aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/m66592-udc.c34
-rw-r--r--drivers/usb/gadget/m66592-udc.h1
2 files changed, 12 insertions, 23 deletions
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 43dcf9e1af6b..0dddd2f8ff35 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL");
37MODULE_AUTHOR("Yoshihiro Shimoda"); 37MODULE_AUTHOR("Yoshihiro Shimoda");
38MODULE_ALIAS("platform:m66592_udc"); 38MODULE_ALIAS("platform:m66592_udc");
39 39
40#define DRIVER_VERSION "18 Oct 2007" 40#define DRIVER_VERSION "26 Jun 2009"
41 41
42/* module parameters */ 42/* module parameters */
43#if defined(CONFIG_SUPERH_BUILT_IN_M66592) 43#if defined(CONFIG_SUPERH_BUILT_IN_M66592)
@@ -276,24 +276,27 @@ static int pipe_buffer_setting(struct m66592 *m66592,
276 buf_bsize = 0; 276 buf_bsize = 0;
277 break; 277 break;
278 case M66592_BULK: 278 case M66592_BULK:
279 bufnum = m66592->bi_bufnum + 279 /* isochronous pipes may be used as bulk pipes */
280 (info->pipe - M66592_BASE_PIPENUM_BULK) * 16; 280 if (info->pipe > M66592_BASE_PIPENUM_BULK)
281 m66592->bi_bufnum += 16; 281 bufnum = info->pipe - M66592_BASE_PIPENUM_BULK;
282 else
283 bufnum = info->pipe - M66592_BASE_PIPENUM_ISOC;
284
285 bufnum = M66592_BASE_BUFNUM + (bufnum * 16);
282 buf_bsize = 7; 286 buf_bsize = 7;
283 pipecfg |= M66592_DBLB; 287 pipecfg |= M66592_DBLB;
284 if (!info->dir_in) 288 if (!info->dir_in)
285 pipecfg |= M66592_SHTNAK; 289 pipecfg |= M66592_SHTNAK;
286 break; 290 break;
287 case M66592_ISO: 291 case M66592_ISO:
288 bufnum = m66592->bi_bufnum + 292 bufnum = M66592_BASE_BUFNUM +
289 (info->pipe - M66592_BASE_PIPENUM_ISOC) * 16; 293 (info->pipe - M66592_BASE_PIPENUM_ISOC) * 16;
290 m66592->bi_bufnum += 16;
291 buf_bsize = 7; 294 buf_bsize = 7;
292 break; 295 break;
293 } 296 }
294 if (m66592->bi_bufnum > M66592_MAX_BUFNUM) { 297
295 pr_err("m66592 pipe memory is insufficient(%d)\n", 298 if (buf_bsize && ((bufnum + 16) >= M66592_MAX_BUFNUM)) {
296 m66592->bi_bufnum); 299 pr_err("m66592 pipe memory is insufficient\n");
297 return -ENOMEM; 300 return -ENOMEM;
298 } 301 }
299 302
@@ -313,17 +316,6 @@ static void pipe_buffer_release(struct m66592 *m66592,
313 if (info->pipe == 0) 316 if (info->pipe == 0)
314 return; 317 return;
315 318
316 switch (info->type) {
317 case M66592_BULK:
318 if (is_bulk_pipe(info->pipe))
319 m66592->bi_bufnum -= 16;
320 break;
321 case M66592_ISO:
322 if (is_isoc_pipe(info->pipe))
323 m66592->bi_bufnum -= 16;
324 break;
325 }
326
327 if (is_bulk_pipe(info->pipe)) { 319 if (is_bulk_pipe(info->pipe)) {
328 m66592->bulk--; 320 m66592->bulk--;
329 } else if (is_interrupt_pipe(info->pipe)) 321 } else if (is_interrupt_pipe(info->pipe))
@@ -1603,8 +1595,6 @@ static int __init m66592_probe(struct platform_device *pdev)
1603 m66592->timer.data = (unsigned long)m66592; 1595 m66592->timer.data = (unsigned long)m66592;
1604 m66592->reg = reg; 1596 m66592->reg = reg;
1605 1597
1606 m66592->bi_bufnum = M66592_BASE_BUFNUM;
1607
1608 ret = request_irq(irq, m66592_irq, IRQF_DISABLED | IRQF_SHARED, 1598 ret = request_irq(irq, m66592_irq, IRQF_DISABLED | IRQF_SHARED,
1609 udc_name, m66592); 1599 udc_name, m66592);
1610 if (ret < 0) { 1600 if (ret < 0) {
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h
index 286ce07e7960..9a9c2bf9fbd5 100644
--- a/drivers/usb/gadget/m66592-udc.h
+++ b/drivers/usb/gadget/m66592-udc.h
@@ -506,7 +506,6 @@ struct m66592 {
506 int interrupt; 506 int interrupt;
507 int isochronous; 507 int isochronous;
508 int num_dma; 508 int num_dma;
509 int bi_bufnum; /* bulk and isochronous's bufnum */
510}; 509};
511 510
512#define gadget_to_m66592(_gadget) container_of(_gadget, struct m66592, gadget) 511#define gadget_to_m66592(_gadget) container_of(_gadget, struct m66592, gadget)