board: amlogic: Add Odroid-N2 board support
PATCH 1/1 board: amlogic: Add Odroid-N2 board support
From: Pascal Vizeli <[email protected]>
Add a proper Odroid-N2 board support to handle the Ethernet MAC address stored in the in-SoC eFuses.
--- board/amlogic/odroid-n2/MAINTAINERS | 7 +++++ board/amlogic/odroid-n2/Makefile | 6 ++++ board/amlogic/odroid-n2/odroid-n2.c | 49 +++++++++++++++++++++++++++++ board/amlogic/w400/MAINTAINERS | 2 -- configs/odroid-n2_defconfig | 2 +- 5 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 board/amlogic/odroid-n2/MAINTAINERS create mode 100644 board/amlogic/odroid-n2/Makefile create mode 100644 board/amlogic/odroid-n2/odroid-n2.c
board/amlogic/odroid-n2/MAINTAINERS new file +7 -0
@@ -0,0 +1,7 @@ +ODROID-N2 +M: Neil Armstrong <[email protected]> +S: Maintained +L: u-boot-amlogic at groups.io +F: board/amlogic/odroid-n2/ +F: configs/odroid-n2_defconfig +F: doc/board/amlogic/odroid-n2.rst
board/amlogic/odroid-n2/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2020 BayLibre, SAS +# Author: Neil Armstrong <[email protected]> + +obj-y := odroid-n2.o
board/amlogic/odroid-n2/odroid-n2.c new file +49 -0
49 lines not on this page · raw message
board/amlogic/w400/MAINTAINERS +0 -2
@@ -5,8 +5,6 @@ L: [email protected] F: board/amlogic/w400/ F: configs/khadas-vim3_defconfig F: configs/khadas-vim3l_defconfig -F: configs/odroid-n2_defconfig F: doc/board/amlogic/w400.rst F: doc/board/amlogic/khadas-vim3.rst F: doc/board/amlogic/khadas-vim3l.rst -F: doc/board/amlogic/odroid-n2.rst
configs/odroid-n2_defconfig +1 -1
@@ -1,5 +1,5 @@ CONFIG_ARM=y -CONFIG_SYS_BOARD="w400" +CONFIG_SYS_BOARD="odroid-n2" CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_ENV_SIZE=0x2000
Signature · 1 line
2.22.0
PATCH 1/1 board: amlogic: Add Odroid-N2 board support
Hi Neil,
Quoted 6 lines · Neil Armstrong
From: Pascal Vizeli <[email protected]>
Add a proper Odroid-N2 board support to handle the Ethernet MAC address stored in the in-SoC eFuses.
This feature need to be implemented for all Amlogic SoC boards, since many boards link libretech-cc also generate random mac address for ethernet.
Please add my: Tested on N2.
-Anand
Quoted 120 lines
Signed-off-by Pascal Vizeli <[email protected]>Signed-off-by Neil Armstrong <[email protected]>--- board/amlogic/odroid-n2/MAINTAINERS | 7 +++++ board/amlogic/odroid-n2/Makefile | 6 ++++ board/amlogic/odroid-n2/odroid-n2.c | 49 +++++++++++++++++++++++++++++ board/amlogic/w400/MAINTAINERS | 2 -- configs/odroid-n2_defconfig | 2 +- 5 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 board/amlogic/odroid-n2/MAINTAINERS create mode 100644 board/amlogic/odroid-n2/Makefile create mode 100644 board/amlogic/odroid-n2/odroid-n2.cboard/amlogic/odroid-n2/MAINTAINERS new file +7
-0@@ -0,0 +1,7 @@ +ODROID-N2 +M: Neil Armstrong <[email protected]> +S: Maintained +L: u-boot-amlogic at groups.io +F: board/amlogic/odroid-n2/ +F: configs/odroid-n2_defconfig +F: doc/board/amlogic/odroid-n2.rstboard/amlogic/odroid-n2/Makefile new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2020 BayLibre, SAS +# Author: Neil Armstrong <[email protected]> + +obj-y := odroid-n2.oboard/amlogic/odroid-n2/odroid-n2.c new file +49
-0@@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2020 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#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> + +#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; + +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 ; +}board/amlogic/w400/MAINTAINERS +0
-2@@ -5,8 +5,6 @@ L: u-boot-amlogic at groups.io F: board/amlogic/w400/ F: configs/khadas-vim3_defconfig F: configs/khadas-vim3l_defconfig -F: configs/odroid-n2_defconfig F: doc/board/amlogic/w400.rst F: doc/board/amlogic/khadas-vim3.rst F: doc/board/amlogic/khadas-vim3l.rst -F: doc/board/amlogic/odroid-n2.rstconfigs/odroid-n2_defconfig +1
-2@@ -1,5 +1,5 @@ CONFIG_ARM=y -CONFIG_SYS_BOARD="w400" +CONFIG_SYS_BOARD="odroid-n2" CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_ENV_SIZE=0x2000 --2.22.0
PATCH 1/1 board: amlogic: Add Odroid-N2 board support
Hi,
Quoted 6 lines · Anand Moon
Hi Neil,
Quoted 3 lines · Neil Armstrong
From: Pascal Vizeli <[email protected]>
Quoted 7 lines
Quoted 3 lines
Add a proper Odroid-N2 board support to handle the Ethernet MAC address stored in the in-SoC eFuses.
This feature need to be implemented for all Amlogic SoC boards, since many boards link libretech-cc also generate random mac address for ethernet.
In fact, AFAIK only HardKernel stores the MAC in the fuses, now Amlogic stores the MAC in the eMMC custom partitions, but they did for GXBB and previous SoCs. Earlier I introduced meson_generate_serial_ethaddr() for GXL and later (not GXBB), to generate an unique MAC address from the SoC serial.
Neil
Quoted 126 lines
Please add my: Tested on N2.
Tested-by Anand Moon <[email protected]>-Anand
Quoted 120 lines
Signed-off-by Pascal Vizeli <[email protected]>Signed-off-by Neil Armstrong <[email protected]>--- board/amlogic/odroid-n2/MAINTAINERS | 7 +++++ board/amlogic/odroid-n2/Makefile | 6 ++++ board/amlogic/odroid-n2/odroid-n2.c | 49 +++++++++++++++++++++++++++++ board/amlogic/w400/MAINTAINERS | 2 -- configs/odroid-n2_defconfig | 2 +- 5 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 board/amlogic/odroid-n2/MAINTAINERS create mode 100644 board/amlogic/odroid-n2/Makefile create mode 100644 board/amlogic/odroid-n2/odroid-n2.cboard/amlogic/odroid-n2/MAINTAINERS new file +7
-0@@ -0,0 +1,7 @@ +ODROID-N2 +M: Neil Armstrong <[email protected]> +S: Maintained +L: u-boot-amlogic at groups.io +F: board/amlogic/odroid-n2/ +F: configs/odroid-n2_defconfig +F: doc/board/amlogic/odroid-n2.rstboard/amlogic/odroid-n2/Makefile new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2020 BayLibre, SAS +# Author: Neil Armstrong <[email protected]> + +obj-y := odroid-n2.oboard/amlogic/odroid-n2/odroid-n2.c new file +49
-0@@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2020 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#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> + +#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; + +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 ; +}board/amlogic/w400/MAINTAINERS +0
-2@@ -5,8 +5,6 @@ L: u-boot-amlogic at groups.io F: board/amlogic/w400/ F: configs/khadas-vim3_defconfig F: configs/khadas-vim3l_defconfig -F: configs/odroid-n2_defconfig F: doc/board/amlogic/w400.rst F: doc/board/amlogic/khadas-vim3.rst F: doc/board/amlogic/khadas-vim3l.rst -F: doc/board/amlogic/odroid-n2.rstconfigs/odroid-n2_defconfig +1
-2@@ -1,5 +1,5 @@ CONFIG_ARM=y -CONFIG_SYS_BOARD="w400" +CONFIG_SYS_BOARD="odroid-n2" CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_ENV_SIZE=0x2000 --2.22.0
PATCH 1/1 board: amlogic: Add Odroid-N2 board support
Hi Neil,
Quoted 18 lines · Neil Armstrong
Hi,
Quoted 6 lines · Anand Moon
Hi Neil,
Quoted 3 lines · Neil Armstrong
From: Pascal Vizeli <[email protected]>
Quoted 7 lines
Quoted 3 lines
Add a proper Odroid-N2 board support to handle the Ethernet MAC address stored in the in-SoC eFuses.
This feature need to be implemented for all Amlogic SoC boards, since many boards link libretech-cc also generate random mac address for ethernet.
Quoted 7 lines
In fact, AFAIK only HardKernel stores the MAC in the fuses, now Amlogic stores the MAC in the eMMC custom partitions, but they did for GXBB and previous SoCs. Earlier I introduced
meson_generate_serial_ethaddr()for GXL and later (not GXBB), to generate an unique MAC address from the SoC serial.Neil
Thanks for this information.
-Anand
PATCH 1/1 board: amlogic: Add Odroid-N2 board support
In reply to Neil ArmstrongQuoted 117 lines · Neil Armstrong
From: Pascal Vizeli <[email protected]>
Add a proper Odroid-N2 board support to handle the Ethernet MAC address stored in the in-SoC eFuses.
Signed-off-by Pascal Vizeli <[email protected]>Signed-off-by Neil Armstrong <[email protected]>--- board/amlogic/odroid-n2/MAINTAINERS | 7 +++++ board/amlogic/odroid-n2/Makefile | 6 ++++ board/amlogic/odroid-n2/odroid-n2.c | 49 +++++++++++++++++++++++++++++ board/amlogic/w400/MAINTAINERS | 2 -- configs/odroid-n2_defconfig | 2 +- 5 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 board/amlogic/odroid-n2/MAINTAINERS create mode 100644 board/amlogic/odroid-n2/Makefile create mode 100644 board/amlogic/odroid-n2/odroid-n2.cboard/amlogic/odroid-n2/MAINTAINERS new file +7
-0@@ -0,0 +1,7 @@ +ODROID-N2 +M: Neil Armstrong <[email protected]> +S: Maintained +L: u-boot-amlogic at groups.io +F: board/amlogic/odroid-n2/ +F: configs/odroid-n2_defconfig +F: doc/board/amlogic/odroid-n2.rstboard/amlogic/odroid-n2/Makefile new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2020 BayLibre, SAS +# Author: Neil Armstrong <[email protected]> + +obj-y := odroid-n2.oboard/amlogic/odroid-n2/odroid-n2.c new file +49
-0@@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2020 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#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> + +#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; + +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 ; +}board/amlogic/w400/MAINTAINERS +0
-2@@ -5,8 +5,6 @@ L: u-boot-amlogic at groups.io F: board/amlogic/w400/ F: configs/khadas-vim3_defconfig F: configs/khadas-vim3l_defconfig -F: configs/odroid-n2_defconfig F: doc/board/amlogic/w400.rst F: doc/board/amlogic/khadas-vim3.rst F: doc/board/amlogic/khadas-vim3l.rst -F: doc/board/amlogic/odroid-n2.rstconfigs/odroid-n2_defconfig +0
-0
configs/odroid-n2_defconfig line 5
Quoted 6 lines
configs/odroid-n2_defconfig +1
-1@@ -1,5 +1,5 @@ CONFIG_ARM=y -CONFIG_SYS_BOARD="w400" +CONFIG_SYS_BOARD="odroid-n2" CONFIG_ARCH_MESON=y CONFIG_SYS_TEXT_BASE=0x01000000 CONFIG_ENV_SIZE=0x2000
Applied to u-boot-amlogic for U-Boot 2020.10
Neil