From: Hauke Mehrtens Date: Sun, 8 Aug 2021 20:50:27 +0000 (+0200) Subject: layerscape: Fix multiple bugs in of_get_mac_address() changes X-Git-Tag: mikrotik~1506 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e06544bdbef8e17445a071162b826d035c3ef742;p=openwrt%2Fstaging%2Fchunkeey.git 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 91a52f22a13d ("treewide: backport support for nvmem on non platform devices") Signed-off-by: Hauke Mehrtens --- diff --git a/target/linux/layerscape/patches-5.4/701-net-0009-dpa-SDK-DPAA-1.x-Ethernet-driver.patch b/target/linux/layerscape/patches-5.4/701-net-0009-dpa-SDK-DPAA-1.x-Ethernet-driver.patch index 215569e406..8dbcb0654f 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0009-dpa-SDK-DPAA-1.x-Ethernet-driver.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0009-dpa-SDK-DPAA-1.x-Ethernet-driver.patch @@ -10514,7 +10514,7 @@ Signed-off-by: Madalin Bucur +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 +}; --- /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 + 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; + } + diff --git a/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch b/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch index 22d6c97a72..72b101bfb0 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0273-net-dsa-ocelot-add-tsn-support-for-felix-switch.patch @@ -658,7 +658,7 @@ Signed-off-by: Xiaoliang Yang 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; diff --git a/target/linux/layerscape/patches-5.4/701-net-0306-staging-fsl_ppfe-eth-resolve-indentation-warning.patch b/target/linux/layerscape/patches-5.4/701-net-0306-staging-fsl_ppfe-eth-resolve-indentation-warning.patch index f57e26688f..d61a448b0b 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0306-staging-fsl_ppfe-eth-resolve-indentation-warning.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0306-staging-fsl_ppfe-eth-resolve-indentation-warning.patch @@ -28,7 +28,7 @@ Signed-off-by: Calvin Johnson --- 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); diff --git a/target/linux/layerscape/patches-5.4/701-net-0307-staging-fsl_ppfe-eth-add-fixed-link-support.patch b/target/linux/layerscape/patches-5.4/701-net-0307-staging-fsl_ppfe-eth-add-fixed-link-support.patch index 298c34a5e8..900a4513fe 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0307-staging-fsl_ppfe-eth-add-fixed-link-support.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0307-staging-fsl_ppfe-eth-add-fixed-link-support.patch @@ -99,7 +99,7 @@ Signed-off-by: Calvin Johnson #include #include #include -@@ -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: diff --git a/target/linux/layerscape/patches-5.4/701-net-0313-staging-fsl_ppfe-eth-reorganize-platform-phy-paramet.patch b/target/linux/layerscape/patches-5.4/701-net-0313-staging-fsl_ppfe-eth-reorganize-platform-phy-paramet.patch index 7d59676781..8a16edf285 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0313-staging-fsl_ppfe-eth-reorganize-platform-phy-paramet.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0313-staging-fsl_ppfe-eth-reorganize-platform-phy-paramet.patch @@ -46,7 +46,7 @@ Signed-off-by: Calvin Johnson 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 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 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++) { diff --git a/target/linux/layerscape/patches-5.4/701-net-0314-staging-fsl_ppfe-eth-support-single-interface-initia.patch b/target/linux/layerscape/patches-5.4/701-net-0314-staging-fsl_ppfe-eth-support-single-interface-initia.patch index 4c4cf6c0f3..fefe863647 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0314-staging-fsl_ppfe-eth-support-single-interface-initia.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0314-staging-fsl_ppfe-eth-support-single-interface-initia.patch @@ -250,7 +250,7 @@ Signed-off-by: Calvin Johnson 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 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)) { diff --git a/target/linux/layerscape/patches-5.4/701-net-0316-staging-fsl_ppfe-eth-remove-unused-code.patch b/target/linux/layerscape/patches-5.4/701-net-0316-staging-fsl_ppfe-eth-remove-unused-code.patch index f1f2483f6f..32211953a5 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0316-staging-fsl_ppfe-eth-remove-unused-code.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0316-staging-fsl_ppfe-eth-remove-unused-code.patch @@ -35,9 +35,9 @@ Signed-off-by: Calvin Johnson 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) diff --git a/target/linux/layerscape/patches-5.4/701-net-0317-staging-fsl_ppfe-eth-separate-mdio-init-from-mac-ini.patch b/target/linux/layerscape/patches-5.4/701-net-0317-staging-fsl_ppfe-eth-separate-mdio-init-from-mac-ini.patch index fbf13c8ffc..74fb01ce0b 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0317-staging-fsl_ppfe-eth-separate-mdio-init-from-mac-ini.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0317-staging-fsl_ppfe-eth-separate-mdio-init-from-mac-ini.patch @@ -549,7 +549,7 @@ Signed-off-by: Calvin Johnson 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 - 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 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 } 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 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 } 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; diff --git a/target/linux/layerscape/patches-5.4/701-net-0320-staging-fsl_ppfe-eth-use-memremap-to-map-RAM-area-us.patch b/target/linux/layerscape/patches-5.4/701-net-0320-staging-fsl_ppfe-eth-use-memremap-to-map-RAM-area-us.patch index 115685c480..c9c3a7a888 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0320-staging-fsl_ppfe-eth-use-memremap-to-map-RAM-area-us.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0320-staging-fsl_ppfe-eth-use-memremap-to-map-RAM-area-us.patch @@ -15,7 +15,7 @@ Signed-off-by: Calvin Johnson --- 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 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 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); diff --git a/target/linux/layerscape/patches-5.4/701-net-0399-staging-fsl_ppfe-eth-Enhance-error-checking-in-platf.patch b/target/linux/layerscape/patches-5.4/701-net-0399-staging-fsl_ppfe-eth-Enhance-error-checking-in-platf.patch index 2613628d02..bcc67e869e 100644 --- a/target/linux/layerscape/patches-5.4/701-net-0399-staging-fsl_ppfe-eth-Enhance-error-checking-in-platf.patch +++ b/target/linux/layerscape/patches-5.4/701-net-0399-staging-fsl_ppfe-eth-Enhance-error-checking-in-platf.patch @@ -13,12 +13,8 @@ Signed-off-by: Anji Jagarlmudi --- 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);