
In message 433C7A66.1000904@orkun.us you wrote:
I was initially thinking to add that functionality to flash_init() of cfi_flash.c. Other flash.c would need to implement the same way. However, there is a way to implement it in flash driver agnostic way.
That's what I had in mind.
I can create a generic flash_protect_init() function (pick a better name if you don't like it) which is called after flash_init() from lib_xxx/board.c files.
Let's call it flash_init_protect().
The implementation of flash_protect_init() would sit in a common file (perhaps in common/flash.c). flash_protect_init() would call flash_protect() for the list provided via CFG_FLASH_PROTECT_LIST (if defined) as well as for U-Boot code and environment areas.
Yes. And here I would not only accept, but appreciate if the default setting could be overwritten using an environment variable so it can be udjusted in the field if something changes later.
This way the feature can be integrated consistently for all flash chip drivers and protection of U-Boot and environment would be standardized (and duplicate code could be removed from cfi_flash.c and other drivers)
Sounds excellent.
Best regards,
Wolfgang Denk