Re: net2280 and UAS not working

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

 



On Mon, Jul 06, 2015 at 06:58:52PM +0200, Paul Jones wrote:
> Hi,
> 
> On 05 Jul 2015, at 20:43, Felipe Balbi <balbi@xxxxxx> wrote:
> 
> > Hi,
> > 
> > On Sun, Jul 05, 2015 at 06:56:29PM +0200, Paul Jones wrote:
> >> Ricardo,
> >> 
> >> I’m trying to get the 3380 to work in UAS mode on the 4.0.1 and/or 4.1.0-rc8 kernels.
> >> I’m using the following script (derived from Sebastian’s post):
> >> 	modprobe tcm_usb_gadget	
> >> 	mount -t configfs none /sys/kernel/config
> >> 	CONFIGFS=/sys/kernel/config/
> >> 	TARGET=$CONFIGFS/target/core/
> >> 	FABRIC=$CONFIGFS/target/usb_gadget/
> >> 		
> >> 	mkdir -p $TARGET/rd_mcp_0/ramdisk
> >> 	echo -n rd_pages=32768 > $TARGET/rd_mcp_0/ramdisk/control
> >> 	echo -n 1 > $TARGET/rd_mcp_0/ramdisk/enable
> >> 
> >> 	mkdir -p $FABRIC/naa.6001405c3214b06a/tpgt_1
> >> 	mkdir $FABRIC/naa.6001405c3214b06a/tpgt_1/lun/lun_0
> >> 	echo -n naa.6001405c3214b06b > $FABRIC/naa.6001405c3214b06a/tpgt_1/nexus
> >> 
> >> 	ln -sv $TARGET/rd_mcp_0/ramdisk $FABRIC/naa.6001405c3214b06a/tpgt_1/lun/lun_0/virtual_scsi_port
> >> 	echo 1 > $FABRIC/naa.6001405c3214b06a/tpgt_1/enable
> >> 
> >> On either of the kernels, once I setup UAS I get an error from tcm_usb_gadget: "Can't claim all required eps”.
> >> This seems to be due to the fact that max_streams = 0 on every EP for the 3380.
> > 
> > yeah, that needs to be initialized.
> > 
> >> If I patch around that:
> >> diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
> >> index 0567cca..94ade78 100644
> >> --- a/drivers/usb/gadget/epautoconf.c
> >> +++ b/drivers/usb/gadget/epautoconf.c
> >> @@ -117,8 +117,10 @@ ep_matches (
> >>        if (usb_endpoint_xfer_bulk(desc)) {
> >>                if (ep_comp && gadget->max_speed >= USB_SPEED_SUPER) {
> >>                        num_req_streams = ep_comp->bmAttributes & 0x1f;
> >> -                       if (num_req_streams > ep->max_streams)
> >> +                       printk("%s: requested streams %d < max streams %d",ep->name, num_req_streams, ep->max_streams);
> >> +/*                     if (num_req_streams > ep->max_streams)
> >>                                return 0;
> >> +*/
> > 
> > no, you should make sure that max_streams is initialized corrent when
> > runing on 3380.
> 
> The above temporary patch was just to see if more is needed besides setting max_streams and to help Ricardo to reproduce the issue.
> 
> > 
> >>                }
> >> 
> >>        }
> >> 
> >> then I can at least get UAS to load, but as soon as I connect a linux box to the 3380 I then get errors:
> >> [   50.954080] ep1in: requested streams 4 < max streams 0
> >> [   50.954089] ep2out: requested streams 4 < max streams 0
> >> [   50.954097] ep3in: requested streams 4 < max streams 0
> >> [   50.954105] ep4out: requested streams 0 < max streams 0
> >> [   50.954116] g_target gadget: g_target ready
> >> [   50.954129] net2280 0000:05:00.0: Operate Defect 7374 workaround soft this time
> >> [   50.954130] net2280 0000:05:00.0: It will operate on cold-reboot and SS connect
> >> [   51.198283] net2280 0000:05:00.0: INFO: Defect 7374 workaround waited about
> >> [   51.198283] 0uSec for Control Read Data Phase ACK
> >> [   51.199366] g_target gadget: super-speed config #1: Linux Target
> >> [   51.199394] Using the BOT protocol
> >> [   51.199903] Wrong signature on CBW
> >> [   51.199913] bot_cmd_complete(313): -22
> >> [   51.199955] Using the UAS protocol
> >> [   72.789041] Unsupported type 0
> >> [   72.789063] g_target gadget: super-speed config #1: Linux Target
> >> [   72.789114] Using the BOT protocol
> >> [   72.789406] Wrong signature on CBW
> >> [   72.789415] bot_cmd_complete(313): -22
> >> [   72.789456] Using the UAS protocol
> >> [   72.921156] Unsupported type 0
> >> [   72.921174] g_target gadget: super-speed config #1: Linux Target
> >> [   72.921222] Using the BOT protocol
> >> [   72.921514] Wrong signature on CBW
> >> [   72.921523] bot_cmd_complete(313): -22
> >> [   72.921563] Using the UAS protocol
> >> 
> >> On the connected Linux box (running 4.1.0-rc8 as well), I get:
> >> [ 4563.476084] usb 2-3: new SuperSpeed USB device number 5 using xhci_hcd
> >> [ 4563.492900] usb 2-3: New USB device found, idVendor=0525, idProduct=a4a5
> >> [ 4563.492903] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> >> [ 4563.492904] usb 2-3: Product: Target Product
> >> [ 4563.492906] usb 2-3: Manufacturer: Target Manufactor
> >> [ 4563.492907] usb 2-3: SerialNumber: 000000000001
> >> [ 4563.494193] scsi host9: uas
> >> [ 4563.494298] xhci_hcd 0000:00:14.0: ERROR Transfer event for disabled endpoint or incorrect stream ring
> >> [ 4563.494324] xhci_hcd 0000:00:14.0: @00000000d43e2500 d3921000 00000000 0a000000 04078000
> >> [ 4563.494346] xhci_hcd 0000:00:14.0: ERROR Transfer event for disabled endpoint or incorrect stream ring
> >> [ 4563.494371] xhci_hcd 0000:00:14.0: @00000000d43e2510 d3921400 00000000 0a000000 04038000
> >> [ 4584.936226] scsi 9:0:0:0: tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN 
> >> [ 4584.936230] scsi 9:0:0:0: tag#0 CDB: Inquiry 12 00 00 00 24 00
> >> [ 4584.936286] scsi host9: uas_eh_bus_reset_handler start
> >> [ 4585.048559] usb 2-3: reset SuperSpeed USB device number 5 using xhci_hcd
> >> [ 4585.065687] scsi host9: uas_eh_bus_reset_handler success
> >> [ 4585.065707] xhci_hcd 0000:00:14.0: ERROR Transfer event for disabled endpoint or incorrect stream ring
> >> [ 4585.065736] xhci_hcd 0000:00:14.0: @00000000d43e2650 d3921800 00000000 0a000000 04078000
> >> [ 4585.068219] scsi 9:0:0:0: tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD 
> >> [ 4585.068223] scsi 9:0:0:0: tag#0 CDB: Test Unit Ready 00 00 00 00 00 00
> >> [ 4585.068224] scsi host9: uas_eh_bus_reset_handler start
> >> [ 4585.180561] usb 2-3: reset SuperSpeed USB device number 5 using xhci_hcd
> >> [ 4585.197711] scsi host9: uas_eh_bus_reset_handler success
> >> [ 4585.197717] scsi 9:0:0:0: Device offlined - not ready after error recovery
> >> 
> >> I presume that the net2280 driver should set max_stream for each EP
> >> when in enhanced mode (3380) but I haven’t been able to figure out yet
> >> where to do that.
> >> I am starting to get myself familiarised with the code so I can help
> >> out and provide some patches.
> > 
> > Have a look at dwc3, bdc and dummy_hcd drivers.
> > 
> >> Sebastian: any ideas what else might be wrong that could cause the CBW
> >> signature to be wrong?
> > 
> > yeah, you're lying to your host. You're basically accepting stream
> > transfers without initializing any streams in HW. When XHCI tries to
> > move that in a stream, your 3380 controller complains because it hasn't
> > been programed to do any stream transfers.
> I presumed (maybe incorrectly) that tcm_usb_gadget is setting
> up/handling the streams support?

it really can't. Streams is a function of the underlying HW. Some HW
support 1 streams and some support 16.

> Does that mean that currently none of the drivers in
> drivers/usb/gadget/udc support UAS (besides dummy_hcd)?

dwc3 and bcd do.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux