diff options
author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2015-11-18 00:34:09 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-12-15 10:12:41 -0500 |
commit | 51f141a97a1406bb0b59d490e837a39ccb7c3999 (patch) | |
tree | 4766c47c6539a342a1c414b9098411e78c6932a2 | |
parent | 762d3a1a9cd7438a8453e005ee5b2bab3203d9c3 (diff) |
usb: renesas_usbhs: Modify pipe configuration
The current code has info->bufnmb_last to calculate the BUFNMB bits of
PIPEBUF register. However, since the bufnmb_last is initialized in
the usbhs_pipe_init() only, this driver is possible to set unexpected
value to the register if usb_ep_{enable,disable}() are called many times.
So, this patch modifies the pipe configuration via struct
renesas_usbhs_driver_param to simplify the code. Also this patch changes:
- a double buffer configuration
- isochronous buffer size from 512 to 1024
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/renesas_usbhs/common.c | 69 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/mod_host.c | 11 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/pipe.c | 112 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/pipe.h | 1 | ||||
-rw-r--r-- | include/linux/usb/renesas_usbhs.h | 18 |
5 files changed, 82 insertions, 129 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index d82fa36c3465..7ccc2fe4f6ec 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c | |||
@@ -302,37 +302,37 @@ static void usbhsc_set_buswait(struct usbhs_priv *priv) | |||
302 | */ | 302 | */ |
303 | 303 | ||
304 | /* commonly used on old SH-Mobile SoCs */ | 304 | /* commonly used on old SH-Mobile SoCs */ |
305 | static u32 usbhsc_default_pipe_type[] = { | 305 | static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = { |
306 | USB_ENDPOINT_XFER_CONTROL, | 306 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false), |
307 | USB_ENDPOINT_XFER_ISOC, | 307 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, false), |
308 | USB_ENDPOINT_XFER_ISOC, | 308 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x18, false), |
309 | USB_ENDPOINT_XFER_BULK, | 309 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x28, true), |
310 | USB_ENDPOINT_XFER_BULK, | 310 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x38, true), |
311 | USB_ENDPOINT_XFER_BULK, | 311 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x48, true), |
312 | USB_ENDPOINT_XFER_INT, | 312 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x04, false), |
313 | USB_ENDPOINT_XFER_INT, | 313 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x05, false), |
314 | USB_ENDPOINT_XFER_INT, | 314 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x06, false), |
315 | USB_ENDPOINT_XFER_INT, | 315 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x07, false), |
316 | }; | 316 | }; |
317 | 317 | ||
318 | /* commonly used on newer SH-Mobile and R-Car SoCs */ | 318 | /* commonly used on newer SH-Mobile and R-Car SoCs */ |
319 | static u32 usbhsc_new_pipe_type[] = { | 319 | static struct renesas_usbhs_driver_pipe_config usbhsc_new_pipe[] = { |
320 | USB_ENDPOINT_XFER_CONTROL, | 320 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false), |
321 | USB_ENDPOINT_XFER_ISOC, | 321 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, true), |
322 | USB_ENDPOINT_XFER_ISOC, | 322 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x28, true), |
323 | USB_ENDPOINT_XFER_BULK, | 323 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x48, true), |
324 | USB_ENDPOINT_XFER_BULK, | 324 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x58, true), |
325 | USB_ENDPOINT_XFER_BULK, | 325 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x68, true), |
326 | USB_ENDPOINT_XFER_INT, | 326 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x04, false), |
327 | USB_ENDPOINT_XFER_INT, | 327 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x05, false), |
328 | USB_ENDPOINT_XFER_INT, | 328 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x06, false), |
329 | USB_ENDPOINT_XFER_BULK, | 329 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x78, true), |
330 | USB_ENDPOINT_XFER_BULK, | 330 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x88, true), |
331 | USB_ENDPOINT_XFER_BULK, | 331 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x98, true), |
332 | USB_ENDPOINT_XFER_BULK, | 332 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xa8, true), |
333 | USB_ENDPOINT_XFER_BULK, | 333 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xb8, true), |
334 | USB_ENDPOINT_XFER_BULK, | 334 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xc8, true), |
335 | USB_ENDPOINT_XFER_BULK, | 335 | RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0xd8, true), |
336 | }; | 336 | }; |
337 | 337 | ||
338 | /* | 338 | /* |
@@ -564,10 +564,9 @@ static int usbhs_probe(struct platform_device *pdev) | |||
564 | switch (priv->dparam.type) { | 564 | switch (priv->dparam.type) { |
565 | case USBHS_TYPE_RCAR_GEN2: | 565 | case USBHS_TYPE_RCAR_GEN2: |
566 | priv->pfunc = usbhs_rcar2_ops; | 566 | priv->pfunc = usbhs_rcar2_ops; |
567 | if (!priv->dparam.pipe_type) { | 567 | if (!priv->dparam.pipe_configs) { |
568 | priv->dparam.pipe_type = usbhsc_new_pipe_type; | 568 | priv->dparam.pipe_configs = usbhsc_new_pipe; |
569 | priv->dparam.pipe_size = | 569 | priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_new_pipe); |
570 | ARRAY_SIZE(usbhsc_new_pipe_type); | ||
571 | } | 570 | } |
572 | break; | 571 | break; |
573 | default: | 572 | default: |
@@ -586,9 +585,9 @@ static int usbhs_probe(struct platform_device *pdev) | |||
586 | dfunc->notify_hotplug = usbhsc_drvcllbck_notify_hotplug; | 585 | dfunc->notify_hotplug = usbhsc_drvcllbck_notify_hotplug; |
587 | 586 | ||
588 | /* set default param if platform doesn't have */ | 587 | /* set default param if platform doesn't have */ |
589 | if (!priv->dparam.pipe_type) { | 588 | if (!priv->dparam.pipe_configs) { |
590 | priv->dparam.pipe_type = usbhsc_default_pipe_type; | 589 | priv->dparam.pipe_configs = usbhsc_default_pipe; |
591 | priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_default_pipe_type); | 590 | priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_default_pipe); |
592 | } | 591 | } |
593 | if (!priv->dparam.pio_dma_border) | 592 | if (!priv->dparam.pio_dma_border) |
594 | priv->dparam.pio_dma_border = 64; /* 64byte */ | 593 | priv->dparam.pio_dma_border = 64; /* 64byte */ |
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index bd050359926c..1a8e4c45c4c5 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c | |||
@@ -1414,7 +1414,8 @@ static void usbhsh_pipe_init_for_host(struct usbhs_priv *priv) | |||
1414 | { | 1414 | { |
1415 | struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv); | 1415 | struct usbhsh_hpriv *hpriv = usbhsh_priv_to_hpriv(priv); |
1416 | struct usbhs_pipe *pipe; | 1416 | struct usbhs_pipe *pipe; |
1417 | u32 *pipe_type = usbhs_get_dparam(priv, pipe_type); | 1417 | struct renesas_usbhs_driver_pipe_config *pipe_configs = |
1418 | usbhs_get_dparam(priv, pipe_configs); | ||
1418 | int pipe_size = usbhs_get_dparam(priv, pipe_size); | 1419 | int pipe_size = usbhs_get_dparam(priv, pipe_size); |
1419 | int old_type, dir_in, i; | 1420 | int old_type, dir_in, i; |
1420 | 1421 | ||
@@ -1442,15 +1443,15 @@ static void usbhsh_pipe_init_for_host(struct usbhs_priv *priv) | |||
1442 | * USB_ENDPOINT_XFER_BULK -> dir in | 1443 | * USB_ENDPOINT_XFER_BULK -> dir in |
1443 | * ... | 1444 | * ... |
1444 | */ | 1445 | */ |
1445 | dir_in = (pipe_type[i] == old_type); | 1446 | dir_in = (pipe_configs[i].type == old_type); |
1446 | old_type = pipe_type[i]; | 1447 | old_type = pipe_configs[i].type; |
1447 | 1448 | ||
1448 | if (USB_ENDPOINT_XFER_CONTROL == pipe_type[i]) { | 1449 | if (USB_ENDPOINT_XFER_CONTROL == pipe_configs[i].type) { |
1449 | pipe = usbhs_dcp_malloc(priv); | 1450 | pipe = usbhs_dcp_malloc(priv); |
1450 | usbhsh_hpriv_to_dcp(hpriv) = pipe; | 1451 | usbhsh_hpriv_to_dcp(hpriv) = pipe; |
1451 | } else { | 1452 | } else { |
1452 | pipe = usbhs_pipe_malloc(priv, | 1453 | pipe = usbhs_pipe_malloc(priv, |
1453 | pipe_type[i], | 1454 | pipe_configs[i].type, |
1454 | dir_in); | 1455 | dir_in); |
1455 | } | 1456 | } |
1456 | 1457 | ||
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c index 4f9c3356127a..0e95d2925dc5 100644 --- a/drivers/usb/renesas_usbhs/pipe.c +++ b/drivers/usb/renesas_usbhs/pipe.c | |||
@@ -44,6 +44,15 @@ char *usbhs_pipe_name(struct usbhs_pipe *pipe) | |||
44 | return usbhsp_pipe_name[usbhs_pipe_type(pipe)]; | 44 | return usbhsp_pipe_name[usbhs_pipe_type(pipe)]; |
45 | } | 45 | } |
46 | 46 | ||
47 | static struct renesas_usbhs_driver_pipe_config | ||
48 | *usbhsp_get_pipe_config(struct usbhs_priv *priv, int pipe_num) | ||
49 | { | ||
50 | struct renesas_usbhs_driver_pipe_config *pipe_configs = | ||
51 | usbhs_get_dparam(priv, pipe_configs); | ||
52 | |||
53 | return &pipe_configs[pipe_num]; | ||
54 | } | ||
55 | |||
47 | /* | 56 | /* |
48 | * DCPCTR/PIPEnCTR functions | 57 | * DCPCTR/PIPEnCTR functions |
49 | */ | 58 | */ |
@@ -384,18 +393,6 @@ void usbhs_pipe_set_trans_count_if_bulk(struct usbhs_pipe *pipe, int len) | |||
384 | /* | 393 | /* |
385 | * pipe setup | 394 | * pipe setup |
386 | */ | 395 | */ |
387 | static int usbhsp_possible_double_buffer(struct usbhs_pipe *pipe) | ||
388 | { | ||
389 | /* | ||
390 | * only ISO / BULK pipe can use double buffer | ||
391 | */ | ||
392 | if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK) || | ||
393 | usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC)) | ||
394 | return 1; | ||
395 | |||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe, | 396 | static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe, |
400 | int is_host, | 397 | int is_host, |
401 | int dir_in) | 398 | int dir_in) |
@@ -412,7 +409,6 @@ static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe, | |||
412 | [USB_ENDPOINT_XFER_INT] = TYPE_INT, | 409 | [USB_ENDPOINT_XFER_INT] = TYPE_INT, |
413 | [USB_ENDPOINT_XFER_ISOC] = TYPE_ISO, | 410 | [USB_ENDPOINT_XFER_ISOC] = TYPE_ISO, |
414 | }; | 411 | }; |
415 | int is_double = usbhsp_possible_double_buffer(pipe); | ||
416 | 412 | ||
417 | if (usbhs_pipe_is_dcp(pipe)) | 413 | if (usbhs_pipe_is_dcp(pipe)) |
418 | return -EINVAL; | 414 | return -EINVAL; |
@@ -434,10 +430,7 @@ static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe, | |||
434 | usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) | 430 | usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) |
435 | bfre = 0; /* FIXME */ | 431 | bfre = 0; /* FIXME */ |
436 | 432 | ||
437 | /* DBLB */ | 433 | /* DBLB: see usbhs_pipe_config_update() */ |
438 | if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC) || | ||
439 | usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) | ||
440 | dblb = (is_double) ? DBLB : 0; | ||
441 | 434 | ||
442 | /* CNTMD */ | 435 | /* CNTMD */ |
443 | if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) | 436 | if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) |
@@ -473,13 +466,13 @@ static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe, | |||
473 | static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe) | 466 | static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe) |
474 | { | 467 | { |
475 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); | 468 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); |
476 | struct usbhs_pipe_info *info = usbhs_priv_to_pipeinfo(priv); | ||
477 | struct device *dev = usbhs_priv_to_dev(priv); | 469 | struct device *dev = usbhs_priv_to_dev(priv); |
478 | int pipe_num = usbhs_pipe_number(pipe); | 470 | int pipe_num = usbhs_pipe_number(pipe); |
479 | int is_double = usbhsp_possible_double_buffer(pipe); | ||
480 | u16 buff_size; | 471 | u16 buff_size; |
481 | u16 bufnmb; | 472 | u16 bufnmb; |
482 | u16 bufnmb_cnt; | 473 | u16 bufnmb_cnt; |
474 | struct renesas_usbhs_driver_pipe_config *pipe_config = | ||
475 | usbhsp_get_pipe_config(priv, pipe_num); | ||
483 | 476 | ||
484 | /* | 477 | /* |
485 | * PIPEBUF | 478 | * PIPEBUF |
@@ -489,56 +482,13 @@ static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe) | |||
489 | * - "Features" - "Pipe configuration" | 482 | * - "Features" - "Pipe configuration" |
490 | * - "Operation" - "FIFO Buffer Memory" | 483 | * - "Operation" - "FIFO Buffer Memory" |
491 | * - "Operation" - "Pipe Control" | 484 | * - "Operation" - "Pipe Control" |
492 | * | ||
493 | * ex) if pipe6 - pipe9 are USB_ENDPOINT_XFER_INT (SH7724) | ||
494 | * | ||
495 | * BUFNMB: PIPE | ||
496 | * 0: pipe0 (DCP 256byte) | ||
497 | * 1: - | ||
498 | * 2: - | ||
499 | * 3: - | ||
500 | * 4: pipe6 (INT 64byte) | ||
501 | * 5: pipe7 (INT 64byte) | ||
502 | * 6: pipe8 (INT 64byte) | ||
503 | * 7: pipe9 (INT 64byte) | ||
504 | * 8 - xx: free (for BULK, ISOC) | ||
505 | */ | 485 | */ |
506 | 486 | buff_size = pipe_config->bufsize; | |
507 | /* | 487 | bufnmb = pipe_config->bufnum; |
508 | * FIXME | ||
509 | * | ||
510 | * it doesn't have good buffer allocator | ||
511 | * | ||
512 | * DCP : 256 byte | ||
513 | * BULK: 512 byte | ||
514 | * INT : 64 byte | ||
515 | * ISOC: 512 byte | ||
516 | */ | ||
517 | if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_CONTROL)) | ||
518 | buff_size = 256; | ||
519 | else if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_INT)) | ||
520 | buff_size = 64; | ||
521 | else | ||
522 | buff_size = 512; | ||
523 | 488 | ||
524 | /* change buff_size to register value */ | 489 | /* change buff_size to register value */ |
525 | bufnmb_cnt = (buff_size / 64) - 1; | 490 | bufnmb_cnt = (buff_size / 64) - 1; |
526 | 491 | ||
527 | /* BUFNMB has been reserved for INT pipe | ||
528 | * see above */ | ||
529 | if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_INT)) { | ||
530 | bufnmb = pipe_num - 2; | ||
531 | } else { | ||
532 | bufnmb = info->bufnmb_last; | ||
533 | info->bufnmb_last += bufnmb_cnt + 1; | ||
534 | |||
535 | /* | ||
536 | * double buffer | ||
537 | */ | ||
538 | if (is_double) | ||
539 | info->bufnmb_last += bufnmb_cnt + 1; | ||
540 | } | ||
541 | |||
542 | dev_dbg(dev, "pipe : %d : buff_size 0x%x: bufnmb 0x%x\n", | 492 | dev_dbg(dev, "pipe : %d : buff_size 0x%x: bufnmb 0x%x\n", |
543 | pipe_num, buff_size, bufnmb); | 493 | pipe_num, buff_size, bufnmb); |
544 | 494 | ||
@@ -549,8 +499,13 @@ static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe) | |||
549 | void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 devsel, | 499 | void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 devsel, |
550 | u16 epnum, u16 maxp) | 500 | u16 epnum, u16 maxp) |
551 | { | 501 | { |
502 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); | ||
503 | int pipe_num = usbhs_pipe_number(pipe); | ||
504 | struct renesas_usbhs_driver_pipe_config *pipe_config = | ||
505 | usbhsp_get_pipe_config(priv, pipe_num); | ||
506 | u16 dblb = pipe_config->double_buf ? DBLB : 0; | ||
507 | |||
552 | if (devsel > 0xA) { | 508 | if (devsel > 0xA) { |
553 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); | ||
554 | struct device *dev = usbhs_priv_to_dev(priv); | 509 | struct device *dev = usbhs_priv_to_dev(priv); |
555 | 510 | ||
556 | dev_err(dev, "devsel error %d\n", devsel); | 511 | dev_err(dev, "devsel error %d\n", devsel); |
@@ -568,7 +523,7 @@ void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 devsel, | |||
568 | maxp); | 523 | maxp); |
569 | 524 | ||
570 | if (!usbhs_pipe_is_dcp(pipe)) | 525 | if (!usbhs_pipe_is_dcp(pipe)) |
571 | usbhsp_pipe_cfg_set(pipe, 0x000F, epnum); | 526 | usbhsp_pipe_cfg_set(pipe, 0x000F | DBLB, epnum | dblb); |
572 | } | 527 | } |
573 | 528 | ||
574 | /* | 529 | /* |
@@ -708,23 +663,7 @@ void usbhs_pipe_init(struct usbhs_priv *priv, | |||
708 | struct usbhs_pipe *pipe; | 663 | struct usbhs_pipe *pipe; |
709 | int i; | 664 | int i; |
710 | 665 | ||
711 | /* | ||
712 | * FIXME | ||
713 | * | ||
714 | * driver needs good allocator. | ||
715 | * | ||
716 | * find first free buffer area (BULK, ISOC) | ||
717 | * (DCP, INT area is fixed) | ||
718 | * | ||
719 | * buffer number 0 - 3 have been reserved for DCP | ||
720 | * see | ||
721 | * usbhsp_to_bufnmb | ||
722 | */ | ||
723 | info->bufnmb_last = 4; | ||
724 | usbhs_for_each_pipe_with_dcp(pipe, priv, i) { | 666 | usbhs_for_each_pipe_with_dcp(pipe, priv, i) { |
725 | if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_INT)) | ||
726 | info->bufnmb_last++; | ||
727 | |||
728 | usbhsp_flags_init(pipe); | 667 | usbhsp_flags_init(pipe); |
729 | pipe->fifo = NULL; | 668 | pipe->fifo = NULL; |
730 | pipe->mod_private = NULL; | 669 | pipe->mod_private = NULL; |
@@ -851,12 +790,13 @@ int usbhs_pipe_probe(struct usbhs_priv *priv) | |||
851 | struct usbhs_pipe_info *info = usbhs_priv_to_pipeinfo(priv); | 790 | struct usbhs_pipe_info *info = usbhs_priv_to_pipeinfo(priv); |
852 | struct usbhs_pipe *pipe; | 791 | struct usbhs_pipe *pipe; |
853 | struct device *dev = usbhs_priv_to_dev(priv); | 792 | struct device *dev = usbhs_priv_to_dev(priv); |
854 | u32 *pipe_type = usbhs_get_dparam(priv, pipe_type); | 793 | struct renesas_usbhs_driver_pipe_config *pipe_configs = |
794 | usbhs_get_dparam(priv, pipe_configs); | ||
855 | int pipe_size = usbhs_get_dparam(priv, pipe_size); | 795 | int pipe_size = usbhs_get_dparam(priv, pipe_size); |
856 | int i; | 796 | int i; |
857 | 797 | ||
858 | /* This driver expects 1st pipe is DCP */ | 798 | /* This driver expects 1st pipe is DCP */ |
859 | if (pipe_type[0] != USB_ENDPOINT_XFER_CONTROL) { | 799 | if (pipe_configs[0].type != USB_ENDPOINT_XFER_CONTROL) { |
860 | dev_err(dev, "1st PIPE is not DCP\n"); | 800 | dev_err(dev, "1st PIPE is not DCP\n"); |
861 | return -EINVAL; | 801 | return -EINVAL; |
862 | } | 802 | } |
@@ -876,10 +816,10 @@ int usbhs_pipe_probe(struct usbhs_priv *priv) | |||
876 | pipe->priv = priv; | 816 | pipe->priv = priv; |
877 | 817 | ||
878 | usbhs_pipe_type(pipe) = | 818 | usbhs_pipe_type(pipe) = |
879 | pipe_type[i] & USB_ENDPOINT_XFERTYPE_MASK; | 819 | pipe_configs[i].type & USB_ENDPOINT_XFERTYPE_MASK; |
880 | 820 | ||
881 | dev_dbg(dev, "pipe %x\t: %s\n", | 821 | dev_dbg(dev, "pipe %x\t: %s\n", |
882 | i, usbhsp_pipe_name[pipe_type[i]]); | 822 | i, usbhsp_pipe_name[pipe_configs[i].type]); |
883 | } | 823 | } |
884 | 824 | ||
885 | return 0; | 825 | return 0; |
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h index b0bc7b603016..3212ab51e844 100644 --- a/drivers/usb/renesas_usbhs/pipe.h +++ b/drivers/usb/renesas_usbhs/pipe.h | |||
@@ -46,7 +46,6 @@ struct usbhs_pipe { | |||
46 | struct usbhs_pipe_info { | 46 | struct usbhs_pipe_info { |
47 | struct usbhs_pipe *pipe; | 47 | struct usbhs_pipe *pipe; |
48 | int size; /* array size of "pipe" */ | 48 | int size; /* array size of "pipe" */ |
49 | int bufnmb_last; /* FIXME : driver needs good allocator */ | ||
50 | 49 | ||
51 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map); | 50 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map); |
52 | }; | 51 | }; |
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index bfb74723f151..4db191fe8c2c 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h | |||
@@ -105,12 +105,26 @@ struct renesas_usbhs_platform_callback { | |||
105 | * some register needs USB chip specific parameters. | 105 | * some register needs USB chip specific parameters. |
106 | * This struct show it to driver | 106 | * This struct show it to driver |
107 | */ | 107 | */ |
108 | |||
109 | struct renesas_usbhs_driver_pipe_config { | ||
110 | u8 type; /* USB_ENDPOINT_XFER_xxx */ | ||
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 | |||
108 | struct renesas_usbhs_driver_param { | 122 | struct renesas_usbhs_driver_param { |
109 | /* | 123 | /* |
110 | * pipe settings | 124 | * pipe settings |
111 | */ | 125 | */ |
112 | u32 *pipe_type; /* array of USB_ENDPOINT_XFER_xxx (from ep0) */ | 126 | struct renesas_usbhs_driver_pipe_config *pipe_configs; |
113 | int pipe_size; /* pipe_type array size */ | 127 | int pipe_size; /* pipe_configs array size */ |
114 | 128 | ||
115 | /* | 129 | /* |
116 | * option: | 130 | * option: |