All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Hewitt <christianshewitt@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 2/5] boards: amlogic: add Beelink S922X board family support
Date: Fri, 18 Dec 2020 08:45:42 +0000	[thread overview]
Message-ID: <20201218084545.29135-3-christianshewitt@gmail.com> (raw)
In-Reply-To: <20201218084545.29135-1-christianshewitt@gmail.com>

Copied from Odroid N2. Add myself as maintainer.

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
 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 0000000000..7f223df4ae
--- /dev/null
+++ b/board/amlogic/beelink-s922x/MAINTAINERS
@@ -0,0 +1,9 @@
+BEELINK-S922X
+M:	Christian Hewitt <christianshewitt@gmail.com>
+S:	Maintained
+L:	u-boot-amlogic at 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 0000000000..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 <narmstrong@baylibre.com>
+
+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 0000000000..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 <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);
+
+	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

WARNING: multiple messages have this Message-ID (diff)
From: Christian Hewitt <christianshewitt@gmail.com>
To: u-boot@lists.denx.de, u-boot-amlogic@groups.io,
	linux-amlogic@lists.infradead.org
Cc: Christian Hewitt <christianshewitt@gmail.com>
Subject: [PATCH 2/5] boards: amlogic: add Beelink S922X board family support
Date: Fri, 18 Dec 2020 08:45:42 +0000	[thread overview]
Message-ID: <20201218084545.29135-3-christianshewitt@gmail.com> (raw)
In-Reply-To: <20201218084545.29135-1-christianshewitt@gmail.com>

Copied from Odroid N2. Add myself as maintainer.

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
 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 0000000000..7f223df4ae
--- /dev/null
+++ b/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/board/amlogic/beelink-s922x/Makefile b/board/amlogic/beelink-s922x/Makefile
new file mode 100644
index 0000000000..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 <narmstrong@baylibre.com>
+
+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 0000000000..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 <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);
+
+	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


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

WARNING: multiple messages have this Message-ID (diff)
From: Christian Hewitt <christianshewitt@gmail.com>
To: u-boot@lists.denx.de, u-boot-amlogic@groups.io,
	linux-amlogic@lists.infradead.org
Cc: Christian Hewitt <christianshewitt@gmail.com>
Subject: [PATCH 2/5] boards: amlogic: add Beelink S922X board family support
Date: Fri, 18 Dec 2020 08:45:42 +0000	[thread overview]
Message-ID: <20201218084545.29135-3-christianshewitt@gmail.com> (raw)
In-Reply-To: <20201218084545.29135-1-christianshewitt@gmail.com>

Copied from Odroid N2. Add myself as maintainer.

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
 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 0000000000..7f223df4ae
--- /dev/null
+++ b/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/board/amlogic/beelink-s922x/Makefile b/board/amlogic/beelink-s922x/Makefile
new file mode 100644
index 0000000000..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 <narmstrong@baylibre.com>
+
+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 0000000000..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 <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);
+
+	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


  parent reply	other threads:[~2020-12-18  8:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18  8:45 [PATCH 0/5] board: amlogic: add Beelink GT-King/Pro support Christian Hewitt
2020-12-18  8:45 ` Christian Hewitt
2020-12-18  8:45 ` Christian Hewitt
2020-12-18  8:45 ` [PATCH 1/5] ARM: dts: import Beelink GT-King/Pro DTs from Linux 5.10 Christian Hewitt
2020-12-18  8:45   ` Christian Hewitt
2020-12-18  8:45   ` Christian Hewitt
2020-12-18  9:42   ` Neil Armstrong
2020-12-18  9:42     ` Neil Armstrong
2020-12-18  9:42     ` Neil Armstrong
2020-12-18  8:45 ` Christian Hewitt [this message]
2020-12-18  8:45   ` [PATCH 2/5] boards: amlogic: add Beelink S922X board family support Christian Hewitt
2020-12-18  8:45   ` Christian Hewitt
2020-12-18  9:42   ` Neil Armstrong
2020-12-18  9:42     ` Neil Armstrong
2020-12-18  9:42     ` Neil Armstrong
2020-12-18  8:45 ` [PATCH 3/5] boards: amlogic: add Beelink GT-King defconfig Christian Hewitt
2020-12-18  8:45   ` Christian Hewitt
2020-12-18  8:45   ` Christian Hewitt
2020-12-18  9:43   ` Neil Armstrong
2020-12-18  9:43     ` Neil Armstrong
2020-12-18  9:43     ` Neil Armstrong
2020-12-18  8:45 ` [PATCH 4/5] boards: amlogic: add Beelink GT-King Pro defconfig Christian Hewitt
2020-12-18  8:45   ` Christian Hewitt
2020-12-18  8:45   ` Christian Hewitt
2020-12-18  9:43   ` Neil Armstrong
2020-12-18  9:43     ` Neil Armstrong
2020-12-18  9:43     ` Neil Armstrong
2020-12-18  8:45 ` [PATCH 5/5] boards: amlogic: update documentation for Beelink GT-King/Pro Christian Hewitt
2020-12-18  8:45   ` Christian Hewitt
2020-12-18  8:45   ` Christian Hewitt
2020-12-18  9:47   ` Neil Armstrong
2020-12-18  9:47     ` Neil Armstrong
2020-12-18  9:47     ` Neil Armstrong
2020-12-18  9:49 ` [PATCH 0/5] board: amlogic: add Beelink GT-King/Pro support Neil Armstrong
2020-12-18  9:49   ` Neil Armstrong
2020-12-18  9:49   ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201218084545.29135-3-christianshewitt@gmail.com \
    --to=christianshewitt@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.