Skip to contentSkip to conversation

usb/gadget: Add driver for Aspeed SoC virtual hub

PATCH Superseded Felipe Balbi 1 participant 1 message Mar 23, 2018 USB

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

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

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,
                 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();
    ^~~~~~~~~~~~~~~~~~

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