aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-pci.c
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-pci.c
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-pci.c')
-rw-r--r--drivers/usb/host/ehci-pci.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 4bc7970ba3ef..12edc723ec73 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -38,7 +38,7 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)
38 if ((temp & (3 << 13)) == (1 << 13)) { 38 if ((temp & (3 << 13)) == (1 << 13)) {
39 temp &= 0x1fff; 39 temp &= 0x1fff;
40 ehci->debug = ehci_to_hcd(ehci)->regs + temp; 40 ehci->debug = ehci_to_hcd(ehci)->regs + temp;
41 temp = readl(&ehci->debug->control); 41 temp = ehci_readl(ehci, &ehci->debug->control);
42 ehci_info(ehci, "debug port %d%s\n", 42 ehci_info(ehci, "debug port %d%s\n",
43 HCS_DEBUG_PORT(ehci->hcs_params), 43 HCS_DEBUG_PORT(ehci->hcs_params),
44 (temp & DBGP_ENABLED) 44 (temp & DBGP_ENABLED)
@@ -71,8 +71,24 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
71 u32 temp; 71 u32 temp;
72 int retval; 72 int retval;
73 73
74 switch (pdev->vendor) {
75 case PCI_VENDOR_ID_TOSHIBA_2:
76 /* celleb's companion chip */
77 if (pdev->device == 0x01b5) {
78#ifdef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
79 ehci->big_endian_mmio = 1;
80#else
81 ehci_warn(ehci,
82 "unsupported big endian Toshiba quirk\n");
83#endif
84 }
85 break;
86 }
87
74 ehci->caps = hcd->regs; 88 ehci->caps = hcd->regs;
75 ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase)); 89 ehci->regs = hcd->regs +
90 HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
91
76 dbg_hcs_params(ehci, "reset"); 92 dbg_hcs_params(ehci, "reset");
77 dbg_hcc_params(ehci, "reset"); 93 dbg_hcc_params(ehci, "reset");
78 94
@@ -101,7 +117,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
101 } 117 }
102 118
103 /* cache this readonly data; minimize chip reads */ 119 /* cache this readonly data; minimize chip reads */
104 ehci->hcs_params = readl(&ehci->caps->hcs_params); 120 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
105 121
106 retval = ehci_halt(ehci); 122 retval = ehci_halt(ehci);
107 if (retval) 123 if (retval)
@@ -235,8 +251,8 @@ static int ehci_pci_suspend(struct usb_hcd *hcd, pm_message_t message)
235 rc = -EINVAL; 251 rc = -EINVAL;
236 goto bail; 252 goto bail;
237 } 253 }
238 writel (0, &ehci->regs->intr_enable); 254 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
239 (void)readl(&ehci->regs->intr_enable); 255 (void)ehci_readl(ehci, &ehci->regs->intr_enable);
240 256
241 /* make sure snapshot being resumed re-enumerates everything */ 257 /* make sure snapshot being resumed re-enumerates everything */
242 if (message.event == PM_EVENT_PRETHAW) { 258 if (message.event == PM_EVENT_PRETHAW) {
@@ -270,13 +286,13 @@ static int ehci_pci_resume(struct usb_hcd *hcd)
270 /* If CF is still set, we maintained PCI Vaux power. 286 /* If CF is still set, we maintained PCI Vaux power.
271 * Just undo the effect of ehci_pci_suspend(). 287 * Just undo the effect of ehci_pci_suspend().
272 */ 288 */
273 if (readl(&ehci->regs->configured_flag) == FLAG_CF) { 289 if (ehci_readl(ehci, &ehci->regs->configured_flag) == FLAG_CF) {
274 int mask = INTR_MASK; 290 int mask = INTR_MASK;
275 291
276 if (!device_may_wakeup(&hcd->self.root_hub->dev)) 292 if (!device_may_wakeup(&hcd->self.root_hub->dev))
277 mask &= ~STS_PCD; 293 mask &= ~STS_PCD;
278 writel(mask, &ehci->regs->intr_enable); 294 ehci_writel(ehci, mask, &ehci->regs->intr_enable);
279 readl(&ehci->regs->intr_enable); 295 ehci_readl(ehci, &ehci->regs->intr_enable);
280 return 0; 296 return 0;
281 } 297 }
282 298
@@ -300,9 +316,9 @@ static int ehci_pci_resume(struct usb_hcd *hcd)
300 /* here we "know" root ports should always stay powered */ 316 /* here we "know" root ports should always stay powered */
301 ehci_port_power(ehci, 1); 317 ehci_port_power(ehci, 1);
302 318
303 writel(ehci->command, &ehci->regs->command); 319 ehci_writel(ehci, ehci->command, &ehci->regs->command);
304 writel(FLAG_CF, &ehci->regs->configured_flag); 320 ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
305 readl(&ehci->regs->command); /* unblock posted writes */ 321 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
306 322
307 hcd->state = HC_STATE_SUSPENDED; 323 hcd->state = HC_STATE_SUSPENDED;
308 return 0; 324 return 0;