diff --git a/boards/nxp/mimxrt700_evk/CMakeLists.txt b/boards/nxp/mimxrt700_evk/CMakeLists.txt index 32c47fe3d951..f1791d8f7f87 100644 --- a/boards/nxp/mimxrt700_evk/CMakeLists.txt +++ b/boards/nxp/mimxrt700_evk/CMakeLists.txt @@ -26,3 +26,7 @@ if(CONFIG_NXP_IMXRT_BOOT_HEADER) zephyr_library_sources(${RT7XX_BOARD_DIR}/flash_config/flash_config.c) zephyr_library_include_directories(${RT7XX_BOARD_DIR}/flash_config) endif() + +if(CONFIG_IMX_USDHC) + zephyr_compile_definitions(FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1) +endif() diff --git a/boards/nxp/mimxrt700_evk/board.c b/boards/nxp/mimxrt700_evk/board.c index 4197df5286aa..a949676cf991 100644 --- a/boards/nxp/mimxrt700_evk/board.c +++ b/boards/nxp/mimxrt700_evk/board.c @@ -434,6 +434,22 @@ void board_early_init_hook(void) DT_PROP_BY_PHANDLE(DT_NODELABEL(usb0), clocks, clock_frequency)); #endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc0), okay) && CONFIG_IMX_USDHC + /*Make sure USDHC ram buffer has power up*/ + POWER_DisablePD(kPDRUNCFG_APD_SDHC0_SRAM); + POWER_DisablePD(kPDRUNCFG_PPD_SDHC0_SRAM); + POWER_DisablePD(kPDRUNCFG_PD_LPOSC); + POWER_ApplyPD(); + + /* USDHC0 */ + /* usdhc depend on 32K clock also */ + CLOCK_AttachClk(kLPOSC_DIV32_to_32K_WAKE); + CLOCK_InitAudioPfd(kCLOCK_Pfd0, 24U); /* Target 400MHZ. */ + CLOCK_AttachClk(kAUDIO_PLL_PFD0_to_SDIO0); + CLOCK_SetClkDiv(kCLOCK_DivSdio0Clk, 1); + RESET_ClearPeripheralReset(kUSDHC0_RST_SHIFT_RSTn); +#endif + #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(wwdt0)) CLOCK_AttachClk(kLPOSC_to_WWDT0); #endif diff --git a/boards/nxp/mimxrt700_evk/mimxrt700_evk-pinctrl.dtsi b/boards/nxp/mimxrt700_evk/mimxrt700_evk-pinctrl.dtsi index 76d796ed8b42..ca001df77780 100644 --- a/boards/nxp/mimxrt700_evk/mimxrt700_evk-pinctrl.dtsi +++ b/boards/nxp/mimxrt700_evk/mimxrt700_evk-pinctrl.dtsi @@ -128,4 +128,43 @@ input-enable; }; }; + + pinmux_usdhc: pinmux_usdhc { + group0 { + pinmux = , + , + , + , + , + , + , + , + , + ; + bias-pull-up; + input-enable; + slew-rate = "normal"; + drive-strength = "normal"; + }; + group1 { + pinmux = ; + bias-pull-down; + input-enable; + slew-rate = "normal"; + drive-strength = "normal"; + }; + group2 { + pinmux = ; + bias-pull-down; + slew-rate = "normal"; + drive-strength = "normal"; + }; + group3 { + pinmux = ; + bias-pull-down; + input-enable; + slew-rate = "slow"; + drive-strength = "normal"; + }; + }; }; diff --git a/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.dts b/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.dts index bc8aca798be9..41d556c1c2e6 100644 --- a/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.dts +++ b/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.dts @@ -24,6 +24,7 @@ pwm-0 = &sc_timer; i2s-codec-tx = &sai0; i2s-tx = &sai0; + sdhc0 = &usdhc0; }; chosen { @@ -182,6 +183,10 @@ zephyr_lcdif: &lcdif {}; status = "okay"; }; +&gpio7 { + status = "okay"; +}; + &green_led { status = "okay"; }; @@ -240,6 +245,20 @@ zephyr_udc0: &usb0 { tx-cal-45-dm-ohms = <6>; }; +&usdhc0 { + status = "okay"; + pwr-gpios = <&gpio7 12 GPIO_ACTIVE_HIGH>; + mmc { + compatible = "zephyr,mmc-disk"; + disk-name = "SD2"; + status = "okay"; + }; + pinctrl-0 = <&pinmux_usdhc>; + pinctrl-names = "default"; + mmc-hs200-1_8v; + mmc-hs400-1_8v; +}; + &wwdt0 { status = "okay"; }; diff --git a/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.yaml b/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.yaml index 10b049b8277d..523db8150a83 100644 --- a/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.yaml +++ b/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.yaml @@ -18,6 +18,7 @@ supported: - gpio - i2c - uart + - sdhc - spi - adc - usb_device diff --git a/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0_defconfig b/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0_defconfig index 7742e7da8fc5..5a4efbdf8041 100644 --- a/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0_defconfig +++ b/boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0_defconfig @@ -17,3 +17,4 @@ CONFIG_HW_STACK_PROTECTION=y CONFIG_TRUSTED_EXECUTION_SECURE=y # Nocache memory options CONFIG_NOCACHE_MEMORY=y +CONFIG_IMX_USDHC_DMA_SUPPORT=n diff --git a/dts/arm/nxp/nxp_rt7xx_cm33_cpu0.dtsi b/dts/arm/nxp/nxp_rt7xx_cm33_cpu0.dtsi index 80cab28c6b18..8abbb046d74f 100644 --- a/dts/arm/nxp/nxp_rt7xx_cm33_cpu0.dtsi +++ b/dts/arm/nxp/nxp_rt7xx_cm33_cpu0.dtsi @@ -1003,6 +1003,30 @@ status = "disabled"; }; + usdhc0: usdhc@412000 { + compatible = "nxp,imx-usdhc"; + reg = <0x412000 0x1000>; + status = "disabled"; + interrupts = <37 0>; + clocks = <&clkctl4 MCUX_USDHC1_CLK>; + max-current-330 = <1020>; + max-current-180 = <1020>; + max-bus-freq = <208000000>; + min-bus-freq = <400000>; + }; + + usdhc1: usdhc@413000 { + compatible = "nxp,imx-usdhc"; + reg = <0x413000 0x1000>; + status = "disabled"; + interrupts = <38 0>; + clocks = <&clkctl4 MCUX_USDHC2_CLK>; + max-current-330 = <1020>; + max-current-180 = <1020>; + max-bus-freq = <208000000>; + min-bus-freq = <400000>; + }; + mrt0: mrt@2d000 { compatible = "nxp,mrt"; reg = <0x2d000 0x100>; diff --git a/tests/subsys/fs/fat_fs_api/prj_mmc.conf b/tests/subsys/fs/fat_fs_api/prj_mmc.conf index 98181cf96a0e..221a57054868 100644 --- a/tests/subsys/fs/fat_fs_api/prj_mmc.conf +++ b/tests/subsys/fs/fat_fs_api/prj_mmc.conf @@ -5,3 +5,4 @@ CONFIG_SPI=y CONFIG_GPIO=y CONFIG_ZTEST=y CONFIG_MAIN_STACK_SIZE=4096 +CONFIG_ZTEST_STACK_SIZE=2048