Commit 12c2b72b authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: EHCI support on MIPS

 From Darwin Rambo, <drambo@broadcom.com>

   These get rid of 8 and 16 byte PCI access, which don't work
   on some MIPS platforms.
parent b5aeadab
...@@ -63,6 +63,7 @@ static void dbg_hcs_params (struct ehci_hcd *ehci, char *label) ...@@ -63,6 +63,7 @@ static void dbg_hcs_params (struct ehci_hcd *ehci, char *label)
buf[0] = 0; buf[0] = 0;
for (i = 0; i < HCS_N_PORTS (params); i++) { for (i = 0; i < HCS_N_PORTS (params); i++) {
// FIXME MIPS won't readb() ...
byte = readb (&ehci->caps->portroute[(i>>1)]); byte = readb (&ehci->caps->portroute[(i>>1)]);
sprintf(tmp, "%d ", sprintf(tmp, "%d ",
((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf))); ((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
...@@ -591,7 +592,7 @@ show_registers (struct class_device *class_dev, char *buf) ...@@ -591,7 +592,7 @@ show_registers (struct class_device *class_dev, char *buf)
spin_lock_irqsave (&ehci->lock, flags); spin_lock_irqsave (&ehci->lock, flags);
/* Capability Registers */ /* Capability Registers */
i = readw (&ehci->caps->hci_version); i = HC_VERSION(readl (&ehci->caps->hc_capbase));
temp = snprintf (next, size, temp = snprintf (next, size,
"PCI device %s\nEHCI %x.%02x, hcd state %d (driver " DRIVER_VERSION ")\n", "PCI device %s\nEHCI %x.%02x, hcd state %d (driver " DRIVER_VERSION ")\n",
pci_name(hcd->pdev), pci_name(hcd->pdev),
......
...@@ -325,7 +325,7 @@ static int ehci_hc_reset (struct usb_hcd *hcd) ...@@ -325,7 +325,7 @@ static int ehci_hc_reset (struct usb_hcd *hcd)
ehci->caps = (struct ehci_caps *) hcd->regs; ehci->caps = (struct ehci_caps *) hcd->regs;
ehci->regs = (struct ehci_regs *) (hcd->regs + ehci->regs = (struct ehci_regs *) (hcd->regs +
readb (&ehci->caps->length)); HC_LENGTH (readl (&ehci->caps->hc_capbase)));
dbg_hcs_params (ehci, "reset"); dbg_hcs_params (ehci, "reset");
dbg_hcc_params (ehci, "reset"); dbg_hcc_params (ehci, "reset");
...@@ -489,7 +489,7 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -489,7 +489,7 @@ static int ehci_start (struct usb_hcd *hcd)
/* PCI Serial Bus Release Number is at 0x60 offset */ /* PCI Serial Bus Release Number is at 0x60 offset */
pci_read_config_byte (hcd->pdev, 0x60, &tempbyte); pci_read_config_byte (hcd->pdev, 0x60, &tempbyte);
temp = readw (&ehci->caps->hci_version); temp = HC_VERSION(readl (&ehci->caps->hc_capbase));
ehci_info (ehci, ehci_info (ehci,
"USB %x.%x enabled, EHCI %x.%02x, driver %s\n", "USB %x.%x enabled, EHCI %x.%02x, driver %s\n",
((tempbyte & 0xf0)>>4), (tempbyte & 0x0f), ((tempbyte & 0xf0)>>4), (tempbyte & 0x0f),
......
...@@ -153,9 +153,12 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action) ...@@ -153,9 +153,12 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
/* Section 2.2 Host Controller Capability Registers */ /* Section 2.2 Host Controller Capability Registers */
struct ehci_caps { struct ehci_caps {
u8 length; /* CAPLENGTH - size of this struct */ /* these fields are specified as 8 and 16 bit registers,
u8 reserved; /* offset 0x1 */ * but some hosts can't perform 8 or 16 bit PCI accesses.
u16 hci_version; /* HCIVERSION - offset 0x2 */ */
u32 hc_capbase;
#define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */
#define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */
u32 hcs_params; /* HCSPARAMS - offset 0x4 */ u32 hcs_params; /* HCSPARAMS - offset 0x4 */
#define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */ #define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */
#define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */ #define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment