aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files-5.4/drivers
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2021-07-23 20:19:43 +0200
committerDavid Bauer <mail@david-bauer.net>2021-08-05 01:46:26 +0200
commit91a52f22a13d768f5b16a2fd0e1d74ffe36f9cb1 (patch)
treef28017e5a42615c51b599d6de96c9fb91d27d476 /target/linux/realtek/files-5.4/drivers
parentedb6bc199049769be76bb3966debcc2b31511e4b (diff)
downloadupstream-91a52f22a13d768f5b16a2fd0e1d74ffe36f9cb1.tar.gz
upstream-91a52f22a13d768f5b16a2fd0e1d74ffe36f9cb1.tar.bz2
upstream-91a52f22a13d768f5b16a2fd0e1d74ffe36f9cb1.zip
treewide: backport support for nvmem on non platform devices
In the current state, nvmem cells are only detected on platform device. To quickly fix the problem, we register the affected problematic driver with the of_platform but that is more an hack than a real solution. Backport from net-next the required patch so that nvmem can work also with non-platform devices and rework our current patch. Drop the mediatek and dsa workaround and rework the ath10k patches. Rework every driver that use the of_get_mac_address api. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Diffstat (limited to 'target/linux/realtek/files-5.4/drivers')
-rw-r--r--target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c
index de54868cad..f810f7eb58 100644
--- a/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c
@@ -1968,7 +1968,6 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
struct device_node *dn = pdev->dev.of_node;
struct rtl838x_eth_priv *priv;
struct resource *res, *mem;
- const void *mac;
phy_interface_t phy_mode;
struct phylink *phylink;
int err = 0, i, rxrings, rxringlen;
@@ -2089,10 +2088,9 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
* 1) from device tree data
* 2) from internal registers set by bootloader
*/
- mac = of_get_mac_address(pdev->dev.of_node);
- if (!IS_ERR(mac)) {
- memcpy(dev->dev_addr, mac, ETH_ALEN);
- rtl838x_set_mac_hw(dev, (u8 *)mac);
+ of_get_mac_address(pdev->dev.of_node, dev->dev_addr);
+ if (is_valid_ether_addr(dev->dev_addr))) {
+ rtl838x_set_mac_hw(dev, (u8 *)dev->dev_addr);
} else {
dev->dev_addr[0] = (sw_r32(priv->r->mac) >> 8) & 0xff;
dev->dev_addr[1] = sw_r32(priv->r->mac) & 0xff;