Skip to content

Commit 0e00a39

Browse files
ccli8fabiobaltieri
authored andcommitted
drivers: usb: udc: add numaker m2l31x usbd controller
Add numaker m2l31x usbd controller Signed-off-by: Chun-Chieh Li <[email protected]>
1 parent 68c11b2 commit 0e00a39

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki-pinctrl.dtsi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@
2424
<PC9MFP_GPIO>;
2525
};
2626
};
27+
28+
/* USBD multi-function pins for VBUS, D+, D-, and ID pins */
29+
usbd_default: usbd_default {
30+
group0 {
31+
pinmux = <PA12MFP_USB_VBUS>,
32+
<PA13MFP_USB_D_N>,
33+
<PA14MFP_USB_D_P>,
34+
<PA15MFP_USB_OTG_ID>;
35+
};
36+
};
2737
};

boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki.dts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535
};
3636
};
3737

38-
&scc {
39-
/* For USB 1.1 Host/Device/OTG, configure to 192MHz, which can generate necessary 48MHz. */
40-
/* For USB 2.0 Host/Device/OTG or no USB application, comment out to use default. */
41-
core-clock = <DT_FREQ_M(192)>;
42-
};
43-
4438
&gpioc {
4539
status = "okay";
4640
};
@@ -80,3 +74,10 @@
8074
pinctrl-names = "default";
8175
status = "okay";
8276
};
77+
78+
/* On enabled, usbd is required to be clocked in 48MHz. */
79+
zephyr_udc0: &usbd {
80+
pinctrl-0 = <&usbd_default>;
81+
pinctrl-names = "default";
82+
status = "okay";
83+
};

dts/arm/nuvoton/m2l31x.dtsi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
reg = <0x40000200 0x100>;
4646
#clock-cells = <0>;
4747
lxt = "enable";
48+
hirc48m = "enable";
4849
clk-pclkdiv = <(NUMAKER_CLK_PCLKDIV_APB0DIV_DIV2 |
4950
NUMAKER_CLK_PCLKDIV_APB1DIV_DIV2)>;
5051
core-clock = <DT_FREQ_M(72)>;
@@ -388,6 +389,19 @@
388389
status = "disabled";
389390
};
390391

392+
usbd: usbd@400c0000 {
393+
compatible = "nuvoton,numaker-usbd";
394+
reg = <0x400c0000 0x1000>;
395+
interrupts = <53 0>;
396+
resets = <&rst NUMAKER_USBD_RST>;
397+
clocks = <&pcc NUMAKER_USBD_MODULE NUMAKER_CLK_CLKSEL0_USBSEL_HIRC48M
398+
NUMAKER_CLK_CLKDIV0_USB(1)>;
399+
dma-buffer-size = <1024>;
400+
status = "disabled";
401+
num-bidir-endpoints = <19>;
402+
disallow-iso-in-out-same-number;
403+
};
404+
391405
wwdt: watchdog@40096000 {
392406
compatible = "nuvoton,numaker-wwdt";
393407
reg = <0x40096000 0x10>;

0 commit comments

Comments
 (0)