Skip to content

Commit c8eaa11

Browse files
jfischer-nokartben
authored andcommitted
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>
1 parent cf6f9e3 commit c8eaa11

File tree

4 files changed

+1287
-0
lines changed

4 files changed

+1287
-0
lines changed

drivers/usb/udc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ zephyr_library_sources_ifdef(CONFIG_UDC_RPI_PICO udc_rpi_pico.c)
2121
zephyr_library_sources_ifdef(CONFIG_UDC_AMBIQ udc_ambiq.c)
2222
zephyr_library_sources_ifdef(CONFIG_UDC_RENESAS_RA udc_renesas_ra.c)
2323
zephyr_library_sources_ifdef(CONFIG_UDC_MAX32 udc_max32.c)
24+
zephyr_library_sources_ifdef(CONFIG_UDC_SAM0 udc_sam0.c)

drivers/usb/udc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,6 @@ source "drivers/usb/udc/Kconfig.rpi_pico"
7878
source "drivers/usb/udc/Kconfig.ambiq"
7979
source "drivers/usb/udc/Kconfig.renesas_ra"
8080
source "drivers/usb/udc/Kconfig.max32"
81+
source "drivers/usb/udc/Kconfig.sam0"
8182

8283
endif # UDC_DRIVER

drivers/usb/udc/Kconfig.sam0

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2025 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config UDC_SAM0
5+
bool "Driver for SAM0 family USB device controller"
6+
default y
7+
depends on DT_HAS_ATMEL_SAM0_USB_ENABLED
8+
select PINCTRL
9+
select SYS_MEM_BLOCKS
10+
select EVENTS
11+
help
12+
Driver for SAM0 family USB device controller.
13+
14+
if UDC_SAM0
15+
16+
config UDC_SAM0_STACK_SIZE
17+
int "UDC controller driver internal thread stack size"
18+
default 512
19+
help
20+
Device controller driver internal thread stack size.
21+
22+
config UDC_SAM0_THREAD_PRIORITY
23+
int "UDC controller driver thread priority"
24+
default 8
25+
help
26+
Device controller driver thread priority.
27+
28+
endif # UDC_SAM0

0 commit comments

Comments
 (0)