diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-07 22:23:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-07 22:23:21 -0500 |
commit | c96e2c92072d3e78954c961f53d8c7352f7abbd7 (patch) | |
tree | d844f26f926ff40e98e9eae0e11fd71acad81df4 /drivers/usb/host/ehci-hcd.c | |
parent | f2aca47dc3c2d0c2d5dbd972558557e74232bbce (diff) | |
parent | 64358164f5bfe5e11d4040c1eb674c29e1436ce5 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (70 commits)
USB: remove duplicate device id from zc0301
USB: remove duplicate device id from usb_storage
USB: remove duplicate device id from keyspan
USB: remove duplicate device id from ftdi_sio
USB: remove duplicate device id from visor
USB: a bit more coding style cleanup
usbcore: trivial whitespace fixes
usb-storage: use first bulk endpoints, not last
EHCI: fix interrupt-driven remote wakeup
USB: switch ehci-hcd to new polling scheme
USB: autosuspend for usb printer driver
USB Input: Added kernel module to support all GTCO CalComp USB InterWrite School products
USB: Sierra Wireless auto set D0
USB: usb ethernet gadget recognizes HUSB2DEV
USB: list atmel husb2_udc gadget controller
USB: gadgetfs AIO tweaks
USB: gadgetfs behaves better on userspace init bug
USB: gadgetfs race fix
USB: gadgetfs simplifications
USB: gadgetfs cleanups
...
Diffstat (limited to 'drivers/usb/host/ehci-hcd.c')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 127 |
1 files changed, 83 insertions, 44 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 025d33313681..185721dba42b 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -157,12 +157,13 @@ MODULE_PARM_DESC (ignore_oc, "ignore bogus hardware overcurrent indications"); | |||
157 | * before driver shutdown. But it also seems to be caused by bugs in cardbus | 157 | * before driver shutdown. But it also seems to be caused by bugs in cardbus |
158 | * bridge shutdown: shutting down the bridge before the devices using it. | 158 | * bridge shutdown: shutting down the bridge before the devices using it. |
159 | */ | 159 | */ |
160 | static int handshake (void __iomem *ptr, u32 mask, u32 done, int usec) | 160 | static int handshake (struct ehci_hcd *ehci, void __iomem *ptr, |
161 | u32 mask, u32 done, int usec) | ||
161 | { | 162 | { |
162 | u32 result; | 163 | u32 result; |
163 | 164 | ||
164 | do { | 165 | do { |
165 | result = readl (ptr); | 166 | result = ehci_readl(ehci, ptr); |
166 | if (result == ~(u32)0) /* card removed */ | 167 | if (result == ~(u32)0) /* card removed */ |
167 | return -ENODEV; | 168 | return -ENODEV; |
168 | result &= mask; | 169 | result &= mask; |
@@ -177,18 +178,19 @@ static int handshake (void __iomem *ptr, u32 mask, u32 done, int usec) | |||
177 | /* force HC to halt state from unknown (EHCI spec section 2.3) */ | 178 | /* force HC to halt state from unknown (EHCI spec section 2.3) */ |
178 | static int ehci_halt (struct ehci_hcd *ehci) | 179 | static int ehci_halt (struct ehci_hcd *ehci) |
179 | { | 180 | { |
180 | u32 temp = readl (&ehci->regs->status); | 181 | u32 temp = ehci_readl(ehci, &ehci->regs->status); |
181 | 182 | ||
182 | /* disable any irqs left enabled by previous code */ | 183 | /* disable any irqs left enabled by previous code */ |
183 | writel (0, &ehci->regs->intr_enable); | 184 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); |
184 | 185 | ||
185 | if ((temp & STS_HALT) != 0) | 186 | if ((temp & STS_HALT) != 0) |
186 | return 0; | 187 | return 0; |
187 | 188 | ||
188 | temp = readl (&ehci->regs->command); | 189 | temp = ehci_readl(ehci, &ehci->regs->command); |
189 | temp &= ~CMD_RUN; | 190 | temp &= ~CMD_RUN; |
190 | writel (temp, &ehci->regs->command); | 191 | ehci_writel(ehci, temp, &ehci->regs->command); |
191 | return handshake (&ehci->regs->status, STS_HALT, STS_HALT, 16 * 125); | 192 | return handshake (ehci, &ehci->regs->status, |
193 | STS_HALT, STS_HALT, 16 * 125); | ||
192 | } | 194 | } |
193 | 195 | ||
194 | /* put TDI/ARC silicon into EHCI mode */ | 196 | /* put TDI/ARC silicon into EHCI mode */ |
@@ -198,23 +200,24 @@ static void tdi_reset (struct ehci_hcd *ehci) | |||
198 | u32 tmp; | 200 | u32 tmp; |
199 | 201 | ||
200 | reg_ptr = (u32 __iomem *)(((u8 __iomem *)ehci->regs) + 0x68); | 202 | reg_ptr = (u32 __iomem *)(((u8 __iomem *)ehci->regs) + 0x68); |
201 | tmp = readl (reg_ptr); | 203 | tmp = ehci_readl(ehci, reg_ptr); |
202 | tmp |= 0x3; | 204 | tmp |= 0x3; |
203 | writel (tmp, reg_ptr); | 205 | ehci_writel(ehci, tmp, reg_ptr); |
204 | } | 206 | } |
205 | 207 | ||
206 | /* reset a non-running (STS_HALT == 1) controller */ | 208 | /* reset a non-running (STS_HALT == 1) controller */ |
207 | static int ehci_reset (struct ehci_hcd *ehci) | 209 | static int ehci_reset (struct ehci_hcd *ehci) |
208 | { | 210 | { |
209 | int retval; | 211 | int retval; |
210 | u32 command = readl (&ehci->regs->command); | 212 | u32 command = ehci_readl(ehci, &ehci->regs->command); |
211 | 213 | ||
212 | command |= CMD_RESET; | 214 | command |= CMD_RESET; |
213 | dbg_cmd (ehci, "reset", command); | 215 | dbg_cmd (ehci, "reset", command); |
214 | writel (command, &ehci->regs->command); | 216 | ehci_writel(ehci, command, &ehci->regs->command); |
215 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; | 217 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; |
216 | ehci->next_statechange = jiffies; | 218 | ehci->next_statechange = jiffies; |
217 | retval = handshake (&ehci->regs->command, CMD_RESET, 0, 250 * 1000); | 219 | retval = handshake (ehci, &ehci->regs->command, |
220 | CMD_RESET, 0, 250 * 1000); | ||
218 | 221 | ||
219 | if (retval) | 222 | if (retval) |
220 | return retval; | 223 | return retval; |
@@ -236,21 +239,21 @@ static void ehci_quiesce (struct ehci_hcd *ehci) | |||
236 | #endif | 239 | #endif |
237 | 240 | ||
238 | /* wait for any schedule enables/disables to take effect */ | 241 | /* wait for any schedule enables/disables to take effect */ |
239 | temp = readl (&ehci->regs->command) << 10; | 242 | temp = ehci_readl(ehci, &ehci->regs->command) << 10; |
240 | temp &= STS_ASS | STS_PSS; | 243 | temp &= STS_ASS | STS_PSS; |
241 | if (handshake (&ehci->regs->status, STS_ASS | STS_PSS, | 244 | if (handshake (ehci, &ehci->regs->status, STS_ASS | STS_PSS, |
242 | temp, 16 * 125) != 0) { | 245 | temp, 16 * 125) != 0) { |
243 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; | 246 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; |
244 | return; | 247 | return; |
245 | } | 248 | } |
246 | 249 | ||
247 | /* then disable anything that's still active */ | 250 | /* then disable anything that's still active */ |
248 | temp = readl (&ehci->regs->command); | 251 | temp = ehci_readl(ehci, &ehci->regs->command); |
249 | temp &= ~(CMD_ASE | CMD_IAAD | CMD_PSE); | 252 | temp &= ~(CMD_ASE | CMD_IAAD | CMD_PSE); |
250 | writel (temp, &ehci->regs->command); | 253 | ehci_writel(ehci, temp, &ehci->regs->command); |
251 | 254 | ||
252 | /* hardware can take 16 microframes to turn off ... */ | 255 | /* hardware can take 16 microframes to turn off ... */ |
253 | if (handshake (&ehci->regs->status, STS_ASS | STS_PSS, | 256 | if (handshake (ehci, &ehci->regs->status, STS_ASS | STS_PSS, |
254 | 0, 16 * 125) != 0) { | 257 | 0, 16 * 125) != 0) { |
255 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; | 258 | ehci_to_hcd(ehci)->state = HC_STATE_HALT; |
256 | return; | 259 | return; |
@@ -277,11 +280,11 @@ static void ehci_watchdog (unsigned long param) | |||
277 | 280 | ||
278 | /* lost IAA irqs wedge things badly; seen with a vt8235 */ | 281 | /* lost IAA irqs wedge things badly; seen with a vt8235 */ |
279 | if (ehci->reclaim) { | 282 | if (ehci->reclaim) { |
280 | u32 status = readl (&ehci->regs->status); | 283 | u32 status = ehci_readl(ehci, &ehci->regs->status); |
281 | if (status & STS_IAA) { | 284 | if (status & STS_IAA) { |
282 | ehci_vdbg (ehci, "lost IAA\n"); | 285 | ehci_vdbg (ehci, "lost IAA\n"); |
283 | COUNT (ehci->stats.lost_iaa); | 286 | COUNT (ehci->stats.lost_iaa); |
284 | writel (STS_IAA, &ehci->regs->status); | 287 | ehci_writel(ehci, STS_IAA, &ehci->regs->status); |
285 | ehci->reclaim_ready = 1; | 288 | ehci->reclaim_ready = 1; |
286 | } | 289 | } |
287 | } | 290 | } |
@@ -309,7 +312,7 @@ ehci_shutdown (struct usb_hcd *hcd) | |||
309 | (void) ehci_halt (ehci); | 312 | (void) ehci_halt (ehci); |
310 | 313 | ||
311 | /* make BIOS/etc use companion controller during reboot */ | 314 | /* make BIOS/etc use companion controller during reboot */ |
312 | writel (0, &ehci->regs->configured_flag); | 315 | ehci_writel(ehci, 0, &ehci->regs->configured_flag); |
313 | } | 316 | } |
314 | 317 | ||
315 | static void ehci_port_power (struct ehci_hcd *ehci, int is_on) | 318 | static void ehci_port_power (struct ehci_hcd *ehci, int is_on) |
@@ -379,12 +382,13 @@ static void ehci_stop (struct usb_hcd *hcd) | |||
379 | ehci_quiesce (ehci); | 382 | ehci_quiesce (ehci); |
380 | 383 | ||
381 | ehci_reset (ehci); | 384 | ehci_reset (ehci); |
382 | writel (0, &ehci->regs->intr_enable); | 385 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); |
383 | spin_unlock_irq(&ehci->lock); | 386 | spin_unlock_irq(&ehci->lock); |
384 | 387 | ||
385 | /* let companion controllers work when we aren't */ | 388 | /* let companion controllers work when we aren't */ |
386 | writel (0, &ehci->regs->configured_flag); | 389 | ehci_writel(ehci, 0, &ehci->regs->configured_flag); |
387 | 390 | ||
391 | remove_companion_file(ehci); | ||
388 | remove_debug_files (ehci); | 392 | remove_debug_files (ehci); |
389 | 393 | ||
390 | /* root hub is shut down separately (first, when possible) */ | 394 | /* root hub is shut down separately (first, when possible) */ |
@@ -402,7 +406,8 @@ static void ehci_stop (struct usb_hcd *hcd) | |||
402 | ehci->stats.complete, ehci->stats.unlink); | 406 | ehci->stats.complete, ehci->stats.unlink); |
403 | #endif | 407 | #endif |
404 | 408 | ||
405 | dbg_status (ehci, "ehci_stop completed", readl (&ehci->regs->status)); | 409 | dbg_status (ehci, "ehci_stop completed", |
410 | ehci_readl(ehci, &ehci->regs->status)); | ||
406 | } | 411 | } |
407 | 412 | ||
408 | /* one-time init, only for memory state */ | 413 | /* one-time init, only for memory state */ |
@@ -428,7 +433,7 @@ static int ehci_init(struct usb_hcd *hcd) | |||
428 | return retval; | 433 | return retval; |
429 | 434 | ||
430 | /* controllers may cache some of the periodic schedule ... */ | 435 | /* controllers may cache some of the periodic schedule ... */ |
431 | hcc_params = readl(&ehci->caps->hcc_params); | 436 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); |
432 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache | 437 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache |
433 | ehci->i_thresh = 8; | 438 | ehci->i_thresh = 8; |
434 | else // N microframes cached | 439 | else // N microframes cached |
@@ -496,13 +501,16 @@ static int ehci_run (struct usb_hcd *hcd) | |||
496 | u32 temp; | 501 | u32 temp; |
497 | u32 hcc_params; | 502 | u32 hcc_params; |
498 | 503 | ||
504 | hcd->uses_new_polling = 1; | ||
505 | hcd->poll_rh = 0; | ||
506 | |||
499 | /* EHCI spec section 4.1 */ | 507 | /* EHCI spec section 4.1 */ |
500 | if ((retval = ehci_reset(ehci)) != 0) { | 508 | if ((retval = ehci_reset(ehci)) != 0) { |
501 | ehci_mem_cleanup(ehci); | 509 | ehci_mem_cleanup(ehci); |
502 | return retval; | 510 | return retval; |
503 | } | 511 | } |
504 | writel(ehci->periodic_dma, &ehci->regs->frame_list); | 512 | ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list); |
505 | writel((u32)ehci->async->qh_dma, &ehci->regs->async_next); | 513 | ehci_writel(ehci, (u32)ehci->async->qh_dma, &ehci->regs->async_next); |
506 | 514 | ||
507 | /* | 515 | /* |
508 | * hcc_params controls whether ehci->regs->segment must (!!!) | 516 | * hcc_params controls whether ehci->regs->segment must (!!!) |
@@ -516,9 +524,9 @@ static int ehci_run (struct usb_hcd *hcd) | |||
516 | * Scsi_Host.highmem_io, and so forth. It's readonly to all | 524 | * Scsi_Host.highmem_io, and so forth. It's readonly to all |
517 | * host side drivers though. | 525 | * host side drivers though. |
518 | */ | 526 | */ |
519 | hcc_params = readl(&ehci->caps->hcc_params); | 527 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); |
520 | if (HCC_64BIT_ADDR(hcc_params)) { | 528 | if (HCC_64BIT_ADDR(hcc_params)) { |
521 | writel(0, &ehci->regs->segment); | 529 | ehci_writel(ehci, 0, &ehci->regs->segment); |
522 | #if 0 | 530 | #if 0 |
523 | // this is deeply broken on almost all architectures | 531 | // this is deeply broken on almost all architectures |
524 | if (!dma_set_mask(hcd->self.controller, DMA_64BIT_MASK)) | 532 | if (!dma_set_mask(hcd->self.controller, DMA_64BIT_MASK)) |
@@ -531,7 +539,7 @@ static int ehci_run (struct usb_hcd *hcd) | |||
531 | // root hub will detect new devices (why?); NEC doesn't | 539 | // root hub will detect new devices (why?); NEC doesn't |
532 | ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET); | 540 | ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET); |
533 | ehci->command |= CMD_RUN; | 541 | ehci->command |= CMD_RUN; |
534 | writel (ehci->command, &ehci->regs->command); | 542 | ehci_writel(ehci, ehci->command, &ehci->regs->command); |
535 | dbg_cmd (ehci, "init", ehci->command); | 543 | dbg_cmd (ehci, "init", ehci->command); |
536 | 544 | ||
537 | /* | 545 | /* |
@@ -541,23 +549,25 @@ static int ehci_run (struct usb_hcd *hcd) | |||
541 | * and there's no companion controller unless maybe for USB OTG.) | 549 | * and there's no companion controller unless maybe for USB OTG.) |
542 | */ | 550 | */ |
543 | hcd->state = HC_STATE_RUNNING; | 551 | hcd->state = HC_STATE_RUNNING; |
544 | writel (FLAG_CF, &ehci->regs->configured_flag); | 552 | ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); |
545 | readl (&ehci->regs->command); /* unblock posted writes */ | 553 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ |
546 | 554 | ||
547 | temp = HC_VERSION(readl (&ehci->caps->hc_capbase)); | 555 | temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
548 | ehci_info (ehci, | 556 | ehci_info (ehci, |
549 | "USB %x.%x started, EHCI %x.%02x, driver %s%s\n", | 557 | "USB %x.%x started, EHCI %x.%02x, driver %s%s\n", |
550 | ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), | 558 | ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), |
551 | temp >> 8, temp & 0xff, DRIVER_VERSION, | 559 | temp >> 8, temp & 0xff, DRIVER_VERSION, |
552 | ignore_oc ? ", overcurrent ignored" : ""); | 560 | ignore_oc ? ", overcurrent ignored" : ""); |
553 | 561 | ||
554 | writel (INTR_MASK, &ehci->regs->intr_enable); /* Turn On Interrupts */ | 562 | ehci_writel(ehci, INTR_MASK, |
563 | &ehci->regs->intr_enable); /* Turn On Interrupts */ | ||
555 | 564 | ||
556 | /* GRR this is run-once init(), being done every time the HC starts. | 565 | /* GRR this is run-once init(), being done every time the HC starts. |
557 | * So long as they're part of class devices, we can't do it init() | 566 | * So long as they're part of class devices, we can't do it init() |
558 | * since the class device isn't created that early. | 567 | * since the class device isn't created that early. |
559 | */ | 568 | */ |
560 | create_debug_files(ehci); | 569 | create_debug_files(ehci); |
570 | create_companion_file(ehci); | ||
561 | 571 | ||
562 | return 0; | 572 | return 0; |
563 | } | 573 | } |
@@ -567,12 +577,12 @@ static int ehci_run (struct usb_hcd *hcd) | |||
567 | static irqreturn_t ehci_irq (struct usb_hcd *hcd) | 577 | static irqreturn_t ehci_irq (struct usb_hcd *hcd) |
568 | { | 578 | { |
569 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 579 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
570 | u32 status; | 580 | u32 status, pcd_status = 0; |
571 | int bh; | 581 | int bh; |
572 | 582 | ||
573 | spin_lock (&ehci->lock); | 583 | spin_lock (&ehci->lock); |
574 | 584 | ||
575 | status = readl (&ehci->regs->status); | 585 | status = ehci_readl(ehci, &ehci->regs->status); |
576 | 586 | ||
577 | /* e.g. cardbus physical eject */ | 587 | /* e.g. cardbus physical eject */ |
578 | if (status == ~(u32) 0) { | 588 | if (status == ~(u32) 0) { |
@@ -587,8 +597,8 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
587 | } | 597 | } |
588 | 598 | ||
589 | /* clear (just) interrupts */ | 599 | /* clear (just) interrupts */ |
590 | writel (status, &ehci->regs->status); | 600 | ehci_writel(ehci, status, &ehci->regs->status); |
591 | readl (&ehci->regs->command); /* unblock posted write */ | 601 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */ |
592 | bh = 0; | 602 | bh = 0; |
593 | 603 | ||
594 | #ifdef EHCI_VERBOSE_DEBUG | 604 | #ifdef EHCI_VERBOSE_DEBUG |
@@ -617,13 +627,15 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
617 | /* remote wakeup [4.3.1] */ | 627 | /* remote wakeup [4.3.1] */ |
618 | if (status & STS_PCD) { | 628 | if (status & STS_PCD) { |
619 | unsigned i = HCS_N_PORTS (ehci->hcs_params); | 629 | unsigned i = HCS_N_PORTS (ehci->hcs_params); |
630 | pcd_status = status; | ||
620 | 631 | ||
621 | /* resume root hub? */ | 632 | /* resume root hub? */ |
622 | if (!(readl(&ehci->regs->command) & CMD_RUN)) | 633 | if (!(ehci_readl(ehci, &ehci->regs->command) & CMD_RUN)) |
623 | usb_hcd_resume_root_hub(hcd); | 634 | usb_hcd_resume_root_hub(hcd); |
624 | 635 | ||
625 | while (i--) { | 636 | while (i--) { |
626 | int pstatus = readl (&ehci->regs->port_status [i]); | 637 | int pstatus = ehci_readl(ehci, |
638 | &ehci->regs->port_status [i]); | ||
627 | 639 | ||
628 | if (pstatus & PORT_OWNER) | 640 | if (pstatus & PORT_OWNER) |
629 | continue; | 641 | continue; |
@@ -643,14 +655,15 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
643 | /* PCI errors [4.15.2.4] */ | 655 | /* PCI errors [4.15.2.4] */ |
644 | if (unlikely ((status & STS_FATAL) != 0)) { | 656 | if (unlikely ((status & STS_FATAL) != 0)) { |
645 | /* bogus "fatal" IRQs appear on some chips... why? */ | 657 | /* bogus "fatal" IRQs appear on some chips... why? */ |
646 | status = readl (&ehci->regs->status); | 658 | status = ehci_readl(ehci, &ehci->regs->status); |
647 | dbg_cmd (ehci, "fatal", readl (&ehci->regs->command)); | 659 | dbg_cmd (ehci, "fatal", ehci_readl(ehci, |
660 | &ehci->regs->command)); | ||
648 | dbg_status (ehci, "fatal", status); | 661 | dbg_status (ehci, "fatal", status); |
649 | if (status & STS_HALT) { | 662 | if (status & STS_HALT) { |
650 | ehci_err (ehci, "fatal error\n"); | 663 | ehci_err (ehci, "fatal error\n"); |
651 | dead: | 664 | dead: |
652 | ehci_reset (ehci); | 665 | ehci_reset (ehci); |
653 | writel (0, &ehci->regs->configured_flag); | 666 | ehci_writel(ehci, 0, &ehci->regs->configured_flag); |
654 | /* generic layer kills/unlinks all urbs, then | 667 | /* generic layer kills/unlinks all urbs, then |
655 | * uses ehci_stop to clean up the rest | 668 | * uses ehci_stop to clean up the rest |
656 | */ | 669 | */ |
@@ -661,6 +674,8 @@ dead: | |||
661 | if (bh) | 674 | if (bh) |
662 | ehci_work (ehci); | 675 | ehci_work (ehci); |
663 | spin_unlock (&ehci->lock); | 676 | spin_unlock (&ehci->lock); |
677 | if (pcd_status & STS_PCD) | ||
678 | usb_hcd_poll_rh_status(hcd); | ||
664 | return IRQ_HANDLED; | 679 | return IRQ_HANDLED; |
665 | } | 680 | } |
666 | 681 | ||
@@ -873,7 +888,8 @@ done: | |||
873 | static int ehci_get_frame (struct usb_hcd *hcd) | 888 | static int ehci_get_frame (struct usb_hcd *hcd) |
874 | { | 889 | { |
875 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 890 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
876 | return (readl (&ehci->regs->frame_index) >> 3) % ehci->periodic_size; | 891 | return (ehci_readl(ehci, &ehci->regs->frame_index) >> 3) % |
892 | ehci->periodic_size; | ||
877 | } | 893 | } |
878 | 894 | ||
879 | /*-------------------------------------------------------------------------*/ | 895 | /*-------------------------------------------------------------------------*/ |
@@ -899,7 +915,13 @@ MODULE_LICENSE ("GPL"); | |||
899 | #define PLATFORM_DRIVER ehci_hcd_au1xxx_driver | 915 | #define PLATFORM_DRIVER ehci_hcd_au1xxx_driver |
900 | #endif | 916 | #endif |
901 | 917 | ||
902 | #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) | 918 | #ifdef CONFIG_PPC_PS3 |
919 | #include "ehci-ps3.c" | ||
920 | #define PS3_SYSTEM_BUS_DRIVER ps3_ehci_sb_driver | ||
921 | #endif | ||
922 | |||
923 | #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ | ||
924 | !defined(PS3_SYSTEM_BUS_DRIVER) | ||
903 | #error "missing bus glue for ehci-hcd" | 925 | #error "missing bus glue for ehci-hcd" |
904 | #endif | 926 | #endif |
905 | 927 | ||
@@ -924,6 +946,20 @@ static int __init ehci_hcd_init(void) | |||
924 | #ifdef PLATFORM_DRIVER | 946 | #ifdef PLATFORM_DRIVER |
925 | platform_driver_unregister(&PLATFORM_DRIVER); | 947 | platform_driver_unregister(&PLATFORM_DRIVER); |
926 | #endif | 948 | #endif |
949 | return retval; | ||
950 | } | ||
951 | #endif | ||
952 | |||
953 | #ifdef PS3_SYSTEM_BUS_DRIVER | ||
954 | retval = ps3_system_bus_driver_register(&PS3_SYSTEM_BUS_DRIVER); | ||
955 | if (retval < 0) { | ||
956 | #ifdef PLATFORM_DRIVER | ||
957 | platform_driver_unregister(&PLATFORM_DRIVER); | ||
958 | #endif | ||
959 | #ifdef PCI_DRIVER | ||
960 | pci_unregister_driver(&PCI_DRIVER); | ||
961 | #endif | ||
962 | return retval; | ||
927 | } | 963 | } |
928 | #endif | 964 | #endif |
929 | 965 | ||
@@ -939,6 +975,9 @@ static void __exit ehci_hcd_cleanup(void) | |||
939 | #ifdef PCI_DRIVER | 975 | #ifdef PCI_DRIVER |
940 | pci_unregister_driver(&PCI_DRIVER); | 976 | pci_unregister_driver(&PCI_DRIVER); |
941 | #endif | 977 | #endif |
978 | #ifdef PS3_SYSTEM_BUS_DRIVER | ||
979 | ps3_system_bus_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); | ||
980 | #endif | ||
942 | } | 981 | } |
943 | module_exit(ehci_hcd_cleanup); | 982 | module_exit(ehci_hcd_cleanup); |
944 | 983 | ||