usb/gadget: Add driver for Aspeed SoC virtual hub
Subsystems (2)
PATCH v7 1/1 usb/gadget: Add driver for Aspeed SoC virtual hub
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).
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.
---
v7. - Fix OF match list
- Remove unused variable in hub code
v6. - Fix bug with 0-length packets on IN endpoints in desc mode
v5. - Remove #ifdef's and hard coded values
- Remove module parameters
- Honor maximum speed device-tree property
- Remove useless list_empty test
- Cosmetic/spaces fixes
- Add SPDX licence identifiers
v4. - Fix missing unlock ast_vhub_udc_wakeup() error path
- Make "irq" signed to deal with error from platform_get_irq
- Fix Makefile for module builds
- Fix a missing endian conversion
v3. - Rebased
- Add clk stuff
v2. - Cosmetic fixes
- Properly "allocate" device addresses instead of using a never reset counter
- Move .dtsi updates to a different patch
foo2
foo
--- drivers/usb/gadget/udc/Kconfig | 2 + drivers/usb/gadget/udc/Makefile | 1 + drivers/usb/gadget/udc/aspeed-vhub/Kconfig | 7 + drivers/usb/gadget/udc/aspeed-vhub/Makefile | 4 + drivers/usb/gadget/udc/aspeed-vhub/core.c | 422 ++++++++++++++ drivers/usb/gadget/udc/aspeed-vhub/dev.c | 580 +++++++++++++++++++ drivers/usb/gadget/udc/aspeed-vhub/ep0.c | 478 ++++++++++++++++ drivers/usb/gadget/udc/aspeed-vhub/epn.c | 843 ++++++++++++++++++++++++++++ drivers/usb/gadget/udc/aspeed-vhub/hub.c | 823 +++++++++++++++++++++++++++ drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 514 +++++++++++++++++ 10 files changed, 3674 insertions(+) create mode 100644 drivers/usb/gadget/udc/aspeed-vhub/Kconfig create mode 100644 drivers/usb/gadget/udc/aspeed-vhub/Makefile create mode 100644 drivers/usb/gadget/udc/aspeed-vhub/core.c create mode 100644 drivers/usb/gadget/udc/aspeed-vhub/dev.c create mode 100644 drivers/usb/gadget/udc/aspeed-vhub/ep0.c create mode 100644 drivers/usb/gadget/udc/aspeed-vhub/epn.c create mode 100644 drivers/usb/gadget/udc/aspeed-vhub/hub.c create mode 100644 drivers/usb/gadget/udc/aspeed-vhub/vhub.h
drivers/usb/gadget/udc/Kconfig +2 -0
@@ -438,6 +438,8 @@ config USB_GADGET_XILINX dynamically linked module called "udc-xilinx" and force all gadget drivers to also be dynamically linked. +source "drivers/usb/gadget/udc/aspeed-vhub/Kconfig" + # # LAST -- dummy/emulated controller #
drivers/usb/gadget/udc/Makefile +1 -0
@@ -39,4 +39,5 @@ obj-$(CONFIG_USB_MV_U3D) += mv_u3d_core.o obj-$(CONFIG_USB_GR_UDC) += gr_udc.o obj-$(CONFIG_USB_GADGET_XILINX) += udc-xilinx.o obj-$(CONFIG_USB_SNP_UDC_PLAT) += snps_udc_plat.o +obj-$(CONFIG_USB_ASPEED_VHUB) += aspeed-vhub/ obj-$(CONFIG_USB_BDC_UDC) += bdc/
drivers/usb/gadget/udc/aspeed-vhub/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0+ +config USB_ASPEED_VHUB + tristate "Aspeed vHub UDC driver" + depends on ARCH_ASPEED || COMPILE_TEST + help + USB peripheral controller for the Aspeed AST2500 family + SoCs supporting the "vHub" functionality and USB2.0
drivers/usb/gadget/udc/aspeed-vhub/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ +obj-$(CONFIG_USB_ASPEED_VHUB) += aspeed-vhub.o +aspeed-vhub-y := core.o ep0.o epn.o dev.o hub.o +
drivers/usb/gadget/udc/aspeed-vhub/core.c new file +422 -0
422 lines not on this page · raw message
drivers/usb/gadget/udc/aspeed-vhub/dev.c new file +580 -0
580 lines not on this page · raw message
drivers/usb/gadget/udc/aspeed-vhub/ep0.c new file +478 -0
478 lines not on this page · raw message
drivers/usb/gadget/udc/aspeed-vhub/epn.c new file +843 -0
843 lines not on this page · raw message
drivers/usb/gadget/udc/aspeed-vhub/hub.c new file +823 -0
653 lines not on this page · raw message
drivers/usb/gadget/udc/aspeed-vhub/vhub.h new file +514 -0
514 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.