License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-block.git] / include / linux / usb / chipidea.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
e443b333
AS
2/*
3 * Platform data for the chipidea USB dual role controller
4 */
5
6#ifndef __LINUX_USB_CHIPIDEA_H
7#define __LINUX_USB_CHIPIDEA_H
8
3ecb3e09 9#include <linux/extcon.h>
a2c3d690
RZ
10#include <linux/usb/otg.h>
11
8e22978c 12struct ci_hdrc;
3ecb3e09
II
13
14/**
15 * struct ci_hdrc_cable - structure for external connector cable state tracking
5cc49268 16 * @connected: true if cable is connected, false otherwise
3ecb3e09 17 * @changed: set to true when extcon event happen
a89b94b5 18 * @enabled: set to true if we've enabled the vbus or id interrupt
3ecb3e09
II
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
23 */
24struct ci_hdrc_cable {
5cc49268 25 bool connected;
3ecb3e09 26 bool changed;
a89b94b5 27 bool enabled;
3ecb3e09
II
28 struct extcon_dev *edev;
29 struct ci_hdrc *ci;
30 struct notifier_block nb;
31};
32
8e22978c 33struct ci_hdrc_platform_data {
e443b333
AS
34 const char *name;
35 /* offset of the capability registers */
36 uintptr_t capoffset;
bd841986 37 unsigned power_budget;
1e5e2d3d
AT
38 struct phy *phy;
39 /* old usb_phy interface */
ef44cb42 40 struct usb_phy *usb_phy;
40dcd0e8 41 enum usb_phy_interface phy_mode;
e443b333 42 unsigned long flags;
8e22978c 43#define CI_HDRC_REGS_SHARED BIT(0)
8022d3d5 44#define CI_HDRC_DISABLE_DEVICE_STREAMING BIT(1)
1f874edc 45#define CI_HDRC_SUPPORTS_RUNTIME_PM BIT(2)
8022d3d5
PC
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)
577b232f
PC
49 /*
50 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
51 * but otg is not supported (no register otgsc).
52 */
53#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
ed8f8318 54#define CI_HDRC_IMX28_WRITE_FIX BIT(5)
4f6743d5 55#define CI_HDRC_FORCE_FULLSPEED BIT(6)
6adb9b7b 56#define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7)
28362673 57#define CI_HDRC_SET_NON_ZERO_TTHA BIT(8)
65668718 58#define CI_HDRC_OVERRIDE_AHB_BURST BIT(9)
96625ead
PC
59#define CI_HDRC_OVERRIDE_TX_BURST BIT(10)
60#define CI_HDRC_OVERRIDE_RX_BURST BIT(11)
8feb3680 61#define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */
581821ae 62#define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13)
691962d1 63 enum usb_dr_mode dr_mode;
8e22978c
AS
64#define CI_HDRC_CONTROLLER_RESET_EVENT 0
65#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
11893dae 66 int (*notify_event) (struct ci_hdrc *ci, unsigned event);
1542d9c3 67 struct regulator *reg_vbus;
79742351 68 struct usb_otg_caps ci_otg_caps;
f6a9ff07 69 bool tpl_support;
df96ed8d
PC
70 /* interrupt threshold setting */
71 u32 itc_setting;
65668718 72 u32 ahb_burst_config;
96625ead
PC
73 u32 tx_burst_size;
74 u32 rx_burst_size;
3ecb3e09
II
75
76 /* VBUS and ID signal state tracking, using extcon framework */
77 struct ci_hdrc_cable vbus_extcon;
78 struct ci_hdrc_cable id_extcon;
1fbf4628 79 u32 phy_clkgate_delay_us;
e443b333
AS
80};
81
82/* Default offset of capability registers */
83#define DEF_CAPOFFSET 0x100
84
8e22978c
AS
85/* Add ci hdrc device */
86struct platform_device *ci_hdrc_add_device(struct device *dev,
cbc6dc2a 87 struct resource *res, int nres,
8e22978c
AS
88 struct ci_hdrc_platform_data *platdata);
89/* Remove ci hdrc device */
90void ci_hdrc_remove_device(struct platform_device *pdev);
cbc6dc2a 91
e443b333 92#endif