ODROID N2+ fixes (#929)

* Make sure to set board_rev for N2+ correctly

For some reason the code to set the environment did not make it into the
ODROID N2 board code. Fix the patch to correctly set board_rev for N2(+).
Also remove the w400 patch as it is no longer required.

* Use latest ODROID-N2+ patches

Use the queued patches (and fixes) for upstream ODROID-N2+ support.
This uses the clock settings from meson-g12b-a311d.dtsi running the
CPUs at the following clocks:
- 4xA73@2.2GHz
- 2xA53@1.8GHz
This commit is contained in:
Stefan Agner 2020-10-24 18:45:41 +02:00 committed by GitHub
parent 5f8aeb1c6d
commit e43747c2e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 161 additions and 152 deletions

View File

@ -1,30 +1,32 @@
From d35db3d5f943fea569dde8e83f15565254643385 Mon Sep 17 00:00:00 2001
Message-Id: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
From 734f52f38625ce29c964517255538b3b0b546e8d Mon Sep 17 00:00:00 2001
Message-Id: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Sun, 19 Jul 2020 14:10:32 +0000
Subject: [PATCH 1/4] arm64: dts: meson: convert ODROID-N2 to dtsi
Date: Tue, 15 Sep 2020 17:24:30 +0200
Subject: [PATCH 1/7] arm64: dts: meson: convert ODROID-N2 to dtsi
Convert the current ODROID-N2 dts into a common dtsi in preparation
for adding ODROID-N2+ support.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
[rebased ontop of sound patches]
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20200915152432.30616-2-narmstrong@baylibre.com
---
.../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 619 +----------------
.../dts/amlogic/meson-g12b-odroid-n2.dtsi | 626 ++++++++++++++++++
2 files changed, 627 insertions(+), 618 deletions(-)
.../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 618 +----------------
.../dts/amlogic/meson-g12b-odroid-n2.dtsi | 625 ++++++++++++++++++
2 files changed, 626 insertions(+), 617 deletions(-)
create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 34fffa6d859d..5fd51a87ae9b 100644
index 34fffa6d859d..a198a91259ec 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -6,626 +6,9 @@
@@ -7,625 +7,9 @@
/dts-v1/;
-#include "meson-g12b-s922x.dtsi"
#include "meson-g12b-s922x.dtsi"
-#include <dt-bindings/input/input.h>
-#include <dt-bindings/gpio/meson-g12a-gpio.h>
-#include <dt-bindings/sound/meson-g12a-toacodec.h>
@ -650,17 +652,16 @@ index 34fffa6d859d..5fd51a87ae9b 100644
};
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
new file mode 100644
index 000000000000..e5bc132ce7d5
index 000000000000..6982632ae646
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -0,0 +1,626 @@
@@ -0,0 +1,625 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
+ */
+
+#include "meson-g12b-s922x.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+#include <dt-bindings/sound/meson-g12a-toacodec.h>
@ -1065,7 +1066,7 @@ index 000000000000..e5bc132ce7d5
+
+&ext_mdio {
+ external_phy: ethernet-phy@0 {
+ /* Realtek RTL8211F (0x001cc916) */
+ /* Realtek RTL8211F (0x001cc916) */
+ reg = <0>;
+ max-speed = <1000>;
+

View File

@ -1,15 +1,20 @@
From 4b9d9159ed5a79ceac5b831012b3cb44cce2516c Mon Sep 17 00:00:00 2001
Message-Id: <4b9d9159ed5a79ceac5b831012b3cb44cce2516c.1602360581.git.stefan@agner.ch>
In-Reply-To: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
References: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
From 75f1e8330dac46a0bef8a360be0ae4566d9a470c Mon Sep 17 00:00:00 2001
Message-Id: <75f1e8330dac46a0bef8a360be0ae4566d9a470c.1603528796.git.stefan@agner.ch>
In-Reply-To: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
References: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Sun, 19 Jul 2020 14:10:33 +0000
Subject: [PATCH 2/4] dt-bindings: arm: amlogic: add support for the ODROID-N2+
Date: Tue, 15 Sep 2020 17:24:31 +0200
Subject: [PATCH 2/7] dt-bindings: arm: amlogic: add support for the ODROID-N2+
HardKernel ODROID-N2+ uses a revised Amlogic S922X v2 chip that supports
higher cpu clock speeds than the original ODROID-N2.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20200915152432.30616-3-narmstrong@baylibre.com
---
Documentation/devicetree/bindings/arm/amlogic.yaml | 1 +
1 file changed, 1 insertion(+)

View File

@ -1,24 +1,27 @@
From 81b5af6c3ce3e0f312be0897bec0b3c942e2ce97 Mon Sep 17 00:00:00 2001
Message-Id: <81b5af6c3ce3e0f312be0897bec0b3c942e2ce97.1602360581.git.stefan@agner.ch>
In-Reply-To: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
References: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
From c714cb26fcb59f5201f7aac68dfd9883319881b2 Mon Sep 17 00:00:00 2001
Message-Id: <c714cb26fcb59f5201f7aac68dfd9883319881b2.1603528796.git.stefan@agner.ch>
In-Reply-To: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
References: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Sun, 19 Jul 2020 14:10:34 +0000
Subject: [PATCH 3/4] arm64: dts: meson: add support for the ODROID-N2+
Date: Tue, 15 Sep 2020 17:24:32 +0200
Subject: [PATCH 3/7] arm64: dts: meson: add support for the ODROID-N2+
HardKernel ODROID-N2+ uses an Amlogic S922X rev. C chip capable of higher
clock speeds than the original ODROID-N2. Hardkernel supports the big cpu
cluster at 2.4GHz and the little cpu cluster at 2.0GHz. Opp points and
regulator changess are from the HardKernel Linux kernel sources.
clock speeds than the original ODROID-N2.
The rev. C support a slighly higher VDDCPU_A & VDDCPU_B voltages and supports
the same OPPs as the Amlogic A311D SoC from the same G12B family.
Suggested-by: Dongjin Kim <tobetter@hardkernel.com>
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
[Integrated Neil Armstrong's feedback from mailing list]
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20200915152432.30616-4-narmstrong@baylibre.com
---
arch/arm64/boot/dts/amlogic/Makefile | 1 +
.../dts/amlogic/meson-g12b-odroid-n2-plus.dts | 53 +++++++++++++++++++
2 files changed, 54 insertions(+)
.../dts/amlogic/meson-g12b-odroid-n2-plus.dts | 31 +++++++++++++++++++
2 files changed, 32 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
@ -35,10 +38,10 @@ index 4e2239ffcaa5..b0b3d6791499 100644
dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
new file mode 100644
index 000000000000..4ebb448d233f
index 000000000000..5de2815ba99d
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
@@ -0,0 +1,53 @@
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
@ -47,18 +50,20 @@ index 000000000000..4ebb448d233f
+
+/dts-v1/;
+
+/* The Amlogic S922X Rev. C supports the same OPPs as the A311D variant */
+#include "meson-g12b-a311d.dtsi"
+#include "meson-g12b-odroid-n2.dtsi"
+
+/ {
+ compatible = "hardkernel,odroid-n2-plus", "amlogic,s922x", "amlogic,g12b";
+ model = "Hardkernel ODROID-N2+";
+ model = "Hardkernel ODROID-N2Plus";
+};
+
+&vddcpu_a {
+ regulator-min-microvolt = <680000>;
+ regulator-max-microvolt = <1040000>;
+
+ pwms = <&pwm_ab 0 1500 0>;
+ pwms = <&pwm_AO_cd 1 1500 0>;
+};
+
+&vddcpu_b {
@ -68,30 +73,6 @@ index 000000000000..4ebb448d233f
+ pwms = <&pwm_AO_cd 1 1500 0>;
+};
+
+&cpu_opp_table_0 {
+ opp-1908000000 {
+ opp-hz = /bits/ 64 <1908000000>;
+ opp-microvolt = <1030000>;
+ };
+
+ opp-2016000000 {
+ opp-hz = /bits/ 64 <2016000000>;
+ opp-microvolt = <1040000>;
+ };
+};
+
+&cpub_opp_table_1 {
+ opp-2304000000 {
+ opp-hz = /bits/ 64 <2304000000>;
+ opp-microvolt = <1030000>;
+ };
+
+ opp-2400000000 {
+ opp-hz = /bits/ 64 <2400000000>;
+ opp-microvolt = <1040000>;
+ };
+};
+
--
2.28.0

View File

@ -0,0 +1,38 @@
From f2eead311d9dd9ff7ee0846914147250d7711f98 Mon Sep 17 00:00:00 2001
Message-Id: <f2eead311d9dd9ff7ee0846914147250d7711f98.1603528796.git.stefan@agner.ch>
In-Reply-To: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
References: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
From: Scott K Logan <logans@cottsay.net>
Date: Fri, 25 Sep 2020 01:43:53 -0700
Subject: [PATCH 4/7] arm64: dts: meson: add missing g12 rng clock
This adds the missing perpheral clock for the RNG for Amlogic G12. As
stated in amlogic,meson-rng.yaml, this isn't always necessary for the
RNG to function, but is better to have in case the clock is disabled for
some reason prior to loading.
Signed-off-by: Scott K Logan <logans@cottsay.net>
Suggested-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Link: https://lore.kernel.org/r/520a1a8ec7a958b3d918d89563ec7e93a4100a45.camel@cottsay.net
---
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
index 1e83ec5b8c91..81f490e404ca 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
@@ -282,6 +282,8 @@ apb_efuse: bus@30000 {
hwrng: rng@218 {
compatible = "amlogic,meson-rng";
reg = <0x0 0x218 0x0 0x4>;
+ clocks = <&clkc CLKID_RNG0>;
+ clock-names = "core";
};
};
--
2.28.0

View File

@ -0,0 +1,42 @@
From 0a3a45efeefaf65c170df265126a07da3236e178 Mon Sep 17 00:00:00 2001
Message-Id: <0a3a45efeefaf65c170df265126a07da3236e178.1603528796.git.stefan@agner.ch>
In-Reply-To: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
References: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Fri, 23 Oct 2020 11:41:39 +0200
Subject: [PATCH 5/7] arm64: dts: meson: odroid-n2 plus: fix vddcpu_a pwm
On the odroid N2 plus, cpufreq is not available due to an error on the cpu
regulators. vddcpu a and b get the same PWM. The one provided to vddcpu A
is incorrect. Because vddcpu B PWM is busy the regulator cannot register:
> pwm-regulator regulator-vddcpu-b: Failed to get PWM: -16
Like on the odroid n2, use PWM A out of GPIOE_2 for vddcpu A to fix the
problem
Fixes: 98d24896ee11 ("arm64: dts: meson: add support for the ODROID-N2+")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Link: https://lore.kernel.org/r/20201023094139.809379-1-jbrunet@baylibre.com
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
index 5de2815ba99d..ce1198ad34e4 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
@@ -19,7 +19,7 @@ &vddcpu_a {
regulator-min-microvolt = <680000>;
regulator-max-microvolt = <1040000>;
- pwms = <&pwm_AO_cd 1 1500 0>;
+ pwms = <&pwm_ab 0 1500 0>;
};
&vddcpu_b {
--
2.28.0

View File

@ -1,10 +1,10 @@
From 6a7c42785788faa862aeb7902cb2b3b08f033ca0 Mon Sep 17 00:00:00 2001
Message-Id: <6a7c42785788faa862aeb7902cb2b3b08f033ca0.1602360581.git.stefan@agner.ch>
In-Reply-To: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
References: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
From 03041630d824a775b71f6008067955a51d069845 Mon Sep 17 00:00:00 2001
Message-Id: <03041630d824a775b71f6008067955a51d069845.1603528796.git.stefan@agner.ch>
In-Reply-To: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
References: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 27 Aug 2020 23:29:57 +0200
Subject: [PATCH 4/4] clk: meson: g12a: mark fclk_div2 as critical
Subject: [PATCH 6/7] clk: meson: g12a: mark fclk_div2 as critical
On Amlogic Meson G12b platform, similar to fclk_div3, the fclk_div2
seems to be necessary for the system to operate correctly as well.

View File

@ -1,8 +1,10 @@
From f6fce2e974fe091fd233301bd7c127ca18304039 Mon Sep 17 00:00:00 2001
Message-Id: <f6fce2e974fe091fd233301bd7c127ca18304039.1603303549.git.stefan@agner.ch>
From 2c5d0244cbd6727f0e56bd6607b3a1b18ce27a3e Mon Sep 17 00:00:00 2001
Message-Id: <2c5d0244cbd6727f0e56bd6607b3a1b18ce27a3e.1603528796.git.stefan@agner.ch>
In-Reply-To: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
References: <734f52f38625ce29c964517255538b3b0b546e8d.1603528796.git.stefan@agner.ch>
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Mon, 19 Oct 2020 19:07:02 +0200
Subject: [PATCH] usb: cdc-acm: fix cooldown mechanism
Subject: [PATCH 7/7] usb: cdc-acm: fix cooldown mechanism
Commit a4e7279cd1d1 ("cdc-acm: introduce a cool down") is causing
regression if there is some USB error, such as -EPROTO.

View File

@ -1,10 +1,8 @@
From c67fb4dbb332ed38bc7fbee13079e5ea11390f4e Mon Sep 17 00:00:00 2001
Message-Id: <c67fb4dbb332ed38bc7fbee13079e5ea11390f4e.1602104035.git.stefan@agner.ch>
In-Reply-To: <f40f83d023b2e1dd82e751aee35c1f0d386b8b4f.1602104035.git.stefan@agner.ch>
References: <f40f83d023b2e1dd82e751aee35c1f0d386b8b4f.1602104035.git.stefan@agner.ch>
From 698972869afda7095e31892c48051350788aa0a1 Mon Sep 17 00:00:00 2001
Message-Id: <698972869afda7095e31892c48051350788aa0a1.1603550330.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Mon, 31 Aug 2020 13:40:18 +0200
Subject: [PATCH 2/3] ARM: meson: isolate loading of socinfo
Subject: [PATCH 1/2] ARM: meson: isolate loading of socinfo
Move loading of socinfo into a separate function so the value can be
reused later.
@ -59,5 +57,5 @@ index 3abb27e03b..cfcd5bbd3b 100644
socinfo_to_soc_id(socinfo),
socinfo_to_package_id(socinfo),
--
2.28.0
2.29.1

View File

@ -1,58 +0,0 @@
From f40f83d023b2e1dd82e751aee35c1f0d386b8b4f Mon Sep 17 00:00:00 2001
Message-Id: <f40f83d023b2e1dd82e751aee35c1f0d386b8b4f.1602104035.git.stefan@agner.ch>
From: Pascal Vizeli <pvizeli@syshack.ch>
Date: Sat, 1 Feb 2020 20:55:39 +0000
Subject: [PATCH 1/3] Amlogic w400: read ethaddr from efuse
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
---
board/amlogic/w400/w400.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
index 47a51710dc..d74aab899a 100644
--- a/board/amlogic/w400/w400.c
+++ b/board/amlogic/w400/w400.c
@@ -6,15 +6,36 @@
#include <common.h>
#include <dm.h>
-#include <env_internal.h>
-#include <init.h>
-#include <net.h>
+#include <env.h>
#include <asm/io.h>
+#include <asm/arch/sm.h>
#include <asm/arch/eth.h>
+#define EFUSE_MAC_OFFSET 20
+#define EFUSE_MAC_SIZE 12
+
int misc_init_r(void)
{
+ u8 mac_addr[6];
+ char efuse_mac_addr[EFUSE_MAC_SIZE], buff[3];
+ ssize_t len;
+
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;
+
+ for (int i = 0; i < 6; i++){
+ buff[0] = efuse_mac_addr[i * 2];
+ buff[1] = efuse_mac_addr[i * 2 + 1];
+ mac_addr[i] = simple_strtoul(buff, NULL, 16);
+ }
+ if(is_valid_ethaddr(mac_addr))
+ eth_env_set_enetaddr("ethaddr", mac_addr);
+ }
+
return 0;
}
--
2.28.0

View File

@ -1,17 +1,17 @@
From bb86524d84909ffe5d1d6ff3afe41d26396ba561 Mon Sep 17 00:00:00 2001
Message-Id: <bb86524d84909ffe5d1d6ff3afe41d26396ba561.1602104035.git.stefan@agner.ch>
In-Reply-To: <f40f83d023b2e1dd82e751aee35c1f0d386b8b4f.1602104035.git.stefan@agner.ch>
References: <f40f83d023b2e1dd82e751aee35c1f0d386b8b4f.1602104035.git.stefan@agner.ch>
From 439e2a240062c4be21ac7879b130ef590106cdd8 Mon Sep 17 00:00:00 2001
Message-Id: <439e2a240062c4be21ac7879b130ef590106cdd8.1603550497.git.stefan@agner.ch>
In-Reply-To: <698972869afda7095e31892c48051350788aa0a1.1603550497.git.stefan@agner.ch>
References: <698972869afda7095e31892c48051350788aa0a1.1603550497.git.stefan@agner.ch>
From: Pascal Vizeli <pvizeli@syshack.ch>
Date: Tue, 4 Aug 2020 13:50:57 +0000
Subject: [PATCH 3/3] meson: Add board_rev to env
Subject: [PATCH 2/2] meson: Add board_rev to env
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
arch/arm/include/asm/arch-meson/boot.h | 4 ++++
arch/arm/mach-meson/board-info.c | 12 ++++++++++++
board/amlogic/w400/w400.c | 5 +++++
board/amlogic/odroid-n2/odroid-n2.c | 5 +++++
3 files changed, 21 insertions(+)
diff --git a/arch/arm/include/asm/arch-meson/boot.h b/arch/arm/include/asm/arch-meson/boot.h
@ -54,11 +54,11 @@ index cfcd5bbd3b..3ea7eb7251 100644
+ /* Write SoC info */
+ return snprintf(buff, buff_len, "%x", socinfo_to_minor(socinfo));
+}
diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
index d74aab899a..cb2e5edf5e 100644
--- a/board/amlogic/w400/w400.c
+++ b/board/amlogic/w400/w400.c
@@ -10,6 +10,7 @@
diff --git a/board/amlogic/odroid-n2/odroid-n2.c b/board/amlogic/odroid-n2/odroid-n2.c
index caf7fd6810..c2a191ba6a 100644
--- a/board/amlogic/odroid-n2/odroid-n2.c
+++ b/board/amlogic/odroid-n2/odroid-n2.c
@@ -12,6 +12,7 @@
#include <asm/io.h>
#include <asm/arch/sm.h>
#include <asm/arch/eth.h>
@ -66,17 +66,17 @@ index d74aab899a..cb2e5edf5e 100644
#define EFUSE_MAC_OFFSET 20
#define EFUSE_MAC_SIZE 12
@@ -20,6 +21,10 @@ int misc_init_r(void)
char efuse_mac_addr[EFUSE_MAC_SIZE], buff[3];
@@ -23,6 +24,10 @@ int misc_init_r(void)
char efuse_mac_addr[EFUSE_MAC_SIZE], tmp[3];
ssize_t len;
+ if (meson_get_soc_rev(buff, sizeof(buff))) {
+ env_set("board_rev", buff);
+ if (meson_get_soc_rev(tmp, sizeof(tmp)) > 0) {
+ env_set("board_rev", tmp);
+ }
+
meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0);
if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
--
2.28.0
2.29.1