]> git.hungrycats.org Git - linux/commitdiff
[PATCH] USB: ehci update: 1/3, misc
authorDavid Brownell <david-b@pacbell.net>
Fri, 16 Jan 2004 08:42:42 +0000 (00:42 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 16 Jan 2004 08:42:42 +0000 (00:42 -0800)
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).

drivers/usb/host/ehci-dbg.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-mem.c
drivers/usb/host/ehci-q.c
drivers/usb/host/ehci.h

index 42214fa4945e985e1404865adc9ea377e50da173..99a00ab87218c0619e3fc6d15a843ecb2791b9eb 100644 (file)
@@ -116,7 +116,7 @@ static inline void dbg_hcc_params (struct ehci_hcd *ehci, char *label) {}
 #ifdef DEBUG
 
 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,
                cpu_to_le32p (&qtd->hw_next),
@@ -132,7 +132,7 @@ dbg_qtd (char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd)
 }
 
 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,
                qh, qh->hw_next, qh->hw_info1, qh->hw_info2,
index bbd8dad7883fb1384b90e6dbded7b13ad3a7c4f4..e2317fdd1f01d2ae18ce8dc483454e069b20c2c1 100644 (file)
@@ -97,7 +97,9 @@
 static const char      hcd_name [] = "ehci_hcd";
 
 
-// #define EHCI_VERBOSE_DEBUG
+#undef EHCI_VERBOSE_DEBUG
+#undef EHCI_URB_TRACE
+
 // #define have_split_iso
 
 #ifdef DEBUG
index 65f8ab8c82559ed94537eff72d1feba3124074b4..812563661b49fc936f125276d1be6fd04ad4392f 100644 (file)
@@ -28,7 +28,7 @@
  *     - driver buffers, read/written by HC ... single shot DMA 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)
        }
        if (qh->dummy)
                ehci_qtd_free (ehci, qh->dummy);
+       usb_put_dev (qh->dev);
        pci_pool_free (ehci->qh_pool, qh, qh->qh_dma);
 }
 
index bafc981be5ebde3b7711ea96c3009f594c8a3495..84ee330db7f60bd1f70eb3d64bddbfe7f1c5abf1 100644 (file)
@@ -164,7 +164,8 @@ static void qtd_copy_status (
 
                /* if async CSPLIT failed, try cleaning out the TT buffer */
                } else if (urb->dev->tt && !usb_pipeint (urb->pipe)
-                               && QTD_CERR(token) == 0) {
+                               && ((token & QTD_STS_MMF) != 0
+                                       || QTD_CERR(token) == 0)) {
 #ifdef DEBUG
                        struct usb_device *tt = urb->dev->tt->hub;
                        dev_dbg (&tt->dev,
@@ -212,6 +213,16 @@ ehci_urb_done (struct ehci_hcd *ehci, struct urb *urb, struct pt_regs *regs)
        }
        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 */
        spin_unlock (&ehci->lock);
        usb_hcd_giveback_urb (&ehci->hcd, urb, regs);
@@ -640,6 +651,9 @@ qh_make (
 
                        qh->period = urb->interval;
                }
+
+               /* support for tt scheduling */
+               qh->dev = usb_get_dev (urb->dev);
        }
 
        /* using TT? */
@@ -699,8 +713,6 @@ done:
        usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, 1);
        return qh;
 }
-#undef hb_mult
-#undef hb_packet
 
 /*-------------------------------------------------------------------------*/
 
@@ -887,10 +899,14 @@ submit_async (
        if (usb_pipein (urb->pipe) && !usb_pipecontrol (urb->pipe))
                epnum |= 0x10;
 
-       ehci_vdbg (ehci, "submit_async urb %p len %d ep%d%s qtd %p [qh %p]\n",
-               urb, urb->transfer_buffer_length,
-               epnum & 0x0f, (epnum & 0x10) ? "in" : "out",
+#ifdef EHCI_URB_TRACE
+       ehci_dbg (ehci,
+               "%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);
+#endif
 
        spin_lock_irqsave (&ehci->lock, flags);
        qh = qh_append_tds (ehci, urb, qtd_list, epnum, &dev->ep [epnum]);
index a24a60f3da9c6e6128cc188e74d283d43a1571bb..5b4aab7df5bd78d7823889b1ae911dd7d09afa28 100644 (file)
@@ -381,7 +381,7 @@ struct ehci_qh {
        unsigned short          period;         /* polling interval */
        unsigned short          start;          /* where polling starts */
 #define NO_FRAME ((unsigned short)~0)                  /* pick new start */
-
+       struct usb_device       *dev;           /* access to TT */
 } __attribute__ ((aligned (32)));
 
 /*-------------------------------------------------------------------------*/