Skip to content

Commit fcb96ce

Browse files
committed
boards: nxp: mimxrt700: enable usdhc0 instance
enable usdhc0 clock config usdhc0 pin enable mmc-disk:SD2 Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
1 parent a18d663 commit fcb96ce

File tree

6 files changed

+83
-1
lines changed

6 files changed

+83
-1
lines changed

boards/nxp/mimxrt700_evk/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ if(CONFIG_NXP_IMXRT_BOOT_HEADER)
2626
zephyr_library_sources(${RT7XX_BOARD_DIR}/flash_config/flash_config.c)
2727
zephyr_library_include_directories(${RT7XX_BOARD_DIR}/flash_config)
2828
endif()
29+
30+
if(CONFIG_IMX_USDHC)
31+
zephyr_compile_definitions(FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1)
32+
endif()

boards/nxp/mimxrt700_evk/board.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,22 @@ void board_early_init_hook(void)
434434
DT_PROP_BY_PHANDLE(DT_NODELABEL(usb0), clocks, clock_frequency));
435435
#endif
436436

437+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) && CONFIG_IMX_USDHC
438+
/*Make sure USDHC ram buffer has power up*/
439+
POWER_DisablePD(kPDRUNCFG_APD_SDHC0_SRAM);
440+
POWER_DisablePD(kPDRUNCFG_PPD_SDHC0_SRAM);
441+
POWER_DisablePD(kPDRUNCFG_PD_LPOSC);
442+
POWER_ApplyPD();
443+
444+
/* USDHC0 */
445+
/* usdhc depend on 32K clock also */
446+
CLOCK_AttachClk(kLPOSC_DIV32_to_32K_WAKE);
447+
CLOCK_InitAudioPfd(kCLOCK_Pfd0, 24U); /* Target 400MHZ. */
448+
CLOCK_AttachClk(kAUDIO_PLL_PFD0_to_SDIO0);
449+
CLOCK_SetClkDiv(kCLOCK_DivSdio0Clk, 1);
450+
RESET_ClearPeripheralReset(kUSDHC0_RST_SHIFT_RSTn);
451+
#endif
452+
437453
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wwdt0))
438454
CLOCK_AttachClk(kLPOSC_to_WWDT0);
439455
#endif

boards/nxp/mimxrt700_evk/mimxrt700_evk-pinctrl.dtsi

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,43 @@
101101
input-enable;
102102
};
103103
};
104+
105+
pinmux_usdhc: pinmux_usdhc {
106+
group0 {
107+
pinmux = <SDHC0_CMD_PIO7_1>,
108+
<USDHC0_USDHC_DATA0_PIO7_6>,
109+
<USDHC0_USDHC_DATA1_PIO7_7>,
110+
<USDHC0_USDHC_DATA2_PIO7_8>,
111+
<USDHC0_USDHC_DATA3_PIO7_9>,
112+
<USDHC0_USDHC_DATA4_PIO7_2>,
113+
<USDHC0_USDHC_DATA5_PIO7_3>,
114+
<USDHC0_USDHC_DATA6_PIO7_4>,
115+
<USDHC0_USDHC_DATA7_PIO7_5>,
116+
<SDHC0_CARD_DET_N_PIO7_11>;
117+
bias-pull-up;
118+
input-enable;
119+
slew-rate = "normal";
120+
drive-strength = "normal";
121+
};
122+
group1 {
123+
pinmux = <SDHC0_CLK_PIO7_0>;
124+
bias-pull-down;
125+
input-enable;
126+
slew-rate = "normal";
127+
drive-strength = "normal";
128+
};
129+
group2 {
130+
pinmux = <GPIO7_GPIO12_PIO7_12>;
131+
bias-pull-down;
132+
slew-rate = "normal";
133+
drive-strength = "normal";
134+
};
135+
group3 {
136+
pinmux = <SDHC0_DS_PIO7_10>;
137+
bias-pull-down;
138+
input-enable;
139+
slew-rate = "slow";
140+
drive-strength = "normal";
141+
};
142+
};
104143
};

boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.dts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
sw1 = &user_button_2;
2323
watchdog0 = &wwdt0;
2424
pwm-0 = &sc_timer;
25+
sdhc0 = &usdhc0;
2526
};
2627

2728
chosen {
@@ -159,6 +160,10 @@ zephyr_lcdif: &lcdif {};
159160
status = "okay";
160161
};
161162

163+
&gpio7 {
164+
status = "okay";
165+
};
166+
162167
&green_led {
163168
status = "okay";
164169
};
@@ -211,6 +216,20 @@ zephyr_udc0: &usb0 {
211216
tx-cal-45-dm-ohms = <6>;
212217
};
213218

219+
&usdhc0 {
220+
status = "okay";
221+
pwr-gpios = <&gpio7 12 GPIO_ACTIVE_HIGH>;
222+
mmc {
223+
compatible = "zephyr,mmc-disk";
224+
disk-name = "SD2";
225+
status = "okay";
226+
};
227+
pinctrl-0 = <&pinmux_usdhc>;
228+
pinctrl-names = "default";
229+
mmc-hs200-1_8v;
230+
mmc-hs400-1_8v;
231+
};
232+
214233
&wwdt0 {
215234
status = "okay";
216235
};

boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ supported:
1818
- gpio
1919
- i2c
2020
- uart
21+
- sdhc
2122
- spi
2223
- adc
2324
- usb_device

boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0_defconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2024 NXP
2+
# Copyright 2024-2025 NXP
33
#
44
# SPDX-License-Identifier: Apache-2.0
55
#
@@ -15,3 +15,6 @@ CONFIG_HW_STACK_PROTECTION=y
1515

1616
# Enable TrustZone-M
1717
CONFIG_TRUSTED_EXECUTION_SECURE=y
18+
# Nocache memory options
19+
CONFIG_NOCACHE_MEMORY=y
20+
CONFIG_IMX_USDHC_DMA_SUPPORT=n

0 commit comments

Comments
 (0)