Skip to content

Support usdhc feature on rt700 cm33_cpu0 core #91316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions boards/nxp/mimxrt700_evk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
16 changes: 16 additions & 0 deletions boards/nxp/mimxrt700_evk/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions boards/nxp/mimxrt700_evk/mimxrt700_evk-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,43 @@
input-enable;
};
};

pinmux_usdhc: pinmux_usdhc {
group0 {
pinmux = <SDHC0_CMD_PIO7_1>,
<USDHC0_USDHC_DATA0_PIO7_6>,
<USDHC0_USDHC_DATA1_PIO7_7>,
<USDHC0_USDHC_DATA2_PIO7_8>,
<USDHC0_USDHC_DATA3_PIO7_9>,
<USDHC0_USDHC_DATA4_PIO7_2>,
<USDHC0_USDHC_DATA5_PIO7_3>,
<USDHC0_USDHC_DATA6_PIO7_4>,
<USDHC0_USDHC_DATA7_PIO7_5>,
<SDHC0_CARD_DET_N_PIO7_11>;
bias-pull-up;
input-enable;
slew-rate = "normal";
drive-strength = "normal";
};
group1 {
pinmux = <SDHC0_CLK_PIO7_0>;
bias-pull-down;
input-enable;
slew-rate = "normal";
drive-strength = "normal";
};
group2 {
pinmux = <GPIO7_GPIO12_PIO7_12>;
bias-pull-down;
slew-rate = "normal";
drive-strength = "normal";
};
group3 {
pinmux = <SDHC0_DS_PIO7_10>;
bias-pull-down;
input-enable;
slew-rate = "slow";
drive-strength = "normal";
};
};
};
19 changes: 19 additions & 0 deletions boards/nxp/mimxrt700_evk/mimxrt700_evk_mimxrt798s_cm33_cpu0.dts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
pwm-0 = &sc_timer;
i2s-codec-tx = &sai0;
i2s-tx = &sai0;
sdhc0 = &usdhc0;
};

chosen {
Expand Down Expand Up @@ -182,6 +183,10 @@ zephyr_lcdif: &lcdif {};
status = "okay";
};

&gpio7 {
status = "okay";
};

&green_led {
status = "okay";
};
Expand Down Expand Up @@ -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";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ supported:
- gpio
- i2c
- uart
- sdhc
- spi
- adc
- usb_device
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 24 additions & 0 deletions dts/arm/nxp/nxp_rt7xx_cm33_cpu0.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
1 change: 1 addition & 0 deletions tests/subsys/fs/fat_fs_api/prj_mmc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ CONFIG_SPI=y
CONFIG_GPIO=y
CONFIG_ZTEST=y
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_ZTEST_STACK_SIZE=2048