Patchwork [U-Boot,v2,48/67] net: xilinx_ll_temac: Pull out init of struct eth_ops

login
register
mail settings
Submitter Tomas Hlavacek
Date Nov. 21, 2012, 1:23 p.m.
Message ID <1353504238-11277-49-git-send-email-tmshlvck@gmail.com>
Download mbox | patch
Permalink /patch/200752/
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Comments

Tomas Hlavacek - Nov. 21, 2012, 1:23 p.m.
Add static struct eth_ops and set ops function pointers statically.
Remove setting eth_ops members dynamically.

This is a step toward converting the driver for DM.

Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>
---
 drivers/net/xilinx_ll_temac.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

Patch

diff --git a/drivers/net/xilinx_ll_temac.c b/drivers/net/xilinx_ll_temac.c
index 8f67417..5f52251 100644
--- a/drivers/net/xilinx_ll_temac.c
+++ b/drivers/net/xilinx_ll_temac.c
@@ -282,6 +282,24 @@  static int ll_temac_phy_init(struct eth_device *dev)
 	return 1;
 }
 
+static struct eth_ops ll_temac_ops_sdma = {
+	.init = ll_temac_init,
+	.halt = ll_temac_halt,
+	.write_hwaddr = ll_temac_setup_mac_addr,
+	.recv = ll_temac_recv_sdma,
+	.send = ll_temac_send_sdma
+};
+
+static struct eth_ops ll_temac_ops_fifo = {
+	.init = ll_temac_init,
+	.halt = ll_temac_halt,
+	.write_hwaddr = ll_temac_setup_mac_addr,
+	.recv = ll_temac_recv_fifo,
+	.send = ll_temac_send_fifo
+};
+
+
+
 /*
  * Initialize a single ll_temac devices
  *
@@ -313,9 +331,6 @@  int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf)
 	dev->iobase = devinf->base_addr;
 
 	dev->priv = ll_temac;
-	dev->eo->init = ll_temac_init;
-	dev->eo->halt = ll_temac_halt;
-	dev->eo->write_hwaddr = ll_temac_setup_mac_addr;
 
 	ll_temac->ctrladdr = devinf->ctrl_addr;
 	if (devinf->flags & XILINX_LL_TEMAC_M_SDMA_PLB) {
@@ -334,16 +349,14 @@  int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf)
 		ll_temac->ctrlinit = ll_temac_init_sdma;
 		ll_temac->ctrlhalt = ll_temac_halt_sdma;
 		ll_temac->ctrlreset = ll_temac_reset_sdma;
-		dev->eo->recv = ll_temac_recv_sdma;
-		dev->eo->send = ll_temac_send_sdma;
+		dev->eo = &ll_temac_ops_sdma;
 	} else {
 		ll_temac->in32 = NULL;
 		ll_temac->out32 = NULL;
 		ll_temac->ctrlinit = NULL;
 		ll_temac->ctrlhalt = NULL;
 		ll_temac->ctrlreset = ll_temac_reset_fifo;
-		dev->eo->recv = ll_temac_recv_fifo;
-		dev->eo->send = ll_temac_send_fifo;
+		dev->eo = &ll_temac_ops_fifo;
 	}
 
 	/* Link to specified MDIO bus */