[RFC] [PATCH] isp1760-hcd: Re-add 195ns timing delay for processing SKIPMAP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I am using an isp1763 on MPC8360 and linux-3.0.0-2 from debian.

The driver is ported from Sebastian's original isp1760 and I am forward porting to Arvid's version.

I noticed that a custom timing delay is missing on the new isp1760. This delay is added in [1]
and an mmiowb() is added in [2]

In my port to the isp1763, not having this delay makes usb mass storage detection unstable.
Adding the code back improves things, but I am still having some timing issues.

Here is the patch for the missing delay...

<diff>
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 125e261..b07879c 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -1103,6 +1103,17 @@ static void handle_done_ptds(struct usb_hcd *hcd)
        int modified;
        int skip_map;

+       /*
+        * When this function is called from the interrupt handler to enqueue
+        * a follow-up packet, the SKIP register gets written and read back
+        * almost immediately. With ISP1761, this register requires a delay of
+        * 195ns between a write and subsequent read (see section 15.1.1.3).
+        * memory barrier is used to ensure the delay is counted after the write
+        * is finished on the device.
+        */
+       mmiowb();
+       ndelay(195);
+
        skip_map = reg_read32(hcd->regs, HC_INT_PTD_SKIPMAP_REG);
        priv->int_done_map &= ~skip_map;
        skip_map = reg_read32(hcd->regs, HC_ATL_PTD_SKIPMAP_REG);
</diff>

The symptoms I am experiencing is very similar to this case [3]
where only some usb mass storage device works and others do not.
My debugging seems to lead to ptd_error like this:

nxp-isp1763 f8010000.usb: check_atl_transfer: ptd error:
        dw0: a80000f8 dw1: 00002021 dw2: 0001a000 dw3: 56000000
        dw4: 00000000 dw5: 00000000 dw6: 00000000 dw7: 00000000
usb 1-1.2: reset high speed USB device number 4 using nxp-isp1763
sd 2:0:0:0: [sdb] No Caching mode page present
sd 2:0:0:0: [sdb] Assuming drive cache: write through
nxp-isp1763 f8010000.usb: check_atl_transfer: ptd error:
        dw0: 28008000 dw1: 00002420 dw2: 00038000 dw3: 52000000
        dw4: 00000000 dw5: 00000000 dw6: 00000000 dw7: 00000000
usb 1-1.2: reset high speed USB device number 4 using nxp-isp1763

Q1: Is my understanding correct (that we need to re-add the ndelay(195) to not violate timing?)
Q2: Any ideas on how I should proceed further in debugging?

References:

[1] http://kerneltrap.org/mailarchive/linux-usb/2009/3/25/5238724
[2] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/patch/drivers/usb/host/isp1760-hcd.c?id=ebb8a4e48722c8f5e04a6490b197d2fbc894a0f6
[3] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/patch/drivers/usb/host/isp1760-hcd.c?id=0954e1c258c4018bfd370da41fbb5deb34582976

Thanks for everyone's time.
--
Richard Retanubun
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux