layerscape: Fix multiple bugs in of_get_mac_address() changes

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 91a52f22a1 ("treewide: backport support for nvmem on non platform devices")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Hauke Mehrtens 2021-08-08 22:50:27 +02:00
parent 4e57f83659
commit e06544bdbe
10 changed files with 24 additions and 30 deletions

View 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;
+ }
+

View 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;

View 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);

View 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:

View 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++) {

View 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)) {

View 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)

View 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;

View 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);

View 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);