diff options
author | Bryan Wu <cooloney@kernel.org> | 2008-12-02 14:33:48 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-07 13:00:07 -0500 |
commit | c6cf8b003e5a37f8193c2883876c5942adcd7284 (patch) | |
tree | c0ce285fb7a70dfd149ecfc325ad4c468ea0bbbc /drivers/usb/musb/musb_core.h | |
parent | 6995eb68aab70e79eedb710d7d6d1f22d8aea4a7 (diff) |
USB: musb: add Blackfin specific configuration to MUSB
Some config registers are not avaiable in Blackfin, we have to comment them out.
v1-v2:
- remove Blackfin specific header file
- add Blackfin register version to musb_regs.h header file
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/musb/musb_core.h')
-rw-r--r-- | drivers/usb/musb/musb_core.h | 70 |
1 files changed, 67 insertions, 3 deletions
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index d45d258e63f0..630946a2d9fc 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -191,7 +191,7 @@ enum musb_g_ep0_state { | |||
191 | */ | 191 | */ |
192 | 192 | ||
193 | #if defined(CONFIG_ARCH_DAVINCI) || defined(CONFIG_ARCH_OMAP2430) \ | 193 | #if defined(CONFIG_ARCH_DAVINCI) || defined(CONFIG_ARCH_OMAP2430) \ |
194 | || defined(CONFIG_ARCH_OMAP3430) | 194 | || defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_BLACKFIN) |
195 | /* REVISIT indexed access seemed to | 195 | /* REVISIT indexed access seemed to |
196 | * misbehave (on DaVinci) for at least peripheral IN ... | 196 | * misbehave (on DaVinci) for at least peripheral IN ... |
197 | */ | 197 | */ |
@@ -448,6 +448,70 @@ static inline struct musb *gadget_to_musb(struct usb_gadget *g) | |||
448 | } | 448 | } |
449 | #endif | 449 | #endif |
450 | 450 | ||
451 | #ifdef CONFIG_BLACKFIN | ||
452 | static inline int musb_read_fifosize(struct musb *musb, | ||
453 | struct musb_hw_ep *hw_ep, u8 epnum) | ||
454 | { | ||
455 | musb->nr_endpoints++; | ||
456 | musb->epmask |= (1 << epnum); | ||
457 | |||
458 | if (epnum < 5) { | ||
459 | hw_ep->max_packet_sz_tx = 128; | ||
460 | hw_ep->max_packet_sz_rx = 128; | ||
461 | } else { | ||
462 | hw_ep->max_packet_sz_tx = 1024; | ||
463 | hw_ep->max_packet_sz_rx = 1024; | ||
464 | } | ||
465 | hw_ep->is_shared_fifo = false; | ||
466 | |||
467 | return 0; | ||
468 | } | ||
469 | |||
470 | static inline void musb_configure_ep0(struct musb *musb) | ||
471 | { | ||
472 | musb->endpoints[0].max_packet_sz_tx = MUSB_EP0_FIFOSIZE; | ||
473 | musb->endpoints[0].max_packet_sz_rx = MUSB_EP0_FIFOSIZE; | ||
474 | musb->endpoints[0].is_shared_fifo = true; | ||
475 | } | ||
476 | |||
477 | #else | ||
478 | |||
479 | static inline int musb_read_fifosize(struct musb *musb, | ||
480 | struct musb_hw_ep *hw_ep, u8 epnum) | ||
481 | { | ||
482 | u8 reg = 0; | ||
483 | |||
484 | /* read from core using indexed model */ | ||
485 | reg = musb_readb(hw_ep->regs, 0x10 + MUSB_FIFOSIZE); | ||
486 | /* 0's returned when no more endpoints */ | ||
487 | if (!reg) | ||
488 | return -ENODEV; | ||
489 | |||
490 | musb->nr_endpoints++; | ||
491 | musb->epmask |= (1 << epnum); | ||
492 | |||
493 | hw_ep->max_packet_sz_tx = 1 << (reg & 0x0f); | ||
494 | |||
495 | /* shared TX/RX FIFO? */ | ||
496 | if ((reg & 0xf0) == 0xf0) { | ||
497 | hw_ep->max_packet_sz_rx = hw_ep->max_packet_sz_tx; | ||
498 | hw_ep->is_shared_fifo = true; | ||
499 | return 0; | ||
500 | } else { | ||
501 | hw_ep->max_packet_sz_rx = 1 << ((reg & 0xf0) >> 4); | ||
502 | hw_ep->is_shared_fifo = false; | ||
503 | } | ||
504 | |||
505 | return 0; | ||
506 | } | ||
507 | |||
508 | static inline void musb_configure_ep0(struct musb *musb) | ||
509 | { | ||
510 | musb->endpoints[0].max_packet_sz_tx = MUSB_EP0_FIFOSIZE; | ||
511 | musb->endpoints[0].max_packet_sz_rx = MUSB_EP0_FIFOSIZE; | ||
512 | } | ||
513 | #endif /* CONFIG_BLACKFIN */ | ||
514 | |||
451 | 515 | ||
452 | /***************************** Glue it together *****************************/ | 516 | /***************************** Glue it together *****************************/ |
453 | 517 | ||
@@ -470,14 +534,14 @@ extern void musb_hnp_stop(struct musb *musb); | |||
470 | 534 | ||
471 | extern int musb_platform_set_mode(struct musb *musb, u8 musb_mode); | 535 | extern int musb_platform_set_mode(struct musb *musb, u8 musb_mode); |
472 | 536 | ||
473 | #if defined(CONFIG_USB_TUSB6010) || \ | 537 | #if defined(CONFIG_USB_TUSB6010) || defined(CONFIG_BLACKFIN) || \ |
474 | defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) | 538 | defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) |
475 | extern void musb_platform_try_idle(struct musb *musb, unsigned long timeout); | 539 | extern void musb_platform_try_idle(struct musb *musb, unsigned long timeout); |
476 | #else | 540 | #else |
477 | #define musb_platform_try_idle(x, y) do {} while (0) | 541 | #define musb_platform_try_idle(x, y) do {} while (0) |
478 | #endif | 542 | #endif |
479 | 543 | ||
480 | #ifdef CONFIG_USB_TUSB6010 | 544 | #if defined(CONFIG_USB_TUSB6010) || defined(CONFIG_BLACKFIN) |
481 | extern int musb_platform_get_vbus_status(struct musb *musb); | 545 | extern int musb_platform_get_vbus_status(struct musb *musb); |
482 | #else | 546 | #else |
483 | #define musb_platform_get_vbus_status(x) 0 | 547 | #define musb_platform_get_vbus_status(x) 0 |