Re: PXA27x UDC driver GIT repository
Yuri Tikhonov <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello David, I tested your UDC driver on my PXA270-based board (the Colibri analogue) with the file-storage gadget on the top and found that it operates well only with stall=N option set. When I used the default stall setting (i.e. 'Y') then my USB host (x86 PC) reported about the error: [yur]# dmesg ... usb 1-2: new full speed USB device using uhci_hcd and address 35 usb 1-2: configuration #1 chosen from 1 choice scsi34 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 35 usb-storage: waiting for device to settle before scanning scsi 34:0:0:0: Direct-Access Linux File-Stor Gadget 0311 PQ: 0 ANSI: 2 SCSI device sdb: 7862272 512-byte hdwr sectors (4025 MB) usb 1-2: reset full speed USB device using uhci_hcd and address 35 sdb: Write Protect is off sdb: Mode Sense: 0f 00 00 00 sdb: assuming drive cache: write through SCSI device sdb: 7862272 512-byte hdwr sectors (4025 MB) sdb: Write Protect is off sdb: Mode Sense: 0f 00 00 00 sdb: assuming drive cache: write through sdb:<6>usb 1-2: reset full speed USB device using uhci_hcd and address 35 usb 1-2: reset full speed USB device using uhci_hcd and address 35 usb 1-2: reset full speed USB device using uhci_hcd and address 35 sd 35:0:0:0: SCSI error: return code = 0x00070000 end_request: I/O error, dev sdb, sector 0 Buffer I/O error on device sdb, logical block 0 usb 1-2: reset full speed USB device using uhci_hcd and address 35 usb 1-2: reset full speed USB device using uhci_hcd and address 35 ... I investigated the problem and found the following reference in the PXA270 Developers Manual document: " 12.6.8.5 Sent STALL and Force STALL ... Note: Users must clear the SST bit before the USB host controller requests more data from IN endpoints or invalid or corrupted data may be sent to the host. ... " What follows is the patch (also attached) which modifies the pxa27x UDC driver according to the note mentioned above. Using this patch I successfully run the UDC driver with the file-storage gadget on its top and mounted the backing file exported by the gadget on my host PC. Perhaps this is not the most effective and elegant way of fixing the bug discovered, or there are some other places in the UDC driver where the corresponding fix has to be applied too. What do you think ? -- The patch fixes the errors happened on the bus during the bulk transactions when the pxa27x UDC driver is used together with the file-storage gadget. Signed-off-by: Yuri Tikhonov <[email protected]> -- diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index f7c0052..672e301 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c @@ -1057,8 +1057,14 @@ static int pxa27x_ep_set_halt(struct usb_ep *_ep, int value) } else { unsigned i; for (i = 0; i < 1000; i += 20) { - if (*ep->reg_udccsr & UDCCSR_SST) + if (*ep->reg_udccsr & UDCCSR_SST) { + /* According to UM we must clear the SST bit + * before the USB host controller requests more + * data from IN endpoints; do it right now. + */ + *ep->reg_udccsr = UDCCSR_SST; break; + } udelay(20); } } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
pxa27x_usb_stall_070903.patch
(text/x-diff, 852 B)
The patch fixes the errors happened on the bus during the bulk transactions when the pxa27x UDC driver is used together with the file-storage gadget. Signed-off-by: Yuri Tikhonov <[email protected]> -- diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index f7c0052..672e301 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c @@ -1057,8 +1057,14 @@ static int pxa27x_ep_set_halt(struct usb_ep *_ep, int value) } else { unsigned i; for (i = 0; i < 1000; i += 20) { - if (*ep->reg_udccsr & UDCCSR_SST) + if (*ep->reg_udccsr & UDCCSR_SST) { + /* According to UM we must clear the SST bit + * before the USB host controller requests more + * data from IN endpoints; do it right now. + */ + *ep->reg_udccsr = UDCCSR_SST; break; + } udelay(20); } }