ChangeSet 1.1832.55.64, 2004/09/09 16:06:55-07:00, [EMAIL PROTECTED] [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 <[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]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> drivers/usb/host/ohci-dbg.c | 4 ++-- drivers/usb/host/ohci-hcd.c | 16 ++++++++++++---- drivers/usb/host/ohci-hub.c | 9 +++++---- drivers/usb/host/ohci.h | 5 +++-- 4 files changed, 22 insertions(+), 12 deletions(-) diff -Nru a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c --- a/drivers/usb/host/ohci-dbg.c 2004-10-19 08:14:58 -07:00 +++ b/drivers/usb/host/ohci-dbg.c 2004-10-19 08:14:58 -07:00 @@ -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; diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c --- a/drivers/usb/host/ohci-hcd.c 2004-10-19 08:14:58 -07:00 +++ b/drivers/usb/host/ohci-hcd.c 2004-10-19 08:14:58 -07:00 @@ -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 */ } diff -Nru a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c --- a/drivers/usb/host/ohci-hub.c 2004-10-19 08:14:58 -07:00 +++ b/drivers/usb/host/ohci-hub.c 2004-10-19 08:14:58 -07:00 @@ -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) diff -Nru a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h --- a/drivers/usb/host/ohci.h 2004-10-19 08:14:58 -07:00 +++ b/drivers/usb/host/ohci.h 2004-10-19 08:14:58 -07:00 @@ -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); } ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel