usb: gadget: Add Renesas RZ/N1 USBF driver
v4 cover usb: gadget: Add Renesas RZ/N1 USBF driver
Hello everyone,
This is version four of my series which adds support for the Renesas USBF controller, which is used in the RZ/N1 SoC. This will facilitate exposing USB gadgets from RZ/N1 SoCs in U-Boot.
The driver was ported from the Linux kernel. The following features were removed to reduce the memory footprint of the driver, and to avoid including features not relevant to U-Boot:
- Suspend/resume
- Handling of endpoints > 2
- Dynamic detection of endpoint DMA capability (DMA capability is predetermined for each endpoint anyway).
Best regards,
Romain
---
Changes in v4:
- Added a comment to explain why AHBBINTEN has to be read
- Refactored VBUS handling to use the vbus_session() mechanism
- Added back some missing dev_info() and dev_dbg() calls
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- Mentionned all removed features in commit log.
- Style corrections in Kconfig.
- Added a call to usbf_detach() in remove().
- Matched indents with Linux driver and stubbed spinlock handling.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Provided the original Linux commit hash.
- Corrected a few spelling mistakes.
- Link to v1: https://patch.msgid.link/[email protected]
To: [email protected]
To: [email protected]
Cc: Thomas Petazzoni <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Herve Codina <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Romain Gantois <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Nobuhiro Iwamatsu <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: David Lechner <[email protected]>
Cc: Julien Stephan <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Kory Maincent <[email protected]>
Cc: Kuan-Wei Chiu <[email protected]>
Cc: Raymond Mao <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Peter Robinson <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Johan Jonker <[email protected]>
Cc: George Chan <[email protected]>
Cc: Balaji Selvanathan <[email protected]>
Cc: Bastien Curutchet <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Carlo Caione <[email protected]>
---
Herve Codina (1):
usb: gadget: Add Renesas RZ/N1 USBF controller support
Romain Gantois (1):
linux/list.h: Add list_is_first()
MAINTAINERS | 5 + drivers/usb/gadget/Kconfig | 9 + drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/renesas_usbf.c | 3154 +++++++++++++++++++++++++++++++++++++ include/linux/list.h | 10 + 5 files changed, 3179 insertions(+)
---
base-commit: 8937b1ba6e7c32e463d964b4255b700088455ad6
change-id: 20260622-rzn1-usbf-4d364687ae44
Best regards,
Signature · 1 line
Romain Gantois <[email protected]>
PATCH v4 1/2 linux/list.h: Add list_is_first()
Include the list_is_first() kernel function, which will be used by the Renesas USBF driver.
--- include/linux/list.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/linux/list.h +10 -0
@@ -153,6 +153,16 @@ static inline void list_move_tail(struct list_head *list,list_add_tail (list, head); } +/** +* list_is_first -- tests whether @list is the first entry in list @head +* @list: the entry to test +* @head: the head of the list +*/ +static inline int list_is_first (const struct list_head *list,const struct list_head *head) +{ +return list->prev == head; +} +/** * list_is_last - tests whether @list is the last entry in list @head * @list: the entry to test
Signature · 1 line
2.56.1
PATCH v4 2/2 usb: gadget: Add Renesas RZ/N1 USBF controller support
In reply to Romain GantoisFrom: Herve Codina <[email protected]>
Add support for the Renesas USBF controller. This is an USB2.0 UDC controller available in the RZ/N1 SoC.
This driver was originally written by Hervé Codina for the Linux kernel.
Linux revision this was ported from:
74851fbb6d64 ("usb: gadget: renesas_usbf: Handle devm_pm_runtime_enable() errors")
The following features were removed to reduce the memory footprint of the driver, and to avoid including features not relevant to U-Boot:
- Suspend/resume
- Handling of endpoints > 2
- Dynamic detection of endpoint DMA capability (DMA capability is predetermined for each endpoint anyway).
--- MAINTAINERS | 5 + drivers/usb/gadget/Kconfig | 9 + drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/renesas_usbf.c | 3154 +++++++++++++++++++++++++++++++++++++ 4 files changed, 3169 insertions(+)
MAINTAINERS +5 -0
@@ -1509,6 +1509,11 @@ S: Maintained T: git https://git.u-boot-project.org/u-boot/custodians/u-boot-nand-flash.git F: drivers/mtd/nand/raw/ +RENESAS RZ/N1 USBF CONTROLLER DRIVER +M: Romain Gantois <[email protected]> +S: Maintained +F: drivers/usb/gadget/renesas_usbf.c + RISC-V M: Tim Ouyang <[email protected]> M: Leo Liang <[email protected]>
drivers/usb/gadget/Kconfig +9 -0
@@ -159,6 +159,15 @@ config CI_UDC Say Y here to enable device controller functionality of the ChipIdea driver. +config USB_GADGET_RENESAS_USBF + bool "Renesas USB Function controller" + depends on RZN1 + depends on DM_USB_GADGET + select USB_GADGET_DUALSPEED + help + Renesas USB Function controller is a USB peripheral controller + available on RZ/N1 Renesas SoCs. + config USB_GADGET_VBUS_DRAW int "Maximum VBUS Power usage (2-500 mA)" range 2 500
drivers/usb/gadget/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_USB_GADGET_AT91) += at91_udc.o obj-$(CONFIG_USB_GADGET_ATMEL_USBA) += atmel_usba_udc.o obj-$(CONFIG_USB_GADGET_DWC2_OTG) += dwc2_udc_otg.o obj-$(CONFIG_USB_GADGET_DWC2_OTG_PHY) += dwc2_udc_otg_phy.o +obj-$(CONFIG_USB_GADGET_RENESAS_USBF) += renesas_usbf.o obj-$(CONFIG_USB_RENESAS_USBHS) += rcar/ ifndef CONFIG_XPL_BUILD obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
drivers/usb/gadget/renesas_usbf.c new file +3154 -0
2,967 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.56.1
Part of the diff is not shown here. View the raw message.