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

[PATCH] USB: ehci update: 1/3, misc

This is minor "obvious" fixes plus two tweaks to help later
patches:

    - Interrupt QH has a link to the device, needed to implement
      schedule trees (like OHCI does today) that are TT-aware
      (essential for most keyboards and mice).

    - Export the macros that do high bandwidth packetsize stuff.
      They're also needed for high bandwidth ISO transfers.

It also morphs some existing "too much debug info" urb tracing
so it's kicked in by a manual #define EHCI_URB_TRACE.  If some
generic version of that gets added to usbcore, this sort
of debug code can vanish (from all hcds).
parent 96acbb85
...@@ -116,7 +116,7 @@ static inline void dbg_hcc_params (struct ehci_hcd *ehci, char *label) {} ...@@ -116,7 +116,7 @@ static inline void dbg_hcc_params (struct ehci_hcd *ehci, char *label) {}
#ifdef DEBUG #ifdef DEBUG
static void __attribute__((__unused__)) static void __attribute__((__unused__))
dbg_qtd (char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd) dbg_qtd (const char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd)
{ {
ehci_dbg (ehci, "%s td %p n%08x %08x t%08x p0=%08x\n", label, qtd, ehci_dbg (ehci, "%s td %p n%08x %08x t%08x p0=%08x\n", label, qtd,
cpu_to_le32p (&qtd->hw_next), cpu_to_le32p (&qtd->hw_next),
...@@ -132,7 +132,7 @@ dbg_qtd (char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd) ...@@ -132,7 +132,7 @@ dbg_qtd (char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd)
} }
static void __attribute__((__unused__)) static void __attribute__((__unused__))
dbg_qh (char *label, struct ehci_hcd *ehci, struct ehci_qh *qh) dbg_qh (const char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
{ {
ehci_dbg (ehci, "%s qh %p n%08x info %x %x qtd %x\n", label, ehci_dbg (ehci, "%s qh %p n%08x info %x %x qtd %x\n", label,
qh, qh->hw_next, qh->hw_info1, qh->hw_info2, qh, qh->hw_next, qh->hw_info1, qh->hw_info2,
......
...@@ -97,7 +97,9 @@ ...@@ -97,7 +97,9 @@
static const char hcd_name [] = "ehci_hcd"; static const char hcd_name [] = "ehci_hcd";
// #define EHCI_VERBOSE_DEBUG #undef EHCI_VERBOSE_DEBUG
#undef EHCI_URB_TRACE
// #define have_split_iso // #define have_split_iso
#ifdef DEBUG #ifdef DEBUG
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* - driver buffers, read/written by HC ... single shot DMA mapped * - driver buffers, read/written by HC ... single shot DMA mapped
* *
* There's also PCI "register" data, which is memory mapped. * There's also PCI "register" data, which is memory mapped.
* No memory seen by this driver is pagable. * No memory seen by this driver is pageable.
*/ */
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -131,6 +131,7 @@ static void qh_put (struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -131,6 +131,7 @@ static void qh_put (struct ehci_hcd *ehci, struct ehci_qh *qh)
} }
if (qh->dummy) if (qh->dummy)
ehci_qtd_free (ehci, qh->dummy); ehci_qtd_free (ehci, qh->dummy);
usb_put_dev (qh->dev);
pci_pool_free (ehci->qh_pool, qh, qh->qh_dma); pci_pool_free (ehci->qh_pool, qh, qh->qh_dma);
} }
......
...@@ -164,7 +164,8 @@ static void qtd_copy_status ( ...@@ -164,7 +164,8 @@ static void qtd_copy_status (
/* if async CSPLIT failed, try cleaning out the TT buffer */ /* if async CSPLIT failed, try cleaning out the TT buffer */
} else if (urb->dev->tt && !usb_pipeint (urb->pipe) } else if (urb->dev->tt && !usb_pipeint (urb->pipe)
&& QTD_CERR(token) == 0) { && ((token & QTD_STS_MMF) != 0
|| QTD_CERR(token) == 0)) {
#ifdef DEBUG #ifdef DEBUG
struct usb_device *tt = urb->dev->tt->hub; struct usb_device *tt = urb->dev->tt->hub;
dev_dbg (&tt->dev, dev_dbg (&tt->dev,
...@@ -212,6 +213,16 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs) ...@@ -212,6 +213,16 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs)
} }
spin_unlock (&urb->lock); spin_unlock (&urb->lock);
#ifdef EHCI_URB_TRACE
ehci_dbg (ehci,
"%s %s urb %p ep%d%s status %d len %d/%d\n",
__FUNCTION__, urb->dev->devpath, urb,
usb_pipeendpoint (urb->pipe),
usb_pipein (urb->pipe) ? "in" : "out",
urb->status,
urb->actual_length, urb->transfer_buffer_length);
#endif
/* complete() can reenter this HCD */ /* complete() can reenter this HCD */
spin_unlock (&ehci->lock); spin_unlock (&ehci->lock);
usb_hcd_giveback_urb (&ehci->hcd, urb, regs); usb_hcd_giveback_urb (&ehci->hcd, urb, regs);
...@@ -640,6 +651,9 @@ qh_make ( ...@@ -640,6 +651,9 @@ qh_make (
qh->period = urb->interval; qh->period = urb->interval;
} }
/* support for tt scheduling */
qh->dev = usb_get_dev (urb->dev);
} }
/* using TT? */ /* using TT? */
...@@ -699,8 +713,6 @@ qh_make ( ...@@ -699,8 +713,6 @@ qh_make (
usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, 1); usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, 1);
return qh; return qh;
} }
#undef hb_mult
#undef hb_packet
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
...@@ -887,10 +899,14 @@ submit_async ( ...@@ -887,10 +899,14 @@ submit_async (
if (usb_pipein (urb->pipe) && !usb_pipecontrol (urb->pipe)) if (usb_pipein (urb->pipe) && !usb_pipecontrol (urb->pipe))
epnum |= 0x10; epnum |= 0x10;
ehci_vdbg (ehci, "submit_async urb %p len %d ep%d%s qtd %p [qh %p]\n", #ifdef EHCI_URB_TRACE
urb, urb->transfer_buffer_length, ehci_dbg (ehci,
epnum & 0x0f, (epnum & 0x10) ? "in" : "out", "%s %s urb %p ep%d%s len %d, qtd %p [qh %p]\n",
__FUNCTION__, urb->dev->devpath, urb,
epnum & 0x0f, usb_pipein (urb->pipe) ? "in" : "out",
urb->transfer_buffer_length,
qtd, dev ? dev->ep [epnum] : (void *)~0); qtd, dev ? dev->ep [epnum] : (void *)~0);
#endif
spin_lock_irqsave (&ehci->lock, flags); spin_lock_irqsave (&ehci->lock, flags);
qh = qh_append_tds (ehci, urb, qtd_list, epnum, &dev->ep [epnum]); qh = qh_append_tds (ehci, urb, qtd_list, epnum, &dev->ep [epnum]);
......
...@@ -381,7 +381,7 @@ struct ehci_qh { ...@@ -381,7 +381,7 @@ struct ehci_qh {
unsigned short period; /* polling interval */ unsigned short period; /* polling interval */
unsigned short start; /* where polling starts */ unsigned short start; /* where polling starts */
#define NO_FRAME ((unsigned short)~0) /* pick new start */ #define NO_FRAME ((unsigned short)~0) /* pick new start */
struct usb_device *dev; /* access to TT */
} __attribute__ ((aligned (32))); } __attribute__ ((aligned (32)));
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
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