Message ID | 20230607-boneless-evaluator-e681ce74deef@wendy |
---|---|
State | Superseded |
Delegated to: | Andes |
Headers | show |
Series | Sync PolarFire SoC dts with Linux | expand |
> On Wed, 2023-06-07 at 11:06 +0100, Conor Dooley wrote: > The dts sync from Linux leaves mac0/ethernet1 enabled on icicle, but > U-Boot does not currently set a mac address for it. Expand on the > code > which currently sets the mac for mac1/ethernet0 to optionally set the > mac address for the second ethernet. > > Signed-off-by: Conor Dooley <conor.dooley@microchip.com> > --- > board/microchip/mpfs_icicle/mpfs_icicle.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/board/microchip/mpfs_icicle/mpfs_icicle.c > b/board/microchip/mpfs_icicle/mpfs_icicle.c > index e74c9fb03c..b4072acb18 100644 > --- a/board/microchip/mpfs_icicle/mpfs_icicle.c > +++ b/board/microchip/mpfs_icicle/mpfs_icicle.c > @@ -80,7 +80,7 @@ int board_late_init(void) > char icicle_mac_addr[20]; > void *blob = (void *)gd->fdt_blob; > > - node = fdt_path_offset(blob, "ethernet0"); > + node = fdt_path_offset(blob, "/soc/ethernet@20112000"); > if (node < 0) { > printf("No ethernet0 path offset\n"); > return -ENODEV; > @@ -88,7 +88,7 @@ int board_late_init(void) > > ret = fdtdec_get_byte_array(blob, node, "local-mac-address", > mac_addr, 6); > if (ret) { > - printf("No local-mac-address property\n"); > + printf("No local-mac-address property for > ethernet@20112000\n"); > return -EINVAL; > } > > @@ -104,7 +104,7 @@ int board_late_init(void) > > ret = fdt_setprop(blob, node, "local-mac-address", mac_addr, > 6); > if (ret) { > - printf("Error setting local-mac-address property\n"); > + printf("Error setting local-mac-address property for > ethernet@20112000\n"); > return -ENODEV; > } > > @@ -123,6 +123,15 @@ int board_late_init(void) > > mac_addr[5] = device_serial_number[0] + 1; > > + node = fdt_path_offset(blob, "/soc/ethernet@20110000"); > + if (node >= 0) { > + ret = fdt_setprop(blob, node, "local-mac-address", > mac_addr, 6); > + if (ret) { > + printf("Error setting local-mac-address > property for ethernet@20112000\n"); The print error is for ethernet@20110000 not ethernet@20112000. Other than that: Reviewed-by: Padmarao Begari <padmarao.begari@microchip.com> Tested-by: Padmarao Begari <padmarao.begari@microchip.com> > + return -ENODEV; > + } > + } > + > icicle_mac_addr[0] = '['; > > sprintf(&icicle_mac_addr[1], "%pM", mac_addr);
On Tue, Jun 13, 2023 at 05:35:58AM +0000, Padmarao.Begari@microchip.com wrote: > On Wed, 2023-06-07 at 11:06 +0100, Conor Dooley wrote: > > @@ -123,6 +123,15 @@ int board_late_init(void) > > > > mac_addr[5] = device_serial_number[0] + 1; > > > > + node = fdt_path_offset(blob, "/soc/ethernet@20110000"); > > + if (node >= 0) { > > + ret = fdt_setprop(blob, node, "local-mac-address", > > mac_addr, 6); > > + if (ret) { > > + printf("Error setting local-mac-address > > property for ethernet@20112000\n"); > The print error is for ethernet@20110000 not ethernet@20112000. Ah, good spot, thanks. I'll fix that up and resubmit. Thanks, Conor.
diff --git a/board/microchip/mpfs_icicle/mpfs_icicle.c b/board/microchip/mpfs_icicle/mpfs_icicle.c index e74c9fb03c..b4072acb18 100644 --- a/board/microchip/mpfs_icicle/mpfs_icicle.c +++ b/board/microchip/mpfs_icicle/mpfs_icicle.c @@ -80,7 +80,7 @@ int board_late_init(void) char icicle_mac_addr[20]; void *blob = (void *)gd->fdt_blob; - node = fdt_path_offset(blob, "ethernet0"); + node = fdt_path_offset(blob, "/soc/ethernet@20112000"); if (node < 0) { printf("No ethernet0 path offset\n"); return -ENODEV; @@ -88,7 +88,7 @@ int board_late_init(void) ret = fdtdec_get_byte_array(blob, node, "local-mac-address", mac_addr, 6); if (ret) { - printf("No local-mac-address property\n"); + printf("No local-mac-address property for ethernet@20112000\n"); return -EINVAL; } @@ -104,7 +104,7 @@ int board_late_init(void) ret = fdt_setprop(blob, node, "local-mac-address", mac_addr, 6); if (ret) { - printf("Error setting local-mac-address property\n"); + printf("Error setting local-mac-address property for ethernet@20112000\n"); return -ENODEV; } @@ -123,6 +123,15 @@ int board_late_init(void) mac_addr[5] = device_serial_number[0] + 1; + node = fdt_path_offset(blob, "/soc/ethernet@20110000"); + if (node >= 0) { + ret = fdt_setprop(blob, node, "local-mac-address", mac_addr, 6); + if (ret) { + printf("Error setting local-mac-address property for ethernet@20112000\n"); + return -ENODEV; + } + } + icicle_mac_addr[0] = '['; sprintf(&icicle_mac_addr[1], "%pM", mac_addr);
The dts sync from Linux leaves mac0/ethernet1 enabled on icicle, but U-Boot does not currently set a mac address for it. Expand on the code which currently sets the mac for mac1/ethernet0 to optionally set the mac address for the second ethernet. Signed-off-by: Conor Dooley <conor.dooley@microchip.com> --- board/microchip/mpfs_icicle/mpfs_icicle.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)