From 4af1803d66ad9f991c1ed1a9826dc6a650ede4c5 Mon Sep 17 00:00:00 2001 From: Serhio Date: Sat, 29 Oct 2022 15:25:57 +0300 Subject: [PATCH] Force higmac driver to use specified PHY addr instead of DTS default value (#529) --- .../kernel/patches/20-of_mdio.c.patch | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/br-ext-chip-hisilicon/board/hi3516av100/kernel/patches/20-of_mdio.c.patch b/br-ext-chip-hisilicon/board/hi3516av100/kernel/patches/20-of_mdio.c.patch index a4099533..dea339c8 100644 --- a/br-ext-chip-hisilicon/board/hi3516av100/kernel/patches/20-of_mdio.c.patch +++ b/br-ext-chip-hisilicon/board/hi3516av100/kernel/patches/20-of_mdio.c.patch @@ -1,32 +1,26 @@ -diff --git a/home/goody/of_mdio.c b/output/build/linux-4.9.37/drivers/of/of_mdio.c -index 262281bd..5f338cd6 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -25,6 +25,11 @@ MODULE_AUTHOR("Grant Likely "); MODULE_LICENSE("GPL"); -+int higmacphy = 0; ++int higmacphy = -1; +EXPORT_SYMBOL(higmacphy); -+MODULE_PARM_DESC(higmacphy, "Select phyaddr for higmac driver.\n"); ++MODULE_PARM_DESC(higmacphy, "Force higmac driver to use specified PHY addr instead of DTS default value.\n"); +module_param_named(higmacphy, higmacphy, int, 0600); + /* Extract the clause 22 phy ID from the compatible string of the form * ethernet-phy-idAAAA.BBBB */ static int of_get_phy_id(struct device_node *device, u32 *phy_id) -@@ -248,7 +256,14 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) - if (of_find_property(child, "reg", NULL)) +@@ -233,6 +238,11 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) continue; + } -- for (addr = 0; addr < PHY_MAX_ADDR; addr++) { -+ if (higmacphy>0) { -+ dev_info(&mdio->dev, "higmacphy addr is set in kernel arguments: phy %s at address %i\n", -+ child->name, higmacphy); -+ -+ if (of_mdiobus_child_is_phy(child)) -+ of_mdiobus_register_phy(mdio, child, higmacphy); ++ if (higmacphy != -1) { ++ dev_info(&mdio->dev, "higmac phy addr in %s is set to %i\n", child->name, higmacphy); ++ addr = higmacphy; + } -+ else for (addr = 0; addr < PHY_MAX_ADDR; addr++) { - /* skip already registered PHYs */ - if (mdiobus_is_registered_device(mdio, addr)) - continue; ++ + if (of_mdiobus_child_is_phy(child)) + of_mdiobus_register_phy(mdio, child, addr); + else