smc911x: write back the manually set MAC address
PATCH 1/3 smc911x: write back the manually set MAC address
If the MAX address is given by the environment, write it back to the hardware.
--- drivers/net/smc911x.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/smc911x.c +7 -2
@@ -41,8 +41,13 @@ static int smx911x_handle_mac_address(bd_t *bd)unsigned long addrh, addrl;uchar m[6 ]; -/* if the environment has a valid mac address then use it */ -if (!eth_getenv_enetaddr ("ethaddr" , m)) { +if (eth_getenv_enetaddr ("ethaddr" , m)) { +/* if the environment has a valid mac address then use it */ + addrl = m[0 ] | (m[1 ] <<8 ) | (m[2 ] <<16 ) | (m[3 ] <<24 ); + addrh = m[4 ] | (m[5 ] <<8 ); +smc911x_set_mac_csr (ADDRL , addrl); +smc911x_set_mac_csr (ADDRH , addrh); + }else {/* if not, try to get one from the eeprom */ addrh =smc911x_get_mac_csr (ADDRH ); addrl =smc911x_get_mac_csr (ADDRL );
Signature · 1 line
1.6.2.1
PATCH 1/3 smc911x: write back the manually set MAC address
Quoted 2 lines · Daniel Mack
Signed-off-by Daniel Mack <[email protected]>Cc Sascha Hauer <[email protected]>
ping.
Quoted 27 lines
--- drivers/net/smc911x.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)drivers/net/smc911x.c +7
-2@@ -41,8 +41,13 @@ static int smx911x_handle_mac_address(bd_t *bd)unsigned long addrh, addrl;uchar m[6 ]; -/* if the environment has a valid mac address then use it */ -if (!eth_getenv_enetaddr ("ethaddr" , m)) { +if (eth_getenv_enetaddr ("ethaddr" , m)) { +/* if the environment has a valid mac address then use it */ + addrl = m[0 ] | (m[1 ] <<8 ) | (m[2 ] <<16 ) | (m[3 ] <<24 ); + addrh = m[4 ] | (m[5 ] <<8 ); +smc911x_set_mac_csr (ADDRL , addrl); +smc911x_set_mac_csr (ADDRH , addrh); + }else {/* if not, try to get one from the eeprom */ addrh =smc911x_get_mac_csr (ADDRH ); addrl =smc911x_get_mac_csr (ADDRL );Signature · 1 line
1.6.2.1
PATCH 2/3 smc911x: add support for LAN9220
In reply to Daniel Mack--- drivers/net/smc911x.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/smc911x.h +2 -0
@@ -382,6 +382,7 @@ static inline void smc911x_reg_write(u32 addr, u32 val)#define CHIP_9216 0x116a#define CHIP_9217 0x117a#define CHIP_9218 0x118a +#define CHIP_9220 0x9220struct chip_id {u16 id;
@@ -398,6 +399,7 @@ static const struct chip_id chip_ids[] = { { CHIP_9216, "LAN9216" }, { CHIP_9217, "LAN9217" }, { CHIP_9218, "LAN9218" }, + { CHIP_9220, "LAN9220" }, { 0, NULL }, };
Signature · 1 line
1.6.2.1
PATCH 3/3 smc911x: do net reset the chip if no EEPROM is connected
On boards without EEPROMs, don't reset the chip on U-Boot's exit so that the MAC set by environment settings can be used by the OS later.
--- drivers/net/smc911x.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/smc911x.c +2 -0
@@ -225,7 +225,9 @@ int eth_send(volatile void *packet, int length)void eth_halt (void ) { +#ifndef CONFIG_DRIVER_SMC911X_NO_EEPROM smc911x_reset (); +#endif }int eth_rx (void )
Signature · 1 line
1.6.2.1
PATCH 3/3 smc911x: do net reset the chip if no EEPROM is connected
Quoted 2 lines · On Wednesday 08 April 2009 07:23:39 Daniel Mack wrote:
On boards without EEPROMs, don't reset the chip on U-Boot's exit so that the MAC set by environment settings can be used by the OS later.
that isnt how the MAC is passed to the OS ... this change is incorrect
the OS must be able to get the MAC address regardless of the state of the network controller
-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/20090408/04ddc7b5/attachment.pgp
PATCH 3/3 smc911x: do net reset the chip if no EEPROM is connected
Quoted 8 lines · Mike Frysinger
Quoted 2 lines · On Wednesday 08 April 2009 07:23:39 Daniel Mack wrote:
On boards without EEPROMs, don't reset the chip on U-Boot's exit so that the MAC set by environment settings can be used by the OS later.
that isnt how the MAC is passed to the OS ... this change is incorrect
the OS must be able to get the MAC address regardless of the state of the network controller
Not if the MAC is stored in the volatile smc911x registers. Issuing a soft reset flushes these values - if U-Boot does that, the OS has no change getting them.
That's what I saw here and it is also stated in the datasheet.
Daniel
PATCH 3/3 smc911x: do net reset the chip if no EEPROM is connected
Quoted 5 lines · On Wednesday 08 April 2009 20:08:38 Daniel Mack wrote:
Quoted 4 lines · Mike Frysinger
Quoted 2 lines · On Wednesday 08 April 2009 07:23:39 Daniel Mack wrote:
On boards without EEPROMs, don't reset the chip on U-Boot's exit so that the MAC set by environment settings can be used by the OS later.
Quoted 8 lines
Quoted 4 lines
that isnt how the MAC is passed to the OS ... this change is incorrect
the OS must be able to get the MAC address regardless of the state of the network controller
Not if the MAC is stored in the volatile smc911x registers. Issuing a soft reset flushes these values - if U-Boot does that, the OS has no change getting them.
then either your u-boot or your OS is misconfigured and you need to fix that. as clearly stated in docs/README.enetaddr, the environment is the place where mac addresses live when there is no dedicated storage (like an eeprom).
ignoring that, the mac address doesnt magically get programmed. if no network operation was initiated, then the part wouldnt have been programmed anyways, so you're still left with an OS that cant get itself functional.
Quoted 1 line
That's what I saw here and it is also stated in the datasheet.
sounds like the driver and hardware is operating correctly then
-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/20090408/5fb53054/attachment.pgp
PATCH 3/3 smc911x: do net reset the chip if no EEPROM is connected
Quoted 11 lines · Mike Frysinger
Quoted 3 lines
Not if the MAC is stored in the volatile smc911x registers. Issuing a soft reset flushes these values - if U-Boot does that, the OS has no change getting them.
then either your u-boot or your OS is misconfigured and you need to fix that. as clearly stated in docs/README.enetaddr, the environment is the place where mac addresses live when there is no dedicated storage (like an eeprom).
ignoring that, the mac address doesnt magically get programmed. if no network operation was initiated, then the part wouldnt have been programmed anyways, so you're still left with an OS that cant get itself functional.
Ok, true. Thanks for pointing this out.
Daniel
PATCH 3/3 smc911x: do net reset the chip if no EEPROM is connected
Quoted 10 lines · On Tuesday 21 April 2009 07:13:10 Daniel Mack wrote:
Quoted 9 lines · Mike Frysinger
Quoted 3 lines
Not if the MAC is stored in the volatile smc911x registers. Issuing a soft reset flushes these values - if U-Boot does that, the OS has no change getting them.
then either your u-boot or your OS is misconfigured and you need to fix that. as clearly stated in docs/README.enetaddr, the environment is the place where mac addresses live when there is no dedicated storage (like an eeprom).
Quoted 6 lines
Quoted 4 lines
ignoring that, the mac address doesnt magically get programmed. if no network operation was initiated, then the part wouldnt have been programmed anyways, so you're still left with an OS that cant get itself functional.
Ok, true. Thanks for pointing this out.
usually what i suggest to people are things like:
- pass $(ethaddr) via kernel command line and parse /proc/cmdline
- use the u-boot tools to read the u-boot env directly
- set the hw address with ifconfig or similar tool
-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/20090426/1123a06b/attachment.pgp
PATCH 3/3 smc911x: do net reset the chip if no EEPROM is connected
Quoted 16 lines · Mike Frysinger
Quoted 15 lines · On Tuesday 21 April 2009 07:13:10 Daniel Mack wrote:
Quoted 13 lines · Mike Frysinger
Quoted 3 lines
Not if the MAC is stored in the volatile smc911x registers. Issuing a soft reset flushes these values - if U-Boot does that, the OS has no change getting them.
then either your u-boot or your OS is misconfigured and you need to fix that. as clearly stated in docs/README.enetaddr, the environment is the place where mac addresses live when there is no dedicated storage (like an eeprom).
ignoring that, the mac address doesnt magically get programmed. if no network operation was initiated, then the part wouldnt have been programmed anyways, so you're still left with an OS that cant get itself functional.
Quoted 6 lines
Quoted 1 line
Ok, true. Thanks for pointing this out.
usually what i suggest to people are things like:
- pass $(ethaddr) via kernel command line and parse/proc/cmdline
- use the u-boot tools to read the u-boot env directly
- set the hw address withifconfigor similar tool
... which doesn't help much when it's about booting from NFS root. The particular problem here is that the MAC changes from what it's set to in U-Boot during the TFTP transaction and the randomly chosen one in Linux (which takes place because after the reset, the MAC is all 0xff). And that in turn confuses the ARP caches on other hosts. My patch solves that issue for that very case; that's why it's still in my local tree.
Daniel
PATCH 3/3 smc911x: do net reset the chip if no EEPROM is connected
Quoted 17 lines · On Monday 27 April 2009 10:44:16 Daniel Mack wrote:
Quoted 16 lines · Mike Frysinger
Quoted 15 lines · On Tuesday 21 April 2009 07:13:10 Daniel Mack wrote:
Quoted 13 lines · Mike Frysinger
Quoted 3 lines
Not if the MAC is stored in the volatile smc911x registers. Issuing a soft reset flushes these values - if U-Boot does that, the OS has no change getting them.
then either your u-boot or your OS is misconfigured and you need to fix that. as clearly stated in docs/README.enetaddr, the environment is the place where mac addresses live when there is no dedicated storage (like an eeprom).
ignoring that, the mac address doesnt magically get programmed. if no network operation was initiated, then the part wouldnt have been programmed anyways, so you're still left with an OS that cant get itself functional.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Ok, true. Thanks for pointing this out.
usually what i suggest to people are things like:
- pass $(ethaddr) via kernel command line and parse/proc/cmdline
- use the u-boot tools to read the u-boot env directly
- set the hw address withifconfigor similar tool... which doesn't help much when it's about booting from NFS root.
it works fine if you use an initramfs like everyone suggests
-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/20090427/75391343/attachment.pgp
PATCH 3/3 smc911x: do net reset the chip if no EEPROM is connected
Quoted 10 lines · Mike Frysinger
Quoted 7 lines · On Monday 27 April 2009 10:44:16 Daniel Mack wrote:
Quoted 4 lines · Mike Frysinger
usually what i suggest to people are things like:
- pass $(ethaddr) via kernel command line and parse/proc/cmdline
- use the u-boot tools to read the u-boot env directly
- set the hw address withifconfigor similar tool... which doesn't help much when it's about booting from NFS root.
it works fine if you use an initramfs like everyone suggests
Or when you use a device tree. :-)
-Scott
Ben Warren
AppliedPATCH 2/3 smc911x: add support for LAN9220
In reply to Daniel MackQuoted 20 lines · Daniel Mack
Signed-off-by Daniel Mack <[email protected]>Cc Sascha Hauer <[email protected]>--- drivers/net/smc911x.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/net/smc911x.h +1
-0@@ -382,6 +382,7 @@ static inline void smc911x_reg_write(u32 addr, u32 val)#define CHIP_9216 0x116a#define CHIP_9217 0x117a#define CHIP_9218 0x118a +#define CHIP_9220 0x9220struct chip_id {u16 id;
drivers/net/smc911x.h static const struct chip_id chip_ids[] = { · line 405
Quoted 7 lines
drivers/net/smc911x.h +1
-0@@ -398,6 +399,7 @@ static const struct chip_id chip_ids[] = { { CHIP_9216, "LAN9216" }, { CHIP_9217, "LAN9217" }, { CHIP_9218, "LAN9218" }, + { CHIP_9220, "LAN9220" }, { 0, NULL }, };
Applied to net/next branch.
thanks,
Ben
PATCH 1/3 smc911x: write back the manually set MAC address
In reply to Daniel MackQuoted 5 lines · Daniel Mack
If the MAX address is given by the environment, write it back to the hardware.
Signed-off-by Daniel Mack <[email protected]>Cc Sascha Hauer <[email protected]>
Anyway, you shouldn't rely on this. I'm the original author of this driver, but I do not use U-Boot-v1 anymore, so I can't tell if this breaks something or not.
Sascha
Quoted 28 lines
--- drivers/net/smc911x.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)drivers/net/smc911x.c +7
-2@@ -41,8 +41,13 @@ static int smx911x_handle_mac_address(bd_t *bd)unsigned long addrh, addrl;uchar m[6 ]; -/* if the environment has a valid mac address then use it */ -if (!eth_getenv_enetaddr ("ethaddr" , m)) { +if (eth_getenv_enetaddr ("ethaddr" , m)) { +/* if the environment has a valid mac address then use it */ + addrl = m[0 ] | (m[1 ] <<8 ) | (m[2 ] <<16 ) | (m[3 ] <<24 ); + addrh = m[4 ] | (m[5 ] <<8 ); +smc911x_set_mac_csr (ADDRL , addrl); +smc911x_set_mac_csr (ADDRH , addrh); + }else {/* if not, try to get one from the eeprom */ addrh =smc911x_get_mac_csr (ADDRH ); addrl =smc911x_get_mac_csr (ADDRL );Signature · 1 line
1.6.2.1
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH 1/3 smc911x: write back the manually set MAC address
Hi Sascha,
Quoted 4 lines · Sascha Hauer
Quoted 3 lines · Daniel Mack
If the MAX address is given by the environment, write it back to the hardware.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Daniel Mack <[email protected]>Cc Sascha Hauer <[email protected]>Acked-by Sascha Hauer <[email protected]>Anyway, you shouldn't rely on this. I'm the original author of this driver, but I do not use U-Boot-v1 anymore, so I can't tell if this breaks something or not.
No problem. I just Cc'ed all email addresses I could find in the code.
Who will pick that one and the one regarding support for the 9220 controller for mainline?
Thanks,
Daniel
PATCH 1/3 smc911x: write back the manually set MAC address
Hi Daniel,
Quoted 12 lines · Daniel Mack
Hi Sascha,
Quoted 9 lines · Sascha Hauer
Quoted 5 lines · Daniel Mack
If the MAX address is given by the environment, write it back to the hardware.
Signed-off-by Daniel Mack <[email protected]>Cc Sascha Hauer <[email protected]>Acked-by Sascha Hauer <[email protected]>
Quoted 9 lines
Quoted 3 lines
Anyway, you shouldn't rely on this. I'm the original author of this driver, but I do not use U-Boot-v1 anymore, so I can't tell if this breaks something or not.
No problem. I just Cc'ed all email addresses I could find in the code.
Who will pick that one and the one regarding support for the 9220 controller for mainline?
Network drivers are my responsibility. Please CC me in the future as it stands out more clearly. I guess I was waiting on you to resolve 3/3, but instead can pick up parts 1 and 2 if you like.
Quoted 4 lines
Thanks,
Daniel
regards,
Ben
PATCH 1/3 smc911x: write back the manually set MAC address
Quoted 4 lines · Ben Warren
Quoted 4 lines
Quoted 3 lines
Anyway, you shouldn't rely on this. I'm the original author of this driver, but I do not use U-Boot-v1 anymore, so I can't tell if this breaks something or not.
Quoted 8 lines
Quoted 5 lines
No problem. I just Cc'ed all email addresses I could find in the code.
Who will pick that one and the one regarding support for the 9220 controller for mainline?
Network drivers are my responsibility. Please CC me in the future as it stands out more clearly. I guess I was waiting on you to resolve 3/3, but instead can pick up parts 1 and 2 if you like.
I'll try to solve 3/3 in another fashion, so feel free to merge the other two.
Thanks,
Daniel
Ben Warren
AppliedPATCH 1/3 smc911x: write back the manually set MAC address
In reply to Daniel MackQuoted 19 lines · Daniel Mack
If the MAX address is given by the environment, write it back to the hardware.
Signed-off-by Daniel Mack <[email protected]>Cc Sascha Hauer <[email protected]>--- drivers/net/smc911x.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)drivers/net/smc911x.c +0
-2@@ -41,8 +41,13 @@ static int smx911x_handle_mac_address(bd_t *bd)unsigned long addrh, addrl;uchar m[6 ]; -/* if the environment has a valid mac address then use it */ -if (!eth_getenv_enetaddr ("ethaddr" , m)) {
drivers/net/smc911x.c static int smx911x_handle_mac_address(bd_t *bd) · line 53
Quoted 10 lines
drivers/net/smc911x.c +7
-0+if (eth_getenv_enetaddr ("ethaddr" , m)) { +/* if the environment has a valid mac address then use it */ + addrl = m[0 ] | (m[1 ] <<8 ) | (m[2 ] <<16 ) | (m[3 ] <<24 ); + addrh = m[4 ] | (m[5 ] <<8 ); +smc911x_set_mac_csr (ADDRL , addrl); +smc911x_set_mac_csr (ADDRH , addrh); + }else {/* if not, try to get one from the eeprom */ addrh =smc911x_get_mac_csr (ADDRH ); addrl =smc911x_get_mac_csr (ADDRL );
Applied to net/next branch.
thanks,
Ben
PATCH 1/3 smc911x: write back the manually set MAC address
Quoted 18 lines · Ben Warren
Quoted 17 lines · Daniel Mack
If the MAX address is given by the environment, write it back to the hardware.
Signed-off-by Daniel Mack <[email protected]>Cc Sascha Hauer <[email protected]>--- drivers/net/smc911x.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)drivers/net/smc911x.c +0
-0@@ -41,8 +41,13 @@ static int smx911x_handle_mac_address(bd_t *bd)unsigned long addrh, addrl;uchar m[6 ];
Quoted 13 lines
drivers/net/smc911x.c static int smx911x_handle_mac_address(bd_t *bd) · line 53
Quoted 12 lines
drivers/net/smc911x.c +7
-2-/* if the environment has a valid mac address then use it */ -if (!eth_getenv_enetaddr ("ethaddr" , m)) { +if (eth_getenv_enetaddr ("ethaddr" , m)) { +/* if the environment has a valid mac address then use it */ + addrl = m[0 ] | (m[1 ] <<8 ) | (m[2 ] <<16 ) | (m[3 ] <<24 ); + addrh = m[4 ] | (m[5 ] <<8 ); +smc911x_set_mac_csr (ADDRL , addrl); +smc911x_set_mac_csr (ADDRH , addrh); + }else {/* if not, try to get one from the eeprom */ addrh =smc911x_get_mac_csr (ADDRH ); addrl =smc911x_get_mac_csr (ADDRL );Applied to net/next branch.
Could we get this asap into mainline? Sounds like an urgent bugfix to me:
http://lists.denx.de/pipermail/u-boot/2009-May/053079.html
Many thanks
Dirk
PATCH 1/3 smc911x: write back the manually set MAC address
Dear Ben,
Quoted 6 lines · In message <[email protected]> Dirk Behme wrote:
Quoted 6 lines
Quoted 6 lines
If the MAX address is given by the environment, write it back to the hardware.
Signed-off-by Daniel Mack <[email protected]>Cc Sascha Hauer <[email protected]>
...
Quoted 5 lines
Quoted 1 line
Applied to net/next branch.
Could we get this asap into mainline? Sounds like an urgent bugfix to me:
I agree with Dirk here.
Can we pull this into master, please?
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The flow chart is a most thoroughly oversold piece of program docu- mentation. -- Frederick Brooks, "The Mythical Man Month"
PATCH 1/3 smc911x: write back the manually set MAC address
In reply to Daniel MackQuoted 2 lines · On Wednesday 08 April 2009 07:23:37 Daniel Mack wrote:
If the MAX address is given by the environment, write it back to the hardware.
-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/20090505/9257eeff/attachment.pgp