From: Marek Szyprowski <m.szyprowski@samsung.com> To: u-boot@lists.denx.de Subject: [PATCH] board: amlogic: vim3: read ethernet MAC address from efuse Date: Thu, 17 Dec 2020 08:26:42 +0100 [thread overview] Message-ID: <20201217072642.1319-1-m.szyprowski@samsung.com> (raw) In-Reply-To: CGME20201217072655eucas1p123aa0a548e4de21a8ac580dbc990c760@eucas1p1.samsung.com Add the board specific code for reading built-in ethernet MAC address from efuse. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- board/amlogic/vim3/vim3.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/board/amlogic/vim3/vim3.c b/board/amlogic/vim3/vim3.c index 09ef39ff30..a36df61583 100644 --- a/board/amlogic/vim3/vim3.c +++ b/board/amlogic/vim3/vim3.c @@ -11,6 +11,7 @@ #include <net.h> #include <asm/io.h> #include <asm/arch/eth.h> +#include <asm/arch/sm.h> #include <i2c.h> #include "khadas-mcu.h" @@ -129,9 +130,27 @@ int meson_ft_board_setup(void *blob, struct bd_info *bd) return 0; } +#define EFUSE_MAC_OFFSET 0 +#define EFUSE_MAC_SIZE 6 + int misc_init_r(void) { + uint8_t mac_addr[EFUSE_MAC_SIZE]; + 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, + mac_addr, EFUSE_MAC_SIZE); + if (len != EFUSE_MAC_SIZE) + return 0; + + 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: Marek Szyprowski <m.szyprowski@samsung.com> To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski <m.szyprowski@samsung.com>, Neil Armstrong <narmstrong@baylibre.com>, Jaehoon Chung <jh80.chung@samsung.com>, Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Subject: [PATCH] board: amlogic: vim3: read ethernet MAC address from efuse Date: Thu, 17 Dec 2020 08:26:42 +0100 [thread overview] Message-ID: <20201217072642.1319-1-m.szyprowski@samsung.com> (raw) In-Reply-To: CGME20201217072655eucas1p123aa0a548e4de21a8ac580dbc990c760@eucas1p1.samsung.com Add the board specific code for reading built-in ethernet MAC address from efuse. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- board/amlogic/vim3/vim3.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/board/amlogic/vim3/vim3.c b/board/amlogic/vim3/vim3.c index 09ef39ff30..a36df61583 100644 --- a/board/amlogic/vim3/vim3.c +++ b/board/amlogic/vim3/vim3.c @@ -11,6 +11,7 @@ #include <net.h> #include <asm/io.h> #include <asm/arch/eth.h> +#include <asm/arch/sm.h> #include <i2c.h> #include "khadas-mcu.h" @@ -129,9 +130,27 @@ int meson_ft_board_setup(void *blob, struct bd_info *bd) return 0; } +#define EFUSE_MAC_OFFSET 0 +#define EFUSE_MAC_SIZE 6 + int misc_init_r(void) { + uint8_t mac_addr[EFUSE_MAC_SIZE]; + 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, + mac_addr, EFUSE_MAC_SIZE); + if (len != EFUSE_MAC_SIZE) + return 0; + + if (is_valid_ethaddr(mac_addr)) + eth_env_set_enetaddr("ethaddr", mac_addr); + else + meson_generate_serial_ethaddr(); + } + return 0; } -- 2.17.1
next parent reply other threads:[~2020-12-17 7:26 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20201217072655eucas1p123aa0a548e4de21a8ac580dbc990c760@eucas1p1.samsung.com> 2020-12-17 7:26 ` Marek Szyprowski [this message] 2020-12-17 7:26 ` [PATCH] board: amlogic: vim3: read ethernet MAC address from efuse Marek Szyprowski 2020-12-17 8:43 ` Neil Armstrong 2020-12-17 8:43 ` Neil Armstrong 2020-12-17 8:57 ` Jaehoon Chung 2020-12-17 8:57 ` Jaehoon Chung
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=20201217072642.1319-1-m.szyprowski@samsung.com \ --to=m.szyprowski@samsung.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: linkBe 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.