aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bmips
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/bmips
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/bmips')
-rw-r--r--target/linux/bmips/files/arch/mips/bmips/ath9k-fixup.c6
-rw-r--r--target/linux/bmips/files/arch/mips/bmips/b43-sprom.c6
-rw-r--r--target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c6
3 files changed, 6 insertions, 12 deletions
diff --git a/target/linux/bmips/files/arch/mips/bmips/ath9k-fixup.c b/target/linux/bmips/files/arch/mips/bmips/ath9k-fixup.c
index dd13ac6256..fc03416507 100644
--- a/target/linux/bmips/files/arch/mips/bmips/ath9k-fixup.c
+++ b/target/linux/bmips/files/arch/mips/bmips/ath9k-fixup.c
@@ -167,7 +167,6 @@ static int ath9k_fixup_probe(struct platform_device *pdev)
struct device_node *node = dev->of_node;
struct ath9k_fixup *priv;
struct resource *res;
- const void *mac;
int ret;
if (ath9k_num_fixups >= ATH9K_MAX_FIXUPS)
@@ -200,9 +199,8 @@ static int ath9k_fixup_probe(struct platform_device *pdev)
priv->pdata.led_active_high = of_property_read_bool(node,
"ath,led-active-high");
- mac = of_get_mac_address(node);
- if (!IS_ERR_OR_NULL(mac)) {
- memcpy(priv->mac, mac, ETH_ALEN);
+ of_get_mac_address(node, priv->mac);
+ if (is_valid_ether_addr(priv->mac)) {
dev_info(dev, "mtd mac %pM\n", priv->mac);
} else {
random_ether_addr(priv->mac);
diff --git a/target/linux/bmips/files/arch/mips/bmips/b43-sprom.c b/target/linux/bmips/files/arch/mips/bmips/b43-sprom.c
index 2348bd1fe2..edc7fb145b 100644
--- a/target/linux/bmips/files/arch/mips/bmips/b43-sprom.c
+++ b/target/linux/bmips/files/arch/mips/bmips/b43-sprom.c
@@ -1119,7 +1119,6 @@ static int b43_sprom_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
struct b43_sprom *priv = &b43_sprom;
- const void *mac;
int ret;
priv->dev = dev;
@@ -1129,9 +1128,8 @@ static int b43_sprom_probe(struct platform_device *pdev)
of_property_read_u32(node, "pci-bus", &priv->pci_bus);
of_property_read_u32(node, "pci-dev", &priv->pci_dev);
- mac = of_get_mac_address(node);
- if (!IS_ERR_OR_NULL(mac)) {
- memcpy(priv->mac, mac, ETH_ALEN);
+ of_get_mac_address(node, priv->mac);
+ if (is_valid_ether_addr(priv->mac)) {
dev_info(dev, "mtd mac %pM\n", priv->mac);
} else {
random_ether_addr(priv->mac);
diff --git a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
index 2a27118aa7..d9ecba5188 100644
--- a/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
+++ b/target/linux/bmips/files/drivers/net/ethernet/broadcom/bcm6368-enetsw.c
@@ -864,7 +864,6 @@ static int bcm6368_enetsw_probe(struct platform_device *pdev)
struct device_node *node = dev->of_node;
struct net_device *ndev;
struct resource *res;
- const void *mac;
unsigned i;
int ret;
@@ -953,9 +952,8 @@ static int bcm6368_enetsw_probe(struct platform_device *pdev)
priv->dma_chan_int_mask = DMAC_IR_PKTDONE_MASK;
priv->dma_chan_width = DMA_CHAN_WIDTH;
- mac = of_get_mac_address(node);
- if (!IS_ERR_OR_NULL(mac)) {
- memcpy(ndev->dev_addr, mac, ETH_ALEN);
+ of_get_mac_address(node, ndev->dev_addr);
+ if (is_valid_ether_addr(ndev->dev_addr)) {
dev_info(dev, "mtd mac %pM\n", ndev->dev_addr);
} else {
random_ether_addr(ndev->dev_addr);