Skip to content

Commit 2fbfed9

Browse files
danieldegrassedleach02
authored andcommitted
soc: imx_rt: added support for nxp imx_usdhc SDHC driver to RT600/500
added support for NXP iMX RT600/RT500 to use to SDHC driver, with SD subsystem. Tested with RT685 EVK Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent d108b64 commit 2fbfed9

File tree

7 files changed

+38
-12
lines changed

7 files changed

+38
-12
lines changed

boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ i2s1: &flexcomm3 {
392392
/* Quick fix for 1.8V SD cards on RT600- disable 1.8V negotiation */
393393
no-1-8-v;
394394
pwr-gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
395+
cd-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;
396+
mmc {
397+
compatible = "zephyr,sdmmc-disk";
398+
status = "okay";
399+
label = "SDMMC_0";
400+
};
395401
};
396402

397403
&lpadc0 {

boards/arm/mimxrt685_evk/pinmux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ static int mimxrt685_evk_pinmux_init(const struct device *dev)
770770

771771
#endif
772772

773-
#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_DISK_DRIVER_SDMMC
773+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_IMX_USDHC
774774
uint32_t port1_pin30_config = (/* Pin is configured as SD0_CLK */
775775
IOPCTL_PIO_FUNC1 |
776776
/* Disable pull-up / pull-down function */

dts/arm/nxp/nxp_rt5xx_common.dtsi

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,21 +369,29 @@
369369
};
370370

371371
usdhc1: usdhc@136000 {
372-
compatible = "nxp,imx-usdhc";
372+
compatible = "nxp,imx-sdhc";
373373
reg = <0x136000 0x1000>;
374374
status = "disabled";
375375
interrupts = <45 0>;
376376
clocks = <&clkctl1 MCUX_USDHC1_CLK>;
377-
label = "USDHC_1";
377+
label = "SDHC_0";
378+
max-current-330 = <1020>;
379+
max-current-180 = <1020>;
380+
max-bus-freq = <208000000>;
381+
min-bus-freq = <400000>;
378382
};
379383

380384
usdhc2: usdhc@137000 {
381-
compatible = "nxp,imx-usdhc";
385+
compatible = "nxp,imx-sdhc";
382386
reg = <0x137000 0x1000>;
383387
status = "disabled";
384388
interrupts = <46 0>;
385389
clocks = <&clkctl1 MCUX_USDHC2_CLK>;
386-
label = "USDHC_2";
390+
label = "SDHC_1";
391+
max-current-330 = <1020>;
392+
max-current-180 = <1020>;
393+
max-bus-freq = <208000000>;
394+
min-bus-freq = <400000>;
387395
};
388396

389397
lpadc0: lpadc@13A0000 {

dts/arm/nxp/nxp_rt6xx_common.dtsi

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,21 +321,29 @@
321321
};
322322

323323
usdhc1: usdhc@136000 {
324-
compatible = "nxp,imx-usdhc";
324+
compatible = "nxp,imx-sdhc";
325325
reg = <0x136000 0x1000>;
326326
status = "disabled";
327327
interrupts = <45 0>;
328328
clocks = <&clkctl1 MCUX_USDHC1_CLK>;
329-
label = "USDHC_1";
329+
label = "SDHC_0";
330+
max-current-330 = <1020>;
331+
max-current-180 = <1020>;
332+
max-bus-freq = <208000000>;
333+
min-bus-freq = <400000>;
330334
};
331335

332336
usdhc2: usdhc@137000 {
333-
compatible = "nxp,imx-usdhc";
337+
compatible = "nxp,imx-sdhc";
334338
reg = <0x137000 0x1000>;
335339
status = "disabled";
336340
interrupts = <46 0>;
337341
clocks = <&clkctl1 MCUX_USDHC2_CLK>;
338-
label = "USDHC_2";
342+
label = "SDHC_1";
343+
max-current-330 = <1020>;
344+
max-current-180 = <1020>;
345+
max-bus-freq = <208000000>;
346+
min-bus-freq = <400000>;
339347
};
340348

341349
lpadc0: lpadc@13A0000 {

soc/arm/nxp_imx/rt6xx/Kconfig.defconfig.mimxrt685_cm33

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ config CLOCK_CONTROL_MCUX_SYSCON
4141
default y if HAS_MCUX_SYSCON
4242
depends on CLOCK_CONTROL
4343

44+
config IMX_USDHC
45+
default y if (HAS_MCUX_USDHC1 || HAS_MCUX_USDHC2)
46+
depends on SDHC
47+
4448
if MCUX_OS_TIMER
4549

4650
config SYS_CLOCK_HW_CYCLES_PER_SEC

soc/arm/nxp_imx/rt6xx/soc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ static ALWAYS_INLINE void clock_init(void)
263263
CLOCK_AttachClk(kNONE_to_WDT0_CLK);
264264
#endif
265265

266-
#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_DISK_DRIVER_SDMMC
266+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_IMX_USDHC
267267
/* Make sure USDHC ram buffer has been power up*/
268268
POWER_DisablePD(kPDRUNCFG_APD_USDHC0_SRAM);
269269
POWER_DisablePD(kPDRUNCFG_PPD_USDHC0_SRAM);
@@ -283,7 +283,7 @@ static ALWAYS_INLINE void clock_init(void)
283283
#endif /* CONFIG_SOC_MIMXRT685S_CM33 */
284284
}
285285

286-
#if (DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_DISK_DRIVER_SDMMC)
286+
#if (DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) && CONFIG_IMX_USDHC)
287287

288288
void imxrt_usdhc_pinmux(uint16_t nusdhc, bool init,
289289
uint32_t speed, uint32_t strength)

soc/arm/nxp_imx/rt6xx/soc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
extern "C" {
8080
#endif
8181

82-
#if CONFIG_DISK_DRIVER_SDMMC && \
82+
#if CONFIG_IMX_USDHC && \
8383
(DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc1), okay) || \
8484
DT_NODE_HAS_STATUS(DT_NODELABEL(usdhc2), okay))
8585

0 commit comments

Comments
 (0)