Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Axiado AX3000 and AX3005 USB Device Controller (UDC)
@ 2026-08-18  5:57 Naveen Kumar Rajgiri Bassappa
  2026-08-18  5:57 ` [PATCH v2 1/2] dt-bindings: usb: gadget: udc: add Axiado AX3000 and AX3005 UDC Naveen Kumar Rajgiri Bassappa
       [not found] ` <20260817-axiado-ax3000-usb-device-controller-v2-2-0ef033dd0a68@axiado.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Naveen Kumar Rajgiri Bassappa @ 2026-08-18  5:57 UTC (permalink / raw)
  To: Krutik Shah, Prasad Bolisetty, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Tzu-Hao Wei,
	Karthikeyan Mitran, Philipp Zabel
  Cc: linux-usb, devicetree, linux-arm-kernel, linux-kernel, openbmc,
	Naveen Kumar Rajgiri Bassappa

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 <rbnaveenkumar@axiado.com>
---
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 <rbnaveenkumar@axiado.com>
To: Krutik Shah <krutikshah@axiado.com>
To: Prasad Bolisetty <pbolisetty@axiado.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Tzu-Hao Wei <twei@axiado.com>
To: Karthikeyan Mitran <kmitran@axiado.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-usb@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org

---
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 <rbnaveenkumar@axiado.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] dt-bindings: usb: gadget: udc: add Axiado AX3000 and AX3005 UDC
  2026-08-18  5:57 [PATCH v2 0/2] Axiado AX3000 and AX3005 USB Device Controller (UDC) Naveen Kumar Rajgiri Bassappa
@ 2026-08-18  5:57 ` Naveen Kumar Rajgiri Bassappa
  2026-08-21  7:41   ` Krzysztof Kozlowski
       [not found] ` <20260817-axiado-ax3000-usb-device-controller-v2-2-0ef033dd0a68@axiado.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Naveen Kumar Rajgiri Bassappa @ 2026-08-18  5:57 UTC (permalink / raw)
  To: Krutik Shah, Prasad Bolisetty, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Tzu-Hao Wei,
	Karthikeyan Mitran, Philipp Zabel
  Cc: linux-usb, devicetree, linux-arm-kernel, linux-kernel, openbmc,
	Naveen Kumar Rajgiri Bassappa

Add a Devicetree binding for the USB device controller integrated into
the Axiado AX3000 and AX3005 SoCs.

The controller is based on the Corigine USB 3.1 device IP core and supports
High-Speed and SuperSpeed operation. The standard maximum-speed property
can be used to limit the controller to High-Speed operation.

Signed-off-by: Naveen Kumar Rajgiri Bassappa <rbnaveenkumar@axiado.com>
---
 .../devicetree/bindings/usb/axiado,ax3000-udc.yaml | 72 ++++++++++++++++++++++
 MAINTAINERS                                        |  8 +++
 2 files changed, 80 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/axiado,ax3000-udc.yaml b/Documentation/devicetree/bindings/usb/axiado,ax3000-udc.yaml
new file mode 100644
index 000000000000..a9892658b059
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/axiado,ax3000-udc.yaml
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/axiado,ax3000-udc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Axiado AX3000/AX3005 USB Device Controller
+
+maintainers:
+  - Naveen Kumar Rajgiri Bassappa <rbnaveenkumar@axiado.com>
+  - Krutik Shah <krutikshah@axiado.com>
+  - Prasad Bolisetty <pbolisetty@axiado.com>
+
+description:
+  Axiado USB Device Controller (UDC) is used on the AX3000 and AX3005
+  SoCs. This controller is based on a Corigine USB IP core and provides
+  SuperSpeed (5 Gb/s) or High-Speed (480 Mb/s) operation, selected by the
+  maximum-speed property. It supports control, bulk, interrupt, and
+  isochronous transfer types across multiple configurable endpoints. The
+  node describes the memory-mapped register region, interrupt line, and
+  other required properties for the UDC hardware.
+
+properties:
+  compatible:
+    oneOf:
+      - const: axiado,ax3000-udc
+      - items:
+          - const: axiado,ax3005-udc
+          - const: axiado,ax3000-udc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  phys:
+    maxItems: 1
+
+  maximum-speed:
+    enum: [super-speed, high-speed]
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        usb@81200000 {
+            compatible = "axiado,ax3000-udc";
+            reg = <0x0 0x81200000 0x0 0x00100000>;
+            interrupt-parent = <&gic500>;
+            interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
+            maximum-speed = "high-speed";
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index a674e36529f7..36af69fb965b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4468,6 +4468,14 @@ F:	Documentation/devicetree/bindings/spi/axiado,ax3000-spi.yaml
 F:	drivers/spi/spi-axiado.c
 F:	drivers/spi/spi-axiado.h
 
+AXIADO USB UDC DRIVER
+M:	Naveen Kumar Rajgiri Bassappa <rbnaveenkumar@axiado.com>
+M:	Krutik Shah <krutikshah@axiado.com>
+M:	Prasad Bolisetty <pbolisetty@axiado.com>
+L:	linux-usb@vger.kernel.org
+S:	Supported
+F:	Documentation/devicetree/bindings/usb/axiado,ax3000-udc.yaml
+
 AYANEO PLATFORM EC DRIVER
 M:	Antheas Kapenekakis <lkml@antheas.dev>
 L:	platform-driver-x86@vger.kernel.org

-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: usb: gadget: udc: add Axiado AX3000 and AX3005 UDC
  2026-08-18  5:57 ` [PATCH v2 1/2] dt-bindings: usb: gadget: udc: add Axiado AX3000 and AX3005 UDC Naveen Kumar Rajgiri Bassappa
@ 2026-08-21  7:41   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-21  7:41 UTC (permalink / raw)
  To: Naveen Kumar Rajgiri Bassappa
  Cc: Krutik Shah, Prasad Bolisetty, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Tzu-Hao Wei,
	Karthikeyan Mitran, Philipp Zabel, linux-usb, devicetree,
	linux-arm-kernel, linux-kernel, openbmc

On Mon, Aug 17, 2026 at 10:57:13PM -0700, Naveen Kumar Rajgiri Bassappa wrote:
> +title: Axiado AX3000/AX3005 USB Device Controller
> +
> +maintainers:
> +  - Naveen Kumar Rajgiri Bassappa <rbnaveenkumar@axiado.com>
> +  - Krutik Shah <krutikshah@axiado.com>
> +  - Prasad Bolisetty <pbolisetty@axiado.com>
> +
> +description:
> +  Axiado USB Device Controller (UDC) is used on the AX3000 and AX3005
> +  SoCs. This controller is based on a Corigine USB IP core and provides
> +  SuperSpeed (5 Gb/s) or High-Speed (480 Mb/s) operation, selected by the
> +  maximum-speed property. It supports control, bulk, interrupt, and
> +  isochronous transfer types across multiple configurable endpoints. The
> +  node describes the memory-mapped register region, interrupt line, and
> +  other required properties for the UDC hardware.

Did you implement my comment?

> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - const: axiado,ax3000-udc
> +      - items:
> +          - const: axiado,ax3005-udc
> +          - const: axiado,ax3000-udc
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 1
> +
> +  phys:
> +    maxItems: 1
> +
> +  maximum-speed:
> +    enum: [super-speed, high-speed]

You miss referencing proper schema to get such property or you should
not come with own generic properties. IOW, look at other bindings how
they define a proper UDC device schema.


I also do not see a need for this, compatible defines max speed.


> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    soc {
> +        #address-cells = <2>;
> +        #size-cells = <2>;
> +
> +        usb@81200000 {
> +            compatible = "axiado,ax3000-udc";
> +            reg = <0x0 0x81200000 0x0 0x00100000>;
> +            interrupt-parent = <&gic500>;
> +            interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;

resets, phys. Make example complete.

> +            maximum-speed = "high-speed";
> +        };
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a674e36529f7..36af69fb965b 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4468,6 +4468,14 @@ F:	Documentation/devicetree/bindings/spi/axiado,ax3000-spi.yaml
>  F:	drivers/spi/spi-axiado.c
>  F:	drivers/spi/spi-axiado.h
>  
> +AXIADO USB UDC DRIVER
> +M:	Naveen Kumar Rajgiri Bassappa <rbnaveenkumar@axiado.com>
> +M:	Krutik Shah <krutikshah@axiado.com>
> +M:	Prasad Bolisetty <pbolisetty@axiado.com>
> +L:	linux-usb@vger.kernel.org
> +S:	Supported
> +F:	Documentation/devicetree/bindings/usb/axiado,ax3000-udc.yaml
> +
>  AYANEO PLATFORM EC DRIVER
>  M:	Antheas Kapenekakis <lkml@antheas.dev>
>  L:	platform-driver-x86@vger.kernel.org
> 
> -- 
> 2.34.1
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] usb: gadget: udc: add Axiado AX3000 and AX3005 UDC driver
       [not found] ` <20260817-axiado-ax3000-usb-device-controller-v2-2-0ef033dd0a68@axiado.com>
@ 2026-08-24 15:33   ` Philipp Zabel
  0 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2026-08-24 15:33 UTC (permalink / raw)
  To: Naveen Kumar Rajgiri Bassappa, Krutik Shah, Prasad Bolisetty,
	Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Tzu-Hao Wei, Karthikeyan Mitran
  Cc: linux-usb, devicetree, linux-arm-kernel, linux-kernel, openbmc

On Mo, 2026-08-17 at 22:57 -0700, Naveen Kumar Rajgiri Bassappa wrote:
> Add a driver for the USB device controller 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 implements the USB gadget and endpoint operations, including
> endpoint enable and disable, request queue and dequeue, halt and wedge
> handling, and standard endpoint 0 control requests.
> 
> It supports High-Speed and SuperSpeed operation, control, bulk,
> interrupt, and isochronous transfers, and scatter-gather requests.
> 
> Signed-off-by: Naveen Kumar Rajgiri Bassappa <rbnaveenkumar@axiado.com>
> ---
>  MAINTAINERS                      |    2 +
>  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 +++
>  5 files changed, 4863 insertions(+)
> 
[...]
> diff --git a/drivers/usb/gadget/udc/crg_udc.c b/drivers/usb/gadget/udc/crg_udc.c
> new file mode 100644
> index 000000000000..bb3ed394d984
> --- /dev/null
> +++ b/drivers/usb/gadget/udc/crg_udc.c
> @@ -0,0 +1,4491 @@
[...]
> +static int crg_udc_init_hw(struct crg_gadget_dev *crg_udc)
> +{
> +	struct device *dev = crg_udc->dev;
> +	int ret;
> +
> +	crg_udc->clk = devm_clk_get_optional(dev, NULL);
> +	if (IS_ERR(crg_udc->clk))
> +		return dev_err_probe(dev, PTR_ERR(crg_udc->clk),
> +				     "failed to get clock\n");
> +
> +	ret = clk_prepare_enable(crg_udc->clk);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to enable clock\n");
> +
> +	ret = devm_add_action_or_reset(dev, crg_udc_clk_disable, crg_udc->clk);
> +	if (ret)
> +		return ret;
> +
> +	crg_udc->rst = devm_reset_control_get_optional_exclusive(dev, NULL);
> +	if (IS_ERR(crg_udc->rst))
> +		return dev_err_probe(dev, PTR_ERR(crg_udc->rst),
> +				     "failed to get reset\n");
> +
> +	ret = reset_control_deassert(crg_udc->rst);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to deassert reset\n");
> +
> +	ret = devm_add_action_or_reset(dev, crg_udc_reset_assert, crg_udc->rst);
> +	if (ret)
> +		return ret;

This looks like it could be simplified with
devm_reset_control_get_optional_exclusive_deasserted()

regards
Philipp


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-24 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18  5:57 [PATCH v2 0/2] Axiado AX3000 and AX3005 USB Device Controller (UDC) Naveen Kumar Rajgiri Bassappa
2026-08-18  5:57 ` [PATCH v2 1/2] dt-bindings: usb: gadget: udc: add Axiado AX3000 and AX3005 UDC Naveen Kumar Rajgiri Bassappa
2026-08-21  7:41   ` Krzysztof Kozlowski
     [not found] ` <20260817-axiado-ax3000-usb-device-controller-v2-2-0ef033dd0a68@axiado.com>
2026-08-24 15:33   ` [PATCH v2 2/2] usb: gadget: udc: add Axiado AX3000 and AX3005 UDC driver Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox