layerscape: Fix multiple bugs in of_get_mac_address() changes
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 8 Aug 2021 20:50:27 +0000 (22:50 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 8 Aug 2021 23:16:48 +0000 (01:16 +0200)
The change which backported the of_get_mac_address() change broke some
patches in the layerscape target so the patches did not apply any more.

This commit makes them apply again and also fixes some other problems
related to this change.

Fixes commit 91a52f22a13d ("treewide: backport support for nvmem on non platform devices")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/layerscape/patches-5.4/701-net-0009-dpa-SDK-DPAA-1.x-Ethernet-driver.patch
target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch
target/linux/layerscape/patches-5.4/701-net-0306-staging-fsl_ppfe-eth-resolve-indentation-warning.patch
target/linux/layerscape/patches-5.4/701-net-0307-staging-fsl_ppfe-eth-add-fixed-link-support.patch
target/linux/layerscape/patches-5.4/701-net-0313-staging-fsl_ppfe-eth-reorganize-platform-phy-paramet.patch
target/linux/layerscape/patches-5.4/701-net-0314-staging-fsl_ppfe-eth-support-single-interface-initia.patch
target/linux/layerscape/patches-5.4/701-net-0316-staging-fsl_ppfe-eth-remove-unused-code.patch
target/linux/layerscape/patches-5.4/701-net-0317-staging-fsl_ppfe-eth-separate-mdio-init-from-mac-ini.patch
target/linux/layerscape/patches-5.4/701-net-0320-staging-fsl_ppfe-eth-use-memremap-to-map-RAM-area-us.patch
target/linux/layerscape/patches-5.4/701-net-0399-staging-fsl_ppfe-eth-Enhance-error-checking-in-platf.patch

index 215569e406a27117a425c039b549fdb1b3af02fd..8dbcb0654f2434e7241077fe0f125dcdd1e92103 100644 (file)
@@ -10514,7 +10514,7 @@ Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
 +module_exit(dpa_ptp_unload);
 --- /dev/null
 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c
-@@ -0,0 +1,907 @@
+@@ -0,0 +1,909 @@
 +/* Copyright 2008-2012 Freescale Semiconductor, Inc.
 + *
 + * Redistribution and use in source and binary forms, with or without
@@ -11426,7 +11426,7 @@ Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
 +};
 --- /dev/null
 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/mac.c
-@@ -0,0 +1,489 @@
+@@ -0,0 +1,486 @@
 +/* Copyright 2008-2012 Freescale Semiconductor, Inc.
 + *
 + * Redistribution and use in source and binary forms, with or without
@@ -11700,11 +11700,10 @@ Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
 +              mac_dev->cell_index -= 8;
 +
 +      /* Get the MAC address */
-+      of_get_mac_address(mac_node, mac_dev->addr);
-+      if (unlikely(!is_valid_ether_addr(mac_dev->addr))) {
++      _errno = of_get_mac_address(mac_node, mac_dev->addr);
++      if (unlikely(_errno)) {
 +              dev_err(dev, "of_get_mac_address(%s) failed\n",
 +                              mac_node->full_name);
-+              _errno = -EINVAL;
 +              goto _return_dev_set_drvdata;
 +      }
 +
index 22d6c97a72fd18d7e286b40ba106ba9f08b2f16e..72b101bfb0bc5ae69ad72249593ca238934f1c25 100644 (file)
@@ -658,7 +658,7 @@ Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
  struct dsa_switch_driver {
 --- a/net/dsa/dsa2.c
 +++ b/net/dsa/dsa2.c
-@@ -325,6 +325,10 @@ static int dsa_port_setup(struct dsa_por
+@@ -323,6 +323,10 @@ static int dsa_port_setup(struct dsa_por
                if (err)
                        break;
  
index f57e26688fdb025ededbf5f28111cd560c379124..d61a448b0b204e5e4ef4234fd3202b839bf69ab1 100644 (file)
@@ -28,7 +28,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
 
 --- a/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
 +++ b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
-@@ -89,11 +89,12 @@ static int pfe_get_gemac_if_proprties(st
+@@ -83,11 +83,12 @@ static int pfe_get_gemac_if_proprties(st
        }
  
        addr = of_get_property(gem, "fsl,mdio-mux-val", &size);
index 298c34a5e8349719e10a3732ed99fcd479fa76d6..900a4513fe70ce955131b06637f8dcee7a6caa7e 100644 (file)
@@ -99,7 +99,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
  #include <linux/platform_device.h>
  #include <linux/slab.h>
  #include <linux/clk.h>
-@@ -124,6 +126,8 @@ static int pfe_get_gemac_if_proprties(st
+@@ -118,6 +120,8 @@ static int pfe_get_gemac_if_proprties(st
        pdata->ls1012a_mdio_pdata[port].irq[0] = PHY_POLL;
  
  done:
index 7d59676781ce3268e9d93ad31e23effc5ce2aae2..8a16edf285d3f1dec3a86be3fa76469bd0af07f9 100644 (file)
@@ -46,7 +46,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
        addr = of_get_property(gem, "fsl,gemac-bus-id", &size);
        if (!addr)
                pr_err("%s:%d Invalid gemac-bus-id....\n", __func__,
-@@ -68,16 +61,55 @@ static int pfe_get_gemac_if_proprties(st
+@@ -62,16 +56,55 @@ static int pfe_get_gemac_if_proprties(st
        else
                pdata->ls1012a_eth_pdata[port].bus_id = be32_to_cpup(addr);
  
@@ -109,7 +109,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
        addr = of_get_property(gem, "fsl,mdio-mux-val", &size);
        if (!addr) {
                pr_err("%s: Invalid mdio-mux-val....\n", __func__);
-@@ -90,33 +122,10 @@ static int pfe_get_gemac_if_proprties(st
+@@ -84,33 +117,10 @@ static int pfe_get_gemac_if_proprties(st
                pfe->mdio_muxval[pdata->ls1012a_eth_pdata[port].phy_id] =
                         pdata->ls1012a_eth_pdata[port].mdio_muxval;
  
@@ -143,7 +143,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
        return 0;
  
  err:
-@@ -218,8 +227,8 @@ static int pfe_platform_probe(struct pla
+@@ -212,8 +222,8 @@ static int pfe_platform_probe(struct pla
        pfe_platform_data.ls1012a_mdio_pdata[0].phy_mask = 0xffffffff;
  
        for (ii = 0; ii < interface_count; ii++) {
index 4c4cf6c0f3bce359e3ecd61b641be3f07e8072ca..fefe863647702351b491b1b98cde5c03d5b971b8 100644 (file)
@@ -250,7 +250,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
  struct ls1012a_pfe_platform_data pfe_platform_data;
  
  static int pfe_get_gemac_if_properties(struct device_node *parent, int port, int
-@@ -64,8 +65,10 @@ static int pfe_get_gemac_if_properties(s
+@@ -59,8 +60,10 @@ static int pfe_get_gemac_if_properties(s
        phy_node = of_parse_phandle(gem, "phy-handle", 0);
        pdata->ls1012a_eth_pdata[port].phy_node = phy_node;
        if (phy_node) {
@@ -261,7 +261,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
                if (of_phy_register_fixed_link(gem) < 0) {
                        pr_err("broken fixed-link specification\n");
                        goto err;
-@@ -73,6 +76,7 @@ static int pfe_get_gemac_if_properties(s
+@@ -68,6 +71,7 @@ static int pfe_get_gemac_if_properties(s
                phy_node = of_node_get(gem);
                pdata->ls1012a_eth_pdata[port].phy_node = phy_node;
        } else if (of_get_property(gem, "fsl,pfe-phy-if-flags", &size)) {
index f1f2483f6fbfe3de817f2bed209c9d8ebfe95f62..32211953a58c434daeede4c253cbf4d49c84351d 100644 (file)
@@ -35,9 +35,9 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
        u8 mac_addr[ETH_ALEN];
 --- a/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
 +++ b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
-@@ -55,13 +55,6 @@ static int pfe_get_gemac_if_properties(s
-                      ETH_ALEN);
-       }
+@@ -50,13 +50,6 @@ static int pfe_get_gemac_if_properties(s
+       of_get_mac_address(gem, pdata->ls1012a_eth_pdata[port].mac_addr);
  
 -      addr = of_get_property(gem, "fsl,gemac-bus-id", &size);
 -      if (!addr)
index fbf13c8ffc4f5c278ea102796130819438c65aa5..74fb01ce0bc43b988762ea797944ec0750d86eba 100644 (file)
@@ -549,7 +549,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
  int pfe_eth_suspend(struct net_device *dev);
 --- a/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
 +++ b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
-@@ -21,31 +21,18 @@
+@@ -21,30 +21,17 @@
  extern bool pfe_use_old_dts_phy;
  struct ls1012a_pfe_platform_data pfe_platform_data;
  
@@ -567,7 +567,6 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
 -      int ii = 0, phy_id = 0;
 +      int phy_id = 0;
        const u32 *addr;
-       const void *mac_addr;
  
 -      for (ii = 0; ii < if_cnt; ii++) {
 -              gem = of_get_next_child(parent, gem);
@@ -588,7 +587,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
  
        pdata->ls1012a_eth_pdata[port].gem_id = port;
  
-@@ -88,14 +75,6 @@ static int pfe_get_gemac_if_properties(s
+@@ -83,14 +70,6 @@ static int pfe_get_gemac_if_properties(s
                if (pdata->ls1012a_eth_pdata[port].phy_flags & GEMAC_NO_PHY)
                        goto done;
  
@@ -603,7 +602,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
        } else {
                pr_info("%s: No PHY or fixed-link\n", __func__);
                return 0;
-@@ -140,7 +119,7 @@ static int pfe_platform_probe(struct pla
+@@ -135,7 +114,7 @@ static int pfe_platform_probe(struct pla
        struct resource res;
        int ii, rc, interface_count = 0, size = 0;
        const u32 *prop;
@@ -612,7 +611,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
        struct clk *pfe_clk;
  
        np = pdev->dev.of_node;
-@@ -224,8 +203,13 @@ static int pfe_platform_probe(struct pla
+@@ -219,8 +198,13 @@ static int pfe_platform_probe(struct pla
        pfe_platform_data.ls1012a_mdio_pdata[0].phy_mask = 0xffffffff;
  
        for (ii = 0; ii < interface_count; ii++) {
@@ -628,7 +627,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
        }
  
        pfe->dev = &pdev->dev;
-@@ -347,8 +331,8 @@ static int pfe_platform_resume(struct de
+@@ -342,8 +326,8 @@ static int pfe_platform_resume(struct de
        for (i = 0; i < (NUM_GEMAC_SUPPORT); i++) {
                netdev = pfe->eth.eth_priv[i]->ndev;
  
index 115685c480618e0e632d1ff1bfc69c25918c9635..c9c3a7a88897044113d2e70b5a912a5d4b0fc5a5 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
 
 --- a/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
 +++ b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
-@@ -148,9 +148,10 @@ static int pfe_platform_probe(struct pla
+@@ -143,9 +143,10 @@ static int pfe_platform_probe(struct pla
        pfe->ddr_phys_baseaddr = res.start;
        pfe->ddr_size = resource_size(&res);
  
@@ -28,7 +28,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
                rc = -ENOMEM;
                goto err_ddr;
        }
-@@ -240,7 +241,7 @@ err_hif_irq:
+@@ -235,7 +236,7 @@ err_hif_irq:
        iounmap(pfe->cbus_baseaddr);
  
  err_axi:
@@ -37,7 +37,7 @@ Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
  
  err_ddr:
        platform_set_drvdata(pdev, NULL);
-@@ -264,7 +265,8 @@ static int pfe_platform_remove(struct pl
+@@ -259,7 +260,8 @@ static int pfe_platform_remove(struct pl
        rc = pfe_remove(pfe);
  
        iounmap(pfe->cbus_baseaddr);
index 2613628d02cd6bc2f17c18eda5de2e9d3a2f29e4..bcc67e869ef3a1e8cc32a45b66d501dc17d5e22c 100644 (file)
@@ -13,12 +13,8 @@ Signed-off-by: Anji Jagarlmudi <anji.jagarlmudi@nxp.com>
 
 --- a/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
 +++ b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
-@@ -29,15 +29,19 @@ static int pfe_get_gemac_if_properties(s
-       int size;
-       int phy_id = 0;
+@@ -31,7 +31,11 @@ static int pfe_get_gemac_if_properties(s
        const u32 *addr;
--      const void *mac_addr;
-+      const u8 *mac_addr;
  
        addr = of_get_property(gem, "reg", &size);
 -      port = be32_to_cpup(addr);