0001
0002
0003
0004
0005
0006 #ifndef __LINUX_USB_CHIPIDEA_H
0007 #define __LINUX_USB_CHIPIDEA_H
0008
0009 #include <linux/extcon.h>
0010 #include <linux/usb/otg.h>
0011
0012 struct ci_hdrc;
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 struct ci_hdrc_cable {
0025 bool connected;
0026 bool changed;
0027 bool enabled;
0028 struct extcon_dev *edev;
0029 struct ci_hdrc *ci;
0030 struct notifier_block nb;
0031 };
0032
0033 struct ci_hdrc_platform_data {
0034 const char *name;
0035
0036 uintptr_t capoffset;
0037 unsigned power_budget;
0038 struct phy *phy;
0039
0040 struct usb_phy *usb_phy;
0041 enum usb_phy_interface phy_mode;
0042 unsigned long flags;
0043 #define CI_HDRC_REGS_SHARED BIT(0)
0044 #define CI_HDRC_DISABLE_DEVICE_STREAMING BIT(1)
0045 #define CI_HDRC_SUPPORTS_RUNTIME_PM BIT(2)
0046 #define CI_HDRC_DISABLE_HOST_STREAMING BIT(3)
0047 #define CI_HDRC_DISABLE_STREAMING (CI_HDRC_DISABLE_DEVICE_STREAMING | \
0048 CI_HDRC_DISABLE_HOST_STREAMING)
0049
0050
0051
0052
0053 #define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
0054 #define CI_HDRC_IMX28_WRITE_FIX BIT(5)
0055 #define CI_HDRC_FORCE_FULLSPEED BIT(6)
0056 #define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7)
0057 #define CI_HDRC_SET_NON_ZERO_TTHA BIT(8)
0058 #define CI_HDRC_OVERRIDE_AHB_BURST BIT(9)
0059 #define CI_HDRC_OVERRIDE_TX_BURST BIT(10)
0060 #define CI_HDRC_OVERRIDE_RX_BURST BIT(11)
0061 #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12)
0062 #define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13)
0063 #define CI_HDRC_IMX_IS_HSIC BIT(14)
0064 #define CI_HDRC_PMQOS BIT(15)
0065 enum usb_dr_mode dr_mode;
0066 #define CI_HDRC_CONTROLLER_RESET_EVENT 0
0067 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
0068 #define CI_HDRC_IMX_HSIC_ACTIVE_EVENT 2
0069 #define CI_HDRC_IMX_HSIC_SUSPEND_EVENT 3
0070 #define CI_HDRC_CONTROLLER_VBUS_EVENT 4
0071 int (*notify_event) (struct ci_hdrc *ci, unsigned event);
0072 struct regulator *reg_vbus;
0073 struct usb_otg_caps ci_otg_caps;
0074 bool tpl_support;
0075
0076 u32 itc_setting;
0077 u32 ahb_burst_config;
0078 u32 tx_burst_size;
0079 u32 rx_burst_size;
0080
0081
0082 struct ci_hdrc_cable vbus_extcon;
0083 struct ci_hdrc_cable id_extcon;
0084 u32 phy_clkgate_delay_us;
0085
0086
0087 struct pinctrl *pctl;
0088 struct pinctrl_state *pins_default;
0089 struct pinctrl_state *pins_host;
0090 struct pinctrl_state *pins_device;
0091
0092
0093 int (*hub_control)(struct ci_hdrc *ci, u16 typeReq, u16 wValue,
0094 u16 wIndex, char *buf, u16 wLength,
0095 bool *done, unsigned long *flags);
0096 void (*enter_lpm)(struct ci_hdrc *ci, bool enable);
0097 };
0098
0099
0100 #define DEF_CAPOFFSET 0x100
0101
0102
0103 struct platform_device *ci_hdrc_add_device(struct device *dev,
0104 struct resource *res, int nres,
0105 struct ci_hdrc_platform_data *platdata);
0106
0107 void ci_hdrc_remove_device(struct platform_device *pdev);
0108
0109 enum usb_dr_mode ci_hdrc_query_available_role(struct platform_device *pdev);
0110
0111 #endif