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: usb: udc: dwc3: initial implementation #84544

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions drivers/usb/udc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ zephyr_library_sources(udc_common.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers/usb/common/)

zephyr_library_sources_ifdef(CONFIG_UDC_DWC2 udc_dwc2.c)
zephyr_library_sources_ifdef(CONFIG_UDC_DWC3 udc_dwc3.c)
zephyr_library_sources_ifdef(CONFIG_UDC_NRF udc_nrf.c)
zephyr_library_sources_ifdef(CONFIG_UDC_KINETIS udc_kinetis.c)
zephyr_library_sources_ifdef(CONFIG_UDC_SKELETON udc_skeleton.c)
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/udc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module-str = usb drv
source "subsys/logging/Kconfig.template.log_config"

source "drivers/usb/udc/Kconfig.dwc2"
source "drivers/usb/udc/Kconfig.dwc3"
source "drivers/usb/udc/Kconfig.nrf"
source "drivers/usb/udc/Kconfig.kinetis"
source "drivers/usb/udc/Kconfig.skeleton"
Expand Down
48 changes: 48 additions & 0 deletions drivers/usb/udc/Kconfig.dwc3
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright (c) 2023-2024 tinyVision.ai
# SPDX-License-Identifier: Apache-2.0

config UDC_DWC3
bool "Synopsys USB device controller driver"
default y
depends on DT_HAS_SNPS_DWC3_ENABLED
select NOCACHE_MEMORY if ARCH_HAS_NOCACHE_MEMORY_SUPPORT
select UDC_BUF_FORCE_NOCACHE
imply NOCACHE_MEMORY
help
Synopsys DWC3 USB device controller driver.

config UDC_DWC3_SHELL
bool "Enable debug shell commands for the DWC3 driver"
default y
depends on UDC_DWC3 && SHELL
help
Debug commands that permit to dump the state of the transfer,
events, and dump all registers.

config UDC_DWC3_EVENTS_NUM
int "Number of events in the event ring buffer"
default 16
help
It is typically not needed to increase the number of events, but
if it were to happen due to some rare condition, increasing this
number could be useful.

config UDC_DWC3_EVENTS_POLL_MS
int "Sleep duration at which the USB driver checks for event"
default 10
help
This is a temporary workaround until IRQs are enabled again on the
driver. In practice, though, polling does not impact performance
since as an event is processed, a new event is already available.
As there is a very fast link (5 Gbit/s) and a slow MCU (80 MHz)
in the system this driver was integrated.

config UDC_DWC3_TRB_NUM
int "Number of buffers for each non-control endpoint"
default 4
range 3 32
help
This is a general knob for the number of buffers present for each
endpoint. This does not affect control endpoints. The default is
enough for most conditions, but for performance and debug purposes,
increasing could reveal useful.
Loading
Loading