aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2013-09-24 15:09:29 +0530
committerNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2013-10-04 12:01:21 +0530
commita351fc0cbc823aff137f55aea33c9923475482e3 (patch)
tree42c022700634430ac0a5e12cf0fa5b42731a190e /lib
parent2b14fb9a9eab6d6d34850bfb8c5cbd2bc3e94286 (diff)
downloadSLOF-a351fc0cbc823aff137f55aea33c9923475482e3.zip
SLOF-a351fc0cbc823aff137f55aea33c9923475482e3.tar.gz
SLOF-a351fc0cbc823aff137f55aea33c9923475482e3.tar.bz2
usb-ohci: update init and rationalize timings
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libusb/usb-hub.c5
-rw-r--r--lib/libusb/usb-ohci.c25
2 files changed, 17 insertions, 13 deletions
diff --git a/lib/libusb/usb-hub.c b/lib/libusb/usb-hub.c
index f5486c5..a06cb47 100644
--- a/lib/libusb/usb-hub.c
+++ b/lib/libusb/usb-hub.c
@@ -119,7 +119,7 @@ static int hub_check_port(struct usb_dev *dev, int port)
if (!(le16_to_cpu(ps.wPortStatus) & HUB_PS_POWER)) {
hub_set_port_feature(dev, port, HUB_PF_POWER);
- SLOF_msleep(200);
+ SLOF_msleep(100);
time = SLOF_GetTimer() + USB_TIMEOUT;
while (time > SLOF_GetTimer()) {
cpu_relax();
@@ -133,10 +133,9 @@ static int hub_check_port(struct usb_dev *dev, int port)
}
}
- SLOF_msleep(200);
if (le16_to_cpu(ps.wPortStatus) & HUB_PS_CONNECTION) {
hub_set_port_feature(dev, port, HUB_PF_RESET);
- SLOF_msleep(200);
+ SLOF_msleep(100);
time = SLOF_GetTimer() + USB_TIMEOUT;
while (time > SLOF_GetTimer()) {
cpu_relax();
diff --git a/lib/libusb/usb-ohci.c b/lib/libusb/usb-ohci.c
index b19204f..3cd91e1 100644
--- a/lib/libusb/usb-ohci.c
+++ b/lib/libusb/usb-ohci.c
@@ -75,22 +75,21 @@ static int ohci_hcd_reset(struct ohci_regs *regs)
/* USBRESET - 1sec */
write_reg32(&regs->control, 0);
- SLOF_msleep(1000);
+ SLOF_msleep(100);
write_reg32(&regs->intr_disable, ~0);
write_reg32(&regs->cmd_status, OHCI_CMD_STATUS_HCR);
- SLOF_msleep(100);
mb();
- time = SLOF_GetTimer() + USB_TIMEOUT;
- while ((time > SLOF_GetTimer()) &&
- (read_reg32(&regs->cmd_status) & OHCI_CMD_STATUS_HCR))
- cpu_relax();
- if (read_reg32(&regs->cmd_status) & OHCI_CMD_STATUS_HCR) {
- printf(" ** HCD Reset failed...");
- return -1;
+ time = 30; /* wait for not more than 30usec */
+ while ((read_reg32(&regs->cmd_status) & OHCI_CMD_STATUS_HCR) != 0) {
+ time--;
+ if (!time) {
+ printf(" ** HCD Reset failed...");
+ return -1;
+ }
+ SLOF_usleep(1);
}
-
return 0;
}
@@ -103,6 +102,7 @@ static int ohci_hcd_init(struct ohci_hcd *ohcd)
uint32_t oldrwc;
struct usb_dev *rhdev = NULL;
struct usb_ep_descr ep;
+ uint32_t reg;
if (!ohcd)
return -1;
@@ -148,6 +148,11 @@ static int ohci_hcd_init(struct ohci_hcd *ohcd)
*/
write_reg32(&regs->fm_interval, FRAME_INTERVAL);
write_reg32(&regs->period_start, PERIODIC_START);
+ reg = read_reg32(&regs->rh_desc_a);
+ reg &= ~( RHDA_PSM_INDIVIDUAL | RHDA_OCPM_PERPORT );
+ reg |= RHDA_NPS_ENABLE;
+ write_reg32(&regs->rh_desc_a, reg);
+ write_reg32(&regs->rh_desc_b, 0);
mb();
SLOF_msleep(100);
ohci_dump_regs(regs);