drivers: usb: device: support Nuvoton NuMaker series USBD controller driver
1. Configure 'core-clock' to 192MHz to generate necessary 48MHz 2. Support workaround to disallowing ISO IN/OUT EPs to be assigned the same EP numbers Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
This commit is contained in:
parent
9260c5b6b2
commit
bc1a988f9d
|
@ -49,4 +49,14 @@
|
|||
<PB6MFP_EMAC0_PPS>;
|
||||
};
|
||||
};
|
||||
|
||||
/* USBD multi-function pins for VBUS, D+, D-, and ID pins */
|
||||
usbd_default: usbd_default {
|
||||
group0 {
|
||||
pinmux = <PA12MFP_USB_VBUS>,
|
||||
<PA13MFP_USB_D_N>,
|
||||
<PA14MFP_USB_D_P>,
|
||||
<PA15MFP_USB_OTG_ID>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -123,3 +123,10 @@
|
|||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/* On enabled, 'core-clock', as above, is required to to be 192MHz. */
|
||||
zephyr_udc0: &usbd {
|
||||
pinctrl-0 = <&usbd_default>;
|
||||
pinctrl-names = "default";
|
||||
status = "okay";
|
||||
};
|
||||
|
|
|
@ -20,5 +20,6 @@ zephyr_library_sources_ifdef(CONFIG_USB_NRFX usb_dc_nrfx.c)
|
|||
zephyr_library_sources_ifdef(CONFIG_USB_MCUX usb_dc_mcux.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_USB_DC_SMARTBOND usb_dc_smartbond.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_USB_DC_IT82XX2 usb_dc_it82xx2.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_USB_DC_NUMAKER usb_dc_numaker.c)
|
||||
|
||||
endif()
|
||||
|
|
|
@ -197,6 +197,31 @@ config USB_DC_IT82XX2
|
|||
help
|
||||
ITE IT82XX2 USB Device Controller Driver
|
||||
|
||||
config USB_DC_NUMAKER
|
||||
bool "Nuvoton NuMaker USB 1.1 device controller"
|
||||
default y
|
||||
depends on DT_HAS_NUVOTON_NUMAKER_USBD_ENABLED
|
||||
help
|
||||
Enable Nuvoton NuMaker USB 1.1 device controller driver
|
||||
|
||||
if USB_DC_NUMAKER
|
||||
|
||||
config USB_DC_NUMAKER_MSG_QUEUE_SIZE
|
||||
int "USB DC message queue size"
|
||||
default 32
|
||||
help
|
||||
Maximum number of messages the driver can queue for interrupt bottom half processing
|
||||
|
||||
config USB_DC_NUMAKER_MSG_HANDLER_THREAD_STACK_SIZE
|
||||
int "USB DC message handler thread stack size"
|
||||
default 1536
|
||||
help
|
||||
Size of the stack for the message handler thread that is used in the driver
|
||||
for handling messages from the USB DC ISR, i.e. interrupt bottom half processing,
|
||||
including callbacks to the USB device stack.
|
||||
|
||||
endif # USB_DC_NUMAKER
|
||||
|
||||
config USB_NATIVE_POSIX
|
||||
bool "Native Posix USB Device Controller Driver"
|
||||
depends on ARCH_POSIX && EXTERNAL_LIBC
|
||||
|
|
2007
drivers/usb/device/usb_dc_numaker.c
Normal file
2007
drivers/usb/device/usb_dc_numaker.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -603,6 +603,19 @@
|
|||
status = "disabled";
|
||||
#io-channel-cells = <1>;
|
||||
};
|
||||
|
||||
usbd: usbd@400c0000 {
|
||||
compatible = "nuvoton,numaker-usbd";
|
||||
reg = <0x400c0000 0x1000>;
|
||||
interrupts = <53 0>;
|
||||
resets = <&rst NUMAKER_USBD_RST>;
|
||||
clocks = <&pcc NUMAKER_USBD_MODULE NUMAKER_CLK_CLKSEL0_USBSEL_PLL_DIV2
|
||||
NUMAKER_CLK_CLKDIV0_USB(2)>;
|
||||
dma-buffer-size = <1536>;
|
||||
status = "disabled";
|
||||
num-bidir-endpoints = <25>;
|
||||
disallow-iso-in-out-same-number;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
33
dts/bindings/usb/nuvoton,numaker-usbd.yaml
Normal file
33
dts/bindings/usb/nuvoton,numaker-usbd.yaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Copyright (c) 2022 Nuvoton Technology Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: Nuvoton NuMaker USB 1.1 device controller
|
||||
|
||||
compatible: "nuvoton,numaker-usbd"
|
||||
|
||||
include: [usb-ep.yaml, reset-device.yaml, pinctrl-device.yaml]
|
||||
|
||||
properties:
|
||||
reg:
|
||||
required: true
|
||||
|
||||
interrupts:
|
||||
required: true
|
||||
|
||||
resets:
|
||||
required: true
|
||||
|
||||
clocks:
|
||||
required: true
|
||||
|
||||
dma-buffer-size:
|
||||
type: int
|
||||
required: true
|
||||
description: |
|
||||
Size of DMA buffer in bytes
|
||||
|
||||
disallow-iso-in-out-same-number:
|
||||
type: boolean
|
||||
description: |
|
||||
Some soc series don't allow Isochronous IN/OUT endpoints to be assigned the same numbers,
|
||||
for example, 0x82 (for Isochronous IN) and 0x02 (for Isochronous OUT) are disallowed.
|
Loading…
Reference in a new issue