[PATCH v2 2/2] board: amlogic: add meson_generate_serial_ethaddr fallback to p200

2024-03-24 Thread Christian Hewitt
Add a fall-back method to generate ethaddr from CPU serial on p200 boards
if the MAC cannot be read from efuse. This prevents random MAC addresses
on the WeTek Hub/Play2 boards.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/p200/p200.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/board/amlogic/p200/p200.c b/board/amlogic/p200/p200.c
index 7c432f9d281..3061f7a6b3c 100644
--- a/board/amlogic/p200/p200.c
+++ b/board/amlogic/p200/p200.c
@@ -30,6 +30,8 @@ int misc_init_r(void)
  mac_addr, EFUSE_MAC_SIZE);
if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("ethaddr", mac_addr);
+   else
+   meson_generate_serial_ethaddr();
}
 
if (!env_get("serial#")) {
-- 
2.34.1



[PATCH v2 1/2] ARM: dts: fix Ethernet on WeTek Hub/Play2

2024-03-24 Thread Christian Hewitt
Placing the snps,reset content needed for Ethernet to probe in a common
uboot.dtsi results in the content not being used and broken Ethernet. Fix
this by creating two board specific dtsi files with the right content.

Fixes: 67d5128df950 ("ARM: dts: add support for WeTek Hub and WeTek Play2")
Signed-off-by: Christian Hewitt 
---
 ...u-boot.dtsi => meson-gxbb-wetek-hub-u-boot.dtsi} |  0
 arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi | 13 +
 2 files changed, 13 insertions(+)
 rename arch/arm/dts/{meson-gxbb-wetek-u-boot.dtsi => 
meson-gxbb-wetek-hub-u-boot.dtsi} (100%)
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi

diff --git a/arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi 
b/arch/arm/dts/meson-gxbb-wetek-hub-u-boot.dtsi
similarity index 100%
rename from arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi
rename to arch/arm/dts/meson-gxbb-wetek-hub-u-boot.dtsi
diff --git a/arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi 
b/arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi
new file mode 100644
index 000..3743053eb9c
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Neil Armstrong 
+ */
+
+#include "meson-gx-u-boot.dtsi"
+
+ {
+   snps,reset-gpio = < GPIOZ_14 0>;
+   snps,reset-delays-us = <0 1 100>;
+   snps,reset-active-low;
+};
-- 
2.34.1



[PATCH v2 0/2] ARM: dts: fix Ethernet and random MAC's on WeTek Hub/Play2

2024-03-24 Thread Christian Hewitt
In submitting the original patches for WeTek Hub/Play2 I appear to have
squashed an experimental change to place the u-boot.dtsi file on the common
board dtsi, but this was incorrect and results in broken Ethernet. Patch 1
creates per-board u-boot.dtsi files to fix that. However, while the NIC is
now probed correctly the current p200.c board file doesn't find the MAC in
efuse and we get random MAC addresses. Patch 2 adds a fallback method for
generating a MAC from the CPU serial.

Changes from v1:
- Simplified p200.c changes
- Drop patch 3

Christian Hewitt (2):
  ARM: dts: fix Ethernet on WeTek Hub/Play2
  board: amlogic: add meson_generate_serial_ethaddr fallback to p200

 ...u-boot.dtsi => meson-gxbb-wetek-hub-u-boot.dtsi} |  0
 arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi | 13 +
 board/amlogic/p200/p200.c   |  2 ++
 3 files changed, 15 insertions(+)
 rename arch/arm/dts/{meson-gxbb-wetek-u-boot.dtsi => 
meson-gxbb-wetek-hub-u-boot.dtsi} (100%)
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi

-- 
2.34.1



[PATCH 3/3] configs: amlogic: set board family to avoid random MAC on WeTek Hub/Play2

2024-03-16 Thread Christian Hewitt
Add CONFIG_SYS_BOARD="p200" to the Hub/Play2 board configs to ensure the
factory programmed MAC is correctly read from efuse.

Signed-off-by: Christian Hewitt 
---
 configs/wetek-hub_defconfig   | 1 +
 configs/wetek-play2_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/wetek-hub_defconfig b/configs/wetek-hub_defconfig
index fd92b041e73..413bbfe9ab7 100644
--- a/configs/wetek-hub_defconfig
+++ b/configs/wetek-hub_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
+CONFIG_SYS_BOARD="p200"
 CONFIG_TEXT_BASE=0x0100
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
diff --git a/configs/wetek-play2_defconfig b/configs/wetek-play2_defconfig
index b887419a6ba..dd98929444c 100644
--- a/configs/wetek-play2_defconfig
+++ b/configs/wetek-play2_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MESON=y
+CONFIG_SYS_BOARD="p200"
 CONFIG_TEXT_BASE=0x0100
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-- 
2.34.1



[PATCH 2/3] ARM: board: meson: update efuse MAC reading code

2024-03-16 Thread Christian Hewitt
Current code used for reading the factory programmed MAC from efuse on
p200 boards does not appear to work resulting in a random MAC being
generated. Update the p200 board data reusing the function from the VIM3
source.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/p200/p200.c | 35 +--
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/board/amlogic/p200/p200.c b/board/amlogic/p200/p200.c
index 7c432f9d281..fb07eefa532 100644
--- a/board/amlogic/p200/p200.c
+++ b/board/amlogic/p200/p200.c
@@ -14,29 +14,36 @@
 #include 
 #include 
 
-#define EFUSE_SN_OFFSET20
-#define EFUSE_SN_SIZE  16
-#define EFUSE_MAC_OFFSET   52
-#define EFUSE_MAC_SIZE 6
+#define EFUSE_MAC_OFFSET   0
+#define EFUSE_MAC_SIZE 12
+#define MAC_ADDR_LEN   6
 
 int misc_init_r(void)
 {
-   u8 mac_addr[EFUSE_MAC_SIZE];
-   char serial[EFUSE_SN_SIZE];
+   u8 mac_addr[MAC_ADDR_LEN];
+   char efuse_mac_addr[EFUSE_MAC_SIZE], tmp[3];
ssize_t len;
 
if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
- mac_addr, EFUSE_MAC_SIZE);
-   if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
+ efuse_mac_addr, EFUSE_MAC_SIZE);
+   if (len != EFUSE_MAC_SIZE)
+   return 0;
+
+   /* MAC is stored in ASCII format, 1bytes = 2characters */
+   for (int i = 0; i < 6; i++) {
+   tmp[0] = efuse_mac_addr[i * 2];
+   tmp[1] = efuse_mac_addr[i * 2 + 1];
+   tmp[2] = '\0';
+   mac_addr[i] = simple_strtoul(tmp, NULL, 16);
+   }
+
+   if (is_valid_ethaddr(mac_addr))
eth_env_set_enetaddr("ethaddr", mac_addr);
-   }
+   else
+   meson_generate_serial_ethaddr();
 
-   if (!env_get("serial#")) {
-   len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
-   EFUSE_SN_SIZE);
-   if (len == EFUSE_SN_SIZE)
-   env_set("serial#", serial);
+   eth_env_get_enetaddr("ethaddr", mac_addr);
}
 
return 0;
-- 
2.34.1



[PATCH 1/3] ARM: dts: fix Ethernet on WeTek Hub/Play2

2024-03-16 Thread Christian Hewitt
Placing the snps,reset content needed for Ethernet to probe in a common
uboot.dtsi results in the content not being used and broken Ethernet. Fix
this by creating two board specific dtsi files with the right content.

Fixes: 67d5128df950 ("ARM: dts: add support for WeTek Hub and WeTek Play2")
Signed-off-by: Christian Hewitt 
---
 ...u-boot.dtsi => meson-gxbb-wetek-hub-u-boot.dtsi} |  0
 arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi | 13 +
 2 files changed, 13 insertions(+)
 rename arch/arm/dts/{meson-gxbb-wetek-u-boot.dtsi => 
meson-gxbb-wetek-hub-u-boot.dtsi} (100%)
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi

diff --git a/arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi 
b/arch/arm/dts/meson-gxbb-wetek-hub-u-boot.dtsi
similarity index 100%
rename from arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi
rename to arch/arm/dts/meson-gxbb-wetek-hub-u-boot.dtsi
diff --git a/arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi 
b/arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi
new file mode 100644
index 000..3743053eb9c
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb-wetek-play2-u-boot.dtsi
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Neil Armstrong 
+ */
+
+#include "meson-gx-u-boot.dtsi"
+
+ {
+   snps,reset-gpio = < GPIOZ_14 0>;
+   snps,reset-delays-us = <0 1 100>;
+   snps,reset-active-low;
+};
-- 
2.34.1



[PATCH 0/3] ARM: dts: fix Ethernet and random MAC's on WeTek Hub/Play2

2024-03-16 Thread Christian Hewitt
In submitting the original patches for WeTek Hub/Play2 I appear to have
squashed an experimental change to place the u-boot.dtsi file on the common
board dtsi, but this was incorrect and results in broken Ethernet. Patch 1
creates per-board u-boot.dtsi files to fix that. However, while the NIC is
now probed correctly this results in random MAC addresses. Setting the p200
family in board configs also does not work, so patch 2 revises (overwrites)
the board init function using the same code as VIM3 which reads the factory
MAC from efuse correctly, and patch 3 sets board family to ensure boards
have a static MAC. The alternative would be to create a dedicated board
definition for wetek boards. If that would be preferred, let me know and I
can rework the changes to do that. And apologies for the mistake on the
original submission.

Christian Hewitt (3):
  ARM: dts: fix Ethernet on WeTek Hub/Play2
  ARM: board: meson: update efuse MAC reading code
  configs: amlogic: set board family to avoid random MAC on WeTek
Hub/Play2

 arch/arm/dts/meson-gxbb-wetek-hub-u-boot.dtsi | 14 
 ...tsi => meson-gxbb-wetek-play2-u-boot.dtsi} |  0
 board/amlogic/p200/p200.c | 35 +++
 configs/wetek-hub_defconfig   |  1 +
 configs/wetek-play2_defconfig |  1 +
 5 files changed, 37 insertions(+), 14 deletions(-)
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-hub-u-boot.dtsi
 rename arch/arm/dts/{meson-gxbb-wetek-u-boot.dtsi => 
meson-gxbb-wetek-play2-u-boot.dtsi} (100%)

-- 
2.34.1



Re: [PATCH v2 0/1] meson: Demonstration of using binman to produce the image

2023-04-03 Thread Christian Hewitt
> On 2 Apr 2023, at 6:41 am, Simon Glass  wrote:
> 
> Hi Mark,
> 
> On Sun, 2 Apr 2023 at 09:28, Mark Kettenis  wrote:
> >
> > > From: Simon Glass 
> > > Date: Sun,  2 Apr 2023 06:54:57 +1200
> > >
> > > The Odroid-C2 is quite a complicated image with many steps. It is an ideal
> > > example for how Binman can be used.
> >
> > You say Odroid-C2, but the patches seem to address the Odroid-C4...
> 
> Ah, yes. The difference seems to be an Amlogic S905 on the C2 and an S902X3 
> on the C4. I wonder if that affects the image makeup?

There are currently four different signing recipes that depend on the
board family that you are building for:

- GXBB
- GXL/GXM
- G12A/SM1
- G12B

The G12A/SM1 and G12B recipes are identical except for a different
signing binary used. The latest Amlogic boards (S905X4, T7, etc.)
also have incremental changes, but none are currently supported in
Linux or u-boot.

One of the challenges for binman will be the signing tools. Currently
this patchset depends upon Amlogic binaries. Apart from them being
closed-source and thus undesirable, they are also x86_64 only and
there are quite a few users (and at least one major distro) needing
to build on arm64 hardware.

There is an open-source tool called gxlimg which supports GXL and newer
boards. IMHO it would make a lot of sense for u-boot to absorb the
functionality of gxlimg (and extend support backwards to GXBB) as this
would remove the dependency on Amlogic binaries and allow u-boot build
and binman signing to be done anywhere.

https://github.com/repk/gxlimg

> The patch is for testing by Christian, who I hope can help get this landed 
> for all the Amlogic boards.

I will try to find the time to test this, but it’s not something I
could do more with (as only supporting 1/4 of the board families
that I need to build for, bu I do appreciate it’s a POC).

In case you’re not aware, Makefile based signing is implemented in
the amlogic-boot-fip repo that I’m currently tooled around:

https://github.com/LibreELEC/amlogic-boot-fip 

This is the “competition” so to speak. It’s quite simple and widely
used by most of the Amlogic supporting distros right now.

Christian

> >
> > > Add a binman description and update the instructions accordingly.
> > >
> > > Changes in v2:
> > > - Rebase to -next
> > >
> > > Simon Glass (1):
> > >   RFC: Move Odroid-C2 to use binman to produce the image
> > >
> > >  arch/arm/dts/meson-sm1-odroid-c4-u-boot.dtsi | 107 
> > >  arch/arm/mach-meson/Kconfig  |   1 +
> > >  doc/board/amlogic/odroid-c4.rst  | 127 +--
> > >  tools/binman/etype/aml_encrypt.py| 124 ++
> > >  tools/binman/ftest.py|   3 +
> > >  tools/binman/missing-blob-help   |   6 +
> > >  tools/binman/test/213_aml_encrypt.dts|  38 ++
> > >  tools/binman/test/214_list_no_dtb.dts|  23 
> > >  8 files changed, 337 insertions(+), 92 deletions(-)
> > >  create mode 100644 tools/binman/etype/aml_encrypt.py
> > >  create mode 100644 tools/binman/test/213_aml_encrypt.dts
> > >  create mode 100644 tools/binman/test/214_list_no_dtb.dts
> > >
> 
> Regards,
> SImon



[PATCH] boards: amlogic: switch LibreTech-CC v2 and WeTek Core2 to EE powerdomain

2023-03-26 Thread Christian Hewitt
The LibreTech-CC (LePotato) v2 and WeTek Core2 boards are still using
the older GX VPU powerdomain driver. Update their configs to use the
newer EE driver like other Amlogic boards [0].

[0] 
https://lore.kernel.org/all/20201106101901.2472557-5-narmstr...@baylibre.com/T/#u

Signed-off-by: Christian Hewitt 
---
 configs/libretech-cc_v2_defconfig | 2 +-
 configs/wetek-core2_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configs/libretech-cc_v2_defconfig 
b/configs/libretech-cc_v2_defconfig
index 30b1651554..ea71f055d9 100644
--- a/configs/libretech-cc_v2_defconfig
+++ b/configs/libretech-cc_v2_defconfig
@@ -51,7 +51,7 @@ CONFIG_MESON_GXL_USB_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_MESON_GXL=y
 CONFIG_POWER_DOMAIN=y
-CONFIG_MESON_GX_VPU_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_DEBUG_UART_SKIP_INIT=y
 CONFIG_MESON_SERIAL=y
diff --git a/configs/wetek-core2_defconfig b/configs/wetek-core2_defconfig
index f5149fc002..07d2587f77 100644
--- a/configs/wetek-core2_defconfig
+++ b/configs/wetek-core2_defconfig
@@ -44,7 +44,7 @@ CONFIG_MESON_GXL_USB_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_MESON_GXL=y
 CONFIG_POWER_DOMAIN=y
-CONFIG_MESON_GX_VPU_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
-- 
2.34.1



[PATCH v2 12/14] ARM: dts: add support for WeTek Hub and WeTek Play2

2023-03-23 Thread Christian Hewitt
Import the dts files from linux-amlogic/for-next (Linux 6.4-rc1) and
add the old PHY reset bindings for dwmac to the u-boot.dtsi until we
support the new bindings in the PHY node. Without this the PHY is not
functional in u-boot or Linux.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 arch/arm/dts/Makefile |   2 +
 arch/arm/dts/meson-gxbb-wetek-hub.dts |  58 +
 arch/arm/dts/meson-gxbb-wetek-play2.dts   | 119 +
 arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi |  13 +
 arch/arm/dts/meson-gxbb-wetek.dtsi| 292 ++
 5 files changed, 484 insertions(+)
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-hub.dts
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-play2.dts
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxbb-wetek.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 42da335bb5..1c843882d1 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -191,6 +191,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-gxbb-nanopi-k2.dtb \
meson-gxbb-p200.dtb \
meson-gxbb-p201.dtb \
+   meson-gxbb-wetek-hub.dtb \
+   meson-gxbb-wetek-play2.dtb \
meson-gxl-s805x-libretech-ac.dtb \
meson-gxl-s905d-libretech-pc.dtb \
meson-gxl-s905w-jethome-jethub-j80.dtb \
diff --git a/arch/arm/dts/meson-gxbb-wetek-hub.dts 
b/arch/arm/dts/meson-gxbb-wetek-hub.dts
new file mode 100644
index 00..58733017ed
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb-wetek-hub.dts
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Neil Armstrong 
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb-wetek.dtsi"
+#include 
+
+/ {
+   compatible = "wetek,hub", "amlogic,meson-gxbb";
+   model = "WeTek Hub";
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "WETEK-HUB";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   linux,rc-map-name = "rc-wetek-hub";
+};
diff --git a/arch/arm/dts/meson-gxbb-wetek-play2.dts 
b/arch/arm/dts/meson-gxbb-wetek-play2.dts
new file mode 100644
index 00..505ffcd8eb
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb-wetek-play2.dts
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Neil Armstrong 
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb-wetek.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "wetek,play2", "amlogic,meson-gxbb";
+   model = "WeTek Play 2";
+
+   spdif_dit: audio-codec-0 {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   status = "okay";
+   sound-name-prefix = "DIT";
+   };
+
+   leds {
+   led-wifi {
+   label = "wetek-play:wifi-status";
+   gpios = < GPIODV_26 GPIO_ACTIVE_HIGH>;
+   default-state = "off";
+   };
+
+   led-ethernet {
+   label = "wetek-play:ethernet-status";
+   gpios = < GPIODV_27 GPIO_ACTIVE_HIGH>;
+   default-state = "off";
+   };
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   poll-interval = <100>;
+
+   button {
+   label = "reset";
+   linux,code = ;
+   gpios = <_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+

[PATCH v2 09/14] ARM: dts: add support for Radxa Zero2

2023-03-23 Thread Christian Hewitt
Import the device-tree from linux-amlogic/for-next (Linux 6.4-rc1)
to support the Radxa-Zero2 board.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 arch/arm/dts/Makefile |   1 +
 .../dts/meson-g12b-radxa-zero2-u-boot.dtsi|   7 +
 arch/arm/dts/meson-g12b-radxa-zero2.dts   | 489 ++
 3 files changed, 497 insertions(+)
 create mode 100644 arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-radxa-zero2.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index eb20524a99..42da335bb5 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -214,6 +214,7 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-g12b-odroid-n2.dtb \
meson-g12b-odroid-n2l.dtb \
meson-g12b-odroid-n2-plus.dtb \
+   meson-g12b-radxa-zero2.dtb \
meson-sm1-bananapi-m2-pro.dtb \
meson-sm1-bananapi-m5.dtb \
meson-sm1-khadas-vim3l.dtb \
diff --git a/arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi 
b/arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi
new file mode 100644
index 00..236f2468dc
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Neil Armstrong 
+ */
+
+#include "meson-g12-common-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-g12b-radxa-zero2.dts 
b/arch/arm/dts/meson-g12b-radxa-zero2.dts
new file mode 100644
index 00..890f5bfebb
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-radxa-zero2.dts
@@ -0,0 +1,489 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ * Copyright (c) 2019 Christian Hewitt 
+ * Copyright (c) 2022 Radxa Limited
+ * Author: Yuntian Zhang 
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-a311d.dtsi"
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "radxa,zero2", "amlogic,a311d", "amlogic,g12b";
+   model = "Radxa Zero2";
+
+   aliases {
+   serial0 = _AO;
+   serial2 = _A;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x8000>;
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   poll-interval = <100>;
+   power-button {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_3 (GPIO_ACTIVE_LOW | 
GPIO_PULL_UP)>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-green {
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   gpios = < GPIOA_12 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   };
+   };
+
+   hdmi-connector {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <_tx_tmds_out>;
+   };
+   };
+   };
+
+   emmc_pwrseq: emmc-pwrseq {
+   compatible = "mmc-pwrseq-emmc";
+   reset-gpios = < BOOT_12 GPIO_ACTIVE_LOW>;
+   };
+
+   sdio_pwrseq: sdio-pwrseq {
+   compatible = "mmc-pwrseq-simple";
+   reset-gpios = < GPIOX_6 GPIO_ACTIVE_LOW>;
+   clocks = <>;
+   clock-names = "ext_clock";
+   };
+
+   ao_5v: regulator-ao-5v {
+   compatible = "regulator-fixed";
+   regulator-name = "AO_5V";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   regulator-always-on;
+   };
+
+   vcc_1v8: regulator-vcc-1v8 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_1V8";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   vin-supply = <_3v3>;
+   regulator-always-on;
+   };
+
+   vcc_3v3: regulator-vcc-3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <_3v3>;
+   regulator-always-on;
+   /* FIXME: actually controlled by VDDCPU_B_EN */

[PATCH v2 14/14] doc: boards: amlogic: add documentation for WeTek Hub and WeTek Play2

2023-03-23 Thread Christian Hewitt
Add build instructions for the WeTek Hub and WeTek Play2 boards.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/p200/MAINTAINERS|   2 +
 doc/board/amlogic/index.rst   |   2 +
 doc/board/amlogic/wetek-hub.rst   | 110 
 doc/board/amlogic/wetek-play2.rst | 115 ++
 4 files changed, 229 insertions(+)
 create mode 100644 doc/board/amlogic/wetek-hub.rst
 create mode 100644 doc/board/amlogic/wetek-play2.rst

diff --git a/board/amlogic/p200/MAINTAINERS b/board/amlogic/p200/MAINTAINERS
index 264218e3be..fe451dd7db 100644
--- a/board/amlogic/p200/MAINTAINERS
+++ b/board/amlogic/p200/MAINTAINERS
@@ -12,3 +12,5 @@ F:configs/wetek-play2_defconfig
 F: doc/board/amlogic/p200.rst
 F: doc/board/amlogic/nanopi-k2.rst
 F: doc/board/amlogic/odroid-c2.rst
+F:  doc/board/amlogic/wetek-hub.rst
+F:  doc/board/amlogic/wetek-play2.rst
diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index 71b7e1f3ed..deb7976436 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -118,4 +118,6 @@ Board Documentation
s400
u200
wetek-core2
+   wetek-hub
+   wetek-play2
w400
diff --git a/doc/board/amlogic/wetek-hub.rst b/doc/board/amlogic/wetek-hub.rst
new file mode 100644
index 00..378c6a6497
--- /dev/null
+++ b/doc/board/amlogic/wetek-hub.rst
@@ -0,0 +1,110 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for WeTek Hub (S905)
+===
+
+WeTek Hub is a small form-factor Android STB manufactured by WeTek with the 
following
+specification:
+
+ - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
+ - ARM Mali 450 GPU
+ - 1GB DDR3 SDRAM
+ - 8GB eMMC
+ - Gigabit Ethernet
+ - HDMI 2.0 4K/60Hz display
+ - 1x USB otg
+ - microSD
+ - UART jack
+ - Infrared receiver
+
+Schematics are not publicly available but have been shared privately to 
maintainers.
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make wetek-hub_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh wetek-hub /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image and WeTek has not publicly shared the U-Boot sources needed to build FIP 
binaries
+for signing. However you can download them from the amlogic-fip-repo.
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip/wetek-hub
+$ export FIPDIR=$PWD
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+
+$ cp $FIPDIR/bl2.bin fip/
+$ cp $FIPDIR/acs.bin fip/
+$ cp $FIPDIR/bl21.bin fip/
+$ cp $FIPDIR/bl30.bin fip/
+$ cp $FIPDIR/bl301.bin fip/
+$ cp $FIPDIR/bl31.img fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ $FIPDIR/blx_fix.sh \
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
+
+$ $FIPDIR/fip_create --bl30 fip/bl30_new.bin \
+ --bl31 fip/bl31.img \
+ --bl33 fip/bl33.bin \
+ fip/fip.bin
+
+$ sed -i 's/\x73\x02\x08\x91/\x1F\x20\x03\xD5/' fip/bl2.bin
+$ python3 $FIPDIR/acs_tool.py fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
+
+$ $FIPDIR/blx_fix.sh \
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
+
+$ cat fip/bl2_new.bin fip/fip.bin > fip/boot_new.bin
+
+$ $FIPDIR/aml_encrypt_gxb --bootsig \
+  --input fip/boot_new.bin
+  --output fip/u-boot.bin
+
+Then write U-Boot to SD or eMMC with:
+
+.. code-block:: bash
+
+$ DEV=/dev/boot_device
+$ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 conv=fsync
+$ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 seek=9 skip=8 
count=87 conv=fsync,notrunc
+$ dd if=/dev/zero of=fip/u-boot.bin.gxbb bs=512 seek=8 count=1 
conv=fsync,notrunc
+$ dd if=bl1.bin.hardkernel of=fip/u-boot.bin.gxbb bs=512 seek=2 skip=2 
count=1 conv=fsync,notrunc
+$ ./aml_chksum fip/u-boot.bin.gxbb
+$ dd if=fip/u-boot.gxbb of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+$ dd if=fip/u-boot.gxbb of=$DEV conv=fsync,notrunc bs=1 count=440
diff --git a/doc/board/amlogic/wetek-play2.rst 
b/doc/board/amlogic/wetek-play2.rst
new file mode 100644
index 00..cd7759f7f4
--- /dev/n

[PATCH v2 13/14] boards: amlogic: add WeTek Hub and WeTek Play2 defconfig

2023-03-23 Thread Christian Hewitt
Add configurations for the WeTek Hub and WeTek Play2 boards.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/p200/MAINTAINERS |  2 +
 configs/wetek-hub_defconfig| 70 ++
 configs/wetek-play2_defconfig  | 70 ++
 3 files changed, 142 insertions(+)
 create mode 100644 configs/wetek-hub_defconfig
 create mode 100644 configs/wetek-play2_defconfig

diff --git a/board/amlogic/p200/MAINTAINERS b/board/amlogic/p200/MAINTAINERS
index 33ca3df5c6..264218e3be 100644
--- a/board/amlogic/p200/MAINTAINERS
+++ b/board/amlogic/p200/MAINTAINERS
@@ -7,6 +7,8 @@ F:  board/amlogic/p200/
 F: configs/nanopi-k2_defconfig
 F: configs/odroid-c2_defconfig
 F: configs/p200_defconfig
+F: configs/wetek-hub_defconfig
+F: configs/wetek-play2_defconfig
 F: doc/board/amlogic/p200.rst
 F: doc/board/amlogic/nanopi-k2.rst
 F: doc/board/amlogic/odroid-c2.rst
diff --git a/configs/wetek-hub_defconfig b/configs/wetek-hub_defconfig
new file mode 100644
index 00..634833f7fe
--- /dev/null
+++ b/configs/wetek-hub_defconfig
@@ -0,0 +1,70 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" wetek-hub"
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-hub"
+CONFIG_DEBUG_UART=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_ADC=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SARADC_MESON=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_PHY=y
+CONFIG_MESON_GXBB_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_GXBB=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_SYSINFO=y
+CONFIG_SYSINFO_SMBIOS=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_DWC2=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/wetek-play2_defconfig b/configs/wetek-play2_defconfig
new file mode 100644
index 00..6d33b09a94
--- /dev/null
+++ b/configs/wetek-play2_defconfig
@@ -0,0 +1,70 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" wetek-play2"
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-play2"
+CONFIG_DEBUG_UART=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_ADC=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SARADC_MESON=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_PHY=y
+CONFIG_MESON_GXBB_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_GXBB=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_SYSINFO=y
+CONFIG_SYSINFO_SMBIOS=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_DWC2=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.34.1



[PATCH v2 11/14] doc: boards: amlogic: add documentation for Radxa Zero2

2023-03-23 Thread Christian Hewitt
Add build docs for the Radxa Zero2 board.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/w400/MAINTAINERS|  2 +
 doc/board/amlogic/index.rst   |  1 +
 doc/board/amlogic/radxa-zero2.rst | 80 +++
 3 files changed, 83 insertions(+)
 create mode 100644 doc/board/amlogic/radxa-zero2.rst

diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
index 042b523056..117f79ea04 100644
--- a/board/amlogic/w400/MAINTAINERS
+++ b/board/amlogic/w400/MAINTAINERS
@@ -5,6 +5,8 @@ L:  u-boot-amlo...@groups.io
 F: board/amlogic/w400/
 F: configs/bananapi-cm4-cm4io_defconfig
 F: configs/bananapi-m2s_defconfig
+F: configs/radxa-zero2_defconfig
 F: doc/board/amlogic/w400.rst
 F: doc/board/amlogic/bananapi-cm4io.rst
 F: doc/board/amlogic/bananapi-m2s.rst
+F: doc/board/amlogic/radxa-zero2.rst
diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index fa1b362731..71b7e1f3ed 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -112,6 +112,7 @@ Board Documentation
p212
q200
radxa-zero
+   radxa-zero2
sei510
sei610
s400
diff --git a/doc/board/amlogic/radxa-zero2.rst 
b/doc/board/amlogic/radxa-zero2.rst
new file mode 100644
index 00..dccf592459
--- /dev/null
+++ b/doc/board/amlogic/radxa-zero2.rst
@@ -0,0 +1,80 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for Radxa Zero2 (A311D)
+==
+
+Radxa Zero2 is a small form factor SBC based on the Amlogic A311D chipset with 
the
+following specification:
+
+- Amlogic A311D (Quad A73 + Dual A53) CPU
+- 4GB LPDDR4 RAM
+- 32/64/128GB eMMC
+- Mali G52-MP4 GPU
+- HDMI 2.1 output (micro)
+- BCM4345 WiFi (2.4/5GHz a/b/g/n/ac) and BT 5.0
+- 1x USB 2.0 port - Type C (OTG)
+- 1x USB 3.0 port - Type C (Host)
+- 1x micro SD Card slot
+- 40 Pin GPIO header
+
+Schematics are available on request from Radxa.
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make radxa-zero2_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh radxa-zero2 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
+
+.. code-block:: bash
+
+$ git clone -b radxa-zero-v2021.07 https://github.com/radxa/u-boot.git
+$ git clone https://github.com/radxa/fip.git
+
+$ sudo apt-get install -y gcc-aarch64-linux-gnu device-tree-compiler 
libncurses5 libncurses5-dev
+$ sudo apt-get install -y bc python dosfstools flex build-essential 
libssl-dev mtools
+
+$ wget 
https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
+$ sudo tar xvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz -C /opt
+
+$ export 
CROSS_COMPILE=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
+$ export ARCH=arm
+$ cd u-boot
+$ make radxa-zero2_defconfig
+$ make
+
+$ cp u-boot.bin ../fip/radxa-zero2/bl33.bin
+$ cd ../fip/radxa-zero2
+$ make
+
+This will generate the signed U-Boot binaries:
+
+.. code-block:: bash
+
+$ u-boot.bin u-boot.bin.sd.bin u-boot.bin.usb.bl2 u-boot.bin.usb.tpl
+
+Then write U-Boot to SD or eMMC with:
+
+.. code-block:: bash
+
+$ DEV=/dev/boot_device
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH v2 10/14] boards: amlogic: add Radxa Zero2 defconfig

2023-03-23 Thread Christian Hewitt
Add board configuration for the Radxa Zero2.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 configs/radxa-zero2_defconfig | 77 +++
 1 file changed, 77 insertions(+)
 create mode 100644 configs/radxa-zero2_defconfig

diff --git a/configs/radxa-zero2_defconfig b/configs/radxa-zero2_defconfig
new file mode 100644
index 00..2218b0db7d
--- /dev/null
+++ b/configs/radxa-zero2_defconfig
@@ -0,0 +1,77 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-radxa-zero2"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" radxa-zero2"
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_DEBUG_UART=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_REMAKE_ELF=y
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_SYS_MAXARGS=32
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+# CONFIG_PHY_REALTEK is not set
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+# CONFIG_ETH_DESIGNWARE_MESON8B is not set
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.34.1



[PATCH v2 08/14] docs: boards: amlogic: add documentation for BananaPi M2S

2023-03-23 Thread Christian Hewitt
Add build docs for the BPI-M2S board.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/w400/MAINTAINERS |   2 +
 doc/board/amlogic/bananapi-m2s.rst | 153 +
 doc/board/amlogic/index.rst|   1 +
 3 files changed, 156 insertions(+)
 create mode 100644 doc/board/amlogic/bananapi-m2s.rst

diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
index 26a4c2c587..042b523056 100644
--- a/board/amlogic/w400/MAINTAINERS
+++ b/board/amlogic/w400/MAINTAINERS
@@ -4,5 +4,7 @@ S:  Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/w400/
 F: configs/bananapi-cm4-cm4io_defconfig
+F: configs/bananapi-m2s_defconfig
 F: doc/board/amlogic/w400.rst
 F: doc/board/amlogic/bananapi-cm4io.rst
+F: doc/board/amlogic/bananapi-m2s.rst
diff --git a/doc/board/amlogic/bananapi-m2s.rst 
b/doc/board/amlogic/bananapi-m2s.rst
new file mode 100644
index 00..4a1be47b35
--- /dev/null
+++ b/doc/board/amlogic/bananapi-m2s.rst
@@ -0,0 +1,153 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for BananaPi M2S (A311D & S922X)
+===
+
+BananaPi BPI-M2S ships is a Single Board Computer manufactured by Sinovoip 
that ships in
+two variants with Amlogic S922X or A311D SoC and the following common 
specification:
+
+- 16GB eMMC
+- HDMI 2.1a video
+- 2x 10/100/1000 Base-T Ethernet (1x RTL8211F, 1x RTL811H)
+- 2x USB 2.0 ports
+- 2x Status LED's (green/blue)
+- 1x Power/Reset button
+- 1x micro SD card slot
+- 40-pin GPIO header
+- PWM fan header
+- UART header
+
+The S992X variant has:
+- 2GB LPDDR4 RAM
+
+The A311D variant has:
+
+- 4GB LPDDR4 RAM
+- NPU (5.0 TOPS)
+- MIPI DSI header
+- MIPI CSI header
+
+An optional RTL8822CS SDIO WiFi/BT mezzanine is available for both board 
variants.
+
+Schematics are available from the manufacturer: 
https://wiki.banana-pi.org/Banana_Pi_BPI-M2S
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make bananapi-m2s_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh bananapi-m2s /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
+
+.. code-block:: bash
+
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+$ DIR=bananapi-m2s
+$ git clone --depth 1 https://github.com/Dangku/amlogic-u-boot.git -b 
khadas-g12b-v2015.01-m2s $DIR
+
+$ cd $DIR
+$ make bananapi_m2s_defconfig
+$ make
+$ export UBDIR=$PWD
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+
+$ wget 
https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh
 -O fip/blx_fix.sh
+$ cp $UBDIR/build/scp_task/bl301.bin fip/
+$ cp $UBDIR/build/board/bananapi/bananpi_m2s/firmware/acs.bin fip/
+$ cp $UBDIR/fip/g12a/bl2.bin fip/
+$ cp $UBDIR/fip/g12a/bl30.bin fip/
+$ cp $UBDIR/fip/g12a/bl31.img fip/
+$ cp $UBDIR/fip/g12a/ddr3_1d.fw fip/
+$ cp $UBDIR/fip/g12a/ddr4_1d.fw fip/
+$ cp $UBDIR/fip/g12a/ddr4_2d.fw fip/
+$ cp $UBDIR/fip/g12a/diag_lpddr4.fw fip/
+$ cp $UBDIR/fip/g12a/lpddr3_1d.fw fip/
+$ cp $UBDIR/fip/g12a/lpddr4_1d.fw fip/
+$ cp $UBDIR/fip/g12a/lpddr4_2d.fw fip/
+$ cp $UBDIR/fip/g12a/piei.fw fip/
+$ cp $UBDIR/fip/g12a/aml_ddr.fw fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ sh fip/blx_fix.sh \
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
+
+$ sh fip/blx_fix.sh \
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
+
+$ $UBDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+   --output fip/bl30_new.bin.g12a.enc \
+   --level v3
+$ $UBDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input 
fip/bl30_new.bin.g12a

[PATCH v2 06/14] ARM: dts: add support for BananaPi M2S

2023-03-23 Thread Christian Hewitt
Import the device-tree from linux-amlogic/for-next (Linux 6.4-rc1)
and omit the NPU node from the A311D board variant dts as this is
not supported under U-Boot.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 arch/arm/dts/Makefile |   1 +
 .../arm/dts/meson-g12b-a311d-bananapi-m2s.dts |  33 ++
 arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi  |   7 +
 arch/arm/dts/meson-g12b-bananapi.dtsi | 521 ++
 .../arm/dts/meson-g12b-s922x-bananapi-m2s.dts |  14 +
 5 files changed, 576 insertions(+)
 create mode 100644 arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts
 create mode 100644 arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-bananapi.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-s922x-bananapi-m2s.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d6139429e5..eb20524a99 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -204,6 +204,7 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-g12a-radxa-zero.dtb \
meson-g12a-sei510.dtb \
meson-g12a-u200.dtb \
+   meson-g12b-a311d-bananapi-m2s.dtb \
meson-g12b-a311d-khadas-vim3.dtb \
meson-g12b-bananapi-cm4-cm4io.dtb \
meson-g12b-gsking-x.dtb \
diff --git a/arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts 
b/arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts
new file mode 100644
index 00..31365316b2
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-a311d.dtsi"
+#include "meson-g12b-bananapi.dtsi"
+
+/ {
+   compatible = "bananapi,bpi-m2s", "amlogic,a311d", "amlogic,g12b";
+   model = "BananaPi M2S";
+
+   aliases {
+   i2c0 = 
+   i2c1 = 
+   };
+};
+
+/* Camera (CSI) bus */
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_h6_pins>, <_sck_h7_pins>;
+   pinctrl-names = "default";
+};
+
+/* Display (DSI) bus */
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_a_pins>, <_sck_a_pins>;
+   pinctrl-names = "default";
+};
diff --git a/arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi 
b/arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi
new file mode 100644
index 00..236f2468dc
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Neil Armstrong 
+ */
+
+#include "meson-g12-common-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-g12b-bananapi.dtsi 
b/arch/arm/dts/meson-g12b-bananapi.dtsi
new file mode 100644
index 00..83709787eb
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-bananapi.dtsi
@@ -0,0 +1,521 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ * Copyright (c) 2023 Christian Hewitt 
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   aliases {
+   serial0 = _AO;
+   ethernet0 = 
+   rtc1 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x8000>; /* 2 GiB or 4 GiB */
+   };
+
+   adc-keys {
+   compatible = "adc-keys";
+   io-channels = < 2>;
+   io-channel-names = "buttons";
+   keyup-threshold-microvolt = <171>;
+
+   button-function {
+   label = "RST";
+   linux,code = ;
+   press-threshold-microvolt = <1>;
+   };
+   };
+
+   emmc_pwrseq: emmc-pwrseq {
+   compatible = "mmc-pwrseq-emmc";
+   reset-gpios = < BOOT_12 GPIO_ACTIVE_LOW>;
+   };
+
+   fan0: pwm-fan {
+   compatible = "pwm-fan";
+   #cooling-cells = <2>;
+   cooling-min-state = <0>;
+   cooling-max-state = <3>;
+   cooling-levels = <0 120 170 220>;
+   pwms = <_cd 1 4 0>;
+   };
+
+   hdmi-connector {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <_tx_tmds_out>;
+   };
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-0 {
+   color = ;
+   function = LED_FUNCTION_STATUS;
+

[PATCH v2 05/14] docs: boards: amlogic: add documentation for BananaPi M2-Pro

2023-03-23 Thread Christian Hewitt
Add build docs for the BPI-M2-PRO board.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/u200/MAINTAINERS   |   2 +
 doc/board/amlogic/bananapi-m2pro.rst | 143 +++
 doc/board/amlogic/index.rst  |   1 +
 3 files changed, 146 insertions(+)
 create mode 100644 doc/board/amlogic/bananapi-m2pro.rst

diff --git a/board/amlogic/u200/MAINTAINERS b/board/amlogic/u200/MAINTAINERS
index 919e349922..f429c212ba 100644
--- a/board/amlogic/u200/MAINTAINERS
+++ b/board/amlogic/u200/MAINTAINERS
@@ -4,8 +4,10 @@ S: Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/u200/
 F: configs/u200_defconfig
+F: configs/bananapi-m2pro_defconfig
 F: configs/bananapi-m5_defconfig
 F: configs/radxa-zero_defconfig
 F: doc/board/amlogic/u200.rst
+F: doc/board/amlogic/bananapi-m2pro.rst
 F: doc/board/amlogic/bananapi-m5.rst
 F: doc/board/amlogic/radxa-zero.rst
diff --git a/doc/board/amlogic/bananapi-m2pro.rst 
b/doc/board/amlogic/bananapi-m2pro.rst
new file mode 100644
index 00..6c35943bac
--- /dev/null
+++ b/doc/board/amlogic/bananapi-m2pro.rst
@@ -0,0 +1,143 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for BananaPi BPI-M2-PRO (S905X3)
+===
+
+BananaPi BPI-M2-PRO is a Single Board Computer manufactured by Sinovoip with 
the
+following specification:
+
+ - Amlogic S905X3 Arm Cortex-A55 quad-core SoC
+ - 2GB DDR4 SDRAM
+ - 16GB eMMC
+ - Gigabit Ethernet
+ - RTL8821CU USB WiFi (a/b/g/n/ac) + BT 5.0
+ - HDMI 2.1 display
+ - 40-pin GPIO header
+ - 2x USB 3.0 Host
+ - 1x DC Jack (power)
+ - microSD
+ - UART serial
+ - Infrared receiver
+
+Schematics are available from the manufacturer: 
https://wiki.banana-pi.org/Banana_Pi_BPI-M2_Pro
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make bananapi-m2pro_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh bananapi-m2pro /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
+
+.. code-block:: bash
+
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+$ DIR=bananapi-m2pro
+$ git clone --depth 1 https://github.com/Dangku/amlogic-u-boot.git -b 
odroidg12-v2015.01-c4-m5 $DIR
+
+$ cd $DIR
+$ make bananapi_m2pro_defconfig
+$ make
+$ export UBOOTDIR=$PWD
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+
+$ wget 
https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh
 -O fip/blx_fix.sh
+$ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+$ cp $UBOOTDIR/build/board/bananapi/bananpi_m5/firmware/acs.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl2.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl30.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl31.img fip/
+$ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/piei.fw fip/
+$ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ sh fip/blx_fix.sh \
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
+
+$ sh fip/blx_fix.sh \
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
+
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
+  --output fip/bl30_new.bin.g12a.enc \
+  --level v3
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input 
fip/bl30_new.bin.g12a.enc \
+  --output fip/bl30_new.bin.enc

[PATCH v2 07/14] boards: add BananaPi M2S defconfig

2023-03-23 Thread Christian Hewitt
Add configuration for the Bananapi BPI-M2S.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 configs/bananapi-m2s_defconfig | 82 ++
 1 file changed, 82 insertions(+)
 create mode 100644 configs/bananapi-m2s_defconfig

diff --git a/configs/bananapi-m2s_defconfig b/configs/bananapi-m2s_defconfig
new file mode 100644
index 00..3109e0ce48
--- /dev/null
+++ b/configs/bananapi-m2s_defconfig
@@ -0,0 +1,82 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-a311d-bananapi-m2s"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" bpi-m2s"
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_DEBUG_UART=y
+CONFIG_AHCI=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_REMAKE_ELF=y
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_SYS_MAXARGS=32
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_AHCI_PCI=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_PCI=y
+CONFIG_PCIE_DW_MESON=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.34.1



[PATCH v2 04/14] boards: add BananaPi M2-Pro defconfig

2023-03-23 Thread Christian Hewitt
Add configuration for the BananaPi M2-Pro board.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 configs/bananapi-m2-pro_defconfig | 76 +++
 1 file changed, 76 insertions(+)
 create mode 100644 configs/bananapi-m2-pro_defconfig

diff --git a/configs/bananapi-m2-pro_defconfig 
b/configs/bananapi-m2-pro_defconfig
new file mode 100644
index 00..28b603fe20
--- /dev/null
+++ b/configs/bananapi-m2-pro_defconfig
@@ -0,0 +1,76 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-sm1-bananapi-m2-pro"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING="bpi-m2-pro"
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_DEBUG_UART=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_REMAKE_ELF=y
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_SYS_MAXARGS=32
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.34.1



[PATCH v2 03/14] ARM: dts: add support for BananaPi M2-Pro

2023-03-23 Thread Christian Hewitt
Import the board dts from the linux-amlogic/for-next (6.4-rc1)
branch. This involves spliting the BPI-M5 dts into a dtsi and
then reusing this for the M2-Pro.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 arch/arm/dts/Makefile |   5 +-
 .../dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi |  14 +
 arch/arm/dts/meson-sm1-bananapi-m2-pro.dts|  97 
 arch/arm/dts/meson-sm1-bananapi-m5.dts| 427 +
 arch/arm/dts/meson-sm1-bananapi.dtsi  | 435 ++
 5 files changed, 550 insertions(+), 428 deletions(-)
 create mode 100644 arch/arm/dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-sm1-bananapi-m2-pro.dts
 create mode 100644 arch/arm/dts/meson-sm1-bananapi.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 0c149b636a..d6139429e5 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -205,14 +205,15 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-g12a-sei510.dtb \
meson-g12a-u200.dtb \
meson-g12b-a311d-khadas-vim3.dtb \
+   meson-g12b-bananapi-cm4-cm4io.dtb \
+   meson-g12b-gsking-x.dtb \
meson-g12b-gtking.dtb \
meson-g12b-gtking-pro.dtb \
-   meson-g12b-gsking-x.dtb \
meson-g12b-odroid-go-ultra.dtb \
meson-g12b-odroid-n2.dtb \
meson-g12b-odroid-n2l.dtb \
meson-g12b-odroid-n2-plus.dtb \
-   meson-g12b-bananapi-cm4-cm4io.dtb \
+   meson-sm1-bananapi-m2-pro.dtb \
meson-sm1-bananapi-m5.dtb \
meson-sm1-khadas-vim3l.dtb \
meson-sm1-odroid-c4.dtb \
diff --git a/arch/arm/dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi 
b/arch/arm/dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi
new file mode 100644
index 00..4a1aeda565
--- /dev/null
+++ b/arch/arm/dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi
@@ -0,0 +1,14 @@
+
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 BayLibre, SAS
+ * Author: Neil Armstrong 
+ */
+
+#include "meson-sm1-u-boot.dtsi"
+
+ {
+   snps,reset-gpio = < GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
+   snps,reset-delays-us = <0 1 100>;
+   snps,reset-active-low;
+};
diff --git a/arch/arm/dts/meson-sm1-bananapi-m2-pro.dts 
b/arch/arm/dts/meson-sm1-bananapi-m2-pro.dts
new file mode 100644
index 00..586034316e
--- /dev/null
+++ b/arch/arm/dts/meson-sm1-bananapi-m2-pro.dts
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 BayLibre SAS
+ * Author: Neil Armstrong 
+ */
+
+/dts-v1/;
+
+#include "meson-sm1-bananapi.dtsi"
+#include 
+
+/ {
+   compatible = "bananapi,bpi-m2-pro", "amlogic,sm1";
+   model = "Banana Pi BPI-M2-PRO";
+
+   sound {
+   compatible = "amlogic,axg-sound-card";
+   model = "BPI-M2-PRO";
+   audio-aux-devs = <_b>;
+   audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
+   "TDMOUT_B IN 1", "FRDDR_B OUT 1",
+   "TDMOUT_B IN 2", "FRDDR_C OUT 1",
+   "TDM_B Playback", "TDMOUT_B OUT";
+
+   assigned-clocks = < CLKID_MPLL2>,
+ < CLKID_MPLL0>,
+ < CLKID_MPLL1>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+
+   dai-link-0 {
+   sound-dai = <_a>;
+   };
+
+   dai-link-1 {
+   sound-dai = <_b>;
+   };
+
+   dai-link-2 {
+   sound-dai = <_c>;
+   };
+
+   /* 8ch hdmi interface */
+   dai-link-3 {
+   sound-dai = <_b>;
+   dai-format = "i2s";
+   dai-tdm-slot-tx-mask-0 = <1 1>;
+   dai-tdm-slot-tx-mask-1 = <1 1>;
+   dai-tdm-slot-tx-mask-2 = <1 1>;
+   dai-tdm-slot-tx-mask-3 = <1 1>;
+   mclk-fs = <256>;
+
+   codec {
+   sound-dai = < TOHDMITX_I2S_IN_B>;
+   };
+   };
+
+   /* hdmi glue */
+   dai-link-4 {
+   sound-dai = < TOHDMITX_I2S_OUT>;
+
+   codec {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+_audio {
+   status = "okay";
+};
+
+_a {
+   status = "okay

[PATCH v2 02/14] docs: boards: amlogic: fix blank-line typo in recently updated docs

2023-03-23 Thread Christian Hewitt
There needs to be a blank line between the start of the code block
and the first line of content. Fix for all recently updated docs.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/bananapi-cm4io.rst| 1 +
 doc/board/amlogic/bananapi-m5.rst   | 1 +
 doc/board/amlogic/beelink-gskingx.rst   | 1 +
 doc/board/amlogic/beelink-gtking.rst| 1 +
 doc/board/amlogic/beelink-gtkingpro.rst | 1 +
 doc/board/amlogic/jethub-j100.rst   | 1 +
 doc/board/amlogic/jethub-j80.rst| 1 +
 doc/board/amlogic/khadas-vim.rst| 1 +
 doc/board/amlogic/khadas-vim2.rst   | 1 +
 doc/board/amlogic/khadas-vim3.rst   | 1 +
 doc/board/amlogic/khadas-vim3l.rst  | 1 +
 doc/board/amlogic/libretech-ac.rst  | 1 +
 doc/board/amlogic/libretech-cc.rst  | 1 +
 doc/board/amlogic/nanopi-k2.rst | 1 +
 doc/board/amlogic/odroid-c2.rst | 1 +
 doc/board/amlogic/odroid-c4.rst | 1 +
 doc/board/amlogic/odroid-go-ultra.rst   | 1 +
 doc/board/amlogic/odroid-hc4.rst| 1 +
 doc/board/amlogic/odroid-n2.rst | 1 +
 doc/board/amlogic/odroid-n2l.rst| 1 +
 doc/board/amlogic/p200.rst  | 1 +
 doc/board/amlogic/p201.rst  | 1 +
 doc/board/amlogic/q200.rst  | 1 +
 doc/board/amlogic/radxa-zero.rst| 1 +
 doc/board/amlogic/s400.rst  | 1 +
 doc/board/amlogic/sei510.rst| 1 +
 doc/board/amlogic/sei610.rst| 1 +
 doc/board/amlogic/u200.rst  | 1 +
 doc/board/amlogic/w400.rst  | 1 +
 doc/board/amlogic/wetek-core2.rst   | 1 +
 30 files changed, 30 insertions(+)

diff --git a/doc/board/amlogic/bananapi-cm4io.rst 
b/doc/board/amlogic/bananapi-cm4io.rst
index aabe2ef197..672cbee7d8 100644
--- a/doc/board/amlogic/bananapi-cm4io.rst
+++ b/doc/board/amlogic/bananapi-cm4io.rst
@@ -44,6 +44,7 @@ U-Boot Signing with Pre-Built FIP repo
 --
 
 .. code-block:: bash
+
 $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
 $ cd amlogic-boot-fip
 $ mkdir my-output-dir
diff --git a/doc/board/amlogic/bananapi-m5.rst 
b/doc/board/amlogic/bananapi-m5.rst
index ddc14b4eef..009ea0ba94 100644
--- a/doc/board/amlogic/bananapi-m5.rst
+++ b/doc/board/amlogic/bananapi-m5.rst
@@ -33,6 +33,7 @@ U-Boot Signing with Pre-Built FIP repo
 --
 
 .. code-block:: bash
+
 $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
 $ cd amlogic-boot-fip
 $ mkdir my-output-dir
diff --git a/doc/board/amlogic/beelink-gskingx.rst 
b/doc/board/amlogic/beelink-gskingx.rst
index 987d358c77..8a8296e863 100644
--- a/doc/board/amlogic/beelink-gskingx.rst
+++ b/doc/board/amlogic/beelink-gskingx.rst
@@ -38,6 +38,7 @@ U-Boot Signing with Pre-Built FIP repo
 --
 
 .. code-block:: bash
+
 $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
 $ cd amlogic-boot-fip
 $ mkdir my-output-dir
diff --git a/doc/board/amlogic/beelink-gtking.rst 
b/doc/board/amlogic/beelink-gtking.rst
index 342887d584..8171b698c7 100644
--- a/doc/board/amlogic/beelink-gtking.rst
+++ b/doc/board/amlogic/beelink-gtking.rst
@@ -34,6 +34,7 @@ U-Boot Signing with Pre-Built FIP repo
 --
 
 .. code-block:: bash
+
 $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
 $ cd amlogic-boot-fip
 $ mkdir my-output-dir
diff --git a/doc/board/amlogic/beelink-gtkingpro.rst 
b/doc/board/amlogic/beelink-gtkingpro.rst
index 541938b103..eb0b7d4fd1 100644
--- a/doc/board/amlogic/beelink-gtkingpro.rst
+++ b/doc/board/amlogic/beelink-gtkingpro.rst
@@ -35,6 +35,7 @@ U-Boot Signing with Pre-Built FIP repo
 --
 
 .. code-block:: bash
+
 $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
 $ cd amlogic-boot-fip
 $ mkdir my-output-dir
diff --git a/doc/board/amlogic/jethub-j100.rst 
b/doc/board/amlogic/jethub-j100.rst
index 0d63976789..86acdafa06 100644
--- a/doc/board/amlogic/jethub-j100.rst
+++ b/doc/board/amlogic/jethub-j100.rst
@@ -42,6 +42,7 @@ U-Boot Signing with Pre-Built FIP repo
 --
 
 .. code-block:: bash
+
 $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
 $ cd amlogic-boot-fip
 $ mkdir my-output-dir
diff --git a/doc/board/amlogic/jethub-j80.rst b/doc/board/amlogic/jethub-j80.rst
index d20fbad4c5..9195df6905 100644
--- a/doc/board/amlogic/jethub-j80.rst
+++ b/doc/board/amlogic/jethub-j80.rst
@@ -34,6 +34,7 @@ U-Boot Signing with Pre-Built FIP repo
 --
 
 .. code-block:: bash
+
 $ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
 $ cd amlogic-boot-fip
 $ mkdir my-output-dir
diff --git a/doc/board/amlogic/khadas-vim.rst b/doc/board/amlogic/khadas-vim.rst
index f1fbe1a8a6..20370ed49a 100644
--- a/doc/board/amlogic/khadas-vim.rst
+++ b/doc/board

[PATCH v2 01/14] docs: boards: amlogic: add bananapi-m5 to u200 maintainer file

2023-03-23 Thread Christian Hewitt
The bananapi-m5 docs are missing from the file, so add them.

Signed-off-by: Christian Hewitt 
Reviewed-by: Neil Armstrong 
---
 board/amlogic/u200/MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/amlogic/u200/MAINTAINERS b/board/amlogic/u200/MAINTAINERS
index 47cec234a1..919e349922 100644
--- a/board/amlogic/u200/MAINTAINERS
+++ b/board/amlogic/u200/MAINTAINERS
@@ -7,4 +7,5 @@ F:  configs/u200_defconfig
 F: configs/bananapi-m5_defconfig
 F: configs/radxa-zero_defconfig
 F: doc/board/amlogic/u200.rst
+F: doc/board/amlogic/bananapi-m5.rst
 F: doc/board/amlogic/radxa-zero.rst
-- 
2.34.1



[PATCH v2 00/14] boards: amlogic: add BananaPi/Radxa/WeTek boards

2023-03-23 Thread Christian Hewitt
This series adds support for the following boards which are
tested and booting fine with 2023.04-rc4:

- BananaPi M2-Pro (S905X3)
- BananaPi M2S (A311D or S922X)
- Radxa Zero2 (A311D)
- WeTek Hub (S905)
- WeTek Play2 (S905)

I also spotted that bananapi-m5 wasn't referrences in the u200
maintainer file so there's a patch to correct that too.

Changes since v1:
- Add reviews on M2-Pro/M2S/Zero2 dts/config patches
- Add a patch to correct a missing blank line in recently updated docs
- Fix commit message for Hub/Play2 config patch

Christian Hewitt (14):
  docs: boards: amlogic: add bananapi-m5 to u200 maintainer file
  docs: boards: amlogic: fix blank-line typo in recently updated docs
  ARM: dts: add support for BananaPi M2-Pro
  boards: add BananaPi M2-Pro defconfig
  docs: boards: amlogic: add documentation for BananaPi M2-Pro
  ARM: dts: add support for BananaPi M2S
  boards: add BananaPi M2S defconfig
  docs: boards: amlogic: add documentation for BananaPi M2S
  ARM: dts: add support for Radxa Zero2
  boards: amlogic: add Radxa Zero2 defconfig
  doc: boards: amlogic: add documentation for Radxa Zero2
  ARM: dts: add support for WeTek Hub and WeTek Play2
  boards: amlogic: add WeTek Hub and WeTek Play2 defconfig
  doc: boards: amlogic: add documentation for WeTek Hub and WeTek Play2

 arch/arm/dts/Makefile |   9 +-
 .../arm/dts/meson-g12b-a311d-bananapi-m2s.dts |  33 ++
 arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi  |   7 +
 arch/arm/dts/meson-g12b-bananapi.dtsi | 521 ++
 .../dts/meson-g12b-radxa-zero2-u-boot.dtsi|   7 +
 arch/arm/dts/meson-g12b-radxa-zero2.dts   | 489 
 .../arm/dts/meson-g12b-s922x-bananapi-m2s.dts |  14 +
 arch/arm/dts/meson-gxbb-wetek-hub.dts |  58 ++
 arch/arm/dts/meson-gxbb-wetek-play2.dts   | 119 
 arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi |  13 +
 arch/arm/dts/meson-gxbb-wetek.dtsi| 292 ++
 .../dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi |  14 +
 arch/arm/dts/meson-sm1-bananapi-m2-pro.dts|  97 
 arch/arm/dts/meson-sm1-bananapi-m5.dts| 427 +-
 arch/arm/dts/meson-sm1-bananapi.dtsi  | 435 +++
 board/amlogic/p200/MAINTAINERS|   4 +
 board/amlogic/u200/MAINTAINERS|   3 +
 board/amlogic/w400/MAINTAINERS|   4 +
 configs/bananapi-m2-pro_defconfig |  76 +++
 configs/bananapi-m2s_defconfig|  82 +++
 configs/radxa-zero2_defconfig |  77 +++
 configs/wetek-hub_defconfig   |  70 +++
 configs/wetek-play2_defconfig |  70 +++
 doc/board/amlogic/bananapi-cm4io.rst  |   1 +
 doc/board/amlogic/bananapi-m2pro.rst  | 143 +
 doc/board/amlogic/bananapi-m2s.rst| 153 +
 doc/board/amlogic/bananapi-m5.rst |   1 +
 doc/board/amlogic/beelink-gskingx.rst |   1 +
 doc/board/amlogic/beelink-gtking.rst  |   1 +
 doc/board/amlogic/beelink-gtkingpro.rst   |   1 +
 doc/board/amlogic/index.rst   |   5 +
 doc/board/amlogic/jethub-j100.rst |   1 +
 doc/board/amlogic/jethub-j80.rst  |   1 +
 doc/board/amlogic/khadas-vim.rst  |   1 +
 doc/board/amlogic/khadas-vim2.rst |   1 +
 doc/board/amlogic/khadas-vim3.rst |   1 +
 doc/board/amlogic/khadas-vim3l.rst|   1 +
 doc/board/amlogic/libretech-ac.rst|   1 +
 doc/board/amlogic/libretech-cc.rst|   1 +
 doc/board/amlogic/nanopi-k2.rst   |   1 +
 doc/board/amlogic/odroid-c2.rst   |   1 +
 doc/board/amlogic/odroid-c4.rst   |   1 +
 doc/board/amlogic/odroid-go-ultra.rst |   1 +
 doc/board/amlogic/odroid-hc4.rst  |   1 +
 doc/board/amlogic/odroid-n2.rst   |   1 +
 doc/board/amlogic/odroid-n2l.rst  |   1 +
 doc/board/amlogic/p200.rst|   1 +
 doc/board/amlogic/p201.rst|   1 +
 doc/board/amlogic/q200.rst|   1 +
 doc/board/amlogic/radxa-zero.rst  |   1 +
 doc/board/amlogic/radxa-zero2.rst |  80 +++
 doc/board/amlogic/s400.rst|   1 +
 doc/board/amlogic/sei510.rst  |   1 +
 doc/board/amlogic/sei610.rst  |   1 +
 doc/board/amlogic/u200.rst|   1 +
 doc/board/amlogic/w400.rst|   1 +
 doc/board/amlogic/wetek-core2.rst |   1 +
 doc/board/amlogic/wetek-hub.rst   | 110 
 doc/board/amlogic/wetek-play2.rst | 115 
 59 files changed, 3129 insertions(+), 428 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts
 create mode 100644 arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-bananapi.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi
 create mode 100644 arch/arm

Re: [PATCH 12/13] boards: amlogic: add WeTek Hub and WeTek Play2 defconfig

2023-03-23 Thread Christian Hewitt



> On 23 Mar 2023, at 10:54 am, Christian Hewitt via groups.io 
>  wrote:
> 
> Add configurations for the WeTek Hub and WeTek Play2 boards along
> with files for the wetek-gxbb board family to ensure the ethernet
> MAC is correctly discovered. Set myself as the maintainer for the
> board family.

^ should read just "Add configurations for the WeTek Hub and WeTek Play2
boards” as the board-family changes were dropped (not needed). I can
send a v2 for this patch alone (or would you prefer the series?)

Christian

> 
> Signed-off-by: Christian Hewitt 
> ---
> board/amlogic/p200/MAINTAINERS |  2 +
> configs/wetek-hub_defconfig| 70 ++
> configs/wetek-play2_defconfig  | 70 ++
> 3 files changed, 142 insertions(+)
> create mode 100644 configs/wetek-hub_defconfig
> create mode 100644 configs/wetek-play2_defconfig
> 
> diff --git a/board/amlogic/p200/MAINTAINERS b/board/amlogic/p200/MAINTAINERS
> index 33ca3df5c6..264218e3be 100644
> --- a/board/amlogic/p200/MAINTAINERS
> +++ b/board/amlogic/p200/MAINTAINERS
> @@ -7,6 +7,8 @@ F:board/amlogic/p200/
> F:configs/nanopi-k2_defconfig
> F:configs/odroid-c2_defconfig
> F:configs/p200_defconfig
> +F:   configs/wetek-hub_defconfig
> +F:   configs/wetek-play2_defconfig
> F:doc/board/amlogic/p200.rst
> F:doc/board/amlogic/nanopi-k2.rst
> F:doc/board/amlogic/odroid-c2.rst
> diff --git a/configs/wetek-hub_defconfig b/configs/wetek-hub_defconfig
> new file mode 100644
> index 00..634833f7fe
> --- /dev/null
> +++ b/configs/wetek-hub_defconfig
> @@ -0,0 +1,70 @@
> +CONFIG_ARM=y
> +CONFIG_ARCH_MESON=y
> +CONFIG_TEXT_BASE=0x0100
> +CONFIG_SYS_LOAD_ADDR=0x100
> +CONFIG_NR_DRAM_BANKS=1
> +CONFIG_ENV_SIZE=0x2000
> +CONFIG_DM_GPIO=y
> +CONFIG_DEBUG_UART_BASE=0xc81004c0
> +CONFIG_DEBUG_UART_CLOCK=2400
> +CONFIG_IDENT_STRING=" wetek-hub"
> +CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-hub"
> +CONFIG_DEBUG_UART=y
> +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
> +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
> +CONFIG_OF_BOARD_SETUP=y
> +# CONFIG_DISPLAY_CPUINFO is not set
> +CONFIG_MISC_INIT_R=y
> +# CONFIG_CMD_BDI is not set
> +# CONFIG_CMD_IMI is not set
> +CONFIG_CMD_ADC=y
> +CONFIG_CMD_GPIO=y
> +CONFIG_CMD_I2C=y
> +# CONFIG_CMD_LOADS is not set
> +CONFIG_CMD_MMC=y
> +CONFIG_CMD_USB=y
> +# CONFIG_CMD_SETEXPR is not set
> +CONFIG_CMD_REGULATOR=y
> +CONFIG_OF_CONTROL=y
> +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> +CONFIG_NET_RANDOM_ETHADDR=y
> +CONFIG_SARADC_MESON=y
> +CONFIG_DM_I2C=y
> +CONFIG_SYS_I2C_MESON=y
> +CONFIG_DM_MMC=y
> +CONFIG_MMC_MESON_GX=y
> +CONFIG_PHY_REALTEK=y
> +CONFIG_DM_ETH=y
> +CONFIG_ETH_DESIGNWARE_MESON8B=y
> +CONFIG_PHY=y
> +CONFIG_MESON_GXBB_USB_PHY=y
> +CONFIG_PINCTRL=y
> +CONFIG_PINCTRL_MESON_GXBB=y
> +CONFIG_POWER_DOMAIN=y
> +CONFIG_MESON_EE_POWER_DOMAIN=y
> +CONFIG_DM_REGULATOR=y
> +CONFIG_DM_REGULATOR_FIXED=y
> +CONFIG_DM_REGULATOR_GPIO=y
> +CONFIG_DM_RESET=y
> +CONFIG_DEBUG_UART_ANNOUNCE=y
> +CONFIG_DEBUG_UART_SKIP_INIT=y
> +CONFIG_MESON_SERIAL=y
> +CONFIG_SYSINFO=y
> +CONFIG_SYSINFO_SMBIOS=y
> +CONFIG_USB=y
> +CONFIG_DM_USB=y
> +CONFIG_USB_DWC2=y
> +CONFIG_USB_KEYBOARD=y
> +CONFIG_VIDEO=y
> +# CONFIG_VIDEO_BPP8 is not set
> +# CONFIG_VIDEO_BPP16 is not set
> +CONFIG_SYS_WHITE_ON_BLACK=y
> +CONFIG_VIDEO_MESON=y
> +CONFIG_VIDEO_DT_SIMPLEFB=y
> +CONFIG_SPLASH_SCREEN=y
> +CONFIG_SPLASH_SCREEN_ALIGN=y
> +CONFIG_VIDEO_BMP_RLE8=y
> +CONFIG_BMP_16BPP=y
> +CONFIG_BMP_24BPP=y
> +CONFIG_BMP_32BPP=y
> +CONFIG_OF_LIBFDT_OVERLAY=y
> diff --git a/configs/wetek-play2_defconfig b/configs/wetek-play2_defconfig
> new file mode 100644
> index 00..6d33b09a94
> --- /dev/null
> +++ b/configs/wetek-play2_defconfig
> @@ -0,0 +1,70 @@
> +CONFIG_ARM=y
> +CONFIG_ARCH_MESON=y
> +CONFIG_TEXT_BASE=0x0100
> +CONFIG_SYS_LOAD_ADDR=0x100
> +CONFIG_NR_DRAM_BANKS=1
> +CONFIG_ENV_SIZE=0x2000
> +CONFIG_DM_GPIO=y
> +CONFIG_DEBUG_UART_BASE=0xc81004c0
> +CONFIG_DEBUG_UART_CLOCK=2400
> +CONFIG_IDENT_STRING=" wetek-play2"
> +CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-play2"
> +CONFIG_DEBUG_UART=y
> +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
> +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
> +CONFIG_OF_BOARD_SETUP=y
> +# CONFIG_DISPLAY_CPUINFO is not set
> +CONFIG_MISC_INIT_R=y
> +# CONFIG_CMD_BDI is not set
> +# CONFIG_CMD_IMI is not set
> +CONFIG_CMD_ADC=y
> +CONFIG_CMD_GPIO=y
> +CONFIG_CMD_I2C=y
> +# CONFIG_CMD_LOADS is not set
> +CONFIG_CMD_MMC=y
> +CONFIG_CMD_USB=y
> +# CONFIG_CMD_SETEXPR is not set
> +CONFIG_CMD_REGULATOR=y

[PATCH 13/13] doc: boards: amlogic: add documentation for WeTek Hub and WeTek Play2

2023-03-23 Thread Christian Hewitt
Add build instructions for the WeTek Hub and WeTek Play2 boards.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/p200/MAINTAINERS|   2 +
 doc/board/amlogic/index.rst   |   2 +
 doc/board/amlogic/wetek-hub.rst   | 109 
 doc/board/amlogic/wetek-play2.rst | 114 ++
 4 files changed, 227 insertions(+)
 create mode 100644 doc/board/amlogic/wetek-hub.rst
 create mode 100644 doc/board/amlogic/wetek-play2.rst

diff --git a/board/amlogic/p200/MAINTAINERS b/board/amlogic/p200/MAINTAINERS
index 264218e3be..fe451dd7db 100644
--- a/board/amlogic/p200/MAINTAINERS
+++ b/board/amlogic/p200/MAINTAINERS
@@ -12,3 +12,5 @@ F:configs/wetek-play2_defconfig
 F: doc/board/amlogic/p200.rst
 F: doc/board/amlogic/nanopi-k2.rst
 F: doc/board/amlogic/odroid-c2.rst
+F:  doc/board/amlogic/wetek-hub.rst
+F:  doc/board/amlogic/wetek-play2.rst
diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index 71b7e1f3ed..deb7976436 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -118,4 +118,6 @@ Board Documentation
s400
u200
wetek-core2
+   wetek-hub
+   wetek-play2
w400
diff --git a/doc/board/amlogic/wetek-hub.rst b/doc/board/amlogic/wetek-hub.rst
new file mode 100644
index 00..7362b7d7f5
--- /dev/null
+++ b/doc/board/amlogic/wetek-hub.rst
@@ -0,0 +1,109 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for WeTek Hub (S905)
+===
+
+WeTek Hub is a small form-factor Android STB manufactured by WeTek with the 
following
+specification:
+
+ - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
+ - ARM Mali 450 GPU
+ - 1GB DDR3 SDRAM
+ - 8GB eMMC
+ - Gigabit Ethernet
+ - HDMI 2.0 4K/60Hz display
+ - 1x USB otg
+ - microSD
+ - UART jack
+ - Infrared receiver
+
+Schematics are not publicly available but have been shared privately to 
maintainers.
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make wetek-hub_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh wetek-hub /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image and WeTek has not publicly shared the U-Boot sources needed to build FIP 
binaries
+for signing. However you can download them from the amlogic-fip-repo.
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip/wetek-hub
+$ export FIPDIR=$PWD
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+
+$ cp $FIPDIR/bl2.bin fip/
+$ cp $FIPDIR/acs.bin fip/
+$ cp $FIPDIR/bl21.bin fip/
+$ cp $FIPDIR/bl30.bin fip/
+$ cp $FIPDIR/bl301.bin fip/
+$ cp $FIPDIR/bl31.img fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ $FIPDIR/blx_fix.sh \
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
+
+$ $FIPDIR/fip_create --bl30 fip/bl30_new.bin \
+ --bl31 fip/bl31.img \
+ --bl33 fip/bl33.bin \
+ fip/fip.bin
+
+$ sed -i 's/\x73\x02\x08\x91/\x1F\x20\x03\xD5/' fip/bl2.bin
+$ python3 $FIPDIR/acs_tool.py fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
+
+$ $FIPDIR/blx_fix.sh \
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
+
+$ cat fip/bl2_new.bin fip/fip.bin > fip/boot_new.bin
+
+$ $FIPDIR/aml_encrypt_gxb --bootsig \
+  --input fip/boot_new.bin
+  --output fip/u-boot.bin
+
+Then write U-Boot to SD or eMMC with:
+
+.. code-block:: bash
+
+$ DEV=/dev/boot_device
+$ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 conv=fsync
+$ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 seek=9 skip=8 
count=87 conv=fsync,notrunc
+$ dd if=/dev/zero of=fip/u-boot.bin.gxbb bs=512 seek=8 count=1 
conv=fsync,notrunc
+$ dd if=bl1.bin.hardkernel of=fip/u-boot.bin.gxbb bs=512 seek=2 skip=2 
count=1 conv=fsync,notrunc
+$ ./aml_chksum fip/u-boot.bin.gxbb
+$ dd if=fip/u-boot.gxbb of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+$ dd if=fip/u-boot.gxbb of=$DEV conv=fsync,notrunc bs=1 count=440
diff --git a/doc/board/amlogic/wetek-play2.rst 
b/doc/board/amlogic/wetek-play2.rst
new file mode 100644
index 00..31c839dcd5
--- /dev/n

[PATCH 12/13] boards: amlogic: add WeTek Hub and WeTek Play2 defconfig

2023-03-23 Thread Christian Hewitt
Add configurations for the WeTek Hub and WeTek Play2 boards along
with files for the wetek-gxbb board family to ensure the ethernet
MAC is correctly discovered. Set myself as the maintainer for the
board family.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/p200/MAINTAINERS |  2 +
 configs/wetek-hub_defconfig| 70 ++
 configs/wetek-play2_defconfig  | 70 ++
 3 files changed, 142 insertions(+)
 create mode 100644 configs/wetek-hub_defconfig
 create mode 100644 configs/wetek-play2_defconfig

diff --git a/board/amlogic/p200/MAINTAINERS b/board/amlogic/p200/MAINTAINERS
index 33ca3df5c6..264218e3be 100644
--- a/board/amlogic/p200/MAINTAINERS
+++ b/board/amlogic/p200/MAINTAINERS
@@ -7,6 +7,8 @@ F:  board/amlogic/p200/
 F: configs/nanopi-k2_defconfig
 F: configs/odroid-c2_defconfig
 F: configs/p200_defconfig
+F: configs/wetek-hub_defconfig
+F: configs/wetek-play2_defconfig
 F: doc/board/amlogic/p200.rst
 F: doc/board/amlogic/nanopi-k2.rst
 F: doc/board/amlogic/odroid-c2.rst
diff --git a/configs/wetek-hub_defconfig b/configs/wetek-hub_defconfig
new file mode 100644
index 00..634833f7fe
--- /dev/null
+++ b/configs/wetek-hub_defconfig
@@ -0,0 +1,70 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" wetek-hub"
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-hub"
+CONFIG_DEBUG_UART=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_ADC=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SARADC_MESON=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_PHY=y
+CONFIG_MESON_GXBB_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_GXBB=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_SYSINFO=y
+CONFIG_SYSINFO_SMBIOS=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_DWC2=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/wetek-play2_defconfig b/configs/wetek-play2_defconfig
new file mode 100644
index 00..6d33b09a94
--- /dev/null
+++ b/configs/wetek-play2_defconfig
@@ -0,0 +1,70 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" wetek-play2"
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxbb-wetek-play2"
+CONFIG_DEBUG_UART=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_ADC=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SARADC_MESON=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_PHY=y
+CONFIG_MESON_GXBB_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_GXBB=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_SYSINFO=y
+CONFIG_SYSINFO_SMBIOS=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_DWC2=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y

[PATCH 11/13] ARM: dts: add support for WeTek Hub and WeTek Play2

2023-03-23 Thread Christian Hewitt
Import the dts files from linux-amlogic/for-next (Linux 6.4-rc1) and
add the old PHY reset bindings for dwmac to the u-boot.dtsi until we
support the new bindings in the PHY node. Without this the PHY is not
functional in u-boot or Linux.

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile |   2 +
 arch/arm/dts/meson-gxbb-wetek-hub.dts |  58 +
 arch/arm/dts/meson-gxbb-wetek-play2.dts   | 119 +
 arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi |  13 +
 arch/arm/dts/meson-gxbb-wetek.dtsi| 292 ++
 5 files changed, 484 insertions(+)
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-hub.dts
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-play2.dts
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxbb-wetek.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 42da335bb5..1c843882d1 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -191,6 +191,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-gxbb-nanopi-k2.dtb \
meson-gxbb-p200.dtb \
meson-gxbb-p201.dtb \
+   meson-gxbb-wetek-hub.dtb \
+   meson-gxbb-wetek-play2.dtb \
meson-gxl-s805x-libretech-ac.dtb \
meson-gxl-s905d-libretech-pc.dtb \
meson-gxl-s905w-jethome-jethub-j80.dtb \
diff --git a/arch/arm/dts/meson-gxbb-wetek-hub.dts 
b/arch/arm/dts/meson-gxbb-wetek-hub.dts
new file mode 100644
index 00..58733017ed
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb-wetek-hub.dts
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Neil Armstrong 
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb-wetek.dtsi"
+#include 
+
+/ {
+   compatible = "wetek,hub", "amlogic,meson-gxbb";
+   model = "WeTek Hub";
+
+   sound {
+   compatible = "amlogic,gx-sound-card";
+   model = "WETEK-HUB";
+   assigned-clocks = < CLKID_MPLL0>,
+ < CLKID_MPLL1>,
+ < CLKID_MPLL2>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = < AIU_CPU CPU_I2S_FIFO>;
+   };
+
+   dai-link-1 {
+   sound-dai = < AIU_CPU CPU_I2S_ENCODER>;
+   dai-format = "i2s";
+   mclk-fs = <256>;
+
+   codec-0 {
+   sound-dai = < AIU_HDMI CTRL_I2S>;
+   };
+   };
+
+   dai-link-2 {
+   sound-dai = < AIU_HDMI CTRL_OUT>;
+
+   codec-0 {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   linux,rc-map-name = "rc-wetek-hub";
+};
diff --git a/arch/arm/dts/meson-gxbb-wetek-play2.dts 
b/arch/arm/dts/meson-gxbb-wetek-play2.dts
new file mode 100644
index 00..505ffcd8eb
--- /dev/null
+++ b/arch/arm/dts/meson-gxbb-wetek-play2.dts
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016 BayLibre, Inc.
+ * Author: Neil Armstrong 
+ */
+
+/dts-v1/;
+
+#include "meson-gxbb-wetek.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "wetek,play2", "amlogic,meson-gxbb";
+   model = "WeTek Play 2";
+
+   spdif_dit: audio-codec-0 {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   status = "okay";
+   sound-name-prefix = "DIT";
+   };
+
+   leds {
+   led-wifi {
+   label = "wetek-play:wifi-status";
+   gpios = < GPIODV_26 GPIO_ACTIVE_HIGH>;
+   default-state = "off";
+   };
+
+   led-ethernet {
+   label = "wetek-play:ethernet-status";
+   gpios = < GPIODV_27 GPIO_ACTIVE_HIGH>;
+   default-state = "off";
+   };
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   poll-interval = <100>;
+
+   button {
+   label = "reset";
+   linux,code = ;
+   gpios = <_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   sound 

[PATCH 10/13] doc: boards: amlogic: add documentation for Radxa Zero2

2023-03-23 Thread Christian Hewitt
Add build docs for the Radxa Zero2 board.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/w400/MAINTAINERS|  2 +
 doc/board/amlogic/index.rst   |  1 +
 doc/board/amlogic/radxa-zero2.rst | 79 +++
 3 files changed, 82 insertions(+)
 create mode 100644 doc/board/amlogic/radxa-zero2.rst

diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
index 042b523056..117f79ea04 100644
--- a/board/amlogic/w400/MAINTAINERS
+++ b/board/amlogic/w400/MAINTAINERS
@@ -5,6 +5,8 @@ L:  u-boot-amlo...@groups.io
 F: board/amlogic/w400/
 F: configs/bananapi-cm4-cm4io_defconfig
 F: configs/bananapi-m2s_defconfig
+F: configs/radxa-zero2_defconfig
 F: doc/board/amlogic/w400.rst
 F: doc/board/amlogic/bananapi-cm4io.rst
 F: doc/board/amlogic/bananapi-m2s.rst
+F: doc/board/amlogic/radxa-zero2.rst
diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index fa1b362731..71b7e1f3ed 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -112,6 +112,7 @@ Board Documentation
p212
q200
radxa-zero
+   radxa-zero2
sei510
sei610
s400
diff --git a/doc/board/amlogic/radxa-zero2.rst 
b/doc/board/amlogic/radxa-zero2.rst
new file mode 100644
index 00..3fb5d360e8
--- /dev/null
+++ b/doc/board/amlogic/radxa-zero2.rst
@@ -0,0 +1,79 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for Radxa Zero2 (A311D)
+==
+
+Radxa Zero2 is a small form factor SBC based on the Amlogic A311D chipset with 
the
+following specification:
+
+- Amlogic A311D (Quad A73 + Dual A53) CPU
+- 4GB LPDDR4 RAM
+- 32/64/128GB eMMC
+- Mali G52-MP4 GPU
+- HDMI 2.1 output (micro)
+- BCM4345 WiFi (2.4/5GHz a/b/g/n/ac) and BT 5.0
+- 1x USB 2.0 port - Type C (OTG)
+- 1x USB 3.0 port - Type C (Host)
+- 1x micro SD Card slot
+- 40 Pin GPIO header
+
+Schematics are available on request from Radxa.
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make radxa-zero2_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh radxa-zero2 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
+
+.. code-block:: bash
+
+$ git clone -b radxa-zero-v2021.07 https://github.com/radxa/u-boot.git
+$ git clone https://github.com/radxa/fip.git
+
+$ sudo apt-get install -y gcc-aarch64-linux-gnu device-tree-compiler 
libncurses5 libncurses5-dev
+$ sudo apt-get install -y bc python dosfstools flex build-essential 
libssl-dev mtools
+
+$ wget 
https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
+$ sudo tar xvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz -C /opt
+
+$ export 
CROSS_COMPILE=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
+$ export ARCH=arm
+$ cd u-boot
+$ make radxa-zero2_defconfig
+$ make
+
+$ cp u-boot.bin ../fip/radxa-zero2/bl33.bin
+$ cd ../fip/radxa-zero2
+$ make
+
+This will generate the signed U-Boot binaries:
+
+.. code-block:: bash
+
+$ u-boot.bin u-boot.bin.sd.bin u-boot.bin.usb.bl2 u-boot.bin.usb.tpl
+
+Then write U-Boot to SD or eMMC with:
+
+.. code-block:: bash
+
+$ DEV=/dev/boot_device
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 09/13] boards: amlogic: add Radxa Zero2 defconfig

2023-03-23 Thread Christian Hewitt
Add board configuration for the Radxa Zero2.

Signed-off-by: Christian Hewitt 
---
 configs/radxa-zero2_defconfig | 77 +++
 1 file changed, 77 insertions(+)
 create mode 100644 configs/radxa-zero2_defconfig

diff --git a/configs/radxa-zero2_defconfig b/configs/radxa-zero2_defconfig
new file mode 100644
index 00..2218b0db7d
--- /dev/null
+++ b/configs/radxa-zero2_defconfig
@@ -0,0 +1,77 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-radxa-zero2"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" radxa-zero2"
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_DEBUG_UART=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_REMAKE_ELF=y
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_SYS_MAXARGS=32
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+# CONFIG_PHY_REALTEK is not set
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+# CONFIG_ETH_DESIGNWARE_MESON8B is not set
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.34.1



[PATCH 08/13] ARM: dts: add support for Radxa Zero2

2023-03-23 Thread Christian Hewitt
Import the device-tree from linux-amlogic/for-next (Linux 6.4-rc1)
to support the Radxa-Zero2 board.

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile |   1 +
 .../dts/meson-g12b-radxa-zero2-u-boot.dtsi|   7 +
 arch/arm/dts/meson-g12b-radxa-zero2.dts   | 489 ++
 3 files changed, 497 insertions(+)
 create mode 100644 arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-radxa-zero2.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index eb20524a99..42da335bb5 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -214,6 +214,7 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-g12b-odroid-n2.dtb \
meson-g12b-odroid-n2l.dtb \
meson-g12b-odroid-n2-plus.dtb \
+   meson-g12b-radxa-zero2.dtb \
meson-sm1-bananapi-m2-pro.dtb \
meson-sm1-bananapi-m5.dtb \
meson-sm1-khadas-vim3l.dtb \
diff --git a/arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi 
b/arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi
new file mode 100644
index 00..236f2468dc
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Neil Armstrong 
+ */
+
+#include "meson-g12-common-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-g12b-radxa-zero2.dts 
b/arch/arm/dts/meson-g12b-radxa-zero2.dts
new file mode 100644
index 00..890f5bfebb
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-radxa-zero2.dts
@@ -0,0 +1,489 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ * Copyright (c) 2019 Christian Hewitt 
+ * Copyright (c) 2022 Radxa Limited
+ * Author: Yuntian Zhang 
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-a311d.dtsi"
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "radxa,zero2", "amlogic,a311d", "amlogic,g12b";
+   model = "Radxa Zero2";
+
+   aliases {
+   serial0 = _AO;
+   serial2 = _A;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x8000>;
+   };
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   poll-interval = <100>;
+   power-button {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_3 (GPIO_ACTIVE_LOW | 
GPIO_PULL_UP)>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-green {
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   gpios = < GPIOA_12 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   };
+   };
+
+   hdmi-connector {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <_tx_tmds_out>;
+   };
+   };
+   };
+
+   emmc_pwrseq: emmc-pwrseq {
+   compatible = "mmc-pwrseq-emmc";
+   reset-gpios = < BOOT_12 GPIO_ACTIVE_LOW>;
+   };
+
+   sdio_pwrseq: sdio-pwrseq {
+   compatible = "mmc-pwrseq-simple";
+   reset-gpios = < GPIOX_6 GPIO_ACTIVE_LOW>;
+   clocks = <>;
+   clock-names = "ext_clock";
+   };
+
+   ao_5v: regulator-ao-5v {
+   compatible = "regulator-fixed";
+   regulator-name = "AO_5V";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   regulator-always-on;
+   };
+
+   vcc_1v8: regulator-vcc-1v8 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_1V8";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   vin-supply = <_3v3>;
+   regulator-always-on;
+   };
+
+   vcc_3v3: regulator-vcc-3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <_3v3>;
+   regulator-always-on;
+   /* FIXME: actually controlled by VDDCPU_B_EN */
+   };
+
+   vddao_1v8: re

[PATCH 07/13] docs: boards: amlogic: add documentation for BananaPi M2S

2023-03-23 Thread Christian Hewitt
Add build docs for the BPI-M2S board.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/w400/MAINTAINERS |   2 +
 doc/board/amlogic/bananapi-m2s.rst | 152 +
 doc/board/amlogic/index.rst|   1 +
 3 files changed, 155 insertions(+)
 create mode 100644 doc/board/amlogic/bananapi-m2s.rst

diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
index 26a4c2c587..042b523056 100644
--- a/board/amlogic/w400/MAINTAINERS
+++ b/board/amlogic/w400/MAINTAINERS
@@ -4,5 +4,7 @@ S:  Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/w400/
 F: configs/bananapi-cm4-cm4io_defconfig
+F: configs/bananapi-m2s_defconfig
 F: doc/board/amlogic/w400.rst
 F: doc/board/amlogic/bananapi-cm4io.rst
+F: doc/board/amlogic/bananapi-m2s.rst
diff --git a/doc/board/amlogic/bananapi-m2s.rst 
b/doc/board/amlogic/bananapi-m2s.rst
new file mode 100644
index 00..265df1aea7
--- /dev/null
+++ b/doc/board/amlogic/bananapi-m2s.rst
@@ -0,0 +1,152 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for BananaPi M2S (A311D & S922X)
+===
+
+BananaPi BPI-M2S ships is a Single Board Computer manufactured by Sinovoip 
that ships in
+two variants with Amlogic S922X or A311D SoC and the following common 
specification:
+
+- 16GB eMMC
+- HDMI 2.1a video
+- 2x 10/100/1000 Base-T Ethernet (1x RTL8211F, 1x RTL811H)
+- 2x USB 2.0 ports
+- 2x Status LED's (green/blue)
+- 1x Power/Reset button
+- 1x micro SD card slot
+- 40-pin GPIO header
+- PWM fan header
+- UART header
+
+The S992X variant has:
+- 2GB LPDDR4 RAM
+
+The A311D variant has:
+
+- 4GB LPDDR4 RAM
+- NPU (5.0 TOPS)
+- MIPI DSI header
+- MIPI CSI header
+
+An optional RTL8822CS SDIO WiFi/BT mezzanine is available for both board 
variants.
+
+Schematics are available from the manufacturer: 
https://wiki.banana-pi.org/Banana_Pi_BPI-M2S
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make bananapi-m2s_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh bananapi-m2s /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
+
+.. code-block:: bash
+
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+$ DIR=bananapi-m2s
+$ git clone --depth 1 https://github.com/Dangku/amlogic-u-boot.git -b 
khadas-g12b-v2015.01-m2s $DIR
+
+$ cd $DIR
+$ make bananapi_m2s_defconfig
+$ make
+$ export UBDIR=$PWD
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+
+$ wget 
https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh
 -O fip/blx_fix.sh
+$ cp $UBDIR/build/scp_task/bl301.bin fip/
+$ cp $UBDIR/build/board/bananapi/bananpi_m2s/firmware/acs.bin fip/
+$ cp $UBDIR/fip/g12a/bl2.bin fip/
+$ cp $UBDIR/fip/g12a/bl30.bin fip/
+$ cp $UBDIR/fip/g12a/bl31.img fip/
+$ cp $UBDIR/fip/g12a/ddr3_1d.fw fip/
+$ cp $UBDIR/fip/g12a/ddr4_1d.fw fip/
+$ cp $UBDIR/fip/g12a/ddr4_2d.fw fip/
+$ cp $UBDIR/fip/g12a/diag_lpddr4.fw fip/
+$ cp $UBDIR/fip/g12a/lpddr3_1d.fw fip/
+$ cp $UBDIR/fip/g12a/lpddr4_1d.fw fip/
+$ cp $UBDIR/fip/g12a/lpddr4_2d.fw fip/
+$ cp $UBDIR/fip/g12a/piei.fw fip/
+$ cp $UBDIR/fip/g12a/aml_ddr.fw fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ sh fip/blx_fix.sh \
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
+
+$ sh fip/blx_fix.sh \
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
+
+$ $UBDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+   --output fip/bl30_new.bin.g12a.enc \
+   --level v3
+$ $UBDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input 
fip/bl30_new.bin.g12a

[PATCH 06/13] boards: add BananaPi M2S defconfig

2023-03-23 Thread Christian Hewitt
Add configuration for the Bananapi BPI-M2S.

Signed-off-by: Christian Hewitt 
---
 configs/bananapi-m2s_defconfig | 82 ++
 1 file changed, 82 insertions(+)
 create mode 100644 configs/bananapi-m2s_defconfig

diff --git a/configs/bananapi-m2s_defconfig b/configs/bananapi-m2s_defconfig
new file mode 100644
index 00..3109e0ce48
--- /dev/null
+++ b/configs/bananapi-m2s_defconfig
@@ -0,0 +1,82 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-a311d-bananapi-m2s"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" bpi-m2s"
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_DEBUG_UART=y
+CONFIG_AHCI=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_REMAKE_ELF=y
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_SYS_MAXARGS=32
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_AHCI_PCI=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_PCI=y
+CONFIG_PCIE_DW_MESON=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.34.1



[PATCH 05/13] ARM: dts: add support for BananaPi M2S

2023-03-23 Thread Christian Hewitt
Import the device-tree from linux-amlogic/for-next (Linux 6.4-rc1)
and omit the NPU node from the A311D board variant dts as this is
not supported under U-Boot.

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile |   1 +
 .../arm/dts/meson-g12b-a311d-bananapi-m2s.dts |  33 ++
 arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi  |   7 +
 arch/arm/dts/meson-g12b-bananapi.dtsi | 521 ++
 .../arm/dts/meson-g12b-s922x-bananapi-m2s.dts |  14 +
 5 files changed, 576 insertions(+)
 create mode 100644 arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts
 create mode 100644 arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-bananapi.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-s922x-bananapi-m2s.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d6139429e5..eb20524a99 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -204,6 +204,7 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-g12a-radxa-zero.dtb \
meson-g12a-sei510.dtb \
meson-g12a-u200.dtb \
+   meson-g12b-a311d-bananapi-m2s.dtb \
meson-g12b-a311d-khadas-vim3.dtb \
meson-g12b-bananapi-cm4-cm4io.dtb \
meson-g12b-gsking-x.dtb \
diff --git a/arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts 
b/arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts
new file mode 100644
index 00..31365316b2
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-a311d.dtsi"
+#include "meson-g12b-bananapi.dtsi"
+
+/ {
+   compatible = "bananapi,bpi-m2s", "amlogic,a311d", "amlogic,g12b";
+   model = "BananaPi M2S";
+
+   aliases {
+   i2c0 = 
+   i2c1 = 
+   };
+};
+
+/* Camera (CSI) bus */
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_h6_pins>, <_sck_h7_pins>;
+   pinctrl-names = "default";
+};
+
+/* Display (DSI) bus */
+ {
+   status = "okay";
+   pinctrl-0 = <_sda_a_pins>, <_sck_a_pins>;
+   pinctrl-names = "default";
+};
diff --git a/arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi 
b/arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi
new file mode 100644
index 00..236f2468dc
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Neil Armstrong 
+ */
+
+#include "meson-g12-common-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-g12b-bananapi.dtsi 
b/arch/arm/dts/meson-g12b-bananapi.dtsi
new file mode 100644
index 00..83709787eb
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-bananapi.dtsi
@@ -0,0 +1,521 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ * Copyright (c) 2023 Christian Hewitt 
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   aliases {
+   serial0 = _AO;
+   ethernet0 = 
+   rtc1 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x8000>; /* 2 GiB or 4 GiB */
+   };
+
+   adc-keys {
+   compatible = "adc-keys";
+   io-channels = < 2>;
+   io-channel-names = "buttons";
+   keyup-threshold-microvolt = <171>;
+
+   button-function {
+   label = "RST";
+   linux,code = ;
+   press-threshold-microvolt = <1>;
+   };
+   };
+
+   emmc_pwrseq: emmc-pwrseq {
+   compatible = "mmc-pwrseq-emmc";
+   reset-gpios = < BOOT_12 GPIO_ACTIVE_LOW>;
+   };
+
+   fan0: pwm-fan {
+   compatible = "pwm-fan";
+   #cooling-cells = <2>;
+   cooling-min-state = <0>;
+   cooling-max-state = <3>;
+   cooling-levels = <0 120 170 220>;
+   pwms = <_cd 1 4 0>;
+   };
+
+   hdmi-connector {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <_tx_tmds_out>;
+   };
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-0 {
+   color = ;
+   function = LED_FUNCTION_STATUS;
+

[PATCH 04/13] docs: boards: amlogic: add documentation for BananaPi M2-Pro

2023-03-23 Thread Christian Hewitt
Add build docs for the BPI-M2-PRO board.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/u200/MAINTAINERS   |   2 +
 doc/board/amlogic/bananapi-m2pro.rst | 142 +++
 doc/board/amlogic/index.rst  |   1 +
 3 files changed, 145 insertions(+)
 create mode 100644 doc/board/amlogic/bananapi-m2pro.rst

diff --git a/board/amlogic/u200/MAINTAINERS b/board/amlogic/u200/MAINTAINERS
index 919e349922..f429c212ba 100644
--- a/board/amlogic/u200/MAINTAINERS
+++ b/board/amlogic/u200/MAINTAINERS
@@ -4,8 +4,10 @@ S: Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/u200/
 F: configs/u200_defconfig
+F: configs/bananapi-m2pro_defconfig
 F: configs/bananapi-m5_defconfig
 F: configs/radxa-zero_defconfig
 F: doc/board/amlogic/u200.rst
+F: doc/board/amlogic/bananapi-m2pro.rst
 F: doc/board/amlogic/bananapi-m5.rst
 F: doc/board/amlogic/radxa-zero.rst
diff --git a/doc/board/amlogic/bananapi-m2pro.rst 
b/doc/board/amlogic/bananapi-m2pro.rst
new file mode 100644
index 00..6c2974f323
--- /dev/null
+++ b/doc/board/amlogic/bananapi-m2pro.rst
@@ -0,0 +1,142 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for BananaPi BPI-M2-PRO (S905X3)
+===
+
+BananaPi BPI-M2-PRO is a Single Board Computer manufactured by Sinovoip with 
the
+following specification:
+
+ - Amlogic S905X3 Arm Cortex-A55 quad-core SoC
+ - 2GB DDR4 SDRAM
+ - 16GB eMMC
+ - Gigabit Ethernet
+ - RTL8821CU USB WiFi (a/b/g/n/ac) + BT 5.0
+ - HDMI 2.1 display
+ - 40-pin GPIO header
+ - 2x USB 3.0 Host
+ - 1x DC Jack (power)
+ - microSD
+ - UART serial
+ - Infrared receiver
+
+Schematics are available from the manufacturer: 
https://wiki.banana-pi.org/Banana_Pi_BPI-M2_Pro
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make bananapi-m2pro_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh bananapi-m2pro /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
+
+.. code-block:: bash
+
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+$ DIR=bananapi-m2pro
+$ git clone --depth 1 https://github.com/Dangku/amlogic-u-boot.git -b 
odroidg12-v2015.01-c4-m5 $DIR
+
+$ cd $DIR
+$ make bananapi_m2pro_defconfig
+$ make
+$ export UBOOTDIR=$PWD
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+
+$ wget 
https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh
 -O fip/blx_fix.sh
+$ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+$ cp $UBOOTDIR/build/board/bananapi/bananpi_m5/firmware/acs.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl2.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl30.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl31.img fip/
+$ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/piei.fw fip/
+$ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ sh fip/blx_fix.sh \
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
+
+$ sh fip/blx_fix.sh \
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
+
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
+  --output fip/bl30_new.bin.g12a.enc \
+  --level v3
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input 
fip/bl30_new.bin.g12a.enc \
+  --output fip/bl30_new.bin.enc

[PATCH 02/13] ARM: dts: add support for BananaPi M2-Pro

2023-03-23 Thread Christian Hewitt
Import the board dts from the linux-amlogic/for-next (6.4-rc1)
branch. This involves spliting the BPI-M5 dts into a dtsi and
then reusing this for the M2-Pro.

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile |   5 +-
 .../dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi |  14 +
 arch/arm/dts/meson-sm1-bananapi-m2-pro.dts|  97 
 arch/arm/dts/meson-sm1-bananapi-m5.dts| 427 +
 arch/arm/dts/meson-sm1-bananapi.dtsi  | 435 ++
 5 files changed, 550 insertions(+), 428 deletions(-)
 create mode 100644 arch/arm/dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-sm1-bananapi-m2-pro.dts
 create mode 100644 arch/arm/dts/meson-sm1-bananapi.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 0c149b636a..d6139429e5 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -205,14 +205,15 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-g12a-sei510.dtb \
meson-g12a-u200.dtb \
meson-g12b-a311d-khadas-vim3.dtb \
+   meson-g12b-bananapi-cm4-cm4io.dtb \
+   meson-g12b-gsking-x.dtb \
meson-g12b-gtking.dtb \
meson-g12b-gtking-pro.dtb \
-   meson-g12b-gsking-x.dtb \
meson-g12b-odroid-go-ultra.dtb \
meson-g12b-odroid-n2.dtb \
meson-g12b-odroid-n2l.dtb \
meson-g12b-odroid-n2-plus.dtb \
-   meson-g12b-bananapi-cm4-cm4io.dtb \
+   meson-sm1-bananapi-m2-pro.dtb \
meson-sm1-bananapi-m5.dtb \
meson-sm1-khadas-vim3l.dtb \
meson-sm1-odroid-c4.dtb \
diff --git a/arch/arm/dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi 
b/arch/arm/dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi
new file mode 100644
index 00..4a1aeda565
--- /dev/null
+++ b/arch/arm/dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi
@@ -0,0 +1,14 @@
+
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 BayLibre, SAS
+ * Author: Neil Armstrong 
+ */
+
+#include "meson-sm1-u-boot.dtsi"
+
+ {
+   snps,reset-gpio = < GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
+   snps,reset-delays-us = <0 1 100>;
+   snps,reset-active-low;
+};
diff --git a/arch/arm/dts/meson-sm1-bananapi-m2-pro.dts 
b/arch/arm/dts/meson-sm1-bananapi-m2-pro.dts
new file mode 100644
index 00..586034316e
--- /dev/null
+++ b/arch/arm/dts/meson-sm1-bananapi-m2-pro.dts
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 BayLibre SAS
+ * Author: Neil Armstrong 
+ */
+
+/dts-v1/;
+
+#include "meson-sm1-bananapi.dtsi"
+#include 
+
+/ {
+   compatible = "bananapi,bpi-m2-pro", "amlogic,sm1";
+   model = "Banana Pi BPI-M2-PRO";
+
+   sound {
+   compatible = "amlogic,axg-sound-card";
+   model = "BPI-M2-PRO";
+   audio-aux-devs = <_b>;
+   audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
+   "TDMOUT_B IN 1", "FRDDR_B OUT 1",
+   "TDMOUT_B IN 2", "FRDDR_C OUT 1",
+   "TDM_B Playback", "TDMOUT_B OUT";
+
+   assigned-clocks = < CLKID_MPLL2>,
+ < CLKID_MPLL0>,
+ < CLKID_MPLL1>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+
+   dai-link-0 {
+   sound-dai = <_a>;
+   };
+
+   dai-link-1 {
+   sound-dai = <_b>;
+   };
+
+   dai-link-2 {
+   sound-dai = <_c>;
+   };
+
+   /* 8ch hdmi interface */
+   dai-link-3 {
+   sound-dai = <_b>;
+   dai-format = "i2s";
+   dai-tdm-slot-tx-mask-0 = <1 1>;
+   dai-tdm-slot-tx-mask-1 = <1 1>;
+   dai-tdm-slot-tx-mask-2 = <1 1>;
+   dai-tdm-slot-tx-mask-3 = <1 1>;
+   mclk-fs = <256>;
+
+   codec {
+   sound-dai = < TOHDMITX_I2S_IN_B>;
+   };
+   };
+
+   /* hdmi glue */
+   dai-link-4 {
+   sound-dai = < TOHDMITX_I2S_OUT>;
+
+   codec {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+_audio {
+   status = "okay";
+};
+
+_a {
+   status = "okay";
+};
+
+_b {
+   s

[PATCH 03/13] boards: add BananaPi M2-Pro defconfig

2023-03-23 Thread Christian Hewitt
Add configuration for the BananaPi M2-Pro board.

Signed-off-by: Christian Hewitt 
---
 configs/bananapi-m2-pro_defconfig | 76 +++
 1 file changed, 76 insertions(+)
 create mode 100644 configs/bananapi-m2-pro_defconfig

diff --git a/configs/bananapi-m2-pro_defconfig 
b/configs/bananapi-m2-pro_defconfig
new file mode 100644
index 00..28b603fe20
--- /dev/null
+++ b/configs/bananapi-m2-pro_defconfig
@@ -0,0 +1,76 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-sm1-bananapi-m2-pro"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING="bpi-m2-pro"
+CONFIG_SYS_LOAD_ADDR=0x100
+CONFIG_DEBUG_UART=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000
+CONFIG_REMAKE_ELF=y
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_SYS_MAXARGS=32
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.34.1



[PATCH 01/13] docs: boards: amlogic: add bananapi-m5 to u200 maintainer file

2023-03-23 Thread Christian Hewitt
The bananapi-m5 docs are missing from the file, so add them.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/u200/MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/amlogic/u200/MAINTAINERS b/board/amlogic/u200/MAINTAINERS
index 47cec234a1..919e349922 100644
--- a/board/amlogic/u200/MAINTAINERS
+++ b/board/amlogic/u200/MAINTAINERS
@@ -7,4 +7,5 @@ F:  configs/u200_defconfig
 F: configs/bananapi-m5_defconfig
 F: configs/radxa-zero_defconfig
 F: doc/board/amlogic/u200.rst
+F: doc/board/amlogic/bananapi-m5.rst
 F: doc/board/amlogic/radxa-zero.rst
-- 
2.34.1



[PATCH 00/13] boards: amlogic: add BananaPi/Radxa/WeTek boards

2023-03-23 Thread Christian Hewitt
This series adds support for the following boards which are
tested and booting fine with 2023.04-rc4:

- BananaPi M2-Pro (S905X3)
- BananaPi M2S (A311D or S922X)
- Radxa Zero2 (A311D)
- WeTek Hub (S905)
- WeTek Play2 (S905)

I also spotted that bananapi-m5 wasn't referrences in the u200
maintainer file so there's a patch to correct that too.

Christian Hewitt (13):
  docs: boards: amlogic: add bananapi-m5 to u200 maintainer file
  ARM: dts: add support for BananaPi M2-Pro
  boards: add BananaPi M2-Pro defconfig
  docs: boards: amlogic: add documentation for BananaPi M2-Pro
  ARM: dts: add support for BananaPi M2S
  boards: add BananaPi M2S defconfig
  docs: boards: amlogic: add documentation for BananaPi M2S
  ARM: dts: add support for Radxa Zero2
  boards: amlogic: add Radxa Zero2 defconfig
  doc: boards: amlogic: add documentation for Radxa Zero2
  ARM: dts: add support for WeTek Hub and WeTek Play2
  boards: amlogic: add WeTek Hub and WeTek Play2 defconfig
  doc: boards: amlogic: add documentation for WeTek Hub and WeTek Play2

 arch/arm/dts/Makefile |   9 +-
 .../arm/dts/meson-g12b-a311d-bananapi-m2s.dts |  33 ++
 arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi  |   7 +
 arch/arm/dts/meson-g12b-bananapi.dtsi | 521 ++
 .../dts/meson-g12b-radxa-zero2-u-boot.dtsi|   7 +
 arch/arm/dts/meson-g12b-radxa-zero2.dts   | 489 
 .../arm/dts/meson-g12b-s922x-bananapi-m2s.dts |  14 +
 arch/arm/dts/meson-gxbb-wetek-hub.dts |  58 ++
 arch/arm/dts/meson-gxbb-wetek-play2.dts   | 119 
 arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi |  13 +
 arch/arm/dts/meson-gxbb-wetek.dtsi| 292 ++
 .../dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi |  14 +
 arch/arm/dts/meson-sm1-bananapi-m2-pro.dts|  97 
 arch/arm/dts/meson-sm1-bananapi-m5.dts| 427 +-
 arch/arm/dts/meson-sm1-bananapi.dtsi  | 435 +++
 board/amlogic/p200/MAINTAINERS|   4 +
 board/amlogic/u200/MAINTAINERS|   3 +
 board/amlogic/w400/MAINTAINERS|   4 +
 configs/bananapi-m2-pro_defconfig |  76 +++
 configs/bananapi-m2s_defconfig|  82 +++
 configs/radxa-zero2_defconfig |  77 +++
 configs/wetek-hub_defconfig   |  70 +++
 configs/wetek-play2_defconfig |  70 +++
 doc/board/amlogic/bananapi-m2pro.rst  | 142 +
 doc/board/amlogic/bananapi-m2s.rst| 152 +
 doc/board/amlogic/index.rst   |   5 +
 doc/board/amlogic/radxa-zero2.rst |  79 +++
 doc/board/amlogic/wetek-hub.rst   | 109 
 doc/board/amlogic/wetek-play2.rst | 114 
 29 files changed, 3094 insertions(+), 428 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12b-a311d-bananapi-m2s.dts
 create mode 100644 arch/arm/dts/meson-g12b-bananapi-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-bananapi.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-radxa-zero2-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-g12b-radxa-zero2.dts
 create mode 100644 arch/arm/dts/meson-g12b-s922x-bananapi-m2s.dts
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-hub.dts
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-play2.dts
 create mode 100644 arch/arm/dts/meson-gxbb-wetek-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxbb-wetek.dtsi
 create mode 100644 arch/arm/dts/meson-sm1-bananapi-m2-pro-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-sm1-bananapi-m2-pro.dts
 create mode 100644 arch/arm/dts/meson-sm1-bananapi.dtsi
 create mode 100644 configs/bananapi-m2-pro_defconfig
 create mode 100644 configs/bananapi-m2s_defconfig
 create mode 100644 configs/radxa-zero2_defconfig
 create mode 100644 configs/wetek-hub_defconfig
 create mode 100644 configs/wetek-play2_defconfig
 create mode 100644 doc/board/amlogic/bananapi-m2pro.rst
 create mode 100644 doc/board/amlogic/bananapi-m2s.rst
 create mode 100644 doc/board/amlogic/radxa-zero2.rst
 create mode 100644 doc/board/amlogic/wetek-hub.rst
 create mode 100644 doc/board/amlogic/wetek-play2.rst

-- 
2.34.1



Re: [PATCH 29/33] doc: boards: amlogic: update documentation for WeTek Core2

2023-03-21 Thread Christian Hewitt


> On 20 Mar 2023, at 10:40 pm, Simon Glass  wrote:
> 
> Hi Christian,
> 
> On Tue, 21 Mar 2023 at 06:05, Christian Hewitt
>  wrote:
>> 
>> Improve documentation.
>> 
>> Signed-off-by: Christian Hewitt 
>> ---
>> doc/board/amlogic/wetek-core2.rst | 83 +--
>> 1 file changed, 47 insertions(+), 36 deletions(-)
> 
> This should really move to binman. Would you like to take a look?
> 
> I sent a patch for this a while ago but it needs something to review
> and try out.
> 
> https://patchwork.ozlabs.org/project/uboot/patch/20220110031413.1970836-39-...@chromium.org/
> 
> I am happy to do more on it as needed.

Hello Simon,

For now this is just a cleanup but longer-term (won’t be quick) I can
take a look. Do you have that series rebased against current and in a
repo somewhere for easier cherry-picking?

Christian

Re: [PATCH 30/33] doc: boards: amlogic: add documentation for BananaPi CM4IO

2023-03-20 Thread Christian Hewitt


> On 20 Mar 2023, at 4:13 pm, Neil Armstrong  wrote:
> 
> On 20/03/2023 12:46, Christian Hewitt wrote:
>> Add build instructions for the BananaPi BPI-CM4IO carrier board with
>> BPI-CM4 module.
>> Signed-off-by: Christian Hewitt 
>> ---
>>  board/amlogic/u200/MAINTAINERS   |   1 -
>>  board/amlogic/w400/MAINTAINERS   |   2 +
>>  doc/board/amlogic/bananapi-cm4io.rst | 152 +++
>>  doc/board/amlogic/index.rst  |   1 +
>>  4 files changed, 155 insertions(+), 1 deletion(-)
>>  create mode 100644 doc/board/amlogic/bananapi-cm4io.rst
> 
> 
> 
>> +
>> +U-Boot Signing with Pre-Built FIP repo
>> +--
>> +
>> +.. code-block:: bash
>> +$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
>> +$ cd amlogic-boot-fip
>> +$ mkdir my-output-dir
>> +$ ./build-fip.sh bananapi-cm4io /path/to/u-boot/u-boot.bin my-output-dir
> 
> 
> This should be bananapi-m2s since the same is used, or we should duplicate it 
> for cm4io/cm4.

https://github.com/LibreELEC/amlogic-boot-fip/tree/master/bananapi-cm4io

^ It’s the same FIPs that were submitted for M2S but for packaging
reasons I cloned them (users struggle to find images not explicitly
named for their board). I’ll submit patches for the M2S and M2-Pro
boards once this series is accepted (hopefully).

Christian

[PATCH 32/33] doc: boards: amlogic: add documentation for GS-King-X

2023-03-20 Thread Christian Hewitt
GS-King-X is also supported with the beelink-s922x FIP sources and can use
the GT-King defconfig. Add a board document with instructions.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/beelink-s922x/MAINTAINERS |   3 +-
 doc/board/amlogic/beelink-gskingx.rst   | 121 
 doc/board/amlogic/index.rst |   1 +
 3 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 doc/board/amlogic/beelink-gskingx.rst

diff --git a/board/amlogic/beelink-s922x/MAINTAINERS 
b/board/amlogic/beelink-s922x/MAINTAINERS
index 47b622765a..8dddeb91d5 100644
--- a/board/amlogic/beelink-s922x/MAINTAINERS
+++ b/board/amlogic/beelink-s922x/MAINTAINERS
@@ -3,8 +3,9 @@ M:  Christian Hewitt 
 S: Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/beelink-s922x/
+F: configs/beelink-gsking-x_defconfig
 F: configs/beelink-gtking_defconfig
 F: configs/beelink-gtkingpro_defconfig
-F: configs/beelink-gsking-x_defconfig
+F: doc/board/amlogic/beelink-gskingx.rst
 F: doc/board/amlogic/beelink-gtking.rst
 F: doc/board/amlogic/beelink-gtkingpro.rst
diff --git a/doc/board/amlogic/beelink-gskingx.rst 
b/doc/board/amlogic/beelink-gskingx.rst
new file mode 100644
index 00..987d358c77
--- /dev/null
+++ b/doc/board/amlogic/beelink-gskingx.rst
@@ -0,0 +1,121 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for Beelink GS-King-X (S922X)
+
+
+The Shenzen AZW (Beelink) GS-King-X is based on the Amlogic W400 reference 
board with an
+S922X-H chip and the following specifications:
+
+- 4GB LPDDR4 RAM
+- 64GB eMMC storage
+- 10/100/1000 Base-T Ethernet
+- AP6356S Wireless (802.11 a/b/g/n/ac, BT 4.1)
+- HDMI 2.1 video
+- S/PDIF optical output
+- 2x ESS9018 audio DACs
+- 4x Ricor RT6862 audio amps
+- Analogue headphone output
+- 1x USB 2.0 OTG port
+- 3x USB 3.0 ports
+- IR receiver
+- 1x micro SD card slot (internal)
+- USB SATA controller with 2x 3.5" drive bays
+- 1x Power on/off button
+
+Beelink do not provide public schematics, but have been willing to share them 
with known
+distro developers to assist with development.
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make beelink-gsking-x_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh beelink-s922x /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Beelink released an Amlogic "SDK" dump in their forums but the U-Boot sources 
included
+result in 2GB RAM detected. The following FIPs were generated with newer 
sources and
+detect 4GB RAM: 
https://github.com/LibreELEC/amlogic-boot-fip/tree/master/beelink-s922x
+
+.. code-block:: bash
+
+$ wget https://github.com/LibreELEC/amlogic-boot-fip/archive/master.zip
+$ unzip master.zip
+$ export FIPDIR=$PWD/amlogic-boot-fip/beelink-s922x
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+$ cp $FIPDIR/* fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ sh fip/blx_fix.sh \
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
+
+$ sh fip/blx_fix.sh \
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
+
+$ fip/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+   --output fip/bl30_new.bin.g12a.enc \
+   --level v3
+$ fip/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
+   --output fip/bl30_new.bin.enc \
+   --level v3 --type bl30
+$ fip/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
+   --output fip/bl31.img.enc \
+   --level v3 --type bl31
+$ fip/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
+   --output fip/bl33.bin.enc \
+   --level v3 --type bl33
+$ fip/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
+   --output fip/bl2.n.bin.sig
+$ fip/aml_encrypt_g12b --bootmk \
+   --output fip/u-boot.bin \
+   --bl2 fip/bl2.n.bin.sig \
+   --bl30 fip/bl30_new.bin.enc \
+   --bl31 fip/bl31.img.enc \
+   --bl33 fip/bl33.bin.enc \
+   --ddrfw1 fip/ddr4_1d.fw \
+   --ddrfw2 fip/ddr4_2d.fw \
+   --ddrfw3

[PATCH 33/33] doc: boards: amlogic: add documentation for ODROID-HC4

2023-03-20 Thread Christian Hewitt
Add separate documentation for the ODROID-HC4 board to ensure
users build U-Boot using the HC4 defconfig that enables PCIe
SATA boot. This avoids user frustration trying to boot after
using the C4 recipe which only works from SD card.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/index.rst  |   1 +
 doc/board/amlogic/odroid-hc4.rst | 141 +++
 2 files changed, 142 insertions(+)
 create mode 100644 doc/board/amlogic/odroid-hc4.rst

diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index 7c4c161e0d..9b76bca427 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -101,6 +101,7 @@ Board Documentation
nanopi-k2
odroid-c2
odroid-c4
+   odroid-hc4
odroid-n2
odroid-n2l
odroid-go-ultra
diff --git a/doc/board/amlogic/odroid-hc4.rst b/doc/board/amlogic/odroid-hc4.rst
new file mode 100644
index 00..94c3312022
--- /dev/null
+++ b/doc/board/amlogic/odroid-hc4.rst
@@ -0,0 +1,141 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for ODROID-HC4 (S905X3)
+==
+
+ODROID-HC4 is a variant of the ODROID-C4 single board computer manufactured by 
Hardkernel
+with the following specification:
+
+ - Amlogic S905X3 Arm Cortex-A55 quad-core SoC
+ - 4GB DDR4 SDRAM
+ - 16MB XT25F128B SPI-NOR flash
+ - Gigabit Ethernet
+ - HDMI 2.1 display
+ - 7-pin GPIO header for OLED display and RTC
+ - 1x USB 2.0 host (micro)
+ - 2x SATA ports via ASM1061 PCIe to SATA controller
+ - microSD
+ - UART serial
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make odroid-hc4_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh odroid-hc4 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
+
+.. code-block:: bash
+
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+$ DIR=odroid-hc4
+$ git clone --depth 1 https://github.com/hardkernel/u-boot.git -b 
odroidg12-v2015.01 $DIR
+
+$ cd odroid-hc4
+$ make odroidc4_defconfig
+$ make
+$ export UBOOTDIR=$PWD
+
+Go back to mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+
+$ wget 
https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh
 -O fip/blx_fix.sh
+$ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+$ cp $UBOOTDIR/build/board/hardkernel/odroidc4/firmware/acs.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl2.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl30.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl31.img fip/
+$ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/piei.fw fip/
+$ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ sh fip/blx_fix.sh \
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
+
+$ sh fip/blx_fix.sh \
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
+
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
+--output 
fip/bl30_new.bin.g12a.enc \
+--level v3
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input 
fip/bl30_new.bin.g12a.enc \
+   --output 
fip/bl30_new.bin.enc \
+   --level v3 --type bl30
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img

[PATCH 31/33] doc: boards: amlogic: add documentation for BananaPi M5

2023-03-20 Thread Christian Hewitt
Add missing build documentation for the BPI-M5 board.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/bananapi-m5.rst | 141 ++
 doc/board/amlogic/index.rst   |   1 +
 2 files changed, 142 insertions(+)
 create mode 100644 doc/board/amlogic/bananapi-m5.rst

diff --git a/doc/board/amlogic/bananapi-m5.rst 
b/doc/board/amlogic/bananapi-m5.rst
new file mode 100644
index 00..ddc14b4eef
--- /dev/null
+++ b/doc/board/amlogic/bananapi-m5.rst
@@ -0,0 +1,141 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for BananaPi BPI-M5 (S905X3)
+===
+
+BananaPi BPI-M5 is a Single Board Computer manufactured by Sinovoip with the 
following
+specification:
+
+ - Amlogic S905X3 Arm Cortex-A55 quad-core SoC
+ - 4GB DDR4 SDRAM
+ - 16GB eMMC
+ - Gigabit Ethernet
+ - HDMI 2.1 display
+ - 40-pin GPIO header
+ - 4x USB 3.0 Host
+ - 1x USB-C (power)
+ - microSD
+ - UART serial
+ - Infrared receiver
+
+Schematics are available from the manufacturer: 
https://wiki.banana-pi.org/Banana_Pi_BPI-M5
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make bananapi-m5_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh bananapi-m5 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
+
+.. code-block:: bash
+
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+$ DIR=bananapi-m5
+$ git clone --depth 1 https://github.com/Dangku/amlogic-u-boot.git -b 
odroidg12-v2015.01-c4-m5 $DIR
+
+$ cd $DIR
+$ make bananapi_m5_defconfig
+$ make
+$ export UBOOTDIR=$PWD
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+
+$ wget 
https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh
 -O fip/blx_fix.sh
+$ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+$ cp $UBOOTDIR/build/board/bananapi/bananpi_m5/firmware/acs.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl2.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl30.bin fip/
+$ cp $UBOOTDIR/fip/g12a/bl31.img fip/
+$ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
+$ cp $UBOOTDIR/fip/g12a/piei.fw fip/
+$ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ sh fip/blx_fix.sh \
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
+
+$ sh fip/blx_fix.sh \
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
+
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
+  --output fip/bl30_new.bin.g12a.enc \
+  --level v3
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input 
fip/bl30_new.bin.g12a.enc \
+  --output fip/bl30_new.bin.enc \
+  --level v3 --type bl30
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
+  --output fip/bl31.img.enc \
+  --level v3 --type bl31
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin 
--compress lz4 \
+  --output fip/bl33.bin.enc \
+  --level v3 --type bl33 --compress lz4
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
+  --output fip/bl2.n.bin.sig
+$ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk

[PATCH 28/33] doc: boards: amlogic: update documentation for W400

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/w400.rst | 115 -
 1 file changed, 61 insertions(+), 54 deletions(-)

diff --git a/doc/board/amlogic/w400.rst b/doc/board/amlogic/w400.rst
index 38dbf52fb9..634fe1298d 100644
--- a/doc/board/amlogic/w400.rst
+++ b/doc/board/amlogic/w400.rst
@@ -1,15 +1,14 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Amlogic W400
-===
+U-Boot for Amlogic W400 (S922X)
+===
 
-U200 is a reference board manufactured by Amlogic with the following
-specifications:
+W400 is a reference board manufactured by Amlogic with the following 
specification:
 
  - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
  - 2GB DDR4 SDRAM
  - 10/100 Ethernet (Internal PHY)
- - 1 x USB 3.0 Host
+ - 1x USB 3.0 Host
  - eMMC
  - SDcard
  - Infrared receiver
@@ -20,7 +19,7 @@ specifications:
 
 Schematics are available from Amlogic on demand.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -29,12 +28,20 @@ U-Boot compilation
 $ make w400_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh jethub-j100 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -49,7 +56,7 @@ the git tree published by the board vendor:
 $ make
 $ export UBOOTDIR=$PWD
 
-Download the latest Amlogic Buildroot package, and extract it :
+Download the latest Amlogic buildroot package and extract it:
 
 .. code-block:: bash
 
@@ -58,7 +65,7 @@ Download the latest Amlogic Buildroot package, and extract it 
:
 $ export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
 $ export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -81,57 +88,57 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ sh fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
 
 $ sh fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
 
 $ $FIPDIR/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3
+  --output 
fip/bl30_new.bin.g12a.enc \
+  --level v3
 $ $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc 
\
-   --output fip/bl30_new.bin.enc \
-   --level v3 --type bl30
+ --output fip/bl30_new.bin.enc \
+ --level v3 --type bl30
 $ $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
-   --output fip/bl31.img.enc \
-   --level v3 --type bl31
+ --output fip/bl31.img.enc \
+ --level v3 --type bl31
 $ $FIPDIR/g12b/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress 
lz4 \
-   --output fip/bl33.bin.enc \
-   --level v3 --type bl33
+ --output fip/bl33.bin.enc \
+ --level v3 --type bl33
 $ $FIPDIR/g12b/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
-   --output fip/bl2.n.bin.sig
+ --output fip/bl2

[PATCH 29/33] doc: boards: amlogic: update documentation for WeTek Core2

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/wetek-core2.rst | 83 +--
 1 file changed, 47 insertions(+), 36 deletions(-)

diff --git a/doc/board/amlogic/wetek-core2.rst 
b/doc/board/amlogic/wetek-core2.rst
index 0147d5fbe2..5eba566af4 100644
--- a/doc/board/amlogic/wetek-core2.rst
+++ b/doc/board/amlogic/wetek-core2.rst
@@ -1,23 +1,24 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for WeTek Core2
-==
+U-Boot for WeTek Core2 (S912)
+=
 
-WeTek Core2 is an Android STB based on the Q200 reference design with
-the following specifications:
+WeTek Core2 is an Android STB based on the Q200 reference design with the 
following
+specifications:
 
  - Amlogic S912 ARM Cortex-A53 octo-core SoC @ 1.5GHz
  - ARM Mali T820 GPU
  - 3GB DDR4 SDRAM
  - 10/100 Realtek RTL8152 Ethernet (internal USB)
  - HDMI 2.0 4K/60Hz display
- - 2x USB 2.0 Host, 1x USB 2.0 OTG (internal)
+ - 2x USB 2.0 Host
+ - 1x USB 2.0 OTG (internal)
  - 32GB eMMC
  - microSD
  - SDIO Wifi Module, Bluetooth
  - Two channel IR receiver
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -26,15 +27,21 @@ U-Boot compilation
 $ make wetek-core2_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`wetek-core2`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh wetek-core2 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic does not provide sources for the firmware or the tools needed
-to create the bootloader image, and WeTek has not publicly shared the
-precompiled FIP binaries. However the public Khadas VIM2 sources also
-work with the Core2 box so we can use the Khadas git tree:
+Amlogic does not provide firmware sources or tools needed to create the 
bootloader image
+and WeTek has not publicly shared the precompiled FIP binaries. However the 
Khadas VIM2
+sources also work with the Core2 box so we can use the Khadas git tree:
 
 .. code-block:: bash
 
@@ -49,7 +56,7 @@ work with the Core2 box so we can use the Khadas git tree:
 $ make
 $ export FIPDIR=$PWD/fip
 
-Go back to mainline U-Boot source tree then:
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -61,38 +68,42 @@ Go back to mainline U-Boot source tree then:
 $ cp $FIPDIR/gxl/bl301.bin fip/
 $ cp $FIPDIR/gxl/bl31.img fip/
 $ cp u-boot.bin fip/bl33.bin
+
 $ $FIPDIR/blx_fix.sh \
-fip/bl30.bin \
-fip/zero_tmp \
-fip/bl30_zero.bin \
-fip/bl301.bin \
-fip/bl301_zero.bin \
-fip/bl30_new.bin \
-bl30
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
+
 $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
+
 $ $FIPDIR/blx_fix.sh \
-fip/bl2_acs.bin \
-fip/zero_tmp \
-fip/bl2_zero.bin \
-fip/bl21.bin \
-fip/bl21_zero.bin \
-fip/bl2_new.bin \
-bl2
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
+
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output 
fip/bl2.n.bin.sig
 $ $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
---output fip/u-boot.bin \
---bl2 fip/bl2.n.bin.sig \
---bl30 fip/bl30_new.bin.enc \
---bl31 fip/bl31.img.enc \
---bl33 fip/bl33.bin.enc
+  --output fip/u-boot.bin \
+  --bl2 fip/bl2.n.bin.sig \
+  --bl30 fip/bl30_new.bin.enc \
+  --bl31 fip/bl31.img.enc \
+  --bl33 fip/bl33.bin.enc
 
-then write the image to SD with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_sd_device
+$ DEV=/dev/boot_device
 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 30/33] doc: boards: amlogic: add documentation for BananaPi CM4IO

2023-03-20 Thread Christian Hewitt
Add build instructions for the BananaPi BPI-CM4IO carrier board with
BPI-CM4 module.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/u200/MAINTAINERS   |   1 -
 board/amlogic/w400/MAINTAINERS   |   2 +
 doc/board/amlogic/bananapi-cm4io.rst | 152 +++
 doc/board/amlogic/index.rst  |   1 +
 4 files changed, 155 insertions(+), 1 deletion(-)
 create mode 100644 doc/board/amlogic/bananapi-cm4io.rst

diff --git a/board/amlogic/u200/MAINTAINERS b/board/amlogic/u200/MAINTAINERS
index 7535e489d1..47cec234a1 100644
--- a/board/amlogic/u200/MAINTAINERS
+++ b/board/amlogic/u200/MAINTAINERS
@@ -4,7 +4,6 @@ S:  Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/u200/
 F: configs/u200_defconfig
-F: configs/bananapi-cm4-cm4io_defconfig
 F: configs/bananapi-m5_defconfig
 F: configs/radxa-zero_defconfig
 F: doc/board/amlogic/u200.rst
diff --git a/board/amlogic/w400/MAINTAINERS b/board/amlogic/w400/MAINTAINERS
index 96ccda2001..26a4c2c587 100644
--- a/board/amlogic/w400/MAINTAINERS
+++ b/board/amlogic/w400/MAINTAINERS
@@ -3,4 +3,6 @@ M:  Neil Armstrong 
 S: Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/w400/
+F: configs/bananapi-cm4-cm4io_defconfig
 F: doc/board/amlogic/w400.rst
+F: doc/board/amlogic/bananapi-cm4io.rst
diff --git a/doc/board/amlogic/bananapi-cm4io.rst 
b/doc/board/amlogic/bananapi-cm4io.rst
new file mode 100644
index 00..aabe2ef197
--- /dev/null
+++ b/doc/board/amlogic/bananapi-cm4io.rst
@@ -0,0 +1,152 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for BananaPi CM4 with CM4IO (A311D)
+==
+
+BPI-CM4 is a system-on-module board manufactured by Sinovoip. It follows the 
Raspberry Pi
+CM4 interface specification but with a single HDMI port and a single DSI 
output:
+
+ - Amlogic A311D Arm Cortex-A53 dual-core + Cortex-A73 quad-core SoC 
+ - 4GB DDR4 SDRAM
+ - 16GB eMMC
+ - NPU
+ - HDMI 2.1 display
+ - Gigabit Ethernet
+ - RTL8822CS WiFi (a/b/g/n/ac) + BT 5.0
+
+BPI-CM4IO is a carrier board for the BPI-CM4 module with the following 
specification:
+
+ - CM4 interface
+ - HDMI interface
+ - MIPI CSI interface
+ - MIPI DSI interface
+ - Ethernet interface
+ - PCIe interface
+ - SD (micro)
+ - SIM (micro)
+ - 26-pin GPIO
+ - UART serial
+ - 1x USB-C (power)
+ - 2x USB 2.0
+
+Schematics are available from the manufacturer: 
https://wiki.banana-pi.org/Banana_Pi_BPI-CM4
+
+U-Boot Compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make bananapi-cm4io_defconfig
+$ make
+
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh bananapi-cm4io /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
+
+.. code-block:: bash
+
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+$ DIR=bananapi-cm4io
+$ git clone --depth 1 https://github.com/Dangku/amlogic-u-boot.git -b 
khadas-g12b-v2015.01-m2s $DIR
+
+$ cd $DIR
+$ make bananapi_cm4_defconfig
+$ make
+$ export UBDIR=$PWD
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+
+$ wget 
https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/blx_fix_g12a.sh
 -O fip/blx_fix.sh
+$ cp $UBDIR/build/scp_task/bl301.bin fip/
+$ cp $UBDIR/build/board/bananapi/bananpi_cm4/firmware/acs.bin fip/
+$ cp $UBDIR/fip/g12a/bl2.bin fip/
+$ cp $UBDIR/fip/g12a/bl30.bin fip/
+$ cp $UBDIR/fip/g12a/bl31.img fip/
+$ cp $UBDIR/fip/g12a/ddr3_1d.fw fip/
+$ cp $UBDIR/fip/g12a/ddr4_1d.fw fip/
+$ cp $UBDIR/fip/g12a/ddr4_2d.fw fip/
+$ cp $UBDIR/fip/g12a/diag_lpddr4.fw fip/
+$ cp $UBDIR/fip/g12a/lpddr3_1d.fw fip/
+$ cp $UBDIR/fip/g12a/lpddr4_1d.fw fip/
+$ cp $UBDIR/fip/g12a/lpddr4_2d.fw fip/
+$ cp $UBDIR/fip/g12a/piei.fw fip/
+$ cp $UBDIR/fip/g12a/aml_ddr.fw fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ sh fip/blx_fix.sh \
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip

[PATCH 27/33] doc: boards: amlogic: update documentation for U200

2023-03-20 Thread Christian Hewitt
Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/u200.rst | 113 +++--
 1 file changed, 59 insertions(+), 54 deletions(-)

diff --git a/doc/board/amlogic/u200.rst b/doc/board/amlogic/u200.rst
index 53213fdb68..6d1d66b4ea 100644
--- a/doc/board/amlogic/u200.rst
+++ b/doc/board/amlogic/u200.rst
@@ -1,15 +1,14 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Amlogic U200
-===
+U-Boot for Amlogic U200 (S905X2)
+
 
-U200 is a reference board manufactured by Amlogic with the following
-specifications:
+U200 is a reference board manufactured by Amlogic with the following 
specification:
 
  - Amlogic S905D2 ARM Cortex-A53 quad-core SoC
  - 2GB DDR4 SDRAM
  - 10/100 Ethernet (Internal PHY)
- - 1 x USB 3.0 Host
+ - 1x USB 3.0 Host
  - eMMC
  - SDcard
  - Infrared receiver
@@ -20,7 +19,7 @@ specifications:
 
 Schematics are available from Amlogic on demand.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -29,14 +28,20 @@ U-Boot compilation
 $ make u200_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`u200`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh u200 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -51,7 +56,7 @@ the git tree published by the board vendor:
 $ make
 $ export UBOOTDIR=$PWD
 
-Download the latest Amlogic Buildroot package, and extract it :
+Download the latest Amlogic buildroot package and extract it:
 
 .. code-block:: bash
 
@@ -60,7 +65,7 @@ Download the latest Amlogic Buildroot package, and extract it 
:
 $ export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
 $ export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -82,56 +87,56 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ sh fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
 
 $ sh fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
 
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3
+  --output 
fip/bl30_new.bin.g12a.enc \
+  --level v3
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc 
\
-   --output fip/bl30_new.bin.enc \
-   --level v3 --type bl30
+ --output fip/bl30_new.bin.enc \
+ --level v3 --type bl30
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
-   --output fip/bl31.img.enc \
-   --level v3 --type bl31
+ --output fip/bl31.img.enc \
+ --level v3 --type bl31
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress 
lz4 \
-   --output fip/bl33.bin.enc \
-   --level v3 --type bl33
+ --output fip/bl33.bin.enc \
+ --level v3 --type bl33
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
-   --output fip/bl2.n.bin.sig

[PATCH 25/33] doc: boards: amlogic: update documentation for SEI510

2023-03-20 Thread Christian Hewitt
Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/sei510.rst | 113 ++-
 1 file changed, 59 insertions(+), 54 deletions(-)

diff --git a/doc/board/amlogic/sei510.rst b/doc/board/amlogic/sei510.rst
index c55e778494..09b0f53e16 100644
--- a/doc/board/amlogic/sei510.rst
+++ b/doc/board/amlogic/sei510.rst
@@ -1,21 +1,20 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Amlogic SEI510
-=
+U-Boot for Amlogic SEI510 (S905X2)
+==
 
-SEI510 is a customer board manufactured by SEI Robotics with the following
-specifications:
+SEI510 is a customer board manufactured by SEI Robotics with the following 
specification:
 
  - Amlogic S905X2 ARM Cortex-A53 quad-core SoC
  - 2GB DDR4 SDRAM
  - 10/100 Ethernet (Internal PHY)
- - 1 x USB 3.0 Host
+ - 1x USB 3.0 Host
  - eMMC
  - SDcard
  - Infrared receiver
  - SDIO WiFi Module
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -24,14 +23,20 @@ U-Boot compilation
 $ make sei510_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`sei510`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh sei510 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -46,7 +51,7 @@ the git tree published by the board vendor:
 $ make
 $ export UBOOTDIR=$PWD
 
-Download the latest Amlogic Buildroot package, and extract it :
+Download the latest Amlogic Buildroot package and extract it:
 
 .. code-block:: bash
 
@@ -55,7 +60,7 @@ Download the latest Amlogic Buildroot package, and extract it 
:
 $ export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180706
 $ export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -77,56 +82,56 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ sh fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
 
 $ sh fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
 
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3
+  --output 
fip/bl30_new.bin.g12a.enc \
+  --level v3
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc 
\
-   --output fip/bl30_new.bin.enc \
-   --level v3 --type bl30
+ --output fip/bl30_new.bin.enc \
+ --level v3 --type bl30
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
-   --output fip/bl31.img.enc \
-   --level v3 --type bl31
+ --output fip/bl31.img.enc \
+ --level v3 --type bl31
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress 
lz4 \
-   --output fip/bl33.bin.enc \
-   --level v3 --type bl33
+ --output fip/bl33.bin.enc \
+ --level v3 --type bl33
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
-   --output fip/bl2.n.bin.sig
+ --output fip

[PATCH 22/33] doc: boards: amlogic: update documentation for Q200

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/q200.rst | 76 +-
 1 file changed, 42 insertions(+), 34 deletions(-)

diff --git a/doc/board/amlogic/q200.rst b/doc/board/amlogic/q200.rst
index 3ac4116be4..c304980579 100644
--- a/doc/board/amlogic/q200.rst
+++ b/doc/board/amlogic/q200.rst
@@ -1,24 +1,24 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Amlogic Q200
-===
+U-Boot for Amlogic Q200 (S912)
+==
 
-Q200 is a reference board manufactured by Amlogic with the following
-specifications:
+Q200 is a reference board manufactured by Amlogic with the following 
specifications:
 
  - Amlogic S912 ARM Cortex-A53 octo-core SoC @ 1.5GHz
  - ARM Mali T860 GPU
  - 2/3GB DDR4 SDRAM
  - 10/100/1000 Ethernet
  - HDMI 2.0 4K/60Hz display
- - 2 x USB 2.0 Host, 1 x USB 2.0 Device
+ - 2x USB 2.0 Host
+ - 1x USB 2.0 Device
  - 16GB/32GB/64GB eMMC
  - 2MB SPI Flash
  - microSD
  - SDIO Wifi Module, Bluetooth
  - IR receiver
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -27,12 +27,20 @@ U-Boot compilation
 $ make khadas-vim2_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh q200 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
+
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image but sources have been shared by Linux development contractor, Baylibre:
 
 .. code-block:: bash
 
@@ -47,7 +55,7 @@ the git tree published by the board vendor:
 $ make
 $ export FIPDIR=$PWD/fip
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -62,40 +70,40 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
 
 $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl2_acs.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/bl21.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
 
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output 
fip/bl2.n.bin.sig
 $ $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
-   --output fip/u-boot.bin \
-   --bl2 fip/bl2.n.bin.sig \
-   --bl30 fip/bl30_new.bin.enc \
-   --bl31 fip/bl31.img.enc \
-   --bl33 fip/bl33.bin.enc
+  --output fip/u-boot.bin \
+  --bl2 fip/bl2.n.bin.sig \
+  --bl30 fip/bl30_new.bin.enc \
+  --bl31 fip/bl31.img.enc \
+  --bl33 fip/bl33.bin.enc
 
-and then write the image to SD with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_sd_device
+$ DEV=/dev/boot_device
 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 26/33] doc: boards: amlogic: update documentation for SEI610

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/sei610.rst | 118 ++-
 1 file changed, 61 insertions(+), 57 deletions(-)

diff --git a/doc/board/amlogic/sei610.rst b/doc/board/amlogic/sei610.rst
index 2d754497cc..84aaeff4ed 100644
--- a/doc/board/amlogic/sei610.rst
+++ b/doc/board/amlogic/sei610.rst
@@ -1,23 +1,22 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Amlogic SEI610
-=
+U-Boot for Amlogic SEI610 (S905X3)
+==
 
-SEI610 is a customer board manufactured by SEI Robotics with the following
-specifications:
+SEI610 is a customer board manufactured by SEI Robotics with the following 
specification:
 
  - Amlogic S905X3 ARM Cortex-A55 quad-core SoC
  - 2GB DDR4 SDRAM
  - 10/100 Ethernet (Internal PHY)
- - 1 x USB 3.0 Host
- - 1 x USB Type-C DRD
- - 1 x FTDI USB Serial Debug Interface
+ - 1x USB 3.0 Host
+ - 1x USB Type-C DRD
+ - 1x FTDI USB Serial Debug Interface
  - eMMC
  - SDcard
  - Infrared receiver
  - SDIO WiFi Module
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -26,14 +25,20 @@ U-Boot compilation
 $ make sei610_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`sei610`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh sei610 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -48,7 +53,7 @@ the git tree published by the board vendor:
 $ make
 $ export UBOOTDIR=$PWD
 
-Download the latest Amlogic Buildroot package, and extract it :
+Download the latest Amlogic buildroot package and extract it:
 
 .. code-block:: bash
 
@@ -57,8 +62,7 @@ Download the latest Amlogic Buildroot package, and extract it 
:
 $ export BRDIR=$PWD/buildroot-openlinux-A113-201901
 $ export FIPDIR=$BRDIR/bootloader/uboot-repo/fip
 
-Go back to mainline U-Boot source tree then :
-
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -80,56 +84,56 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ sh fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
 
 $ sh fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
 
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3
+  --output 
fip/bl30_new.bin.g12a.enc \
+  --level v3
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc 
\
-   --output fip/bl30_new.bin.enc \
-   --level v3 --type bl30
+ --output fip/bl30_new.bin.enc \
+ --level v3 --type bl30
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
-   --output fip/bl31.img.enc \
-   --level v3 --type bl31
+ --output fip/bl31.img.enc \
+ --level v3 --type bl31
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress 
lz4 \
-   --output fip/bl33.bin.enc \
-   --level v3 --type bl33
+ --output fip/bl33.bin.enc \
+ --level v3 --type bl33
 $ $FIPDIR/g12a/aml_encrypt_g12a --bl2sig --input fip

[PATCH 24/33] doc: boards: amlogic: update documentation for S400

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/s400.rst | 89 --
 1 file changed, 47 insertions(+), 42 deletions(-)

diff --git a/doc/board/amlogic/s400.rst b/doc/board/amlogic/s400.rst
index c92817b421..b00fe64e1b 100644
--- a/doc/board/amlogic/s400.rst
+++ b/doc/board/amlogic/s400.rst
@@ -1,15 +1,14 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Amlogic S400
-===
+U-Boot for Amlogic S400 (A113X)
+===
 
-S400 is a reference board manufactured by Amlogic with the following
-specifications:
+S400 is a reference board manufactured by Amlogic with the following 
specifications:
 
- - Amlogic A113DX ARM Cortex-A53 quad-core SoC @ 1.2GHz
+ - Amlogic A113X ARM Cortex-A53 quad-core SoC @ 1.2GHz
  - 1GB DDR4 SDRAM
  - 10/100 Ethernet
- - 2 x USB 2.0 Host
+ - 2x USB 2.0 Host
  - eMMC
  - Infrared receiver
  - SDIO WiFi Module
@@ -19,7 +18,7 @@ specifications:
 
 Schematics are available from Amlogic on demand.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -28,14 +27,20 @@ U-Boot compilation
 $ make s400_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`s400`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh s400 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image but sources have been shared by Linux development contractor, Baylibre:
 
 .. code-block:: bash
 
@@ -65,47 +70,47 @@ Go back to mainline U-boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
 
 $ $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl2_acs.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/bl21.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
 
 $ $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.enc \
-   --level v3 --type bl30
+   --output fip/bl30_new.bin.enc \
+   --level v3 --type bl30
 $ $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl31.img \
-   --output fip/bl31.img.enc \
-   --level v3 --type bl31
+   --output fip/bl31.img.enc \
+   --level v3 --type bl31
 $ $FIPDIR/axg/aml_encrypt_axg --bl3sig --input fip/bl33.bin --compress lz4 
\
-   --output fip/bl33.bin.enc \
-   --level v3 --type bl33
+   --output fip/bl33.bin.enc \
+   --level v3 --type bl33
 $ $FIPDIR/axg/aml_encrypt_axg --bl2sig --input fip/bl2_new.bin \
-   --output fip/bl2.n.bin.sig
+   --output fip/bl2.n.bin.sig
 $ $FIPDIR/axg/aml_encrypt_axg --bootmk \
-   --output fip/u-boot.bin \
-   --bl2 fip/bl2.n.bin.sig \
-   --bl30 fip/bl30_new.bin.enc \
-   --bl31 fip/bl31.img.enc \
-   --bl33 fip/bl33.bin.enc --level v3
+  --output fip/u-boot.bin \
+  --bl2 fip/bl2.n.bin.sig \
+  --bl30 fip/bl30_new.bin.enc \
+  --bl31 fip/bl31.img.enc \
+  --bl33 fip/bl33.bin.enc --level v3
 
-and then write the image to SD with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash

[PATCH 21/33] doc: boards: amlogic: update documentation for P201

2023-03-20 Thread Christian Hewitt
Improve documentation. Notably we can now support U-Boot install to
the internal eMMC storage in addition to SD cards.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/p201.rst | 87 +++---
 1 file changed, 53 insertions(+), 34 deletions(-)

diff --git a/doc/board/amlogic/p201.rst b/doc/board/amlogic/p201.rst
index 2cd236582a..b3dce4204e 100644
--- a/doc/board/amlogic/p201.rst
+++ b/doc/board/amlogic/p201.rst
@@ -1,25 +1,24 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Amlogic P201
-===
+U-Boot for Amlogic P201 (S905)
+==
 
-P201 is a reference board manufactured by Amlogic with the following
-specifications:
+P201 is a reference board manufactured by Amlogic with the following 
specifications:
 
  - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
  - ARM Mali 450 GPU
  - 2GB DDR3 SDRAM
  - 10/100 Ethernet
  - HDMI 2.0 4K/60Hz display
- - 2 x USB 2.0 Host
+ - 2x USB 2.0 Host
  - eMMC, microSD
  - Infrared receiver
  - SDIO WiFi Module
- - CVBS+Stereo Audio Jack
+ - CVBS + Stereo Audio Jack
 
 Schematics are available from Amlogic on demand.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -28,14 +27,20 @@ U-Boot compilation
 $ make p201_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`p201`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh p201 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image but sources have been shared by Linux development contractor, Baylibre:
 
 .. code-block:: bash
 
@@ -63,37 +68,51 @@ Go back to mainline U-boot source tree then :
 $ cp $FIPDIR/gxb/bl301.bin fip/
 $ cp $FIPDIR/gxb/bl31.img fip/
 $ cp u-boot.bin fip/bl33.bin
+$ wget 
https://github.com/LibreELEC/amlogic-boot-fip/raw/master/nanopi-k2/bl1.bin.hardkernel
 fip/bl1.bin.hardkernel
+$ chmod +x fip/bl1.bin.hardkernel
+$ wget 
https://github.com/LibreELEC/amlogic-boot-fip/raw/master/nanopi-k2/aml_chksum 
fip/aml_chksum
+$ chmod +x fip/aml_chksum
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl30.bin \
-fip/zero_tmp \
-fip/bl30_zero.bin \
-fip/bl301.bin \
-fip/bl301_zero.bin \
-fip/bl30_new.bin \
-bl30
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
 
 $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
 
 $ $FIPDIR/blx_fix.sh \
-fip/bl2_acs.bin \
-fip/zero_tmp \
-fip/bl2_zero.bin \
-fip/bl21.bin \
-fip/bl21_zero.bin \
-fip/bl2_new.bin \
-bl2
-
-$ $FIPDIR/fip_create --bl30 fip/bl30_new.bin --bl31 fip/bl31.img --bl33 
fip/bl33.bin fip/fip.bin
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
+
+$ $FIPDIR/fip_create --bl30 fip/bl30_new.bin \
+ --bl31 fip/bl31.img \
+ --bl33 fip/bl33.bin \
+ fip/fip.bin
 
 $ cat fip/bl2_new.bin fip/fip.bin >fip/boot_new.bin
 
-$ $FIPDIR/gxb/aml_encrypt_gxb --bootsig --input fip/boot_new.bin --output 
fip/u-boot.bin
+$ $FIPDIR/gxb/aml_encrypt_gxb --bootsig \
+  --input fip/boot_new.bin \
+  --output fip/u-boot.bin
 
-and then write the image to SD with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_sd_device
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
+$ DEV=/dev/boot_device
+$ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 conv=fsync
+$ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 seek=9 skip=8 
count=87 conv=fsync,notrunc
+$ dd if=/dev/zero of=fip/u-boot.bin.gxbb bs=512 seek=8 count=1 
conv=fsync,notrunc
+$ dd if=bl1.bin.hardkernel of=fip/u-boot.bin.gxbb bs=512 seek=2 skip=2 
count=1 conv=fsync,notrunc
+$ ./aml_chksum fip/u-boot.bin.gxbb
+$ dd if=fip/u-boot.gxbb of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
+$

[PATCH 18/33] doc: boards: amlogic: update documentation for ODROID-N2/N2+

2023-03-20 Thread Christian Hewitt
Improve documentation. Notably mention the ODROID-N2+ and the option
to use FDTDIR not FDT for automatic device-tree selection.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/odroid-n2.rst | 122 +---
 1 file changed, 65 insertions(+), 57 deletions(-)

diff --git a/doc/board/amlogic/odroid-n2.rst b/doc/board/amlogic/odroid-n2.rst
index 7aad36e003..8ca1f89699 100644
--- a/doc/board/amlogic/odroid-n2.rst
+++ b/doc/board/amlogic/odroid-n2.rst
@@ -1,10 +1,10 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for ODROID-N2
-
+U-Boot for ODROID-N2/N2+ (S922X)
+
 
-ODROID-N2 is a single board computer manufactured by Hardkernel
-Co. Ltd with the following specifications:
+ODROID-N2 and ODROID-N2+ are a Single Board Computers manufactured by 
Hardkernel with the
+following specifications:
 
  - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
  - 4GB DDR4 SDRAM
@@ -15,9 +15,13 @@ Co. Ltd with the following specifications:
  - eMMC, microSD
  - Infrared receiver
 
-Schematics are available on the manufacturer website.
+ODROID-N2+ uses Rev-C silicon allowing higher CPU opp-points. U-Boot contains 
logic to
+read the model detail from SARADC and select the correct device-tree file if 
FDTDIR is
+used instead of an FDT reference to a specfic device-tree.
 
-U-Boot compilation
+Schematics are available on the manufacturer website: https://wiki.odroid.com
+
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -26,14 +30,20 @@ U-Boot compilation
 $ make odroid-n2_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh odroid-n2 /path/to/u-boot/u-boot.bin my-output-dir
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`odroid-n2` or `odroid-n2-plus`
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -44,16 +54,14 @@ the git tree published by the board vendor:
 $ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
 
 $ DIR=odroid-n2
-$ git clone --depth 1 \
-   https://github.com/hardkernel/u-boot.git -b odroidn2-v2015.01 \
-   $DIR
+$ git clone --depth 1 https://github.com/hardkernel/u-boot.git -b 
odroidn2-v2015.01 $DIR
 
 $ cd odroid-n2
 $ make odroidn2_defconfig
 $ make
 $ export UBOOTDIR=$PWD
 
- Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -76,57 +84,57 @@ the git tree published by the board vendor:
 $ cp u-boot.bin fip/bl33.bin
 
 $ sh fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
 
 $ sh fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
 
 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3
+  --output fip/bl30_new.bin.g12a.enc \
+  --level v3
 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input 
fip/bl30_new.bin.g12a.enc \
-   --output fip/bl30_new.bin.enc \
-   --level v3 --type bl30
+  --output fip/bl30_new.bin.enc \
+  --level v3 --type bl30
 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
-   --output fip/bl31.img.enc \
-   --level v3 --type bl31
+  --output fip/bl31.img.enc

[PATCH 16/33] doc: boards: amlogic: update documentation for ODROID-C4

2023-03-20 Thread Christian Hewitt
Improve documentation. Notably drop references to the ODROID-HC4 board
as its support has evolved and we will add an HC4 specific document in
a later patch.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/odroid-c4.rst | 117 
 1 file changed, 60 insertions(+), 57 deletions(-)

diff --git a/doc/board/amlogic/odroid-c4.rst b/doc/board/amlogic/odroid-c4.rst
index b512c6a3d8..89198cda91 100644
--- a/doc/board/amlogic/odroid-c4.rst
+++ b/doc/board/amlogic/odroid-c4.rst
@@ -1,10 +1,10 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for ODROID-C4
-
+U-Boot for ODROID-C4 (S905X3)
+=
 
-ODROID-C4 is a single board computer manufactured by Hardkernel
-Co. Ltd with the following specifications:
+ODROID-C4 is a Single Board Computer manufactured by Hardkernel with the 
following
+specifications:
 
  - Amlogic S905X3 Arm Cortex-A55 quad-core SoC
  - 4GB DDR4 SDRAM
@@ -17,12 +17,9 @@ Co. Ltd with the following specifications:
  - UART serial
  - Infrared receiver
 
-The ODROID-HC4 is a variant with a PCIe-SATA controller, the same commands
-applies for HC4.
-
 Schematics are available on the manufacturer website.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -31,14 +28,20 @@ U-Boot compilation
 $ make odroid-c4_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh odroid-c4 /path/to/u-boot/u-boot.bin my-output-dir
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`odroid-c4` or `odroid-hc4`
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -58,7 +61,7 @@ the git tree published by the board vendor:
 $ make
 $ export UBOOTDIR=$PWD
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -82,58 +85,58 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ sh fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
 
 $ sh fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
 
 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3
+  --output fip/bl30_new.bin.g12a.enc \
+  --level v3
 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input 
fip/bl30_new.bin.g12a.enc \
-   --output fip/bl30_new.bin.enc \
-   --level v3 --type bl30
+  --output fip/bl30_new.bin.enc \
+  --level v3 --type bl30
 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
-   --output fip/bl31.img.enc \
-   --level v3 --type bl31
+  --output fip/bl31.img.enc \
+  --level v3 --type bl31
 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin 
--compress lz4 \
-   --output fip/bl33.bin.enc \
-   --level v3 --type bl33 --compress lz4
+  --output fip/bl33.bin.enc \
+  --level v3 --type bl33 --compress lz4
 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
-   --output fip/bl2.n.bin.sig
+  --output fip/bl2.n.bin.sig

[PATCH 17/33] doc: boards: amlogic: update documentation for ODROID GO ULTRA

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/odroid-go-ultra.rst | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/doc/board/amlogic/odroid-go-ultra.rst 
b/doc/board/amlogic/odroid-go-ultra.rst
index 8df9e0cb79..50d91394d4 100644
--- a/doc/board/amlogic/odroid-go-ultra.rst
+++ b/doc/board/amlogic/odroid-go-ultra.rst
@@ -1,10 +1,9 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for ODROID-GO-ULTRA
+U-Boot for ODROID-GO-ULTRA (S922X)
 ==
 
-The Odroid Go Ultra is a portable gaming device with the following
-characteristics:
+The ODROID GO ULTRA is a portable gaming device with the following 
characteristics:
 
  - Amlogic S922X SoC
  - RK817 & RK818 PMICs
@@ -19,7 +18,7 @@ characteristics:
  - 2x ADC Analog Joysticks
  - USB-C Port for USB2 Device and Charging
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -28,7 +27,19 @@ U-Boot compilation
 $ make odroid-go-ultra_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-Pleaser refer to :doc:`pre-generated-fip` with codename `odroid-go-ultra`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh odroid-go-ultra /path/to/u-boot/u-boot.bin my-output-dir
+
+Then write the image to SD or eMMC with:
+
+.. code-block:: bash
+
+$ DEV=/dev/boot_device
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 15/33] doc: boards: amlogic: update documentation for ODROID-C2

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/odroid-c2.rst | 54 ++---
 1 file changed, 30 insertions(+), 24 deletions(-)

diff --git a/doc/board/amlogic/odroid-c2.rst b/doc/board/amlogic/odroid-c2.rst
index 8a1be4bf55..82eea3820e 100644
--- a/doc/board/amlogic/odroid-c2.rst
+++ b/doc/board/amlogic/odroid-c2.rst
@@ -1,12 +1,12 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for ODROID-C2
-
+U-Boot for ODROID-C2 (S905)
+===
 
-ODROID-C2 is a single board computer manufactured by Hardkernel
-Co. Ltd with the following specifications:
+ODROID-C2 is a single board computer manufactured by Hardkernel with the 
following
+specifications:
 
- - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 2GHz
+ - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
  - ARM Mali 450 GPU
  - 2GB DDR3 SDRAM
  - Gigabit Ethernet
@@ -16,9 +16,9 @@ Co. Ltd with the following specifications:
  - eMMC, microSD
  - Infrared receiver
 
-Schematics are available on the manufacturer website.
+Schematics are available on the manufacturer website: https://wiki.odroid.com
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -27,38 +27,44 @@ U-Boot compilation
 $ make odroid-c2_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`odroid-c2`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh odroid-c2 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
 $ DIR=odroid-c2
-$ git clone --depth 1 \
-   https://github.com/hardkernel/u-boot.git -b odroidc2-v2015.01 \
-   $DIR
+$ git clone --depth 1 https://github.com/hardkernel/u-boot.git -b 
odroidc2-v2015.01 $DIR
+
 $ $DIR/fip/fip_create --bl30  $DIR/fip/gxb/bl30.bin \
-   --bl301 $DIR/fip/gxb/bl301.bin \
-   --bl31  $DIR/fip/gxb/bl31.bin \
-   --bl33  u-boot.bin \
-   $DIR/fip.bin
+  --bl301 $DIR/fip/gxb/bl301.bin \
+  --bl31  $DIR/fip/gxb/bl31.bin \
+  --bl33  u-boot.bin \
+  $DIR/fip.bin
+
 $ $DIR/fip/fip_create --dump $DIR/fip.bin
 $ cat $DIR/fip/gxb/bl2.package $DIR/fip.bin > $DIR/boot_new.bin
 $ $DIR/fip/gxb/aml_encrypt_gxb --bootsig \
---input $DIR/boot_new.bin \
---output $DIR/u-boot.img
+   --input $DIR/boot_new.bin \
+   --output $DIR/u-boot.img
 $ dd if=$DIR/u-boot.img of=$DIR/u-boot.gxbb bs=512 skip=96
 
-and then write the image to SD with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_sd_device
+$ DEV=/dev/your_boot_device
 $ BL1=$DIR/sd_fuse/bl1.bin.hardkernel
 $ dd if=$BL1 of=$DEV conv=fsync bs=1 count=442
 $ dd if=$BL1 of=$DEV conv=fsync bs=512 skip=1 seek=1
-- 
2.34.1



[PATCH 14/33] doc: boards: amlogic: update documentation for NanoPi-K2

2023-03-20 Thread Christian Hewitt
Improve documentation. Notably we can now support U-Boot install to
the removable eMMC storage module in addition to SD cards.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/nanopi-k2.rst | 93 +++--
 1 file changed, 54 insertions(+), 39 deletions(-)

diff --git a/doc/board/amlogic/nanopi-k2.rst b/doc/board/amlogic/nanopi-k2.rst
index 76ff874434..2316dae0ec 100644
--- a/doc/board/amlogic/nanopi-k2.rst
+++ b/doc/board/amlogic/nanopi-k2.rst
@@ -1,10 +1,10 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for NanoPi-K2
-
+U-Boot for NanoPi-K2 (S905)
+===
 
-NanoPi-K2 is a single board computer manufactured by FriendlyElec
-with the following specifications:
+NanoPi-K2 is a single board computer manufactured by FriendlyElec with the 
following
+specifications:
 
  - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
  - ARM Mali 450 GPU
@@ -18,7 +18,7 @@ with the following specifications:
 
 Schematics are available on the manufacturer website.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -27,14 +27,20 @@ U-Boot compilation
 $ make nanopi-k2_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`nanopi-k2`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh nanopi-k2 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -43,7 +49,6 @@ the git tree published by the board vendor:
 $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
 $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
 $ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
-$ git clone https://github.com/BayLibre/u-boot.git -b libretech-cc 
amlogic-u-boot
 $ git clone https://github.com/friendlyarm/u-boot.git -b 
nanopi-k2-v2015.01 amlogic-u-boot
 $ cd amlogic-u-boot
 $ sed -i 's/aarch64-linux-gnu-/aarch64-none-elf-/' Makefile
@@ -52,7 +57,7 @@ the git tree published by the board vendor:
 $ make
 $ export FIPDIR=$PWD/fip
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -65,42 +70,52 @@ Go back to mainline U-Boot source tree then :
 $ cp $FIPDIR/gxb/bl301.bin fip/
 $ cp $FIPDIR/gxb/bl31.img fip/
 $ cp u-boot.bin fip/bl33.bin
+$ wget 
https://github.com/LibreELEC/amlogic-boot-fip/raw/master/nanopi-k2/bl1.bin.hardkernel
 fip/bl1.bin.hardkernel
+$ chmod +x fip/bl1.bin.hardkernel
+$ wget 
https://github.com/LibreELEC/amlogic-boot-fip/raw/master/nanopi-k2/aml_chksum 
fip/aml_chksum
+$ chmod +x fip/aml_chksum
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
-
-$ $FIPDIR/fip_create \
---bl30 fip/bl30_new.bin \
---bl31 fip/bl31.img \
---bl33 fip/bl33.bin \
-fip/fip.bin
-
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
+
+$ $FIPDIR/fip_create --bl30 fip/bl30_new.bin \
+ --bl31 fip/bl31.img \
+ --bl33 fip/bl33.bin \
+ fip/fip.bin
+
+$ sed -i 's/\x73\x02\x08\x91/\x1F\x20\x03\xD5/' fip/bl2.bin
 $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl2_acs.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/bl21.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
 
 $ cat fip/bl2_new.bin fip/fip.bin > fip/boot_new.bin
 
 $ $FIPDIR/gxb/aml_encrypt_gxb --bootsig \
-   --input fip/boot_new.bin
-   --output fip/u-boot.bin
+  --input fip/boot_new.bin
+  --output fi

[PATCH 07/33] doc: boards: amlogic: update documentation for JetHub J80

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/jethub-j80.rst | 46 ++--
 1 file changed, 26 insertions(+), 20 deletions(-)

diff --git a/doc/board/amlogic/jethub-j80.rst b/doc/board/amlogic/jethub-j80.rst
index f669a0118d..d20fbad4c5 100644
--- a/doc/board/amlogic/jethub-j80.rst
+++ b/doc/board/amlogic/jethub-j80.rst
@@ -1,10 +1,10 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for JetHub J80
-==
+U-Boot for JetHub J80 (S905W)
+=
 
-JetHome Jethub H1 (http://jethome.ru/jethub-h1) is a home automation
-controller manufactured by JetHome with the following specifications:
+JetHome Jethub H1 (http://jethome.ru/jethub-h1) is a home automation 
controller device
+manufactured by JetHome with the following specifications:
 
  - Amlogic S905W (ARM Cortex-A53) quad-core up to 1.5GHz
  - No video out
@@ -21,7 +21,7 @@ controller manufactured by JetHome with the following 
specifications:
  - DC source 5V microUSB
  - Square plastic case
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -30,14 +30,20 @@ U-Boot compilation
 $ make jethub_j80_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`jethub-j80`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh jethub-j80 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain binaries
-from the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -45,7 +51,7 @@ from the git tree published by the board vendor:
 $ cd jethub-u-boot
 $ export FIPDIR=$PWD
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -84,16 +90,16 @@ Go back to mainline U-Boot source tree then :
 $ $FIPDIR/j80/aml_encrypt_gxl --bl3enc --input fip/bl33.bin --compress lz4
 $ $FIPDIR/j80/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output 
fip/bl2.n.bin.sig
 $ $FIPDIR/j80/aml_encrypt_gxl --bootmk \
---output fip/u-boot.bin \
---bl2 fip/bl2.n.bin.sig \
---bl30 fip/bl30_new.bin.enc \
---bl31 fip/bl31.img.enc \
---bl33 fip/bl33.bin.enc
+  --output fip/u-boot.bin \
+  --bl2 fip/bl2.n.bin.sig \
+  --bl30 fip/bl30_new.bin.enc \
+  --bl31 fip/bl31.img.enc \
+  --bl33 fip/bl33.bin.enc
 
-and then write the image to SD/eMMC with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_sd_device
+$ DEV=/dev/boot_device
 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 04/33] doc: boards: amlogic: update documentation for Beelink GT-King

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/beelink-gtking.rst | 120 +--
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/doc/board/amlogic/beelink-gtking.rst 
b/doc/board/amlogic/beelink-gtking.rst
index 2fb50c5f7b..342887d584 100644
--- a/doc/board/amlogic/beelink-gtking.rst
+++ b/doc/board/amlogic/beelink-gtking.rst
@@ -1,10 +1,10 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Beelink GT-King
-==
+U-Boot for Beelink GT-King (S922X)
+==
 
-The Shenzen AZW (Beelink) GT-King is based on the Amlogic W400 reference
-board with an S922X-H chip.
+The Shenzen AZW (Beelink) GT-King is based on the Amlogic W400 reference board 
with an
+S922X-H chip and the following specifications:
 
 - 4GB LPDDR4 RAM
 - 64GB eMMC storage
@@ -18,10 +18,10 @@ board with an S922X-H chip.
 - IR receiver
 - 1x micro SD card slot
 
-Beelink do not provide public schematics, but have been willing
-to share them with known distro developers on request.
+Beelink do not provide public schematics, but have been willing to share them 
with known
+distro developers to assist with development.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -30,21 +30,21 @@ U-Boot compilation
 $ make beelink-gtking_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-Amlogic does not provide sources for the firmware and for tools needed
-to create the bootloader image. Beelink have provided the Amlogic "SDK"
-in their forums, but the u-boot sources included result in 2GB RAM being
-detected. The following FIPs were generated with newer private sources
-and give correct (4GB) RAM detection:
-
-https://github.com/LibreELEC/amlogic-boot-fip/tree/master/beelink-s922x
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh beelink-s922x /path/to/u-boot/u-boot.bin my-output-dir
 
-NB: Beelink use a common board config for GT-King, GT-King Pro and the
-GS-King-X model, hence the "beelink-s922x" name.
+U-Boot Manual Signing
+-
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`beelink-s922x`
+Beelink released an Amlogic "SDK" dump in their forums, but the U-Boot sources 
included
+result in 2GB RAM detected. The following FIPs were generated with newer 
sources and
+detect 4GB RAM: 
https://github.com/LibreELEC/amlogic-boot-fip/tree/master/beelink-s922x
 
 .. code-block:: bash
 
@@ -61,57 +61,57 @@ Go back to the mainline U-Boot source tree then:
 $ cp u-boot.bin fip/bl33.bin
 
 $ sh fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
 
 $ sh fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
 
 $ fip/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3
+   --output fip/bl30_new.bin.g12a.enc \
+   --level v3
 $ fip/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
-   --output fip/bl30_new.bin.enc \
-   --level v3 --type bl30
+   --output fip/bl30_new.bin.enc \
+   --level v3 --type bl30
 $ fip/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
-   --output fip/bl31.img.enc \
-   --level v3 --type bl31
+   --output fip/bl31.img.enc \
+   --level v3 --type bl31
 $ fip/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
-   --output fip/bl33.bin.enc \
-   --level v3 --type bl33
+   --output fip/bl33.bin.enc \
+   --level v3 --type bl33
 $ fip/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
-   --output fip/bl2.n.bin.sig
+   --output fip/bl2.n.bin.sig
 $ fip/aml_encrypt_g12b --bootmk \
-   --output fip/u-boot.bin \

[PATCH 05/33] doc: boards: amlogic: update documentation for Beelink GT-King Pro

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/beelink-gtkingpro.rst | 120 
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/doc/board/amlogic/beelink-gtkingpro.rst 
b/doc/board/amlogic/beelink-gtkingpro.rst
index 07bb04bb36..541938b103 100644
--- a/doc/board/amlogic/beelink-gtkingpro.rst
+++ b/doc/board/amlogic/beelink-gtkingpro.rst
@@ -1,10 +1,10 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Beelink GT-King Pro
-==
+U-Boot for Beelink GT-King Pro (S922X)
+==
 
-The Shenzen AZW (Beelink) GT-King Pro is based on the Amlogic W400 reference
-board with an S922X-H chip.
+The Shenzen AZW (Beelink) GT-King Pro is based on the Amlogic W400 reference 
board with
+an S922X-H chip and the following specifications:
 
 - 4GB LPDDR4 RAM
 - 64GB eMMC storage
@@ -19,10 +19,10 @@ board with an S922X-H chip.
 - 1x SD card slot
 - 1x Power on/off button
 
-Beelink do not provide public schematics, but have been willing
-to share them with known distro developers on request.
+Beelink do not provide public schematics, but have been willing to share them 
with known  
+distro developers to assist with development.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -31,21 +31,21 @@ U-Boot compilation
 $ make beelink-gtkingpro_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-Amlogic does not provide sources for the firmware and for tools needed
-to create the bootloader image. Beelink have provided the Amlogic "SDK"
-in their forums, but the u-boot sources included result in 2GB RAM being
-detected. The following FIPs were generated with newer private sources
-and give correct (4GB) RAM detection:
-
-https://github.com/LibreELEC/amlogic-boot-fip/tree/master/beelink-s922x
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh beelink-s922x /path/to/u-boot/u-boot.bin my-output-dir
 
-NB: Beelink use a common board config for GT-King, GT-King Pro and the
-GS-King-X model, hence the "beelink-s922x" name.
+U-Boot Manual Signing
+-
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`beelink-s922x`
+Beelink released an Amlogic "SDK" dump in their forums, but the U-Boot sources 
included
+result in 2GB RAM detected. The following FIPs were generated with newer 
sources and
+detect 4GB RAM: 
https://github.com/LibreELEC/amlogic-boot-fip/tree/master/beelink-s922x
 
 .. code-block:: bash
 
@@ -62,57 +62,57 @@ Go back to the mainline U-Boot source tree then:
 $ cp u-boot.bin fip/bl33.bin
 
 $ sh fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+ fip/bl30.bin \
+ fip/zero_tmp \
+ fip/bl30_zero.bin \
+ fip/bl301.bin \
+ fip/bl301_zero.bin \
+ fip/bl30_new.bin \
+ bl30
 
 $ sh fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+ fip/bl2.bin \
+ fip/zero_tmp \
+ fip/bl2_zero.bin \
+ fip/acs.bin \
+ fip/bl21_zero.bin \
+ fip/bl2_new.bin \
+ bl2
 
 $ fip/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3
+   --output fip/bl30_new.bin.g12a.enc \
+   --level v3
 $ fip/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
-   --output fip/bl30_new.bin.enc \
-   --level v3 --type bl30
+   --output fip/bl30_new.bin.enc \
+   --level v3 --type bl30
 $ fip/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
-   --output fip/bl31.img.enc \
-   --level v3 --type bl31
+   --output fip/bl31.img.enc \
+   --level v3 --type bl31
 $ fip/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
-   --output fip/bl33.bin.enc \
-   --level v3 --type bl33
+   --output fip/bl33.bin.enc \
+   --level v3 --type bl33
 $ fip/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
-   --output fip/bl2.n.bin.sig
+   --output fip/bl2.n.bin.sig
 $ fip/aml_encrypt_g12b --bootmk \

[PATCH 20/33] doc: boards: amlogic: update documentation for P200

2023-03-20 Thread Christian Hewitt
Improve documentation. Notably we can now support U-Boot install to
the internal eMMC storage in addition to SD cards.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/p200.rst | 87 +++---
 1 file changed, 53 insertions(+), 34 deletions(-)

diff --git a/doc/board/amlogic/p200.rst b/doc/board/amlogic/p200.rst
index 5e7c6b0276..b5c6ad096e 100644
--- a/doc/board/amlogic/p200.rst
+++ b/doc/board/amlogic/p200.rst
@@ -1,25 +1,24 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Amlogic P200
-===
+U-Boot for Amlogic P200 (S905)
+==
 
-P200 is a reference board manufactured by Amlogic with the following
-specifications:
+P200 is a reference board manufactured by Amlogic with the following 
specification:
 
  - Amlogic S905 ARM Cortex-A53 quad-core SoC @ 1.5GHz
  - ARM Mali 450 GPU
  - 2GB DDR3 SDRAM
  - Gigabit Ethernet
  - HDMI 2.0 4K/60Hz display
- - 2 x USB 2.0 Host
+ - 2x USB 2.0 Host
  - eMMC, microSD
  - Infrared receiver
  - SDIO WiFi Module
- - CVBS+Stereo Audio Jack
+ - CVBS + Stereo Audio Jack
 
 Schematics are available from Amlogic on demand.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -28,14 +27,20 @@ U-Boot compilation
 $ make p200_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`p200`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh p200 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image but sources have been shared by Linux development contractor, Baylibre:
 
 .. code-block:: bash
 
@@ -50,7 +55,7 @@ the git tree published by the board vendor:
 $ make
 $ export FIPDIR=$PWD/fip
 
-Go back to mainline U-boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -63,37 +68,51 @@ Go back to mainline U-boot source tree then :
 $ cp $FIPDIR/gxb/bl301.bin fip/
 $ cp $FIPDIR/gxb/bl31.img fip/
 $ cp u-boot.bin fip/bl33.bin
+$ wget 
https://github.com/LibreELEC/amlogic-boot-fip/raw/master/nanopi-k2/bl1.bin.hardkernel
 fip/bl1.bin.hardkernel
+$ chmod +x fip/bl1.bin.hardkernel
+$ wget 
https://github.com/LibreELEC/amlogic-boot-fip/raw/master/nanopi-k2/aml_chksum 
fip/aml_chksum
+$ chmod +x fip/aml_chksum
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl30.bin \
-fip/zero_tmp \
-fip/bl30_zero.bin \
-fip/bl301.bin \
-fip/bl301_zero.bin \
-fip/bl30_new.bin \
-bl30
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
 
 $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
 
 $ $FIPDIR/blx_fix.sh \
-fip/bl2_acs.bin \
-fip/zero_tmp \
-fip/bl2_zero.bin \
-fip/bl21.bin \
-fip/bl21_zero.bin \
-fip/bl2_new.bin \
-bl2
-
-$ $FIPDIR/fip_create --bl30 fip/bl30_new.bin --bl31 fip/bl31.img --bl33 
fip/bl33.bin fip/fip.bin
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
+
+$ $FIPDIR/fip_create --bl30 fip/bl30_new.bin \
+ --bl31 fip/bl31.img \
+ --bl33 fip/bl33.bin \
+ fip/fip.bin
 
 $ cat fip/bl2_new.bin fip/fip.bin >fip/boot_new.bin
 
-$ $FIPDIR/gxb/aml_encrypt_gxb --bootsig --input fip/boot_new.bin --output 
fip/u-boot.bin
+$ $FIPDIR/gxb/aml_encrypt_gxb --bootsig \
+  --input fip/boot_new.bin \
+  --output fip/u-boot.bin
 
 and then write the image to SD with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_sd_device
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
+$ DEV=/dev/boot_device
+$ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 conv=fsync
+$ dd if=fip/u-boot.bin of=fip/u-boot.bin.gxbb bs=512 seek=9 skip=8 
count=87 conv=fsync,notrunc
+$ dd if=/dev/zero of=fip/u-boot.bin.gxbb bs=512 seek=8 count=1 
conv=fsync,notrunc
+$ dd if=bl1.bin.hardkernel of=fi

[PATCH 23/33] doc: boards: amlogic: update documentation for Radxa Zero

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/radxa-zero.rst | 45 +---
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/doc/board/amlogic/radxa-zero.rst b/doc/board/amlogic/radxa-zero.rst
index f5611f52ec..e8a8d87320 100644
--- a/doc/board/amlogic/radxa-zero.rst
+++ b/doc/board/amlogic/radxa-zero.rst
@@ -1,14 +1,13 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Radxa Zero
-=
+U-Boot for Radxa Zero (S905Y2)
+==
 
-Radxa Zero is a small form factor SBC based on the Amlogic S905Y2
-chipset that ships in a number of RAM/eMMC configurations:
+Radxa Zero is a small form factor SBC based on the Amlogic S905Y2 chipset that 
ships in
+a number of RAM/eMMC configurations:
 
-Boards with 512MB/1GB LPDDR4 RAM have no eMMC storage and BCM43436
-wireless (2.4GHz b/g/n) while 2GB/4GB boards have 8/16/32/64/128GB
-eMMC storage and BCM4345 wireless (2.4/5GHz a/b/g/n/ac).
+512MB/1GB LPDDR4 RAM boards have no eMMC and BCM43436 wireless (2.4GHz b/g/n) 
while the
+2GB/4GB boards have 8/16/32/64/128GB eMMC and BCM4345 wireless (2.4/5GHz 
a/b/g/n/ac).
 
 - Amlogic S905Y2 quad-core Cortex-A53
 - Mali G31-MP2 GPU
@@ -18,11 +17,9 @@ eMMC storage and BCM4345 wireless (2.4/5GHz a/b/g/n/ac).
 - 1x micro SD Card slot
 - 40 Pin GPIO header
 
-Schematics are available on the manufacturer website:
+Schematics are available on the manufacturer website: 
https://dl.radxa.com/zero/docs/hw
 
-https://dl.radxa.com/zero/docs/hw/RADAX_ZERO_V13_SCH_20210309.pdf
-
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -31,14 +28,20 @@ U-Boot compilation
 $ make radxa-zero_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh radxa-zero /path/to/u-boot/u-boot.bin my-output-dir
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`radxa-zero`
+U-Boot Manual Signing
+-
 
-Amlogic does not provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-git trees published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -61,16 +64,16 @@ git trees published by the board vendor:
 $ cd ../fip/radxa-zero
 $ make
 
-This will generate:
+This will generate the signed U-Boot binaries:
 
 .. code-block:: bash
 
 $ u-boot.bin u-boot.bin.sd.bin u-boot.bin.usb.bl2 u-boot.bin.usb.tpl
 
-Then write the image to SD with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_sd_device
+$ DEV=/dev/boot_device
 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 19/33] doc: boards: amlogic: update documentation for ODROID-N2L

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/odroid-n2l.rst | 33 ++--
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/doc/board/amlogic/odroid-n2l.rst b/doc/board/amlogic/odroid-n2l.rst
index afd4409d1b..b264ace7f5 100644
--- a/doc/board/amlogic/odroid-n2l.rst
+++ b/doc/board/amlogic/odroid-n2l.rst
@@ -1,22 +1,23 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for ODROID-N2L
-=
+U-Boot for ODROID-N2L (S922X)
+=
 
-ODROID-N2L is a single board computer manufactured by Hardkernel
-Co. Ltd with the following specifications:
+ODROID-N2L is a Single Board Computer manufactured by Hardkernel with the 
following
+specifications:
 
  - Amlogic S922X ARM Cortex-A53 dual-core + Cortex-A73 quad-core SoC
  - 4GB DDR4 SDRAM
  - HDMI 2.1 4K/60Hz display
  - 40-pin GPIO header
- - 1 x USB 3.0 Host, 1 x USB USB 2.0 Host
+ - 1x USB 3.0 Host
+ - 1x USB 2.0 Host
  - eMMC, microSD
  - MIPI DSI Port
 
-Schematics are available on the manufacturer website.
+Schematics are available on the manufacturer website: https://wiki.odroid.com
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -25,7 +26,19 @@ U-Boot compilation
 $ make odroid-n2l_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`odroid-n2l`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh odroid-n2l /path/to/u-boot/u-boot.bin my-output-dir
+
+Then write U-Boot to SD or eMMC with:
+
+.. code-block:: bash
+
+$ DEV=/dev/boot_device
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 13/33] doc: boards: amlogic: update documentation for LePotato

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/libretech-cc.rst | 109 +++--
 1 file changed, 40 insertions(+), 69 deletions(-)

diff --git a/doc/board/amlogic/libretech-cc.rst 
b/doc/board/amlogic/libretech-cc.rst
index 596ce45dc4..d1d3ce49f6 100644
--- a/doc/board/amlogic/libretech-cc.rst
+++ b/doc/board/amlogic/libretech-cc.rst
@@ -1,12 +1,12 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for LibreTech CCs
-
+U-Boot for LibreTech CC 'LePotato' (S905X)
+==
 
-LibreTech CC is a single board computer manufactured by Libre Technology
-with the following specifications:
+LibreTech CC is a Single Board Computer manufactured by Libre Computer 
Technology with
+the following specifications:
 
-V1:
+v1:
 
  - Amlogic S905X ARM Cortex-A53 quad-core SoC @ 1.5GHz
  - ARM Mali 450 GPU
@@ -19,14 +19,14 @@ V1:
  - Infrared receiver
  - Jack for CVBS and Audio
 
-V2:
+v2:
 
  - Added SPI NOR
  - Removed Jack
 
 Schematics are available on the manufacturer website.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -37,36 +37,20 @@ U-Boot compilation
 
 Use libretech-cc_v2_defconfig for v2.
 
-Image creation
---
-
-To boot the system, u-boot must be combined with several earlier stage
-bootloaders:
-
-* bl2.bin: vendor-provided binary blob
-* bl21.bin: built from vendor u-boot source
-* bl30.bin: vendor-provided binary blob
-* bl301.bin: built from vendor u-boot source
-* bl31.bin: vendor-provided binary blob
-* acs.bin: built from vendor u-boot source
-
-These binaries and the tools required below have been collected and prebuilt
-for convenience at <https://github.com/BayLibre/u-boot/releases/>. These
-apply to both v1 and v2.
-
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`lepotato`
-
-Download and extract the libretech-cc release from there, and set FIPDIR to
-point to the `fip` subdirectory.
+U-Boot Signing with Pre-Built FIP repo
+--
 
 .. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh lepotato /path/to/u-boot/u-boot.bin my-output-dir
 
-$ export FIPDIR=/path/to/extracted/fip
+U-Boot Manual Signing
+-
 
-Alternatively, you can obtain the original vendor u-boot tree which
-contains the required blobs and sources, and build yourself.
-Note that old compilers are required for this to build. The compilers here
-are suggested by Amlogic, and they are 32-bit x86 binaries.
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -81,9 +65,7 @@ are suggested by Amlogic, and they are 32-bit x86 binaries.
 $ make
 $ export FIPDIR=$PWD/fip
 
-Once you have the binaries available (either through the prebuilt download,
-or having built the vendor u-boot yourself), you can then proceed to glue
-everything together. Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -98,51 +80,40 @@ everything together. Go back to mainline U-Boot source tree 
then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
 
 $ $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl2_acs.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/bl21.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
 
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output 
fip/bl2.n.bin.sig
 $ $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
-   --output fip/u-boot.bin \
-   --bl2 fip/bl2.n.bin.sig \
-   --bl30 fip/bl30_new.bin.enc \
-   --bl31 fip/bl31.img.enc \
-   --bl33 fip/bl33.bin.enc
+  --output fip/u-boot.bin \
+  --bl2 f

[PATCH 11/33] doc: boards: amlogic: update documentation for Khadas VIM3L

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/khadas-vim3l.rst | 137 ++---
 1 file changed, 68 insertions(+), 69 deletions(-)

diff --git a/doc/board/amlogic/khadas-vim3l.rst 
b/doc/board/amlogic/khadas-vim3l.rst
index 692ab3d21d..935f43c725 100644
--- a/doc/board/amlogic/khadas-vim3l.rst
+++ b/doc/board/amlogic/khadas-vim3l.rst
@@ -1,10 +1,10 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Khadas VIM3L
-===
+U-Boot for Khadas VIM3L (S905D3)
+
 
-Khadas VIM3L is a single board computer manufactured by Shenzhen Wesion
-Technology Co., Ltd. with the following specifications:
+Khadas VIM3L is a Single Board Computer manufactured by Shenzhen Wesion 
Technology Co. Ltd
+with the following specifications:
 
  - Amlogic S905D3 Arm Cortex-A55 quad-core SoC
  - 2GB LPDDR4 SDRAM
@@ -20,32 +20,27 @@ Schematics are available on the manufacturer website.
 
 PCIe Setup
 --
-The VIM3 on-board  MCU can mux the PCIe/USB3.0 shared differential
-lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between
-an USB3.0 Type A connector and a M.2 Key M slot.
-The PHY driving these differential lines is shared between
-the USB3.0 controller and the PCIe Controller, thus only
-a single controller can use it.
 
-To setup for PCIe, run the following commands from U-Boot:
+The on-board MCU can mux the PCIe/USB3.0 shared differential lines using a 
FUSB340TMX USB
+3.1 SuperSpeed Data Switch between a USB3.0 Type-A connector and an M.2 Key-M 
slot. The
+PHY driving these differential lines is shared between the USB3.0 controller 
and the PCIe
+Controller, thus only a single controller can use it.
+
+To setup for PCIe run the following commands from U-Boot then power-cycle the 
board:
 
 .. code-block:: none
 
 i2c dev i2c@5000
 i2c mw 0x18 0x33 1
 
-Then power-cycle the board.
-
-To set back to USB3.0, run the following commands from U-Boot:
+To revert to USB3.0 run the following commands from U-Boot then power-cycle 
the board:
 
 .. code-block:: none
 
 i2c dev i2c@5000
 i2c mw 0x18 0x33 0
 
-Then power-cycle the board.
-
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -54,14 +49,20 @@ U-Boot compilation
 $ make khadas-vim3l_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh khadas-vim3l /path/to/u-boot/u-boot.bin my-output-dir
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`khadas-vim3l`
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -72,16 +73,14 @@ the git tree published by the board vendor:
 $ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
 
 $ DIR=vim3l-u-boot
-$ git clone --depth 1 \
-   https://github.com/khadas/u-boot.git -b khadas-vims-v2015.01 \
-   $DIR
+$ git clone --depth 1 https://github.com/khadas/u-boot.git -b 
khadas-vims-v2015.01 $DIR
 
 $ cd vim3l-u-boot
 $ make kvim3l_defconfig
 $ make CROSS_COMPILE=aarch64-none-elf-
 $ export UBOOTDIR=$PWD
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -105,58 +104,58 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ bash fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+   fip/bl30.bin \
+   fip/zero_tmp \
+   fip/bl30_zero.bin \
+   fip/bl301.bin \
+   fip/bl301_zero.bin \
+   fip/bl30_new.bin \
+   bl30
 
 $ bash fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+   fip/bl2.bin \
+   fip/zero_tmp \
+   fip/bl2_zero.bin \
+   fip/acs.bin \
+   fip/bl21_zero.bin \
+   fip/bl2_new.bin \
+   bl2
 
 $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3

[PATCH 12/33] doc: boards: amlogic: update documentation for LaFrite

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/libretech-ac.rst | 77 --
 1 file changed, 42 insertions(+), 35 deletions(-)

diff --git a/doc/board/amlogic/libretech-ac.rst 
b/doc/board/amlogic/libretech-ac.rst
index 7a915f9f26..6ebb7f646d 100644
--- a/doc/board/amlogic/libretech-ac.rst
+++ b/doc/board/amlogic/libretech-ac.rst
@@ -1,9 +1,9 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for LibreTech AC
-===
+U-Boot for LibreTech-AC 'LaFrite' (S805X)
+=
 
-LibreTech AC is a single board computer manufactured by Libre Technology
+LibreTech-AC aka 'LaFrite' is a Single Board Computer manufactured by Libre 
Computer
 with the following specifications:
 
  - Amlogic S805X ARM Cortex-A53 quad-core SoC @ 1.2GHz
@@ -13,12 +13,13 @@ with the following specifications:
  - HDMI 2.0 4K/60Hz display
  - 40-pin GPIO header
  - 4 x USB 2.0 Host
- - eMMC, SPI NOR Flash
+ - SPI NOR Flash
+ - Removable eMMC module
  - Infrared receiver
 
 Schematics are available on the manufacturer website.
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -27,14 +28,20 @@ U-Boot compilation
 $ make libretech-ac_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`lafrite`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh lafrite /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -50,7 +57,7 @@ the git tree published by the board vendor:
 $ make
 $ export UBOOTDIR=$PWD
 
-Download the latest Amlogic Buildroot package, and extract it :
+Download the latest Amlogic buildroot package and extract it:
 
 .. code-block:: bash
 
@@ -58,7 +65,7 @@ Download the latest Amlogic Buildroot package, and extract it 
:
 $ tar xfz buildroot_openlinux_kernel_4.9_fbdev_20180418.tar.gz 
buildroot_openlinux_kernel_4.9_fbdev_20180418/bootloader
 $ export BRDIR=$PWD/buildroot_openlinux_kernel_4.9_fbdev_20180418
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -73,40 +80,40 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ sh $UBOOTDIR/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+   fip/bl30.bin \
+   fip/zero_tmp \
+   fip/bl30_zero.bin \
+   fip/bl301.bin \
+   fip/bl301_zero.bin \
+   fip/bl30_new.bin \
+   bl30
 
 $ $BRDIR/bootloader/uboot-repo/fip/acs_tool.pyc fip/bl2.bin 
fip/bl2_acs.bin fip/acs.bin 0
 
 $ sh $UBOOTDIR/blx_fix.sh \
-   fip/bl2_acs.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/bl21.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+   fip/bl2_acs.bin \
+   fip/zero_tmp \
+   fip/bl2_zero.bin \
+   fip/bl21.bin \
+   fip/bl21_zero.bin \
+   fip/bl2_new.bin \
+   bl2
 
 $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl3enc --input 
fip/bl30_new.bin
 $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl3enc --input 
fip/bl31.img
 $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl3enc --input 
fip/bl33.bin
 $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bl2sig --input 
fip/bl2_new.bin --output fip/bl2.n.bin.sig
 $ $BRDIR/bootloader/uboot-repo/fip/gxl/aml_encrypt_gxl --bootmk \
-   --output fip/u-boot.bin \
-   --bl2 fip/bl2.n.bin.sig \
-   --bl30 fip/bl30_new.bin.enc \
-   --bl31 fip/bl31.img.enc \
-   --bl33 fip/bl33.bin.enc
+   --output fip/u-boot.bin \
+   --bl2 fip/bl2.n.bin.sig \
+   --bl30 fip/bl30_new.bin.enc \
+   --bl31 fip/bl31.img.enc \
+   --bl33 fip/bl33.bin.enc
 
-and then write the image to SD with:
+Then write U-Boot to USB or SPI-NOR with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_sd_device
+$ DEV=/dev

[PATCH 08/33] doc: boards: amlogic: update documentation for Khadas VIM

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/khadas-vim.rst | 76 +---
 1 file changed, 41 insertions(+), 35 deletions(-)

diff --git a/doc/board/amlogic/khadas-vim.rst b/doc/board/amlogic/khadas-vim.rst
index 04025d737c..f1fbe1a8a6 100644
--- a/doc/board/amlogic/khadas-vim.rst
+++ b/doc/board/amlogic/khadas-vim.rst
@@ -1,24 +1,24 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Khadas VIM
-==
+U-Boot for Khadas VIM (S905X)
+=
 
-Khadas VIM is an Open Source DIY Box manufactured by Shenzhen Wesion
-Technology Co., Ltd with the following specifications:
+Khadas VIM is a Single Board Computer manufactured by Shenzhen Wesion 
Technology Co. Ltd
+with the following specifications:
 
  - Amlogic S905X ARM Cortex-A53 quad-core SoC @ 1.5GHz
  - ARM Mali 450 GPU
  - 2GB DDR3 SDRAM
+ - 8GB/16GB eMMC
  - 10/100 Ethernet
  - HDMI 2.0 4K/60Hz display
  - 40-pin GPIO header
  - 2 x USB 2.0 Host, 1 x USB 2.0 Type-C OTG
- - 8GB/16GBeMMC
  - microSD
  - SDIO Wifi Module, Bluetooth
- - Two channels IR receiver
+ - Two channel IR receiver
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -27,14 +27,20 @@ U-Boot compilation
 $ make khadas-vim_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`khadas-vim`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh khadas-vim /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -64,40 +70,40 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
 
 $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl2_acs.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/bl21.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
 
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output 
fip/bl2.n.bin.sig
 $ $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
-   --output fip/u-boot.bin \
-   --bl2 fip/bl2.n.bin.sig \
-   --bl30 fip/bl30_new.bin.enc \
-   --bl31 fip/bl31.img.enc \
-   --bl33 fip/bl33.bin.enc
+  --output fip/u-boot.bin \
+  --bl2 fip/bl2.n.bin.sig \
+  --bl30 fip/bl30_new.bin.enc \
+  --bl31 fip/bl31.img.enc \
+  --bl33 fip/bl33.bin.enc
 
-and then write the image to SD with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_sd_device
+$ DEV=/dev/boot_device
 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 10/33] doc: boards: amlogic: update documentation for Khadas VIM3

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/khadas-vim3.rst | 137 +++---
 1 file changed, 68 insertions(+), 69 deletions(-)

diff --git a/doc/board/amlogic/khadas-vim3.rst 
b/doc/board/amlogic/khadas-vim3.rst
index 73dc32b79b..88f2e0ebbe 100644
--- a/doc/board/amlogic/khadas-vim3.rst
+++ b/doc/board/amlogic/khadas-vim3.rst
@@ -1,10 +1,10 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Khadas VIM3
-==
+U-Boot for Khadas VIM3 (A311D)
+==
 
-Khadas VIM3 is a single board computer manufactured by Shenzhen Wesion
-Technology Co., Ltd. with the following specifications:
+Khadas VIM3 is a Single Board Computer manufactured by Shenzhen Wesion 
Technology Co. Ltd
+with the following specifications:
 
  - Amlogic A311D Arm Cortex-A53 dual-core + Cortex-A73 quad-core SoC
  - 4GB LPDDR4 SDRAM
@@ -20,32 +20,27 @@ Schematics are available on the manufacturer website.
 
 PCIe Setup
 --
-The VIM3 on-board  MCU can mux the PCIe/USB3.0 shared differential
-lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between
-an USB3.0 Type A connector and a M.2 Key M slot.
-The PHY driving these differential lines is shared between
-the USB3.0 controller and the PCIe Controller, thus only
-a single controller can use it.
 
-To setup for PCIe, run the following commands from U-Boot:
+The on-board MCU can mux the PCIe/USB3.0 shared differential lines using a 
FUSB340TMX USB
+3.1 SuperSpeed Data Switch between a USB3.0 Type-A connector and an M.2 Key M 
slot. The
+PHY driving these differential lines is shared between the USB3.0 controller 
and the PCIe
+Controller, thus only a single controller can use it.
+
+To setup for PCIe run the following commands from U-Boot then power-cycle the 
board:
 
 .. code-block:: none
 
 i2c dev i2c@5000
 i2c mw 0x18 0x33 1
 
-Then power-cycle the board.
-
-To set back to USB3.0, run the following commands from U-Boot:
+To revert to USB3.0 run the following commands from U-Boot then power-cycle 
the board:
 
 .. code-block:: none
 
 i2c dev i2c@5000
 i2c mw 0x18 0x33 0
 
-Then power-cycle the board.
-
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -54,14 +49,20 @@ U-Boot compilation
 $ make khadas-vim3_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh khadas-vim3 /path/to/u-boot/u-boot.bin my-output-dir
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`khadas-vim3`
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -72,16 +73,14 @@ the git tree published by the board vendor:
 $ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
 
 $ DIR=vim3-u-boot
-$ git clone --depth 1 \
-   https://github.com/khadas/u-boot.git -b khadas-vims-v2015.01 \
-   $DIR
+$ git clone --depth 1 https://github.com/khadas/u-boot.git -b 
khadas-vims-v2015.01 $DIR
 
 $ cd vim3-u-boot
 $ make kvim3_defconfig
 $ make CROSS_COMPILE=aarch64-none-elf-
 $ export UBOOTDIR=$PWD
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -105,58 +104,58 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ bash fip/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+   fip/bl30.bin \
+   fip/zero_tmp \
+   fip/bl30_zero.bin \
+   fip/bl301.bin \
+   fip/bl301_zero.bin \
+   fip/bl30_new.bin \
+   bl30
 
 $ bash fip/blx_fix.sh \
-   fip/bl2.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/acs.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+   fip/bl2.bin \
+   fip/zero_tmp \
+   fip/bl2_zero.bin \
+   fip/acs.bin \
+   fip/bl21_zero.bin \
+   fip/bl2_new.bin \
+   bl2
 
 $ $UBOOTDIR/fip/g12b/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
-   --output fip/bl30_new.bin.g12a.enc \
-   --level v3

[PATCH 09/33] doc: boards: amlogic: update documentation for Khadas VIM2

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/khadas-vim2.rst | 76 +--
 1 file changed, 41 insertions(+), 35 deletions(-)

diff --git a/doc/board/amlogic/khadas-vim2.rst 
b/doc/board/amlogic/khadas-vim2.rst
index 7ac3bdcbaf..78d47f93fe 100644
--- a/doc/board/amlogic/khadas-vim2.rst
+++ b/doc/board/amlogic/khadas-vim2.rst
@@ -1,25 +1,25 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for Khadas VIM2
-===
+U-Boot for Khadas VIM2 (S912)
+=
 
-Khadas VIM2 is an Open Source DIY Box manufactured by Shenzhen Wesion
-Technology Co., Ltd with the following specifications:
+Khadas VIM2 is a Single Board Computer manufactured by Shenzhen Wesion 
Technology Co. Ltd
+with the following specifications:
 
  - Amlogic S912 ARM Cortex-A53 octo-core SoC @ 1.5GHz
  - ARM Mali T860 GPU
- - 2/3GB DDR4 SDRAM
+ - 2GB/3GB DDR4 SDRAM
+ - 16GB/32GB/64GB eMMC
  - 10/100/1000 Ethernet
  - HDMI 2.0 4K/60Hz display
  - 40-pin GPIO header
  - 2 x USB 2.0 Host, 1 x USB 2.0 Type-C OTG
- - 16GB/32GB/64GB eMMC
  - 2MB SPI Flash
  - microSD
  - SDIO Wifi Module, Bluetooth
  - Two channels IR receiver
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -28,14 +28,20 @@ U-Boot compilation
 $ make khadas-vim2_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
+
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh khadas-vim2 /path/to/u-boot/u-boot.bin my-output-dir
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`khadas-vim2`
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain them from
-the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -50,7 +56,7 @@ the git tree published by the board vendor:
 $ make
 $ export FIPDIR=$PWD/fip
 
-Go back to mainline U-Boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -65,40 +71,40 @@ Go back to mainline U-Boot source tree then :
 $ cp u-boot.bin fip/bl33.bin
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl30.bin \
-   fip/zero_tmp \
-   fip/bl30_zero.bin \
-   fip/bl301.bin \
-   fip/bl301_zero.bin \
-   fip/bl30_new.bin \
-   bl30
+  fip/bl30.bin \
+  fip/zero_tmp \
+  fip/bl30_zero.bin \
+  fip/bl301.bin \
+  fip/bl301_zero.bin \
+  fip/bl30_new.bin \
+  bl30
 
 $ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
 
 $ $FIPDIR/blx_fix.sh \
-   fip/bl2_acs.bin \
-   fip/zero_tmp \
-   fip/bl2_zero.bin \
-   fip/bl21.bin \
-   fip/bl21_zero.bin \
-   fip/bl2_new.bin \
-   bl2
+  fip/bl2_acs.bin \
+  fip/zero_tmp \
+  fip/bl2_zero.bin \
+  fip/bl21.bin \
+  fip/bl21_zero.bin \
+  fip/bl2_new.bin \
+  bl2
 
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
 $ $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output 
fip/bl2.n.bin.sig
 $ $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
-   --output fip/u-boot.bin \
-   --bl2 fip/bl2.n.bin.sig \
-   --bl30 fip/bl30_new.bin.enc \
-   --bl31 fip/bl31.img.enc \
-   --bl33 fip/bl33.bin.enc
+  --output fip/u-boot.bin \
+  --bl2 fip/bl2.n.bin.sig \
+  --bl30 fip/bl30_new.bin.enc \
+  --bl31 fip/bl31.img.enc \
+  --bl33 fip/bl33.bin.enc
 
-and then write the image to SD with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash
 
 $ DEV=/dev/your_sd_device
 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 06/33] doc: boards: amlogic: update documentation for JetHub J100

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/jethub-j100.rst | 66 ---
 1 file changed, 35 insertions(+), 31 deletions(-)

diff --git a/doc/board/amlogic/jethub-j100.rst 
b/doc/board/amlogic/jethub-j100.rst
index dd1ed68b9c..0d63976789 100644
--- a/doc/board/amlogic/jethub-j100.rst
+++ b/doc/board/amlogic/jethub-j100.rst
@@ -1,11 +1,10 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-U-Boot for JetHub J100
-===
+U-Boot for JetHub J100 (A113X)
+==
 
-JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a series of home
-automation controller manufactured by JetHome with the following
-specifications:
+JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation 
controller device
+manufactured by JetHome with the following specifications:
 
  - Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
  - no video out
@@ -22,16 +21,15 @@ specifications:
  - DC source with a voltage of 9 to 56 V / Passive POE
  - DIN Rail Mounting case
 
-Basic version also has:
+The basic version also has:
 
- - TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output
-   power and Zigbee 3.0 support.
+ - TI CC2538 + CC2592 Zigbee Wireless with upto 20dBm output power and Zigbee 
3.0
  - 1 x 1-Wire
  - 2 x RS-485
  - 4 x dry contact digital GPIO inputs
  - 3 x relay GPIO outputs
 
-U-Boot compilation
+U-Boot Compilation
 --
 
 .. code-block:: bash
@@ -40,14 +38,20 @@ U-Boot compilation
 $ make jethub_j100_defconfig
 $ make
 
-Image creation
---
+U-Boot Signing with Pre-Built FIP repo
+--
 
-For simplified usage, pleaser refer to :doc:`pre-generated-fip` with codename 
`jethub-j100`
+.. code-block:: bash
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh jethub-j100 /path/to/u-boot/u-boot.bin my-output-dir
+
+U-Boot Manual Signing
+-
 
-Amlogic doesn't provide sources for the firmware and for tools needed
-to create the bootloader image, so it is necessary to obtain binaries
-from the git tree published by the board vendor:
+Amlogic does not provide sources for the firmware and tools needed to create a 
bootloader
+image so it is necessary to obtain binaries from sources published by the 
board vendor:
 
 .. code-block:: bash
 
@@ -55,7 +59,7 @@ from the git tree published by the board vendor:
 $ cd jethub-u-boot
 $ export FIPDIR=$PWD
 
-Go back to mainline U-boot source tree then :
+Go back to the mainline U-Boot source tree then:
 
 .. code-block:: bash
 
@@ -90,27 +94,27 @@ Go back to mainline U-boot source tree then :
 bl2
 
 $ $FIPDIR/j100/aml_encrypt_axg --bl3sig --input fip/bl30_new.bin \
---output fip/bl30_new.bin.enc \
---level v3 --type bl30
+   --output fip/bl30_new.bin.enc \
+   --level v3 --type bl30
 $ $FIPDIR/j100/aml_encrypt_axg --bl3sig --input fip/bl31.img \
---output fip/bl31.img.enc \
---level v3 --type bl31
+   --output fip/bl31.img.enc \
+   --level v3 --type bl31
 $ $FIPDIR/j100/aml_encrypt_axg --bl3sig --input fip/bl33.bin --compress 
lz4 \
---output fip/bl33.bin.enc \
---level v3 --type bl33
+   --output fip/bl33.bin.enc \
+   --level v3 --type bl33
 $ $FIPDIR/j100/aml_encrypt_axg --bl2sig --input fip/bl2_new.bin \
---output fip/bl2.n.bin.sig
+   --output fip/bl2.n.bin.sig
 $ $FIPDIR/j100/aml_encrypt_axg --bootmk \
---output fip/u-boot.bin \
---bl2 fip/bl2.n.bin.sig \
---bl30 fip/bl30_new.bin.enc \
---bl31 fip/bl31.img.enc \
---bl33 fip/bl33.bin.enc --level v3
+   --output fip/u-boot.bin \
+   --bl2 fip/bl2.n.bin.sig \
+   --bl30 fip/bl30_new.bin.enc \
+   --bl31 fip/bl31.img.enc \
+   --bl33 fip/bl33.bin.enc --level v3
 
-and then write the image to eMMC with:
+Then write U-Boot to SD or eMMC with:
 
 .. code-block:: bash
 
-$ DEV=/dev/your_emmc_device
+$ DEV=/dev/boot_device
 $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
-$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
-- 
2.34.1



[PATCH 01/33] doc: boards: amlogic: update documentation for index page

2023-03-20 Thread Christian Hewitt
Improve documentation. Notably we remove all the board names from the
feature matrix to reduce table width. SoC types have been added to the
titles in individual board documents so readers can still correlate a
board against the features. This makes it easier to add new boards to
to the document in the future.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/index.rst | 137 +---
 1 file changed, 64 insertions(+), 73 deletions(-)

diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index e51b904582..3eb1cf46e0 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -10,74 +10,65 @@ An up-do-date matrix is also available on: 
http://linux-meson.com
 
 This matrix concerns the actual source code version.
 
-+---+---+-+--+-++-+--+
-|   | S905  | S905X   | S912 | 
A113X   | S905X2 | S922X   | S905X3   |
-|   |   | S805X   | S905D| 
| S905D2 | A311D   | S905D3   |
-|   |   | S905W   |  | 
| S905Y2 | |  |
-+===+===+=+==+=++=+==+
-| Boards| Odroid-C2 | P212| Khadas VIM2  | 
S400| U200   | Odroid-N2   | SEI610   |
-|   | Nanopi-K2 | Khadas-VIM  | Libretech-PC | 
JetHub J100 | SEI510 | Khadas-VIM3 | Khadas-VIM3L |
-|   | P200  | LibreTech-CC v1 | WeTek Core2  | 
| Radxa Zero | GT-King/Pro | Odroid-C4|
-|   | P201  | LibreTech-AC v2 |  | 
|| GSKing-X| Odroid-HC4   |
-|   |   | JetHub J80  |  | 
|| Odroid-Go-  | BananaPi-M5  |
-|   |   | |  | 
|| Ultra   |  |
-|   |   | |  | 
|| Odroid-N2L  |  |
-|   |   | |  | 
|| BPI-M4  |  |
-+---+---+-+--+-++-+--+
-| UART  | **Yes**   | **Yes** | **Yes**  | 
**Yes** | **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+-++-+--+
-| Pinctrl/GPIO  | **Yes**   | **Yes** | **Yes**  | 
**Yes** | **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+-++-+--+
-| Clock Control | **Yes**   | **Yes** | **Yes**  | 
**Yes** | **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+-++-+--+
-| PWM   | **Yes**   | **Yes** | **Yes**  | 
**Yes** | **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+-++-+--+
-| Reset Control | **Yes**   | **Yes** | **Yes**  | 
**Yes** | **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+-++-+--+
-| Infrared Decoder  | No| No  | No   | 
No  | No | No  | No   |
-+---+---+-+--+-++-+--+
-| Ethernet  | **Yes**   | **Yes** | **Yes**  | 
**Yes** | **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+-++-+--+
-| Multi-core| **Yes**   | **Yes** | **Yes**  | 
**Yes** | **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+-++-+--+
-| Fuse access   | **Yes**   | **Yes** |**Yes**   
|**Yes**  |**Yes

[PATCH 03/33] doc: boards: amlogic: update documentation for pre-generated-fip's

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/pre-generated-fip.rst | 138 +++-
 1 file changed, 88 insertions(+), 50 deletions(-)

diff --git a/doc/board/amlogic/pre-generated-fip.rst 
b/doc/board/amlogic/pre-generated-fip.rst
index c63ea616b8..6a43d776d4 100644
--- a/doc/board/amlogic/pre-generated-fip.rst
+++ b/doc/board/amlogic/pre-generated-fip.rst
@@ -1,24 +1,57 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-Pre-Generated FIP file set
-==
+Pre-Generated FIP File Repo
+===
 
-The Amlogic ARMv8 based SoCs uses a vendor variant of the Trusted Firmware-A
-boot architecture.
+Pre-built Flattened Image Package (FIP) sources and Amlogic signing binaries 
for many
+commercially available boards and some Android STB devices are collected for 
use with
+distro build-systems here: https://github.com/LibreELEC/amlogic-boot-fip
 
-You can find documentation on the Trusted Firmware-A architecture on: 
https://www.trustedfirmware.org/projects/tf-a/
+Using the pre-built FIP sources to sign U-Boot is simple, e.g. for LePotato:
 
-The Trusted Firmware-A uses the following boot elements (simplified):
+.. code-block:: bash
+
+$ git clone https://github.com/LibreELEC/amlogic-boot-fip --depth=1
+$ cd amlogic-boot-fip
+$ mkdir my-output-dir
+$ ./build-fip.sh lepotato /path/to/u-boot/u-boot.bin my-output-dir
+
+Then write U-Boot to SD or eMMC with:
+
+.. code-block:: bash
+
+$ DEV=/dev/boot_device
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=440
+
+Files Included
+--
+
+Amlogic ARMv8 SoCs use a vendor modified variant of the ARM Trusted Firmware-A 
boot
+architecture. See documentation here: 
https://www.trustedfirmware.org/projects/tf-a/
+
+Trusted Firmware-A uses the following boot elements (simplified):
+
+- BL1: First boot step implemented in ROM on Amlogic SoCs
+
+- BL2: Second boot step used to initialize the SoC main clocks & DDR 
interface. BL21
+  and ACS board-specific binaries must be "inserted" into the BL2 binary 
before signing
+  and packaging in order to be flashed on the platform
+
+- BL30: Amlogic Secure Co-Processor (SCP) firmware used to handle all system 
management
+  operations (DVFS, suspend/resume, ..)
+
+- BL301: Amlogic Secure Co-Processor (SCP) board-specific firmware "plug-in" 
to handle
+  custom DVFS & suspend-resume parameters
 
-- BL1: First boot step, implemented in ROM on Amlogic SoCs
-- BL2: Second boot step, used to initialize the SoC main clocks & DDR 
interface. The BL21 and ACS board-specific binaries are "inserted" in the BL32 
binary before signing/packaging in order to be flashed on the platform.
-- BL30: Amlogic Secure Co-Processor (SCP) firmware used to handle all the 
system management operations (DVFS, suspend/resume, ...)
-- BL301: Amlogic Secure Co-Processor (SCP) board-specific firmware "plug-in" 
to handle custom DVFS & suspend-resume parameters
 - BL31: Initializes the interrupt controller and the system management 
interface (PSCI)
-- BL32 (Optional): Is the Trusted Environment Execution (TEE) Operating System 
to run secure Trusted Apps, e.g. OP-TEE
+
+- BL32 (Optional): Is the Trusted Environment Execution (TEE) Operating System 
used to
+  run secure Trusted Apps, e.g. OP-TEE
+
 - BL33: Is the last non-secure step, usually U-Boot which loads Linux
 
-Amlogic provides in binary form:
+Amlogic sources provide the following binaries:
 
 - bl2.bin
 - bl30.bin
@@ -26,10 +59,50 @@ Amlogic provides in binary form:
 - bl31.img
 - bl32.bin
 
-And for lastest SoCs, Amlogic also provides the DDR drivers used by the BL2 
binary.
+For G12A/B and SM1 Amlogic also provides DDR drivers used by the BL2 binary:
+
+- ddr4_1d.fw
+- ddr4_2d.fw
+- ddr3_1d.fw
+- piei.fw
+- lpddr4_1d.fw
+- lpddr4_2d.fw
+- diag_lpddr4.fw
+- aml_ddr.fw
+
+The following files are generated from the Amlogic U-Boot fork:
+
+- acs.bin: Contains the PLL & DDR parameters for the board
+- bl301.bin: Contains the DVFS & suspend-resume handling code for the board
+- bl33.bin: U-boot binary image
+
+The acs.bin and bl301.bin files use U-Boot GPL-2.0+ headers and U-Boot build 
system and
+are thus considered to be issued from GPL-2.0+ source code.
+
+Amlogic alo provides pre-compiled x86_64 and Python2 binaries:
 
-The licence of these files wasn't clear until recently, the currently Amlogic 
distribution licence
-is the following:
+- aml_encrypt_gxb
+- aml_encrypt_gxl
+- aml_encrypt_g12a
+- aml_encrypt_g12b
+- acs_tool.pyc
+
+The repo replaces the pre-compiled acs_tool.pyc with a Python3 acs_tool.py 
that can be
+used with modern build hosts.
+
+The repo also provides the following files used with GXBB boards:
+
+- bl1.bin.hardkernel
+- aml_chksum
+
+The repo also supports the open-source 'gxlimg' signing tool that

[PATCH 02/33] doc: boards: amlogic: update documentation for boot-flow

2023-03-20 Thread Christian Hewitt
Improve documentation.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/boot-flow.rst | 178 
 1 file changed, 90 insertions(+), 88 deletions(-)

diff --git a/doc/board/amlogic/boot-flow.rst b/doc/board/amlogic/boot-flow.rst
index 2049672b1b..041297c512 100644
--- a/doc/board/amlogic/boot-flow.rst
+++ b/doc/board/amlogic/boot-flow.rst
@@ -3,132 +3,134 @@
 Amlogic SoC Boot Flow
 =
 
-The Amlogic SoCs have a pre-defined boot sequence in the SoC ROM code. Here are
-the possible boot sources of different SoC families supported by U-Boot:
+Amlogic SoCs follow a pre-defined boot sequence stored in SoC ROM code. The 
possible boot
+sequences of the different SoC families are:
 
-GX* & AXG family
+GX* & AXG Family
 
 
-+--++---+---+---+---+
-|  |   1| 2 | 3 |4  | 5
 |
-+==++===+===+===+===+
-| S905 | POC=0: SPI NOR | eMMC  | NAND  | SD Card   | USB Device   
 |
-| S905X||   |   |   |  
 |
-| S905L||   |   |   |  
 |
-| S905W||   |   |   |  
 |
-| S912 ||   |   |   |  
 |
-+--++---+---+---+---+
-| S805X| POC=0: SPI NOR | eMMC  | NAND  | USB Device| -
 |
-| A113D||   |   |   |  
 |
-| A113X||   |   |   |  
 |
-+--++---+---+---+---+
++--+---+-+-+-+-+
+|  |   1   | 2   | 3   | 4   | 5   |
++==+===+=+=+=+=+
+| S905 | POC=0: SPI NOR| eMMC| NAND| SD  | USB |
+| S905D|   | | | | |
+| S905L|   | | | | |
+| S905W|   | | | | |
+| S905X|   | | | | |
+| S905Y|   | | | | |
+| S912 |   | | | | |
++--+---+-+-+-+-+
+| S805X| POC=0: SPI NOR| eMMC| NAND| USB | -   |
+| A113D|   | | | | |
+| A113X|   | | | | |
++--+---+-+-+-+-+
 
 POC pin: `NAND_CLE`
 
-Some boards provide a button to force USB BOOT which disables the eMMC clock 
signal
-to bypass the eMMC stage. Others have removable eMMC modules; removing the 
eMMC and
-SDCard will allow boot from USB.
+Some boards provide a button to force USB boot by disabling the eMMC clock 
signal and
+allowing the eMMC step to be bypassed. Others have removable eMMC modules; 
removing an
+eMMC module and SD card will allow boot from USB.
 
-An exception is the lafrite board (aml-s805x-xx) which has no SDCard slot and 
boots
-from SPI. The only ways to boot the lafrite board from USB are:
+An exception is the Libre Computer AML-S805X-XX (LaFrite) board which has no 
SD card
+slot and boots from SPI. Booting a LaFrite board from USB requires either:
 
- - Erase the first sectors of SPI NOR flash
- - Insert an HDMI boot plug forcing boot over USB
+ - Erasing the first sectors of SPI NOR flash
+ - Inserting an HDMI boot plug forcing boot over USB
 
-The VIM1 and initial VIM2 boards provide a test point on the eMMC signals to 
block
-the storage from answering and continue to the next boot step.
+The VIM1 and initial VIM2 boards provide a test point on the eMMC signals to 
block the
+storage from answering, allowing boot to continue with the next boot step.
 
-The USB Device boot uses the first USB interface. On some boards this port is 
only
-available on an USB-A type connector and needs an special Type-A to Type-A 
cable to
-communicate with the BootROM.
+USB boot uses the first USB interface. On some boards this port is only 
available on a
+USB-A type connector and requires a special Type-A to Type-A cable to 
communicate with
+the BootROM.
 
-G12* & SM1 family
+G12* & SM1 Family
 -
 
-+---+---+---+---+---+---+---+
-| POC0  | POC1  | POC2  | 1 | 2 | 3

[PATCH 00/33] doc: board: amlogic: spring clean-up of Amlogic docs

2023-03-20 Thread Christian Hewitt
Amlogic documentation spans U-Boot support from 2015-current resulting
in older content being harder to follow. And due to many international
contributors the docs also contain grammar quirks.

This series reworks all board documents to be more consistent. There is
deliberate emphasis on using the amlogic-boot-fip repo for signing tasks
as this is easier for most users to follow. The original/longer signing
process (described as Manual Signing) has been tidied up.

In the index.rst file I've dropped board names from the features table
as this adds considerable width and makes adding new boards a fiddly
process. I've appended the SoC type to the boader header so it shows in
the TOC list to retain a reference between boards and the table.

I've added missing board docs for GS-King-X, BPI-M5, BPI-CM4IO, and we
split ODROID-HC4 into its own document. It originally followed the same
process as the ODROID0-C4, but now has a separate defconfig to enable
SPI-NOR and PCIe SATA support. Users occasionally follow the current
doc and build U-Boot for the C4 which omits this and then struggle to
figure out why SATA boot doesn't work when wiki/forums say it does.

There are other minor cleanups and tweaks for clarity of simply more
up-to-date information for a board or process.

Please review and flag any omissions or issues!

Christian Hewitt (33):
  doc: boards: amlogic: update documentation for index page
  doc: boards: amlogic: update documentation for boot-flow
  doc: boards: amlogic: update documentation for pre-generated-fip's
  doc: boards: amlogic: update documentation for Beelink GT-King
  doc: boards: amlogic: update documentation for Beelink GT-King Pro
  doc: boards: amlogic: update documentation for JetHub J100
  doc: boards: amlogic: update documentation for JetHub J80
  doc: boards: amlogic: update documentation for Khadas VIM
  doc: boards: amlogic: update documentation for Khadas VIM2
  doc: boards: amlogic: update documentation for Khadas VIM3
  doc: boards: amlogic: update documentation for Khadas VIM3L
  doc: boards: amlogic: update documentation for LaFrite
  doc: boards: amlogic: update documentation for LePotato
  doc: boards: amlogic: update documentation for NanoPi-K2
  doc: boards: amlogic: update documentation for ODROID-C2
  doc: boards: amlogic: update documentation for ODROID-C4
  doc: boards: amlogic: update documentation for ODROID GO ULTRA
  doc: boards: amlogic: update documentation for ODROID-N2/N2+
  doc: boards: amlogic: update documentation for ODROID-N2L
  doc: boards: amlogic: update documentation for P200
  doc: boards: amlogic: update documentation for P201
  doc: boards: amlogic: update documentation for Q200
  doc: boards: amlogic: update documentation for Radxa Zero
  doc: boards: amlogic: update documentation for S400
  doc: boards: amlogic: update documentation for SEI510
  doc: boards: amlogic: update documentation for SEI610
  doc: boards: amlogic: update documentation for U200
  doc: boards: amlogic: update documentation for W400
  doc: boards: amlogic: update documentation for WeTek Core2
  doc: boards: amlogic: add documentation for BananaPi CM4IO
  doc: boards: amlogic: add documentation for BananaPi M5
  doc: boards: amlogic: add documentation for GS-King-X
  doc: boards: amlogic: add documentation for ODROID-HC4

 board/amlogic/beelink-s922x/MAINTAINERS |   3 +-
 board/amlogic/u200/MAINTAINERS  |   1 -
 board/amlogic/w400/MAINTAINERS  |   2 +
 doc/board/amlogic/bananapi-cm4io.rst| 152 
 doc/board/amlogic/bananapi-m5.rst   | 141 +++
 doc/board/amlogic/beelink-gskingx.rst   | 121 
 doc/board/amlogic/beelink-gtking.rst| 120 
 doc/board/amlogic/beelink-gtkingpro.rst | 120 
 doc/board/amlogic/boot-flow.rst | 178 
 doc/board/amlogic/index.rst | 141 +--
 doc/board/amlogic/jethub-j100.rst   |  66 -
 doc/board/amlogic/jethub-j80.rst|  46 +++---
 doc/board/amlogic/khadas-vim.rst|  76 +-
 doc/board/amlogic/khadas-vim2.rst   |  76 +-
 doc/board/amlogic/khadas-vim3.rst   | 137 +-
 doc/board/amlogic/khadas-vim3l.rst  | 137 +-
 doc/board/amlogic/libretech-ac.rst  |  77 +-
 doc/board/amlogic/libretech-cc.rst  | 109 ++-
 doc/board/amlogic/nanopi-k2.rst |  93 +++--
 doc/board/amlogic/odroid-c2.rst |  54 +++
 doc/board/amlogic/odroid-c4.rst | 117 
 doc/board/amlogic/odroid-go-ultra.rst   |  25 +++-
 doc/board/amlogic/odroid-hc4.rst| 141 +++
 doc/board/amlogic/odroid-n2.rst | 122 
 doc/board/amlogic/odroid-n2l.rst|  33 +++--
 doc/board/amlogic/p200.rst  |  87 +++-
 doc/board/amlogic/p201.rst  |  87 +++-
 doc/board/amlogic/pre-generated-fip.rst | 138

[PATCH] arm64: dts: meson: nanopi-k2: readd PHY reset properties

2022-10-25 Thread Christian Hewitt
The sync of device-tree/bindings in 11a48a5a18c6 ("Linux 5.6-rc2") causes
Ethernet to break on some GXBB boards; the PHY seems to need proper reset
timing to function in u-boot and Linux. Re-add the old PHY reset binding
for dwmac until we support new bindings in the PHY node. This borrows the
same fix applied to the Odroid C2 board [0].

[0] https://lists.denx.de/pipermail/u-boot/2021-April/446658.html

Fixes: dd5f2351e99a ("arm64: dts: meson: sync dt and bindings from v5.6-rc2")
Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/meson-gxbb-nanopi-k2-u-boot.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/dts/meson-gxbb-nanopi-k2-u-boot.dtsi 
b/arch/arm/dts/meson-gxbb-nanopi-k2-u-boot.dtsi
index c35158d7e9..2a245bbe7f 100644
--- a/arch/arm/dts/meson-gxbb-nanopi-k2-u-boot.dtsi
+++ b/arch/arm/dts/meson-gxbb-nanopi-k2-u-boot.dtsi
@@ -5,3 +5,10 @@
  */
 
 #include "meson-gx-u-boot.dtsi"
+
+ {
+   snps,reset-gpio = < GPIOZ_14 0>;
+   snps,reset-delays-us = <0 1 100>;
+   snps,reset-active-low;
+};
+
-- 
2.17.1



[PATCH 4/4] doc: boards: amlogic: update for Radxa Zero

2021-09-14 Thread Christian Hewitt
Add documentation bits for the Radxa Zero

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/index.rst  |  3 +-
 doc/board/amlogic/radxa-zero.rst | 74 
 2 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 doc/board/amlogic/radxa-zero.rst

diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index 2913ab281a..e2ab600f7f 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -17,7 +17,7 @@ This matrix concerns the actual source code version.
 
+===+===+=+==+++=+==+
 | Boards   | Odroid-C2 | P212| Khadas 
VIM2  | S400   | U200   | Odroid-N2   | SEI610   |
 |  | Nanopi-K2 | Khadas-VIM  | Libretech-PC |  
  | SEI510 | Khadas-VIM3 | Khadas-VIM3L |
-|  | P200  | LibreTech-CC v1 | WeTek Core2  |  
  || GT-King/Pro | Odroid-C4|
+|  | P200  | LibreTech-CC v1 | WeTek Core2  |  
  | Radxa Zero | GT-King/Pro | Odroid-C4|
 |  | P201  | LibreTech-AC v2 |  |  
  || GSKing-X| Odroid-HC4   |
 |   |   | |  | 
   || | BananaPi-M5  |
 
+---+---+-+--+++-+--+
@@ -96,6 +96,7 @@ Board Documentation
p201
p212
q200
+   radxa-zero
s400
sei510
sei610
diff --git a/doc/board/amlogic/radxa-zero.rst b/doc/board/amlogic/radxa-zero.rst
new file mode 100644
index 00..423403f3c7
--- /dev/null
+++ b/doc/board/amlogic/radxa-zero.rst
@@ -0,0 +1,74 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for Radxa Zero
+=
+
+Radxa Zero is a small form factor SBC based on the Amlogic S905Y2
+chipset that ships in a number of RAM/eMMC configurations:
+
+Boards with 512MB/1GB LPDDR4 RAM have no eMMC storage and BCM43436
+wireless (2.4GHz b/g/n) while 2GB/4GB boards have 8/16/32/64/128GB
+eMMC storage and BCM4345 wireless (2.4/5GHz a/b/g/n/ac).
+
+- Amlogic S905Y2 quad-core Cortex-A53
+- Mali G31-MP2 GPU
+- HDMI 2.1 output (micro)
+- 1x USB 2.0 port - Type C (OTG)
+- 1x USB 3.0 port - Type C (Host)
+- 1x micro SD Card slot
+- 40 Pin GPIO header
+
+Schematics are available on the manufacturer website:
+
+https://dl.radxa.com/zero/docs/hw/RADAX_ZERO_V13_SCH_20210309.pdf
+
+U-Boot compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make radxa-zero_defconfig
+$ make
+
+Image creation
+--
+
+Amlogic does not provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+git trees published by the board vendor:
+
+.. code-block:: bash
+
+$ git clone -b radxa-zero-v2021.07 https://github.com/radxa/u-boot.git
+$ git clone https://github.com/radxa/fip.git
+
+$ sudo apt-get install -y gcc-aarch64-linux-gnu device-tree-compiler 
libncurses5 libncurses5-dev
+$ sudo apt-get install -y bc python dosfstools flex build-essential 
libssl-dev mtools
+
+$ wget 
https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
+$ sudo tar xvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz -C /opt
+
+$ export 
CROSS_COMPILE=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
+$ export ARCH=arm
+$ cd u-boot
+$ make radxa-zero_defconfig
+$ make
+
+$ cp u-boot.bin ../fip/radxa-zero/bl33.bin
+$ cd ../fip/radxa-zero
+$ make
+
+This will generate:
+
+.. code-block:: bash
+
+$ u-boot.bin u-boot.bin.sd.bin u-boot.bin.usb.bl2 u-boot.bin.usb.tpl
+
+Then write the image to SD with:
+
+.. code-block:: bash
+
+$ DEV=/dev/your_sd_device
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
-- 
2.17.1



[PATCH 3/4] boards: amlogic: add Radxa Zero defconfig

2021-09-14 Thread Christian Hewitt
Add a defconfig for the Radxa Zero SBC, using an Amlogic S905Y2 chip.

Signed-off-by: Christian Hewitt 
---
 configs/radxa-zero_defconfig | 70 
 1 file changed, 70 insertions(+)
 create mode 100644 configs/radxa-zero_defconfig

diff --git a/configs/radxa-zero_defconfig b/configs/radxa-zero_defconfig
new file mode 100644
index 00..acd13f1c6b
--- /dev/null
+++ b/configs/radxa-zero_defconfig
@@ -0,0 +1,70 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12a-radxa-zero"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" radxa-zero"
+CONFIG_DEBUG_UART=y
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+# CONFIG_NET_RANDOM_ETHADDR is not set
+CONFIG_MMC_MESON_GX=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+# CONFIG_PHY_REALTEK is not set
+# CONFIG_DM_ETH is not set
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+# CONFIG_ETH_DESIGNWARE_MESON8B is not set
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_DM_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



[PATCH 2/4] ARM: dts: add support for Radxa Zero

2021-09-14 Thread Christian Hewitt
Import the initial dts queued for Linux 5.16.y

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile |   1 +
 .../arm/dts/meson-g12a-radxa-zero-u-boot.dtsi |   7 +
 arch/arm/dts/meson-g12a-radxa-zero.dts| 405 ++
 3 files changed, 413 insertions(+)
 create mode 100644 arch/arm/dts/meson-g12a-radxa-zero-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-g12a-radxa-zero.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 461448c579..2ab55f7e2d 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -174,6 +174,7 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-gxm-khadas-vim2.dtb \
meson-gxm-s912-libretech-pc.dtb \
meson-gxm-wetek-core2.dtb \
+   meson-g12a-radxa-zero.dtb \
meson-g12a-sei510.dtb \
meson-g12a-u200.dtb \
meson-g12b-a311d-khadas-vim3.dtb \
diff --git a/arch/arm/dts/meson-g12a-radxa-zero-u-boot.dtsi 
b/arch/arm/dts/meson-g12a-radxa-zero-u-boot.dtsi
new file mode 100644
index 00..236f2468dc
--- /dev/null
+++ b/arch/arm/dts/meson-g12a-radxa-zero-u-boot.dtsi
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS.
+ * Author: Neil Armstrong 
+ */
+
+#include "meson-g12-common-u-boot.dtsi"
diff --git a/arch/arm/dts/meson-g12a-radxa-zero.dts 
b/arch/arm/dts/meson-g12a-radxa-zero.dts
new file mode 100644
index 00..e3bb6df42f
--- /dev/null
+++ b/arch/arm/dts/meson-g12a-radxa-zero.dts
@@ -0,0 +1,405 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2018 BayLibre SAS. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "meson-g12a.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "radxa,zero", "amlogic,g12a";
+   model = "Radxa Zero";
+
+   aliases {
+   serial0 = _AO;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x4000>;
+   };
+
+   cvbs-connector {
+   status = "disabled";
+   compatible = "composite-video-connector";
+
+   port {
+   cvbs_connector_in: endpoint {
+   remote-endpoint = <_vdac_out>;
+   };
+   };
+   };
+
+   hdmi-connector {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_connector_in: endpoint {
+   remote-endpoint = <_tx_tmds_out>;
+   };
+   };
+   };
+
+   emmc_pwrseq: emmc-pwrseq {
+   compatible = "mmc-pwrseq-emmc";
+   reset-gpios = < BOOT_12 GPIO_ACTIVE_LOW>;
+   };
+
+   sdio_pwrseq: sdio-pwrseq {
+   compatible = "mmc-pwrseq-simple";
+   reset-gpios = < GPIOX_6 GPIO_ACTIVE_LOW>;
+   clocks = <>;
+   clock-names = "ext_clock";
+   };
+
+   ao_5v: regulator-ao_5v {
+   compatible = "regulator-fixed";
+   regulator-name = "AO_5V";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   regulator-always-on;
+   };
+
+   vcc_1v8: regulator-vcc_1v8 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_1V8";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   vin-supply = <_3v3>;
+   regulator-always-on;
+   };
+
+   vcc_3v3: regulator-vcc_3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <_3v3>;
+   regulator-always-on;
+   };
+
+   hdmi_pw: regulator-hdmi_pw {
+   compatible = "regulator-fixed";
+   regulator-name = "HDMI_PW";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   vin-supply = <_5v>;
+   regulator-always-on;
+   };
+
+   vddao_1v8: regulator-vddao_1v8 {
+   compatible = "regulator-fixed";
+   regulator-name = "VDDAO_1V8";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   vin-supply = <_3v3>;
+   regulator-always-on;
+   };
+

[PATCH 1/4] ARM: dts: sort Amlogic Makefile section

2021-09-14 Thread Christian Hewitt
Alpha sort the Amlogic dtb list (same as the kernel).

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index f0160d2dc0..461448c579 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -158,6 +158,7 @@ dtb-$(CONFIG_ARCH_S5P4418) += \
s5p4418-nanopi2.dtb
 
 dtb-$(CONFIG_ARCH_MESON) += \
+   meson-axg-s400.dtb \
meson-gxbb-nanopi-k2.dtb \
meson-gxbb-odroidc2.dtb \
meson-gxbb-nanopi-k2.dtb \
@@ -165,22 +166,22 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-gxbb-p201.dtb \
meson-gxl-s905x-p212.dtb \
meson-gxl-s805x-libretech-ac.dtb \
+   meson-gxl-s905d-libretech-pc.dtb \
+   meson-gxl-s905x-khadas-vim.dtb \
meson-gxl-s905x-libretech-cc.dtb \
meson-gxl-s905x-libretech-cc-v2.dtb \
-   meson-gxl-s905x-khadas-vim.dtb \
-   meson-gxl-s905d-libretech-pc.dtb \
+   meson-gxl-s905x-p212.dtb \
meson-gxm-khadas-vim2.dtb \
meson-gxm-s912-libretech-pc.dtb \
meson-gxm-wetek-core2.dtb \
-   meson-axg-s400.dtb \
-   meson-g12a-u200.dtb \
meson-g12a-sei510.dtb \
+   meson-g12a-u200.dtb \
+   meson-g12b-a311d-khadas-vim3.dtb \
meson-g12b-gtking.dtb \
meson-g12b-gtking-pro.dtb \
meson-g12b-gsking-x.dtb \
meson-g12b-odroid-n2.dtb \
meson-g12b-odroid-n2-plus.dtb \
-   meson-g12b-a311d-khadas-vim3.dtb \
meson-sm1-bananapi-m5.dtb \
meson-sm1-khadas-vim3l.dtb \
meson-sm1-odroid-c4.dtb \
-- 
2.17.1



[PATCH 0/4] ARM: amlogic: add Radxa Zero

2021-09-14 Thread Christian Hewitt
This series alpha sorts the Amlogic Makefile, then adds
support for the Radxa Zero SBC using the device-tree
queued in the Amlogic maintainer tree for Linux 5.16.y

Patches are based on custodians/u-boot-amlogic-next

Christian Hewitt (4):
  ARM: dts: sort Amlogic Makefile section
  ARM: dts: add support for Radxa Zero
  boards: amlogic: add Radxa Zero defconfig
  doc: boards: amlogic: update for Radxa Zero

 arch/arm/dts/Makefile |  12 +-
 .../arm/dts/meson-g12a-radxa-zero-u-boot.dtsi |   7 +
 arch/arm/dts/meson-g12a-radxa-zero.dts| 405 ++
 configs/radxa-zero_defconfig  |  70 +++
 doc/board/amlogic/index.rst   |   3 +-
 doc/board/amlogic/radxa-zero.rst  |  74 
 6 files changed, 565 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/dts/meson-g12a-radxa-zero-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-g12a-radxa-zero.dts
 create mode 100644 configs/radxa-zero_defconfig
 create mode 100644 doc/board/amlogic/radxa-zero.rst

-- 
2.17.1



[PATCH] ARM: meson: Add S905Y2 SOC ID

2021-08-20 Thread Christian Hewitt
Add the SOC ID for the S905Y2 to board info, see below for before/after
tested with a Radxa Zero board:

SoC:   Amlogic Meson G12A (Unknown) Revision 28:b (30:2)
SoC:   Amlogic Meson G12A (S905Y2) Revision 28:b (30:2)

Signed-off-by: Christian Hewitt 
---
 arch/arm/mach-meson/board-info.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-meson/board-info.c b/arch/arm/mach-meson/board-info.c
index d16d3f194d..2421acd817 100644
--- a/arch/arm/mach-meson/board-info.c
+++ b/arch/arm/mach-meson/board-info.c
@@ -64,6 +64,7 @@ static const struct meson_gx_package_id {
{ "A113X",  0x25, 0x37, 0xff },
{ "A113D",  0x25, 0x22, 0xff },
{ "S905D2", 0x28, 0x10, 0xf0 },
+   { "S905Y2", 0x28, 0x30, 0xf0 },
{ "S905X2", 0x28, 0x40, 0xf0 },
{ "A311D",  0x29, 0x10, 0xf0 },
{ "S922X",  0x29, 0x40, 0xf0 },
-- 
2.17.1



[PATCH] board: amlogic: odroid-n2: fix fdtfile suffix for n2-plus

2021-08-04 Thread Christian Hewitt
The N2+ dtb is meson-g12b-odroid-n2-plus.dtb, not n2_plus, so
correct the suffix provided in the board file. Also align the
board ident string shown during boot to match.

Fixes: 8bc780106c13 ("board: amlogic: odroid: add runtime detection of the 
N2/N2+/C4/HC4 variants")
Signed-off-by: Christian Hewitt 
---
 board/amlogic/odroid-n2/odroid-n2.c | 2 +-
 configs/odroid-n2_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/amlogic/odroid-n2/odroid-n2.c 
b/board/amlogic/odroid-n2/odroid-n2.c
index 88a60f34fe..acfd107fc5 100644
--- a/board/amlogic/odroid-n2/odroid-n2.c
+++ b/board/amlogic/odroid-n2/odroid-n2.c
@@ -48,7 +48,7 @@ static struct meson_odroid_boards {
/* OdroidN2 rev 2019,2,7 */
{ MESON_SOC_ID_G12B, 330 * 4, 350 * 4, "n2" },
/* OdroidN2plus rev 2019,11,20 */
-   { MESON_SOC_ID_G12B, 410 * 4, 430 * 4, "n2_plus" },
+   { MESON_SOC_ID_G12B, 410 * 4, 430 * 4, "n2-plus" },
/* OdroidC4 rev 2020,01,29 */
{ MESON_SOC_ID_SM1,   80 * 4, 100 * 4, "c4" },
/* OdroidHC4 rev 2019,12,10 */
diff --git a/configs/odroid-n2_defconfig b/configs/odroid-n2_defconfig
index bac44b61ab..1f718a3154 100644
--- a/configs/odroid-n2_defconfig
+++ b/configs/odroid-n2_defconfig
@@ -9,7 +9,7 @@ CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-odroid-n2"
 CONFIG_MESON_G12A=y
 CONFIG_DEBUG_UART_BASE=0xff803000
 CONFIG_DEBUG_UART_CLOCK=2400
-CONFIG_IDENT_STRING=" odroid-n2/n2_plus"
+CONFIG_IDENT_STRING=" odroid-n2/n2-plus"
 CONFIG_DEBUG_UART=y
 CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_CPUINFO is not set
-- 
2.17.1



[PATCH 5/5] boards: amlogic: update documentation for Beelink GT-King/Pro

2020-12-18 Thread Christian Hewitt
Update the device matrix and add build instructions.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/beelink-gtking.rst| 115 +++
 doc/board/amlogic/beelink-gtkingpro.rst | 116 
 doc/board/amlogic/index.rst |   4 +-
 3 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 doc/board/amlogic/beelink-gtking.rst
 create mode 100644 doc/board/amlogic/beelink-gtkingpro.rst

diff --git a/doc/board/amlogic/beelink-gtking.rst 
b/doc/board/amlogic/beelink-gtking.rst
new file mode 100644
index 00..56ce2cb273
--- /dev/null
+++ b/doc/board/amlogic/beelink-gtking.rst
@@ -0,0 +1,115 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for Beelink GT-King
+==
+
+The Shenzen AZW (Beelink) GT-King is based on the Amlogic W400 reference
+board with an S922X-H chip.
+
+- 4GB LPDDR4 RAM
+- 64GB eMMC storage
+- 10/100/1000 Base-T Ethernet
+- AP6356S Wireless (802.11 a/b/g/n/ac, BT 4.1)
+- HDMI 2.1 video
+- S/PDIF optical output
+- Analogue audio output
+- 1x USB 2.0 port
+- 2x USB 3.0 ports
+- IR receiver
+- 1x micro SD card slot
+
+Beelink do not provide public schematics, but have been willing
+to share them with known distro developers on request.
+
+U-Boot compilation
+--
+
+.. code-block:: bash
+
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make beelink-gtking_defconfig
+$ make
+
+Image creation
+--
+
+Amlogic does not provide sources for the firmware and for tools needed
+to create the bootloader image. Beelink have provided the Amlogic "SDK"
+in their forums, but the u-boot sources included result in 2GB RAM being
+detected. The following FIPs were generated with newer private sources
+and give correct (4GB) RAM detection:
+
+https://github.com/LibreELEC/amlogic-boot-fip/tree/master/beelink-s922x
+
+NB: Beelink use a common board config for GT-King, GT-King Pro and the
+GS-King-X model, hence the "beelink-s922x" name.
+
+.. code-block:: bash
+
+$ wget https://github.com/LibreELEC/amlogic-boot-fip/archive/master.zip
+$ unzip master.zip
+$ export FIPDIR=$PWD/amlogic-boot-fip/beelink-s922x
+
+Go back to the mainline U-Boot source tree then:
+
+.. code-block:: bash
+
+$ mkdir fip
+$ cp $FIPDIR/* fip/
+$ cp u-boot.bin fip/bl33.bin
+
+$ sh fip/blx_fix.sh \
+   fip/bl30.bin \
+   fip/zero_tmp \
+   fip/bl30_zero.bin \
+   fip/bl301.bin \
+   fip/bl301_zero.bin \
+   fip/bl30_new.bin \
+   bl30
+
+$ sh fip/blx_fix.sh \
+   fip/bl2.bin \
+   fip/zero_tmp \
+   fip/bl2_zero.bin \
+   fip/acs.bin \
+   fip/bl21_zero.bin \
+   fip/bl2_new.bin \
+   bl2
+
+$ fip/aml_encrypt_g12b --bl30sig --input fip/bl30_new.bin \
+   --output fip/bl30_new.bin.g12a.enc \
+   --level v3
+$ fip/aml_encrypt_g12b --bl3sig --input fip/bl30_new.bin.g12a.enc \
+   --output fip/bl30_new.bin.enc \
+   --level v3 --type bl30
+$ fip/aml_encrypt_g12b --bl3sig --input fip/bl31.img \
+   --output fip/bl31.img.enc \
+   --level v3 --type bl31
+$ fip/aml_encrypt_g12b --bl3sig --input fip/bl33.bin --compress lz4 \
+   --output fip/bl33.bin.enc \
+   --level v3 --type bl33
+$ fip/aml_encrypt_g12b --bl2sig --input fip/bl2_new.bin \
+   --output fip/bl2.n.bin.sig
+$ fip/aml_encrypt_g12b --bootmk \
+   --output fip/u-boot.bin \
+   --bl2 fip/bl2.n.bin.sig \
+   --bl30 fip/bl30_new.bin.enc \
+   --bl31 fip/bl31.img.enc \
+   --bl33 fip/bl33.bin.enc \
+   --ddrfw1 fip/ddr4_1d.fw \
+   --ddrfw2 fip/ddr4_2d.fw \
+   --ddrfw3 fip/ddr3_1d.fw \
+   --ddrfw4 fip/piei.fw \
+   --ddrfw5 fip/lpddr4_1d.fw \
+   --ddrfw6 fip/lpddr4_2d.fw \
+   --ddrfw7 fip/diag_lpddr4.fw \
+   --ddrfw8 fip/aml_ddr.fw \
+   --level v3
+
+and then write the image to SD with:
+
+.. code-block:: bash
+
+$ DEV=/dev/your_sd_device
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 
seek=1
+$ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
diff --git a/doc/board/amlogic/beelink-gtkingpro.rst 
b/doc/board/amlogic/beelink-gtkingpro.rst
new file mode 100644
index 00..d750351361
--- /dev/null
+++ b/doc/board/amlogic/beelink-gtkingpro.rst
@@ -0,0 +1,116 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+U-Boot for Beelink GT-King Pro
+==
+
+The Shenzen AZW (Beelink) GT-King Pro is based on the Amlogic W400 reference
+board with an S922X-H chip.
+
+- 4GB LPDDR4 RAM
+- 64GB eMMC storage
+- 10/100/1000 Base-T Ethernet
+- AP6356S Wireless (8

[PATCH 2/5] boards: amlogic: add Beelink S922X board family support

2020-12-18 Thread Christian Hewitt
Copied from Odroid N2. Add myself as maintainer.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/beelink-s922x/MAINTAINERS |  9 
 board/amlogic/beelink-s922x/Makefile|  6 +++
 board/amlogic/beelink-s922x/beelink-s922x.c | 54 +
 3 files changed, 69 insertions(+)
 create mode 100644 board/amlogic/beelink-s922x/MAINTAINERS
 create mode 100644 board/amlogic/beelink-s922x/Makefile
 create mode 100644 board/amlogic/beelink-s922x/beelink-s922x.c

diff --git a/board/amlogic/beelink-s922x/MAINTAINERS 
b/board/amlogic/beelink-s922x/MAINTAINERS
new file mode 100644
index 00..7f223df4ae
--- /dev/null
+++ b/board/amlogic/beelink-s922x/MAINTAINERS
@@ -0,0 +1,9 @@
+BEELINK-S922X
+M: Christian Hewitt 
+S: Maintained
+L: u-boot-amlo...@groups.io
+F: board/amlogic/beelink-s922x/
+F: configs/beelink-gtking_defconfig
+F: configs/beelink-gtkingpro_defconfig
+F: doc/board/amlogic/beelink-gtking.rst
+F: doc/board/amlogic/beelink-gtkingpro.rst
diff --git a/board/amlogic/beelink-s922x/Makefile 
b/board/amlogic/beelink-s922x/Makefile
new file mode 100644
index 00..27b1a74105
--- /dev/null
+++ b/board/amlogic/beelink-s922x/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2020 BayLibre, SAS
+# Author: Neil Armstrong 
+
+obj-y  := beelink-s922x.o
diff --git a/board/amlogic/beelink-s922x/beelink-s922x.c 
b/board/amlogic/beelink-s922x/beelink-s922x.c
new file mode 100644
index 00..dc0d933a39
--- /dev/null
+++ b/board/amlogic/beelink-s922x/beelink-s922x.c
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 BayLibre, SAS
+ * Author: Neil Armstrong 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define EFUSE_MAC_OFFSET   20
+#define EFUSE_MAC_SIZE 12
+#define MAC_ADDR_LEN   6
+
+int misc_init_r(void)
+{
+   u8 mac_addr[MAC_ADDR_LEN];
+   char efuse_mac_addr[EFUSE_MAC_SIZE], tmp[3];
+   ssize_t len;
+
+   if (IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG) &&
+   meson_get_soc_rev(tmp, sizeof(tmp)) > 0)
+   env_set("soc_rev", tmp);
+
+   meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
+
+   if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
+   len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
+ efuse_mac_addr, EFUSE_MAC_SIZE);
+   if (len != EFUSE_MAC_SIZE)
+   return 0;
+
+   /* MAC is stored in ASCII format, 1bytes = 2characters */
+   for (int i = 0; i < 6; i++) {
+   tmp[0] = efuse_mac_addr[i * 2];
+   tmp[1] = efuse_mac_addr[i * 2 + 1];
+   tmp[2] = '\0';
+   mac_addr[i] = simple_strtoul(tmp, NULL, 16);
+   }
+
+   if (is_valid_ethaddr(mac_addr))
+   eth_env_set_enetaddr("ethaddr", mac_addr);
+   else
+   meson_generate_serial_ethaddr();
+   }
+
+   return 0;
+}
-- 
2.17.1



[PATCH 4/5] boards: amlogic: add Beelink GT-King Pro defconfig

2020-12-18 Thread Christian Hewitt
Add a defconfig for the Beelink GT-King Pro Android STB, which is based
on the Amlogic W400 reference design.

Signed-off-by: Christian Hewitt 
---
 configs/beelink-gtkingpro_defconfig | 71 +
 1 file changed, 71 insertions(+)
 create mode 100644 configs/beelink-gtkingpro_defconfig

diff --git a/configs/beelink-gtkingpro_defconfig 
b/configs/beelink-gtkingpro_defconfig
new file mode 100644
index 00..569031600a
--- /dev/null
+++ b/configs/beelink-gtkingpro_defconfig
@@ -0,0 +1,71 @@
+CONFIG_ARM=y
+CONFIG_SYS_BOARD="beelink-s922x"
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" beelink"
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-gtking-pro"
+CONFIG_DEBUG_UART=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_DM_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



[PATCH 3/5] boards: amlogic: add Beelink GT-King defconfig

2020-12-18 Thread Christian Hewitt
Add a defconfig for the Beelink GT-King Android STB, which is based
on the Amlogic W400 reference design.

Signed-off-by: Christian Hewitt 
---
 configs/beelink-gtking_defconfig | 71 
 1 file changed, 71 insertions(+)
 create mode 100644 configs/beelink-gtking_defconfig

diff --git a/configs/beelink-gtking_defconfig b/configs/beelink-gtking_defconfig
new file mode 100644
index 00..ea428874af
--- /dev/null
+++ b/configs/beelink-gtking_defconfig
@@ -0,0 +1,71 @@
+CONFIG_ARM=y
+CONFIG_SYS_BOARD="beelink-s922x"
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" beelink"
+CONFIG_DEFAULT_DEVICE_TREE="meson-g12b-gtking"
+CONFIG_DEBUG_UART=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_DM_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



[PATCH 1/5] ARM: dts: import Beelink GT-King/Pro DTs from Linux 5.10

2020-12-18 Thread Christian Hewitt
Import the Beelink GT-King/Pro and supporting meson-g12b-w400.dtsi file
from Linux 5.10.

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile  |   2 +
 arch/arm/dts/meson-g12b-gtking-pro.dts | 125 
 arch/arm/dts/meson-g12b-gtking.dts | 145 +
 arch/arm/dts/meson-g12b-w400.dtsi  | 425 +
 4 files changed, 697 insertions(+)
 create mode 100644 arch/arm/dts/meson-g12b-gtking-pro.dts
 create mode 100644 arch/arm/dts/meson-g12b-gtking.dts
 create mode 100644 arch/arm/dts/meson-g12b-w400.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 02dd6a832f..287ac63da4 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -170,6 +170,8 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-axg-s400.dtb \
meson-g12a-u200.dtb \
meson-g12a-sei510.dtb \
+   meson-g12b-gtking.dtb \
+   meson-g12b-gtking-pro.dtb \
meson-g12b-odroid-n2.dtb \
meson-g12b-odroid-n2-plus.dtb \
meson-g12b-a311d-khadas-vim3.dtb \
diff --git a/arch/arm/dts/meson-g12b-gtking-pro.dts 
b/arch/arm/dts/meson-g12b-gtking-pro.dts
new file mode 100644
index 00..f0c56a16af
--- /dev/null
+++ b/arch/arm/dts/meson-g12b-gtking-pro.dts
@@ -0,0 +1,125 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ * Copyright (c) 2019 Christian Hewitt 
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-w400.dtsi"
+#include 
+
+/ {
+   compatible = "azw,gtking", "amlogic,g12b";
+   model = "Beelink GT-King Pro";
+
+   gpio-keys-polled {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <100>;
+
+   power-button {
+   label = "power";
+   linux,code = ;
+   gpios = <_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   white {
+   label = "power:white";
+   gpios = <_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
+   default-state = "on";
+   };
+   };
+
+   sound {
+   compatible = "amlogic,axg-sound-card";
+   model = "G12B-GTKING-PRO";
+   audio-aux-devs = <_b>;
+   audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
+   "TDMOUT_B IN 1", "FRDDR_B OUT 1",
+   "TDMOUT_B IN 2", "FRDDR_C OUT 1",
+   "TDM_B Playback", "TDMOUT_B OUT";
+
+   assigned-clocks = < CLKID_MPLL2>,
+ < CLKID_MPLL0>,
+ < CLKID_MPLL1>;
+   assigned-clock-parents = <0>, <0>, <0>;
+   assigned-clock-rates = <294912000>,
+  <270950400>,
+  <393216000>;
+   status = "okay";
+
+   dai-link-0 {
+   sound-dai = <_a>;
+   };
+
+   dai-link-1 {
+   sound-dai = <_b>;
+   };
+
+   dai-link-2 {
+   sound-dai = <_c>;
+   };
+
+   /* 8ch hdmi interface */
+   dai-link-3 {
+   sound-dai = <_b>;
+   dai-format = "i2s";
+   dai-tdm-slot-tx-mask-0 = <1 1>;
+   dai-tdm-slot-tx-mask-1 = <1 1>;
+   dai-tdm-slot-tx-mask-2 = <1 1>;
+   dai-tdm-slot-tx-mask-3 = <1 1>;
+   mclk-fs = <256>;
+
+   codec {
+   sound-dai = < TOHDMITX_I2S_IN_B>;
+   };
+   };
+
+   dai-link-4 {
+   sound-dai = < TOHDMITX_I2S_OUT>;
+
+   codec {
+   sound-dai = <_tx>;
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+_audio {
+   status = "okay";
+};
+
+_a {
+   status = "okay";
+};
+
+_b {
+   status = "okay";
+};
+
+_c {
+   status = "okay";
+};
+
+_b {
+   status = "okay";
+};
+
+_b {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/dts/meson-g12b-gtking.dts 
b/arch/arm/dts/meson-g12b-gtking.dts
new file mode 100

[PATCH 0/5] board: amlogic: add Beelink GT-King/Pro support

2020-12-18 Thread Christian Hewitt
This patchset adds support for the Beelink GT-King and GT-King Pro boxes
based on the Amlogic S922X (G12B/W400) SoC. Patches are based on the
u-boot-amlogic-next branch in the custodians tree.

Christian Hewitt (5):
  ARM: dts: import Beelink GT-King/Pro DTs from Linux 5.10
  boards: amlogic: add Beelink S922X board family support
  boards: amlogic: add Beelink GT-King defconfig
  boards: amlogic: add Beelink GT-King Pro defconfig
  boards: amlogic: update documentation for Beelink GT-King/Pro

 arch/arm/dts/Makefile   |   2 +
 arch/arm/dts/meson-g12b-gtking-pro.dts  | 125 ++
 arch/arm/dts/meson-g12b-gtking.dts  | 145 +++
 arch/arm/dts/meson-g12b-w400.dtsi   | 425 
 board/amlogic/beelink-s922x/MAINTAINERS |   9 +
 board/amlogic/beelink-s922x/Makefile|   6 +
 board/amlogic/beelink-s922x/beelink-s922x.c |  54 +++
 configs/beelink-gtking_defconfig|  71 
 configs/beelink-gtkingpro_defconfig |  71 
 doc/board/amlogic/beelink-gtking.rst| 115 ++
 doc/board/amlogic/beelink-gtkingpro.rst | 116 ++
 doc/board/amlogic/index.rst |   4 +-
 12 files changed, 1142 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/meson-g12b-gtking-pro.dts
 create mode 100644 arch/arm/dts/meson-g12b-gtking.dts
 create mode 100644 arch/arm/dts/meson-g12b-w400.dtsi
 create mode 100644 board/amlogic/beelink-s922x/MAINTAINERS
 create mode 100644 board/amlogic/beelink-s922x/Makefile
 create mode 100644 board/amlogic/beelink-s922x/beelink-s922x.c
 create mode 100644 configs/beelink-gtking_defconfig
 create mode 100644 configs/beelink-gtkingpro_defconfig
 create mode 100644 doc/board/amlogic/beelink-gtking.rst
 create mode 100644 doc/board/amlogic/beelink-gtkingpro.rst

-- 
2.17.1



[PATCH 3/3] boards: amlogic: update documentation for WeTek Core2

2020-12-15 Thread Christian Hewitt
Update the device matrix and add build instructions.

Signed-off-by: Christian Hewitt 
---
 doc/board/amlogic/index.rst   |  3 +-
 doc/board/amlogic/wetek-core2.rst | 90 +++
 2 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 doc/board/amlogic/wetek-core2.rst

diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index cba1c7b726..a585d857df 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -17,7 +17,7 @@ This matrix concerns the actual source code version.
 
+===+===+=+==+++=+==+
 | Boards   | Odroid-C2 | P212| Khadas 
VIM2  | S400   | U200   | Odroid-N2   | SEI610   |
 |  | Nanopi-K2 | Khadas-VIM  | Libretech-PC |  
  | SEI510 | Khadas-VIM3 | Khadas-VIM3L |
-|  | P200  | LibreTech-CC v1 |  |  
  || | Odroid-C4|
+|  | P200  | LibreTech-CC v1 | WeTek Core2  |  
  || | Odroid-C4|
 |  | P201  | LibreTech-AC v2 |  |  
  || |  |
 
+---+---+-+--+++-+--+
 | UART | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
@@ -95,4 +95,5 @@ Board Documentation
sei510
sei610
u200
+   wetek-core2
w400
diff --git a/doc/board/amlogic/wetek-core2.rst 
b/doc/board/amlogic/wetek-core2.rst
new file mode 100644
index 00..d2aeb90c3d
--- /dev/null
+++ b/doc/board/amlogic/wetek-core2.rst
@@ -0,0 +1,90 @@
+.. SPDX-License-Identifier: GPL-2.0+
+U-Boot for WeTek Core2
+==
+
+WeTek Core2 is an Android STB based on the Q200 reference design with
+the following specifications:
+
+ - Amlogic S912 ARM Cortex-A53 octo-core SoC @ 1.5GHz
+ - ARM Mali T820 GPU
+ - 3GB DDR4 SDRAM
+ - 10/100 Realtek RTL8152 Ethernet (internal USB)
+ - HDMI 2.0 4K/60Hz display
+ - 2x USB 2.0 Host, 1x USB 2.0 OTG (internal)
+ - 32GB eMMC
+ - microSD
+ - SDIO Wifi Module, Bluetooth
+ - Two channel IR receiver
+
+U-Boot compilation
+--
+
+.. code-block:: bash
+$ export CROSS_COMPILE=aarch64-none-elf-
+$ make wetek-core2_defconfig
+$ make
+Image creation
+--
+
+Amlogic does not provide sources for the firmware or the tools needed
+to create the bootloader image, and WeTek has not publicly shared the
+precompiled FIP binaries. However the public Khadas VIM2 sources also
+work with the Core2 box so we can use the Khadas git tree:
+
+.. code-block:: bash
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+$ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+$ export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+$ git clone https://github.com/khadas/u-boot -b khadas-vim-v2015.01 
vim-u-boot
+$ cd vim-u-boot
+$ make kvim2_defconfig
+$ make
+$ export FIPDIR=$PWD/fip
+
+Go back to mainline U-Boot source tree then:
+
+.. code-block:: bash
+$ mkdir fip
+$ cp $FIPDIR/gxl/bl2.bin fip/
+$ cp $FIPDIR/gxl/acs.bin fip/
+$ cp $FIPDIR/gxl/bl21.bin fip/
+$ cp $FIPDIR/gxl/bl30.bin fip/
+$ cp $FIPDIR/gxl/bl301.bin fip/
+$ cp $FIPDIR/gxl/bl31.img fip/
+$ cp u-boot.bin fip/bl33.bin
+$ $FIPDIR/blx_fix.sh \
+fip/bl30.bin \
+fip/zero_tmp \
+fip/bl30_zero.bin \
+fip/bl301.bin \
+fip/bl301_zero.bin \
+fip/bl30_new.bin \
+bl30
+$ python $FIPDIR/acs_tool.pyc fip/bl2.bin fip/bl2_acs.bin fip/acs.bin 0
+$ $FIPDIR/blx_fix.sh \
+fip/bl2_acs.bin \
+fip/zero_tmp \
+fip/bl2_zero.bin \
+fip/bl21.bin \
+fip/bl21_zero.bin \
+fip/bl2_new.bin \
+bl2
+$ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl30_new.bin
+$ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl31.img
+$ $FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input fip/bl33.bin
+$ $FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input fip/bl2_new.bin --output 
fip/bl2.n.bin.sig
+$ $FIPDIR/gxl/aml_encrypt_gxl --bootmk \
+--output fip/u-boot.bin \
+--bl2 fip/bl2.n.bin.sig \
+--bl30 fip/bl30_new.bin.enc \
+--bl31 fip/bl31.img.enc \
+--bl33 fip/bl33.bin.enc

[PATCH 2/3] boards: amlogic: add WeTek Core2 support

2020-12-15 Thread Christian Hewitt
Add a config for the WeTek Core2, largely based on the VIM2 config.

Signed-off-by: Christian Hewitt 
---
 configs/wetek-core2_defconfig | 70 +++
 1 file changed, 70 insertions(+)
 create mode 100644 configs/wetek-core2_defconfig

diff --git a/configs/wetek-core2_defconfig b/configs/wetek-core2_defconfig
new file mode 100644
index 00..706abff962
--- /dev/null
+++ b/configs/wetek-core2_defconfig
@@ -0,0 +1,70 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_MESON_GXM=y
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=2400
+CONFIG_IDENT_STRING=" wetek-core2"
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxm-wetek-core2"
+CONFIG_DEBUG_UART=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_CONSOLE_MUX=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_ADC=y
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SARADC_MESON=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MESON_GXL_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_GXL=y
+CONFIG_DM_REGULATOR=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_GX_VPU_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_MESON=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_GXL=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



[PATCH 1/3] ARM: dts: import WeTek Core2 DTs from Linux 5.10

2020-12-15 Thread Christian Hewitt
Import the WeTek Core2 and supporting meson-gx-p23x-q20x.dtsi files
from Linux 5.10.

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile |   1 +
 arch/arm/dts/meson-gx-p23x-q20x.dtsi  | 324 ++
 .../arm/dts/meson-gxm-wetek-core2-u-boot.dtsi |   7 +
 arch/arm/dts/meson-gxm-wetek-core2.dts|  87 +
 4 files changed, 419 insertions(+)
 create mode 100644 arch/arm/dts/meson-gx-p23x-q20x.dtsi
 create mode 100644 arch/arm/dts/meson-gxm-wetek-core2-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxm-wetek-core2.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 4cbf3746f3..99f89227cb 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -166,6 +166,7 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-gxl-s905d-libretech-pc.dtb \
meson-gxm-khadas-vim2.dtb \
meson-gxm-s912-libretech-pc.dtb \
+   meson-gxm-wetek-core2.dtb \
meson-axg-s400.dtb \
meson-g12a-u200.dtb \
meson-g12a-sei510.dtb \
diff --git a/arch/arm/dts/meson-gx-p23x-q20x.dtsi 
b/arch/arm/dts/meson-gx-p23x-q20x.dtsi
new file mode 100644
index 00..6b57e15aad
--- /dev/null
+++ b/arch/arm/dts/meson-gx-p23x-q20x.dtsi
@@ -0,0 +1,324 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2016 Endless Computers, Inc.
+ * Author: Carlo Caione 
+ */
+
+/* Common DTSI for same Amlogic Q200/Q201 and P230/P231 boards using either
+ * the pin-compatible S912 (GXM) or S905D (GXL) SoCs.
+ */
+
+#include 
+
+/ {
+   aliases {
+   serial0 = _AO;
+   ethernet0 = 
+   };
+
+   dio2133: analog-amplifier {
+   compatible = "simple-audio-amplifier";
+   sound-name-prefix = "AU2";
+   VCC-supply = <_5v>;
+   enable-gpios = < GPIOH_5 GPIO_ACTIVE_HIGH>;
+   };
+
+   spdif_dit: audio-codec-0 {
+   #sound-dai-cells = <0>;
+   compatible = "linux,spdif-dit";
+   status = "okay";
+   sound-name-prefix = "DIT";
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x8000>;
+   };
+
+   hdmi_5v: regulator-hdmi-5v {
+   compatible = "regulator-fixed";
+
+   regulator-name = "HDMI_5V";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+
+   gpio = < GPIOH_3 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   regulator-always-on;
+   };
+
+   vddio_ao18: regulator-vddio_ao18 {
+   compatible = "regulator-fixed";
+   regulator-name = "VDDIO_AO18";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   };
+
+   vddio_boot: regulator-vddio_boot {
+   compatible = "regulator-fixed";
+   regulator-name = "VDDIO_BOOT";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   };
+
+   vddao_3v3: regulator-vddao_3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "VDDAO_3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   vcc_3v3: regulator-vcc_3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   emmc_pwrseq: emmc-pwrseq {
+   compatible = "mmc-pwrseq-emmc";
+   reset-gpios = < BOOT_9 GPIO_ACTIVE_LOW>;
+   };
+
+   wifi32k: wifi32k {
+   compatible = "pwm-clock";
+   #clock-cells = <0>;
+   clock-frequency = <32768>;
+   pwms = <_ef 0 30518 0>; /* PWM_E at 32.768KHz */
+   };
+
+   sdio_pwrseq: sdio-pwrseq {
+   compatible = "mmc-pwrseq-simple";
+   reset-gpios = < GPIOX_6 GPIO_ACTIVE_LOW>;
+   clocks = <>;
+   clock-names = "ext_clock";
+   };
+
+   cvbs-connector {
+   compatible = "composite-video-connector";
+
+   port {
+   cvbs_connector_in: endpoint {
+   remote-endpoint = <_vdac_out>;
+   };
+   };
+   };
+
+   hdmi-connector {
+   compatible = "

[PATCH 0/3] board: amlogic: add WeTek Core2 support

2020-12-15 Thread Christian Hewitt
This patchset adds support for the WeTek Core2 box which is based on the
Amlogic S912 (GXM) SoC. Patches are based on u-boot-amlogic-next branch
in the custodians tree.

Christian Hewitt (3):
  ARM: dts: import WeTek Core2 DTs from Linux 5.10
  boards: amlogic: add WeTek Core2 support
  boards: amlogic: update documentation for WeTek Core2

 arch/arm/dts/Makefile |   1 +
 arch/arm/dts/meson-gx-p23x-q20x.dtsi  | 324 ++
 .../arm/dts/meson-gxm-wetek-core2-u-boot.dtsi |   7 +
 arch/arm/dts/meson-gxm-wetek-core2.dts|  87 +
 configs/wetek-core2_defconfig |  70 
 doc/board/amlogic/index.rst   |   3 +-
 doc/board/amlogic/wetek-core2.rst |  90 +
 7 files changed, 581 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/meson-gx-p23x-q20x.dtsi
 create mode 100644 arch/arm/dts/meson-gxm-wetek-core2-u-boot.dtsi
 create mode 100644 arch/arm/dts/meson-gxm-wetek-core2.dts
 create mode 100644 configs/wetek-core2_defconfig
 create mode 100644 doc/board/amlogic/wetek-core2.rst

-- 
2.17.1



[PATCH 2/2] boards: amlogic: add Khadas VIM3L support

2019-12-11 Thread Christian Hewitt
Khadas VIM3L uses the same board layout as VIM3, but with an S905D3 chip
instead of A311D. Board config is derived from khadas-vim3_defconfig and
sei610_defconfig. README is based on README.khadas-vim3; the difference
is that VIM3L uses FIP files from the g12a folder in vendor sources not
the g12b folder.

Signed-off-by: Christian Hewitt 
---
 board/amlogic/w400/README.khadas-vim3l | 132 +
 configs/khadas-vim3l_defconfig |  62 
 2 files changed, 194 insertions(+)
 create mode 100644 board/amlogic/w400/README.khadas-vim3l
 create mode 100644 configs/khadas-vim3l_defconfig

diff --git a/board/amlogic/w400/README.khadas-vim3l 
b/board/amlogic/w400/README.khadas-vim3l
new file mode 100644
index 000..b53a67c
--- /dev/null
+++ b/board/amlogic/w400/README.khadas-vim3l
@@ -0,0 +1,132 @@
+U-Boot for Khadas VIM3L
+===
+
+Khadas VIM3 is a single board computer manufactured by Shenzhen Wesion
+Technology Co., Ltd. with the following specifications:
+
+ - Amlogic S905D3 Arm Cortex-A55 quad-core SoC
+ - 2GB LPDDR4 SDRAM
+ - Gigabit Ethernet
+ - HDMI 2.1 display
+ - 40-pin GPIO header
+ - 1 x USB 3.0 Host, 1 x USB 2.0 Host
+ - eMMC, microSD
+ - M.2
+ - Infrared receiver
+
+Schematics are available on the manufacturer website.
+
+Currently the U-Boot port supports the following devices:
+ - serial
+ - eMMC, microSD
+ - Ethernet
+ - I2C
+ - Regulators
+ - Reset controller
+ - Clock controller
+ - ADC
+
+u-boot compilation
+==
+
+ > export ARCH=arm
+ > export CROSS_COMPILE=aarch64-none-elf-
+ > make khadas-vim3l_defconfig
+ > make
+
+Image creation
+==
+
+Amlogic doesn't provide sources for the firmware and for tools needed
+to create the bootloader image, so it is necessary to obtain them from
+the git tree published by the board vendor:
+
+ > wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > wget 
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
+ > tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
+ > export 
PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
+
+ > DIR=vim3l-u-boot
+ > git clone --depth 1 \
+   https://github.com/khadas/u-boot.git -b khadas-vims-v2015.01 \
+   $DIR
+
+ > cd vim3l-u-boot
+ > make kvim3l_defconfig
+ > make
+ > export UBOOTDIR=$PWD
+
+ Go back to mainline U-Boot source tree then :
+ > mkdir fip
+
+ > cp $UBOOTDIR/build/scp_task/bl301.bin fip/
+ > cp $UBOOTDIR/build/board/khadas/kvim3l/firmware/acs.bin fip/
+ > cp $UBOOTDIR/fip/g12a/bl2.bin fip/
+ > cp $UBOOTDIR/fip/g12a/bl30.bin fip/
+ > cp $UBOOTDIR/fip/g12a/bl31.img fip/
+ > cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
+ > cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
+ > cp $UBOOTDIR/fip/g12a/piei.fw fip/
+ > cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
+ > cp u-boot.bin fip/bl33.bin
+
+ > sh fip/blx_fix.sh \
+   fip/bl30.bin \
+   fip/zero_tmp \
+   fip/bl30_zero.bin \
+   fip/bl301.bin \
+   fip/bl301_zero.bin \
+   fip/bl30_new.bin \
+   bl30
+
+ > sh fip/blx_fix.sh \
+   fip/bl2.bin \
+   fip/zero_tmp \
+   fip/bl2_zero.bin \
+   fip/acs.bin \
+   fip/bl21_zero.bin \
+   fip/bl2_new.bin \
+   bl2
+
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
+   --output fip/bl30_new.bin.g12a.enc \
+   --level v3
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input 
fip/bl30_new.bin.g12a.enc \
+   --output fip/bl30_new.bin.enc \
+   --level v3 --type bl30
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
+   --output fip/bl31.img.enc \
+   --level v3 --type bl31
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin 
--compress lz4 \
+   --output fip/bl33.bin.enc \
+   --level v3 --type bl33 --compress lz4
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
+   --output fip/bl2.n.bin.sig
+ > $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk \
+   --output fip/u-boot.bin \
+   --bl2 fip/bl2.n.bin.sig \
+   --bl30 fip/bl30_new.bin.e

[PATCH 1/2] ARM: dts: Import Khadas VIM3L DT from Linux 5.5-rc1

2019-12-11 Thread Christian Hewitt
Import the Khadas VIM3L device-tree from [1]

[1] e42617b825f8 ("Linux 5.5-rc1")

Signed-off-by: Christian Hewitt 
---
 arch/arm/dts/Makefile   |  1 +
 arch/arm/dts/meson-sm1-khadas-vim3l.dts | 95 +
 2 files changed, 96 insertions(+)
 create mode 100644 arch/arm/dts/meson-sm1-khadas-vim3l.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3dc9c4d..b6c9f82 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -152,6 +152,7 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-g12a-sei510.dtb \
meson-g12b-odroid-n2.dtb \
meson-g12b-a311d-khadas-vim3.dtb \
+   meson-sm1-khadas-vim3l.dtb \
meson-sm1-sei610.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
tegra20-medcom-wide.dtb \
diff --git a/arch/arm/dts/meson-sm1-khadas-vim3l.dts 
b/arch/arm/dts/meson-sm1-khadas-vim3l.dts
new file mode 100644
index 000..1001b37
--- /dev/null
+++ b/arch/arm/dts/meson-sm1-khadas-vim3l.dts
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ */
+
+/dts-v1/;
+
+#include "meson-sm1.dtsi"
+#include "meson-khadas-vim3.dtsi"
+
+/ {
+   compatible = "khadas,vim3l", "amlogic,sm1";
+   model = "Khadas VIM3L";
+
+   vddcpu: regulator-vddcpu {
+   /*
+* Silergy SY8030DEC Regulator.
+*/
+   compatible = "pwm-regulator";
+
+   regulator-name = "VDDCPU";
+   regulator-min-microvolt = <69>;
+   regulator-max-microvolt = <105>;
+
+   vin-supply = <_3v3>;
+
+   pwms = <_AO_cd 1 1250 0>;
+   pwm-dutycycle-range = <100 0>;
+
+   regulator-boot-on;
+   regulator-always-on;
+   };
+};
+
+ {
+   cpu-supply = <>;
+   operating-points-v2 = <_opp_table>;
+   clocks = < CLKID_CPU_CLK>;
+   clock-latency = <5>;
+};
+
+ {
+   cpu-supply = <>;
+   operating-points-v2 = <_opp_table>;
+   clocks = < CLKID_CPU1_CLK>;
+   clock-latency = <5>;
+};
+
+ {
+   cpu-supply = <>;
+   operating-points-v2 = <_opp_table>;
+   clocks = < CLKID_CPU2_CLK>;
+   clock-latency = <5>;
+};
+
+ {
+   cpu-supply = <>;
+   operating-points-v2 = <_opp_table>;
+   clocks = < CLKID_CPU3_CLK>;
+   clock-latency = <5>;
+};
+
+_AO_cd {
+   pinctrl-0 = <_ao_d_e_pins>;
+   pinctrl-names = "default";
+   clocks = <>;
+   clock-names = "clkin1";
+   status = "okay";
+};
+
+/*
+ * The VIM3 on-board  MCU can mux the PCIe/USB3.0 shared differential
+ * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between
+ * an USB3.0 Type A connector and a M.2 Key M slot. The PHY driving
+ * these differential lines is shared between the USB3.0 controller
+ * and the PCIe Controller, thus only a single controller can use it.
+ * If the MCU is configured to mux the PCIe/USB3.0 differential lines
+ * to the M.2 Key M slot, uncomment the following block to disable
+ * USB3.0 from the USB Complex and enable the PCIe controller.
+ * The End User is not expected to uncomment the following except for
+ * testing purposes, but instead rely on the firmware/bootloader to
+ * update these nodes accordingly if PCIe mode is selected by the MCU.
+ */
+
+/*
+ {
+   status = "okay";
+};
+
+ {
+   phys = <_phy0>, <_phy1>;
+   phy-names = "usb2-phy0", "usb2-phy1";
+};
+ */
-- 
2.7.4



[PATCH 0/2] amlogic: add Khadas VIM3L support

2019-12-11 Thread Christian Hewitt
Khadas VIM3L is a new revision of the VIM3 board that swaps the premium
A311D chip for Amlogic's mid-range S905D3 chip.

Christian Hewitt (2):
  ARM: dts: Import Khadas VIM3L DT from Linux 5.5-rc1
  boards: amlogic: add Khadas VIM3L support

 arch/arm/dts/Makefile   |   1 +
 arch/arm/dts/meson-sm1-khadas-vim3l.dts |  95 +++
 board/amlogic/w400/README.khadas-vim3l  | 132 
 configs/khadas-vim3l_defconfig  |  62 +++
 4 files changed, 290 insertions(+)
 create mode 100644 arch/arm/dts/meson-sm1-khadas-vim3l.dts
 create mode 100644 board/amlogic/w400/README.khadas-vim3l
 create mode 100644 configs/khadas-vim3l_defconfig

-- 
2.7.4