mirror of
https://github.com/Fishwaldo/build.git
synced 2025-03-17 12:21:23 +00:00
Set MAC addresses for Rock64 from armbianEnv.txt
Currently rockchip-cpuinfo driver reads SoC serial as all zeroes due to either a bug, hardware limitation or serial not flashed to eFuses
This commit is contained in:
parent
5a5388b7fb
commit
d5c6bf69db
4 changed files with 63 additions and 1 deletions
4
config/bootenv/rk3328-default.txt
Normal file
4
config/bootenv/rk3328-default.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
verbosity=1
|
||||
console=both
|
||||
ethaddr=02:38:a0:82:2d:c0
|
||||
eth1addr=02:38:a0:82:2e:c1
|
|
@ -3,7 +3,7 @@ KERNEL_IMAGE_TYPE=Image
|
|||
OFFSET=16
|
||||
|
||||
BOOTSCRIPT='boot-rk3328.cmd:boot.cmd'
|
||||
BOOTENV_FILE='rockchip-default.txt'
|
||||
BOOTENV_FILE='rk3328-default.txt'
|
||||
|
||||
UBOOT_TARGET_MAP=";;idbloader.bin uboot.img trust.bin"
|
||||
UBOOT_USE_GCC='> 6.0'
|
||||
|
|
42
patch/kernel/rk3328-default/read-ethernet-mac-from-DT.patch
Normal file
42
patch/kernel/rk3328-default/read-ethernet-mac-from-DT.patch
Normal file
|
@ -0,0 +1,42 @@
|
|||
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
|
||||
index 7924367f..9f4730b1 100644
|
||||
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
|
||||
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_device.h>
|
||||
+#include <linux/of_net.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/delay.h>
|
||||
@@ -1156,11 +1157,20 @@ void rk_get_eth_addr(void *priv, unsigned char *addr)
|
||||
int ret;
|
||||
struct rk_priv_data *bsp_priv = priv;
|
||||
struct device *dev = &bsp_priv->pdev->dev;
|
||||
+ const char *dt_mac_addr;
|
||||
|
||||
rk_devinfo_get_eth_mac(addr);
|
||||
if (is_valid_ether_addr(addr))
|
||||
goto out;
|
||||
|
||||
+ if (dev->of_node) {
|
||||
+ dt_mac_addr = of_get_mac_address(dev->of_node);
|
||||
+ if (dt_mac_addr)
|
||||
+ memcpy(addr, dt_mac_addr, ETH_ALEN);
|
||||
+ }
|
||||
+ if (is_valid_ether_addr(addr))
|
||||
+ goto out;
|
||||
+
|
||||
ret = rk_vendor_read(LAN_MAC_ID, addr, 6);
|
||||
if (ret != 6 || !is_valid_ether_addr(addr)) {
|
||||
dev_err(dev, "%s: rk_vendor_read eth mac address failed (%d)",
|
||||
@@ -1176,7 +1186,7 @@ void rk_get_eth_addr(void *priv, unsigned char *addr)
|
||||
}
|
||||
|
||||
out:
|
||||
- dev_err(dev, "%s: mac address: %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
+ dev_info(dev, "%s: mac address: %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
__func__, addr[0], addr[1], addr[2],
|
||||
addr[3], addr[4], addr[5]);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
|
||||
index 113b82cd..d0612eb1 100755
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
|
||||
@@ -47,6 +47,11 @@
|
||||
model = "PINE64 ROCK64";
|
||||
compatible = "pine64,rock64", "rockchip,rk3328";
|
||||
|
||||
+ aliases {
|
||||
+ ethernet0 = &gmac2io;
|
||||
+ ethernet1 = &gmac2phy;
|
||||
+ };
|
||||
+
|
||||
chosen {
|
||||
bootargs = "rockchip_jtag earlyprintk=uart8250-32bit,0xff130000";
|
||||
};
|
Loading…
Add table
Reference in a new issue