diff options
author | David Brownell <david-b@pacbell.net> | 2005-08-31 14:52:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-12 15:23:46 -0400 |
commit | fdd13b36c4a501d8787a27e54635fbd943f2685d (patch) | |
tree | eebcc2fc677b5b625235e2e0797b5f9ab6d74905 /drivers/usb/host/ohci-hcd.c | |
parent | e0fd3cbc50a8c925e8e7d8448df689015362c458 (diff) |
[PATCH] USB: OHCI relies less on NDP register
Some OHCI implementations have differences in the way the NDP register
(in roothub_a) reports the number of ports present. This patch allows the
platform specific code to optionally supply the number of ports. The
driver just reads the value at init (if not supplied) instead of reading
it every time its needed (except for an AMD756 bug workaround).
It also sets the value correctly for the ARM pxa27x architecture.
Signed-Off-By: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ohci-hcd.c')
-rw-r--r-- | drivers/usb/host/ohci-hcd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 6efb69f7c075..67c1aa5eb1c1 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -484,6 +484,10 @@ static int ohci_init (struct ohci_hcd *ohci) | |||
484 | // flush the writes | 484 | // flush the writes |
485 | (void) ohci_readl (ohci, &ohci->regs->control); | 485 | (void) ohci_readl (ohci, &ohci->regs->control); |
486 | 486 | ||
487 | /* Read the number of ports unless overridden */ | ||
488 | if (ohci->num_ports == 0) | ||
489 | ohci->num_ports = roothub_a(ohci) & RH_A_NDP; | ||
490 | |||
487 | if (ohci->hcca) | 491 | if (ohci->hcca) |
488 | return 0; | 492 | return 0; |
489 | 493 | ||
@@ -560,10 +564,8 @@ static int ohci_run (struct ohci_hcd *ohci) | |||
560 | msleep(temp); | 564 | msleep(temp); |
561 | temp = roothub_a (ohci); | 565 | temp = roothub_a (ohci); |
562 | if (!(temp & RH_A_NPS)) { | 566 | if (!(temp & RH_A_NPS)) { |
563 | unsigned ports = temp & RH_A_NDP; | ||
564 | |||
565 | /* power down each port */ | 567 | /* power down each port */ |
566 | for (temp = 0; temp < ports; temp++) | 568 | for (temp = 0; temp < ohci->num_ports; temp++) |
567 | ohci_writel (ohci, RH_PS_LSDA, | 569 | ohci_writel (ohci, RH_PS_LSDA, |
568 | &ohci->regs->roothub.portstatus [temp]); | 570 | &ohci->regs->roothub.portstatus [temp]); |
569 | } | 571 | } |
@@ -861,7 +863,7 @@ static int ohci_restart (struct ohci_hcd *ohci) | |||
861 | * and that if we try to turn them back on the root hub | 863 | * and that if we try to turn them back on the root hub |
862 | * will respond to CSC processing. | 864 | * will respond to CSC processing. |
863 | */ | 865 | */ |
864 | i = roothub_a (ohci) & RH_A_NDP; | 866 | i = ohci->num_ports; |
865 | while (i--) | 867 | while (i--) |
866 | ohci_writel (ohci, RH_PS_PSS, | 868 | ohci_writel (ohci, RH_PS_PSS, |
867 | &ohci->regs->roothub.portstatus [temp]); | 869 | &ohci->regs->roothub.portstatus [temp]); |