[PATCH v2 0/2] Axiado AX3000 and AX3005 USB Device Controller (UDC)
Naveen Kumar Rajgiri Bassappa <[email protected]>
| Newsgroups | org.ozlabs.lists.openbmc,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.linux-usb |
|---|---|
| Message-ID | <20260817-axiado-ax3000-usb-device-controller-v2-0-0ef033dd0a68@axiado.com> |
Dear maintainers, This series adds support for the USB device controller (UDC) integrated into the Axiado AX3000 and AX3005 SoCs. The controller is based on the Corigine USB 3.1 device IP core and uses an xHCI-like programming model with a command ring, an event ring, and per-endpoint transfer rings composed of Transfer Request Blocks (TRBs). The driver integrates with the USB gadget framework and supports High-Speed and SuperSpeed operation. It supports control, bulk, interrupt, and isochronous transfers, including scatter-gather requests. It also implements endpoint enable and disable, request queuing and dequeuing, halt and wedge handling, and standard endpoint 0 control requests. The standard |maximum-speed| Devicetree property can be used to limit the controller to High-Speed operation. When the property is absent, the driver defaults to SuperSpeed. The driver was tested on AX3000 and AX3005 boards. Signed-off-by: Naveen Kumar Rajgiri Bassappa <[email protected]> --- Changes in v2: - Drop the dual (GPL-2.0+ OR MIT) license; the driver and header are now GPL-2.0+ only. - Register via module_platform_driver() and add MODULE_AUTHOR/MODULE_ALIAS instead of the hand-written module_init/module_exit pair. - Acquire clock, reset and PHY through the driver model (devm_clk_get_optional, devm_reset_control_get_optional_exclusive, devm_phy_optional_get), with teardown wired up via devm_add_action_or_reset. - Switch to devm_request_irq() and drop the manual free_irq() paths. - Support multiple instances using an IDA (DEFINE_IDA/ida_alloc/ida_free) instead of a file-static device counter. - Read match data with device_get_match_data() and move the former compile-time feature switches to DT properties (dis-u1u2-entry-quirk, dis-u1u2-initiation-quirk, reinit-ep0-on-bus-reset). - Set the DMA mask via dma_set_mask_and_coherent() with a 32-bit fallback, and convert PM to SIMPLE_DEV_PM_OPS. - Fix endianness handling for TRBs, events and endpoint contexts using cpu_to_le32()/le32_to_cpu(), and decode setup packets without casting. - Locking: pass the caller's IRQ flags through the completion paths so the interrupt state is correctly restored across the unlock/lock window around gadget callbacks. - Properly free all coherent DMA allocations and add dma_mapping_error() checks after dma_map_single() - Fix DMA directions on the GET_STATUS/SET_SEL control transfers. - Replace open-coded register busy-wait loops with readl_poll_timeout_atomic() so they time out instead of spinning forever, and return proper errnos (-EBUSY/-ETIMEDOUT/-EIO) instead of -1. - Replace the custom SETF_VAR/GETF/MAKEF_VAR shift-and-mask macros with FIELD_PREP/FIELD_GET (include linux/bitfield.h), and use BIT()/GENMASK() and dma_wmb()/dma_rmb(). - Use DMA_MAPPING_ERROR instead of a private DMA_ADDR_INVALID. - Remove the U-Boot-derived VBUS cable-detect routine, the VBUS-detect kthread and its wait queue, dead defines and struct fields, the unused interrupt-register-array macros, the mdelay()-based reset delays and the bulk of the dev_dbg() tracing. - Implement the pullup(is_on == 0) path and route suspend/shutdown through pullup(0); mark crg_udc_ep_ops const and return IRQ_NONE from the shared IRQ handler when the interrupt is not ours. - Use dev_err_probe() with structured goto-based unwinding in probe. - Reword the Kconfig help text for USB_CRG_UDC to name the crg_udc module. - Link to v1: https://lore.kernel.org/r/20260202-axiado-ax3000-usb-device-controller-v1-0-45ce0a8b014f@axiado.com To: Naveen Kumar Rajgiri Bassappa <[email protected]> To: Krutik Shah <[email protected]> To: Prasad Bolisetty <[email protected]> To: Greg Kroah-Hartman <[email protected]> To: Rob Herring <[email protected]> To: Krzysztof Kozlowski <[email protected]> To: Conor Dooley <[email protected]> To: Tzu-Hao Wei <[email protected]> To: Karthikeyan Mitran <[email protected]> To: Philipp Zabel <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] --- Naveen Kumar Rajgiri Bassappa (2): dt-bindings: usb: gadget: udc: add Axiado AX3000 and AX3005 UDC usb: gadget: udc: add Axiado AX3000 and AX3005 UDC driver .../devicetree/bindings/usb/axiado,ax3000-udc.yaml | 72 + MAINTAINERS | 10 + drivers/usb/gadget/udc/Kconfig | 14 + drivers/usb/gadget/udc/Makefile | 1 + drivers/usb/gadget/udc/crg_udc.c | 4491 ++++++++++++++++++++ drivers/usb/gadget/udc/crg_udc.h | 355 ++ 6 files changed, 4943 insertions(+) --- base-commit: 7bf68027b97bc94f6121448cb5a02ed9d04187c4 change-id: 20260128-axiado-ax3000-usb-device-controller-156d3f1840c9 Best regards, -- Naveen Kumar Rajgiri Bassappa <[email protected]>