Browse Source

drivers: udc: add new UDC driver for SAM0 USB controller

The UDC driver for this beautiful USB controller is mostly rewritten
from scratch. USB Pad Calibration and clock handling are copied from the
usb_dc_sam0 driver.

The driver uses multipacket transfers for all endpoints except the OUT
control endpoint. The OUT control endpoint has a buffer that is always
mapped to the endpoint buffer register so that it always has a valid
buffer. The driver provides up to 7 IN and 7 OUT endpoints that support
any type of transfer. Double buffering is not used, for the possible
case of isochronous transfers some changes would be required in the
future.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
pull/88757/merge
Johann Fischer 4 months ago committed by Benjamin Cabé
parent
commit
c8eaa11a0b
  1. 1
      drivers/usb/udc/CMakeLists.txt
  2. 1
      drivers/usb/udc/Kconfig
  3. 28
      drivers/usb/udc/Kconfig.sam0
  4. 1257
      drivers/usb/udc/udc_sam0.c

1
drivers/usb/udc/CMakeLists.txt

@ -21,3 +21,4 @@ zephyr_library_sources_ifdef(CONFIG_UDC_RPI_PICO udc_rpi_pico.c) @@ -21,3 +21,4 @@ zephyr_library_sources_ifdef(CONFIG_UDC_RPI_PICO udc_rpi_pico.c)
zephyr_library_sources_ifdef(CONFIG_UDC_AMBIQ udc_ambiq.c)
zephyr_library_sources_ifdef(CONFIG_UDC_RENESAS_RA udc_renesas_ra.c)
zephyr_library_sources_ifdef(CONFIG_UDC_MAX32 udc_max32.c)
zephyr_library_sources_ifdef(CONFIG_UDC_SAM0 udc_sam0.c)

1
drivers/usb/udc/Kconfig

@ -78,5 +78,6 @@ source "drivers/usb/udc/Kconfig.rpi_pico" @@ -78,5 +78,6 @@ source "drivers/usb/udc/Kconfig.rpi_pico"
source "drivers/usb/udc/Kconfig.ambiq"
source "drivers/usb/udc/Kconfig.renesas_ra"
source "drivers/usb/udc/Kconfig.max32"
source "drivers/usb/udc/Kconfig.sam0"
endif # UDC_DRIVER

28
drivers/usb/udc/Kconfig.sam0

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
# Copyright (c) 2025 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
config UDC_SAM0
bool "Driver for SAM0 family USB device controller"
default y
depends on DT_HAS_ATMEL_SAM0_USB_ENABLED
select PINCTRL
select SYS_MEM_BLOCKS
select EVENTS
help
Driver for SAM0 family USB device controller.
if UDC_SAM0
config UDC_SAM0_STACK_SIZE
int "UDC controller driver internal thread stack size"
default 512
help
Device controller driver internal thread stack size.
config UDC_SAM0_THREAD_PRIORITY
int "UDC controller driver thread priority"
default 8
help
Device controller driver thread priority.
endif # UDC_SAM0

1257
drivers/usb/udc/udc_sam0.c

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save