Commit 65a7d3e4 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: ohci updates

Small bugfixes, at least one of which gets rid of  some
rather random behavior from certain board init
behaviors.


OHCI updates:

 - Bugfix the code taking frame clock adjustments from the boot loader.
   A recent change had a bug which caused inconsistent failures on some
   OHCI configs, including amd756.  Thanks to <pacman@manson.clss.net>
   for tracking down the specifics.

 - From Lothar Wassmann <lk@karo-electronics.de> two fixes:
     (a) don't let tick clock sign-extend, that can make unlinks
         take excessively long (could happen easily enough);
     (b) when re-activating schedules after suspend, use the right
         bitmask (rare/exotic)

 - When suspending the root hub, mark it as USB_STATE_SUSPENDED
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent a16d6213
......@@ -640,14 +640,14 @@ show_registers (struct class_device *class_dev, char *buf)
rdata = ohci_readl (&regs->fminterval);
temp = scnprintf (next, size,
"fmintvl 0x%08x %sFSMPS=0x%04x FI=0x%04x\n",
rdata, (rdata >> 31) ? " FIT" : "",
rdata, (rdata >> 31) ? "FIT " : "",
(rdata >> 16) & 0xefff, rdata & 0xffff);
size -= temp;
next += temp;
rdata = ohci_readl (&regs->fmremaining);
temp = scnprintf (next, size, "fmremaining 0x%08x %sFR=0x%04x\n",
rdata, (rdata >> 31) ? " FRT" : "",
rdata, (rdata >> 31) ? "FRT " : "",
rdata & 0x3fff);
size -= temp;
next += temp;
......
......@@ -409,11 +409,19 @@ static int hc_reset (struct ohci_hcd *ohci)
/* boot firmware should have set this up (5.1.1.3.1) */
if (!ohci->fminterval) {
u32 t2;
temp = ohci_readl (&ohci->regs->fminterval);
if (temp & 0x3fff0000)
ohci->fminterval = temp;
else
ohci->fminterval = DEFAULT_FMINTERVAL;
ohci->fminterval = temp & 0x3fff;
if (ohci->fminterval != FI)
ohci_dbg (ohci, "fminterval delta %d\n",
ohci->fminterval - FI);
t2 = FSMP (ohci->fminterval);
temp >>= 16;
if ((t2/2) < temp || temp > t2)
temp = t2;
ohci->fminterval |= temp << 16;
/* also: power/overcurrent flags in roothub.a */
}
......
......@@ -146,10 +146,11 @@ static int ohci_hub_suspend (struct usb_hcd *hcd)
ohci->next_statechange = jiffies + msecs_to_jiffies (5);
succeed:
/* it's not USB_STATE_SUSPENDED unless access to this
/* it's not HCD_STATE_SUSPENDED unless access to this
* hub from the non-usb side (PCI, SOC, etc) stopped
*/
root->dev.power.power_state = 3;
root->state = USB_STATE_SUSPENDED;
done:
spin_unlock_irq (&ohci->lock);
return status;
......@@ -289,7 +290,7 @@ static int ohci_hub_resume (struct usb_hcd *hcd)
ohci->hc_control |= enables;
writel (ohci->hc_control, &ohci->regs->control);
if (temp)
writel (status, &ohci->regs->cmdstatus);
writel (temp, &ohci->regs->cmdstatus);
(void) ohci_readl (&ohci->regs->control);
}
......@@ -481,8 +482,8 @@ static void start_hnp(struct ohci_hcd *ohci);
/* this timer value might be vendor-specific ... */
#define PORT_RESET_HW_MSEC 10
/* wrap-aware logic stolen from <linux/jiffies.h> */
#define tick_before(t1,t2) ((((s16)(t1))-((s16)(t2))) < 0)
/* wrap-aware logic morphed from <linux/jiffies.h> */
#define tick_before(t1,t2) ((s16)(((s16)(t1))-((s16)(t2))) < 0)
/* called from some task, normally khubd */
static inline void root_port_reset (struct ohci_hcd *ohci, unsigned port)
......
......@@ -406,13 +406,14 @@ static inline void disable (struct ohci_hcd *ohci)
}
#define FI 0x2edf /* 12000 bits per frame (-1) */
#define DEFAULT_FMINTERVAL ((((6 * (FI - 210)) / 7) << 16) | FI)
#define FSMP(fi) ((6 * ((fi) - 210)) / 7)
#define LSTHRESH 0x628 /* lowspeed bit threshold */
static inline void periodic_reinit (struct ohci_hcd *ohci)
{
u32 fi = ohci->fminterval & 0x0ffff;
writel (ohci->fminterval, &ohci->regs->fminterval);
writel (((9 * FI) / 10) & 0x3fff, &ohci->regs->periodicstart);
writel (((9 * fi) / 10) & 0x3fff, &ohci->regs->periodicstart);
writel (LSTHRESH, &ohci->regs->lsthresh);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment