sunxi: nanopi-r1s-h5: use mac address provided by eeprom

Signed-off-by: AmadeusGhost <amadeus@jmu.edu.cn>
This commit is contained in:
AmadeusGhost 2021-05-26 23:05:55 +08:00
parent 3a0062b797
commit 13a3b44d07
4 changed files with 13 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <amadeus@jmu.edu.cn>
@ -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;
+ };
+};
+