[PATCH 06/14] ARM: Arria10: xload: rework __arria10_load_fpga

Steffen Trumtrar s.trumtrar at pengutronix.de
Mon Jun 17 04:36:28 PDT 2024


When arria10_load_fpga was reworked to try writing the FPGA multiple
times, some decisions where made regarding what is a failure and when to
try it again.
Some of these assumptions turn out to be premature optimizations that
actually make it worse:

  - when a10_fpga_write returns ENOSPC this is not a reason to try
    again. Just try writing the FPGA and see if it succeeds. Try again,
    if that fails.
  - ignore arria10_read_blocks errors (as before)

Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
---
 arch/arm/mach-socfpga/arria10-xload.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/mach-socfpga/arria10-xload.c b/arch/arm/mach-socfpga/arria10-xload.c
index 7b0d6f00fb..d4370945a1 100644
--- a/arch/arm/mach-socfpga/arria10-xload.c
+++ b/arch/arm/mach-socfpga/arria10-xload.c
@@ -368,13 +368,10 @@ static inline int __arria10_load_fpga(void *buf, uint32_t count, uint32_t size)
 	while (count <= size) {
 		ret = a10_fpga_write(buf, SZ_16K);
 		if (ret == -ENOSPC)
-			return -EAGAIN;
+			break;
 
 		count += SZ_16K / SECTOR_SIZE;
 		ret = arria10_read_blocks(buf, count, SZ_16K);
-		// Reading failed, consider this a failed attempt to configure the FPGA and retry
-		if (ret)
-			return -EAGAIN;
 	}
 
 	ret = a10_fpga_write_complete();

-- 
2.43.2




More information about the barebox mailing list