mbox series

[v2,00/12] ADD USB3.1 HOST, Peri and DRD support

Message ID 20230112215906.494394-1-biju.das.jz@bp.renesas.com
Headers show
Series ADD USB3.1 HOST, Peri and DRD support | expand

Message

Biju Das Jan. 12, 2023, 9:58 p.m. UTC
This patch series aims to add USB3.1 HOST, Peri and DRD support
on RZ/V2M EVK platform.

The reset for both host and peri are located in USB3DRD block. The
USB3DRD registers are mapped in the AXI address space of the Peripheral
module.

RZ/V2M XHCI is similar to R-Car XHCI but it doesn't require any
firmware.

Host/device needs to do reset release and set the host/device function
on DRD module, before accessing any registers.

v1->v2:
 * Added Rb tag from Rob for host binding patch
 * Renamed clock-name from "host_axi"->"axi"
 * Drop quotes around usb-xhci.yaml.
 * Moved DRD interrupts from device ctrlr to DRD bindings
 * Updated interrupts and dropped interrupt-names in device ctrlr bindings
 * Renamed aclk->axi in device ctrlr bindings
 * Added DRD interrupts and interrupt-names in DRD bindings
 * Dropped peripheral reset and reset-names from DRD bindings
 * Added reg property for usb3 device ctrlr nodes
 * Renamed peri_axi->axi and apb->reg
 * Updated pattern properties and example.
 * Moved header file from include/linux/soc/renesas->include/linux/usb
 * Passing DRD irq resource from parent to usb3_peri for handling it.
 * As drd reg is now separated from usb3 peri, updated DRD reg handling in
   usb3 peri driver.
 * Removed usb3 peri reset handling from DRD driver.
 * Added Rb tag from Geert for reset and clock updates for xhci-plat.

Note:
 * Patch12 dependup on [1]
  [1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/20221209171836.71610-3-biju.das.jz@bp.renesas.com/

Biju Das (12):
  dt-bindings: usb: renesas,usb-xhci: Document RZ/V2M support
  dt-bindings: usb: renesas,usb3-peri: Update reset, clock-name and
    interrupts properties
  dt-bindings: usb: renesas,usb3-peri: Document RZ/V2MA bindings
  dt-bindings: usb: Add RZ/V2M USB3DRD binding
  usb: gadget: Add support for RZ/V2M USB3DRD driver
  usb: gadget: udc: renesas_usb3: Add role switch support for RZ/V2M
  usb: host: xhci-plat: Improve clock handling in probe()
  usb: host: xhci-plat: Add reset support
  xhci: host: Add Renesas RZ/V2M SoC support
  arm64: dts: renesas: r9a09g011: Add USB3 DRD, device and host nodes
  arm64: dts: renesas: rzv2mevk2: Enable USB3 DRD, Peripheral and Host
  arm64: dts: renesas: rzv2mevk2: Enable USB3 role switch

 .../bindings/usb/renesas,rzv2m-usb3drd.yaml   | 129 ++++++++++++++++
 .../bindings/usb/renesas,usb-xhci.yaml        |  41 +++++-
 .../bindings/usb/renesas,usb3-peri.yaml       |  40 +----
 .../boot/dts/renesas/r9a09g011-v2mevk2.dts    |  76 ++++++++++
 arch/arm64/boot/dts/renesas/r9a09g011.dtsi    |  45 ++++++
 drivers/usb/gadget/udc/Kconfig                |   7 +
 drivers/usb/gadget/udc/Makefile               |   1 +
 drivers/usb/gadget/udc/renesas_usb3.c         | 136 +++++++++++------
 drivers/usb/gadget/udc/rzv2m_usb3drd.c        | 139 ++++++++++++++++++
 drivers/usb/host/Kconfig                      |   9 ++
 drivers/usb/host/Makefile                     |   3 +
 drivers/usb/host/xhci-plat.c                  |  36 ++++-
 drivers/usb/host/xhci-rzv2m.c                 |  38 +++++
 drivers/usb/host/xhci-rzv2m.h                 |  16 ++
 include/linux/usb/rzv2m_usb3drd.h             |  20 +++
 15 files changed, 649 insertions(+), 87 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/renesas,rzv2m-usb3drd.yaml
 create mode 100644 drivers/usb/gadget/udc/rzv2m_usb3drd.c
 create mode 100644 drivers/usb/host/xhci-rzv2m.c
 create mode 100644 drivers/usb/host/xhci-rzv2m.h
 create mode 100644 include/linux/usb/rzv2m_usb3drd.h

Comments

Greg KH Jan. 19, 2023, 1:10 p.m. UTC | #1
On Thu, Jan 12, 2023 at 09:58:54PM +0000, Biju Das wrote:
> This patch series aims to add USB3.1 HOST, Peri and DRD support
> on RZ/V2M EVK platform.
> 
> The reset for both host and peri are located in USB3DRD block. The
> USB3DRD registers are mapped in the AXI address space of the Peripheral
> module.
> 
> RZ/V2M XHCI is similar to R-Car XHCI but it doesn't require any
> firmware.
> 
> Host/device needs to do reset release and set the host/device function
> on DRD module, before accessing any registers.

After applying this series and building it on x86_64 I get the following
build errors:

ERROR: modpost: "rzv2m_usb3drd_reset" [drivers/usb/host/xhci-plat-hcd.ko] undefined!
ERROR: modpost: "rzv2m_usb3drd_reset" [drivers/usb/gadget/udc/renesas_usb3.ko] undefined!

:(
Greg KH Jan. 21, 2023, 10:06 a.m. UTC | #2
On Sat, Jan 21, 2023 at 09:59:53AM +0000, Biju Das wrote:
> Hi Greg,
> 
> Thanks for the feedback.
> 
> > Subject: Re: [PATCH v2 00/12] ADD USB3.1 HOST, Peri and DRD support
> > 
> > On Thu, Jan 12, 2023 at 09:58:54PM +0000, Biju Das wrote:
> > > This patch series aims to add USB3.1 HOST, Peri and DRD support on
> > > RZ/V2M EVK platform.
> > >
> > > The reset for both host and peri are located in USB3DRD block. The
> > > USB3DRD registers are mapped in the AXI address space of the
> > > Peripheral module.
> > >
> > > RZ/V2M XHCI is similar to R-Car XHCI but it doesn't require any
> > > firmware.
> > >
> > > Host/device needs to do reset release and set the host/device function
> > > on DRD module, before accessing any registers.
> > 
> > After applying this series and building it on x86_64 I get the following
> > build errors:
> > 
> > ERROR: modpost: "rzv2m_usb3drd_reset" [drivers/usb/host/xhci-plat-hcd.ko]
> > undefined!
> > ERROR: modpost: "rzv2m_usb3drd_reset"
> > [drivers/usb/gadget/udc/renesas_usb3.ko] undefined!
> 
> The file drivers/usb/gadget/udc/rzv2m_usb3drd.c is not getting compiled,
> 
> If USB_RZV2M_USB3DRD=y, USB_XHCI_RZV2M=m and USB_RENESAS_USB3=m and 
> Because of that modpost is giving undefined error.
> 
> So I have updated the KCONFIG like below and now it builds OK now. I will send next version
> based on this, if there are no comments.
> 
> -- a/drivers/usb/gadget/udc/Kconfig
> +++ b/drivers/usb/gadget/udc/Kconfig
> @@ -180,10 +180,17 @@ config USB_RENESAS_USBHS_UDC
>            gadget drivers to also be dynamically linked.
>  
>  config USB_RZV2M_USB3DRD
> +       tristate 'Renesas USB3.1 DRD controller'
>         depends on ARCH_R9A09G011 || COMPILE_TEST
> -       bool
> -       default y if USB_XHCI_RZV2M
> -       default y if USB_RENESAS_USB3
> +       default y if USB_XHCI_RZV2M=y
> +       default y if USB_RENESAS_USB3=y


These should just be:
	default USB_XHCI_RZV2M
	default USB_RENESAS_USB3
right?

thanks,

greg k-h
Biju Das Jan. 21, 2023, 10:54 a.m. UTC | #3
Hi Greg,

Thanks for the feedback.

> Subject: Re: [PATCH v2 00/12] ADD USB3.1 HOST, Peri and DRD support
> 
> On Sat, Jan 21, 2023 at 09:59:53AM +0000, Biju Das wrote:
> > Hi Greg,
> >
> > Thanks for the feedback.
> >
> > > Subject: Re: [PATCH v2 00/12] ADD USB3.1 HOST, Peri and DRD support
> > >
> > > On Thu, Jan 12, 2023 at 09:58:54PM +0000, Biju Das wrote:
> > > > This patch series aims to add USB3.1 HOST, Peri and DRD support on
> > > > RZ/V2M EVK platform.
> > > >
> > > > The reset for both host and peri are located in USB3DRD block. The
> > > > USB3DRD registers are mapped in the AXI address space of the
> > > > Peripheral module.
> > > >
> > > > RZ/V2M XHCI is similar to R-Car XHCI but it doesn't require any
> > > > firmware.
> > > >
> > > > Host/device needs to do reset release and set the host/device
> > > > function on DRD module, before accessing any registers.
> > >
> > > After applying this series and building it on x86_64 I get the
> > > following build errors:
> > >
> > > ERROR: modpost: "rzv2m_usb3drd_reset"
> > > [drivers/usb/host/xhci-plat-hcd.ko]
> > > undefined!
> > > ERROR: modpost: "rzv2m_usb3drd_reset"
> > > [drivers/usb/gadget/udc/renesas_usb3.ko] undefined!
> >
> > The file drivers/usb/gadget/udc/rzv2m_usb3drd.c is not getting
> > compiled,
> >
> > If USB_RZV2M_USB3DRD=y, USB_XHCI_RZV2M=m and USB_RENESAS_USB3=m and
> > Because of that modpost is giving undefined error.
> >
> > So I have updated the KCONFIG like below and now it builds OK now. I
> > will send next version based on this, if there are no comments.
> >
> > -- a/drivers/usb/gadget/udc/Kconfig
> > +++ b/drivers/usb/gadget/udc/Kconfig
> > @@ -180,10 +180,17 @@ config USB_RENESAS_USBHS_UDC
> >            gadget drivers to also be dynamically linked.
> >
> >  config USB_RZV2M_USB3DRD
> > +       tristate 'Renesas USB3.1 DRD controller'
> >         depends on ARCH_R9A09G011 || COMPILE_TEST
> > -       bool
> > -       default y if USB_XHCI_RZV2M
> > -       default y if USB_RENESAS_USB3
> > +       default y if USB_XHCI_RZV2M=y
> > +       default y if USB_RENESAS_USB3=y
> 
> 
> These should just be:
> 	default USB_XHCI_RZV2M
> 	default USB_RENESAS_USB3
> right?

Yes, you are correct. Will send next version based on this.

Cheers,
Biju