Jetson Nano SD card enters back to high speed mode instead of uhs mode after soft reboot

Hi,

Opening a new issue as this is on different lines, brought here from: Slow SD card access speed (read+write) with Jetson Nano production module .
As discussed in the above topic, there was an issue with a slow access to SD card. The issue was solved by the patch mentioned there. However, a strange behaviour was noticed:
When I do a soft reboot (sudo reboot), and then check the ios using: cat /sys/kernel/debug/mmc1/ios, I get the following output:

clock:		50000000 Hz
vdd:		21 (3.3 ~ 3.4 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	2 (on)
bus width:	2 (4 bits)
timing spec:	2 (sd high-speed)
signal voltage:	0 (3.30 V)
driver type:	0 (driver type B)

But I have changed the dtb (as mentioned in the forum to which the link is provided above) already before flashing, so this should not be the case. Instead what I should get as an output is the following, which I also get with a hard reboot (power off+on).

clock:		204000000 Hz
vdd:		21 (3.3 ~ 3.4 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	2 (on)
bus width:	2 (4 bits)
timing spec:	6 (sd uhs SDR104)
signal voltage:	1 (1.80 V)
driver type:	0 (driver type B)

For the soft reboot case, I also observe that the SD card access speeds are actually slower 4 times (like 23 MBps vs 85 MBps on a hard reboot), when tested with the gnome-disks benchmarking utility.

Please note that this issue is not the same as mentioned here: how to modify the dts file for jetson nano board.

I always see my dtb changes, it is just that on soft reboot, the speed of SD card is slower (see the ios output above), and on hard reboot, the speed is as desired (again, the ios output above). I can always get to the desired behaviour with a hard reboot, but there are some cases where I have to do a soft reboot during operation while at customer’s end and many a times a hard reboot is not feasible. It is as though the SD card access speed mode detected by the kernel is different (only high speed mode instead of ultra high speed mode) for a soft reboot case. The SD card is of course the same in all cases. In the first link I provided, you can see the history of changes made to enable SD card, improve boot time with SD card in place, improve speed of access to SD card, etc.

An additional observation: Suppose with all the supporting patches applied, I do a soft reboot and find the SD card in a slower speed mode, and I remove and re-insert the SD card while the system is on, I notice that the SD card gets to ultra high speed again.

It seems like the SD Detect signal needs to transition for the SD card to be recognized as an ultra high speed device (or maybe something else I don’t know of).

Is there a work-around for this? Like can a reset the sd card device via the driver when a reboot is called? Or what would be the proper solution otherwise?

You are right. I guess that is different issue. Please try with this patch.

9875882.diff.zip (1.7 KB)

Hi WayneWWW,

I applied the patch but the issue still exists. Which logs will be helpful here?

Hi jetson_user,

Please help do below test

  1. Plug in the sdcard and do the cold boot.

  2. dump below clk rate.
    sudo cat /sys/kernel/debug/clk/sdmmc3/clk_rate

  3. Check dmesg

  4. Try to run soft reboot.

  5. dump clk rate again

  6. Check dmesg again.

If you see the clk error, please try to plug out/in the card and check the clk again to see if it restores to normal.

Thanks.

Hi WayneWWW,

Please find attached the logs.sd_card_high_speed_soft_reboot.zip.log (31.5 KB) .

I had to rename the .zip file to .zip.log because apparently only certain types of files can be uploaded. You can rename, after you download, to .zip and then extract.

And I did not observe any clk error for the soft reboot case in dmesg.

Hi jetson_user,

What is the clk result if you plug in/out the sdcard after you hit error?

Hi WayneWWW,

Please find attached the logs after warm boot + remove + reinsert sd card. I see no errors in dmesg -- follow. Only that I see many logs like this: Tuning done, restoring the best tap value : 62 after removal of sd card, and these do not appear once the sd card is re-inserted. logs_after_warm_reboot_and_remove_plus_reinsert_sd.zip.log (15.8 KB)

Could you also try to add nvidia,vmmc-always-on in your device tree (as other sd properties) and see if it can work?

Where exactly do I add this? Under the sdmmc3 controller?

Where exactly do I add this? Under the sdmmc3 controller?

Correct.

Hi WayneWWW,

Adding the nvidia,vmmc-always-on in the device tree helped, I now see SD card in ultra high speed mode even on soft reboot. Is the modification safe though for the device ? If yes, and after some tests of my own, I shall uploaded a patch here with consolidated changes. Thank you!

Yes, please use vmmc-always-on and the patch as the solution.

I am seeing the same issue under jetson-nano-2gb-jp441-sd-card-image

Where exactly do I add this? Under the sdmmc3 controller?

  1. Will updating the dtd without patching the kernel work?
  2. What is the exact name of the “sdmmc3 controller” section?

Thanks!

Hi,

I am not sure why you can see similar case with sdcard image. The original post was to discuss the extra sdcard slot on custom carrier board. And custom board does not use sdcard image.

This was on production module but not sdcard based module. Thus, this is different case from you.

If you don’t understand what I am talking about, please tell. I can give more detail.

Your issue is not related to original post. File your own topic please.

@WayneWWW,

Will do.