1/* 2 * Platform data for the chipidea USB dual role controller 3 */ 4 5#ifndef __LINUX_USB_CHIPIDEA_H 6#define __LINUX_USB_CHIPIDEA_H 7 8#include <linux/extcon.h> 9#include <linux/usb/otg.h> 10 11struct ci_hdrc; 12 13/** 14 * struct ci_hdrc_cable - structure for external connector cable state tracking 15 * @state: current state of the line 16 * @changed: set to true when extcon event happen 17 * @edev: device which generate events 18 * @ci: driver state of the chipidea device 19 * @nb: hold event notification callback 20 * @conn: used for notification registration 21 */ 22struct ci_hdrc_cable { 23 bool state; 24 bool changed; 25 struct extcon_dev *edev; 26 struct ci_hdrc *ci; 27 struct notifier_block nb; 28}; 29 30struct ci_hdrc_platform_data { 31 const char *name; 32 /* offset of the capability registers */ 33 uintptr_t capoffset; 34 unsigned power_budget; 35 struct phy *phy; 36 /* old usb_phy interface */ 37 struct usb_phy *usb_phy; 38 enum usb_phy_interface phy_mode; 39 unsigned long flags; 40#define CI_HDRC_REGS_SHARED BIT(0) 41#define CI_HDRC_DISABLE_DEVICE_STREAMING BIT(1) 42#define CI_HDRC_SUPPORTS_RUNTIME_PM BIT(2) 43#define CI_HDRC_DISABLE_HOST_STREAMING BIT(3) 44#define CI_HDRC_DISABLE_STREAMING (CI_HDRC_DISABLE_DEVICE_STREAMING | \ 45 CI_HDRC_DISABLE_HOST_STREAMING) 46 /* 47 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1, 48 * but otg is not supported (no register otgsc). 49 */ 50#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) 51#define CI_HDRC_IMX28_WRITE_FIX BIT(5) 52#define CI_HDRC_FORCE_FULLSPEED BIT(6) 53#define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7) 54#define CI_HDRC_SET_NON_ZERO_TTHA BIT(8) 55#define CI_HDRC_OVERRIDE_AHB_BURST BIT(9) 56#define CI_HDRC_OVERRIDE_TX_BURST BIT(10) 57#define CI_HDRC_OVERRIDE_RX_BURST BIT(11) 58 enum usb_dr_mode dr_mode; 59#define CI_HDRC_CONTROLLER_RESET_EVENT 0 60#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 61 void (*notify_event) (struct ci_hdrc *ci, unsigned event); 62 struct regulator *reg_vbus; 63 struct usb_otg_caps ci_otg_caps; 64 bool tpl_support; 65 /* interrupt threshold setting */ 66 u32 itc_setting; 67 u32 ahb_burst_config; 68 u32 tx_burst_size; 69 u32 rx_burst_size; 70 71 /* VBUS and ID signal state tracking, using extcon framework */ 72 struct ci_hdrc_cable vbus_extcon; 73 struct ci_hdrc_cable id_extcon; 74 u32 phy_clkgate_delay_us; 75}; 76 77/* Default offset of capability registers */ 78#define DEF_CAPOFFSET 0x100 79 80/* Add ci hdrc device */ 81struct platform_device *ci_hdrc_add_device(struct device *dev, 82 struct resource *res, int nres, 83 struct ci_hdrc_platform_data *platdata); 84/* Remove ci hdrc device */ 85void ci_hdrc_remove_device(struct platform_device *pdev); 86 87#endif 88