I'm trying to add an SD card over SPI (ecspi2) on the iMX7 Solo. I would use an SDIO port but its not an option on my hardware (custom board). I'm using Yocto and Linux 4.1.
I have added the following to my .dts, but I don't see any new block device show up in lsblk or any new partition in /proc/partitions, or any prints related to this show up in /var/log/messages.
&ecspi2 {
status = "okay";
sdcard: mmc-slot@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "mmc-spi-slot";
reg = <0>;
spi-max-frequency = <5000000>;
voltage-ranges = <3200 3400>;
disable-wp;
disable-cd;
};
};
pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
MX7D_PAD_ECSPI2_MISO__ECSPI2_MISO 0x00000014
MX7D_PAD_ECSPI2_MOSI__ECSPI2_MOSI 0x00000014
MX7D_PAD_ECSPI2_SCLK__ECSPI2_SCLK 0x00000014
MX7D_PAD_ECSPI2_SS0__ECSPI2_SS0 0x00000014
>;
};
My theory now is that the MMC_SPI kernel driver (which has "mmc-spi-slot" as the compatible string) is not being compiled into my kernel. I have found other posts where people used this driver for this purpose (sd card over spi on iMX6 was the closest case I could find) :
https://github.com/torvalds/linux/blob/master/drivers/mmc/host/mmc_spi.c
TargetMachine$ cat /lib/modules/$(uname -r)/modules.builtin | grep mmc
kernel/drivers/mmc/card/mmc_block.ko
kernel/drivers/mmc/core/mmc_core.ko
kernel/drivers/mmc/host/sdhci.ko
kernel/drivers/mmc/host/sdhci-pltfm.ko
kernel/drivers/mmc/host/sdhci-esdhc-imx.ko
TargetMachine$ cat /lib/modules/$(uname -r)/modules.builtin | grep spi
kernel/drivers/base/regmap/regmap-spi.ko
kernel/drivers/mfd/mc13xxx-spi.ko
kernel/drivers/mtd/spi-nor/spi-nor.ko
kernel/drivers/mtd/spi-nor/fsl-quadspi.ko
kernel/drivers/spi/spi-bitbang.ko
kernel/drivers/spi/spi-gpio.ko
kernel/drivers/spi/spi-imx.ko
I searched around the kernel menuconfig UI for relevant kernel components to add. I already had the following config entries set:
HostMachine$ cat .config | grep MMC
# Supported MMC/SDIO adapters
CONFIG_MMC=y
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_CLKGATE is not set
# MMC/SD/SDIO Card Drivers
CONFIG_MMC_BLOCK=y
CONFIG_MMC_BLOCK_MINORS=8
CONFIG_MMC_BLOCK_BOUNCE=y
# CONFIG_MMC_TEST is not set
# MMC/SD/SDIO Host Controller Drivers
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_IO_ACCESSORS=y
CONFIG_MMC_SDHCI_PLTFM=y
# CONFIG_MMC_SDHCI_OF_ARASAN is not set
CONFIG_MMC_SDHCI_ESDHC_IMX=y
# CONFIG_MMC_SDHCI_F_SDH30 is not set
# CONFIG_MMC_MXC is not set
# CONFIG_MMC_DW is not set
# CONFIG_MMC_VUB300 is not set
# CONFIG_MMC_USHC is not set
# CONFIG_MMC_USDHI6ROL0 is not set
When I search for "MMC" in the menuconfig UI, I see an additional entry that is not in my .config file:
Symbol: MMC_SPI [=n]
Type : tristate
Prompt: MMC/SD/SDIO over SPI
Location:
-> Device Drivers
(1) -> MMC/SD/SDIO card support (MMC [=y])
Depends on: MMC [=y] && SPI_MASTER [=y] && !HIGHMEM [=y] && HAS_DMA [=y]
Defined at drivers/mmc/host/Kconfig:472
Selects: CRC7 [=m] && CRC_ITU_T [=m]
However, I dont see any way in the menu to enable the MMC_SPI symbol, or to get CONFIG_MMC_SPI to showup in my .config file.
https://github.com/torvalds/linux/blob/master/drivers/mmc/host/Kconfig
Can you help me get past this point? Do you agree that I need to get the mmc_spi driver compiled in? If so, how can I get it to compile in? What else might be the problem and how do I troubleshoot ?
Solved! Go to Solution.
Hi Adrian
I am afraid SD Card over SPI is not supported with i.MX7.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Adrian
I am afraid SD Card over SPI is not supported with i.MX7.
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
You say SD Card SPI mode (*) is not possible on i.MX7.
Do you mean the uSDHC does not support this, or the ECSPI module does not support this?
As the SD card SPI mode requires just a normal SPI host, the ECSPI should be able to handle it?
So, indeed, like Stefano asked: please explain.
Regards,
Leon.
(*) SD card SPI mode: How to Use MMC/SDC
Hi Leon
I believe ECSPI should be able to handle it, one can look at AN2689 document
https://www.nxp.com/docs/en/application-note/AN2689.pdf
Best regards
igor
Hello Igor,
please could you explain me why the i.MX7 does not support the SD Card over SPI?
Best regards
Stefano
Thanks for the replies, Jas and Igor.
Looks like we'll have to find a different way forward on this design.
Take care,
Adrian
The option doesn't appear because imx_v7_defconfig negates the dependency ie:
1. CONFIG_HIGHMEM=y
2. CONFIG_HAS_DMA is not set
You would need to re-enable and see what happens.