diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2021-03-16 23:35:45 +0100 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2021-03-16 23:57:52 +0100 |
commit | 7091e312307f4563d4a7afb5946140120cfa87fa (patch) | |
tree | e72c26a8bd9eaa1fd90ea69b3c421ce544a0babc /target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch | |
parent | 0f7cd97f812adaf4b2c2048227610d150aec72cc (diff) | |
download | upstream-7091e312307f4563d4a7afb5946140120cfa87fa.tar.gz upstream-7091e312307f4563d4a7afb5946140120cfa87fa.tar.bz2 upstream-7091e312307f4563d4a7afb5946140120cfa87fa.zip |
bcm4908: backport recent bcm4908_enet changes
This includes 5.12 fix and 5.13 improvements.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch')
-rw-r--r-- | target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch b/target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch new file mode 100644 index 0000000000..4b8e1f83b8 --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/074-v5.13-0001-net-broadcom-bcm4908_enet-read-MAC-from-OF.patch @@ -0,0 +1,48 @@ +From 3559c1ea4336636c886002996d50805365d3055c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> +Date: Wed, 10 Mar 2021 09:48:13 +0100 +Subject: [PATCH] net: broadcom: bcm4908_enet: read MAC from OF +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +BCM4908 devices have MAC address accessible using NVMEM so it's needed +to use OF helper for reading it. + +Signed-off-by: Rafał Miłecki <rafal@milecki.pl> +Signed-off-by: David S. Miller <davem@davemloft.net> +--- + drivers/net/ethernet/broadcom/bcm4908_enet.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c ++++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c +@@ -9,6 +9,7 @@ + #include <linux/interrupt.h> + #include <linux/module.h> + #include <linux/of.h> ++#include <linux/of_net.h> + #include <linux/platform_device.h> + #include <linux/slab.h> + #include <linux/string.h> +@@ -620,6 +621,7 @@ static int bcm4908_enet_probe(struct pla + struct device *dev = &pdev->dev; + struct net_device *netdev; + struct bcm4908_enet *enet; ++ const u8 *mac; + int err; + + netdev = devm_alloc_etherdev(dev, sizeof(*enet)); +@@ -647,7 +649,11 @@ static int bcm4908_enet_probe(struct pla + return err; + + SET_NETDEV_DEV(netdev, &pdev->dev); +- eth_hw_addr_random(netdev); ++ mac = of_get_mac_address(dev->of_node); ++ if (!IS_ERR(mac)) ++ ether_addr_copy(netdev->dev_addr, mac); ++ else ++ eth_hw_addr_random(netdev); + netdev->netdev_ops = &bcm4908_enet_netdev_ops; + netdev->min_mtu = ETH_ZLEN; + netdev->mtu = ETH_DATA_LEN; |