Skip to content

Commit a25cfe5

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 a06cf96 commit a25cfe5

File tree

6 files changed

+80
-0
lines changed

6 files changed

+80
-0
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
@@ -128,4 +128,43 @@
128128
input-enable;
129129
};
130130
};
131+
132+
pinmux_usdhc: pinmux_usdhc {
133+
group0 {
134+
pinmux = <SDHC0_CMD_PIO7_1>,
135+
<USDHC0_USDHC_DATA0_PIO7_6>,
136+
<USDHC0_USDHC_DATA1_PIO7_7>,
137+
<USDHC0_USDHC_DATA2_PIO7_8>,
138+
<USDHC0_USDHC_DATA3_PIO7_9>,
139+
<USDHC0_USDHC_DATA4_PIO7_2>,
140+
<USDHC0_USDHC_DATA5_PIO7_3>,
141+
<USDHC0_USDHC_DATA6_PIO7_4>,
142+
<USDHC0_USDHC_DATA7_PIO7_5>,
143+
<SDHC0_CARD_DET_N_PIO7_11>;
144+
bias-pull-up;
145+
input-enable;
146+
slew-rate = "normal";
147+
drive-strength = "normal";
148+
};
149+
group1 {
150+
pinmux = <SDHC0_CLK_PIO7_0>;
151+
bias-pull-down;
152+
input-enable;
153+
slew-rate = "normal";
154+
drive-strength = "normal";
155+
};
156+
group2 {
157+
pinmux = <GPIO7_GPIO12_PIO7_12>;
158+
bias-pull-down;
159+
slew-rate = "normal";
160+
drive-strength = "normal";
161+
};
162+
group3 {
163+
pinmux = <SDHC0_DS_PIO7_10>;
164+
bias-pull-down;
165+
input-enable;
166+
slew-rate = "slow";
167+
drive-strength = "normal";
168+
};
169+
};
131170
};

boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.dts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
pwm-0 = &sc_timer;
2525
i2s-codec-tx = &sai0;
2626
i2s-tx = &sai0;
27+
sdhc0 = &usdhc0;
2728
};
2829

2930
chosen {
@@ -182,6 +183,10 @@ zephyr_lcdif: &lcdif {};
182183
status = "okay";
183184
};
184185

186+
&gpio7 {
187+
status = "okay";
188+
};
189+
185190
&green_led {
186191
status = "okay";
187192
};
@@ -240,6 +245,20 @@ zephyr_udc0: &usb0 {
240245
tx-cal-45-dm-ohms = <6>;
241246
};
242247

248+
&usdhc0 {
249+
status = "okay";
250+
pwr-gpios = <&gpio7 12 GPIO_ACTIVE_HIGH>;
251+
mmc {
252+
compatible = "zephyr,mmc-disk";
253+
disk-name = "SD2";
254+
status = "okay";
255+
};
256+
pinctrl-0 = <&pinmux_usdhc>;
257+
pinctrl-names = "default";
258+
mmc-hs200-1_8v;
259+
mmc-hs400-1_8v;
260+
};
261+
243262
&wwdt0 {
244263
status = "okay";
245264
};

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ CONFIG_HW_STACK_PROTECTION=y
1717
CONFIG_TRUSTED_EXECUTION_SECURE=y
1818
# Nocache memory options
1919
CONFIG_NOCACHE_MEMORY=y
20+
CONFIG_IMX_USDHC_DMA_SUPPORT=n

0 commit comments

Comments
 (0)