Re: [PATCH v2 3/3] arm: mvebu: Initial ESPRESSOBin-Ultra board support

2021-03-01 Thread Marek Behun
On Mon, 1 Mar 2021 16:41:01 +0100
Pali Rohár  wrote:

> On Sunday 28 February 2021 22:38:26 Luka Kovacic wrote:
> > Hello Marek,
> > 
> > On Sat, Feb 27, 2021 at 2:24 PM Marek Behun  wrote:  
> > >
> > > In Linux the DTS for espressobin-ultra includes
> > > armada-3720-espressobin.dtsi and just adds changes.
> > >
> > > If possible, please do this as is done in Linux. In fact we want to
> > > slowly move in the direction to have the dts files just copied from
> > > Linux.
> > >
> > > Marek  
> > 
> > Thanks for pointing this out.
> > As you and Pali have suggested, I will rework this patch to be as
> > close to the Linux dts as possible.
> > 
> > I'd go with the approach of just creating a dts with changes with
> > respect to the base ESPRESSOBin.
> > 
> > Kind regards,
> > Luka  
> 
> Hello Luka!
> 
> Linux kernel has currently 5 DTS files for espressobin (v5, v5-emmc, v7,
> v7-emmc, ultra) and all are using one common dtsi file.
> 
> In U-Boot now we have just one DTS file for all 4 variants (ultra
> variant is missing) and differences between emmc and non-emmc, v5 and v7
> variants is done at u-boot runtime code.
> 
> So this allows to have just one U-Boot binary for all espressobin
> boards.
> 
> Distributions (OpenWRT and Armbian) complained about need to have such
> many precompiled binaries for espressobin. And seems that after unifying
> u-boot to build just one espressobin binary, they are happy.
> 
> So, if it is possible, I would be happy if we can continue with this
> approach with just one DTS file and one U-Boot binary for all
> espressobin variants.
> 
> If it is needed to enable / disable some nodes in DTS file, it is
> possible at U-Boot runtime via board_fix_fdt() function in board code.
> Here can be e.g. code which checks if U-Boot is running at espressobin
> v7 or at espressobin ultra. Maybe this could help you with debugging...

The previous message was for Luka, sorry.

BTW Pali, if distributions want to have one binary for all variants
maybe they would be interested in my approach to the TIM GPP code for
RAM initialization from mox-boot-builder repository, since we have one
flash-image.bin binary for both DDR3 and DDR4 for all RAM sizes.

Marek


Re: [PATCH v2 3/3] arm: mvebu: Initial ESPRESSOBin-Ultra board support

2021-03-01 Thread Marek Behun
On Mon, 1 Mar 2021 16:41:01 +0100
Pali Rohár  wrote:

> On Sunday 28 February 2021 22:38:26 Luka Kovacic wrote:
> > Hello Marek,
> > 
> > On Sat, Feb 27, 2021 at 2:24 PM Marek Behun  wrote:  
> > >
> > > In Linux the DTS for espressobin-ultra includes
> > > armada-3720-espressobin.dtsi and just adds changes.
> > >
> > > If possible, please do this as is done in Linux. In fact we want to
> > > slowly move in the direction to have the dts files just copied from
> > > Linux.
> > >
> > > Marek  
> > 
> > Thanks for pointing this out.
> > As you and Pali have suggested, I will rework this patch to be as
> > close to the Linux dts as possible.
> > 
> > I'd go with the approach of just creating a dts with changes with
> > respect to the base ESPRESSOBin.
> > 
> > Kind regards,
> > Luka  
> 
> Hello Luka!
> 
> Linux kernel has currently 5 DTS files for espressobin (v5, v5-emmc, v7,
> v7-emmc, ultra) and all are using one common dtsi file.
> 
> In U-Boot now we have just one DTS file for all 4 variants (ultra
> variant is missing) and differences between emmc and non-emmc, v5 and v7
> variants is done at u-boot runtime code.
> 
> So this allows to have just one U-Boot binary for all espressobin
> boards.
> 
> Distributions (OpenWRT and Armbian) complained about need to have such
> many precompiled binaries for espressobin. And seems that after unifying
> u-boot to build just one espressobin binary, they are happy.
> 
> So, if it is possible, I would be happy if we can continue with this
> approach with just one DTS file and one U-Boot binary for all
> espressobin variants.
> 
> If it is needed to enable / disable some nodes in DTS file, it is
> possible at U-Boot runtime via board_fix_fdt() function in board code.
> Here can be e.g. code which checks if U-Boot is running at espressobin
> v7 or at espressobin ultra. Maybe this could help you with debugging...

In that case try to make the "one dts file to rule them all" to be the
same as the basic dts file in Linux, and do the necessary U-Boot
differences in armada-3720-espressobin-u-boot.dtsi file. Then fix the
necessary differences for variants in board code.

Marek


Re: [PATCH v2 3/3] arm: mvebu: Initial ESPRESSOBin-Ultra board support

2021-03-01 Thread Pali Rohár
On Sunday 28 February 2021 22:38:26 Luka Kovacic wrote:
> Hello Marek,
> 
> On Sat, Feb 27, 2021 at 2:24 PM Marek Behun  wrote:
> >
> > In Linux the DTS for espressobin-ultra includes
> > armada-3720-espressobin.dtsi and just adds changes.
> >
> > If possible, please do this as is done in Linux. In fact we want to
> > slowly move in the direction to have the dts files just copied from
> > Linux.
> >
> > Marek
> 
> Thanks for pointing this out.
> As you and Pali have suggested, I will rework this patch to be as
> close to the Linux dts as possible.
> 
> I'd go with the approach of just creating a dts with changes with
> respect to the base ESPRESSOBin.
> 
> Kind regards,
> Luka

Hello Luka!

Linux kernel has currently 5 DTS files for espressobin (v5, v5-emmc, v7,
v7-emmc, ultra) and all are using one common dtsi file.

In U-Boot now we have just one DTS file for all 4 variants (ultra
variant is missing) and differences between emmc and non-emmc, v5 and v7
variants is done at u-boot runtime code.

So this allows to have just one U-Boot binary for all espressobin
boards.

Distributions (OpenWRT and Armbian) complained about need to have such
many precompiled binaries for espressobin. And seems that after unifying
u-boot to build just one espressobin binary, they are happy.

So, if it is possible, I would be happy if we can continue with this
approach with just one DTS file and one U-Boot binary for all
espressobin variants.

If it is needed to enable / disable some nodes in DTS file, it is
possible at U-Boot runtime via board_fix_fdt() function in board code.
Here can be e.g. code which checks if U-Boot is running at espressobin
v7 or at espressobin ultra. Maybe this could help you with debugging...


Re: [PATCH v2 3/3] arm: mvebu: Initial ESPRESSOBin-Ultra board support

2021-02-28 Thread Luka Kovacic
Hello Marek,

On Sat, Feb 27, 2021 at 2:24 PM Marek Behun  wrote:
>
> In Linux the DTS for espressobin-ultra includes
> armada-3720-espressobin.dtsi and just adds changes.
>
> If possible, please do this as is done in Linux. In fact we want to
> slowly move in the direction to have the dts files just copied from
> Linux.
>
> Marek

Thanks for pointing this out.
As you and Pali have suggested, I will rework this patch to be as
close to the Linux dts as possible.

I'd go with the approach of just creating a dts with changes with
respect to the base ESPRESSOBin.

Kind regards,
Luka


Re: [PATCH v2 3/3] arm: mvebu: Initial ESPRESSOBin-Ultra board support

2021-02-27 Thread Marek Behun
In Linux the DTS for espressobin-ultra includes
armada-3720-espressobin.dtsi and just adds changes.

If possible, please do this as is done in Linux. In fact we want to
slowly move in the direction to have the dts files just copied from
Linux.

Marek


Re: [PATCH v2 3/3] arm: mvebu: Initial ESPRESSOBin-Ultra board support

2021-02-26 Thread Pali Rohár
On Monday 15 February 2021 20:59:34 Luka Kovacic wrote:
> Add initial support for the ESPRESSOBin-Ultra board from Globalscale
> Technologies, Inc.
> 
> The board is based on the 64-bit dual-core Marvell Armada 3720 SoC.
> Peripherals:
>  - 5 Gigabit Ethernet ports (WAN has PoE, up to 30W, Topaz 6341 switch)
>  - RTC clock (PCF8563)
>  - USB 3.0 port
>  - USB 2.0 port
>  - 4x LED
>  - UART over Micro-USB
>  - M.2 slot (2280)
>  - Mini PCI-E slot
> 
> Additionally, automatic import of the Marvell hw_info parameters is
> enabled via the recently added hw_info command.
> The parameters stored in Marvell hw_info are usually the board serial
> number and MAC addresses.

Hello Luka!

Few months ago I have de-duplicated all existing espressobin setups
supported in uboot to use just one DTS file and one defconfig file and
do board detection at runtime.

So I do not think it is a good idea to again define another espressobin
DTS and defconfig file.

Linux kernel also is using one common DTS file for all espressobin
boards (including ultra variant).

So could you please try to rework this patch to use existing files
armada-3720-espressobin.dts and mvebu_espressobin-88f3720_defconfig
(with probably some board code which detects for ultra variant)?

> Signed-off-by: Luka Kovacic 
> Cc: Luka Perkov 
> Cc: Robert Marko 
> ---
>  arch/arm/dts/Makefile |   1 +
>  .../arm/dts/armada-3720-espressobin-ultra.dts | 202 ++
>  board/Marvell/mvebu_armada-37xx/MAINTAINERS   |   8 +
>  board/Marvell/mvebu_armada-37xx/board.c   |  92 +++-
>  .../mvebu_espressobin-ultra-88f3720_defconfig |  92 
>  5 files changed, 389 insertions(+), 6 deletions(-)
>  create mode 100644 arch/arm/dts/armada-3720-espressobin-ultra.dts
>  create mode 100644 configs/mvebu_espressobin-ultra-88f3720_defconfig
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 33e483f4fb..9f544b1caf 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -208,6 +208,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
>  dtb-$(CONFIG_ARCH_MVEBU) +=  \
>   armada-3720-db.dtb  \
>   armada-3720-espressobin.dtb \
> + armada-3720-espressobin-ultra.dtb   \
>   armada-3720-turris-mox.dtb  \
>   armada-3720-uDPU.dtb\
>   armada-375-db.dtb   \
> diff --git a/arch/arm/dts/armada-3720-espressobin-ultra.dts 
> b/arch/arm/dts/armada-3720-espressobin-ultra.dts
> new file mode 100644
> index 00..70f97fe239
> --- /dev/null
> +++ b/arch/arm/dts/armada-3720-espressobin-ultra.dts
> @@ -0,0 +1,202 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Device Tree file for ESPRESSObin-Ultra board
> + * Copyright (C) 2016 Marvell
> + * Copyright (C) 2019 Globalscale technologies, Inc.
> + * Copyright (C) 2020 Sartura Ltd.
> + *
> + * Author: Jason Hung 
> + * Author: Luka Kovacic 
> + * Author: Vladimir Vid 
> + */
> +
> +/dts-v1/;
> +
> +#include "armada-372x.dtsi"
> +
> +/ {
> + model = "Globalscale Marvell ESPRESSOBin Ultra Board";
> + compatible = "globalscale,espressobin-ultra", "marvell,armada3720", 
> "marvell,armada3710";
> +
> + chosen {
> + stdout-path = "serial0:115200n8";
> + };
> +
> + aliases {
> + ethernet0 = ð0;
> + i2c0 = &i2c0;
> + spi0 = &spi0;
> + };
> +
> + memory {
> + device_type = "memory";
> + reg = <0x 0x 0x 0x2000>;
> + };
> +
> + vcc_sd_reg0: regulator@0 {
> + compatible = "regulator-gpio";
> + regulator-name = "vcc_sd0";
> + regulator-min-microvolt = <180>;
> + regulator-max-microvolt = <330>;
> + regulator-type = "voltage";
> + states = <180 0x1
> +   330 0x0>;
> + gpios = <&gpionb 4 GPIO_ACTIVE_HIGH>;
> + };
> +
> + gpio-leds {
> + pinctrl-names = "default";
> + pinctrl-0 = <&led1_pins>, <&led2_pins>, <&led3_pins>, 
> <&led4_pins>;
> + compatible = "gpio-leds";
> +
> + led1 {
> + label = "led1";
> + gpios = <&gpionb 11 GPIO_ACTIVE_LOW>;
> + default-state = "on";
> + };
> + led2 {
> + label = "led2";
> + gpios = <&gpionb 12 GPIO_ACTIVE_LOW>;
> + default-state = "on";
> + };
> + led3 {
> + label = "led3";
> + gpios = <&gpionb 13 GPIO_ACTIVE_LOW>;
> + default-state = "on";
> + };
> + led4 {
> + label = "led4";
> + gpios = <&gpionb 14 GPIO_ACTIVE_LOW>;
> + default-state = "on";
> + };
> + };
> +};
> +
> +&

[PATCH v2 3/3] arm: mvebu: Initial ESPRESSOBin-Ultra board support

2021-02-15 Thread Luka Kovacic
Add initial support for the ESPRESSOBin-Ultra board from Globalscale
Technologies, Inc.

The board is based on the 64-bit dual-core Marvell Armada 3720 SoC.
Peripherals:
 - 5 Gigabit Ethernet ports (WAN has PoE, up to 30W, Topaz 6341 switch)
 - RTC clock (PCF8563)
 - USB 3.0 port
 - USB 2.0 port
 - 4x LED
 - UART over Micro-USB
 - M.2 slot (2280)
 - Mini PCI-E slot

Additionally, automatic import of the Marvell hw_info parameters is
enabled via the recently added hw_info command.
The parameters stored in Marvell hw_info are usually the board serial
number and MAC addresses.

Signed-off-by: Luka Kovacic 
Cc: Luka Perkov 
Cc: Robert Marko 
---
 arch/arm/dts/Makefile |   1 +
 .../arm/dts/armada-3720-espressobin-ultra.dts | 202 ++
 board/Marvell/mvebu_armada-37xx/MAINTAINERS   |   8 +
 board/Marvell/mvebu_armada-37xx/board.c   |  92 +++-
 .../mvebu_espressobin-ultra-88f3720_defconfig |  92 
 5 files changed, 389 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/dts/armada-3720-espressobin-ultra.dts
 create mode 100644 configs/mvebu_espressobin-ultra-88f3720_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 33e483f4fb..9f544b1caf 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -208,6 +208,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
 dtb-$(CONFIG_ARCH_MVEBU) +=\
armada-3720-db.dtb  \
armada-3720-espressobin.dtb \
+   armada-3720-espressobin-ultra.dtb   \
armada-3720-turris-mox.dtb  \
armada-3720-uDPU.dtb\
armada-375-db.dtb   \
diff --git a/arch/arm/dts/armada-3720-espressobin-ultra.dts 
b/arch/arm/dts/armada-3720-espressobin-ultra.dts
new file mode 100644
index 00..70f97fe239
--- /dev/null
+++ b/arch/arm/dts/armada-3720-espressobin-ultra.dts
@@ -0,0 +1,202 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for ESPRESSObin-Ultra board
+ * Copyright (C) 2016 Marvell
+ * Copyright (C) 2019 Globalscale technologies, Inc.
+ * Copyright (C) 2020 Sartura Ltd.
+ *
+ * Author: Jason Hung 
+ * Author: Luka Kovacic 
+ * Author: Vladimir Vid 
+ */
+
+/dts-v1/;
+
+#include "armada-372x.dtsi"
+
+/ {
+   model = "Globalscale Marvell ESPRESSOBin Ultra Board";
+   compatible = "globalscale,espressobin-ultra", "marvell,armada3720", 
"marvell,armada3710";
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   aliases {
+   ethernet0 = ð0;
+   i2c0 = &i2c0;
+   spi0 = &spi0;
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x 0x 0x2000>;
+   };
+
+   vcc_sd_reg0: regulator@0 {
+   compatible = "regulator-gpio";
+   regulator-name = "vcc_sd0";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <330>;
+   regulator-type = "voltage";
+   states = <180 0x1
+ 330 0x0>;
+   gpios = <&gpionb 4 GPIO_ACTIVE_HIGH>;
+   };
+
+   gpio-leds {
+   pinctrl-names = "default";
+   pinctrl-0 = <&led1_pins>, <&led2_pins>, <&led3_pins>, 
<&led4_pins>;
+   compatible = "gpio-leds";
+
+   led1 {
+   label = "led1";
+   gpios = <&gpionb 11 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+   led2 {
+   label = "led2";
+   gpios = <&gpionb 12 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+   led3 {
+   label = "led3";
+   gpios = <&gpionb 13 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+   led4 {
+   label = "led4";
+   gpios = <&gpionb 14 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+   };
+};
+
+&pinctrl_nb {
+   led1_pins: led1-pins {
+   groups = "pwm0";
+   function = "gpio";
+   };
+   led2_pins: led2-pins {
+   groups = "pwm1";
+   function = "gpio";
+   };
+   led3_pins: led3-pins {
+   groups = "pwm2";
+   function = "gpio";
+   };
+   led4_pins: led4-pins {
+   groups = "pwm3";
+   function = "gpio";
+   };
+};
+
+&comphy {
+   max-lanes = <3>;
+   phy0 {
+   phy-type = ;
+   phy-speed = ;
+   };
+
+   phy1 {
+   phy-type = ;
+   phy-speed = ;
+   };
+
+   phy2 {
+   phy-type = ;
+   phy-speed = ;
+   };
+};
+
+ð0 {
+   status =