From 13a3b44d072b7026c42d464a5be9cd1747bd2c23 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Wed, 26 May 2021 23:05:55 +0800 Subject: [PATCH] sunxi: nanopi-r1s-h5: use mac address provided by eeprom Signed-off-by: AmadeusGhost --- .../sunxi/base-files/etc/board.d/02_network | 9 +-------- target/linux/sunxi/config-5.4 | 1 + target/linux/sunxi/image/cortexa53.mk | 4 ++-- ...sunxi-h5-add-support-for-nanopi-r1s-h5.patch | 17 +++++++++-------- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/target/linux/sunxi/base-files/etc/board.d/02_network b/target/linux/sunxi/base-files/etc/board.d/02_network index 7020b5f29a..19fdd5d060 100755 --- a/target/linux/sunxi/base-files/etc/board.d/02_network +++ b/target/linux/sunxi/base-files/etc/board.d/02_network @@ -31,13 +31,6 @@ sunxi_setup_interfaces() esac } -nanopi_generate_mac() -{ - local sd_hash=$(sha256sum /sys/class/block/mmcblk0/device/cid) - local mac_base=$(macaddr_canonicalize "$(echo "${sd_hash}" | dd bs=1 count=12 2>/dev/null)") - echo "$(macaddr_unsetbit_mc "$(macaddr_setbit_la "${mac_base}")")" -} - sunxi_setup_macs() { local board="$1" @@ -47,7 +40,7 @@ sunxi_setup_macs() case "$board" in friendlyarm,nanopi-r1s-h5) - lan_mac=$(nanopi_generate_mac) + lan_mac=$(get_mac_binary "/sys/bus/i2c/devices/0-0051/eeprom" 0xfa) ;; esac diff --git a/target/linux/sunxi/config-5.4 b/target/linux/sunxi/config-5.4 index c28249f6f1..55436323cc 100644 --- a/target/linux/sunxi/config-5.4 +++ b/target/linux/sunxi/config-5.4 @@ -167,6 +167,7 @@ CONFIG_DWMAC_SUNXI=y CONFIG_DYNAMIC_DEBUG=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y +CONFIG_EEPROM_AT24=y CONFIG_ELF_CORE=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_EXT4_FS=y diff --git a/target/linux/sunxi/image/cortexa53.mk b/target/linux/sunxi/image/cortexa53.mk index 0b1fd9fce0..ecd8f5358c 100644 --- a/target/linux/sunxi/image/cortexa53.mk +++ b/target/linux/sunxi/image/cortexa53.mk @@ -43,8 +43,8 @@ TARGET_DEVICES += friendlyarm_nanopi-neo2 define Device/friendlyarm_nanopi-r1s-h5 DEVICE_VENDOR := FriendlyARM DEVICE_MODEL := Nanopi R1S H5 - DEVICE_PACKAGES := kmod-eeprom-at24 kmod-gpio-button-hotplug kmod-leds-gpio \ - kmod-rtl8189es kmod-usb2 kmod-usb-net-rtl8152 wpad-basic + DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-rtl8189es \ + kmod-usb2 kmod-usb-net-rtl8152 wpad-basic SUPPORTED_DEVICES:=nanopi-r1s-h5 $(Device/sun50i-h5) endef diff --git a/target/linux/sunxi/patches-5.4/101-sunxi-h5-add-support-for-nanopi-r1s-h5.patch b/target/linux/sunxi/patches-5.4/101-sunxi-h5-add-support-for-nanopi-r1s-h5.patch index 71a6447249..3b74ff4c5f 100644 --- a/target/linux/sunxi/patches-5.4/101-sunxi-h5-add-support-for-nanopi-r1s-h5.patch +++ b/target/linux/sunxi/patches-5.4/101-sunxi-h5-add-support-for-nanopi-r1s-h5.patch @@ -24,7 +24,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus.dtb --- /dev/null +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts -@@ -0,0 +1,201 @@ +@@ -0,0 +1,202 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (C) 2021 AmadeusGhost @@ -67,15 +67,15 @@ + gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>; + }; + -+ wan { -+ label = "nanopi:green:wan"; -+ gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; -+ }; -+ + lan { + label = "nanopi:green:lan"; + gpios = <&pio 0 9 GPIO_ACTIVE_HIGH>; + }; ++ ++ wan { ++ label = "nanopi:green:wan"; ++ gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; ++ }; + }; + + r-gpio-keys { @@ -175,9 +175,10 @@ + status = "okay"; + + eeprom@51 { -+ compatible = "microchip,24c02"; -+ reg = <0x51>; ++ compatible = "atmel,24c02"; + pagesize = <16>; ++ reg = <0x51>; ++ read-only; + }; +}; +