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