MMC over SPI on iMX6 (i.MX6ULLEVK)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MMC over SPI on iMX6 (i.MX6ULLEVK)

2,542 Views
SicScar
Contributor II

Hi, 

i'm working on a i.MX6ULLEVK board, and i'm asked to read an SD card through SPI (SDIO channels are are not available).

I managed to modify the dts and use some of the CSI signals like this  :

...

pinctrl_ecspi1: ecspi1grp {
fsl,pins = <
MX6UL_PAD_CSI_DATA07__ECSPI1_MISO 0x100b1
MX6UL_PAD_CSI_DATA06__ECSPI1_MOSI 0x100b1
MX6UL_PAD_CSI_DATA04__ECSPI1_SCLK 0x100b1
MX6UL_PAD_CSI_DATA05__GPIO4_IO26 0x100b1
>;
};
...
&ecspi1 {
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio4 26 0 GPIO_ACTIVE_HIGH>; //SS cs active low destroys everything
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1>;
status = "okay";

spidev@0x00 {
compatible = "spidev";
spi-max-frequency = <20000000>;
reg = <0>;
};
};
.....
 
And i can see my ecspi1 on /dev and i see some signals. 
Is there a way to activate the MMC drivers on this SPI?
 
thanks a lot! 
Simone 
 
 
Labels (2)
0 Kudos
Reply
5 Replies

2,532 Views
igorpadykov
NXP Employee
NXP Employee

Hi Simone

 

unfortunately spi mode is not supported by uSDHC module as described in sect.58.8.11 Protocol Control (uSDHCx_PROT_CTRL) in description of D3CD bit   i.MX 6ULL Applications Processor Reference Manual

""..card into the SPI mode, which the uSDHC does not support.""

 

Best regards
igor

0 Kudos
Reply

2,522 Views
SicScar
Contributor II

Hi Igor, 

huge thanks for your quick reply. 

Maybe i'm getting that wrong... But, i don't want to use uSDHC module. i'd like to add a new sd device, using SPI1 (or SPI2 it's the same) signals, removed from CSI module. To achieve that, I enabled MMC_OVER_SPI in yocto menuconfing (this is the reference https://www.kernelconfig.io/config_mmc_spi?q=&kernelversion=5.4.118&arch=arm) and i double checked the .config file and all dependecies are imported. 

my new device tree is: 

 

&ecspi1 {
	fsl,spi-num-chipselects = <1>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ecspi1>;
	cs-gpios = <&gpio4 26 0 GPIO_ACTIVE_HIGH>;  
	status = "okay";	
	/*
    spidev@0x00 {
        compatible = "spidev";
        spi-max-frequency = <20000000>;
        reg = <0>;
    };
	*/

	mmc-slot@0x00 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "mmc-spi-slot";
        reg = <0>;
        spi-max-frequency = <50000>;
        voltage-ranges = <3000 3400>;
        disable-wp;
        disable-cd;
    };
};​

 

It compiles without errors or warnings, and during boot sequence i can see the line: 

[ 2.284524] mmc_spi spi0.0: SD/MMC host mmc2, no WP, no poweroff, cd polling
[ 2.289852] sdhci-pltfm: SDHCI platform and OF driver helper
[ 2.301530] sdhci-esdhc-imx 2190000.usdhc: Got CD GPIO
[ 2.348249] mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA
[ 2.397736] mmc1: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA

there's the mmc2 instantiated. 

Besides, when the os is running, if I insert the sd card in my adapter, i can see these errors: 

[ 96.674783] mmc_spi spi0.0: no support for card's volts
[ 96.680106] mmc2: error -22 whilst initialising SD card
[ 96.686496] mmc_spi spi0.0: no support for card's volts
[ 96.697171] mmc2: error -22 whilst initialising MMC card

 

So i really think that there's a way out....

thanks again

Simone

0 Kudos
Reply

2,518 Views
igorpadykov
NXP Employee
NXP Employee

Hi Simone

 

from log "sdhci-esdhc-imx" driver is invoked which do not support spi mode.

 

Best regards
igor

0 Kudos
Reply

2,515 Views
SicScar
Contributor II

Ok...

thanks a lot for the time, 

best reguards! 

Simone

0 Kudos
Reply

2,302 Views
cristiansicilia
Contributor III

Did you find any solution for MMC over SPI?

0 Kudos
Reply