Skip to content

Commit 8a9afc9

Browse files
NeilChen93kartben
authored andcommitted
boards: frdm_mcxn236: Fix USB next support on this board
This board was missing key code changes needed to support Zephyr USB Next Signed-off-by: Neil Chen <[email protected]>
1 parent 3b40760 commit 8a9afc9

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

boards/nxp/frdm_mcxn236/board.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
#include "usb.h"
1414

1515
/* USB PHY configuration */
16-
#define BOARD_USB_PHY_D_CAL 0x04U
17-
#define BOARD_USB_PHY_TXCAL45DP 0x07U
18-
#define BOARD_USB_PHY_TXCAL45DM 0x07U
16+
#define BOARD_USB_PHY_D_CAL (0x04U)
17+
#define BOARD_USB_PHY_TXCAL45DP (0x07U)
18+
#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 */
@@ -219,11 +223,7 @@ void board_early_init_hook(void)
219223
CLOCK_AttachClk(kFRO_HF_to_ADC0);
220224
#endif
221225

222-
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI
223-
usb_phy_config_struct_t usbPhyConfig = {
224-
BOARD_USB_PHY_D_CAL, BOARD_USB_PHY_TXCAL45DP, BOARD_USB_PHY_TXCAL45DM,
225-
};
226-
226+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && (CONFIG_USB_DC_NXP_EHCI || CONFIG_UDC_NXP_EHCI)
227227
SPC0->ACTIVE_VDELAY = 0x0500;
228228
/* Change the power DCDC to 1.8v (By default, DCDC is 1.8V), CORELDO to 1.1v (By default,
229229
* CORELDO is 1.0V)
@@ -259,8 +259,10 @@ void board_early_init_hook(void)
259259
CLOCK_EnableClock(kCLOCK_UsbHsPhy);
260260
CLOCK_EnableUsbhsPhyPllClock(kCLOCK_Usbphy480M, BOARD_XTAL0_CLK_HZ);
261261
CLOCK_EnableUsbhsClock();
262+
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(usb1)) && CONFIG_USB_DC_NXP_EHCI
262263
USB_EhciPhyInit(kUSB_ControllerEhci0, BOARD_XTAL0_CLK_HZ, &usbPhyConfig);
263264
#endif
265+
#endif
264266

265267
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp0))
266268
CLOCK_SetClkDiv(kCLOCK_DivCmp0FClk, 1U);

boards/nxp/frdm_mcxn236/frdm_mcxn236.dts

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

131131
zephyr_udc0: &usb1 {
132132
status = "okay";
133+
phy-handle = <&usbphy1>;
134+
};
135+
136+
&usbphy1 {
137+
status = "okay";
138+
tx-d-cal = <4>;
139+
tx-cal-45-dp-ohms = <7>;
140+
tx-cal-45-dm-ohms = <7>;
133141
};
134142

135143
&lpcmp0 {

boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ supported:
2525
- pwm
2626
- regulator
2727
- spi
28+
- usbd
2829
- watchdog
29-
- usb_device
3030
vendor: nxp

dts/arm/nxp/nxp_mcxn23x_common.dtsi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,12 @@
754754
status = "disabled";
755755
};
756756

757+
usbphy1: usbphy@10a000 {
758+
compatible = "nxp,usbphy";
759+
reg = <0x10a000 0x1000>;
760+
status = "disabled";
761+
};
762+
757763
lpcmp0: lpcmp@51000 {
758764
compatible = "nxp,lpcmp";
759765
reg = <0x51000 0x1000>;

0 commit comments

Comments
 (0)