]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: phy: Add support for all targets which requires MANUAL_RELOC
authorMichal Simek <michal.simek@xilinx.com>
Wed, 13 May 2015 10:53:03 +0000 (12:53 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 14 May 2015 07:18:33 +0000 (09:18 +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>
drivers/net/phy/phy.c

index df7e9450c2614a4040ced79d12d0e21238e5f689..600d5a2638278ec5a822b038c77e701244818b6f 100644 (file)
@@ -20,6 +20,8 @@
 #include <linux/err.h>
 #include <linux/compiler.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /* Generic PHY support and helper functions */
 
 /**
@@ -493,6 +495,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;
 }