From 91a52f22a13d768f5b16a2fd0e1d74ffe36f9cb1 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Fri, 23 Jul 2021 20:19:43 +0200 Subject: 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 --- target/linux/realtek/files-5.4/drivers/net/ethernet/rtl838x_eth.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'target/linux/realtek/files-5.4') 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; -- cgit v1.2.3