[U-Boot] [PATCH] Add AMD 29LV160DB FLASH support to SBC2410 board.

The new SBC-2410A board from Embest now ships with 2MB NOR FLASH, for which CONFIG_AMD_LV160 has been defined in include/configs/sbc2410x.h
This chip is already supported in other architectures, so AMD_ID_LV160B has been used as-is in board/sbc2410x/flash.c
Signed-off-by: Daniel Schuler dbschuler@gmail.com --- board/sbc2410x/flash.c | 6 ++++++ include/configs/sbc2410x.h | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/board/sbc2410x/flash.c b/board/sbc2410x/flash.c index abb0935..81aa9e8 100644 --- a/board/sbc2410x/flash.c +++ b/board/sbc2410x/flash.c @@ -69,6 +69,9 @@ ulong flash_init (void) #elif defined(CONFIG_AMD_LV800) (AMD_MANUFACT & FLASH_VENDMASK) | (AMD_ID_LV800B & FLASH_TYPEMASK); +#elif defined(CONFIG_AMD_LV160) + (AMD_MANUFACT & FLASH_VENDMASK) | + (AMD_ID_LV160B & FLASH_TYPEMASK); #else #error "Unknown flash configured" #endif @@ -142,6 +145,9 @@ void flash_print_info (flash_info_t * info) case (AMD_ID_LV800B & FLASH_TYPEMASK): printf ("1x Amd29LV800BB (8Mbit)\n"); break; + case (AMD_ID_LV160B & FLASH_TYPEMASK): + printf ("1x Amd29LV160DB (16Mbit)\n"); + break; default: printf ("Unknown Chip Type\n"); goto Done; diff --git a/include/configs/sbc2410x.h b/include/configs/sbc2410x.h index d7a6ae4..944d85b 100644 --- a/include/configs/sbc2410x.h +++ b/include/configs/sbc2410x.h @@ -139,7 +139,7 @@
#define CONFIG_SYS_LOAD_ADDR 0x33000000 /* default load address */
-/* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need */ +/* the PWM Timer 4 uses a counter of 15625 for 10 ms, so we need */ /* it to wrap 100 times (total 1562500) to get 1 sec. */ #define CONFIG_SYS_HZ 1562500
@@ -173,29 +173,36 @@ */ /* #define CONFIG_AMD_LV400 1 /* uncomment this if you have a LV400 flash */ */
-#define CONFIG_AMD_LV800 1 /* uncomment this if you have a LV800 flash */ +/* #define CONFIG_AMD_LV800 1 /* uncomment this if you have a LV800 flash */ */ + +#define CONFIG_AMD_LV160 1 /* uncomment this if you have a LV160 flash */
#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */
+#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */ + +#ifdef CONFIG_AMD_LV160 +#define PHYS_FLASH_SIZE 0x00200000 /* 2MB */ +#define CONFIG_SYS_MAX_FLASH_SECT (35) /* max number of sectors on one chip */ +#endif + #ifdef CONFIG_AMD_LV800 #define PHYS_FLASH_SIZE 0x00100000 /* 1MB */ #define CONFIG_SYS_MAX_FLASH_SECT (19) /* max number of sectors on one chip */ -#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x0F0000) /* addr of environment */ #endif
#ifdef CONFIG_AMD_LV400 #define PHYS_FLASH_SIZE 0x00080000 /* 512KB */ #define CONFIG_SYS_MAX_FLASH_SECT (11) /* max number of sectors on one chip */ -#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x070000) /* addr of environment */ #endif
+#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + PHYS_FLASH_SIZE - CONFIG_ENV_SIZE) /* starting addr of environment */ + /* timeout values are in ticks */ #define CONFIG_SYS_FLASH_ERASE_TOUT (5*CONFIG_SYS_HZ) /* Timeout for Flash Erase */ #define CONFIG_SYS_FLASH_WRITE_TOUT (5*CONFIG_SYS_HZ) /* Timeout for Flash Write */
-#define CONFIG_ENV_IS_IN_FLASH 1 -#define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */ - /*----------------------------------------------------------------------- * NAND flash settings */ -- 1.5.6.3

Dear "Daniel Schuler",
In message 7909dbcf0812292347x63b36946r7b7feb90dcbb5a6b@mail.gmail.com you wrote:
The new SBC-2410A board from Embest now ships with 2MB NOR FLASH, for which CONFIG_AMD_LV160 has been defined in include/configs/sbc2410x.h
This chip is already supported in other architectures, so AMD_ID_LV160B has been used as-is in board/sbc2410x/flash.c
Signed-off-by: Daniel Schuler dbschuler@gmail.com
board/sbc2410x/flash.c | 6 ++++++ include/configs/sbc2410x.h | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-)
Your patch has been corrupted by your mailer which wrapped long lines.
But I also think that's the wrong approach. Instead of spending (or more precisely wasting) efforts on that old custom flash driver you should change the code to use the generic CFI driver instead.
Thanks.
Best regards,
Wolfgang Denk
participants (2)
-
Daniel Schuler
-
Wolfgang Denk