aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/uhci-hcd.h
diff options
context:
space:
mode:
authorJan Andersson <jan@gaisler.com>2011-05-06 06:00:17 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-06 21:24:01 -0400
commitd3219d1c4c9ab7cd959f8f294420faf5f936cf55 (patch)
treed2ddd049bd7f872cda2050d94868f22a9a2f2b35 /drivers/usb/host/uhci-hcd.h
parent9faa091a409851ac6b3812164d53644074bc89b1 (diff)
USB: UHCI: Support non-PCI host controllers
This patch is part of a series that extend the UHCI HCD to support non-PCI host controllers. This patch also extends the uhci_{read,write}* functions to allow accesses to registers not mapped into PCI I/O space. This extension also includes the addition of a void __iomem pointer to the uhci structure. A new Kconfig option is added to signal that the system has a non-PCI HC. If this Kconfig option is set, uhci-hcd.c will include generic reset functions for systems that do not make use of keyboard and mouse legacy support. PCI controllers will still always use the reset functions from pci-quirks This patch is followed by a patch that adds bus glue for the first non-PCI UHCI HC. Signed-off-by: Jan Andersson <jan@gaisler.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/uhci-hcd.h')
-rw-r--r--drivers/usb/host/uhci-hcd.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
index a6de241bf966..a4e64d08f020 100644
--- a/drivers/usb/host/uhci-hcd.h
+++ b/drivers/usb/host/uhci-hcd.h
@@ -380,6 +380,9 @@ struct uhci_hcd {
380 /* Grabbed from PCI */ 380 /* Grabbed from PCI */
381 unsigned long io_addr; 381 unsigned long io_addr;
382 382
383 /* Used when registers are memory mapped */
384 void __iomem *regs;
385
383 struct dma_pool *qh_pool; 386 struct dma_pool *qh_pool;
384 struct dma_pool *td_pool; 387 struct dma_pool *td_pool;
385 388
@@ -481,6 +484,14 @@ struct urb_priv {
481#define PCI_VENDOR_ID_GENESYS 0x17a0 484#define PCI_VENDOR_ID_GENESYS 0x17a0
482#define PCI_DEVICE_ID_GL880S_UHCI 0x8083 485#define PCI_DEVICE_ID_GL880S_UHCI 0x8083
483 486
487/*
488 * Functions used to access controller registers. The UCHI spec says that host
489 * controller I/O registers are mapped into PCI I/O space. For non-PCI hosts
490 * we use memory mapped registers.
491 */
492
493#if !defined(CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC)
494/* Support PCI only */
484static inline u32 uhci_readl(struct uhci_hcd *uhci, int reg) 495static inline u32 uhci_readl(struct uhci_hcd *uhci, int reg)
485{ 496{
486 return inl(uhci->io_addr + reg); 497 return inl(uhci->io_addr + reg);
@@ -511,4 +522,58 @@ static inline void uhci_writeb(struct uhci_hcd *uhci, u8 val, int reg)
511 outb(val, uhci->io_addr + reg); 522 outb(val, uhci->io_addr + reg);
512} 523}
513 524
525#else
526/* Support PCI and non-PCI host controllers */
527
528#define uhci_has_pci_registers(u) ((u)->io_addr != 0)
529
530static inline u32 uhci_readl(struct uhci_hcd *uhci, int reg)
531{
532 if (uhci_has_pci_registers(uhci))
533 return inl(uhci->io_addr + reg);
534 else
535 return readl(uhci->regs + reg);
536}
537
538static inline void uhci_writel(struct uhci_hcd *uhci, u32 val, int reg)
539{
540 if (uhci_has_pci_registers(uhci))
541 outl(val, uhci->io_addr + reg);
542 else
543 writel(val, uhci->regs + reg);
544}
545
546static inline u16 uhci_readw(struct uhci_hcd *uhci, int reg)
547{
548 if (uhci_has_pci_registers(uhci))
549 return inw(uhci->io_addr + reg);
550 else
551 return readw(uhci->regs + reg);
552}
553
554static inline void uhci_writew(struct uhci_hcd *uhci, u16 val, int reg)
555{
556 if (uhci_has_pci_registers(uhci))
557 outw(val, uhci->io_addr + reg);
558 else
559 writew(val, uhci->regs + reg);
560}
561
562static inline u8 uhci_readb(struct uhci_hcd *uhci, int reg)
563{
564 if (uhci_has_pci_registers(uhci))
565 return inb(uhci->io_addr + reg);
566 else
567 return readb(uhci->regs + reg);
568}
569
570static inline void uhci_writeb(struct uhci_hcd *uhci, u8 val, int reg)
571{
572 if (uhci_has_pci_registers(uhci))
573 outb(val, uhci->io_addr + reg);
574 else
575 writeb(val, uhci->regs + reg);
576}
577#endif /* !defined(CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC) */
578
514#endif 579#endif