rockchip: add NanoPi R4S Enterprise Edition build

FriendlyElec renamed the NanoPi R4S board with EEPROM (mac address)
to "enterprise" edition, and it was added as a "new" board in upstream
kernel.

This patch switched to use that upstreamed dts and removed local
EEPROM patch.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2024-02-17 13:54:36 +08:00 committed by Nick Hainke
parent 873b0ed42c
commit afca1236f3
7 changed files with 26 additions and 63 deletions

View File

@ -107,7 +107,8 @@ define U-Boot/nanopi-r4s-rk3399
$(U-Boot/rk3399/Default)
NAME:=NanoPi R4S
BUILD_DEVICES:= \
friendlyarm_nanopi-r4s
friendlyarm_nanopi-r4s \
friendlyarm_nanopi-r4s-enterprise
endef
define U-Boot/rock-pi-4-rk3399

View File

@ -12,6 +12,7 @@ friendlyarm,nanopi-r2c|\
friendlyarm,nanopi-r2c-plus|\
friendlyarm,nanopi-r2s|\
friendlyarm,nanopi-r4s|\
friendlyarm,nanopi-r4s-enterprise|\
xunlong,orangepi-r1-plus|\
xunlong,orangepi-r1-plus-lts)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0"

View File

@ -11,6 +11,7 @@ rockchip_setup_interfaces()
friendlyarm,nanopi-r2c-plus|\
friendlyarm,nanopi-r2s|\
friendlyarm,nanopi-r4s|\
friendlyarm,nanopi-r4s-enterprise|\
xunlong,orangepi-r1-plus|\
xunlong,orangepi-r1-plus-lts)
ucidef_set_interfaces_lan_wan 'eth1' 'eth0'
@ -27,27 +28,6 @@ rockchip_setup_interfaces()
esac
}
nanopi_r4s_get_mac()
{
local interface=$1
local eeprom_path="/sys/bus/i2c/devices/2-0051/eeprom"
local address
if [ -f "$eeprom_path" ]; then
address=$(get_mac_binary "$eeprom_path" 0xfa)
if [ "$interface" = "lan" ]; then
address=$(macaddr_setbit_la "$address")
fi
else
address=$(macaddr_generate_from_mmc_cid mmcblk1)
if [ "$interface" = "lan" ]; then
address=$(macaddr_add "$address" 1)
fi
fi
echo "$address"
}
rockchip_setup_macs()
{
local board="$1"
@ -61,19 +41,20 @@ rockchip_setup_macs()
wan_mac=$(macaddr_generate_from_mmc_cid mmcblk0)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
friendlyarm,nanopi-r4s)
wan_mac=$(nanopi_r4s_get_mac wan)
lan_mac=$(nanopi_r4s_get_mac lan)
friendlyarm,nanopi-r2c-plus|\
friendlyarm,nanopi-r4s|\
friendlyarm,nanopi-r5s)
wan_mac=$(macaddr_generate_from_mmc_cid mmcblk1)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
friendlyarm,nanopi-r4s-enterprise)
wan_mac=$(get_mac_binary "/sys/bus/i2c/devices/2-0051/eeprom" 0xfa)
lan_mac=$(macaddr_setbit_la "$wan_mac")
;;
friendlyarm,nanopi-r5c)
wan_mac=$(macaddr_generate_from_mmc_cid mmcblk*)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
friendlyarm,nanopi-r2c-plus|\
friendlyarm,nanopi-r5s)
wan_mac=$(macaddr_generate_from_mmc_cid mmcblk1)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
xunlong,orangepi-r1-plus|\
xunlong,orangepi-r1-plus-lts)
wan_mac=$(macaddr_add "$(cat /sys/class/net/eth1/address)" -1)

View File

@ -37,7 +37,8 @@ xunlong,orangepi-r1-plus-lts)
set_interface_core 2 "eth0"
set_interface_core 4 "eth1" "xhci-hcd:usb[0-9]+"
;;
friendlyarm,nanopi-r4s)
friendlyarm,nanopi-r4s|\
friendlyarm,nanopi-r4s-enterprise)
set_interface_core 10 "eth0"
set_interface_core 20 "eth1"
;;

View File

@ -55,6 +55,16 @@ define Device/friendlyarm_nanopi-r4s
endef
TARGET_DEVICES += friendlyarm_nanopi-r4s
define Device/friendlyarm_nanopi-r4s-enterprise
DEVICE_VENDOR := FriendlyARM
DEVICE_MODEL := NanoPi R4S Enterprise Edition
DEVICE_VARIANT := 4GB LPDDR4
SOC := rk3399
UBOOT_DEVICE_NAME := nanopi-r4s-rk3399
DEVICE_PACKAGES := kmod-r8168
endef
TARGET_DEVICES += friendlyarm_nanopi-r4s-enterprise
define Device/friendlyarm_nanopi-r5c
DEVICE_VENDOR := FriendlyARM
DEVICE_MODEL := NanoPi R5C

View File

@ -1,31 +0,0 @@
From af20b3384e8723077cc6484160b0cf4e9be321de Mon Sep 17 00:00:00 2001
From: Tianling Shen <cnsztl@gmail.com>
Date: Mon, 7 Jun 2021 15:45:37 +0800
Subject: [PATCH] arm64: dts: rockchip: add EEPROM node for NanoPi R4S
NanoPi R4S has a EEPROM attached to the 2nd I2C bus (U92), which
stores the MAC address.
Signed-off-by: Tianling Shen <cnsztl@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
@@ -68,6 +68,15 @@
status = "disabled";
};
+&i2c2 {
+ eeprom@51 {
+ compatible = "microchip,24c02", "atmel,24c02";
+ reg = <0x51>;
+ pagesize = <16>;
+ read-only; /* This holds our MAC */
+ };
+};
+
&i2c4 {
status = "disabled";
};

View File

@ -22,7 +22,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net>
status = "okay";
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
@@ -121,6 +121,11 @@
@@ -112,6 +112,11 @@
status = "disabled";
};