From patchwork Fri Nov 2 17:18:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot, RFC, 49/50] net: xilinx_ll_temac: Pull out init of struct eth_ops Date: Fri, 02 Nov 2012 07:18:41 -0000 From: Tomas Hlavacek X-Patchwork-Id: 196669 Message-Id: <1351876722-5183-50-git-send-email-tmshlvck@gmail.com> To: u-boot@lists.denx.de Cc: marex@denx.de 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 --- drivers/net/xilinx_ll_temac.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) 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 */