mdziekon / armbian-build

Armbian Linux Build Framework
https://www.armbian.com
GNU General Public License v2.0
0 stars 0 forks source link

H616: enable sd card reader UHS-I support #1

Open mdziekon opened 1 year ago

mdziekon commented 1 year ago

Note for myself


Legacy kernel (4.9) supports SD reader with UHS enabled for better SD card IO performance: https://github.com/orangepi-xunlong/linux-orangepi/blob/orange-pi-4.9-sun50iw9/arch/arm64/boot/dts/sunxi/sun50i-h616-orangepi-zero2.dts#L3346-L3348 (as used by Armbian here: https://github.com/armbian/build/blob/59363d5a0f1a833bb54efbde0831a2e3f6626c8a/config/sources/families/sun50iw9.conf#L21-L23) (verified with cat /sys/kernel/debug/mmc0/ios and some basic performance testing)

However, newer kernels do not have this caps enabled.

Trying to enable them on Armbian edge (currently, kernel 6.2.x) via adding the following DTS attributes:

 &mmc0 {
        vmmc-supply = <&reg_dcdce>;
+       vqmmc-supply = <&reg_bldo1>;
        cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;  /* PF6 */
        bus-width = <4>;
        status = "okay";
+       sd-uhs-sdr50;
+       sd-uhs-ddr50;
+       sd-uhs-sdr104;
+       mmc-ddr-1_8v;
 };

results in the board being unable to boot due to -110 ERROR while trying to find the file system.

Looking deeper into the driver's code, the driver reaches at best this place in code: https://github.com/torvalds/linux/blob/v6.2/drivers/mmc/core/core.c#L1248-L1253

So, with my limited knowledge, it looks like the device was unable to switch to 1.8V mode.

AGM1968 commented 1 year ago

Hi Michal, if you've not already seen, these are added to h616.dtsi

-           max-frequency = <150000000>;
            cap-sd-highspeed;
            cap-mmc-highspeed;
            mmc-ddr-3_3v;
+           mmc-ddr-1_8v;
            cap-sdio-irq;
            #address-cells = <1>;
            #size-cells = <0>;
mdziekon commented 1 year ago

@AGM1968 hi, no, unfortunatelly I haven't seen this change you're mentioning. I can't see it neither in current main of armbian, nor in current master of Linux itself. Could you please point me to the place you've found such thing?

AGM1968 commented 1 year ago

Hi Michal, if you go to >>

/build/cache/sources/linux-kernel-worktree/6.2_sunxi64_arm64/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi

you'll find where to add mmc-ddr-1_8v

I've really not looked at all on this but just thought that might be the problem from memory of dtsi.

Hope it helps

Mainline as follows >>

https://github.com/AGM1968/linux/blob/929ed21dfdb6ee94391db51c9eedb63314ef6847/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi#L277-L281

mdziekon commented 1 year ago

@AGM1968 ok, I think I understand what you meant.

However, isn't that the same as adding it to &mmc0, in cache/sources/linux-kernel-worktree/6.2__sunxi64__arm64/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts (because that's where I put the patch from the original comment, it's just a simplified version)? As far as I understand, in sun50i-h616-orangepi-zero2.dts we're essentially creating overwrites for specific dts entries in the base definitions (in this case that would be sun50i-h616.dtsi). So in general, I think it shouldn't matter whether I'll make the change in sun50i-h616.dtsi or in sun50i-h616-orangepi-zero2.dts, right?

AGM1968 commented 1 year ago

There may be issues during the compile process with the includes. I've only seen the reference added to the dtsi.

mdziekon commented 1 year ago

Ok, understood, thanks for explaining that. In that case, I'll definitely try the other way once I have some spare time.

AGM1968 commented 1 year ago

Yeah Im only guessing really, but that's the most likely explanation.

Try earlycon when you boot, not sure how you debugging.

Best, Alistair