1 /* SPDX-License-Identifier: GPL-2.0 */
3 * This is used to for host and peripheral modes of the driver for
4 * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC.
6 * Board initialization should put one of these into dev->platform_data,
7 * probably on some platform_device named "musb-hdrc". It encapsulates
8 * key configuration differences between boards.
11 #ifndef __LINUX_USB_MUSB_H
12 #define __LINUX_USB_MUSB_H
14 /* The USB role is defined by the connector used on the board, so long as
15 * standards are being followed. (Developer boards sometimes won't.)
19 MUSB_HOST
, /* A or Mini-A connector */
20 MUSB_PERIPHERAL
, /* B or Mini-B connector */
21 MUSB_OTG
/* Mini-AB connector */
26 enum musb_fifo_style
{
30 } __attribute__ ((packed
));
35 } __attribute__ ((packed
));
37 struct musb_fifo_cfg
{
39 enum musb_fifo_style style
;
40 enum musb_buf_mode mode
;
44 #define MUSB_EP_FIFO(ep, st, m, pkt) \
52 #define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \
53 MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
55 #define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \
56 MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
58 struct musb_hdrc_eps_bits
{
63 struct musb_hdrc_config
{
64 struct musb_fifo_cfg
*fifo_cfg
; /* board fifo configuration */
65 unsigned fifo_cfg_size
; /* size of the fifo configuration */
67 /* MUSB configuration-specific details */
68 unsigned multipoint
:1; /* multipoint device */
69 unsigned dyn_fifo
:1 __deprecated
; /* supports dynamic fifo sizing */
71 /* need to explicitly de-assert the port reset after resume? */
72 unsigned host_port_deassert_reset_at_resume
:1;
74 u8 num_eps
; /* number of endpoints _with_ ep0 */
75 u8 ram_bits
; /* ram address size */
80 struct musb_hdrc_platform_data
{
81 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
87 /* (HOST or OTG) switch VBUS on/off */
88 int (*set_vbus
)(struct device
*dev
, int is_on
);
90 /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
93 /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */
96 /* (HOST or OTG) msec/2 after VBUS on till power good */
99 /* (HOST or OTG) program PHY for external Vbus */
102 /* MUSB configuration-specific details */
103 const struct musb_hdrc_config
*config
;
105 /* Architecture specific board data */
108 /* Platform specific struct musb_ops pointer */
109 const void *platform_ops
;
112 enum musb_vbus_id_status
{
120 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
121 int musb_mailbox(enum musb_vbus_id_status status
);
123 static inline int musb_mailbox(enum musb_vbus_id_status status
)
129 /* TUSB 6010 support */
131 #define TUSB6010_OSCCLK_60 16667 /* psec/clk @ 60.0 MHz */
132 #define TUSB6010_REFCLK_24 41667 /* psec/clk @ 24.0 MHz XI */
133 #define TUSB6010_REFCLK_19 52083 /* psec/clk @ 19.2 MHz CLKIN */
135 #endif /* __LINUX_USB_MUSB_H */