Skip to contentSkip to conversation

usb/gadget: Add driver for Aspeed SoC virtual hub

PATCH Superseded Benjamin Herrenschmidt 1 participant 1 message Mar 24, 2018 USB

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 2/2 usb/gadget: Add driver for Aspeed SoC virtual hub

Quoted 41 lines · Felipe Balbi

Hi,

Quoted 17 lines · Benjamin Herrenschmidt

The Aspeed BMC SoCs support a "virtual hub" function. It provides some HW support for a top-level USB2 hub behind which sit 5 gadget "ports".

This driver adds support for the full functionality, emulating the hub standard requests and exposing 5 UDC gadget drivers corresponding to the ports.

The hub itself has HW provided dedicated EP0 and EP1 (the latter for hub interrupts). It also has dedicated EP0s for each function. For other endpoints, there's a pool of 15 "generic" endpoints that are shared among the ports.

The driver relies on my previous patch adding a "dispose" EP op to handle EP allocation between ports. EPs are allocated from the shared pool in the UDC "match_ep" callback and assigned to the UDC instance (added to the gadget ep_list).

Quoted 5 lines

When the composite driver gets unbound, the new hook will allow the UDC to clean things up and return those EPs to the shared pool.

---

doesn't compile:

In file included from ./include/linux/bitmap.h:9:0,

                 from ./include/linux/cpumask.h:12,
                 from ./arch/x86/include/asm/cpumask.h:5,
                 from ./arch/x86/include/asm/msr.h:11,
                 from ./arch/x86/include/asm/processor.h:21,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
Quoted 8 lines
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from drivers/usb/gadget/udc/aspeed-vhub/hub.c:16:
In function ‘memcpy’,
    inlined from ‘ast_vhub_rep_desc’ at drivers/usb/gadget/udc/aspeed-vhub/hub.c:276:2:
./include/linux/string.h:341:4: error: call to ‘__read_overflow2’ declared with attribute error: detected read beyond size of object passed as 2nd parameter
    __read_overflow2();

That's really odd... some new gcc thing ? I don't understand where the overflow would occur... Do you see anything ? Unless my brain is acting up, there is no overflow and gcc is bogus:

I just hand counted the size of the 3 possible structures "desc" can point to and compared to the constants used for the size, and it all fits.

Unfortunately, I can't seem to reproduce with the version of cross compiler I'm using here, so I'm not sure what construct to use to make gcc stop erroneously barfing...

Cheers,
Ben.

Quoted 10 lines
    ^~~~~~~~~~~~~~~~~~

make[4]: *** [scripts/Makefile.build:316: drivers/usb/gadget/udc/aspeed-vhub/hub.o] Error 1 make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:575: drivers/usb/gadget/udc/aspeed-vhub] Error 2 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:575: drivers/usb/gadget/udc] Error 2 make[1]: *** [scripts/Makefile.build:575: drivers/usb/gadget] Error 2
make: *** [Makefile:1722: drivers/usb/] Error 2

---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html