Skip to contentSkip to conversation

net: fm: fix the FMan firmware load offset

PATCH In review Michael Walle 2 participants 2 messages Oct 23 – Nov 6 Network drivers

lore
Share & tools
lore
#0 lore raw

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.

Fixes 382c53f94631 ("net: fm: add TFABOOT support")
---
 drivers/net/fm/fm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/fm/fm.c +1 -3
index 146f3f1fbd3..a2754c1f841 100644
@@ -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
#1 lore raw
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_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.

Quoted 7 lines

To fix it, pass only the flash offset.

Fixes 382c53f94631 ("net: fm: add TFABOOT support")
---
 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]>