1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#ifndef RENESAS_USB_H
18#define RENESAS_USB_H
19#include <linux/platform_device.h>
20#include <linux/usb/ch9.h>
21
22
23
24
25
26
27enum {
28 USBHS_HOST = 0,
29 USBHS_GADGET,
30 USBHS_MAX,
31};
32
33
34
35
36
37
38
39
40struct renesas_usbhs_driver_callback {
41 int (*notify_hotplug)(struct platform_device *pdev);
42};
43
44
45
46
47
48
49struct renesas_usbhs_platform_callback {
50
51
52
53
54
55
56
57 int (*hardware_init)(struct platform_device *pdev);
58
59
60
61
62
63
64
65 int (*hardware_exit)(struct platform_device *pdev);
66
67
68
69
70
71
72 int (*power_ctrl)(struct platform_device *pdev,
73 void __iomem *base, int enable);
74
75
76
77
78
79
80 int (*phy_reset)(struct platform_device *pdev);
81
82
83
84
85
86
87 int (*get_id)(struct platform_device *pdev);
88
89
90
91
92 int (*get_vbus)(struct platform_device *pdev);
93
94
95
96
97
98
99 int (*set_vbus)(struct platform_device *pdev, int enable);
100};
101
102
103
104
105
106
107
108
109struct renesas_usbhs_driver_pipe_config {
110 u8 type;
111 u16 bufsize;
112 u8 bufnum;
113 bool double_buf;
114};
115#define RENESAS_USBHS_PIPE(_type, _size, _num, _double_buf) { \
116 .type = (_type), \
117 .bufsize = (_size), \
118 .bufnum = (_num), \
119 .double_buf = (_double_buf), \
120 }
121
122struct renesas_usbhs_driver_param {
123
124
125
126 struct renesas_usbhs_driver_pipe_config *pipe_configs;
127 int pipe_size;
128
129
130
131
132
133
134
135
136 int buswait_bwait;
137
138
139
140
141
142
143 int detection_delay;
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 int d0_tx_id;
159 int d0_rx_id;
160 int d1_tx_id;
161 int d1_rx_id;
162 int d2_tx_id;
163 int d2_rx_id;
164 int d3_tx_id;
165 int d3_rx_id;
166
167
168
169
170
171
172 int pio_dma_border;
173
174 uintptr_t type;
175 u32 enable_gpio;
176
177
178
179
180 u32 has_otg:1;
181 u32 has_sudmac:1;
182 u32 has_usb_dmac:1;
183#define USBHS_USB_DMAC_XFER_SIZE 32
184};
185
186#define USBHS_TYPE_RCAR_GEN2 1
187#define USBHS_TYPE_RCAR_GEN3 2
188
189
190
191
192
193
194struct renesas_usbhs_platform_info {
195
196
197
198
199
200
201 struct renesas_usbhs_platform_callback platform_callback;
202
203
204
205
206
207 struct renesas_usbhs_driver_callback driver_callback;
208
209
210
211
212
213
214 struct renesas_usbhs_driver_param driver_param;
215};
216
217
218
219
220#define renesas_usbhs_get_info(pdev)\
221 ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data)
222
223#define renesas_usbhs_call_notify_hotplug(pdev) \
224 ({ \
225 struct renesas_usbhs_driver_callback *dc; \
226 dc = &(renesas_usbhs_get_info(pdev)->driver_callback); \
227 if (dc && dc->notify_hotplug) \
228 dc->notify_hotplug(pdev); \
229 })
230#endif
231