Add AMD 29LV160DB FLASH support to SBC-2410A board.
PATCH 1/1 Add AMD 29LV160DB FLASH support to SBC-2410A board.
Hello,
I'm not sure if this is the proper way to submit a patch - please feel free to let me know what needs to be changed, if anything. Thanks,
Daniel Schuler
===================
The current SBC-2410A board from Embest ships with 2MiB of NOR FLASH, for which CONFIG_AMD_LV160 has been defined in include/configs/sbc2410x.h Also, CONFIG_ENV_ADDR has been made more generic by making it depend on CONFIG_ENV_SIZE, so that only the latter needs to be changed to modify the size of the environment.
In board/sbc2410x/flash.c, the appropriate #elif and case statements have been added to support this chip.
--- board/sbc2410x/flash.c | 6 ++++++ include/configs/sbc2410x.h | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-)
board/sbc2410x/flash.c +6 -0
@@ -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;
include/configs/sbc2410x.h +1 -1
@@ -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,35 @@*/ /* #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 */
+#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_IS_IN_FLASH 1
+#define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */
+#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
*/
Signature · 1 line
1.5.6.3
PATCH 1/1 Add AMD 29LV160DB FLASH support to SBC-2410A board.
Dear Daniel,
Quoted 3 lines · In message <[email protected]> you…
I'm not sure if this is the proper way to submit a patch - please feel free to let me know what needs to be changed, if anything.
It is the proper way, but there are some problems with your patch.
Quoted 4 lines
Daniel Schuler
===================
Such explanations should follow the commit message, i., e. please put these below the "---" line, not above it.
Quoted 2 lines
The current SBC-2410A board from Embest ships with 2MiB of NOR FLASH, for which
CONFIG_AMD_LV160has been defined ininclude/configs/sbc2410x.h
Instead of extending the proprietary flash driver for this board, you should drop it completely and use the CFI flash driver instead. Needed changes are small, and you will get rid of such chip dependen- cies.
Quoted 3 lines
Also,
CONFIG_ENV_ADDRhas been made more generic by making it depend onCONFIG_ENV_SIZE, so that only the latter needs to be changed to modify the size of the environment.
You should configure the environment such that it works with all types of flash chips, so you can use the same binary image of U-Boot on all boards.
Your patch includes also other changes, which are not mentioned in the commit message, and which should (as they are unrelated) be split off into a separate patch.
Quoted 6 lines
In
board/sbc2410x/flash.c, the appropriate #elif and case statements have been added to support this chip.Signed-off-by Daniel Schuler <[email protected]>--- board/sbc2410x/flash.c | 6 ++++++
I really recommend to get rid of this file. Usedrivers/mtd/cfi_flash.c instead.
include/configs/sbc2410x.h line 142
Quoted 8 lines
include/configs/sbc2410x.h +1
-1@@ -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 */
Unrelated change; should be separate patch.
include/configs/sbc2410x.h
Quoted 13 lines
include/configs/sbc2410x.h +0
-0/* it to wrap 100 times (total 1562500) to get 1 sec. */ #define CONFIG_SYS_HZ 1562500@@ -173,29 +173,35 @@*/ /* #define CONFIG_AMD_LV400 1 /\* uncomment this if you have a LV400 flash *\/ */
include/configs/sbc2410x.h +1
-1-#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 *\/ */
include/configs/sbc2410x.h +2
-0+ +#define CONFIG_AMD_LV160 1/* uncomment this if you have a LV160 flash */
I recommend to make the configuration independent of the actual flash chips.
Quoted 6 lines
#define
CONFIG_SYS_MAX_FLASH_BANKS1 /* max number of memory banks */include/configs/sbc2410x.h +3
-0+#ifdef CONFIG_AMD_LV160 +#define PHYS_FLASH_SIZE 0x00200000/* 2MB */ +#define CONFIG_SYS_MAX_FLASH_SECT (35)/* max number of sectors on one chip */
^^^^^^^^^^^^^^^^
and fix your mailer. Your patch is line-wrapped, so it is useless anyway.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "...all the good computer designs are bootlegged; the formally planned products, if they are built at all, are dogs!" - David E. Lundstrom, "A Few Good Men From Univac", MIT Press, 1987