net: fm: fix the FMan firmware load offset
PATCH 1/1 net: fm: fix the FMan firmware load offset
When booting from QSPI with TF-A, the FMan firmware is read with spi_flash_read(). This only expects an offset into the flash, but instead a pointer (CFG_SYS_FSL_QSPI_BASE + offset) into the memory was passed.
I'm not sure why this went unnoticed for so long. Maybe the offset is stripped with 3-byte addressing or a 4-byte flash just ignores the upper byte if CONFIG_FSL_QSPI_AHB_FULL_MAP is not set.
Also the non-TFA boot version has the correct offset in spi_flash_read().
Anyway, with CONFIG_FSL_QSPI_AHB_FULL_MAP (only set by default on iMX SoCs which doesn't have fm) set, on a LS1043A I get on a LS1043A:
Fman1: Data at 00000000f9d46630 is not a firmware
because the firmware is read from 2xCFG_SYS_FSL_QSPI_BASE + offset.
To fix it, pass only the flash offset.
--- drivers/net/fm/fm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/fm/fm.c +1 -3
@@ -400,9 +400,7 @@ int fm_init_common(int index, struct ccsr_fman *reg, const char *firmware_name)if (!ucode_flash) {printf ("SF: probe for ucode failed\n" ); }else { - ret =spi_flash_read (ucode_flash, -CONFIG_SYS_FMAN_FW_ADDR + -CFG_SYS_FSL_QSPI_BASE , + ret =spi_flash_read (ucode_flash,CONFIG_SYS_FMAN_FW_ADDR ,CONFIG_SYS_QE_FMAN_FW_LENGTH , addr);if (ret)
Signature · 1 line
2.47.3
Quoted 19 lines
When booting from QSPI with TF-A, the FMan firmware is read with
spi_flash_read(). This only expects an offset into the flash, but instead a pointer (CFG_SYS_FSL_QSPI_BASE+ offset) into the memory was passed.I'm not sure why this went unnoticed for so long. Maybe the offset is stripped with 3-byte addressing or a 4-byte flash just ignores the upper byte if
CONFIG_FSL_QSPI_AHB_FULL_MAPis not set.Also the non-TFA boot version has the correct offset in
spi_flash_read().Anyway, with
CONFIG_FSL_QSPI_AHB_FULL_MAP(only set by default on iMX SoCs which doesn't have fm) set, on a LS1043A I get on a LS1043A:Fman1: Data at
00000000f9d46630is not a firmwarebecause the firmware is read from 2xCFG_SYS_FSL_QSPI_BASE + offset.
Quoted 7 lines
To fix it, pass only the flash offset.
Fixes 382c53f94631 ("net: fm: add TFABOOT support")Signed-off-by Michael Walle <[email protected]>--- drivers/net/fm/fm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Applied to u-boot-net branch for-main [1], thanks!
[1] https://git.u-boot-project.org/u-boot/custodians/u-boot-net/-/commits/for-main
[1/1] net: fm: fix the FMan firmware load offset
commit: bf59c3a24ed3296dea57ecbb2ef0bda84dd25e97
Best regards,
Signature · 1 line
Jerome Forissier <[email protected]>