Skip to content

Commit faeabc6

Browse files
tmon-nordickartben
authored andcommitted
usb: device_next: Add Kconfig to set maximum speed
Two main ideas behind setting maximum speed are: * Allow code and RAM optimizations at compile time * Allow High-Speed capable drivers to limit operating speed to user choice. This commit only introduces the necessary Kconfig options but does not implement any code or RAM optimizations and does not modify any driver. Signed-off-by: Tomasz Moń <[email protected]>
1 parent 35af7b8 commit faeabc6

File tree

6 files changed

+31
-0
lines changed

6 files changed

+31
-0
lines changed

drivers/usb/udc/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ menuconfig UDC_DRIVER
1111

1212
if UDC_DRIVER
1313

14+
config UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
15+
bool
16+
17+
config UDC_DRIVER_HIGH_SPEED_SUPPORT_ENABLED
18+
bool
19+
1420
config UDC_BUF_COUNT
1521
int "Number of buffers in the pool"
1622
range 16 256

drivers/usb/udc/Kconfig.dwc2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ config UDC_DWC2
55
bool "DWC2 USB device controller driver"
66
default y
77
depends on DT_HAS_SNPS_DWC2_ENABLED
8+
select UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
89
select NRFS if NRFS_HAS_VBUS_DETECTOR_SERVICE
910
select NRFS_VBUS_DETECTOR_SERVICE_ENABLED if NRFS_HAS_VBUS_DETECTOR_SERVICE
1011
select EVENTS

drivers/usb/udc/Kconfig.mcux

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ config UDC_NXP_EHCI
55
bool "NXP MCUX USB EHCI Device controller driver"
66
default y
77
depends on DT_HAS_NXP_EHCI_ENABLED
8+
select UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
89
select PINCTRL
910
select NOCACHE_MEMORY if CPU_HAS_DCACHE
1011
imply UDC_BUF_FORCE_NOCACHE
@@ -16,6 +17,7 @@ config UDC_NXP_IP3511
1617
bool "NXP MCUX USB IP3511 Device controller driver"
1718
default y
1819
depends on DT_HAS_NXP_LPCIP3511_ENABLED
20+
select UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
1921
select PINCTRL
2022
imply UDC_WORKQUEUE
2123
help

drivers/usb/udc/Kconfig.skeleton

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ config UDC_SKELETON
55
bool "Skeleton for an USB device controller driver"
66
default y
77
depends on DT_HAS_ZEPHYR_UDC_SKELETON_ENABLED
8+
select UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
89
help
910
Skeleton for an USB device controller driver.
1011

drivers/usb/udc/Kconfig.virtual

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config UDC_VIRTUAL
66
select UVB
77
default y
88
depends on DT_HAS_ZEPHYR_UDC_VIRTUAL_ENABLED
9+
select UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
910
help
1011
Virtual USB device controller driver.
1112

subsys/usb/device_next/Kconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ module = USBD
1616
module-str = usbd
1717
source "subsys/logging/Kconfig.template.log_config"
1818

19+
choice USBD_MAX_SPEED_CHOICE
20+
prompt "Max supported connection speed"
21+
default USBD_MAX_SPEED_HIGH if UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
22+
default USBD_MAX_SPEED_FULL
23+
24+
config USBD_MAX_SPEED_HIGH
25+
bool "High-Speed"
26+
depends on UDC_DRIVER_HAS_HIGH_SPEED_SUPPORT
27+
select UDC_DRIVER_HIGH_SPEED_SUPPORT_ENABLED
28+
29+
config USBD_MAX_SPEED_FULL
30+
bool "Full-Speed"
31+
32+
endchoice
33+
34+
config USBD_MAX_SPEED
35+
int
36+
default 0 if USBD_MAX_SPEED_FULL
37+
default 1 if USBD_MAX_SPEED_HIGH
38+
1939
config USBD_SHELL
2040
bool "USB device shell"
2141
depends on SHELL

0 commit comments

Comments
 (0)