Re: f_mass_storage vs drivers/target

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

 



On Thu, 2019-08-22 at 14:58 +1000, Benjamin Herrenschmidt wrote:
> 
> Ah lovely ... the 338x fails in EP autoconf with f_tcm, digging...
> 
> While digging I found this gem:
> 
> 	/* USB3380: use same address for usb and hardware endpoints */
> 	snprintf(name, sizeof(name), "ep%d%s", usb_endpoint_num(desc),
> 			usb_endpoint_dir_in(desc) ? "in" : "out");
> 	ep = gadget_find_ep_by_name(_gadget, name);
> 	if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp))
> 		return ep;
> 
> Any idea what's that supposed to achieve ?
> 
> When ep_match is called, usb_endpoint_num() hasn't been set yet so
> it's always 0 and always fails... or am I missing something ?

Two problems:

 - net2280.c doesn't set a max EP size, so autoconfig fails since
f_tcm specifies one. What about this ?

--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -940,12 +940,14 @@ int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
        if (usb_endpoint_dir_out(desc) && !ep->caps.dir_out)
                return 0;
 
-       if (max > ep->maxpacket_limit)
+       if (ep->maxpacket_limit && max > ep->maxpacket_limit)
                return 0;

(ie assume that ep->maxpacket_limit 0 means the UDC supports any
legal size)

 - No UDC driver other than dummy sets max_streams, and f_tcm requires 4,
so f_tcm will fail with *any* superspeed UDC driver as far as I can tell.

Was it ever tested with USB 3 ?

I'm not sure what the right fix here yet is as I yet have to learn about
what those USB3 streams are :-) For now I've commented things out.

It's still not working yet as configuring f_tcm seems to be a black art
with no useful documentation or examples anywhere (the device shows up on
the host but doesn't bind to any mass storage driver ... yet).

Cheers,
Ben.





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

  Powered by Linux