Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit Nintendo Switch's external SD SDHCI bus clock speed. #5

Open
wants to merge 1 commit into
base: switch
Choose a base branch
from

Conversation

perillamint
Copy link

This will fix Nintendo Switch does not load rootfs with some
"incompatible" SD cards, which supports UHS SDR104 speed.

So, this patch will solve this problem by limiting bus speed
to Switch's hardware can handle.

@perillamint
Copy link
Author

Thanks to KTemkin for information about limiting SDHCI bus via max-frequency DTB entry

@SwtcR
Copy link
Contributor

SwtcR commented Apr 29, 2018

Do you have more info? e8a92bf attempted to enable UHS SDR104 mode for tegra210 (adjacent commits added the needed pad control stuff for 1.8V mode). It seems to work for some cards and not others - it definitely switches to 1.8V mode. Are you sure the right solution here is to just disable SDR104 mode? Where does this limitation come from?

@SwtcR
Copy link
Contributor

SwtcR commented Apr 29, 2018

Here's an example of a dmesg with an SDR104 mode card that works properly:

[    2.229548] mmc0: new ultra high speed SDR104 SDHC card at address aaaa
[    2.237462] mmcblk0: mmc0:aaaa SC16G 14.8 GiB 
[    2.248173]  mmcblk0: p1 p2

But I have another card where it just hangs and dumps registers. Are we sure the hardware isn't rated for SDR104? It seems to me that it's more likely there's a bug somewhere else...

@perillamint
Copy link
Author

perillamint commented Apr 29, 2018

@SwtcR I tried other values on max-frequency. When I clocked them to 200MHz, it worked fine with Samsung EVO + 64GB card.

However, when I put 208MHz on them, it could not catch interrupt. I think Switch or card has a bare clock speed margin for SDR104 and it caused the problem on some cards.

@perillamint
Copy link
Author

perillamint commented Apr 29, 2018

My card connects well to my laptop's SD slot with SDR104 speed without any flaw (XPS 9550, RTS525A PCI Express Card Reader) but has trouble on Switch

@SwtcR
Copy link
Contributor

SwtcR commented Apr 29, 2018

OK, so the problem is 208MHz mode? Keep in mind that max-frequency is, well, the max. We need to find out what clocks actually get used and which ones work, and ideally, why.

@perillamint
Copy link
Author

perillamint commented Apr 29, 2018

Yup, we should need to find out what Horizon OS uses. However, I can't do it because I don't have an oscilloscope with enough sample rate. I only have a cheap maid-in-china portable scope(DSO Quad) which could not speed up to 208MHz. :'(

@hxhieu
Copy link

hxhieu commented Apr 30, 2018

Just FYI, this patch does NOT work on my Samsung EVO+ 128GB but this one works perillamint@ec2c0a0
Thanks.

@webfrogs
Copy link

@hxhieu This patch works for my 32G Samsung EVO+ SD card, but I have not tried it on my Samsung EVO+ 64GB. Yours patch works on my 64G SD card.

@hxhieu
Copy link

hxhieu commented Apr 30, 2018

Damn Samsung makes this so hard. I only have a 128GB and only the dirty hack works.
FYI, I even tried this patch with as low as 100MHz to match with the dirty hack - still doesnt work :(

@T3CHNOLOG1C
Copy link

This patch made my 32GB UHS-1 Samsung EVO card work, which didn't work with the stock kernel.

@T3CHNOLOG1C
Copy link

Update: wifi doesn't seem to work with this kernel even after a reboot, did an ls on /dev and I don't see wlan0 or wlp2s0.

@teslamint
Copy link

This patch not works on my SanDisk Ultra 32G SD card. Without the patch, it works.

This will fix Nintendo Switch does not load rootfs with some
"incompatible" SD cards, which supports UHS SDR104 speed.

So, this patch will solve this problem by limiting bus speed
to Switch's hardware can handle.

By experimentally obtained experience, 150MHz works fine with
64GB Samsung EVO+ microSD cards
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants