
In message 20051225120433.F3F6.LARK@linux.net.cn you wrote:
After reading many board/*/flash.c and writing customer board driver for one of my customer, I think the current flash interface can be improved.
Did you have a look at the cfi_flash driver? This is supposed to replace the custom board/*/flash.c in most cses (i. e. whenever memory footprint requirements are not too limiting).
I suggest adding a subdir $(TOPDIR)/include/flash/ and putting flash chip information here. When you use some kinds of flash chips, just include relevant header files.
I think we should use the cfi_driver instead.
And BTW - a comment on the suggested code:
If we go further, many information in $(TOPDIR)/include/flash.h can be put into these header files.
...
The following is an example of AMD Spansion S29AL016M chip.
...
int FLASH_S29AL016M_T_BYTE_SA[] = { 0x000000, 0x010000, 0x020000, 0x030000, 0x040000, 0x050000, 0x060000, 0x070000,
...
All-capital-names should be reserved for preprocessor variables. It is not acceptable to use these for other variables or function names. It is also not a good idea to have such initializations in a header file which might get included more than once.
Best regards,
Wolfgang Denk