Hello Samuel Beaussier,
My apologies for the delay.
The tuning issue seems to be related to the usdh clock, which may explain the random nature of the symptoms. (Since the eMMC HW appears to work flawlessly).
I was checking both .dtsi files and did noticed that the usdhc2 (both usdhc definitions, for that matter) do present changes that may explain this scenario.
usdhc2: usdhc@02194000 {
compatible = "fsl,imx6ull-usdhc", "fsl,imx6sx-usdhc";
reg = <0x02194000 0x4000>;
interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6UL_CLK_USDHC2>,
<&clks IMX6UL_CLK_USDHC2>,
<&clks IMX6UL_CLK_USDHC2>;
clock-names = "ipg", "ahb", "per";
assigned-clocks = <&clks IMX6UL_CLK_USDHC2_SEL>, <&clks IMX6UL_CLK_USDHC2>;
assigned-clock-parents = <&clks IMX6UL_CLK_PLL2_PFD2>;
assigned-clock-rates = <0>, <132000000>;
bus-width = <4>;
fsl,tuning-step= <2>;
status = "disabled";
};
The fsl,tuning-step is an optional feature that specify the increasing delay cell steps in tuning procedure. The default value for the uSDHC controller is one, but this feature is useful for some special boards or cards when the default tuning step can't find the proper delay window within limited tuning retries. Since the tuning is not executing properly, this line may be the culprit.
Another possible explanation would be a conflict between the clocks, but I would expect then more consistent failures.
Please try disabling the tuning-step line first and let us know if it works, if this was not the cause then it is most likely the assigned clock rates so you may leave those lines out as well. If the former is the case you would need to follow the whole Device Tree so see if there’s a conflict or an override to the required clock configuration in order to determine the root of the problem.
I hope this information helps!
Regards,