Skip to content

Commit

Permalink
rockchip: add NanoPi R4S Enterprise Edition build
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
1715173329 authored and PolynomialDivision committed Feb 19, 2024
1 parent 873b0ed commit afca123
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 63 deletions.
3 changes: 2 additions & 1 deletion package/boot/uboot-rockchip/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions target/linux/rockchip/armv8/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
39 changes: 10 additions & 29 deletions target/linux/rockchip/armv8/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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"
Expand All @@ -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-r5c)
wan_mac=$(macaddr_generate_from_mmc_cid mmcblk*)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
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)
;;
xunlong,orangepi-r1-plus|\
xunlong,orangepi-r1-plus-lts)
wan_mac=$(macaddr_add "$(cat /sys/class/net/eth1/address)" -1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
;;
Expand Down
10 changes: 10 additions & 0 deletions target/linux/rockchip/image/armv8.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Signed-off-by: David Bauer <[email protected]>
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";
};

Expand Down

0 comments on commit afca123

Please sign in to comment.