aboutsummaryrefslogtreecommitdiffstats
path: root/roms/u-boot/board/amlogic
diff options
context:
space:
mode:
Diffstat (limited to 'roms/u-boot/board/amlogic')
-rw-r--r--roms/u-boot/board/amlogic/beelink-s922x/MAINTAINERS9
-rw-r--r--roms/u-boot/board/amlogic/beelink-s922x/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/beelink-s922x/beelink-s922x.c52
-rw-r--r--roms/u-boot/board/amlogic/odroid-n2/MAINTAINERS9
-rw-r--r--roms/u-boot/board/amlogic/odroid-n2/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/odroid-n2/odroid-n2.c140
-rw-r--r--roms/u-boot/board/amlogic/p200/MAINTAINERS12
-rw-r--r--roms/u-boot/board/amlogic/p200/Makefile5
-rw-r--r--roms/u-boot/board/amlogic/p200/p200.c43
-rw-r--r--roms/u-boot/board/amlogic/p201/MAINTAINERS7
-rw-r--r--roms/u-boot/board/amlogic/p201/Makefile5
-rw-r--r--roms/u-boot/board/amlogic/p201/p201.c43
-rw-r--r--roms/u-boot/board/amlogic/p212/MAINTAINERS15
-rw-r--r--roms/u-boot/board/amlogic/p212/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/p212/p212.c46
-rw-r--r--roms/u-boot/board/amlogic/q200/MAINTAINERS12
-rw-r--r--roms/u-boot/board/amlogic/q200/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/q200/q200.c46
-rw-r--r--roms/u-boot/board/amlogic/s400/MAINTAINERS8
-rw-r--r--roms/u-boot/board/amlogic/s400/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/s400/s400.c22
-rw-r--r--roms/u-boot/board/amlogic/sei510/MAINTAINERS8
-rw-r--r--roms/u-boot/board/amlogic/sei510/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/sei510/sei510.c26
-rw-r--r--roms/u-boot/board/amlogic/sei610/MAINTAINERS8
-rw-r--r--roms/u-boot/board/amlogic/sei610/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/sei610/sei610.c26
-rw-r--r--roms/u-boot/board/amlogic/u200/MAINTAINERS7
-rw-r--r--roms/u-boot/board/amlogic/u200/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/u200/u200.c22
-rw-r--r--roms/u-boot/board/amlogic/vim3/MAINTAINERS9
-rw-r--r--roms/u-boot/board/amlogic/vim3/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/vim3/khadas-mcu.h81
-rw-r--r--roms/u-boot/board/amlogic/vim3/vim3.c175
-rw-r--r--roms/u-boot/board/amlogic/w400/MAINTAINERS6
-rw-r--r--roms/u-boot/board/amlogic/w400/Makefile6
-rw-r--r--roms/u-boot/board/amlogic/w400/w400.c20
37 files changed, 922 insertions, 0 deletions
diff --git a/roms/u-boot/board/amlogic/beelink-s922x/MAINTAINERS b/roms/u-boot/board/amlogic/beelink-s922x/MAINTAINERS
new file mode 100644
index 000000000..7f223df4a
--- /dev/null
+++ b/roms/u-boot/board/amlogic/beelink-s922x/MAINTAINERS
@@ -0,0 +1,9 @@
+BEELINK-S922X
+M: Christian Hewitt <christianshewitt@gmail.com>
+S: Maintained
+L: u-boot-amlogic@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/roms/u-boot/board/amlogic/beelink-s922x/Makefile b/roms/u-boot/board/amlogic/beelink-s922x/Makefile
new file mode 100644
index 000000000..27b1a7410
--- /dev/null
+++ b/roms/u-boot/board/amlogic/beelink-s922x/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2020 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := beelink-s922x.o
diff --git a/roms/u-boot/board/amlogic/beelink-s922x/beelink-s922x.c b/roms/u-boot/board/amlogic/beelink-s922x/beelink-s922x.c
new file mode 100644
index 000000000..bb7442626
--- /dev/null
+++ b/roms/u-boot/board/amlogic/beelink-s922x/beelink-s922x.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/boot.h>
+
+#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);
+
+ 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;
+}
diff --git a/roms/u-boot/board/amlogic/odroid-n2/MAINTAINERS b/roms/u-boot/board/amlogic/odroid-n2/MAINTAINERS
new file mode 100644
index 000000000..77f774634
--- /dev/null
+++ b/roms/u-boot/board/amlogic/odroid-n2/MAINTAINERS
@@ -0,0 +1,9 @@
+ODROID-N2
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/odroid-n2/
+F: configs/odroid-n2_defconfig
+F: configs/odroid-c4_defconfig
+F: doc/board/amlogic/odroid-n2.rst
+F: doc/board/amlogic/odroid-c4.rst
diff --git a/roms/u-boot/board/amlogic/odroid-n2/Makefile b/roms/u-boot/board/amlogic/odroid-n2/Makefile
new file mode 100644
index 000000000..68e4e2a82
--- /dev/null
+++ b/roms/u-boot/board/amlogic/odroid-n2/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2020 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := odroid-n2.o
diff --git a/roms/u-boot/board/amlogic/odroid-n2/odroid-n2.c b/roms/u-boot/board/amlogic/odroid-n2/odroid-n2.c
new file mode 100644
index 000000000..88a60f34f
--- /dev/null
+++ b/roms/u-boot/board/amlogic/odroid-n2/odroid-n2.c
@@ -0,0 +1,140 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <adc.h>
+#include <env.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/boot.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/boot.h>
+
+#define EFUSE_MAC_OFFSET 20
+#define EFUSE_MAC_SIZE 12
+#define MAC_ADDR_LEN 6
+
+#define ODROID_HW_VS_ADC_CHANNEL 1
+
+#define MESON_SOC_ID_G12B 0x29
+#define MESON_SOC_ID_SM1 0x2b
+
+int mmc_get_env_dev(void)
+{
+ if (meson_get_boot_device() == BOOT_DEVICE_EMMC)
+ return 1;
+ return 0;
+}
+
+/* Variant detection is based on the ADC RAW values for the channel #1 */
+static struct meson_odroid_boards {
+ unsigned int soc_id;
+ unsigned int adc_min;
+ unsigned int adc_max;
+ char *variant;
+} boards[] = {
+ /* OdroidN2 rev 2018,7,23 */
+ { MESON_SOC_ID_G12B, 80 * 4, 90 * 4, "n2" },
+ /* OdroidN2 rev 2018,12,6 */
+ { MESON_SOC_ID_G12B, 160 * 4, 170 * 4, "n2" },
+ /* OdroidN2 rev 2019,1,17 */
+ { MESON_SOC_ID_G12B, 245 * 4, 255 * 4, "n2" },
+ /* 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" },
+ /* OdroidC4 rev 2020,01,29 */
+ { MESON_SOC_ID_SM1, 80 * 4, 100 * 4, "c4" },
+ /* OdroidHC4 rev 2019,12,10 */
+ { MESON_SOC_ID_SM1, 300 * 4, 320 * 4, "hc4" },
+ /* OdroidC4 rev 2019,11,29 */
+ { MESON_SOC_ID_SM1, 335 * 4, 345 * 4, "c4" },
+ /* OdroidHC4 rev 2020,8,7 */
+ { MESON_SOC_ID_SM1, 590 * 4, 610 * 4, "hc4" },
+};
+
+static void odroid_set_fdtfile(char *soc, char *variant)
+{
+ char s[128];
+
+ snprintf(s, sizeof(s), "amlogic/meson-%s-odroid-%s.dtb", soc, variant);
+ env_set("fdtfile", s);
+}
+
+static int odroid_detect_variant(void)
+{
+ char *variant = "", *soc = "";
+ unsigned int adcval = 0;
+ int ret, i, soc_id = 0;
+
+ if (of_machine_is_compatible("amlogic,sm1")) {
+ soc_id = MESON_SOC_ID_SM1;
+ soc = "sm1";
+ } else if (of_machine_is_compatible("amlogic,g12b")) {
+ soc_id = MESON_SOC_ID_G12B;
+ soc = "g12b";
+ } else {
+ return -1;
+ }
+
+ ret = adc_channel_single_shot("adc@9000", ODROID_HW_VS_ADC_CHANNEL,
+ &adcval);
+ if (ret)
+ return ret;
+
+ for (i = 0 ; i < ARRAY_SIZE(boards) ; ++i) {
+ if (soc_id == boards[i].soc_id &&
+ adcval >= boards[i].adc_min &&
+ adcval < boards[i].adc_max) {
+ variant = boards[i].variant;
+ break;
+ }
+ }
+
+ printf("Board variant: %s\n", variant);
+ env_set("variant", variant);
+
+ odroid_set_fdtfile(soc, variant);
+
+ return 0;
+}
+
+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);
+
+ 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();
+ }
+
+ odroid_detect_variant();
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/p200/MAINTAINERS b/roms/u-boot/board/amlogic/p200/MAINTAINERS
new file mode 100644
index 000000000..1df9b8b24
--- /dev/null
+++ b/roms/u-boot/board/amlogic/p200/MAINTAINERS
@@ -0,0 +1,12 @@
+P200
+M: Beniamino Galvani <b.galvani@gmail.com>
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/p200/
+F: configs/nanopi-k2_defconfig
+F: configs/odroid-c2_defconfig
+F: configs/p200_defconfig
+F: doc/board/amlogic/p200.rst
+F: doc/board/amlogic/nanopi-k2.rst
+F: doc/board/amlogic/odroid-c2.rst
diff --git a/roms/u-boot/board/amlogic/p200/Makefile b/roms/u-boot/board/amlogic/p200/Makefile
new file mode 100644
index 000000000..f82a7ea9c
--- /dev/null
+++ b/roms/u-boot/board/amlogic/p200/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+
+obj-y := p200.o
diff --git a/roms/u-boot/board/amlogic/p200/p200.c b/roms/u-boot/board/amlogic/p200/p200.c
new file mode 100644
index 000000000..7c432f9d2
--- /dev/null
+++ b/roms/u-boot/board/amlogic/p200/p200.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/gx.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+#define EFUSE_SN_OFFSET 20
+#define EFUSE_SN_SIZE 16
+#define EFUSE_MAC_OFFSET 52
+#define EFUSE_MAC_SIZE 6
+
+int misc_init_r(void)
+{
+ u8 mac_addr[EFUSE_MAC_SIZE];
+ char serial[EFUSE_SN_SIZE];
+ 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))
+ eth_env_set_enetaddr("ethaddr", mac_addr);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/p201/MAINTAINERS b/roms/u-boot/board/amlogic/p201/MAINTAINERS
new file mode 100644
index 000000000..1501b6280
--- /dev/null
+++ b/roms/u-boot/board/amlogic/p201/MAINTAINERS
@@ -0,0 +1,7 @@
+P201
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/p201/
+F: configs/p201_defconfig
+F: doc/board/amlogic/p201.rst
diff --git a/roms/u-boot/board/amlogic/p201/Makefile b/roms/u-boot/board/amlogic/p201/Makefile
new file mode 100644
index 000000000..11de5396a
--- /dev/null
+++ b/roms/u-boot/board/amlogic/p201/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+
+obj-y := p201.o
diff --git a/roms/u-boot/board/amlogic/p201/p201.c b/roms/u-boot/board/amlogic/p201/p201.c
new file mode 100644
index 000000000..7c432f9d2
--- /dev/null
+++ b/roms/u-boot/board/amlogic/p201/p201.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/gx.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+#define EFUSE_SN_OFFSET 20
+#define EFUSE_SN_SIZE 16
+#define EFUSE_MAC_OFFSET 52
+#define EFUSE_MAC_SIZE 6
+
+int misc_init_r(void)
+{
+ u8 mac_addr[EFUSE_MAC_SIZE];
+ char serial[EFUSE_SN_SIZE];
+ 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))
+ eth_env_set_enetaddr("ethaddr", mac_addr);
+ }
+
+ 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);
+ }
+
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/p212/MAINTAINERS b/roms/u-boot/board/amlogic/p212/MAINTAINERS
new file mode 100644
index 000000000..3d622af29
--- /dev/null
+++ b/roms/u-boot/board/amlogic/p212/MAINTAINERS
@@ -0,0 +1,15 @@
+P212
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/p212/
+F: include/configs/p212.h
+F: configs/khadas-vim_defconfig
+F: configs/libretech-ac_defconfig
+F: configs/libretech-cc_defconfig
+F: configs/libretech-cc_v2_defconfig
+F: configs/p212_defconfig
+F: doc/board/amlogic/p212.rst
+F: doc/board/amlogic/libretech-ac.rst
+F: doc/board/amlogic/libretech-cc.rst
+F: doc/board/amlogic/khadas-vim.rst
diff --git a/roms/u-boot/board/amlogic/p212/Makefile b/roms/u-boot/board/amlogic/p212/Makefile
new file mode 100644
index 000000000..d98cc11a4
--- /dev/null
+++ b/roms/u-boot/board/amlogic/p212/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := p212.o
diff --git a/roms/u-boot/board/amlogic/p212/p212.c b/roms/u-boot/board/amlogic/p212/p212.c
new file mode 100644
index 000000000..fcef90bce
--- /dev/null
+++ b/roms/u-boot/board/amlogic/p212/p212.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/gx.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+#define EFUSE_SN_OFFSET 20
+#define EFUSE_SN_SIZE 16
+#define EFUSE_MAC_OFFSET 52
+#define EFUSE_MAC_SIZE 6
+
+int misc_init_r(void)
+{
+ u8 mac_addr[EFUSE_MAC_SIZE];
+ char serial[EFUSE_SN_SIZE];
+ 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))
+ 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);
+ }
+
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/q200/MAINTAINERS b/roms/u-boot/board/amlogic/q200/MAINTAINERS
new file mode 100644
index 000000000..ba7c12b2c
--- /dev/null
+++ b/roms/u-boot/board/amlogic/q200/MAINTAINERS
@@ -0,0 +1,12 @@
+Q200
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/q200/
+F: include/configs/q200.h
+F: configs/khadas-vim2_defconfig
+F: configs/libretech-s905d-pc_defconfig
+F: configs/libretech-s912-pc_defconfig
+F: configs/wetek-core2_defconfig
+F: doc/board/amlogic/khadas-vim2.rst
+F: doc/board/amlogic/wetek-core2.rst
diff --git a/roms/u-boot/board/amlogic/q200/Makefile b/roms/u-boot/board/amlogic/q200/Makefile
new file mode 100644
index 000000000..fd78fd068
--- /dev/null
+++ b/roms/u-boot/board/amlogic/q200/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := q200.o
diff --git a/roms/u-boot/board/amlogic/q200/q200.c b/roms/u-boot/board/amlogic/q200/q200.c
new file mode 100644
index 000000000..3aa6d8f20
--- /dev/null
+++ b/roms/u-boot/board/amlogic/q200/q200.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/gx.h>
+#include <asm/arch/mem.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+
+#define EFUSE_SN_OFFSET 20
+#define EFUSE_SN_SIZE 16
+#define EFUSE_MAC_OFFSET 52
+#define EFUSE_MAC_SIZE 6
+
+int misc_init_r(void)
+{
+ u8 mac_addr[EFUSE_MAC_SIZE];
+ char serial[EFUSE_SN_SIZE];
+ 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))
+ 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);
+ }
+
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/s400/MAINTAINERS b/roms/u-boot/board/amlogic/s400/MAINTAINERS
new file mode 100644
index 000000000..fb46b1bbb
--- /dev/null
+++ b/roms/u-boot/board/amlogic/s400/MAINTAINERS
@@ -0,0 +1,8 @@
+S400
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/s400/
+F: include/configs/s400.h
+F: configs/s400_defconfig
+F: doc/board/amlogic/s400.rst
diff --git a/roms/u-boot/board/amlogic/s400/Makefile b/roms/u-boot/board/amlogic/s400/Makefile
new file mode 100644
index 000000000..bf03862b9
--- /dev/null
+++ b/roms/u-boot/board/amlogic/s400/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := s400.o
diff --git a/roms/u-boot/board/amlogic/s400/s400.c b/roms/u-boot/board/amlogic/s400/s400.c
new file mode 100644
index 000000000..06a9044fd
--- /dev/null
+++ b/roms/u-boot/board/amlogic/s400/s400.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/axg.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+int misc_init_r(void)
+{
+ meson_generate_serial_ethaddr();
+
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/sei510/MAINTAINERS b/roms/u-boot/board/amlogic/sei510/MAINTAINERS
new file mode 100644
index 000000000..c01c1d60d
--- /dev/null
+++ b/roms/u-boot/board/amlogic/sei510/MAINTAINERS
@@ -0,0 +1,8 @@
+SEI510
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/sei510/
+F: configs/sei510_defconfig
+F: include/configs/sei510.h
+F: doc/board/amlogic/sei510.rst
diff --git a/roms/u-boot/board/amlogic/sei510/Makefile b/roms/u-boot/board/amlogic/sei510/Makefile
new file mode 100644
index 000000000..03399a384
--- /dev/null
+++ b/roms/u-boot/board/amlogic/sei510/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := sei510.o
diff --git a/roms/u-boot/board/amlogic/sei510/sei510.c b/roms/u-boot/board/amlogic/sei510/sei510.c
new file mode 100644
index 000000000..bb188c21f
--- /dev/null
+++ b/roms/u-boot/board/amlogic/sei510/sei510.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <env_internal.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/axg.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+int misc_init_r(void)
+{
+ meson_generate_serial_ethaddr();
+
+ env_set("serial#", "AMLG12ASEI510");
+
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/sei610/MAINTAINERS b/roms/u-boot/board/amlogic/sei610/MAINTAINERS
new file mode 100644
index 000000000..092178b2c
--- /dev/null
+++ b/roms/u-boot/board/amlogic/sei610/MAINTAINERS
@@ -0,0 +1,8 @@
+SEI610
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/sei610/
+F: configs/sei610_defconfig
+F: include/configs/sei610.h
+F: doc/board/amlogic/sei610.rst
diff --git a/roms/u-boot/board/amlogic/sei610/Makefile b/roms/u-boot/board/amlogic/sei610/Makefile
new file mode 100644
index 000000000..428792afe
--- /dev/null
+++ b/roms/u-boot/board/amlogic/sei610/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := sei610.o
diff --git a/roms/u-boot/board/amlogic/sei610/sei610.c b/roms/u-boot/board/amlogic/sei610/sei610.c
new file mode 100644
index 000000000..6490bac9e
--- /dev/null
+++ b/roms/u-boot/board/amlogic/sei610/sei610.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <env_internal.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/axg.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+int misc_init_r(void)
+{
+ meson_generate_serial_ethaddr();
+
+ env_set("serial#", "AMLG12ASEI610");
+
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/u200/MAINTAINERS b/roms/u-boot/board/amlogic/u200/MAINTAINERS
new file mode 100644
index 000000000..8c23f9a7d
--- /dev/null
+++ b/roms/u-boot/board/amlogic/u200/MAINTAINERS
@@ -0,0 +1,7 @@
+U200
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/u200/
+F: configs/u200_defconfig
+F: doc/board/amlogic/u200.rst
diff --git a/roms/u-boot/board/amlogic/u200/Makefile b/roms/u-boot/board/amlogic/u200/Makefile
new file mode 100644
index 000000000..485791bbb
--- /dev/null
+++ b/roms/u-boot/board/amlogic/u200/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2016 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := u200.o
diff --git a/roms/u-boot/board/amlogic/u200/u200.c b/roms/u-boot/board/amlogic/u200/u200.c
new file mode 100644
index 000000000..06a9044fd
--- /dev/null
+++ b/roms/u-boot/board/amlogic/u200/u200.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/axg.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+int misc_init_r(void)
+{
+ meson_generate_serial_ethaddr();
+
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/vim3/MAINTAINERS b/roms/u-boot/board/amlogic/vim3/MAINTAINERS
new file mode 100644
index 000000000..92b426f66
--- /dev/null
+++ b/roms/u-boot/board/amlogic/vim3/MAINTAINERS
@@ -0,0 +1,9 @@
+VIM3
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/vim3/
+F: configs/khadas-vim3_defconfig
+F: configs/khadas-vim3l_defconfig
+F: doc/board/amlogic/khadas-vim3.rst
+F: doc/board/amlogic/khadas-vim3l.rst
diff --git a/roms/u-boot/board/amlogic/vim3/Makefile b/roms/u-boot/board/amlogic/vim3/Makefile
new file mode 100644
index 000000000..c51507730
--- /dev/null
+++ b/roms/u-boot/board/amlogic/vim3/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2020 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := vim3.o
diff --git a/roms/u-boot/board/amlogic/vim3/khadas-mcu.h b/roms/u-boot/board/amlogic/vim3/khadas-mcu.h
new file mode 100644
index 000000000..de3758caf
--- /dev/null
+++ b/roms/u-boot/board/amlogic/vim3/khadas-mcu.h
@@ -0,0 +1,81 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Khadas System control Microcontroller Register map
+ *
+ * Copyright (C) 2020 BayLibre SAS
+ *
+ * Author(s): Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#ifndef MFD_KHADAS_MCU_H
+#define MFD_KHADAS_MCU_H
+
+#define KHADAS_MCU_PASSWD_VEN_0_REG 0x00 /* RO */
+#define KHADAS_MCU_PASSWD_VEN_1_REG 0x01 /* RO */
+#define KHADAS_MCU_PASSWD_VEN_2_REG 0x02 /* RO */
+#define KHADAS_MCU_PASSWD_VEN_3_REG 0x03 /* RO */
+#define KHADAS_MCU_PASSWD_VEN_4_REG 0x04 /* RO */
+#define KHADAS_MCU_PASSWD_VEN_5_REG 0x05 /* RO */
+#define KHADAS_MCU_MAC_0_REG 0x06 /* RO */
+#define KHADAS_MCU_MAC_1_REG 0x07 /* RO */
+#define KHADAS_MCU_MAC_2_REG 0x08 /* RO */
+#define KHADAS_MCU_MAC_3_REG 0x09 /* RO */
+#define KHADAS_MCU_MAC_4_REG 0x0a /* RO */
+#define KHADAS_MCU_MAC_5_REG 0x0b /* RO */
+#define KHADAS_MCU_USID_0_REG 0x0c /* RO */
+#define KHADAS_MCU_USID_1_REG 0x0d /* RO */
+#define KHADAS_MCU_USID_2_REG 0x0e /* RO */
+#define KHADAS_MCU_USID_3_REG 0x0f /* RO */
+#define KHADAS_MCU_USID_4_REG 0x10 /* RO */
+#define KHADAS_MCU_USID_5_REG 0x11 /* RO */
+#define KHADAS_MCU_VERSION_0_REG 0x12 /* RO */
+#define KHADAS_MCU_VERSION_1_REG 0x13 /* RO */
+#define KHADAS_MCU_DEVICE_NO_0_REG 0x14 /* RO */
+#define KHADAS_MCU_DEVICE_NO_1_REG 0x15 /* RO */
+#define KHADAS_MCU_FACTORY_TEST_REG 0x16 /* R */
+#define KHADAS_MCU_BOOT_MODE_REG 0x20 /* RW */
+#define KHADAS_MCU_BOOT_EN_WOL_REG 0x21 /* RW */
+#define KHADAS_MCU_BOOT_EN_RTC_REG 0x22 /* RW */
+#define KHADAS_MCU_BOOT_EN_EXP_REG 0x23 /* RW */
+#define KHADAS_MCU_BOOT_EN_IR_REG 0x24 /* RW */
+#define KHADAS_MCU_BOOT_EN_DCIN_REG 0x25 /* RW */
+#define KHADAS_MCU_BOOT_EN_KEY_REG 0x26 /* RW */
+#define KHADAS_MCU_KEY_MODE_REG 0x27 /* RW */
+#define KHADAS_MCU_LED_MODE_ON_REG 0x28 /* RW */
+#define KHADAS_MCU_LED_MODE_OFF_REG 0x29 /* RW */
+#define KHADAS_MCU_SHUTDOWN_NORMAL_REG 0x2c /* RW */
+#define KHADAS_MCU_MAC_SWITCH_REG 0x2d /* RW */
+#define KHADAS_MCU_MCU_SLEEP_MODE_REG 0x2e /* RW */
+#define KHADAS_MCU_IR_CODE1_0_REG 0x2f /* RW */
+#define KHADAS_MCU_IR_CODE1_1_REG 0x30 /* RW */
+#define KHADAS_MCU_IR_CODE1_2_REG 0x31 /* RW */
+#define KHADAS_MCU_IR_CODE1_3_REG 0x32 /* RW */
+#define KHADAS_MCU_USB_PCIE_SWITCH_REG 0x33 /* RW */
+#define KHADAS_MCU_IR_CODE2_0_REG 0x34 /* RW */
+#define KHADAS_MCU_IR_CODE2_1_REG 0x35 /* RW */
+#define KHADAS_MCU_IR_CODE2_2_REG 0x36 /* RW */
+#define KHADAS_MCU_IR_CODE2_3_REG 0x37 /* RW */
+#define KHADAS_MCU_PASSWD_USER_0_REG 0x40 /* RW */
+#define KHADAS_MCU_PASSWD_USER_1_REG 0x41 /* RW */
+#define KHADAS_MCU_PASSWD_USER_2_REG 0x42 /* RW */
+#define KHADAS_MCU_PASSWD_USER_3_REG 0x43 /* RW */
+#define KHADAS_MCU_PASSWD_USER_4_REG 0x44 /* RW */
+#define KHADAS_MCU_PASSWD_USER_5_REG 0x45 /* RW */
+#define KHADAS_MCU_USER_DATA_0_REG 0x46 /* RW 56 bytes */
+#define KHADAS_MCU_PWR_OFF_CMD_REG 0x80 /* WO */
+#define KHADAS_MCU_PASSWD_START_REG 0x81 /* WO */
+#define KHADAS_MCU_CHECK_VEN_PASSWD_REG 0x82 /* WO */
+#define KHADAS_MCU_CHECK_USER_PASSWD_REG 0x83 /* WO */
+#define KHADAS_MCU_SHUTDOWN_NORMAL_STATUS_REG 0x86 /* RO */
+#define KHADAS_MCU_WOL_INIT_START_REG 0x87 /* WO */
+#define KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG 0x88 /* WO */
+
+enum {
+ KHADAS_BOARD_VIM1 = 0x1,
+ KHADAS_BOARD_VIM2,
+ KHADAS_BOARD_VIM3,
+ KHADAS_BOARD_EDGE = 0x11,
+ KHADAS_BOARD_EDGE_V,
+};
+
+#endif /* MFD_KHADAS_MCU_H */
diff --git a/roms/u-boot/board/amlogic/vim3/vim3.c b/roms/u-boot/board/amlogic/vim3/vim3.c
new file mode 100644
index 000000000..6cd5f2e11
--- /dev/null
+++ b/roms/u-boot/board/amlogic/vim3/vim3.c
@@ -0,0 +1,175 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env_internal.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/boot.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/sm.h>
+#include <asm/global_data.h>
+#include <i2c.h>
+#include "khadas-mcu.h"
+
+int mmc_get_env_dev(void)
+{
+ if (meson_get_boot_device() == BOOT_DEVICE_EMMC)
+ return 2;
+ return 1;
+}
+
+/*
+ * 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.
+ */
+int meson_ft_board_setup(void *blob, struct bd_info *bd)
+{
+ struct udevice *bus, *dev;
+ int node, i2c_node, ret;
+ unsigned int i2c_addr;
+ u32 *val;
+
+ /* Find I2C device */
+ node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "khadas,mcu");
+ if (node < 0) {
+ printf("vim3: cannot find khadas,mcu node\n");
+ return 0;
+ }
+
+ /* Get addr */
+ val = (u32 *)fdt_getprop(gd->fdt_blob, node, "reg", NULL);
+ if (!val) {
+ printf("vim3: cannot find khadas,mcu node i2c addr\n");
+ return 0;
+ }
+ i2c_addr = fdt32_to_cpu(*val);
+
+ /* Get i2c device */
+ i2c_node = fdt_parent_offset(gd->fdt_blob, node);
+ if (node < 0) {
+ printf("vim3: cannot find khadas,mcu i2c node\n");
+ return 0;
+ }
+
+ ret = uclass_get_device_by_of_offset(UCLASS_I2C, i2c_node, &bus);
+ if (ret < 0) {
+ printf("vim3: cannot find i2c bus (%d)\n", ret);
+ return 0;
+ }
+
+ ret = i2c_get_chip(bus, i2c_addr, 1, &dev);
+ if (ret < 0) {
+ printf("vim3: cannot find i2c chip (%d)\n", ret);
+ return 0;
+ }
+
+ /* Read USB_PCIE_SWITCH_REG */
+ ret = dm_i2c_reg_read(dev, KHADAS_MCU_USB_PCIE_SWITCH_REG);
+ if (ret < 0) {
+ printf("vim3: failed to read i2c reg (%d)\n", ret);
+ return 0;
+ }
+ debug("MCU_USB_PCIE_SWITCH_REG: %d\n", ret);
+
+ /*
+ * If in PCIe mode, alter DT
+ * 0:Enable USB3.0,Disable PCIE, 1:Disable USB3.0, Enable PCIE
+ */
+ if (ret > 0) {
+ static char data[32] __aligned(4);
+ const void *ptmp;
+ int len;
+
+ /* Find USB node */
+ node = fdt_node_offset_by_compatible(blob, -1, "amlogic,meson-g12a-usb-ctrl");
+ if (node < 0) {
+ printf("vim3: cannot find amlogic,meson-g12a-usb-ctrl node\n");
+ return 0;
+ }
+
+ /* Update PHY names (mandatory to disable USB3.0) */
+ len = strlcpy(data, "usb2-phy0", 32) + 1;
+ len += strlcpy(&data[len], "usb2-phy1", 32 - len) + 1;
+ ret = fdt_setprop(blob, node, "phy-names", data, len);
+ if (ret < 0) {
+ printf("vim3: failed to update usb phy names property (%d)\n", ret);
+ return 0;
+ }
+
+ /* Update PHY list, by keeping the 2 first entries (optional) */
+ ptmp = fdt_getprop(blob, node, "phys", &len);
+ if (ptmp) {
+ memcpy(data, ptmp, min_t(unsigned int, 2 * sizeof(u32), len));
+
+ ret = fdt_setprop(blob, node, "phys", data,
+ min_t(unsigned int, 2 * sizeof(u32), len));
+ if (ret < 0)
+ printf("vim3: failed to update usb phys property (%d)\n", ret);
+ } else
+ printf("vim3: cannot find usb node phys property\n");
+
+ /* Find PCIe node */
+ node = fdt_node_offset_by_compatible(blob, -1, "amlogic,g12a-pcie");
+ if (node < 0) {
+ printf("vim3: cannot find amlogic,g12a-pcie node\n");
+ return 0;
+ }
+
+ /* Enable PCIe */
+ len = strlcpy(data, "okay", 32);
+ ret = fdt_setprop(blob, node, "status", data, len);
+ if (ret < 0) {
+ printf("vim3: failed to enable pcie node (%d)\n", ret);
+ return 0;
+ }
+
+ printf("vim3: successfully enabled PCIe\n");
+ }
+
+ return 0;
+}
+
+#define EFUSE_MAC_OFFSET 0
+#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 (!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();
+
+ eth_env_get_enetaddr("ethaddr", mac_addr);
+ }
+
+ return 0;
+}
diff --git a/roms/u-boot/board/amlogic/w400/MAINTAINERS b/roms/u-boot/board/amlogic/w400/MAINTAINERS
new file mode 100644
index 000000000..991590d9f
--- /dev/null
+++ b/roms/u-boot/board/amlogic/w400/MAINTAINERS
@@ -0,0 +1,6 @@
+W400
+M: Neil Armstrong <narmstrong@baylibre.com>
+S: Maintained
+L: u-boot-amlogic@groups.io
+F: board/amlogic/w400/
+F: doc/board/amlogic/w400.rst
diff --git a/roms/u-boot/board/amlogic/w400/Makefile b/roms/u-boot/board/amlogic/w400/Makefile
new file mode 100644
index 000000000..fac4a73af
--- /dev/null
+++ b/roms/u-boot/board/amlogic/w400/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2019 BayLibre, SAS
+# Author: Neil Armstrong <narmstrong@baylibre.com>
+
+obj-y := w400.o
diff --git a/roms/u-boot/board/amlogic/w400/w400.c b/roms/u-boot/board/amlogic/w400/w400.c
new file mode 100644
index 000000000..419919849
--- /dev/null
+++ b/roms/u-boot/board/amlogic/w400/w400.c
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env_internal.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/eth.h>
+
+int misc_init_r(void)
+{
+ meson_generate_serial_ethaddr();
+
+ return 0;
+}