Skip to content

Commit 85bdab0

Browse files
mmahadevan108kartben
authored andcommitted
soc: mimxrt1180: Add USB support
This was tested on the MIMXRT1180 EVK board Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent c353347 commit 85bdab0

File tree

8 files changed

+81
-6
lines changed

8 files changed

+81
-6
lines changed

boards/nxp/mimxrt1180_evk/doc/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ configuration supports the following hardware features:
128128
+-----------+------------+-------------------------------------+
129129
| HWINFO | on-chip | Unique device serial number |
130130
+-----------+------------+-------------------------------------+
131+
| USB | on-chip | USB device |
132+
+-----------+------------+-------------------------------------+
131133

132134
The default configuration can be found in the defconfig file:
133135
:zephyr_file:`boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33_defconfig`

boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.dts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,15 @@
9393
&edma4 {
9494
status = "okay";
9595
};
96+
97+
zephyr_udc0: &usb1 {
98+
status = "okay";
99+
phy-handle = <&usbphy1>;
100+
};
101+
102+
&usbphy1 {
103+
status = "okay";
104+
tx-d-cal = <7>;
105+
tx-cal-45-dp-ohms = <6>;
106+
tx-cal-45-dm-ohms = <6>;
107+
};

boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ supported:
2727
- dma
2828
- spi
2929
- watchdog
30+
- usb_device
3031
vendor: nxp

boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.dts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,15 @@
6363
&edma4 {
6464
status = "okay";
6565
};
66+
67+
zephyr_udc0: &usb1 {
68+
status = "okay";
69+
phy-handle = <&usbphy1>;
70+
};
71+
72+
&usbphy1 {
73+
status = "okay";
74+
tx-d-cal = <7>;
75+
tx-cal-45-dp-ohms = <6>;
76+
tx-cal-45-dm-ohms = <6>;
77+
};

drivers/usb/device/usb_dc_mcux.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ BUILD_ASSERT(NUM_INSTS <= 1, "Only one USB device supported");
9090
#define CONTROLLER_ID kUSB_ControllerLpcIp3511Fs0
9191
#endif /* LPC55s69 */
9292
#elif defined(CONFIG_SOC_SERIES_IMXRT11XX) || \
93+
defined(CONFIG_SOC_SERIES_IMXRT118X) || \
9394
defined(CONFIG_SOC_SERIES_IMXRT10XX) || \
9495
defined(CONFIG_SOC_SERIES_MCXN)
9596
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1))

dts/arm/nxp/nxp_rt118x.dtsi

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
};
4949
};
5050
};
51+
52+
/* USB PLL */
53+
usbclk: usbpll-clock {
54+
compatible = "fixed-clock";
55+
clock-frequency = <24000000>;
56+
#clock-cells = <0>;
57+
};
5158
};
5259

5360
&peripheral {
@@ -1130,15 +1137,47 @@
11301137
clk-source = <1>;
11311138
clk-divider = <1>;
11321139
};
1140+
1141+
usb1: usbd@2c80000 {
1142+
compatible = "nxp,ehci";
1143+
reg = <0x2c80000 0x1000>;
1144+
interrupts = <215 0>;
1145+
interrupt-names = "usb_otg";
1146+
clocks = <&usbclk>;
1147+
num-bidir-endpoints = <8>;
1148+
status = "disabled";
1149+
};
1150+
1151+
usb2: usbd@2c90000 {
1152+
compatible = "nxp,ehci";
1153+
reg = <0x2c90000 0x1000>;
1154+
interrupts = <214 0>;
1155+
interrupt-names = "usb_otg";
1156+
clocks = <&usbclk>;
1157+
num-bidir-endpoints = <8>;
1158+
status = "disabled";
1159+
};
1160+
1161+
usbphy1: usbphy@2ca0000 {
1162+
compatible = "nxp,usbphy";
1163+
reg = <0x2ca0000 0x1000>;
1164+
status = "disabled";
1165+
};
1166+
1167+
usbphy2: usbphy@2cb0000 {
1168+
compatible = "nxp,usbphy";
1169+
reg = <0x2cb0000 0x1000>;
1170+
status = "disabled";
1171+
};
11331172
};
11341173

11351174
&flexspi {
1136-
compatible = "nxp,imx-flexspi";
1137-
interrupts = <55 0>;
1138-
#address-cells = <1>;
1139-
#size-cells = <0>;
1140-
status = "disabled";
1141-
clocks = <&ccm IMX_CCM_FLEXSPI_CLK 0x0 0>;
1175+
compatible = "nxp,imx-flexspi";
1176+
interrupts = <55 0>;
1177+
#address-cells = <1>;
1178+
#size-cells = <0>;
1179+
status = "disabled";
1180+
clocks = <&ccm IMX_CCM_FLEXSPI_CLK 0x0 0>;
11421181
};
11431182

11441183
&flexspi2 {

samples/subsys/usb/dfu/sample.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ common:
1717
- mimxrt1050_evk/mimxrt1052/hyperflash
1818
- mimxrt1050_evk/mimxrt1052/qspi
1919
- mimxrt1060_evk/mimxrt1062/hyperflash
20+
- mimxrt1180_evk/mimxrt1189/cm7
2021
- nucleo_f207zg
2122
- teensy40
2223
- teensy41

soc/nxp/imxrt/imxrt118x/soc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,13 @@ static ALWAYS_INLINE void clock_init(void)
494494

495495
#endif /* CONFIG_DT_HAS_NXP_MCUX_I3C_ENABLED */
496496

497+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_UDC_NXP_EHCI
498+
CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usb480M,
499+
DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency));
500+
CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M,
501+
DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency));
502+
#endif
503+
497504
/* Keep core clock ungated during WFI */
498505
CCM->LPCG[1].LPM0 = 0x33333333;
499506
CCM->LPCG[1].LPM1 = 0x33333333;

0 commit comments

Comments
 (0)