Linux-altera 4.12 failes MMC on CycloneV, while ltsi does not

I’m setting up a system on a CycloneV on Atlas-SoC, and I’m using Yocto Pyro. I’m using meta-altera from https://github.com/kraj/meta-altera to build the kernel. The preloader and u-boot is built using Quartus and EDS. I’m using meta-linaro and use Linaro GCC 6.3.

If I select KERNEL_PROVIDER=“linux-altera-ltsi” which is 4.1.33, everything boots fine. However if I select KERNEL_PROVIDER=“linux-altera” and version 4.12 or 4.11, I get failures in MMC, which ultimately fails the boot.

Any ideas to why?

[    1.625114] mmc_host mmc0: Bus speed (slot 0) = 200000000Hz (slot req 25000000Hz, actual 25000000HZ div = 4)
[    1.634925] mmc0: new SD card at address 9a6c
[    1.639825] mmcblk0: mmc0:9a6c SU02G 1.84 GiB 
[    1.651203]  mmcblk0: p1 p2 p3
[    1.788574] mmcblk0: error -110 transferring data, sector 136328, nr 264, cmd response 0x900, card status 0x0
[    1.828493] mmc_host mmc0: Bus speed (slot 0) = 200000000Hz (slot req 400000Hz, actual 400000HZ div = 250)
[    1.925149] mmc_host mmc0: Bus speed (slot 0) = 200000000Hz (slot req 25000000Hz, actual 25000000HZ div = 4)
[    2.138569] mmcblk0: error -110 transferring data, sector 136328, nr 264, cmd response 0x900, card status 0x0
[    2.148602] mmcblk0: retrying using single block read
[    2.268567] mmcblk0: error -110 transferring data, sector 136337, nr 255, cmd response 0x900, card status 0x0

I have finally found the solution, and the reason is that the DTAppend documentation is outdated.

If one looks at the DTAppend information in the latest DeviceTreeGenerator page, one finds the instructions for setting up MMC:

This setup is working for altera-linux-ltsi, but not for altera-linux. I downloaded the latest CycloneV GHRD release (from https://releases.rocketboards.org/release/2017.10/gsrd/hw/cv_soc_devkit_ghrd.tar.gz) and peeked into the CycloneV board info files, and it had a very different setup:

<DTAppend name="sdmmc_clk_divided" type="node" parentlabel="hps_0_clkmgr" newlabel="sdmmc_clk_divided"/>
<DTAppend name="#clock-cells" type="number" parentlabel="sdmmc_clk_divided" val="0"/>
<DTAppend name="compatible" type="string" parentlabel="sdmmc_clk_divided" val="altr,socfpga-gate-clk"/>
<DTAppend name="clocks" type="phandle" parentlabel="sdmmc_clk_divided" val="sdmmc_clk"/>
<DTAppend name="clk-gate" parentlabel="sdmmc_clk_divided">
	<val type="hex">0xa0</val>
	<val type="hex">8</val>
</DTAppend>
<DTAppend name="fixed-divider" type="number" parentlabel="sdmmc_clk_divided" val="4"/>
<DTAppend name="clocks" parentlabel="hps_0_sdmmc">
	<val type="phandle">l4_mp_clk</val>
	<val type="phandle">sdmmc_clk_divided</val>
</DTAppend>
<DTAppend name="clk-phase" parentlabel="sdmmc_clk">
	<val type="number">0</val> 
	<val type="number">135</val> 
</DTAppend>

<DTAppend name="#address-cells" type="number" parentlabel="hps_0_sdmmc" val="1"/>
<DTAppend name="#size-cells" type="number" parentlabel="hps_0_sdmmc" val="0"/>
<DTAppend name="broken-cd" type="bool" parentlabel="hps_0_sdmmc" val="true"/>
<DTAppend name="cap-mmc-highspeed" type="bool" parentlabel="hps_0_sdmmc" val="true"/>
<DTAppend name="cap-sd-highspeed" type="bool" parentlabel="hps_0_sdmmc" val="true"/>
<DTAppend name="bus-width" type="number" parentlabel="hps_0_sdmmc" val="4"/>
<DTAppend name="device-width" parentlabel="hps_0_sdmmc" action="remove"/>
<DTAppend name="bank-width" parentlabel="hps_0_sdmmc" action="remove"/>
<DTAppend name="compatible" type="string" parentlabel="hps_0_sdmmc" val="altr,socfpga-dw-mshc"/>
<DTAppend name="altr,dw-mshc-ciu-div" type="number" parentlabel="hps_0_sdmmc" val="3"/>
<DTAppend name="altr,dw-mshc-sdr-timing"  parentlabel="hps_0_sdmmc" >
	<val type="number">0</val>
	<val type="number">3</val>
</DTAppend>
<DTAppend name="supports-highspeed"  parentlabel="hps_0_sdmmc" />
<DTAppend name="slot@0" type="node" parentlabel="hps_0_sdmmc" newlabel="slot_0"/>
<DTAppend name="reg" type="number" parentlabel="slot_0" val="0"/>
<DTAppend name="bus-width" type="number" parentlabel="slot_0" val="4"/>

<DTAppend name="reg" type="number" parentlabel="slot_0" val="0"/>
<DTAppend name="bus-width" type="number" parentlabel="slot_0" val="4"/>
<DTAppend name="cd" parentlabel="hps_0_sdmmc" >
	<val type="phandle">hps_0_gpio1_porta</val>
	<val type="number">18</val>
	<val type="number">0</val>
</DTAppend>
<DTAppend name="cd-gpios" parentlabel="hps_0_sdmmc" >
	<val type="phandle">hps_0_gpio1_porta</val>
	<val type="number">18</val>
	<val type="number">0</val>
</DTAppend>

And with this mmc is working much faster and is working for both the latest kernel and the ltsi kernel.

Can I suggest that the DeviceTreeGenerator page should be updated, please?