From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Mon, 11 May 2009 17:29:25 -0700 Subject: [U-Boot] [PATCH 2/4] macb: add set_hw_enetaddr support In-Reply-To: <1242023969-13542-2-git-send-email-plagnioj@jcrosoft.com> References: <1242023969-13542-1-git-send-email-plagnioj@jcrosoft.com> <1242023969-13542-2-git-send-email-plagnioj@jcrosoft.com> Message-ID: <4A08C2E5.9000709@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Jean-Christophe PLAGNIOL-VILLARD wrote: > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD > Cc: Ben Warren > Cc: Haavard Skinnemoen > --- > drivers/net/macb.c | 23 +++++++++++++++++------ > 1 files changed, 17 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/macb.c b/drivers/net/macb.c > index 6de0a04..a339730 100644 > --- a/drivers/net/macb.c > +++ b/drivers/net/macb.c > @@ -404,12 +404,25 @@ static int macb_phy_init(struct macb_device *macb) > } > } > > -static int macb_init(struct eth_device *netdev, bd_t *bd) > +static int macb_set_hw_enetaddr(struct eth_device *netdev, bd_t *bd) > { > struct macb_device *macb = to_macb(netdev); > - unsigned long paddr; > u32 hwaddr_bottom; > u16 hwaddr_top; > + > + /* set hardware address */ > + hwaddr_bottom = cpu_to_le32(*((u32 *)netdev->enetaddr)); > + macb_writel(macb, SA1B, hwaddr_bottom); > + hwaddr_top = cpu_to_le16(*((u16 *)(netdev->enetaddr + 4))); > + macb_writel(macb, SA1T, hwaddr_top); > + > + return 0; > +} > + > +static int macb_init(struct eth_device *netdev, bd_t *bd) > +{ > + struct macb_device *macb = to_macb(netdev); > + unsigned long paddr; > int i; > > /* > @@ -439,10 +452,7 @@ static int macb_init(struct eth_device *netdev, bd_t *bd) > macb_writel(macb, TBQP, macb->tx_ring_dma); > > /* set hardware address */ > - hwaddr_bottom = cpu_to_le32(*((u32 *)netdev->enetaddr)); > - macb_writel(macb, SA1B, hwaddr_bottom); > - hwaddr_top = cpu_to_le16(*((u16 *)(netdev->enetaddr + 4))); > - macb_writel(macb, SA1T, hwaddr_top); > + macb_set_hw_enetaddr(netdev, bd); > > /* choose RMII or MII mode. This depends on the board */ > #ifdef CONFIG_RMII > @@ -521,6 +531,7 @@ int macb_eth_initialize(int id, void *regs, unsigned int phy_addr) > netdev->halt = macb_halt; > netdev->send = macb_send; > netdev->recv = macb_recv; > + netdev->set_hw_enetaddr = macb_set_hw_enetaddr; > NAK, since this function pointer doesn't exist due to NAK'ing of part 1 regards, Ben