[U-Boot] [PATCH] Disable FLASH_AMLV256U support for TOP860 target

TOP860 configuration assumes at most 128 flash sectors. Thus, the AMLV256U flash can't be supported. The existing code could result in memory corruption when writing to the flash_info->start[] array.
Signed-off-by: Vasili Galka vvv444@gmail.com Cc: Wolfgang Denk wd@denx.de --- board/emk/common/flash.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/board/emk/common/flash.c b/board/emk/common/flash.c index ae5777c..4119b3b 100644 --- a/board/emk/common/flash.c +++ b/board/emk/common/flash.c @@ -324,6 +324,7 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info) } break; } +#ifndef CONFIG_TOP860 if ((FPW)addr[FLASH_ID3] == (FPW)AMD_ID_LV256U_2 && (FPW)addr[FLASH_ID4] == (FPW)AMD_ID_LV256U_3) { @@ -337,7 +338,8 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info) } break; } - +#endif + /* fall thru to here ! */ default: printf ("unknown AMD device=%x %x %x",

On Mon, Jun 16, 2014 at 5:41 PM, Vasili Galka vvv444@gmail.com wrote:
TOP860 configuration assumes at most 128 flash sectors. Thus, the AMLV256U flash can't be supported. The existing code could result in memory corruption when writing to the flash_info->start[] array.
Signed-off-by: Vasili Galka vvv444@gmail.com Cc: Wolfgang Denk wd@denx.de
board/emk/common/flash.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/board/emk/common/flash.c b/board/emk/common/flash.c index ae5777c..4119b3b 100644 --- a/board/emk/common/flash.c +++ b/board/emk/common/flash.c @@ -324,6 +324,7 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info) } break; } +#ifndef CONFIG_TOP860 if ((FPW)addr[FLASH_ID3] == (FPW)AMD_ID_LV256U_2 && (FPW)addr[FLASH_ID4] == (FPW)AMD_ID_LV256U_3) { @@ -337,7 +338,8 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info) } break; }
+#endif
/* fall thru to here ! */ default: printf ("unknown AMD device=%x %x %x",
-- 1.7.9
Any review? This was inspired by a a compiler warning. I'm still getting this warning on the latest master.
Best, Vasili

Dear Vasili,
In message CA+gZxsOYLBU18LimMmfP9B-gZaykN=hZtM1FVgpd8p-eEW19bQ@mail.gmail.com you wrote:
TOP860 configuration assumes at most 128 flash sectors. Thus, the AMLV256U flash can't be supported. The existing code could result in memory corruption when writing to the flash_info->start[] array.
Signed-off-by: Vasili Galka vvv444@gmail.com Cc: Wolfgang Denk wd@denx.de
board/emk/common/flash.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/board/emk/common/flash.c b/board/emk/common/flash.c index ae5777c..4119b3b 100644 --- a/board/emk/common/flash.c +++ b/board/emk/common/flash.c @@ -324,6 +324,7 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info) } break; } +#ifndef CONFIG_TOP860 if ((FPW)addr[FLASH_ID3] == (FPW)AMD_ID_LV256U_2 && (FPW)addr[FLASH_ID4] == (FPW)AMD_ID_LV256U_3) { @@ -337,7 +338,8 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info) } break; }
+#endif
/* fall thru to here ! */ default: printf ("unknown AMD device=%x %x %x",
-- 1.7.9
Any review? This was inspired by a a compiler warning. I'm still getting this warning on the latest master.
Sorry, I missed that one.
Would it not be more appropriate to adjust the CONFIG_SYS_MAX_FLASH_SECT setting in "include/configs/TOP860.h"? Or are you 100% sure that there were never be any AMLV256U flash chips fit on a TOP860 board?
Best regards,
Wolfgang Denk
participants (2)
-
Vasili Galka
-
Wolfgang Denk