diff mbox

[U-Boot] dm: net: Fix DM for targets which use MANUAL_RELOC

Message ID b81501500d0bcc9dd602f2676d51388c30a08de6.1449834390.git.michal.simek@xilinx.com
State Accepted
Delegated to: Joe Hershberger
Headers show

Commit Message

Michal Simek Dec. 11, 2015, 11:46 a.m. UTC
All ethernet operation needs to be updated for architectures which
requires MANUAL_RELOC.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 net/eth.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Joe Hershberger Dec. 15, 2015, 5:53 p.m. UTC | #1
On Fri, Dec 11, 2015 at 5:46 AM, Michal Simek <michal.simek@xilinx.com> wrote:
> All ethernet operation needs to be updated for architectures which
> requires MANUAL_RELOC.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff mbox

Patch

diff --git a/net/eth.c b/net/eth.c
index c542f4aa3b3b..6cf3a353a347 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -541,6 +541,34 @@  static int eth_post_probe(struct udevice *dev)
 	struct eth_pdata *pdata = dev->platdata;
 	unsigned char env_enetaddr[6];
 
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
+	struct eth_ops *ops = eth_get_ops(dev);
+	static int reloc_done;
+
+	if (!reloc_done) {
+		if (ops->start)
+			ops->start += gd->reloc_off;
+		if (ops->send)
+			ops->send += gd->reloc_off;
+		if (ops->recv)
+			ops->recv += gd->reloc_off;
+		if (ops->free_pkt)
+			ops->free_pkt += gd->reloc_off;
+		if (ops->stop)
+			ops->stop += gd->reloc_off;
+#ifdef CONFIG_MCAST_TFTP
+		if (ops->mcast)
+			ops->mcast += gd->reloc_off;
+#endif
+		if (ops->write_hwaddr)
+			ops->write_hwaddr += gd->reloc_off;
+		if (ops->read_rom_hwaddr)
+			ops->read_rom_hwaddr += gd->reloc_off;
+
+		reloc_done++;
+	}
+#endif
+
 	priv->state = ETH_STATE_INIT;
 
 	/* Check if the device has a MAC address in ROM */