* RE: Unlocking flash problem with the epxa10db device [not found] <3D8A91C3.5030404@calimatech.com> @ 2002-09-20 4:52 ` Christopher Hoover 2002-09-20 13:52 ` Louie Boczek 0 siblings, 1 reply; 3+ messages in thread From: Christopher Hoover @ 2002-09-20 4:52 UTC (permalink / raw) To: 'Louie Boczek', 'ARM Linux kernel Mailinglist'; +Cc: linux-mtd I wrote cfi_intelext_varsize_frob(). It is behaving as intended. You have to unlock/lock/erase/etc. an *entire* block/sector at a time. There's no way to unlock 4 bytes and leave the other (erasesize - 4) bytes locked. So the function returns EINVAL if the size isn't an even "multiple" of the block size(s). ("Multiple" here is not meant strictly in the mathematical sense; consider variably-sized blocks.) You'll find the other functions behave identically, e.g. erase. -ch -----Original Message----- From: linux-arm-kernel-admin@lists.arm.linux.org.uk [mailto:linux-arm-kernel-admin@lists.arm.linux.org.uk] On Behalf Of Louie Boczek Sent: Thursday, September 19, 2002 8:11 PM To: ARM Linux kernel Mailinglist Subject: Unlocking flash problem with the epxa10db device I just started working with the Altera Excalibur board and ran into the following problem. I was not able to write to the flash and found the problem lied in the unlocking code. In the epxa10db-flash.c:epxa10db_mtd_init() routine it calls: mymtd->unlock(mymtd, mymtd->eraseregions[i].offset + j * mymtd->eraseregions[i].erasesize, 4); which eventually calls "cfi_cmdsetc_001.c:cfi_intelext_varsize_frob()" in this routine there is a check to make sure that the region being unlocked is the whole region with the check: if ((ofs + len) & (regions[i].erasesize -1)) return -EINVAL; this fails since the call was only to unlock 4 bytes not erasesize. So I fixed the problem by changing the call to mymtd->unlock() to pass the erasesize instead of 4. But the question is, should "cfi_intelext_varsize_frob()" check to see if the whole region is specifed or should it unlock the region that the specified location is located. I think the later. I am using the linux-2.4.18-rmk7 but I also checked linux-2.4.19 and the problem is also there. I am new to this, I hope I gave enough and thorough informartion. thanks louie ------------------------------------------------------------------- Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel FAQ/Etiquette: http://www.arm.linux.org.uk/armlinux/mailinglists.php ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Unlocking flash problem with the epxa10db device 2002-09-20 4:52 ` Unlocking flash problem with the epxa10db device Christopher Hoover @ 2002-09-20 13:52 ` Louie Boczek 2002-09-20 14:14 ` Clive Davies 0 siblings, 1 reply; 3+ messages in thread From: Louie Boczek @ 2002-09-20 13:52 UTC (permalink / raw) To: Christopher Hoover; +Cc: 'ARM Linux kernel Mailinglist', linux-mtd Sounds good to me. I could have gone either way. So I actually fixed it the way you want. On a side note, is there any reason that the entire flash is unlocked on boot instead of just the filesystem. I am referencing the unlock code in epxa10db-flash.c. thanks louie Christopher Hoover wrote: >I wrote cfi_intelext_varsize_frob(). It is behaving as intended. > >You have to unlock/lock/erase/etc. an *entire* block/sector at a time. > >There's no way to unlock 4 bytes and leave the other (erasesize - 4) >bytes locked. So the function returns EINVAL if the size isn't an even >"multiple" of the block size(s). ("Multiple" here is not meant strictly >in the mathematical sense; consider variably-sized blocks.) > >You'll find the other functions behave identically, e.g. erase. > >-ch > > >-----Original Message----- >From: linux-arm-kernel-admin@lists.arm.linux.org.uk >[mailto:linux-arm-kernel-admin@lists.arm.linux.org.uk] On Behalf Of >Louie Boczek >Sent: Thursday, September 19, 2002 8:11 PM >To: ARM Linux kernel Mailinglist >Subject: Unlocking flash problem with the epxa10db device > > >I just started working with the Altera Excalibur board and ran into the >following problem. > >I was not able to write to the flash and found the problem lied in the >unlocking code. >In the epxa10db-flash.c:epxa10db_mtd_init() routine it calls: > > mymtd->unlock(mymtd, mymtd->eraseregions[i].offset + j * >mymtd->eraseregions[i].erasesize, 4); > >which eventually calls "cfi_cmdsetc_001.c:cfi_intelext_varsize_frob()" >in this routine there is a check to make sure that the region being >unlocked is the whole region with the check: > if ((ofs + len) & (regions[i].erasesize -1)) > return -EINVAL; > >this fails since the call was only to unlock 4 bytes not erasesize. So >I fixed the problem by changing the call to mymtd->unlock() to pass the > >erasesize instead of 4. > >But the question is, should "cfi_intelext_varsize_frob()" check to see >if the whole region is specifed or should it unlock the region that the >specified location is located. I think the later. > >I am using the linux-2.4.18-rmk7 but I also checked linux-2.4.19 and the > >problem is also there. > > >I am new to this, I hope I gave enough and thorough informartion. > >thanks >louie > > >------------------------------------------------------------------- >Subscription options: >http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel >FAQ/Etiquette: >http://www.arm.linux.org.uk/armlinux/mailinglists.php > > > > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Unlocking flash problem with the epxa10db device 2002-09-20 13:52 ` Louie Boczek @ 2002-09-20 14:14 ` Clive Davies 0 siblings, 0 replies; 3+ messages in thread From: Clive Davies @ 2002-09-20 14:14 UTC (permalink / raw) To: Louie Boczek, Christopher Hoover Cc: 'ARM Linux kernel Mailinglist', linux-mtd > On a side note, is there any reason that the entire flash is unlocked on > boot instead of just the filesystem. I am referencing the unlock code > in epxa10db-flash.c. > Not really, I didn't feel that the flash locking added much so I just unlocked the whole flash at boot time and forgot about it. Clive ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-09-20 14:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <3D8A91C3.5030404@calimatech.com>
2002-09-20 4:52 ` Unlocking flash problem with the epxa10db device Christopher Hoover
2002-09-20 13:52 ` Louie Boczek
2002-09-20 14:14 ` Clive Davies
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox