Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: udc: add initial support for DWC2 device controller #64943

Merged
merged 4 commits into from
Dec 18, 2023

Conversation

jfischer-no
Copy link
Collaborator

Add common DWC2 register header initial device support (UDC API) for DWC2 controller.

include/zephyr/drivers/usb/udc.h Outdated Show resolved Hide resolved
drivers/usb/common/usb_dwc2_hw.h Outdated Show resolved Hide resolved
drivers/usb/common/usb_dwc2_hw.h Outdated Show resolved Hide resolved
drivers/usb/common/usb_dwc2_hw.h Outdated Show resolved Hide resolved
drivers/usb/common/usb_dwc2_hw.h Outdated Show resolved Hide resolved
drivers/usb/common/usb_dwc2_hw.h Outdated Show resolved Hide resolved
drivers/usb/common/usb_dwc2_hw.h Outdated Show resolved Hide resolved
drivers/usb/common/usb_dwc2_hw.h Outdated Show resolved Hide resolved
drivers/usb/common/usb_dwc2_hw.h Outdated Show resolved Hide resolved
drivers/usb/udc/udc_dwc2.c Outdated Show resolved Hide resolved
@carlescufi
Copy link
Member

carlescufi commented Nov 15, 2023

@erwango this driver should work on STM32 devices that use the Synopsys DWC2 IP. Would it be possible for you to test it on those? Additional reviews would be great.

Note: I am aware that there is a dedicated shim driver that supports all STM32 devices, but this DWC2-specific one should work on any ICs using that IP. We are not talking about replacing the existing driver as was suggested in this issue but rather to verify that this driver does work on the relevant STM32 ICs.

@sylvioalves this is also true for the ESP32-S3, although the configuration of the IP is unknown to us, so you would need to help out providing the configuration so that you can test the driver.

@erwango
Copy link
Member

erwango commented Nov 16, 2023

@erwango this driver should work on STM32 devices that use the Synopsys DWC2 IP. Would it be possible for you to test it on those? Additional reviews would be great.

We can help to test for sure. What would be nice is to add ready-to-use test configurations on impacted boards which would save us some time and allow at least building (and testing) reproducibility. This hasn't been made for https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/ethernet/eth_dwmac_stm32h7x.c which isn't build or tested (at least in tree) since years maybe.
Also maybe increasing automated USB test coverage would be helpful (see #62983) which was rejected for arguable reasons.

Note: I am aware that there is a dedicated shim driver that supports all STM32 devices, but this DWC2-specific one should work on any ICs using that IP. We are not talking about replacing the existing driver as was suggested in this issue but rather to verify that this driver does work on the relevant STM32 ICs.

Sure, I'm getting it.

This header is based on drivers/usb/device/usb_dw_registers.h and
describes registers of the DWC2 controllers IP and is intended for use
in both device controller drivers and a host controller driver. The
difference to usb_dw_registers.h is that this header does not confuse
offsets with bit positions, contains all the definitions required for
device mode, has register and bit field names identical to the databook
and no annoying underscores.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Use new common header and remove usb_dw_registers.h.
No functional changes, only renaming of registers and field identifiers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The driver currently supports only dedicated FIFO mode (with
dynfifosizing if enabled). Control, bulk and interrupt transfers are
supported, isochronous transfers are not yet supported. The driver
accesses controller registers using sys_io.h, but for debugging purposes
one can get a register map from the driver's config, similar to the
usb_dc_dw.c driver.

Initial support also has vendor quirks for the STM32F4 SoC family.
Tested on NUCLEO-F413HG.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add DT overlay to be able to support and test UDC DWC2 driver
(snps,dwc2) on nucleo_f413zh board. This disables STM32 shim
driver described and configured on the SoC and board level.

Obviously,it should work with other STM32F4 boards as well and we
could have a mechanism to apply it generically using snippets.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Drivers area: Samples Samples area: USB Universal Serial Bus Experimental Experimental features not enabled by default platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants