1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Platform data for the chipidea USB dual role controller
6 #ifndef __LINUX_USB_CHIPIDEA_H
7 #define __LINUX_USB_CHIPIDEA_H
9 #include <linux/extcon.h>
10 #include <linux/usb/otg.h>
15 * struct ci_hdrc_cable - structure for external connector cable state tracking
16 * @connected: true if cable is connected, false otherwise
17 * @changed: set to true when extcon event happen
18 * @enabled: set to true if we've enabled the vbus or id interrupt
19 * @edev: device which generate events
20 * @ci: driver state of the chipidea device
21 * @nb: hold event notification callback
22 * @conn: used for notification registration
24 struct ci_hdrc_cable
{
28 struct extcon_dev
*edev
;
30 struct notifier_block nb
;
33 struct ci_hdrc_platform_data
{
35 /* offset of the capability registers */
37 unsigned power_budget
;
39 /* old usb_phy interface */
40 struct usb_phy
*usb_phy
;
41 enum usb_phy_interface phy_mode
;
43 #define CI_HDRC_REGS_SHARED BIT(0)
44 #define CI_HDRC_DISABLE_DEVICE_STREAMING BIT(1)
45 #define CI_HDRC_SUPPORTS_RUNTIME_PM BIT(2)
46 #define CI_HDRC_DISABLE_HOST_STREAMING BIT(3)
47 #define CI_HDRC_DISABLE_STREAMING (CI_HDRC_DISABLE_DEVICE_STREAMING | \
48 CI_HDRC_DISABLE_HOST_STREAMING)
50 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
51 * but otg is not supported (no register otgsc).
53 #define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
54 #define CI_HDRC_IMX28_WRITE_FIX BIT(5)
55 #define CI_HDRC_FORCE_FULLSPEED BIT(6)
56 #define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7)
57 #define CI_HDRC_SET_NON_ZERO_TTHA BIT(8)
58 #define CI_HDRC_OVERRIDE_AHB_BURST BIT(9)
59 #define CI_HDRC_OVERRIDE_TX_BURST BIT(10)
60 #define CI_HDRC_OVERRIDE_RX_BURST BIT(11)
61 #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */
62 #define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13)
63 enum usb_dr_mode dr_mode
;
64 #define CI_HDRC_CONTROLLER_RESET_EVENT 0
65 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
66 int (*notify_event
) (struct ci_hdrc
*ci
, unsigned event
);
67 struct regulator
*reg_vbus
;
68 struct usb_otg_caps ci_otg_caps
;
70 /* interrupt threshold setting */
76 /* VBUS and ID signal state tracking, using extcon framework */
77 struct ci_hdrc_cable vbus_extcon
;
78 struct ci_hdrc_cable id_extcon
;
79 u32 phy_clkgate_delay_us
;
82 /* Default offset of capability registers */
83 #define DEF_CAPOFFSET 0x100
85 /* Add ci hdrc device */
86 struct platform_device
*ci_hdrc_add_device(struct device
*dev
,
87 struct resource
*res
, int nres
,
88 struct ci_hdrc_platform_data
*platdata
);
89 /* Remove ci hdrc device */
90 void ci_hdrc_remove_device(struct platform_device
*pdev
);