1
2
3
4
5
6
7
8
9
10
11#ifndef __LINUX_USB_MUSB_H
12#define __LINUX_USB_MUSB_H
13
14
15
16
17enum musb_mode {
18 MUSB_UNDEFINED = 0,
19 MUSB_HOST,
20 MUSB_PERIPHERAL,
21 MUSB_OTG
22};
23
24struct clk;
25
26enum musb_fifo_style {
27 FIFO_RXTX,
28 FIFO_TX,
29 FIFO_RX
30} __attribute__ ((packed));
31
32enum musb_buf_mode {
33 BUF_SINGLE,
34 BUF_DOUBLE
35} __attribute__ ((packed));
36
37struct musb_fifo_cfg {
38 u8 hw_ep_num;
39 enum musb_fifo_style style;
40 enum musb_buf_mode mode;
41 u16 maxpacket;
42};
43
44#define MUSB_EP_FIFO(ep, st, m, pkt) \
45{ \
46 .hw_ep_num = ep, \
47 .style = st, \
48 .mode = m, \
49 .maxpacket = pkt, \
50}
51
52#define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \
53 MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
54
55#define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \
56 MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
57
58struct musb_hdrc_eps_bits {
59 const char name[16];
60 u8 bits;
61};
62
63struct musb_hdrc_config {
64 struct musb_fifo_cfg *fifo_cfg;
65 unsigned fifo_cfg_size;
66
67
68 unsigned multipoint:1;
69 unsigned dyn_fifo:1 __deprecated;
70 unsigned soft_con:1 __deprecated;
71 unsigned utm_16:1 __deprecated;
72 unsigned big_endian:1;
73 unsigned mult_bulk_tx:1;
74 unsigned mult_bulk_rx:1;
75 unsigned high_iso_tx:1;
76 unsigned high_iso_rx:1;
77 unsigned dma:1 __deprecated;
78 unsigned vendor_req:1 __deprecated;
79
80
81 unsigned host_port_deassert_reset_at_resume:1;
82
83 u8 num_eps;
84 u8 dma_channels __deprecated;
85 u8 dyn_fifo_size;
86 u8 vendor_ctrl __deprecated;
87 u8 vendor_stat __deprecated;
88 u8 dma_req_chan __deprecated;
89 u8 ram_bits;
90
91 struct musb_hdrc_eps_bits *eps_bits __deprecated;
92#ifdef CONFIG_BLACKFIN
93
94 unsigned int gpio_vrsel;
95 unsigned int gpio_vrsel_active;
96
97 unsigned char clkin;
98#endif
99 u32 maximum_speed;
100};
101
102struct musb_hdrc_platform_data {
103
104 u8 mode;
105
106
107 const char *clock;
108
109
110 int (*set_vbus)(struct device *dev, int is_on);
111
112
113 u8 power;
114
115
116 u8 min_power;
117
118
119 u8 potpgt;
120
121
122 unsigned extvbus:1;
123
124
125 int (*set_power)(int state);
126
127
128 const struct musb_hdrc_config *config;
129
130
131 void *board_data;
132
133
134 const void *platform_ops;
135};
136
137enum musb_vbus_id_status {
138 MUSB_UNKNOWN = 0,
139 MUSB_ID_GROUND,
140 MUSB_ID_FLOAT,
141 MUSB_VBUS_VALID,
142 MUSB_VBUS_OFF,
143};
144
145#if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
146int musb_mailbox(enum musb_vbus_id_status status);
147#else
148static inline int musb_mailbox(enum musb_vbus_id_status status)
149{
150 return 0;
151}
152#endif
153
154
155
156#define TUSB6010_OSCCLK_60 16667
157#define TUSB6010_REFCLK_24 41667
158#define TUSB6010_REFCLK_19 52083
159
160#ifdef CONFIG_ARCH_OMAP2
161
162extern int __init tusb6010_setup_interface(
163 struct musb_hdrc_platform_data *data,
164 unsigned ps_refclk, unsigned waitpin,
165 unsigned async_cs, unsigned sync_cs,
166 unsigned irq, unsigned dmachan);
167
168extern int tusb6010_platform_retime(unsigned is_refclk);
169
170#endif
171
172#endif
173