soc: mimxrt1180: Add USB support

This was tested on the MIMXRT1180 EVK board

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
Mahesh Mahadevan 2024-12-02 12:13:26 -06:00 committed by Benjamin Cabé
commit 85bdab00de
8 changed files with 81 additions and 6 deletions

View file

@ -128,6 +128,8 @@ configuration supports the following hardware features:
+-----------+------------+-------------------------------------+ +-----------+------------+-------------------------------------+
| HWINFO | on-chip | Unique device serial number | | HWINFO | on-chip | Unique device serial number |
+-----------+------------+-------------------------------------+ +-----------+------------+-------------------------------------+
| USB | on-chip | USB device |
+-----------+------------+-------------------------------------+
The default configuration can be found in the defconfig file: The default configuration can be found in the defconfig file:
:zephyr_file:`boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33_defconfig` :zephyr_file:`boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33_defconfig`

View file

@ -93,3 +93,15 @@
&edma4 { &edma4 {
status = "okay"; status = "okay";
}; };
zephyr_udc0: &usb1 {
status = "okay";
phy-handle = <&usbphy1>;
};
&usbphy1 {
status = "okay";
tx-d-cal = <7>;
tx-cal-45-dp-ohms = <6>;
tx-cal-45-dm-ohms = <6>;
};

View file

@ -27,4 +27,5 @@ supported:
- dma - dma
- spi - spi
- watchdog - watchdog
- usb_device
vendor: nxp vendor: nxp

View file

@ -63,3 +63,15 @@
&edma4 { &edma4 {
status = "okay"; status = "okay";
}; };
zephyr_udc0: &usb1 {
status = "okay";
phy-handle = <&usbphy1>;
};
&usbphy1 {
status = "okay";
tx-d-cal = <7>;
tx-cal-45-dp-ohms = <6>;
tx-cal-45-dm-ohms = <6>;
};

View file

@ -90,6 +90,7 @@ BUILD_ASSERT(NUM_INSTS <= 1, "Only one USB device supported");
#define CONTROLLER_ID kUSB_ControllerLpcIp3511Fs0 #define CONTROLLER_ID kUSB_ControllerLpcIp3511Fs0
#endif /* LPC55s69 */ #endif /* LPC55s69 */
#elif defined(CONFIG_SOC_SERIES_IMXRT11XX) || \ #elif defined(CONFIG_SOC_SERIES_IMXRT11XX) || \
defined(CONFIG_SOC_SERIES_IMXRT118X) || \
defined(CONFIG_SOC_SERIES_IMXRT10XX) || \ defined(CONFIG_SOC_SERIES_IMXRT10XX) || \
defined(CONFIG_SOC_SERIES_MCXN) defined(CONFIG_SOC_SERIES_MCXN)
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1))

View file

@ -48,6 +48,13 @@
}; };
}; };
}; };
/* USB PLL */
usbclk: usbpll-clock {
compatible = "fixed-clock";
clock-frequency = <24000000>;
#clock-cells = <0>;
};
}; };
&peripheral { &peripheral {
@ -1130,15 +1137,47 @@
clk-source = <1>; clk-source = <1>;
clk-divider = <1>; clk-divider = <1>;
}; };
usb1: usbd@2c80000 {
compatible = "nxp,ehci";
reg = <0x2c80000 0x1000>;
interrupts = <215 0>;
interrupt-names = "usb_otg";
clocks = <&usbclk>;
num-bidir-endpoints = <8>;
status = "disabled";
};
usb2: usbd@2c90000 {
compatible = "nxp,ehci";
reg = <0x2c90000 0x1000>;
interrupts = <214 0>;
interrupt-names = "usb_otg";
clocks = <&usbclk>;
num-bidir-endpoints = <8>;
status = "disabled";
};
usbphy1: usbphy@2ca0000 {
compatible = "nxp,usbphy";
reg = <0x2ca0000 0x1000>;
status = "disabled";
};
usbphy2: usbphy@2cb0000 {
compatible = "nxp,usbphy";
reg = <0x2cb0000 0x1000>;
status = "disabled";
};
}; };
&flexspi { &flexspi {
compatible = "nxp,imx-flexspi"; compatible = "nxp,imx-flexspi";
interrupts = <55 0>; interrupts = <55 0>;
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
status = "disabled"; status = "disabled";
clocks = <&ccm IMX_CCM_FLEXSPI_CLK 0x0 0>; clocks = <&ccm IMX_CCM_FLEXSPI_CLK 0x0 0>;
}; };
&flexspi2 { &flexspi2 {

View file

@ -17,6 +17,7 @@ common:
- mimxrt1050_evk/mimxrt1052/hyperflash - mimxrt1050_evk/mimxrt1052/hyperflash
- mimxrt1050_evk/mimxrt1052/qspi - mimxrt1050_evk/mimxrt1052/qspi
- mimxrt1060_evk/mimxrt1062/hyperflash - mimxrt1060_evk/mimxrt1062/hyperflash
- mimxrt1180_evk/mimxrt1189/cm7
- nucleo_f207zg - nucleo_f207zg
- teensy40 - teensy40
- teensy41 - teensy41

View file

@ -494,6 +494,13 @@ static ALWAYS_INLINE void clock_init(void)
#endif /* CONFIG_DT_HAS_NXP_MCUX_I3C_ENABLED */ #endif /* CONFIG_DT_HAS_NXP_MCUX_I3C_ENABLED */
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_UDC_NXP_EHCI
CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usb480M,
DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency));
CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M,
DT_PROP_BY_PHANDLE(DT_NODELABEL(usb1), clocks, clock_frequency));
#endif
/* Keep core clock ungated during WFI */ /* Keep core clock ungated during WFI */
CCM->LPCG[1].LPM0 = 0x33333333; CCM->LPCG[1].LPM0 = 0x33333333;
CCM->LPCG[1].LPM1 = 0x33333333; CCM->LPCG[1].LPM1 = 0x33333333;