Skip to content

Commit

Permalink
drivers: usb: udc: add numaker m2l31x usbd controller
Browse files Browse the repository at this point in the history
Add numaker m2l31x usbd controller

Signed-off-by: Chun-Chieh Li <[email protected]>
  • Loading branch information
ccli8 authored and fabiobaltieri committed Sep 25, 2024
1 parent 68c11b2 commit 0e00a39
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
10 changes: 10 additions & 0 deletions boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,14 @@
<PC9MFP_GPIO>;
};
};

/* 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>;
};
};
};
13 changes: 7 additions & 6 deletions boards/nuvoton/numaker_m2l31ki/numaker_m2l31ki.dts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@
};
};

&scc {
/* For USB 1.1 Host/Device/OTG, configure to 192MHz, which can generate necessary 48MHz. */
/* For USB 2.0 Host/Device/OTG or no USB application, comment out to use default. */
core-clock = <DT_FREQ_M(192)>;
};

&gpioc {
status = "okay";
};
Expand Down Expand Up @@ -80,3 +74,10 @@
pinctrl-names = "default";
status = "okay";
};

/* On enabled, usbd is required to be clocked in 48MHz. */
zephyr_udc0: &usbd {
pinctrl-0 = <&usbd_default>;
pinctrl-names = "default";
status = "okay";
};
14 changes: 14 additions & 0 deletions dts/arm/nuvoton/m2l31x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
reg = <0x40000200 0x100>;
#clock-cells = <0>;
lxt = "enable";
hirc48m = "enable";
clk-pclkdiv = <(NUMAKER_CLK_PCLKDIV_APB0DIV_DIV2 |
NUMAKER_CLK_PCLKDIV_APB1DIV_DIV2)>;
core-clock = <DT_FREQ_M(72)>;
Expand Down Expand Up @@ -388,6 +389,19 @@
status = "disabled";
};

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_HIRC48M
NUMAKER_CLK_CLKDIV0_USB(1)>;
dma-buffer-size = <1024>;
status = "disabled";
num-bidir-endpoints = <19>;
disallow-iso-in-out-same-number;
};

wwdt: watchdog@40096000 {
compatible = "nuvoton,numaker-wwdt";
reg = <0x40096000 0x10>;
Expand Down

0 comments on commit 0e00a39

Please sign in to comment.