Hey.  I nearly have this driver working (I hope), and I wanted to
give you some feedback so far on what I needed to do to get it into
my kernel.

I'm using a Sharp LH7A40x SoC, on my own custom board.  This is
using the Philips ISP1362 USB-OTG controller, but I'm only using it
for host capability.  I have no DMA to the chip, and no way to do a
hardware reset.  That seems to be fine.  I previously got the
'ohci-isp1362' driver working to the point where I could reliably
read (but not write) to a usb flash drive, so I'm trying this
driver out to hopefully address the writing issue, as well as
increase performance (hopefully) and debugability (and community
support).

I grabbed Lothar's isp1362-hcd driver, based off of Olav's driver
for the isp116x.  (Thanks Lothar & Olav & all)  The patch applied
fine to linux 2.6.11-mm2 with my architecture patches.  I followed
the suggested platform device init, and that worked great.

I needed to modify the drivers/usb/Makefile before it would compile
in:

diff -dbBurN linux-2.6.11-mm2/drivers/usb/Makefile
linux-2.6.11-mm2-oscar4_usb/drivers/usb/Makefile
--- linux-2.6.11-mm2/drivers/usb/Makefile       2005-04-25
15:29:50.000000000 -0500
+++ linux-2.6.11-mm2-oscar4_usb/drivers/usb/Makefile    2005-04-25
16:51:24.000000000 -0500
@@ -12,6 +12,7 @@
 obj-$(CONFIG_USB_OHCI_HCD)     += host/
 obj-$(CONFIG_USB_UHCI_HCD)     += host/
 obj-$(CONFIG_USB_SL811_HCD)    += host/
+obj-$(CONFIG_USB_ISP1362_HCD)   += host/
 obj-$(CONFIG_ETRAX_USB_HOST)   += host/

 obj-$(CONFIG_USB_ACM)          += class/

I'm assuming this is the right way, but I don't know how you did
it.   This wasn't included in the patch.

Oh, and there was a problem with the isp1362_platform_data
structure.. the .remote_wakeup_enable entry you mentioned doesn't
exist in the data structure!  Here's what I'm using for that:

static struct isp1362_platform_data isp1362_hcd_data = {
//       .reset = isp1362_hw_reset,
    .reset = NULL,  // no usb hardware reset on oscar!
    .delay = isp1362_delay,
    .clock = NULL,
    .potpg = 25,
    .no_power_switching = 0,
    .power_switching_mode = 1,
//    .remote_wakeup_enable = 1,
//    .remote_wakeup_connected = 1,
//    .remote_wakeup_enable = 0,   // AAH, this isn't a valid field
    .remote_wakeup_connected = 0,
    .int_edge_triggered = 0,
    .int_act_high = 0,
    .dreq_act_high = 1,
    .dack_act_high = 0,
    .oc_enable = 0,
};


I had some trouble at first with HCuPINT_CLKRDY, but we solved that
earlier in the list.  I used the define 'USE_32BIT' to 0.
Isn't the ISP1362 16-bit only?  You can do 32-bit accesses on the
16-bit bus, but then you violate the (fussy) timing for sure!  That
was one problem I overlooked for a while.

I had a bigger problem with the isp1362_[read,write]_fifo
functions.. the writesl / writesw calls also completely violated
the timing requirements.  They caused back-to-back writes (and I'm
assuming reads) with 20ns write-high-to-write-low time, but it has
to be 110ns.  I don't think this can be solved (atleast on my chip)
with bus timing, so I rewrote these functions to be simpler.  Since
it does something similar to the USE_32BIT == 1 behavior, I used
the same define to choose my code: (this is a mangled patch
excerpt)

diff -dbBurN
linux-2.6.11-mm2_usb_prechanges/drivers/usb/host/isp1362.h
linux-2.6.11-mm2-oscar4_usb/drivers/usb/host/isp1362.h
--- linux-2.6.11-mm2_usb_prechanges/drivers/usb/host/isp1362.h 
2005-04-27 11:46:41.000000000 -0500
+++ linux-2.6.11-mm2-oscar4_usb/drivers/usb/host/isp1362.h     
2005-04-25 17:50:05.000000000 -0500
@@ -721,7 +757,6 @@
                dp += len & ~3;
                len &= 3;
        }
-#endif
        if (len >= 2) {
                RDBG("%s: Using readsw for %d words\n",
__FUNCTION__, len >> 1);
                readsw(isp1362_hcd->data_reg, dp, len >> 1);
@@ -736,6 +771,22 @@
                     (u8)data, (u32)dp);
                *dp = (u8)data;
        }
+#else
+        while ( len >= 2 )
+        {
+            data = isp1362_read_data16(isp1362_hcd);
+            *dp++ = (u8)data;
+            *dp++ = (u8)(data >> 8);
+            len -= 2;
+        }
+
+        if ( len > 0 )
+        {
+            data = isp1362_read_data16(isp1362_hcd);
+            *dp++ = (u8)data;
+            len--;
+        }
+#endif
 }

 static void isp1362_write_fifo(struct isp1362_hcd *isp1362_hcd,
void *buf, u16 len)

@@ -755,7 +806,6 @@
                dp += len & ~3;
                len &= 3;
        }
-#endif
        if (len >= 2) {
                RDBG("%s: Using writesw for %d words\n",
__FUNCTION__, len >> 1);
                writesw(isp1362_hcd->data_reg, dp, len >> 1);
@@ -772,6 +822,22 @@
                        data, (u32)dp);
                isp1362_write_data16(isp1362_hcd, data);
        }
+#else
+        while ( len >= 2 )
+        {
+            data = (u16)*dp++;
+            data |= (u16)(*dp++) << 8;
+            isp1362_write_data16(isp1362_hcd, data);
+            len -= 2;
+        }
+
+        if ( len > 0 )
+        {
+            data = (u16)*dp++;
+            isp1362_write_data16(isp1362_hcd, data);
+            len--;
+        }
+#endif
 }

 #define isp1362_read_reg16(d, r)               ({                 
    \


I think those were the major points.  I re-enabled the debugging,
changing a few minor things (such as BUG_ON -> WARN_ON).  I'm still
having trouble, but I'll mention that in a follow-up.

Your feedback on my feedback would be great.   =]

Thanks again,
Mike


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to