blob: 2016a2448ccba9d90e49eb0bf4d929a73c087c1b [file] [log] [blame]
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +09001/*
2 * Renesas USB driver
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 */
17#include <linux/delay.h>
18#include <linux/io.h>
19#include "./common.h"
20#include "./pipe.h"
21
Kuninori Morimotod3af90a2011-06-06 14:18:44 +090022#define usbhsf_get_cfifo(p) (&((p)->fifo_info.cfifo))
Kuninori Morimotoe73a9892011-06-06 14:19:03 +090023#define usbhsf_get_d0fifo(p) (&((p)->fifo_info.d0fifo))
24#define usbhsf_get_d1fifo(p) (&((p)->fifo_info.d1fifo))
Kuninori Morimotod3af90a2011-06-06 14:18:44 +090025
Kuninori Morimotod77e3f42011-06-06 14:18:50 +090026#define usbhsf_fifo_is_busy(f) ((f)->pipe) /* see usbhs_pipe_select_fifo */
27
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +090028/*
Kuninori Morimoto4bd04812011-06-06 14:18:07 +090029 * packet info function
30 */
Kuninori Morimoto97664a22011-06-06 14:18:38 +090031static int usbhsf_null_handle(struct usbhs_pkt *pkt, int *is_done)
Kuninori Morimotodad67392011-06-06 14:18:28 +090032{
33 struct usbhs_priv *priv = usbhs_pipe_to_priv(pkt->pipe);
34 struct device *dev = usbhs_priv_to_dev(priv);
35
36 dev_err(dev, "null handler\n");
37
38 return -EINVAL;
39}
40
41static struct usbhs_pkt_handle usbhsf_null_handler = {
42 .prepare = usbhsf_null_handle,
43 .try_run = usbhsf_null_handle,
44};
45
Kuninori Morimoto6acb95d2011-06-06 14:18:16 +090046void usbhs_pkt_init(struct usbhs_pkt *pkt)
Kuninori Morimoto4bd04812011-06-06 14:18:07 +090047{
Kuninori Morimotoe73a9892011-06-06 14:19:03 +090048 pkt->dma = DMA_ADDR_INVALID;
Kuninori Morimoto6acb95d2011-06-06 14:18:16 +090049 INIT_LIST_HEAD(&pkt->node);
50}
51
Kuninori Morimoto659d4952011-06-06 14:18:23 +090052void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
Kuninori Morimotodad67392011-06-06 14:18:28 +090053 struct usbhs_pkt_handle *handler,
Kuninori Morimoto659d4952011-06-06 14:18:23 +090054 void *buf, int len, int zero)
Kuninori Morimoto6acb95d2011-06-06 14:18:16 +090055{
Kuninori Morimotodad67392011-06-06 14:18:28 +090056 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
57 struct device *dev = usbhs_priv_to_dev(priv);
Kuninori Morimoto97664a22011-06-06 14:18:38 +090058 unsigned long flags;
59
60 /******************** spin lock ********************/
61 usbhs_lock(priv, flags);
Kuninori Morimotodad67392011-06-06 14:18:28 +090062
63 if (!handler) {
64 dev_err(dev, "no handler function\n");
65 handler = &usbhsf_null_handler;
66 }
67
Kuninori Morimoto6acb95d2011-06-06 14:18:16 +090068 list_del_init(&pkt->node);
69 list_add_tail(&pkt->node, &pipe->list);
70
Kuninori Morimoto659d4952011-06-06 14:18:23 +090071 pkt->pipe = pipe;
72 pkt->buf = buf;
Kuninori Morimotodad67392011-06-06 14:18:28 +090073 pkt->handler = handler;
Kuninori Morimoto659d4952011-06-06 14:18:23 +090074 pkt->length = len;
75 pkt->zero = zero;
76 pkt->actual = 0;
Kuninori Morimoto97664a22011-06-06 14:18:38 +090077
78 usbhs_unlock(priv, flags);
79 /******************** spin unlock ******************/
Kuninori Morimoto0432eed2011-06-06 14:18:54 +090080
81 usbhs_pkt_start(pipe);
Kuninori Morimoto6acb95d2011-06-06 14:18:16 +090082}
83
Kuninori Morimoto97664a22011-06-06 14:18:38 +090084static void __usbhsf_pkt_del(struct usbhs_pkt *pkt)
Kuninori Morimoto6acb95d2011-06-06 14:18:16 +090085{
86 list_del_init(&pkt->node);
87}
88
Kuninori Morimoto97664a22011-06-06 14:18:38 +090089static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe)
Kuninori Morimoto6acb95d2011-06-06 14:18:16 +090090{
91 if (list_empty(&pipe->list))
92 return NULL;
93
94 return list_entry(pipe->list.next, struct usbhs_pkt, node);
95}
96
Kuninori Morimoto97664a22011-06-06 14:18:38 +090097struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt)
98{
99 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
100 unsigned long flags;
101
102 /******************** spin lock ********************/
103 usbhs_lock(priv, flags);
104
105 if (!pkt)
106 pkt = __usbhsf_pkt_get(pipe);
107
108 if (pkt)
109 __usbhsf_pkt_del(pkt);
110
111 usbhs_unlock(priv, flags);
112 /******************** spin unlock ******************/
113
114 return pkt;
115}
116
117int __usbhs_pkt_handler(struct usbhs_pipe *pipe, int type)
118{
119 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
120 struct usbhs_pipe_info *info = usbhs_priv_to_pipeinfo(priv);
121 struct usbhs_pkt *pkt;
122 struct device *dev = usbhs_priv_to_dev(priv);
123 int (*func)(struct usbhs_pkt *pkt, int *is_done);
124 unsigned long flags;
125 int ret = 0;
126 int is_done = 0;
127
128 /******************** spin lock ********************/
129 usbhs_lock(priv, flags);
130
131 pkt = __usbhsf_pkt_get(pipe);
132 if (!pkt)
133 goto __usbhs_pkt_handler_end;
134
135 switch (type) {
136 case USBHSF_PKT_PREPARE:
137 func = pkt->handler->prepare;
138 break;
139 case USBHSF_PKT_TRY_RUN:
140 func = pkt->handler->try_run;
141 break;
Kuninori Morimotoe73a9892011-06-06 14:19:03 +0900142 case USBHSF_PKT_DMA_DONE:
143 func = pkt->handler->dma_done;
144 break;
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900145 default:
146 dev_err(dev, "unknown pkt hander\n");
147 goto __usbhs_pkt_handler_end;
148 }
149
150 ret = func(pkt, &is_done);
151
152 if (is_done)
153 __usbhsf_pkt_del(pkt);
154
155__usbhs_pkt_handler_end:
156 usbhs_unlock(priv, flags);
157 /******************** spin unlock ******************/
158
Kuninori Morimoto0432eed2011-06-06 14:18:54 +0900159 if (is_done) {
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900160 info->done(pkt);
Kuninori Morimoto0432eed2011-06-06 14:18:54 +0900161 usbhs_pkt_start(pipe);
162 }
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900163
164 return ret;
165}
166
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900167/*
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900168 * irq enable/disable function
169 */
170#define usbhsf_irq_empty_ctrl(p, e) usbhsf_irq_callback_ctrl(p, bempsts, e)
171#define usbhsf_irq_ready_ctrl(p, e) usbhsf_irq_callback_ctrl(p, brdysts, e)
172#define usbhsf_irq_callback_ctrl(pipe, status, enable) \
173 ({ \
174 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); \
175 struct usbhs_mod *mod = usbhs_mod_get_current(priv); \
176 u16 status = (1 << usbhs_pipe_number(pipe)); \
177 if (!mod) \
178 return; \
179 if (enable) \
180 mod->irq_##status |= status; \
181 else \
182 mod->irq_##status &= ~status; \
183 usbhs_irq_callback_update(priv, mod); \
184 })
185
186static void usbhsf_tx_irq_ctrl(struct usbhs_pipe *pipe, int enable)
187{
188 /*
189 * And DCP pipe can NOT use "ready interrupt" for "send"
190 * it should use "empty" interrupt.
191 * see
192 * "Operation" - "Interrupt Function" - "BRDY Interrupt"
193 *
194 * on the other hand, normal pipe can use "ready interrupt" for "send"
195 * even though it is single/double buffer
196 */
197 if (usbhs_pipe_is_dcp(pipe))
198 usbhsf_irq_empty_ctrl(pipe, enable);
199 else
200 usbhsf_irq_ready_ctrl(pipe, enable);
201}
202
203static void usbhsf_rx_irq_ctrl(struct usbhs_pipe *pipe, int enable)
204{
205 usbhsf_irq_ready_ctrl(pipe, enable);
206}
207
208/*
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900209 * FIFO ctrl
210 */
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900211static void usbhsf_send_terminator(struct usbhs_pipe *pipe,
212 struct usbhs_fifo *fifo)
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900213{
214 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
215
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900216 usbhs_bset(priv, fifo->ctr, BVAL, BVAL);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900217}
218
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900219static int usbhsf_fifo_barrier(struct usbhs_priv *priv,
220 struct usbhs_fifo *fifo)
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900221{
222 int timeout = 1024;
223
224 do {
225 /* The FIFO port is accessible */
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900226 if (usbhs_read(priv, fifo->ctr) & FRDY)
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900227 return 0;
228
229 udelay(10);
230 } while (timeout--);
231
232 return -EBUSY;
233}
234
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900235static void usbhsf_fifo_clear(struct usbhs_pipe *pipe,
236 struct usbhs_fifo *fifo)
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900237{
238 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
239
240 if (!usbhs_pipe_is_dcp(pipe))
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900241 usbhsf_fifo_barrier(priv, fifo);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900242
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900243 usbhs_write(priv, fifo->ctr, BCLR);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900244}
245
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900246static int usbhsf_fifo_rcv_len(struct usbhs_priv *priv,
247 struct usbhs_fifo *fifo)
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900248{
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900249 return usbhs_read(priv, fifo->ctr) & DTLN_MASK;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900250}
251
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900252static void usbhsf_fifo_unselect(struct usbhs_pipe *pipe,
253 struct usbhs_fifo *fifo)
254{
255 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
256
257 usbhs_pipe_select_fifo(pipe, NULL);
258 usbhs_write(priv, fifo->sel, 0);
259}
260
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900261static int usbhsf_fifo_select(struct usbhs_pipe *pipe,
262 struct usbhs_fifo *fifo,
263 int write)
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900264{
265 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
266 struct device *dev = usbhs_priv_to_dev(priv);
267 int timeout = 1024;
268 u16 mask = ((1 << 5) | 0xF); /* mask of ISEL | CURPIPE */
269 u16 base = usbhs_pipe_number(pipe); /* CURPIPE */
270
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900271 if (usbhs_pipe_is_busy(pipe) ||
272 usbhsf_fifo_is_busy(fifo))
273 return -EBUSY;
274
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900275 if (usbhs_pipe_is_dcp(pipe))
276 base |= (1 == write) << 5; /* ISEL */
277
278 /* "base" will be used below */
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900279 usbhs_write(priv, fifo->sel, base | MBW_32);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900280
281 /* check ISEL and CURPIPE value */
282 while (timeout--) {
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900283 if (base == (mask & usbhs_read(priv, fifo->sel))) {
284 usbhs_pipe_select_fifo(pipe, fifo);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900285 return 0;
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900286 }
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900287 udelay(10);
288 }
289
290 dev_err(dev, "fifo select error\n");
291
292 return -EIO;
293}
294
295/*
296 * PIO fifo functions
297 */
Kuninori Morimoto0cb7e612011-06-06 14:18:58 +0900298static int usbhsf_pio_try_push(struct usbhs_pkt *pkt, int *is_done)
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900299{
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900300 struct usbhs_pipe *pipe = pkt->pipe;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900301 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900302 struct device *dev = usbhs_priv_to_dev(priv);
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900303 struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv); /* CFIFO */
304 void __iomem *addr = priv->base + fifo->port;
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900305 u8 *buf;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900306 int maxp = usbhs_pipe_get_maxpacket(pipe);
307 int total_len;
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900308 int i, ret, len;
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900309 int is_short;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900310
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900311 ret = usbhsf_fifo_select(pipe, fifo, 1);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900312 if (ret < 0)
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900313 return 0;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900314
Kuninori Morimotodad67392011-06-06 14:18:28 +0900315 ret = usbhs_pipe_is_accessible(pipe);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900316 if (ret < 0)
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900317 goto usbhs_fifo_write_busy;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900318
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900319 ret = usbhsf_fifo_barrier(priv, fifo);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900320 if (ret < 0)
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900321 goto usbhs_fifo_write_busy;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900322
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900323 buf = pkt->buf + pkt->actual;
324 len = pkt->length - pkt->actual;
325 len = min(len, maxp);
326 total_len = len;
327 is_short = total_len < maxp;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900328
329 /*
330 * FIXME
331 *
332 * 32-bit access only
333 */
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900334 if (len >= 4 && !((unsigned long)buf & 0x03)) {
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900335 iowrite32_rep(addr, buf, len / 4);
336 len %= 4;
337 buf += total_len - len;
338 }
339
340 /* the rest operation */
341 for (i = 0; i < len; i++)
342 iowrite8(buf[i], addr + (0x03 - (i & 0x03)));
343
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900344 /*
345 * variable update
346 */
347 pkt->actual += total_len;
348
349 if (pkt->actual < pkt->length)
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900350 *is_done = 0; /* there are remainder data */
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900351 else if (is_short)
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900352 *is_done = 1; /* short packet */
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900353 else
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900354 *is_done = !pkt->zero; /* send zero packet ? */
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900355
356 /*
357 * pipe/irq handling
358 */
359 if (is_short)
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900360 usbhsf_send_terminator(pipe, fifo);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900361
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900362 usbhsf_tx_irq_ctrl(pipe, !*is_done);
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900363 usbhs_pipe_enable(pipe);
364
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900365 dev_dbg(dev, " send %d (%d/ %d/ %d/ %d)\n",
366 usbhs_pipe_number(pipe),
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900367 pkt->length, pkt->actual, *is_done, pkt->zero);
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900368
369 /*
370 * Transmission end
371 */
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900372 if (*is_done) {
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900373 if (usbhs_pipe_is_dcp(pipe))
374 usbhs_dcp_control_transfer_done(pipe);
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900375 }
376
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900377 usbhsf_fifo_unselect(pipe, fifo);
378
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900379 return 0;
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900380
381usbhs_fifo_write_busy:
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900382 usbhsf_fifo_unselect(pipe, fifo);
383
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900384 /*
385 * pipe is busy.
386 * retry in interrupt
387 */
388 usbhsf_tx_irq_ctrl(pipe, 1);
389
390 return ret;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900391}
392
Kuninori Morimoto0cb7e612011-06-06 14:18:58 +0900393struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = {
394 .prepare = usbhsf_pio_try_push,
395 .try_run = usbhsf_pio_try_push,
Kuninori Morimotodad67392011-06-06 14:18:28 +0900396};
397
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900398static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done)
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900399{
Kuninori Morimotodad67392011-06-06 14:18:28 +0900400 struct usbhs_pipe *pipe = pkt->pipe;
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900401
402 if (usbhs_pipe_is_busy(pipe))
403 return 0;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900404
405 /*
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900406 * pipe enable to prepare packet receive
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900407 */
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900408
409 usbhs_pipe_enable(pipe);
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900410 usbhsf_rx_irq_ctrl(pipe, 1);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900411
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900412 return 0;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900413}
414
Kuninori Morimoto0cb7e612011-06-06 14:18:58 +0900415static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done)
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900416{
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900417 struct usbhs_pipe *pipe = pkt->pipe;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900418 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900419 struct device *dev = usbhs_priv_to_dev(priv);
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900420 struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv); /* CFIFO */
421 void __iomem *addr = priv->base + fifo->port;
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900422 u8 *buf;
423 u32 data = 0;
424 int maxp = usbhs_pipe_get_maxpacket(pipe);
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900425 int rcv_len, len;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900426 int i, ret;
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900427 int total_len = 0;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900428
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900429 ret = usbhsf_fifo_select(pipe, fifo, 0);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900430 if (ret < 0)
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900431 return 0;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900432
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900433 ret = usbhsf_fifo_barrier(priv, fifo);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900434 if (ret < 0)
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900435 goto usbhs_fifo_read_busy;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900436
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900437 rcv_len = usbhsf_fifo_rcv_len(priv, fifo);
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900438
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900439 buf = pkt->buf + pkt->actual;
440 len = pkt->length - pkt->actual;
441 len = min(len, rcv_len);
442 total_len = len;
443
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900444 /*
445 * Buffer clear if Zero-Length packet
446 *
447 * see
448 * "Operation" - "FIFO Buffer Memory" - "FIFO Port Function"
449 */
450 if (0 == rcv_len) {
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900451 usbhsf_fifo_clear(pipe, fifo);
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900452 goto usbhs_fifo_read_end;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900453 }
454
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900455 /*
456 * FIXME
457 *
458 * 32-bit access only
459 */
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900460 if (len >= 4 && !((unsigned long)buf & 0x03)) {
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900461 ioread32_rep(addr, buf, len / 4);
462 len %= 4;
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900463 buf += total_len - len;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900464 }
465
466 /* the rest operation */
467 for (i = 0; i < len; i++) {
468 if (!(i & 0x03))
469 data = ioread32(addr);
470
471 buf[i] = (data >> ((i & 0x03) * 8)) & 0xff;
472 }
473
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900474 pkt->actual += total_len;
475
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900476usbhs_fifo_read_end:
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900477 if ((pkt->actual == pkt->length) || /* receive all data */
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900478 (total_len < maxp)) { /* short packet */
479 *is_done = 1;
480 usbhsf_rx_irq_ctrl(pipe, 0);
481 usbhs_pipe_disable(pipe);
482 }
Kuninori Morimoto659d4952011-06-06 14:18:23 +0900483
484 dev_dbg(dev, " recv %d (%d/ %d/ %d/ %d)\n",
485 usbhs_pipe_number(pipe),
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900486 pkt->length, pkt->actual, *is_done, pkt->zero);
Kuninori Morimoto4bd04812011-06-06 14:18:07 +0900487
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900488usbhs_fifo_read_busy:
489 usbhsf_fifo_unselect(pipe, fifo);
490
491 return ret;
Kuninori Morimotoe8d548d2011-06-06 14:18:03 +0900492}
Kuninori Morimotodad67392011-06-06 14:18:28 +0900493
Kuninori Morimoto0cb7e612011-06-06 14:18:58 +0900494struct usbhs_pkt_handle usbhs_fifo_pio_pop_handler = {
Kuninori Morimotodad67392011-06-06 14:18:28 +0900495 .prepare = usbhsf_prepare_pop,
Kuninori Morimoto0cb7e612011-06-06 14:18:58 +0900496 .try_run = usbhsf_pio_try_pop,
Kuninori Morimotodad67392011-06-06 14:18:28 +0900497};
498
499/*
500 * handler function
501 */
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900502static int usbhsf_ctrl_stage_end(struct usbhs_pkt *pkt, int *is_done)
Kuninori Morimotodad67392011-06-06 14:18:28 +0900503{
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900504 usbhs_dcp_control_transfer_done(pkt->pipe);
Kuninori Morimotodad67392011-06-06 14:18:28 +0900505
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900506 *is_done = 1;
Kuninori Morimotodad67392011-06-06 14:18:28 +0900507
508 return 0;
509}
510
511struct usbhs_pkt_handle usbhs_ctrl_stage_end_handler = {
512 .prepare = usbhsf_ctrl_stage_end,
513 .try_run = usbhsf_ctrl_stage_end,
514};
515
516/*
Kuninori Morimotoe73a9892011-06-06 14:19:03 +0900517 * DMA fifo functions
518 */
519static struct dma_chan *usbhsf_dma_chan_get(struct usbhs_fifo *fifo,
520 struct usbhs_pkt *pkt)
521{
522 if (&usbhs_fifo_dma_push_handler == pkt->handler)
523 return fifo->tx_chan;
524
525 if (&usbhs_fifo_dma_pop_handler == pkt->handler)
526 return fifo->rx_chan;
527
528 return NULL;
529}
530
531static struct usbhs_fifo *usbhsf_get_dma_fifo(struct usbhs_priv *priv,
532 struct usbhs_pkt *pkt)
533{
534 struct usbhs_fifo *fifo;
535
536 /* DMA :: D0FIFO */
537 fifo = usbhsf_get_d0fifo(priv);
538 if (usbhsf_dma_chan_get(fifo, pkt) &&
539 !usbhsf_fifo_is_busy(fifo))
540 return fifo;
541
542 /* DMA :: D1FIFO */
543 fifo = usbhsf_get_d1fifo(priv);
544 if (usbhsf_dma_chan_get(fifo, pkt) &&
545 !usbhsf_fifo_is_busy(fifo))
546 return fifo;
547
548 return NULL;
549}
550
551#define usbhsf_dma_start(p, f) __usbhsf_dma_ctrl(p, f, DREQE)
552#define usbhsf_dma_stop(p, f) __usbhsf_dma_ctrl(p, f, 0)
553static void __usbhsf_dma_ctrl(struct usbhs_pipe *pipe,
554 struct usbhs_fifo *fifo,
555 u16 dreqe)
556{
557 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
558
559 usbhs_bset(priv, fifo->sel, DREQE, dreqe);
560}
561
562#define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1)
563#define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0)
564static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map)
565{
566 struct usbhs_pipe *pipe = pkt->pipe;
567 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
568 struct usbhs_pipe_info *info = usbhs_priv_to_pipeinfo(priv);
569
570 return info->dma_map_ctrl(pkt, map);
571}
572
573static void usbhsf_dma_complete(void *arg);
574static void usbhsf_dma_prepare_tasklet(unsigned long data)
575{
576 struct usbhs_pkt *pkt = (struct usbhs_pkt *)data;
577 struct usbhs_pipe *pipe = pkt->pipe;
578 struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe);
579 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
580 struct scatterlist sg;
581 struct dma_async_tx_descriptor *desc;
582 struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt);
583 struct device *dev = usbhs_priv_to_dev(priv);
584 enum dma_data_direction dir;
585 dma_cookie_t cookie;
586
587 dir = usbhs_pipe_is_dir_in(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
588
589 sg_init_table(&sg, 1);
590 sg_set_page(&sg, virt_to_page(pkt->dma),
591 pkt->length, offset_in_page(pkt->dma));
592 sg_dma_address(&sg) = pkt->dma + pkt->actual;
593 sg_dma_len(&sg) = pkt->trans;
594
595 desc = chan->device->device_prep_slave_sg(chan, &sg, 1, dir,
596 DMA_PREP_INTERRUPT |
597 DMA_CTRL_ACK);
598 if (!desc)
599 return;
600
601 desc->callback = usbhsf_dma_complete;
602 desc->callback_param = pipe;
603
604 cookie = desc->tx_submit(desc);
605 if (cookie < 0) {
606 dev_err(dev, "Failed to submit dma descriptor\n");
607 return;
608 }
609
610 dev_dbg(dev, " %s %d (%d/ %d)\n",
611 fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero);
612
613 usbhsf_dma_start(pipe, fifo);
614 dma_async_issue_pending(chan);
615}
616
617static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done)
618{
619 struct usbhs_pipe *pipe = pkt->pipe;
620 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
621 struct usbhs_fifo *fifo;
622 int len = pkt->length - pkt->actual;
623 int ret;
624
625 if (usbhs_pipe_is_busy(pipe))
626 return 0;
627
628 /* use PIO if packet is less than pio_dma_border or pipe is DCP */
629 if ((len < usbhs_get_dparam(priv, pio_dma_border)) ||
630 usbhs_pipe_is_dcp(pipe))
631 goto usbhsf_pio_prepare_push;
632
633 if (len % 4) /* 32bit alignment */
634 goto usbhsf_pio_prepare_push;
635
636 /* get enable DMA fifo */
637 fifo = usbhsf_get_dma_fifo(priv, pkt);
638 if (!fifo)
639 goto usbhsf_pio_prepare_push;
640
641 if (usbhsf_dma_map(pkt) < 0)
642 goto usbhsf_pio_prepare_push;
643
644 ret = usbhsf_fifo_select(pipe, fifo, 0);
645 if (ret < 0)
646 goto usbhsf_pio_prepare_push_unmap;
647
648 pkt->trans = len;
649
650 tasklet_init(&fifo->tasklet,
651 usbhsf_dma_prepare_tasklet,
652 (unsigned long)pkt);
653
654 tasklet_schedule(&fifo->tasklet);
655
656 return 0;
657
658usbhsf_pio_prepare_push_unmap:
659 usbhsf_dma_unmap(pkt);
660usbhsf_pio_prepare_push:
661 /*
662 * change handler to PIO
663 */
664 pkt->handler = &usbhs_fifo_pio_push_handler;
665
666 return pkt->handler->prepare(pkt, is_done);
667}
668
669static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done)
670{
671 struct usbhs_pipe *pipe = pkt->pipe;
672
673 pkt->actual = pkt->trans;
674
675 *is_done = !pkt->zero; /* send zero packet ? */
676
677 usbhsf_dma_stop(pipe, pipe->fifo);
678 usbhsf_dma_unmap(pkt);
679 usbhsf_fifo_unselect(pipe, pipe->fifo);
680
681 return 0;
682}
683
684struct usbhs_pkt_handle usbhs_fifo_dma_push_handler = {
685 .prepare = usbhsf_dma_prepare_push,
686 .dma_done = usbhsf_dma_push_done,
687};
688
689static int usbhsf_dma_try_pop(struct usbhs_pkt *pkt, int *is_done)
690{
691 struct usbhs_pipe *pipe = pkt->pipe;
692 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
693 struct usbhs_fifo *fifo;
694 int len, ret;
695
696 if (usbhs_pipe_is_busy(pipe))
697 return 0;
698
699 if (usbhs_pipe_is_dcp(pipe))
700 goto usbhsf_pio_prepare_pop;
701
702 /* get enable DMA fifo */
703 fifo = usbhsf_get_dma_fifo(priv, pkt);
704 if (!fifo)
705 goto usbhsf_pio_prepare_pop;
706
707 ret = usbhsf_fifo_select(pipe, fifo, 0);
708 if (ret < 0)
709 goto usbhsf_pio_prepare_pop;
710
711 /* use PIO if packet is less than pio_dma_border */
712 len = usbhsf_fifo_rcv_len(priv, fifo);
713 len = min(pkt->length - pkt->actual, len);
714 if (len % 4) /* 32bit alignment */
715 goto usbhsf_pio_prepare_pop_unselect;
716
717 if (len < usbhs_get_dparam(priv, pio_dma_border))
718 goto usbhsf_pio_prepare_pop_unselect;
719
720 ret = usbhsf_fifo_barrier(priv, fifo);
721 if (ret < 0)
722 goto usbhsf_pio_prepare_pop_unselect;
723
724 if (usbhsf_dma_map(pkt) < 0)
725 goto usbhsf_pio_prepare_pop_unselect;
726
727 /* DMA */
728
729 /*
730 * usbhs_fifo_dma_pop_handler :: prepare
731 * enabled irq to come here.
732 * but it is no longer needed for DMA. disable it.
733 */
734 usbhsf_rx_irq_ctrl(pipe, 0);
735
736 pkt->trans = len;
737
738 tasklet_init(&fifo->tasklet,
739 usbhsf_dma_prepare_tasklet,
740 (unsigned long)pkt);
741
742 tasklet_schedule(&fifo->tasklet);
743
744 return 0;
745
746usbhsf_pio_prepare_pop_unselect:
747 usbhsf_fifo_unselect(pipe, fifo);
748usbhsf_pio_prepare_pop:
749
750 /*
751 * change handler to PIO
752 */
753 pkt->handler = &usbhs_fifo_pio_pop_handler;
754
755 return pkt->handler->try_run(pkt, is_done);
756}
757
758static int usbhsf_dma_pop_done(struct usbhs_pkt *pkt, int *is_done)
759{
760 struct usbhs_pipe *pipe = pkt->pipe;
761 int maxp = usbhs_pipe_get_maxpacket(pipe);
762
763 usbhsf_dma_stop(pipe, pipe->fifo);
764 usbhsf_dma_unmap(pkt);
765 usbhsf_fifo_unselect(pipe, pipe->fifo);
766
767 pkt->actual += pkt->trans;
768
769 if ((pkt->actual == pkt->length) || /* receive all data */
770 (pkt->trans < maxp)) { /* short packet */
771 *is_done = 1;
772 } else {
773 /* re-enable */
774 usbhsf_prepare_pop(pkt, is_done);
775 }
776
777 return 0;
778}
779
780struct usbhs_pkt_handle usbhs_fifo_dma_pop_handler = {
781 .prepare = usbhsf_prepare_pop,
782 .try_run = usbhsf_dma_try_pop,
783 .dma_done = usbhsf_dma_pop_done
784};
785
786/*
787 * DMA setting
788 */
789static bool usbhsf_dma_filter(struct dma_chan *chan, void *param)
790{
791 struct sh_dmae_slave *slave = param;
792
793 /*
794 * FIXME
795 *
796 * usbhs doesn't recognize id = 0 as valid DMA
797 */
798 if (0 == slave->slave_id)
799 return false;
800
801 chan->private = slave;
802
803 return true;
804}
805
806static void usbhsf_dma_quit(struct usbhs_priv *priv, struct usbhs_fifo *fifo)
807{
808 if (fifo->tx_chan)
809 dma_release_channel(fifo->tx_chan);
810 if (fifo->rx_chan)
811 dma_release_channel(fifo->rx_chan);
812
813 fifo->tx_chan = NULL;
814 fifo->rx_chan = NULL;
815}
816
817static void usbhsf_dma_init(struct usbhs_priv *priv,
818 struct usbhs_fifo *fifo)
819{
820 struct device *dev = usbhs_priv_to_dev(priv);
821 dma_cap_mask_t mask;
822
823 dma_cap_zero(mask);
824 dma_cap_set(DMA_SLAVE, mask);
825 fifo->tx_chan = dma_request_channel(mask, usbhsf_dma_filter,
826 &fifo->tx_slave);
827
828 dma_cap_zero(mask);
829 dma_cap_set(DMA_SLAVE, mask);
830 fifo->rx_chan = dma_request_channel(mask, usbhsf_dma_filter,
831 &fifo->rx_slave);
832
833 if (fifo->tx_chan || fifo->rx_chan)
834 dev_info(dev, "enable DMAEngine (%s%s%s)\n",
835 fifo->name,
836 fifo->tx_chan ? "[TX]" : " ",
837 fifo->rx_chan ? "[RX]" : " ");
838}
839
840/*
Kuninori Morimotodad67392011-06-06 14:18:28 +0900841 * irq functions
842 */
843static int usbhsf_irq_empty(struct usbhs_priv *priv,
844 struct usbhs_irq_state *irq_state)
845{
846 struct usbhs_pipe *pipe;
Kuninori Morimotodad67392011-06-06 14:18:28 +0900847 struct device *dev = usbhs_priv_to_dev(priv);
848 int i, ret;
849
850 if (!irq_state->bempsts) {
851 dev_err(dev, "debug %s !!\n", __func__);
852 return -EIO;
853 }
854
855 dev_dbg(dev, "irq empty [0x%04x]\n", irq_state->bempsts);
856
857 /*
858 * search interrupted "pipe"
859 * not "uep".
860 */
861 usbhs_for_each_pipe_with_dcp(pipe, priv, i) {
862 if (!(irq_state->bempsts & (1 << i)))
863 continue;
864
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900865 ret = usbhs_pkt_run(pipe);
Kuninori Morimotodad67392011-06-06 14:18:28 +0900866 if (ret < 0)
867 dev_err(dev, "irq_empty run_error %d : %d\n", i, ret);
868 }
869
870 return 0;
871}
872
873static int usbhsf_irq_ready(struct usbhs_priv *priv,
874 struct usbhs_irq_state *irq_state)
875{
876 struct usbhs_pipe *pipe;
Kuninori Morimotodad67392011-06-06 14:18:28 +0900877 struct device *dev = usbhs_priv_to_dev(priv);
878 int i, ret;
879
880 if (!irq_state->brdysts) {
881 dev_err(dev, "debug %s !!\n", __func__);
882 return -EIO;
883 }
884
885 dev_dbg(dev, "irq ready [0x%04x]\n", irq_state->brdysts);
886
887 /*
888 * search interrupted "pipe"
889 * not "uep".
890 */
891 usbhs_for_each_pipe_with_dcp(pipe, priv, i) {
892 if (!(irq_state->brdysts & (1 << i)))
893 continue;
894
Kuninori Morimoto97664a22011-06-06 14:18:38 +0900895 ret = usbhs_pkt_run(pipe);
Kuninori Morimotodad67392011-06-06 14:18:28 +0900896 if (ret < 0)
897 dev_err(dev, "irq_ready run_error %d : %d\n", i, ret);
898 }
899
900 return 0;
901}
902
Kuninori Morimotoe73a9892011-06-06 14:19:03 +0900903static void usbhsf_dma_complete(void *arg)
904{
905 struct usbhs_pipe *pipe = arg;
906 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
907 struct device *dev = usbhs_priv_to_dev(priv);
908 int ret;
909
910 ret = usbhs_pkt_dmadone(pipe);
911 if (ret < 0)
912 dev_err(dev, "dma_complete run_error %d : %d\n",
913 usbhs_pipe_number(pipe), ret);
914}
915
Kuninori Morimotodad67392011-06-06 14:18:28 +0900916/*
917 * fifo init
918 */
919void usbhs_fifo_init(struct usbhs_priv *priv)
920{
921 struct usbhs_mod *mod = usbhs_mod_get_current(priv);
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900922 struct usbhs_fifo *cfifo = usbhsf_get_cfifo(priv);
Kuninori Morimotoe73a9892011-06-06 14:19:03 +0900923 struct usbhs_fifo *d0fifo = usbhsf_get_d0fifo(priv);
924 struct usbhs_fifo *d1fifo = usbhsf_get_d1fifo(priv);
Kuninori Morimotodad67392011-06-06 14:18:28 +0900925
926 mod->irq_empty = usbhsf_irq_empty;
927 mod->irq_ready = usbhsf_irq_ready;
928 mod->irq_bempsts = 0;
929 mod->irq_brdysts = 0;
Kuninori Morimotod77e3f42011-06-06 14:18:50 +0900930
931 cfifo->pipe = NULL;
Kuninori Morimotoe73a9892011-06-06 14:19:03 +0900932 cfifo->tx_chan = NULL;
933 cfifo->rx_chan = NULL;
934
935 d0fifo->pipe = NULL;
936 d0fifo->tx_chan = NULL;
937 d0fifo->rx_chan = NULL;
938
939 d1fifo->pipe = NULL;
940 d1fifo->tx_chan = NULL;
941 d1fifo->rx_chan = NULL;
942
943 usbhsf_dma_init(priv, usbhsf_get_d0fifo(priv));
944 usbhsf_dma_init(priv, usbhsf_get_d1fifo(priv));
Kuninori Morimotodad67392011-06-06 14:18:28 +0900945}
946
947void usbhs_fifo_quit(struct usbhs_priv *priv)
948{
949 struct usbhs_mod *mod = usbhs_mod_get_current(priv);
950
951 mod->irq_empty = NULL;
952 mod->irq_ready = NULL;
953 mod->irq_bempsts = 0;
954 mod->irq_brdysts = 0;
Kuninori Morimotoe73a9892011-06-06 14:19:03 +0900955
956 usbhsf_dma_quit(priv, usbhsf_get_d0fifo(priv));
957 usbhsf_dma_quit(priv, usbhsf_get_d1fifo(priv));
Kuninori Morimotodad67392011-06-06 14:18:28 +0900958}
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900959
960int usbhs_fifo_probe(struct usbhs_priv *priv)
961{
962 struct usbhs_fifo *fifo;
963
964 /* CFIFO */
965 fifo = usbhsf_get_cfifo(priv);
Kuninori Morimotoe73a9892011-06-06 14:19:03 +0900966 fifo->name = "CFIFO";
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900967 fifo->port = CFIFO;
968 fifo->sel = CFIFOSEL;
969 fifo->ctr = CFIFOCTR;
970
Kuninori Morimotoe73a9892011-06-06 14:19:03 +0900971 /* D0FIFO */
972 fifo = usbhsf_get_d0fifo(priv);
973 fifo->name = "D0FIFO";
974 fifo->port = D0FIFO;
975 fifo->sel = D0FIFOSEL;
976 fifo->ctr = D0FIFOCTR;
977 fifo->tx_slave.slave_id = usbhs_get_dparam(priv, d0_tx_id);
978 fifo->rx_slave.slave_id = usbhs_get_dparam(priv, d0_rx_id);
979
980 /* D1FIFO */
981 fifo = usbhsf_get_d1fifo(priv);
982 fifo->name = "D1FIFO";
983 fifo->port = D1FIFO;
984 fifo->sel = D1FIFOSEL;
985 fifo->ctr = D1FIFOCTR;
986 fifo->tx_slave.slave_id = usbhs_get_dparam(priv, d1_tx_id);
987 fifo->rx_slave.slave_id = usbhs_get_dparam(priv, d1_rx_id);
988
Kuninori Morimotod3af90a2011-06-06 14:18:44 +0900989 return 0;
990}
991
992void usbhs_fifo_remove(struct usbhs_priv *priv)
993{
994}