]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
net: phy: Add support for all targets which requires MANUAL_RELOC
authorMichal Simek <michal.simek@xilinx.com>
Wed, 13 May 2015 11:40:40 +0000 (13:40 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:43:14 +0000 (22:43 +0200)
Targets with CONFIG_NEEDS_MANUAL_RELOC do not use REL/RELA
relocation (mostly only GOT) where functions aray are not
updated. This patch is fixing function pointers passed to phy_register
function.
This patch was tested on Microblaze architecture.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/phy/phy.c

index 9e6bca3f6f50734ba63e4f616009c0a0bc7b96a1..444ca9c98e4e45f2e92f5a7a0090390a4b90539e 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/err.h>
 #include <linux/compiler.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /* Generic PHY support and helper functions */
 
 /**
@@ -519,6 +521,20 @@ int phy_register(struct phy_driver *drv)
        INIT_LIST_HEAD(&drv->list);
        list_add_tail(&drv->list, &phy_drivers);
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+       if (drv->probe)
+               drv->probe += gd->reloc_off;
+       if (drv->config)
+               drv->config += gd->reloc_off;
+       if (drv->startup)
+               drv->startup += gd->reloc_off;
+       if (drv->shutdown)
+               drv->shutdown += gd->reloc_off;
+       if (drv->readext)
+               drv->readext += gd->reloc_off;
+       if (drv->writeext)
+               drv->writeext += gd->reloc_off;
+#endif
        return 0;
 }