aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-12-14 14:54:08 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 18:44:32 -0500
commit083522d76662cda71328df1f3d75e5a9057c7c9f (patch)
treeeafbb962ec90431d0c1b490b4caea7cf9b54672c /drivers/usb/host/ehci.h
parent11d1a4aa8d657478cb2e5d33f203ba8f01b9ac24 (diff)
USB: Implement support for EHCI with big endian MMIO
This patch implements supports for EHCI controllers whose MMIO registers are big endian and enables that functionality for the Toshiba SCC chip. It does _not_ add support for big endian in-memory data structures as this is not needed for that chip and I hope it will never be. The guts of the patch are to convert readl(...) to ehci_readl(ehci, ...) and similarly for register writes. Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Geoff Levand <geoffrey.levand@am.sony.com> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci.h')
-rw-r--r--drivers/usb/host/ehci.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 74dbc6c8228f..5f28b74bb8d3 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -92,6 +92,7 @@ struct ehci_hcd { /* one per controller */
92 unsigned is_tdi_rh_tt:1; /* TDI roothub with TT */ 92 unsigned is_tdi_rh_tt:1; /* TDI roothub with TT */
93 unsigned no_selective_suspend:1; 93 unsigned no_selective_suspend:1;
94 unsigned has_fsl_port_bug:1; /* FreeScale */ 94 unsigned has_fsl_port_bug:1; /* FreeScale */
95 unsigned big_endian_mmio:1;
95 96
96 u8 sbrn; /* packed release number */ 97 u8 sbrn; /* packed release number */
97 98
@@ -651,6 +652,37 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
651#define ehci_has_fsl_portno_bug(e) (0) 652#define ehci_has_fsl_portno_bug(e) (0)
652#endif 653#endif
653 654
655/*
656 * While most USB host controllers implement their registers in
657 * little-endian format, a minority (celleb companion chip) implement
658 * them in big endian format.
659 *
660 * This attempts to support either format at compile time without a
661 * runtime penalty, or both formats with the additional overhead
662 * of checking a flag bit.
663 */
664
665#ifdef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
666#define ehci_big_endian_mmio(e) ((e)->big_endian_mmio)
667#else
668#define ehci_big_endian_mmio(e) 0
669#endif
670
671static inline unsigned int ehci_readl (const struct ehci_hcd *ehci,
672 __u32 __iomem * regs)
673{
674 return ehci_big_endian_mmio(ehci) ?
675 readl_be((__force u32 *)regs) :
676 readl((__force u32 *)regs);
677}
678
679static inline void ehci_writel (const struct ehci_hcd *ehci,
680 const unsigned int val, __u32 __iomem *regs)
681{
682 ehci_big_endian_mmio(ehci) ?
683 writel_be(val, (__force u32 *)regs) :
684 writel(val, (__force u32 *)regs);
685}
654 686
655/*-------------------------------------------------------------------------*/ 687/*-------------------------------------------------------------------------*/
656 688