firmware/br-ext-chip-hisilicon/board/hi3516av100/kernel/patches/20-of_mdio.c.patch

33 lines
1.2 KiB
Diff

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 <grant.likely@secretlab.ca>");
MODULE_LICENSE("GPL");
+int higmacphy = 0;
+EXPORT_SYMBOL(higmacphy);
+MODULE_PARM_DESC(higmacphy, "Select phyaddr for higmac driver.\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))
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);
+ }
+ else for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
/* skip already registered PHYs */
if (mdiobus_is_registered_device(mdio, addr))
continue;