emmc chip on SDMMC3

Hello,
We have a custom board with a eMMC chip (Samsung KLMCG2KETM-B041) connected to SDMMC3 (eMMC chip CLK/CMD/DATA is connected to Nano pin #229, 227, 219, 221, 223, 225).
I modified the dts files to enable the SDMMC3 controller:

diff --git a/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts b/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
index 3b3d514..4a844e0 100644
--- a/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
+++ b/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
@@ -31,6 +31,10 @@
 		status = "okay";
 	};
 
+	sdhci@700b0400 {
+                status = "okay";
+        };
+
 	sdhci@700b0000 { /* SDMMC1 for SD card */
 		status = "disabled";
 	};
diff --git a/sources/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi b/sources/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
index c65c30e..a98b5e8 100644
--- a/sources/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
+++ b/sources/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
@@ -71,6 +71,10 @@
 		max-clk-limit = <204000000>;
 		ddr-clk-limit = <48000000>;
 		bus-width = <4>;
+		built-in;
+		nvidia,is-emmc;
+		mmc-ddr-1_8v;
+                mmc-hs200-1_8v;
 		calib-3v3-offsets = <0x007D>;
 		calib-1v8-offsets = <0x7B7B>;
 		compad-vref-3v3 = <0x7>;

but still can’t see /dev/mmcblk1.

$ ls /dev/mmcblk*
/dev/mmcblk0     /dev/mmcblk0p12  /dev/mmcblk0p3  /dev/mmcblk0p7
/dev/mmcblk0p1   /dev/mmcblk0p13  /dev/mmcblk0p4  /dev/mmcblk0p8
/dev/mmcblk0p10  /dev/mmcblk0p14  /dev/mmcblk0p5  /dev/mmcblk0p9
/dev/mmcblk0p11  /dev/mmcblk0p2   /dev/mmcblk0p6  /dev/mmcblk0rpmb

What should I do to use this eMMC chip. Thanks!

ps. attachment file is the dmesg message.
dmesg_emmc_20190813.txt (56.2 KB)

Hi, SDMMC3 is for SD card, why do you use it as eMMC?

Hi Trumany,
We want to add storage size on board.
Thanks!

Are you using bridge design to convert eMMC to SDIO?

Hi Trumany,
Here is the HW Engineer for this project,No bridge design just like the Jetson Tegra K1 with EMMC reference design,see attached schematic.



From hw side, this kind of your design is not validated on Jetson nano, SDMMC3 is only used for SD card per OEM DG. It is not guaranteed to be workable. Not sure if it can work, did you try manually enable card detection (pin 208)?

Hi Tim,

Please check the device tree source of rel-32.2 and refer to sdhci@700b0600 for how we configure the sdmmc controller for emmc.

Hello,
I trace the kernel and found mmc1 MMC_CAP2_NO_MMC flag is set so can’t enter mmc_attach_mmc() for mm1.
so I modify the kernel source:

diff --git a/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts b/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
index 3b3d514..4a844e0 100644
--- a/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
+++ b/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0002-p3449-0000-b00.dts
@@ -31,6 +31,10 @@
 		status = "okay";
 	};
 
+	sdhci@700b0400 {
+                status = "okay";
+        };
+
 	sdhci@700b0000 { /* SDMMC1 for SD card */
 		status = "disabled";
 	};
diff --git a/sources/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi b/sources/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
index c65c30e..dc4dfe5 100644
--- a/sources/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
+++ b/sources/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-sdhci.dtsi
@@ -71,6 +71,12 @@
 		max-clk-limit = <204000000>;
 		ddr-clk-limit = <48000000>;
 		bus-width = <4>;
+		built-in;
+		nvidia,is-emmc;
+		mmc-ddr-1_8v;
+		mmc-hs200-1_8v;
+		no-sdio;
+		no-sd;
 		calib-3v3-offsets = <0x007D>;
 		calib-1v8-offsets = <0x7B7B>;
 		compad-vref-3v3 = <0x7>;
diff --git a/sources/kernel/kernel-4.9/drivers/mmc/core/host.c b/sources/kernel/kernel-4.9/drivers/mmc/core/host.c
index 8cb1de7..74d8692 100644
--- a/sources/kernel/kernel-4.9/drivers/mmc/core/host.c
+++ b/sources/kernel/kernel-4.9/drivers/mmc/core/host.c
@@ -318,8 +318,8 @@ int mmc_of_parse(struct mmc_host *host)
 		host->caps2 |= MMC_CAP2_NO_SDIO;
 	if (device_property_read_bool(dev, "no-sd"))
 		host->caps2 |= MMC_CAP2_NO_SD;
-	if (device_property_read_bool(dev, "no-mmc"))
-		host->caps2 |= MMC_CAP2_NO_MMC;
+	//if (device_property_read_bool(dev, "no-mmc"))
+		//host->caps2 |= MMC_CAP2_NO_MMC;
 	if (device_property_read_bool(dev, "only-1-8-v"))
 		host->caps2 |= MMC_CAP2_ONLY_1V8_SIGNAL_VOLTAGE;

attachment file “dmesg_emmc_20190815_1.txt” is the dmesg message.

I found there is error in mmc_select_hs200()
So I also modify sources/kernel/kernel-4.9/drivers/mmc/core/mmc.c:

diff --git a/sources/kernel/kernel-4.9/drivers/mmc/core/mmc.c b/sources/kernel/kernel-4.9/drivers/mmc/core/mmc.c
index 75cdd85..40622c5 100644
--- a/sources/kernel/kernel-4.9/drivers/mmc/core/mmc.c
+++ b/sources/kernel/kernel-4.9/drivers/mmc/core/mmc.c
@@ -1627,6 +1627,7 @@ static int mmc_select_hs400es(struct mmc_card *card)
  * 2. switch to HS200 mode
  * 3. set the clock to > 52Mhz and <=200MHz
  */
+#if 0
 static int mmc_select_hs200(struct mmc_card *card)
 {
 	struct mmc_host *host = card->host;
@@ -1683,7 +1684,7 @@ static int mmc_select_hs200(struct mmc_card *card)
 	}
 	return err;
 }
-
+#endif
 /*
  * Activate High Speed, HS200 or HS400ES mode if supported.
  */
@@ -1696,8 +1697,8 @@ static int mmc_select_timing(struct mmc_card *card)
 
 	if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
 		err = mmc_select_hs400es(card);
-	else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
-		err = mmc_select_hs200(card);
+	//else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
+		//err = mmc_select_hs200(card);
 	else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
 		err = mmc_select_hs(card);

attachment file “dmesg_emmc_20190815_2.txt” is the dmesg message.

There are still many errors, but now we can recognize this emmc chip.

$ dmesg | grep mmc1
...
[    1.519114] mmc1: new high speed MMC card at address 0001
[    1.519576] mmcblk1: mmc1:0001 CKTM4R 58.2 GiB
[    1.523828] mmcblk1rpmb: mmc1:0001 CKTM4R partition 3 4.00 MiB
...

I trace the mmc_select_hs200() and found error is occured in mmc_switch().
Could you suggest how we configure SDMMC3 for emmc? Thanks!
dmesg_emmc_20190815_1.txt (68.6 KB)
dmesg_emmc_20190815_2.txt (112 KB)

Did you refer to how we configure emmc nano?
→ tegra210-porg-p3448-common.dtsi
→ tegra210-porg-power-tree-p3448-0000-a00.dtsi
→ tegra210-p3448-0002-p3449-0000-b00.dts

Hello,
I tried to configure the sdmmc controller for emmc referring to sdhci@700b0600.
But still can’t work.

Thanks!

I think this may be out of our support scope for Jetson Nano. Even OEM design guide does not cover your case.
Could you find a nvidia sales to highlight your issue?

Hi WayneWWW,
In the Jetson nano product design guide, the sdmmc3 can be designed as sd card.
[url]https://developer.nvidia.com/embedded/dlc/jetson-nano-product-design-guide[/url]

After doing some research, I have some conclutions below.

The SD card and eMMC actually use the same signal. The main difference is eMMC only have 4 bit data line and SD has 8. eMMC support 1-bit, 4-bit,and 8-bit mode.
[url]http://www.zeroplus.com.tw/software_download/201207-eMMC_en.pdf[/url] (see page 5)
So, there are some conversion boards in the market to convert an eMMC chip to microSD card form factor, like this:
[url]https://www.friendlyarm.com/index.php?route=product/product&product_id=208[/url]

I wonder why sdmmc3 cannot support eMMC.

Hi FrankPCP,

Are you using A02 modules or B00 modules exactly?

Hi WayneWWW,
We are using B00 module.

Thanks.

Please refer to this topic which enables sd card on sdmmc3.

You may copy the emmc parameters from sdmmc4 to sdmmc3 device tree.

Hi WayneWWW,
I followed the instructions in the topic below, but the eMMC still cannot be detected.

Here are the changes I made in device tree.

diff --git a/sources/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi b/sources/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
index 67283d4..5dac07a 100644
--- a/sources/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
+++ b/sources/hardware/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi
@@ -308,13 +308,17 @@
 			override@1 {
 				target = <&sdhci2>;
 				_overlay_ {
-					vmmc-supply = <&max77620_ldo6>;
+					//vmmc-supply = <&max77620_ldo6>;
+					vqmmc-supply = <&max77620_ldo6>;
+					status = "okay";
 					no-sdio;
-					no-mmc;
-					sd-uhs-sdr104;
-					sd-uhs-sdr50;
-					sd-uhs-sdr25;
-					sd-uhs-sdr12;
+					//no-mmc;
+					no-sd;
+					//sd-uhs-sdr104;
+					//sd-uhs-sdr50;
+					//sd-uhs-sdr25;
+					//sd-uhs-sdr12;
+					mmc-hs200-1_8v;					
 				};
 			};
 			override@2 {
diff --git a/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi b/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
index 5ef4384..eb2314a 100644
--- a/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
+++ b/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi
@@ -254,6 +254,11 @@
 		status = "disabled";
 		/delete-property/ keep-power-in-suspend;
 		/delete-property/ non-removable;
+		mmc-ddr-1_8v;
+		mmc-ocr-mask = <3>;
+		uhs-mask = <0x0>;
+		max-clk-limit = <400000>;
+		tap-delay = <3>;	
 	};
 
 	sdhci@700b0200 { /* SDMMC2 for Wifi */

The dmesg.txt is kernel messages and nano_dtsi.txt is the log after performed command below.

dtc -I fs /sys/firmware/devicetree/base > nano_dtsi.txt

Is there anything I need to add for enable eMMC on sdmmc3??

dmesg.txt (80.2 KB)
nano_dtsi.txt (283 KB)

Hi WayneWWW,
I’m sorry. I have to correct my previous statement. I can detect the eMMC now but observe a lot of error messages keep showing.

[ 2402.507130] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings
[ 2403.544839] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 2403.554269] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 2403.564294] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings
[ 2404.594234] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 2404.603699] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 2404.612834] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings
[ 2405.657041] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 2405.666485] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 2405.676687] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings
[ 2405.813283] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 2405.822406] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 2405.831722] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings
[ 2406.185598] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 2406.194462] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 2406.203411] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings
[ 2406.555814] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 2406.564678] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 2406.573629] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings
[ 2406.926012] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 2406.934875] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 2406.943825] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings
[ 2408.310555] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 2408.320497] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 2408.329778] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings
[ 2409.367526] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 2409.376813] sdhci-tegra sdhci-tegra.2: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 2409.386233] sdhci-tegra sdhci-tegra.2: error -19 in autocal-pu-pd-offset settings

Is there any setting need to be change for fix these error messages??

Hi WayneWWW,
I found these error messages is caused by the lack of prod settings. I copy the prod_c_hs200 of the “sdhci@700b0600” to “sdhci@700b0400” directly. The system will crash. Please see the log.txt. Could you please advise me what the correct prod setting is ?
log.txt (27.8 KB)

/hardware/nvidia/soc/t210/kernel-dts/tegra210-soc/tegra210-prods.dtsi has more prod setting for sdmmc4.

Please check it too.

Hi WayneWWW,
The file you mentioned was exactly the one I copy prod setting from.
Thanks.