Two mpfs icicle init fixes
cover Two mpfs icicle init fixes
From: Conor Dooley <[email protected]>
Two fixes for issues that I spotted today while looking into passing a minimal dtb to U-Boot from the first bootloader stage. This minimal dtb had no ethernet nodes, and the code in this patches fell over :\
Cheers,
Conor.
---
CC: Padmarao Begari <[email protected]>
CC: Cyril Jean <[email protected]>
CC: Tom Rini <[email protected]>
CC: Conor Dooley <[email protected]>
CC: [email protected]
Conor Dooley (2):
board: microchip: icicle: correct type for node offset
board: microchip: icicle: make both ethernets optional
board/microchip/mpfs_icicle/mpfs_icicle.c | 25 ++++++++--------------- 1 file changed, 8 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 board: microchip: icicle: correct type for node offset
From: Conor Dooley <[email protected]>
Node offsets returned by libfdt can contain negative error numbers, so the variable type should be "int". As things stand, if the ethernet nodes are not found in the early init callback, the if (node < 0) tests pass and the code errors out while trying to set the local-mac-address for a non-existent node.
--- board/microchip/mpfs_icicle/mpfs_icicle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/microchip/mpfs_icicle/mpfs_icicle.c +1 -1
@@ -72,7 +72,7 @@ int board_early_init_f(void)int board_late_init (void ) {u32 ret; -u32 node; +int node;u8 idx;u8 device_serial_number[16 ] = {0 };unsigned char mac_addr[6 ];
Signature · 1 line
2.43.0
PATCH 2/2 board: microchip: icicle: make both ethernets optional
In reply to Conor DooleyFrom: Conor Dooley <[email protected]>
A given AMP configuration for a board may make either one, or neither of, the ethernet ports available to U-Boot. The Icicle's init code will fail if mac1 is not present, so move it to the optional approach taken for mac0.
--- board/microchip/mpfs_icicle/mpfs_icicle.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)
board/microchip/mpfs_icicle/mpfs_icicle.c +7 -16
@@ -79,18 +79,6 @@ int board_late_init(void)char icicle_mac_addr[20 ];void *blob = (void *)gd->fdt_blob; - node =fdt_path_offset (blob,"/soc/ethernet@20112000" ); -if (node <0 ) { -printf ("No ethernet0 path offset\n" ); -return -ENODEV ; - } - - ret =fdtdec_get_byte_array (blob, node,"local-mac-address" , mac_addr,6 ); -if (ret) { -printf ("No local-mac-address property for ethernet@20112000\n" ); -return -EINVAL ; - } -read_device_serial_number (device_serial_number,16 );/* Update MAC address with device serial number */
@@ -101,10 +89,13 @@ int board_late_init(void) mac_addr[4 ] = device_serial_number[1 ]; mac_addr[5 ] = device_serial_number[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 ; + node =fdt_path_offset (blob,"/soc/ethernet@20112000" ); +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 ] ='[' ;
Signature · 1 line
2.43.0
Re: [PATCH v1 1/2] board: microchip: icicle: correct type for node offset
In reply to Conor DooleyQuoted 8 lines · Conor Dooley
From: Conor Dooley <[email protected]>
Node offsets returned by libfdt can contain negative error numbers, so the variable type should be "int". As things stand, if the ethernet nodes are not found in the early init callback, the if (node < 0) tests pass and the code errors out while trying to set the local-mac-address for a non-existent node.
Quoted 5 lines
Fixes 64413e1b7c ("riscv: Add Microchip MPFS Icicle Kit support")Signed-off-by Conor Dooley <[email protected]>--- board/microchip/mpfs_icicle/mpfs_icicle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH v1 2/2] board: microchip: icicle: make both ethernets optional
In reply to Conor DooleyQuoted 11 lines · Conor Dooley
From: Conor Dooley <[email protected]>
A given AMP configuration for a board may make either one, or neither of, the ethernet ports available to U-Boot. The Icicle's init code will fail if mac1 is not present, so move it to the optional approach taken for mac0.
Signed-off-by Conor Dooley <[email protected]>--- board/microchip/mpfs_icicle/mpfs_icicle.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)