diff mbox series

[v3] arm64: dts: renesas: Add mmc aliases into board dts files

Message ID 1614255382-6377-1-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series [v3] arm64: dts: renesas: Add mmc aliases into board dts files | expand

Commit Message

Yoshihiro Shimoda Feb. 25, 2021, 12:16 p.m. UTC
After the commit 7320915c8861 ("mmc: Set PROBE_PREFER_ASYNCHRONOUS
for drivers that existed in v4.14"), the order of /dev/mmcblkN
was not fixed in some SoCs which have multiple sdhi controllers.
So, we were hard to use an sdhi device as rootfs by using
the kernel parameter like "root=/dev/mmcblkNpM".

According to the discussion on a mainling list [1], we can add
mmc aliases to fix the issue. So, add such aliases into Renesas
arm64 board dts files.

[1]
https://lore.kernel.org/linux-arm-kernel/CAPDyKFptyEQNJu8cqzMt2WRFZcwEdjDiytMBp96nkoZyprTgmA@mail.gmail.com/

Fixes: 7320915c8861 ("mmc: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.14")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 Changes from v2:
 - Set the aliases into board dts files for consistency with R-Car Gen2.
 - Change the subject.
 - Add Fixes tag.
 https://patchwork.kernel.org/project/linux-renesas-soc/patch/1612752464-27838-1-git-send-email-yoshihiro.shimoda.uh@renesas.com/

 Changes from v1:
 - Revise the commit description.
 - Remove some alias which SoC has one sdhi controller only.
https://patchwork.kernel.org/project/linux-renesas-soc/patch/1604654877-30010-1-git-send-email-yoshihiro.shimoda.uh@renesas.com/

 arch/arm64/boot/dts/renesas/hihope-common.dtsi            | 3 +++
 arch/arm64/boot/dts/renesas/r8a774a1-beacon-rzg2m-kit.dts | 3 +++
 arch/arm64/boot/dts/renesas/r8a774b1-beacon-rzg2n-kit.dts | 3 +++
 arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts           | 2 ++
 arch/arm64/boot/dts/renesas/r8a774e1-beacon-rzg2h-kit.dts | 3 +++
 arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts            | 3 +++
 arch/arm64/boot/dts/renesas/salvator-common.dtsi          | 3 +++
 arch/arm64/boot/dts/renesas/ulcb-kf.dtsi                  | 1 +
 arch/arm64/boot/dts/renesas/ulcb.dtsi                     | 2 ++
 9 files changed, 23 insertions(+)

Comments

Geert Uytterhoeven Feb. 25, 2021, 12:46 p.m. UTC | #1
Hi Shimoda-san,

Cc Ulf

On Thu, Feb 25, 2021 at 1:16 PM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> After the commit 7320915c8861 ("mmc: Set PROBE_PREFER_ASYNCHRONOUS
> for drivers that existed in v4.14"), the order of /dev/mmcblkN
> was not fixed in some SoCs which have multiple sdhi controllers.
> So, we were hard to use an sdhi device as rootfs by using
> the kernel parameter like "root=/dev/mmcblkNpM".
>
> According to the discussion on a mainling list [1], we can add
> mmc aliases to fix the issue. So, add such aliases into Renesas
> arm64 board dts files.
>
> [1]
> https://lore.kernel.org/linux-arm-kernel/CAPDyKFptyEQNJu8cqzMt2WRFZcwEdjDiytMBp96nkoZyprTgmA@mail.gmail.com/
>
> Fixes: 7320915c8861 ("mmc: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.14")
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  Changes from v2:
>  - Set the aliases into board dts files for consistency with R-Car Gen2.
>  - Change the subject.
>  - Add Fixes tag.

Thanks for the update!

LGTM, so
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> @@ -36,6 +36,9 @@
>                 serial0 = &scif2;
>                 serial1 = &hscif1;
>                 ethernet0 = &avb;
> +               mmc0 = &sdhi0;
> +               mmc1 = &sdhi2;
> +               mmc2 = &sdhi3;
>         };

Looks like on Salvator-X(S) the two SD card slots are labeled
SD0 and SD3, so the last one should be mmc3?

What's most important? Getting the naming right, or matching the
traditional naming?

https://martinfowler.com/bliki/TwoHardThings.html

Gr{oetje,eeting}s,

                        Geert
Yoshihiro Shimoda Feb. 26, 2021, 1:01 a.m. UTC | #2
Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Thursday, February 25, 2021 9:47 PM
> On Thu, Feb 25, 2021 at 1:16 PM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com> wrote:
<snip>
> > ---
> >  Changes from v2:
> >  - Set the aliases into board dts files for consistency with R-Car Gen2.
> >  - Change the subject.
> >  - Add Fixes tag.
> 
> Thanks for the update!
> 
> LGTM, so
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thank you for your review!

> > --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > @@ -36,6 +36,9 @@
> >                 serial0 = &scif2;
> >                 serial1 = &hscif1;
> >                 ethernet0 = &avb;
> > +               mmc0 = &sdhi0;
> > +               mmc1 = &sdhi2;
> > +               mmc2 = &sdhi3;
> >         };
> 
> Looks like on Salvator-X(S) the two SD card slots are labeled
> SD0 and SD3, so the last one should be mmc3?
> 
> What's most important? Getting the naming right, or matching the
> traditional naming?

Most important is stable these mmcblkN naming for using it on
the "root=" parameter :)

I don't have a strong opinion though, IMO, matching the traditional naming
is better than board labeled because:
- we don't need to add any alias into a board dts if the board is using one
  sdhi/eMMC only like r8a77995-draak.dts.
- also, the traditional naming is familiar to us.

Best regards,
Yoshihiro Shimoda
Yoshihiro Shimoda March 1, 2021, 3:13 a.m. UTC | #3
Hi Geert-san,

> From: Yoshihiro Shimoda, Sent: Friday, February 26, 2021 10:02 AM
> > From: Geert Uytterhoeven, Sent: Thursday, February 25, 2021 9:47 PM
> > On Thu, Feb 25, 2021 at 1:16 PM Yoshihiro Shimoda
> > <yoshihiro.shimoda.uh@renesas.com> wrote:
> > > --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > @@ -36,6 +36,9 @@
> > >                 serial0 = &scif2;
> > >                 serial1 = &hscif1;
> > >                 ethernet0 = &avb;
> > > +               mmc0 = &sdhi0;
> > > +               mmc1 = &sdhi2;
> > > +               mmc2 = &sdhi3;
> > >         };
> >
> > Looks like on Salvator-X(S) the two SD card slots are labeled
> > SD0 and SD3, so the last one should be mmc3?
> >
> > What's most important? Getting the naming right, or matching the
> > traditional naming?
> 
> Most important is stable these mmcblkN naming for using it on
> the "root=" parameter :)
> 
> I don't have a strong opinion though, IMO, matching the traditional naming
> is better than board labeled because:
> - we don't need to add any alias into a board dts if the board is using one
>   sdhi/eMMC only like r8a77995-draak.dts.
> - also, the traditional naming is familiar to us.

I'm afraid about changing my mind. But, may I use eMMC channel as mmc0?
This mean that I'd like to change the aliases as below.

+               mmc0 = &sdhi2;
+               mmc1 = &sdhi0;
+               mmc2 = &sdhi3;

This is because it's easy to imagine mmcblk0 as eMMC
and super old kernels (v5.4 or or earlier) were probed as mmcblk0
so that we can use "root=/dev/mmcblk0pN" on the kernel parameter.

Best regards,
Yoshihiro Shimoda
Geert Uytterhoeven March 1, 2021, 8:50 a.m. UTC | #4
Hi Shimoda-san,

On Mon, Mar 1, 2021 at 4:13 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> > From: Yoshihiro Shimoda, Sent: Friday, February 26, 2021 10:02 AM
> > > From: Geert Uytterhoeven, Sent: Thursday, February 25, 2021 9:47 PM
> > > On Thu, Feb 25, 2021 at 1:16 PM Yoshihiro Shimoda
> > > <yoshihiro.shimoda.uh@renesas.com> wrote:
> > > > --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > > +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > > @@ -36,6 +36,9 @@
> > > >                 serial0 = &scif2;
> > > >                 serial1 = &hscif1;
> > > >                 ethernet0 = &avb;
> > > > +               mmc0 = &sdhi0;
> > > > +               mmc1 = &sdhi2;
> > > > +               mmc2 = &sdhi3;
> > > >         };
> > >
> > > Looks like on Salvator-X(S) the two SD card slots are labeled
> > > SD0 and SD3, so the last one should be mmc3?
> > >
> > > What's most important? Getting the naming right, or matching the
> > > traditional naming?
> >
> > Most important is stable these mmcblkN naming for using it on
> > the "root=" parameter :)
> >
> > I don't have a strong opinion though, IMO, matching the traditional naming
> > is better than board labeled because:
> > - we don't need to add any alias into a board dts if the board is using one
> >   sdhi/eMMC only like r8a77995-draak.dts.
> > - also, the traditional naming is familiar to us.
>
> I'm afraid about changing my mind. But, may I use eMMC channel as mmc0?

“A wise man changes his mind sometimes, but a fool never."

> This mean that I'd like to change the aliases as below.
>
> +               mmc0 = &sdhi2;
> +               mmc1 = &sdhi0;
> +               mmc2 = &sdhi3;
>
> This is because it's easy to imagine mmcblk0 as eMMC
> and super old kernels (v5.4 or or earlier) were probed as mmcblk0
> so that we can use "root=/dev/mmcblk0pN" on the kernel parameter.

Makes sense.  I had a look at my R-Car H3 ES1.0/Salvator-X boot logs,
which shows the following history:

  - v4.7..v4.9-rc8: mmc0 = SD0 mmc1 = SD3
  - v4.8-rc7..v5.4-rc1: mmc0 = eMMC mmc1 = SD0 mmc2 = SD3
  - v5.4-rc3..v5.11-rc7: mmc0 = SD0 mmc1 = eMMC mmc2 = SD3
  - v5.9-rc7..v5.11: mmc0 = SD0 mmc1 = SD3 mmc2 = eMMC

Note that (1) this includes both mainline and development kernels based
on renesas-drivers, and (2) naming could be unstable, hence the
overlapping ranges.

So I'll be waiting for your v4...

Gr{oetje,eeting}s,

                        Geert
Yoshihiro Shimoda March 1, 2021, 10:59 a.m. UTC | #5
Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Monday, March 1, 2021 5:51 PM
> On Mon, Mar 1, 2021 at 4:13 AM Yoshihiro Shimoda
> > > From: Yoshihiro Shimoda, Sent: Friday, February 26, 2021 10:02 AM
> > > > From: Geert Uytterhoeven, Sent: Thursday, February 25, 2021 9:47 PM
> > > > On Thu, Feb 25, 2021 at 1:16 PM Yoshihiro Shimoda
> > > > > --- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > > > +++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
> > > > > @@ -36,6 +36,9 @@
> > > > >                 serial0 = &scif2;
> > > > >                 serial1 = &hscif1;
> > > > >                 ethernet0 = &avb;
> > > > > +               mmc0 = &sdhi0;
> > > > > +               mmc1 = &sdhi2;
> > > > > +               mmc2 = &sdhi3;
> > > > >         };
> > > >
> > > > Looks like on Salvator-X(S) the two SD card slots are labeled
> > > > SD0 and SD3, so the last one should be mmc3?
> > > >
> > > > What's most important? Getting the naming right, or matching the
> > > > traditional naming?
> > >
> > > Most important is stable these mmcblkN naming for using it on
> > > the "root=" parameter :)
> > >
> > > I don't have a strong opinion though, IMO, matching the traditional naming
> > > is better than board labeled because:
> > > - we don't need to add any alias into a board dts if the board is using one
> > >   sdhi/eMMC only like r8a77995-draak.dts.
> > > - also, the traditional naming is familiar to us.
> >
> > I'm afraid about changing my mind. But, may I use eMMC channel as mmc0?
> 
> “A wise man changes his mind sometimes, but a fool never."

Interesting.

> > This mean that I'd like to change the aliases as below.
> >
> > +               mmc0 = &sdhi2;
> > +               mmc1 = &sdhi0;
> > +               mmc2 = &sdhi3;
> >
> > This is because it's easy to imagine mmcblk0 as eMMC
> > and super old kernels (v5.4 or or earlier) were probed as mmcblk0
> > so that we can use "root=/dev/mmcblk0pN" on the kernel parameter.
> 
> Makes sense.  I had a look at my R-Car H3 ES1.0/Salvator-X boot logs,
> which shows the following history:
> 
>   - v4.7..v4.9-rc8: mmc0 = SD0 mmc1 = SD3
>   - v4.8-rc7..v5.4-rc1: mmc0 = eMMC mmc1 = SD0 mmc2 = SD3
>   - v5.4-rc3..v5.11-rc7: mmc0 = SD0 mmc1 = eMMC mmc2 = SD3
>   - v5.9-rc7..v5.11: mmc0 = SD0 mmc1 = SD3 mmc2 = eMMC

Thank you for sharing the information. These are helpful!

> Note that (1) this includes both mainline and development kernels based
> on renesas-drivers, and (2) naming could be unstable, hence the
> overlapping ranges.
> 
> So I'll be waiting for your v4...

Thank you for your comments! So, I'll submit v4 patch soon.

Best regards,
Yoshihiro Shimoda
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/renesas/hihope-common.dtsi b/arch/arm64/boot/dts/renesas/hihope-common.dtsi
index 7a3da9b..6e81eee 100644
--- a/arch/arm64/boot/dts/renesas/hihope-common.dtsi
+++ b/arch/arm64/boot/dts/renesas/hihope-common.dtsi
@@ -12,6 +12,9 @@ 
 	aliases {
 		serial0 = &scif2;
 		serial1 = &hscif0;
+		mmc0 = &sdhi0;
+		mmc1 = &sdhi2;
+		mmc2 = &sdhi3;
 	};
 
 	chosen {
diff --git a/arch/arm64/boot/dts/renesas/r8a774a1-beacon-rzg2m-kit.dts b/arch/arm64/boot/dts/renesas/r8a774a1-beacon-rzg2m-kit.dts
index 501cb05..d913097 100644
--- a/arch/arm64/boot/dts/renesas/r8a774a1-beacon-rzg2m-kit.dts
+++ b/arch/arm64/boot/dts/renesas/r8a774a1-beacon-rzg2m-kit.dts
@@ -21,6 +21,9 @@ 
 		serial4 = &hscif2;
 		serial5 = &scif5;
 		ethernet0 = &avb;
+		mmc0 = &sdhi0;
+		mmc1 = &sdhi2;
+		mmc2 = &sdhi3;
 	};
 
 	chosen {
diff --git a/arch/arm64/boot/dts/renesas/r8a774b1-beacon-rzg2n-kit.dts b/arch/arm64/boot/dts/renesas/r8a774b1-beacon-rzg2n-kit.dts
index 71763f4..60d66fe 100644
--- a/arch/arm64/boot/dts/renesas/r8a774b1-beacon-rzg2n-kit.dts
+++ b/arch/arm64/boot/dts/renesas/r8a774b1-beacon-rzg2n-kit.dts
@@ -22,6 +22,9 @@ 
 		serial5 = &scif5;
 		serial6 = &scif4;
 		ethernet0 = &avb;
+		mmc0 = &sdhi0;
+		mmc1 = &sdhi2;
+		mmc2 = &sdhi3;
 	};
 
 	chosen {
diff --git a/arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts b/arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts
index ea87cb5..33257c6 100644
--- a/arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts
+++ b/arch/arm64/boot/dts/renesas/r8a774c0-cat874.dts
@@ -17,6 +17,8 @@ 
 	aliases {
 		serial0 = &scif2;
 		serial1 = &hscif2;
+		mmc0 = &sdhi0;
+		mmc1 = &sdhi3;
 	};
 
 	chosen {
diff --git a/arch/arm64/boot/dts/renesas/r8a774e1-beacon-rzg2h-kit.dts b/arch/arm64/boot/dts/renesas/r8a774e1-beacon-rzg2h-kit.dts
index 273f062..1af38bf 100644
--- a/arch/arm64/boot/dts/renesas/r8a774e1-beacon-rzg2h-kit.dts
+++ b/arch/arm64/boot/dts/renesas/r8a774e1-beacon-rzg2h-kit.dts
@@ -22,6 +22,9 @@ 
 		serial5 = &scif5;
 		serial6 = &scif4;
 		ethernet0 = &avb;
+		mmc0 = &sdhi0;
+		mmc1 = &sdhi2;
+		mmc2 = &sdhi3;
 	};
 
 	chosen {
diff --git a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
index f74f8b9..e557b9e 100644
--- a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
@@ -16,6 +16,9 @@ 
 	aliases {
 		serial0 = &scif2;
 		ethernet0 = &avb;
+		mmc0 = &sdhi0;
+		mmc1 = &sdhi1;
+		mmc2 = &sdhi3;
 	};
 
 	chosen {
diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
index c22bb38..1ac6bc9 100644
--- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
+++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
@@ -36,6 +36,9 @@ 
 		serial0 = &scif2;
 		serial1 = &hscif1;
 		ethernet0 = &avb;
+		mmc0 = &sdhi0;
+		mmc1 = &sdhi2;
+		mmc2 = &sdhi3;
 	};
 
 	chosen {
diff --git a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
index e9ed259..61bd4df 100644
--- a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
+++ b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
@@ -16,6 +16,7 @@ 
 	aliases {
 		serial1 = &hscif0;
 		serial2 = &scif1;
+		mmc2 = &sdhi3;
 	};
 
 	clksndsel: clksndsel {
diff --git a/arch/arm64/boot/dts/renesas/ulcb.dtsi b/arch/arm64/boot/dts/renesas/ulcb.dtsi
index a04eae5..cb0661a 100644
--- a/arch/arm64/boot/dts/renesas/ulcb.dtsi
+++ b/arch/arm64/boot/dts/renesas/ulcb.dtsi
@@ -23,6 +23,8 @@ 
 	aliases {
 		serial0 = &scif2;
 		ethernet0 = &avb;
+		mmc0 = &sdhi0;
+		mmc1 = &sdhi2;
 	};
 
 	chosen {