diff mbox series

[U-Boot,v3.1,9/9] arm: dts: sunxi: Alter mmc2 auto-numbering to mmc1

Message ID 20190125081638.12727-1-jagan@amarulasolutions.com
State Accepted
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series [U-Boot,v3.1,1/9] sunxi: clk: add MMC gates/resets | expand

Commit Message

Jagan Teki Jan. 25, 2019, 8:16 a.m. UTC
Environment and fastboot mmc devices are configured based on the number
of mmc slots defined on particular board configs, MMC_SUNXI_SLOT_EXTRA.

If MMC_SUNXI_SLOT_EXTRA is more than 1, the default env and fastboot
mmc devices is mmc1 by assuming mmc0 is SD and mmc1 is emmc device.

But with DM_MMC the mmc devices are numbered as per the dts node
enablement. If there is a chance of having enabling all mmc nodes
in dts say mmc0, mmc1, mmc2 then the default env and fastboot devices
will failed to assign proper emmc device since mmc2 is emmc in most
of the Allwinner platforms.

So, we need to alter the auto-numbering by aliasing mmc2 to mmc1 since
aliases take precedence over auto-numbering.

If the dts enables mmc0, mmc1, mmc2, then all the nodes will probe
sequentially and auto-numbered as it is. but when aliases mmc1 with mmc2
the resulting number should be that mmc0 is till mmc0, mmc2 become mmc1
and mmc2 become mmc1

Without aliases of mmc1 = &mmc2;

Comments

Jagan Teki Jan. 29, 2019, 6:20 p.m. UTC | #1
On Fri, Jan 25, 2019 at 1:46 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Environment and fastboot mmc devices are configured based on the number
> of mmc slots defined on particular board configs, MMC_SUNXI_SLOT_EXTRA.
>
> If MMC_SUNXI_SLOT_EXTRA is more than 1, the default env and fastboot
> mmc devices is mmc1 by assuming mmc0 is SD and mmc1 is emmc device.
>
> But with DM_MMC the mmc devices are numbered as per the dts node
> enablement. If there is a chance of having enabling all mmc nodes
> in dts say mmc0, mmc1, mmc2 then the default env and fastboot devices
> will failed to assign proper emmc device since mmc2 is emmc in most
> of the Allwinner platforms.
>
> So, we need to alter the auto-numbering by aliasing mmc2 to mmc1 since
> aliases take precedence over auto-numbering.
>
> If the dts enables mmc0, mmc1, mmc2, then all the nodes will probe
> sequentially and auto-numbered as it is. but when aliases mmc1 with mmc2
> the resulting number should be that mmc0 is till mmc0, mmc2 become mmc1
> and mmc2 become mmc1
>
> Without aliases of mmc1 = &mmc2;
> ================================
> MMC:   mmc@1c0f000: 0, mmc@1c10000: 1, mmc@1c11000: 2
>
> With aliases of mmc1 = &mmc2;
> ================================
> MMC:   Device 'mmc@1c11000': seq 1 is in use by 'mmc@1c10000'
> mmc@1c0f000: 0, mmc@1c10000: 2, mmc@1c11000: 1
> Loading Environment from FAT... OK
>
> Some platforms like A20 has mmc0...mmc3, but there is no usecases now
> for enabling all mmc controllers in any of A20 board dts files.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---

Applied to u-boot-sunxi/master
diff mbox series

Patch

================================
MMC:   mmc@1c0f000: 0, mmc@1c10000: 1, mmc@1c11000: 2

With aliases of mmc1 = &mmc2;
================================
MMC:   Device 'mmc@1c11000': seq 1 is in use by 'mmc@1c10000'
mmc@1c0f000: 0, mmc@1c10000: 2, mmc@1c11000: 1
Loading Environment from FAT... OK

Some platforms like A20 has mmc0...mmc3, but there is no usecases now
for enabling all mmc controllers in any of A20 board dts files.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v3.1:
- add proper commit message details along with example of how aliases
  alter the mmc numbering.

 arch/arm/dts/sunxi-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
index 8a9f2a6417..fdd4c80aa4 100644
--- a/arch/arm/dts/sunxi-u-boot.dtsi
+++ b/arch/arm/dts/sunxi-u-boot.dtsi
@@ -1,6 +1,10 @@ 
 #include <config.h>
 
 / {
+	aliases {
+		mmc1 = &mmc2;
+	};
+
 	binman {
 		filename = "u-boot-sunxi-with-spl.bin";
 		pad-byte = <0xff>;