
On Wed, Jun 1, 2011 at 6:59 PM, Frank Svendsbøe frank.svendsboe@gmail.com wrote:
On Wed, Jun 1, 2011 at 5:34 PM, Stefan Roese sr@denx.de wrote:
Hi Frank,
On Wednesday 01 June 2011 16:33:14 Frank Svendsbøe wrote:
Simply because disabling write-protection is not impossible after installation. Our device will be located 3000m below sea level.
I see.
Hmm.. then you read my mind :) I meant to say "is not possible" and not "is not impossible" :)
Yep. I read so fast, that I didn't catch the misspelled words. ;)
Thanks, this worked for me. Is it ok for you too?
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 6039e1f..99360af 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -176,6 +176,7 @@ u64 flash_read64(void *addr)__attribute__((weak, alias("__flash_read64"))); #define flash_read64 __flash_read64 #endif
Don't add this empty line.
Thanks for spotting this. I'll remove this of course.
/*----------------------------------------------------------------------- */ #if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) @@ -2151,7 +2152,8 @@ void flash_protect_default(void) #endif }
-unsigned long flash_init (void) +unsigned long flash_init(void) __attribute__((weak, alias("__flash_init"))); +unsigned long __flash_init (void) { unsigned long size = 0; int i;
Looks good. I have no objections. Please go ahead and send this as a "proper" patch.
Will do (as soon as I get back to work).
Best regards, Frank.
Hi Stefan, A few weeks ago, I applied this change and everything worked fine in U-Boot. However, I didn't succeed doing the same hack in Linux. I've done some hardcoding experiments in drivers/mtd/chips/cfi_probe.c, but so far no success. After reading some CFI manuals, it seems CFI will/should use bus write operations even during CFI read operations. Can you confirm this? Then my next question is how come U-Boot read operations works by just hardcoding the flash geometry. It seems U-Boot utilize just plain localbus accesses to read flash data, ie. not the "CFI protocol". What did I miss here.. ?
Now I'm considering two options: 1) Either write a custom flash map driver, and access the flash the same way U-Boot does, or 2) try to convince the FPGA designers that our way of forcing write protection is not according the the CFI specifications, and should be done otherwise. What do you think is the best solution?
Is there anybody else out there supporting hardware write protection on CFI devices?
Best regards, Frank