Small bugfixes, at least one of which gets rid of some rather random behavior from certain board init behaviors.
Please merge. - Dave
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 <[EMAIL PROTECTED]> for tracking down the specifics. - From Lothar Wassmann <[EMAIL PROTECTED]> 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: David Brownell <[EMAIL PROTECTED]> --- 1.29/drivers/usb/host/ohci-dbg.c Wed Jul 14 15:24:27 2004 +++ edited/drivers/usb/host/ohci-dbg.c Wed Sep 8 22:49:26 2004 @@ -640,14 +640,14 @@ rdata = ohci_readl (®s->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 (®s->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; --- 1.68/drivers/usb/host/ohci-hcd.c Thu Sep 2 09:39:09 2004 +++ edited/drivers/usb/host/ohci-hcd.c Wed Sep 8 22:49:26 2004 @@ -409,11 +409,19 @@ /* 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 */ } --- 1.23/drivers/usb/host/ohci-hub.c Sat Aug 21 16:33:45 2004 +++ edited/drivers/usb/host/ohci-hub.c Wed Sep 8 22:49:26 2004 @@ -146,10 +146,11 @@ 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 @@ 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 @@ /* 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) --- 1.26/drivers/usb/host/ohci.h Thu Sep 2 09:39:10 2004 +++ edited/drivers/usb/host/ohci.h Wed Sep 8 22:49:26 2004 @@ -406,13 +406,14 @@ } #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); }