ChangeSet 1.1276.8.3, 2004/01/28 12:28:44-08:00, david-b@pacbell.net [PATCH] USB: EHCI support on MIPS From Darwin Rambo, These get rid of 8 and 16 byte PCI access, which don't work on some MIPS platforms. drivers/usb/host/ehci-dbg.c | 3 ++- drivers/usb/host/ehci-hcd.c | 6 +++--- drivers/usb/host/ehci.h | 9 ++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff -Nru a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c --- a/drivers/usb/host/ehci-dbg.c Wed Jan 28 13:36:25 2004 +++ b/drivers/usb/host/ehci-dbg.c Wed Jan 28 13:36:25 2004 @@ -73,6 +73,7 @@ buf[0] = 0; for (i = 0; i < HCS_N_PORTS (params); i++) { + // FIXME MIPS won't readb() ... byte = readb (&ehci->caps->portroute[(i>>1)]); sprintf(tmp, "%d ", ((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf))); @@ -571,7 +572,7 @@ spin_lock_irqsave (&ehci->lock, flags); /* Capability Registers */ - i = readw (&ehci->caps->hci_version); + i = HC_VERSION(readl (&ehci->caps->hc_capbase)); temp = snprintf (next, size, "%s\nEHCI %x.%02x, hcd state %d (driver " DRIVER_VERSION ")\n", pdev->dev.name, diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c --- a/drivers/usb/host/ehci-hcd.c Wed Jan 28 13:36:25 2004 +++ b/drivers/usb/host/ehci-hcd.c Wed Jan 28 13:36:25 2004 @@ -333,8 +333,8 @@ spin_lock_init (&ehci->lock); ehci->caps = (struct ehci_caps *) hcd->regs; - ehci->regs = (struct ehci_regs *) (hcd->regs + - readb (&ehci->caps->length)); + ehci->regs = (struct ehci_regs *) (hcd->regs + + HC_LENGTH (readl (&ehci->caps->hc_capbase))); dbg_hcs_params (ehci, "ehci_start"); dbg_hcc_params (ehci, "ehci_start"); @@ -486,7 +486,7 @@ /* PCI Serial Bus Release Number is at 0x60 offset */ 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, "USB %x.%x enabled, EHCI %x.%02x, driver %s\n", ((tempbyte & 0xf0)>>4), (tempbyte & 0x0f), diff -Nru a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h --- a/drivers/usb/host/ehci.h Wed Jan 28 13:36:25 2004 +++ b/drivers/usb/host/ehci.h Wed Jan 28 13:36:25 2004 @@ -153,9 +153,12 @@ /* Section 2.2 Host Controller Capability Registers */ struct ehci_caps { - u8 length; /* CAPLENGTH - size of this struct */ - u8 reserved; /* offset 0x1 */ - u16 hci_version; /* HCIVERSION - offset 0x2 */ + /* these fields are specified as 8 and 16 bit registers, + * but some hosts can't perform 8 or 16 bit PCI accesses. + */ + 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 */ #define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */ #define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */