diff mbox series

[v2,3/3] arm64: dts: a3720: add support for espressobin with populated emmc

Message ID 20200904153354.1120958-3-a.heider@gmail.com
State Accepted
Commit f1a43c84a960265309fa8365759de271a70c5a7e
Delegated to: Stefan Roese
Headers show
Series [v2,1/3] arm64: dts: armada-3720-espressobin: use Linux model/compatible strings | expand

Commit Message

Andre Heider Sept. 4, 2020, 3:33 p.m. UTC
Import armada-3720-espressobin-emmc.dts from Linux, but use sdhc1 for
emmc, since our dtsi is still based on downstream and sdhc0 is used for
the sd card.

Signed-off-by: Andre Heider <a.heider@gmail.com>
---
 arch/arm/dts/Makefile                         |  1 +
 arch/arm/dts/armada-3720-espressobin-emmc.dts | 44 +++++++++++++++++++
 doc/README.marvell                            |  7 ++-
 3 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/armada-3720-espressobin-emmc.dts

Comments

Andre Heider Sept. 9, 2020, 9:16 a.m. UTC | #1
On 04/09/2020 17:33, Andre Heider wrote:
> Import armada-3720-espressobin-emmc.dts from Linux, but use sdhc1 for
> emmc, since our dtsi is still based on downstream and sdhc0 is used for
> the sd card.
> 
> Signed-off-by: Andre Heider <a.heider@gmail.com>

We've found a tester with an eMMC board, and unfortunately this patch is 
not sufficient. eMMC shows up, but accessing it errors out with "MMC: no 
card present".

Stefan, please ignore 3/3 for now.
If you agree, 1/3 and 2/3 are still worth having, they prepare for 
syncing dts files with Linux.

Regards,
Andre
Andre Heider Sept. 10, 2020, 6:04 p.m. UTC | #2
On 09/09/2020 11:16, Andre Heider wrote:
> On 04/09/2020 17:33, Andre Heider wrote:
>> Import armada-3720-espressobin-emmc.dts from Linux, but use sdhc1 for
>> emmc, since our dtsi is still based on downstream and sdhc0 is used for
>> the sd card.
>>
>> Signed-off-by: Andre Heider <a.heider@gmail.com>
> 
> We've found a tester with an eMMC board, and unfortunately this patch is 
> not sufficient. eMMC shows up, but accessing it errors out with "MMC: no 
> card present".
> 
> Stefan, please ignore 3/3 for now.
> If you agree, 1/3 and 2/3 are still worth having, they prepare for 
> syncing dts files with Linux.

Thanks to Gérald we managed to fix it. 3/3 is good to go, the missing 
piece was just respecting "non-removable", see [0].

That patch combined with this set makes it work, so please go ahead and 
review :)

Thanks,
Andre

[0] 
https://patchwork.ozlabs.org/project/uboot/patch/20200910175340.515227-1-a.heider@gmail.com/
Stefan Roese Oct. 14, 2020, 8:17 a.m. UTC | #3
On 04.09.20 17:33, Andre Heider wrote:
> Import armada-3720-espressobin-emmc.dts from Linux, but use sdhc1 for
> emmc, since our dtsi is still based on downstream and sdhc0 is used for
> the sd card.
> 
> Signed-off-by: Andre Heider <a.heider@gmail.com>

Applied to u-boot-marvell/master

Thanks,
Stefan

> ---
>   arch/arm/dts/Makefile                         |  1 +
>   arch/arm/dts/armada-3720-espressobin-emmc.dts | 44 +++++++++++++++++++
>   doc/README.marvell                            |  7 ++-
>   3 files changed, 50 insertions(+), 2 deletions(-)
>   create mode 100644 arch/arm/dts/armada-3720-espressobin-emmc.dts
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 5e34192be6..8f1958b5a7 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -202,6 +202,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
>   dtb-$(CONFIG_ARCH_MVEBU) +=			\
>   	armada-3720-db.dtb			\
>   	armada-3720-espressobin.dtb		\
> +	armada-3720-espressobin-emmc.dtb	\
>   	armada-3720-turris-mox.dtb		\
>   	armada-3720-uDPU.dtb			\
>   	armada-375-db.dtb			\
> diff --git a/arch/arm/dts/armada-3720-espressobin-emmc.dts b/arch/arm/dts/armada-3720-espressobin-emmc.dts
> new file mode 100644
> index 0000000000..29ccb6a573
> --- /dev/null
> +++ b/arch/arm/dts/armada-3720-espressobin-emmc.dts
> @@ -0,0 +1,44 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Device Tree file for Globalscale Marvell ESPRESSOBin Board with eMMC
> + * Copyright (C) 2018 Marvell
> + *
> + * Romain Perier <romain.perier@free-electrons.com>
> + * Konstantin Porotchkin <kostap@marvell.com>
> + *
> + */
> +/*
> + * Schematic available at http://espressobin.net/wp-content/uploads/2017/08/ESPRESSObin_V5_Schematics.pdf
> + */
> +
> +/dts-v1/;
> +
> +#include "armada-3720-espressobin.dtsi"
> +
> +/ {
> +	model = "Globalscale Marvell ESPRESSOBin Board (eMMC)";
> +	compatible = "globalscale,espressobin-emmc", "globalscale,espressobin",
> +		     "marvell,armada3720", "marvell,armada3710";
> +};
> +
> +/* U11 */
> +&sdhci1 {
> +	non-removable;
> +	bus-width = <8>;
> +	mmc-ddr-1_8v;
> +	mmc-hs400-1_8v;
> +	marvell,xenon-emmc;
> +	marvell,xenon-tun-count = <9>;
> +	marvell,pad-type = "fixed-1-8v";
> +
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc_pins>;
> +	status = "okay";
> +
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	mmccard: mmccard@0 {
> +		compatible = "mmc-card";
> +		reg = <0>;
> +	};
> +};
> diff --git a/doc/README.marvell b/doc/README.marvell
> index 5416bc3035..be07f31f8c 100644
> --- a/doc/README.marvell
> +++ b/doc/README.marvell
> @@ -43,8 +43,11 @@ Build Procedure
>           In order to prevent this, the required device-tree MUST be set during compilation.
>           All device-tree files are located in ./arch/arm/dts/ folder.
>   
> -	For other DB boards (MacchiatoBin, EspressoBin and 3700 DB board) compile u-boot with
> -	just default device-tree from defconfig using:
> +	For the EspressoBin board with populated eMMC device use
> +		# make DEVICE_TREE=armada-3720-espressobin-emmc
> +
> +	For other DB boards (MacchiatoBin, EspressoBin without soldered eMMC and 3700 DB board)
> +	compile u-boot with just default device-tree from defconfig using:
>   
>   		# make
>   
> 


Viele Grüße,
Stefan
Pali Rohár Oct. 14, 2020, 8:21 a.m. UTC | #4
On Wednesday 14 October 2020 10:17:45 Stefan Roese wrote:
> On 04.09.20 17:33, Andre Heider wrote:
> > Import armada-3720-espressobin-emmc.dts from Linux, but use sdhc1 for
> > emmc, since our dtsi is still based on downstream and sdhc0 is used for
> > the sd card.
> > 
> > Signed-off-by: Andre Heider <a.heider@gmail.com>
> 
> Applied to u-boot-marvell/master
> 
> Thanks,
> Stefan
> 
> > ---
> >   arch/arm/dts/Makefile                         |  1 +
> >   arch/arm/dts/armada-3720-espressobin-emmc.dts | 44 +++++++++++++++++++
> >   doc/README.marvell                            |  7 ++-
> >   3 files changed, 50 insertions(+), 2 deletions(-)
> >   create mode 100644 arch/arm/dts/armada-3720-espressobin-emmc.dts
> > 
> > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> > index 5e34192be6..8f1958b5a7 100644
> > --- a/arch/arm/dts/Makefile
> > +++ b/arch/arm/dts/Makefile
> > @@ -202,6 +202,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
> >   dtb-$(CONFIG_ARCH_MVEBU) +=			\
> >   	armada-3720-db.dtb			\
> >   	armada-3720-espressobin.dtb		\
> > +	armada-3720-espressobin-emmc.dtb	\
> >   	armada-3720-turris-mox.dtb		\
> >   	armada-3720-uDPU.dtb			\
> >   	armada-375-db.dtb			\
> > diff --git a/arch/arm/dts/armada-3720-espressobin-emmc.dts b/arch/arm/dts/armada-3720-espressobin-emmc.dts
> > new file mode 100644
> > index 0000000000..29ccb6a573
> > --- /dev/null
> > +++ b/arch/arm/dts/armada-3720-espressobin-emmc.dts
> > @@ -0,0 +1,44 @@
> > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > +/*
> > + * Device Tree file for Globalscale Marvell ESPRESSOBin Board with eMMC
> > + * Copyright (C) 2018 Marvell
> > + *
> > + * Romain Perier <romain.perier@free-electrons.com>
> > + * Konstantin Porotchkin <kostap@marvell.com>
> > + *
> > + */
> > +/*
> > + * Schematic available at http://espressobin.net/wp-content/uploads/2017/08/ESPRESSObin_V5_Schematics.pdf
> > + */
> > +
> > +/dts-v1/;
> > +
> > +#include "armada-3720-espressobin.dtsi"
> > +
> > +/ {
> > +	model = "Globalscale Marvell ESPRESSOBin Board (eMMC)";
> > +	compatible = "globalscale,espressobin-emmc", "globalscale,espressobin",
> > +		     "marvell,armada3720", "marvell,armada3710";
> > +};
> > +
> > +/* U11 */
> > +&sdhci1 {
> > +	non-removable;
> > +	bus-width = <8>;
> > +	mmc-ddr-1_8v;
> > +	mmc-hs400-1_8v;
> > +	marvell,xenon-emmc;
> > +	marvell,xenon-tun-count = <9>;
> > +	marvell,pad-type = "fixed-1-8v";
> > +
> > +	pinctrl-names = "default";
> > +	pinctrl-0 = <&mmc_pins>;
> > +	status = "okay";
> > +
> > +	#address-cells = <1>;
> > +	#size-cells = <0>;
> > +	mmccard: mmccard@0 {
> > +		compatible = "mmc-card";
> > +		reg = <0>;
> > +	};
> > +};
> > diff --git a/doc/README.marvell b/doc/README.marvell
> > index 5416bc3035..be07f31f8c 100644
> > --- a/doc/README.marvell
> > +++ b/doc/README.marvell
> > @@ -43,8 +43,11 @@ Build Procedure
> >           In order to prevent this, the required device-tree MUST be set during compilation.
> >           All device-tree files are located in ./arch/arm/dts/ folder.
> > -	For other DB boards (MacchiatoBin, EspressoBin and 3700 DB board) compile u-boot with
> > -	just default device-tree from defconfig using:
> > +	For the EspressoBin board with populated eMMC device use
> > +		# make DEVICE_TREE=armada-3720-espressobin-emmc
> > +
> > +	For other DB boards (MacchiatoBin, EspressoBin without soldered eMMC and 3700 DB board)
> > +	compile u-boot with just default device-tree from defconfig using:

Hello! Does not it really make sense to do autodetection of eMMC
presence and enable it in U-Boot code only when needed and therefore
avoid having two DTS files and needs for specifying DEVICE_TREE variable
and therefore variant of Espressobin, as I stated in previous emails?

I think this just complicates build process... E.g. we already have a
code in U-Boot which detects V5 vs V7 variant.

> >   		# make
> > 
> 
> 
> Viele Grüße,
> Stefan
> 
> -- 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de
Andre Heider Oct. 14, 2020, 8:37 a.m. UTC | #5
On 14/10/2020 10:21, Pali Rohár wrote:

<snip>

>>> diff --git a/doc/README.marvell b/doc/README.marvell
>>> index 5416bc3035..be07f31f8c 100644
>>> --- a/doc/README.marvell
>>> +++ b/doc/README.marvell
>>> @@ -43,8 +43,11 @@ Build Procedure
>>>            In order to prevent this, the required device-tree MUST be set during compilation.
>>>            All device-tree files are located in ./arch/arm/dts/ folder.
>>> -	For other DB boards (MacchiatoBin, EspressoBin and 3700 DB board) compile u-boot with
>>> -	just default device-tree from defconfig using:
>>> +	For the EspressoBin board with populated eMMC device use
>>> +		# make DEVICE_TREE=armada-3720-espressobin-emmc
>>> +
>>> +	For other DB boards (MacchiatoBin, EspressoBin without soldered eMMC and 3700 DB board)
>>> +	compile u-boot with just default device-tree from defconfig using:
> 
> Hello! Does not it really make sense to do autodetection of eMMC
> presence and enable it in U-Boot code only when needed and therefore
> avoid having two DTS files and needs for specifying DEVICE_TREE variable
> and therefore variant of Espressobin, as I stated in previous emails?
> 
> I think this just complicates build process... E.g. we already have a
> code in U-Boot which detects V5 vs V7 variant.

I still like the idea, but I'm still hesitating to just enable the emmc 
everywhere. There's the issue with powering down the emmc block if it's 
not populated. How would that work once we switch to atf for comphy control?

 From a different angle: If we could just do that, why does Linux have 
different devicetrees?

Regards,
Andre
Pali Rohár Oct. 14, 2020, 8:45 a.m. UTC | #6
On Wednesday 14 October 2020 10:37:57 Andre Heider wrote:
> On 14/10/2020 10:21, Pali Rohár wrote:
> 
> <snip>
> 
> > > > diff --git a/doc/README.marvell b/doc/README.marvell
> > > > index 5416bc3035..be07f31f8c 100644
> > > > --- a/doc/README.marvell
> > > > +++ b/doc/README.marvell
> > > > @@ -43,8 +43,11 @@ Build Procedure
> > > >            In order to prevent this, the required device-tree MUST be set during compilation.
> > > >            All device-tree files are located in ./arch/arm/dts/ folder.
> > > > -	For other DB boards (MacchiatoBin, EspressoBin and 3700 DB board) compile u-boot with
> > > > -	just default device-tree from defconfig using:
> > > > +	For the EspressoBin board with populated eMMC device use
> > > > +		# make DEVICE_TREE=armada-3720-espressobin-emmc
> > > > +
> > > > +	For other DB boards (MacchiatoBin, EspressoBin without soldered eMMC and 3700 DB board)
> > > > +	compile u-boot with just default device-tree from defconfig using:
> > 
> > Hello! Does not it really make sense to do autodetection of eMMC
> > presence and enable it in U-Boot code only when needed and therefore
> > avoid having two DTS files and needs for specifying DEVICE_TREE variable
> > and therefore variant of Espressobin, as I stated in previous emails?
> > 
> > I think this just complicates build process... E.g. we already have a
> > code in U-Boot which detects V5 vs V7 variant.
> 
> I still like the idea, but I'm still hesitating to just enable the emmc
> everywhere. There's the issue with powering down the emmc block if it's not
> populated. How would that work once we switch to atf for comphy control?

Is there issue with powering it down? I just do not know about it. And
could we fix it?

> From a different angle: If we could just do that, why does Linux have
> different devicetrees?

I do not know exact answer, so I just guess two reasons:

1) historic, nobody wanted to think about it, so rather created
secondary DTS

2) linux driver model does not have API and solution how to do this
auto-detection and in case of absence, turn blocks off and reconfigure
it.

IIRC similar problem was with MOX (also based on A3720) and final
solution is that kernel has only one DTB and U-Boot "modifies" it prior
booting kernel, based on autodetection which U-Boot did. Similarly like
MAC address of MTD partitions are put into espressobin DTB prior booting
kernel.

> 
> Regards,
> Andre
Pali Rohár Oct. 14, 2020, 1:20 p.m. UTC | #7
On Wednesday 14 October 2020 10:45:33 Pali Rohár wrote:
> On Wednesday 14 October 2020 10:37:57 Andre Heider wrote:
> > On 14/10/2020 10:21, Pali Rohár wrote:
> > 
> > <snip>
> > 
> > > > > diff --git a/doc/README.marvell b/doc/README.marvell
> > > > > index 5416bc3035..be07f31f8c 100644
> > > > > --- a/doc/README.marvell
> > > > > +++ b/doc/README.marvell
> > > > > @@ -43,8 +43,11 @@ Build Procedure
> > > > >            In order to prevent this, the required device-tree MUST be set during compilation.
> > > > >            All device-tree files are located in ./arch/arm/dts/ folder.
> > > > > -	For other DB boards (MacchiatoBin, EspressoBin and 3700 DB board) compile u-boot with
> > > > > -	just default device-tree from defconfig using:
> > > > > +	For the EspressoBin board with populated eMMC device use
> > > > > +		# make DEVICE_TREE=armada-3720-espressobin-emmc
> > > > > +
> > > > > +	For other DB boards (MacchiatoBin, EspressoBin without soldered eMMC and 3700 DB board)
> > > > > +	compile u-boot with just default device-tree from defconfig using:
> > > 
> > > Hello! Does not it really make sense to do autodetection of eMMC
> > > presence and enable it in U-Boot code only when needed and therefore
> > > avoid having two DTS files and needs for specifying DEVICE_TREE variable
> > > and therefore variant of Espressobin, as I stated in previous emails?
> > > 
> > > I think this just complicates build process... E.g. we already have a
> > > code in U-Boot which detects V5 vs V7 variant.
> > 
> > I still like the idea, but I'm still hesitating to just enable the emmc
> > everywhere. There's the issue with powering down the emmc block if it's not
> > populated. How would that work once we switch to atf for comphy control?
> 
> Is there issue with powering it down? I just do not know about it. And
> could we fix it?
> 
> > From a different angle: If we could just do that, why does Linux have
> > different devicetrees?
> 
> I do not know exact answer, so I just guess two reasons:
> 
> 1) historic, nobody wanted to think about it, so rather created
> secondary DTS
> 
> 2) linux driver model does not have API and solution how to do this
> auto-detection and in case of absence, turn blocks off and reconfigure
> it.
> 
> IIRC similar problem was with MOX (also based on A3720) and final
> solution is that kernel has only one DTB and U-Boot "modifies" it prior
> booting kernel, based on autodetection which U-Boot did. Similarly like
> MAC address of MTD partitions are put into espressobin DTB prior booting
> kernel.

MOX has uSD slot for uSD card and SDIO slot for SDIO wifi card, both
removable. Standard product configuration does not contain SDIO wifi
card, but kernel's DTS file have it enabled by default:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts

So it is really problem to enable eMMC by default on espressobin?
diff mbox series

Patch

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 5e34192be6..8f1958b5a7 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -202,6 +202,7 @@  dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
 dtb-$(CONFIG_ARCH_MVEBU) +=			\
 	armada-3720-db.dtb			\
 	armada-3720-espressobin.dtb		\
+	armada-3720-espressobin-emmc.dtb	\
 	armada-3720-turris-mox.dtb		\
 	armada-3720-uDPU.dtb			\
 	armada-375-db.dtb			\
diff --git a/arch/arm/dts/armada-3720-espressobin-emmc.dts b/arch/arm/dts/armada-3720-espressobin-emmc.dts
new file mode 100644
index 0000000000..29ccb6a573
--- /dev/null
+++ b/arch/arm/dts/armada-3720-espressobin-emmc.dts
@@ -0,0 +1,44 @@ 
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for Globalscale Marvell ESPRESSOBin Board with eMMC
+ * Copyright (C) 2018 Marvell
+ *
+ * Romain Perier <romain.perier@free-electrons.com>
+ * Konstantin Porotchkin <kostap@marvell.com>
+ *
+ */
+/*
+ * Schematic available at http://espressobin.net/wp-content/uploads/2017/08/ESPRESSObin_V5_Schematics.pdf
+ */
+
+/dts-v1/;
+
+#include "armada-3720-espressobin.dtsi"
+
+/ {
+	model = "Globalscale Marvell ESPRESSOBin Board (eMMC)";
+	compatible = "globalscale,espressobin-emmc", "globalscale,espressobin",
+		     "marvell,armada3720", "marvell,armada3710";
+};
+
+/* U11 */
+&sdhci1 {
+	non-removable;
+	bus-width = <8>;
+	mmc-ddr-1_8v;
+	mmc-hs400-1_8v;
+	marvell,xenon-emmc;
+	marvell,xenon-tun-count = <9>;
+	marvell,pad-type = "fixed-1-8v";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc_pins>;
+	status = "okay";
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	mmccard: mmccard@0 {
+		compatible = "mmc-card";
+		reg = <0>;
+	};
+};
diff --git a/doc/README.marvell b/doc/README.marvell
index 5416bc3035..be07f31f8c 100644
--- a/doc/README.marvell
+++ b/doc/README.marvell
@@ -43,8 +43,11 @@  Build Procedure
         In order to prevent this, the required device-tree MUST be set during compilation.
         All device-tree files are located in ./arch/arm/dts/ folder.
 
-	For other DB boards (MacchiatoBin, EspressoBin and 3700 DB board) compile u-boot with
-	just default device-tree from defconfig using:
+	For the EspressoBin board with populated eMMC device use
+		# make DEVICE_TREE=armada-3720-espressobin-emmc
+
+	For other DB boards (MacchiatoBin, EspressoBin without soldered eMMC and 3700 DB board)
+	compile u-boot with just default device-tree from defconfig using:
 
 		# make