--- zzzz-none-000/linux-4.4.271/include/linux/usb/msm_hsusb.h 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/include/linux/usb/msm_hsusb.h 2023-04-19 10:22:30.000000000 +0000 @@ -20,7 +20,23 @@ #include #include +#include +#include #include +/* + * The following are bit fields describing the usb_request.udc_priv word. + * These bit fields are set by function drivers that wish to queue + * usb_requests with sps/bam parameters. + */ +#define MSM_PIPE_ID_MASK (0x1F) +#define MSM_TX_PIPE_ID_OFS (16) +#define MSM_SPS_MODE BIT(5) +#define MSM_IS_FINITE_TRANSFER BIT(6) +#define MSM_PRODUCER BIT(7) +#define MSM_DISABLE_WB BIT(8) +#define MSM_ETD_IOC BIT(9) +#define MSM_INTERNAL_MEM BIT(10) +#define MSM_VENDOR_ID BIT(16) #include /** @@ -57,6 +73,15 @@ #define IDEV_CHG_MAX 1500 #define IUNIT 100 +/* phy related flags */ +#define ENABLE_DP_MANUAL_PULLUP BIT(0) +#define ENABLE_SECONDARY_PHY BIT(1) +#define PHY_HOST_MODE BIT(2) +#define PHY_CHARGER_CONNECTED BIT(3) +#define PHY_VBUS_VALID_OVERRIDE BIT(4) +#define DEVICE_IN_SS_MODE BIT(5) +#define USB_NUM_BUS_CLOCKS 3 + /** * Different states involved in USB charger detection. * @@ -99,6 +124,26 @@ }; /** + * Supported USB controllers + */ + +enum usb_ctrl { + DWC3_CTRL = 0, /* DWC3 controller */ + CI_CTRL, /* ChipIdea controller */ + HSIC_CTRL, /* HSIC controller */ + NUM_CTRL, +}; + + +/** + * USB ID state + */ +enum usb_id_state { + USB_ID_GROUND = 0, + USB_ID_FLOAT, +}; + +/** * struct msm_otg_platform_data - platform device data * for msm_otg driver. * @phy_init_seq: PHY configuration sequence values. Value of -1 is reserved as @@ -197,4 +242,58 @@ struct notifier_block reboot; }; +#ifdef CONFIG_USB_BAM +void msm_bam_set_usb_host_dev(struct device *dev); +void msm_bam_set_hsic_host_dev(struct device *dev); +void msm_bam_wait_for_usb_host_prod_granted(void); +void msm_bam_wait_for_hsic_host_prod_granted(void); +bool msm_bam_hsic_lpm_ok(void); +void msm_bam_usb_host_notify_on_resume(void); +void msm_bam_hsic_host_notify_on_resume(void); +bool msm_bam_hsic_host_pipe_empty(void); +bool msm_usb_bam_enable(enum usb_ctrl ctrl, bool bam_enable); +#else +static inline void msm_bam_set_usb_host_dev(struct device *dev) {} +static inline void msm_bam_set_hsic_host_dev(struct device *dev) {} +static inline void msm_bam_wait_for_usb_host_prod_granted(void) {} +static inline void msm_bam_wait_for_hsic_host_prod_granted(void) {} +static inline bool msm_bam_hsic_lpm_ok(void) { return true; } +static inline void msm_bam_hsic_host_notify_on_resume(void) {} +static inline void msm_bam_usb_host_notify_on_resume(void) {} +static inline bool msm_bam_hsic_host_pipe_empty(void) { return true; } +static inline bool msm_usb_bam_enable(enum usb_ctrl ctrl, bool bam_enable) +{ + return true; +} +#endif + + +/* CONFIG_PM */ +#ifdef CONFIG_PM +static inline int get_pm_runtime_counter(struct device *dev) +{ + return atomic_read(&dev->power.usage_count); +} +#else /* !CONFIG_PM */ +static inline int get_pm_runtime_counter(struct device *dev) { return -ENOSYS; } +#endif + +#ifdef CONFIG_USB_CI13XXX_MSM +void msm_hw_bam_disable(bool bam_disable); +void msm_usb_irq_disable(bool disable); +#else +static inline void msm_hw_bam_disable(bool bam_disable) +{ +} + +static inline void msm_usb_irq_disable(bool disable) +{ +} +#endif + +int msm_ep_config(struct usb_ep *ep, struct usb_request *request); +int msm_ep_unconfig(struct usb_ep *ep); +int msm_data_fifo_config(struct usb_ep *ep, phys_addr_t addr, u32 size, + u8 dst_pipe_idx); + #endif