* [U-Boot] macb: get mac address from environment
@ 2009-07-11 23:05 Andrzej Wolski
2009-07-12 1:09 ` Mike Frysinger
0 siblings, 1 reply; 5+ messages in thread
From: Andrzej Wolski @ 2009-07-11 23:05 UTC (permalink / raw)
To: u-boot
This fix macb driver broken by commit
56b555a644f3cbb1b3929cb52b61d3ce483885f5
Signed-off-by: Andrzej Wolski <awolski@poczta.fm>
---
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 6de0a04..0d2ef5e 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -408,8 +408,7 @@ static int macb_init(struct eth_device *netdev, bd_t
*bd)
{
struct macb_device *macb = to_macb(netdev);
unsigned long paddr;
- u32 hwaddr_bottom;
- u16 hwaddr_top;
+ uchar enetaddr[6];
int i;
/*
@@ -439,10 +438,10 @@ 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);
+ eth_getenv_enetaddr("ethaddr", enetaddr);
+ macb_writel(macb, SA1B, (enetaddr[3] << 24) | (enetaddr[2] << 16)
+ | (enetaddr[1] << 8) | (enetaddr[0]));
+ macb_writel(macb, SA1T, (enetaddr[5] << 8) | (enetaddr[4]));
/* choose RMII or MII mode. This depends on the board */
#ifdef CONFIG_RMII
--
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] macb: get mac address from environment
2009-07-11 23:05 [U-Boot] macb: get mac address from environment Andrzej Wolski
@ 2009-07-12 1:09 ` Mike Frysinger
2009-07-12 2:27 ` Andrzej Wolski
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2009-07-12 1:09 UTC (permalink / raw)
To: u-boot
On Saturday 11 July 2009 19:05:40 Andrzej Wolski wrote:
> This fix macb driver broken by commit
> 56b555a644f3cbb1b3929cb52b61d3ce483885f5
what exactly broke ? drivers that are ported to NET_MULTI should *not* be
getting the mac from the environment. and from what i can see, the macb
driver is properly supporting the NET_MULTI setup.
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -408,8 +408,7 @@ static int macb_init(struct eth_device *netdev, bd_t
> *bd)
> {
> struct macb_device *macb = to_macb(netdev);
> unsigned long paddr;
> - u32 hwaddr_bottom;
> - u16 hwaddr_top;
> + uchar enetaddr[6];
> int i;
>
> /*
> @@ -439,10 +438,10 @@ 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);
> + eth_getenv_enetaddr("ethaddr", enetaddr);
> + macb_writel(macb, SA1B, (enetaddr[3] << 24) | (enetaddr[2] << 16)
> + | (enetaddr[1] << 8) | (enetaddr[0]));
> + macb_writel(macb, SA1T, (enetaddr[5] << 8) | (enetaddr[4]));
>
> /* choose RMII or MII mode. This depends on the board */
> #ifdef CONFIG_RMII
looks to me like the existing code is correct and your new proposed code is
not
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090711/57d46a57/attachment.pgp
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot] macb: get mac address from environment
2009-07-12 1:09 ` Mike Frysinger
@ 2009-07-12 2:27 ` Andrzej Wolski
2009-07-12 3:23 ` Mike Frysinger
0 siblings, 1 reply; 5+ messages in thread
From: Andrzej Wolski @ 2009-07-12 2:27 UTC (permalink / raw)
To: u-boot
> On Saturday 11 July 2009 19:05:40 Andrzej Wolski wrote:
>> This fix macb driver broken by commit
>> 56b555a644f3cbb1b3929cb52b61d3ce483885f5
>
> what exactly broke ? drivers that are ported to NET_MULTI should *not* be
> getting the mac from the environment. and from what i can see, the macb
> driver is properly supporting the NET_MULTI setup.
>
> looks to me like the existing code is correct and your new proposed code is
> not
Hmm. Since pointed commit Ethernet just stopped to work, at least on my
board similar to SAM9260EK. Maybe someone else can confirm it?
Moreover, since that patch, when ethaddr is not set in the environment,
and I set it from command line, I get this while trying to ping:
U-Boot> ping 192.168.2.1
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
*** ERROR: `ethaddr' not set
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
ping failed; host 192.168.2.1 is not alive
Andrzej
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] macb: get mac address from environment
2009-07-12 2:27 ` Andrzej Wolski
@ 2009-07-12 3:23 ` Mike Frysinger
2009-07-12 12:05 ` Andrzej Wolski
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2009-07-12 3:23 UTC (permalink / raw)
To: u-boot
On Saturday 11 July 2009 22:27:36 Andrzej Wolski wrote:
> > On Saturday 11 July 2009 19:05:40 Andrzej Wolski wrote:
> >> This fix macb driver broken by commit
> >> 56b555a644f3cbb1b3929cb52b61d3ce483885f5
> >
> > what exactly broke ? drivers that are ported to NET_MULTI should *not*
> > be getting the mac from the environment. and from what i can see, the
> > macb driver is properly supporting the NET_MULTI setup.
> >
> > looks to me like the existing code is correct and your new proposed code
> > is not
>
> Hmm. Since pointed commit Ethernet just stopped to work, at least on my
> board similar to SAM9260EK. Maybe someone else can confirm it?
>
> Moreover, since that patch, when ethaddr is not set in the environment,
> and I set it from command line, I get this while trying to ping:
>
> U-Boot> ping 192.168.2.1
> macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
> *** ERROR: `ethaddr' not set
> macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
> ping failed; host 192.168.2.1 is not alive
do you have CONFIG_NET_MULTI defined ? if not, your board needs to switch
over to it.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090711/2b70f245/attachment.pgp
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] macb: get mac address from environment
2009-07-12 3:23 ` Mike Frysinger
@ 2009-07-12 12:05 ` Andrzej Wolski
0 siblings, 0 replies; 5+ messages in thread
From: Andrzej Wolski @ 2009-07-12 12:05 UTC (permalink / raw)
To: u-boot
>>>> This fix macb driver broken by commit
>>>> 56b555a644f3cbb1b3929cb52b61d3ce483885f5
>>> what exactly broke ? drivers that are ported to NET_MULTI should *not*
>>> be getting the mac from the environment. and from what i can see, the
>>> macb driver is properly supporting the NET_MULTI setup.
>>>
>>> looks to me like the existing code is correct and your new proposed code
>>> is not
>> Hmm. Since pointed commit Ethernet just stopped to work, at least on my
>> board similar to SAM9260EK. Maybe someone else can confirm it?
>>
>> Moreover, since that patch, when ethaddr is not set in the environment,
>> and I set it from command line, I get this while trying to ping:
>>
>> U-Boot> ping 192.168.2.1
>> macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
>> *** ERROR: `ethaddr' not set
>> macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
>> ping failed; host 192.168.2.1 is not alive
>
> do you have CONFIG_NET_MULTI defined ? if not, your board needs to switch
> over to it.
> -mike
I use configuration for at91sam9260ek board already present in U-Boot
and CONFIG_NET_MULTI is defined there.
Andrzej
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-12 12:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-11 23:05 [U-Boot] macb: get mac address from environment Andrzej Wolski
2009-07-12 1:09 ` Mike Frysinger
2009-07-12 2:27 ` Andrzej Wolski
2009-07-12 3:23 ` Mike Frysinger
2009-07-12 12:05 ` Andrzej Wolski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox