Skip to content

Commit 87cec85

Browse files
mmahadevan108kartben
authored andcommitted
boards: frdm_mcxn947: Fix USB next support on this board
This board was missing key code changes needed to support Zephyr USB Next Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent 09c309f commit 87cec85

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

boards/nxp/frdm_mcxn947/board.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#define BOARD_USB_PHY_D_CAL (0x04U)
1717
#define BOARD_USB_PHY_TXCAL45DP (0x07U)
1818
#define BOARD_USB_PHY_TXCAL45DM (0x07U)
19+
20+
usb_phy_config_struct_t usbPhyConfig = {
21+
BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM,
22+
};
1923
#endif
2024

2125
/* Board xtal frequency in Hz */
@@ -284,11 +288,7 @@ static int frdm_mcxn947_init(void)
284288
CLOCK_AttachClk(kFRO_HF_to_ADC0);
285289
#endif
286290

287-
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI
288-
usb_phy_config_struct_t usbPhyConfig = {
289-
BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM,
290-
};
291-
291+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI)
292292
SPC0->ACTIVE_VDELAY = 0x0500;
293293
/* Change the power DCDC to 1.8v (By default, DCDC is 1.8V), CORELDO to 1.1v (By default,
294294
* CORELDO is 1.0V)
@@ -323,8 +323,10 @@ static int frdm_mcxn947_init(void)
323323
CLOCK_EnableClock(kCLOCK_UsbHsPhy);
324324
CLOCK_EnableUsbhsPhyPllClock(kCLOCK_Usbphy480M, BOARD_XTAL0_CLK_HZ);
325325
CLOCK_EnableUsbhsClock();
326+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI
326327
USB_EhciPhyInit(kUSB_ControllerEhci0, BOARD_XTAL0_CLK_HZ, &usbPhyConfig);
327328
#endif
329+
#endif
328330

329331
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp0))
330332
CLOCK_SetClkDiv(kCLOCK_DivCmp0FClk, 1U);

boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@
182182

183183
zephyr_udc0: &usb1 {
184184
status = "okay";
185+
phy_handle = <&usbphy1>;
186+
};
187+
188+
&usbphy1 {
189+
status = "okay";
190+
tx-d-cal = <4>;
191+
tx-cal-45-dp-ohms = <7>;
192+
tx-cal-45-dm-ohms = <7>;
185193
};
186194

187195
&lpcmp0 {

dts/arm/nxp/nxp_mcxn94x_common.dtsi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,12 @@
880880
status = "disabled";
881881
};
882882

883+
usbphy1: usbphy@10a000 {
884+
compatible = "nxp,usbphy";
885+
reg = <0x10a000 0x1000>;
886+
status = "disabled";
887+
};
888+
883889
lpcmp0: lpcmp@51000 {
884890
compatible = "nxp,lpcmp";
885891
reg = <0x51000 0x1000>;

0 commit comments

Comments
 (0)