ARM: fdt support: Add usbethaddr as an acceptable MAC
PATCH 1/1 ARM: fdt support: Add usbethaddr as an acceptable MAC
A board that has a USB ethernet device only may set the usbetheraddr and not the ethaddr.
ethaddr will be the default MAC address that is chosen and if that is not populated then the usbethaddr is looked at. If neither are set then then device tree blob is not modified.
--- common/fdt_support.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
common/fdt_support.c +11 -1
@@ -450,8 +450,18 @@ void fdt_fixup_ethernet(void *fdt)if (node <0 )return ; +if (!getenv ("ethaddr" )) { +if (getenv ("usbethaddr" )) { +strcpy (mac,"usbethaddr" ); + }else { +debug ("No ethernet MAC Address defined\n" ); +return ; + } + }else { +strcpy (mac,"ethaddr" ); + } + i =0 ; -strcpy (mac,"ethaddr" );while ((tmp =getenv (mac)) !=NULL ) {sprintf (enet,"ethernet%d" , i); path =fdt_getprop (fdt, node, enet,NULL );
Signature · 1 line
1.7.9.5
PATCH 1/1 ARM: fdt support: Add usbethaddr as an acceptable MAC
Quoted 25 lines · Dan Murphy
A board that has a USB ethernet device only may set the usbetheraddr and not the ethaddr.
ethaddr will be the default MAC address that is chosen and if that is not populated then the usbethaddr is looked at. If neither are set then then device tree blob is not modified.Signed-off-by Dan Murphy <[email protected]>--- common/fdt_support.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)common/fdt_support.c +6
-0@@ -450,8 +450,18 @@ void fdt_fixup_ethernet(void *fdt)if (node <0 )return ; +if (!getenv ("ethaddr" )) { +if (getenv ("usbethaddr" )) { +strcpy (mac,"usbethaddr" ); + }else { +debug ("No ethernet MAC Address defined\n" ); +return ;
common/fdt_support.c void fdt_fixup_ethernet(void *fdt) · line 467
Quoted 10 lines
common/fdt_support.c +5
-1+ } + }else { +strcpy (mac,"ethaddr" ); + } + i =0 ; -strcpy (mac,"ethaddr" );while ((tmp =getenv (mac)) !=NULL ) {sprintf (enet,"ethernet%d" , i); path =fdt_getprop (fdt, node, enet,NULL );
The problem is we may well have both. I think we need to re-work the function slightly to be:
while ((tmp = getenv(mac)) != NULL) {
do_fdt_fixup_ethernet_x(tmp, fdt, node, enet, i)
}
if (getenv("usbethaddr"))
do_fdt_fixup_ethernet_x("usbethaddr", fdt, ...)
Where the name of the new function, and parameter order also makes sense and is complete of course. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131002/0f68cb87/attachment.pgp>
PATCH 1/1 ARM: fdt support: Add usbethaddr as an acceptable MAC
Tom
Quoted 45 lines · Tom Rini
Quoted 25 lines · Dan Murphy
A board that has a USB ethernet device only may set the usbetheraddr and not the ethaddr.
ethaddr will be the default MAC address that is chosen and if that is not populated then the usbethaddr is looked at. If neither are set then then device tree blob is not modified.Signed-off-by Dan Murphy <[email protected]>--- common/fdt_support.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)common/fdt_support.c +6
-0@@ -450,8 +450,18 @@ void fdt_fixup_ethernet(void *fdt)if (node <0 )return ; +if (!getenv ("ethaddr" )) { +if (getenv ("usbethaddr" )) { +strcpy (mac,"usbethaddr" ); + }else { +debug ("No ethernet MAC Address defined\n" ); +return ;common/fdt_support.c void fdt_fixup_ethernet(void *fdt) · line 467
Quoted 10 lines
common/fdt_support.c +5
-1+ } + }else { +strcpy (mac,"ethaddr" ); + } + i =0 ; -strcpy (mac,"ethaddr" );while ((tmp =getenv (mac)) !=NULL ) {sprintf (enet,"ethernet%d" , i); path =fdt_getprop (fdt, node, enet,NULL );The problem is we may well have both. I think we need to re-work the function slightly to be:
while ((tmp = getenv(mac)) != NULL) {
do_fdt_fixup_ethernet_x(tmp, fdt, node, enet, i)
}
if (getenv("usbethaddr"))
do_fdt_fixup_ethernet_x("usbethaddr", fdt, ...)
Quoted 3 lines
Where the name of the new function, and parameter order also makes sense and is complete of course. Thanks!
One issue with this approach is that we don't know which inteface in the dt is usb ethernet and which is not. So correctly assigning the MAC to the correct inteface will be tricky.
But the patch is flawed in the affect is that it does not take into account multiple usbethaddr either. I will rework it for this but I am not sure about the other.
Dan
Signature · 2 lines
------------------ Dan Murphy
PATCH 1/1 ARM: fdt support: Add usbethaddr as an acceptable MAC
Quoted 48 lines · Dan Murphy
Tom
Quoted 45 lines · Tom Rini
Quoted 25 lines · Dan Murphy
A board that has a USB ethernet device only may set the usbetheraddr and not the ethaddr.
ethaddr will be the default MAC address that is chosen and if that is not populated then the usbethaddr is looked at. If neither are set then then device tree blob is not modified.Signed-off-by Dan Murphy <[email protected]>--- common/fdt_support.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)common/fdt_support.c +6
-0@@ -450,8 +450,18 @@ void fdt_fixup_ethernet(void *fdt)if (node <0 )return ; +if (!getenv ("ethaddr" )) { +if (getenv ("usbethaddr" )) { +strcpy (mac,"usbethaddr" ); + }else { +debug ("No ethernet MAC Address defined\n" ); +return ;common/fdt_support.c void fdt_fixup_ethernet(void *fdt) · line 467
Quoted 10 lines
common/fdt_support.c +5
-1+ } + }else { +strcpy (mac,"ethaddr" ); + } + i =0 ; -strcpy (mac,"ethaddr" );while ((tmp =getenv (mac)) !=NULL ) {sprintf (enet,"ethernet%d" , i); path =fdt_getprop (fdt, node, enet,NULL );The problem is we may well have both. I think we need to re-work the function slightly to be:
while ((tmp = getenv(mac)) != NULL) {
do_fdt_fixup_ethernet_x(tmp, fdt, node, enet, i)
}
if (getenv("usbethaddr"))
do_fdt_fixup_ethernet_x("usbethaddr", fdt, ...)
Quoted 7 lines
Quoted 3 lines
Where the name of the new function, and parameter order also makes sense and is complete of course. Thanks!
One issue with this approach is that we don't know which inteface in the dt is usb ethernet and which is not. So correctly assigning the MAC to the correct inteface will be tricky.
Oh, that's true... Maybe I should withdraw my objection, since we're unlikely to really see both in production cases.
Quoted 3 lines
But the patch is flawed in the affect is that it does not take into account multiple usbethaddr either. I will rework it for this but I am not sure about the other.
But we don't support that either, did a quick grep before posting.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131002/cc57040c/attachment.pgp>
PATCH 1/1 ARM: fdt support: Add usbethaddr as an acceptable MAC
Tom
Quoted 55 lines · Tom Rini
Quoted 48 lines · Dan Murphy
Tom
Quoted 45 lines · Tom Rini
Quoted 25 lines · Dan Murphy
A board that has a USB ethernet device only may set the usbetheraddr and not the ethaddr.
ethaddr will be the default MAC address that is chosen and if that is not populated then the usbethaddr is looked at. If neither are set then then device tree blob is not modified.Signed-off-by Dan Murphy <[email protected]>--- common/fdt_support.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)common/fdt_support.c +6
-0@@ -450,8 +450,18 @@ void fdt_fixup_ethernet(void *fdt)if (node <0 )return ; +if (!getenv ("ethaddr" )) { +if (getenv ("usbethaddr" )) { +strcpy (mac,"usbethaddr" ); + }else { +debug ("No ethernet MAC Address defined\n" ); +return ;common/fdt_support.c void fdt_fixup_ethernet(void *fdt) · line 467
Quoted 10 lines
common/fdt_support.c +5
-1+ } + }else { +strcpy (mac,"ethaddr" ); + } + i =0 ; -strcpy (mac,"ethaddr" );while ((tmp =getenv (mac)) !=NULL ) {sprintf (enet,"ethernet%d" , i); path =fdt_getprop (fdt, node, enet,NULL );The problem is we may well have both. I think we need to re-work the function slightly to be:
while ((tmp = getenv(mac)) != NULL) {
do_fdt_fixup_ethernet_x(tmp, fdt, node, enet, i)
}
if (getenv("usbethaddr"))
do_fdt_fixup_ethernet_x("usbethaddr", fdt, ...)Quoted 6 lines
Quoted 3 lines
Where the name of the new function, and parameter order also makes sense and is complete of course. Thanks!
One issue with this approach is that we don't know which inteface in the dt is usb ethernet and which is not. So correctly assigning the MAC to the correct inteface will be tricky.
Quoted 8 lines
Oh, that's true... Maybe I should withdraw my objection, since we're unlikely to really see both in production cases.
Quoted 3 lines
But the patch is flawed in the affect is that it does not take into account multiple usbethaddr either. I will rework it for this but I am not sure about the other.
But we don't support that either, did a quick grep before posting.
Actually we do. If you setenv eth1addr in the enviroment it will try to set it in the dtb for the next ethernet instance.
The other option is to set the ethaddr and then have usbethaddr reference ethaddr and leave this code alone.
Dan
Signature · 2 lines
------------------ Dan Murphy
PATCH 1/1 ARM: fdt support: Add usbethaddr as an acceptable MAC
All
Quoted 64 lines · Dan Murphy
Tom
Quoted 61 lines · Tom Rini
Quoted 48 lines · Dan Murphy
Tom
Quoted 45 lines · Tom Rini
Quoted 25 lines · Dan Murphy
A board that has a USB ethernet device only may set the usbetheraddr and not the ethaddr.
ethaddr will be the default MAC address that is chosen and if that is not populated then the usbethaddr is looked at. If neither are set then then device tree blob is not modified.Signed-off-by Dan Murphy <[email protected]>--- common/fdt_support.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)common/fdt_support.c +6
-0@@ -450,8 +450,18 @@ void fdt_fixup_ethernet(void *fdt)if (node <0 )return ; +if (!getenv ("ethaddr" )) { +if (getenv ("usbethaddr" )) { +strcpy (mac,"usbethaddr" ); + }else { +debug ("No ethernet MAC Address defined\n" ); +return ;common/fdt_support.c void fdt_fixup_ethernet(void *fdt) · line 467
Quoted 10 lines
common/fdt_support.c +5
-1+ } + }else { +strcpy (mac,"ethaddr" ); + } + i =0 ; -strcpy (mac,"ethaddr" );while ((tmp =getenv (mac)) !=NULL ) {sprintf (enet,"ethernet%d" , i); path =fdt_getprop (fdt, node, enet,NULL );The problem is we may well have both. I think we need to re-work the function slightly to be:
while ((tmp = getenv(mac)) != NULL) {
do_fdt_fixup_ethernet_x(tmp, fdt, node, enet, i)
}
if (getenv("usbethaddr"))
do_fdt_fixup_ethernet_x("usbethaddr", fdt, ...)Quoted 6 lines
Quoted 3 lines
Where the name of the new function, and parameter order also makes sense and is complete of course. Thanks!
One issue with this approach is that we don't know which inteface in the dt is usb ethernet and which is not. So correctly assigning the MAC to the correct inteface will be tricky.
Oh, that's true... Maybe I should withdraw my objection, since we're unlikely to really see both in production cases.
Quoted 3 lines
But the patch is flawed in the affect is that it does not take into account multiple usbethaddr either. I will rework it for this but I am not sure about the other.
Quoted 8 lines
Quoted 2 lines
But we don't support that either, did a quick grep before posting.
Actually we do. If you setenv eth1addr in the enviroment it will try to set it in the dtb for the next ethernet instance.
The other option is to set the ethaddr and then have usbethaddr reference ethaddr and leave this code alone.
Dan
Are there additional comments?
I currently do not have a V2 so I am assuming I have addressed all comments.
Please let me know.
Dan
Signature · 2 lines
------------------ Dan Murphy
Quoted 7 lines · Dan Murphy
A board that has a USB ethernet device only may set the usbetheraddr and not the ethaddr.
ethaddr will be the default MAC address that is chosen and if that is not populated then the usbethaddr is looked at. If neither are set then then device tree blob is not modified.Signed-off-by Dan Murphy <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140619/dbb0be25/attachment.pgp>