Disable Tuning for External EMMC

Hi,

I have an external emmc connected on sdmmc1. It’s working on hs200 mode.
i want it to make it work on 50 MHz without tuning feature.

Currently with below entry external emmc is working on hs200 mode

sdhci@3400000 {         /*added external eMMC support on SDMMC1*/                                                                                              
    uhs-mask = <0x1f>;
    no-sdio;
    no-sd;
    non-removable;
    mmc-ddr-1_8v;
    mmc-hs200-1_8v;
    nvidia,cd-wakeup-capable;
    nvidia,enable-strobe-mode;
    status = "okay";
};

Please suggest what should be the uhs-mask for 50MHz without tuning.

Actually in one of our device we are facing this crash issue:

[ 4.601962] mmcblk0rpmb: mmc0:0001 DG4016 partition 3 4.00 MiB
[ 4.608832] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24 p25 p26 p27 p28 p29 p30 p31 p2
[ 4.642570] sdhci-tegra 3400000.sdhci: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 4.642573] sdhci-tegra 3400000.sdhci: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 4.642578] sdhci-tegra 3400000.sdhci: error -19 in autocal-pu-pd-offset settings
[ 4.643592] sdhci-tegra 3400000.sdhci: Failed to set trim value for timing 9, -19
[ 4.643607] sdhci-tegra 3400000.sdhci: Failed to set number of iterations for timing 9, -19
[ 4.644256] sdhci-tegra 3400000.sdhci: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 4.644258] sdhci-tegra 3400000.sdhci: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 4.644262] sdhci-tegra 3400000.sdhci: error -19 in autocal-pu-pd-offset settings
[ 4.645315] sdhci-tegra 3400000.sdhci: Failed to set trim value for timing 9, -19
[ 4.645322] sdhci-tegra 3400000.sdhci: Failed to set number of iterations for timing 9, -19
[ 4.645326] sdhci-tegra 3400000.sdhci: tegra_sdhci_get_max_tuning_loop_counter: error -19 in tuning iteration update
[ 4.646947] mmc2: Applying tuning correction
[ 4.646986] ------------[ cut here ]------------
[ 4.646994] WARNING: CPU: 3 PID: 1651 at …/drivers/mmc/host/sdhci-tegra.c:660 tegra_sdhci_post_tuning+0x474/0x630
[ 4.646997] Modules linked in:
[ 4.646997]
[ 4.647001] CPU: 3 PID: 1651 Comm: kworker/3:2 Not tainted 4.9.140 #4
[ 4.647002] Hardware name: lightning (DT)
[ 4.647011] Workqueue: events_freezable mmc_rescan
[ 4.647012] task: ffffffc0eb52aa00 task.stack: ffffffc0eb75c000
[ 4.647014] PC is at tegra_sdhci_post_tuning+0x474/0x630
[ 4.647016] LR is at tegra_sdhci_post_tuning+0x53c/0x630
[ 4.647018] pc : [] lr : [] pstate: 604000c5
[ 4.647018] sp : ffffffc0eb75fa30
[ 4.647021] x29: ffffffc0eb75fa30 x28: 0000000000000088
[ 4.647024] x27: 0000000000000054 x26: 0000000000000000
[ 4.647027] x25: 0000000000000000 x24: 0000000000001388
[ 4.647029] x23: ffffffc0eb65ecc0 x22: 0000000000000041
[ 4.647031] x21: 0000000000000000 x20: 0000000000000027
[ 4.647033] x19: ffffffc0eb65e7c0 x18: 0000000000000000
[ 4.647035] x17: 0000000000000041 x16: 00000000ffffffff
[ 4.647037] x15: 0000000000000000 x14: 0000000000000001
[ 4.647039] x13: 0000000000000000 x12: 0000000000000000
[ 4.647041] x11: 0000000000000001 x10: 0000000000000001
[ 4.647043] x9 : 0000000000000020 x8 : 0000000000000000
[ 4.647045] x7 : 0000000000000000 x6 : 0000000000000000
[ 4.647046] x5 : 0000000000000000 x4 : 0000000000000000
[ 4.647048] x3 : 0000000000000001 x2 : 0000000000000020
[ 4.647050] x1 : 0000000000000020 x0 : 00000000ffffffff
[ 4.647051]
[ 4.647053] —[ end trace b59d9a83ec36cd93 ]—
[ 4.647055] Call trace:
[ 4.647058] [] tegra_sdhci_post_tuning+0x474/0x630
[ 4.647061] [] sdhci_execute_tuning+0x37c/0x918
[ 4.647063] [] mmc_execute_tuning+0x58/0xe0
[ 4.647065] [] mmc_hs200_tuning+0x3c/0x70
[ 4.647068] [] mmc_init_card+0x8dc/0xd68
[ 4.647070] [] mmc_attach_mmc+0xa4/0x168
[ 4.647072] [] mmc_rescan+0x2f8/0x370
[ 4.647077] [] process_one_work+0x1e4/0x4b0
[ 4.647079] [] worker_thread+0x50/0x4c8
[ 4.647081] [] kthread+0xec/0xf0
[ 4.647084] [] ret_from_fork+0x10/0x30
[ 4.647086] mmc2: Tap value after applying correction 19
[ 4.647093] mmc2: hw tuning done …
[ 4.648131] mmc2: new HS200 MMC card at address 0001
[ 4.648388] mmcblk2: mmc2:0001 DA6128 116 GiB
[ 4.648491] mmcblk2boot0: mmc2:0001 DA6128 partition 1 4.00 MiB
[ 4.652592] mmcblk2boot1: mmc2:0001 DA6128 partition 2 4.00 MiB
[ 4.652692] mmcblk2rpmb: mmc2:0001 DA6128 partition 3 4.00 MiB
[ 5.310980] tegra-pcie 10003000.pcie-controller: PCIE: Disable power rails

Also attaching full logs also for your reference.crash_logs.txt (93.9 KB)

Any suggestion will be appreciated.

To run eMMC at 50MHz non-tunable mode, uhs-mask should be set 0x60.
Once the system boots, please check the dt value using
cat /proc/device-tree/sdhci@3400000/uhs-mask

Hi Bibek,

Thanks for your response.

I have one more query:

Currently the external emmc is working on hs200 mode, below are the mmc initialisation logs:

root@localhost:/home/ubuntu# dmesg | grep mmc
[ 0.000000] Kernel command line: console=ttyS0,115200 androidboot.presilicon=true firmware_class.path=/etc/firmware root=/dev/mmcblk0p1 rw M
[ 0.449035] GPIO line 445 (sdmmc-wake-support-input) hogged as input
[ 0.449080] GPIO line 446 (sdmmc-wake-support-output) hogged as output/high
[ 0.525548] vddio-sdmmc1: 1800 <–> 3300 mV at 3300 mV
[ 4.400269] mmc1: SDHCI controller on 3440000.sdhci [3440000.sdhci] using ADMA 64-bit with 64 bit addr
[ 4.400290] mmc0: SDHCI controller on 3460000.sdhci [3460000.sdhci] using ADMA 64-bit with 64 bit addr
[ 4.412263] mmc2: SDHCI controller on 3400000.sdhci [3400000.sdhci] using ADMA 64-bit with 64 bit addr
[ 4.455034] mmc0: mmc_decode_ext_csd: CMDQ supported: depth: 31, cmdq_support: 1
[ 4.469241] mmc0: periodic cache flush enabled
[ 4.469248] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[ 4.471036] mmc2: Applying tuning correction
[ 4.471088] WARNING: CPU: 3 PID: 1616 at …/drivers/mmc/host/sdhci-tegra.c:660 tegra_sdhci_post_tuning+0x474/0x630
[ 4.471103] Workqueue: events_freezable mmc_rescan
[ 4.471158] [] mmc_execute_tuning+0x58/0xe0
[ 4.471160] [] mmc_hs200_tuning+0x3c/0x70
[ 4.471162] [] mmc_init_card+0x8dc/0xd68
[ 4.471164] [] mmc_attach_mmc+0xa4/0x168
[ 4.471166] [] mmc_rescan+0x2f8/0x370
[ 4.471180] mmc2: Tap value after applying correction 19
[ 4.471186] mmc2: hw tuning done …
[ 4.471880] mmc2: new HS200 MMC card at address 0001
[ 4.472800] mmcblk0: mmc0:0001 DG4016 14.7 GiB
[ 4.476182] mmcblk2: mmc2:0001 DA6128 116 GiB
[ 4.476306] mmcblk2boot0: mmc2:0001 DA6128 partition 1 4.00 MiB
[ 4.476934] mmcblk0boot0: mmc0:0001 DG4016 partition 1 4.00 MiB
[ 4.477037] mmcblk0boot1: mmc0:0001 DG4016 partition 2 4.00 MiB
[ 4.480430] mmcblk2boot1: mmc2:0001 DA6128 partition 2 4.00 MiB
[ 4.480531] mmcblk2rpmb: mmc2:0001 DA6128 partition 3 4.00 MiB
[ 4.483009] mmcblk0rpmb: mmc0:0001 DG4016 partition 3 4.00 MiB
[ 4.486088] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24 p25 p26 p27 p28 p29 p30 p31 p32
[ 16.620646] mmcblk mmc0:0001: Card claimed for testing.
[ 16.620653] mmcblk mmc2:0001: Card claimed for testing.
[ 16.763263] Root device found: mmcblk0p1
[ 16.768127] Found dev node: /dev/mmcblk0p1
[ 16.791428] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[ 16.800176] Rootfs mounted over mmcblk0p1
[ 17.299528] EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)
[ 19.829373] EXT4-fs (mmcblk2): mounted filesystem with ordered data mode. Opts: (null)
[ 138.898957] EXT4-fs (mmcblk0p32): mounted filesystem with ordered data mode. Opts: (null)

Whenever i am doing any read/write on the emmc, below logs are continuously coming in dmesg:

[ 1677.265071] sdhci-tegra 3400000.sdhci: tegra_sdhci_pad_autocalib: error -19 in comp vref settings
[ 1677.274107] sdhci-tegra 3400000.sdhci: tegra_sdhci_pad_autocalib: error -19 in autocal-en settings
[ 1677.283225] sdhci-tegra 3400000.sdhci: error -19 in autocal-pu-pd-offset settings

Please suggest how can i fix them.

Hi,

Any suggestion will be appreciated.

Could you check if adding the following in the prods.dtsi under sdhci@3400000 helps
prod_c_hs200 {
prod = <0x00000100 0x00FF0000 0x00090000
0x000001C0 0x0000E000 0x00004000
0x000001E0 0x0000000F 0x00000007
0x000001E4 0x20007F7F 0x20007A00>;
};

After adding above prod settings, errors are resolved.
Thanks for the help.

I have one more query, Our hardware supports 400MHz speed also for the external Emmc. but currently its working on hs200 speed with below dtsi settings.
sdhci@3400000 { /added external eMMC support on SDMMC1/
uhs-mask = <0x1f>;
no-sdio;
no-sd;
non-removable;
mmc-ddr-1_8v;
mmc-hs200-1_8v;
nvidia,cd-wakeup-capable;
nvidia,enable-strobe-mode;
status = “okay”;
};

I wanted to configure this emmc for hs400 speed. so i added two entries
mmc-hs400-1_8v;
mmc-hs400-enhanced-strobe;

But now i am getting card init errors.

[ 0.000000] Kernel command line: console=ttyS0,115200 androidboot.presilicon=true firmware_class.path=/etc/firmware root=/dev/mmcblk0p1 rw rootwait rootfstype=
[ 0.458348] GPIO line 445 (sdmmc-wake-support-input) hogged as input
[ 0.458395] GPIO line 446 (sdmmc-wake-support-output) hogged as output/high
[ 0.533559] vddio-sdmmc1: 1800 <–> 3300 mV at 3300 mV
[ 5.077818] mmc0: SDHCI controller on 3460000.sdhci [3460000.sdhci] using ADMA 64-bit with 64 bit addr
[ 5.089797] mmc1: SDHCI controller on 3440000.sdhci [3440000.sdhci] using ADMA 64-bit with 64 bit addr
[ 5.105802] mmc2: SDHCI controller on 3400000.sdhci [3400000.sdhci] using ADMA 64-bit with 64 bit addr
[ 5.119501] mmc0: mmc_decode_ext_csd: CMDQ supported: depth: 31, cmdq_support: 1
[ 5.133386] mmc0: periodic cache flush enabled
[ 5.133392] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[ 5.133733] mmcblk0: mmc0:0001 DG4016 14.7 GiB
[ 5.137875] mmcblk0boot0: mmc0:0001 DG4016 partition 1 4.00 MiB
[ 5.142015] mmcblk0boot1: mmc0:0001 DG4016 partition 2 4.00 MiB
[ 5.145088] mmc2: mmc_select_hs400es failed, error -524
[ 5.145091] mmc_attach_mmc: mmc_init_card fail
[ 5.145093] mmc2: error -524 whilst initialising MMC card
[ 5.145266] mmc1: CMD CRC or end bit error, int mask 0x20001
[ 5.145321] mmc1: error -84 whilst initialising SDIO card
[ 5.146298] mmcblk0rpmb: mmc0:0001 DG4016 partition 3 4.00 MiB
[ 5.149377] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24 p25 p26 p27 p28 p29 p30 p31 p32 p33 p34
[ 5.239632] mmc2: mmc_select_hs400es failed, error -524
[ 5.239636] mmc_attach_mmc: mmc_init_card fail
[ 5.239637] mmc2: error -524 whilst initialising MMC card
[ 5.240343] mmc1: error -110 whilst initialising SDIO card
[ 5.415142] mmc2: mmc_select_hs400es failed, error -524
[ 5.415145] mmc_attach_mmc: mmc_init_card fail
[ 5.415149] mmc2: error -524 whilst initialising MMC card
[ 5.420455] mmc1: error -110 whilst initialising SDIO card
[ 5.583238] mmc2: mmc_select_hs400es failed, error -524
[ 5.583241] mmc_attach_mmc: mmc_init_card fail
[ 5.583243] mmc2: error -524 whilst initialising MMC card
[ 5.584552] mmc1: error -110 whilst initialising SDIO card
[ 6.354711] mmcblk mmc0:0001: Card claimed for testing.
[ 6.493129] Root device found: mmcblk0p1
[ 6.497938] Found dev node: /dev/mmcblk0p1
[ 6.520684] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[ 6.529424] Rootfs mounted over mmcblk0p1
[ 7.055990] EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)

Can you please help me on this.

Add below property in dt.
uhs-mask = <0x60>; This will enumerate eMMC in DDR52 non-tuning mode.

uhs-mask = <0x60>[quote=“Bibek, post:13, topic:161110, full:true”]
Add below property in dt.
uhs-mask = <0x60>; This will enumerate eMMC in DDR52 non-tuning mode.
[/quote]

With this change emmc will work in hs400 mode ??

HS400 requires 8-bit bus which is not present on SDMMC1

Thanks Bibek for the help.