erase.c

Alice Hennessy ahennessy at mvista.com
Mon Mar 12 18:10:09 EST 2001


Kári Davíðsson wrote:

> Hi,
>
> In the intel chip that we are using here all sectors seem to be locked
> by default.
> So in the erase utility I propose the following patch.
>
> Maybe it is ambigous to do force unlocking of sectors like this.
> Should we maybe have a separate utility to lock/unlock sectors?
>
> K.D.
>
> --- ../mtd/util/erase.c Thu Sep 21 22:00:07 2000
> +++ util/erase.c        Mon Mar 12 14:58:58 2001
> @@ -51,6 +51,12 @@
>                  erase.length, erase.start);
>           fflush(stdout);
>
> +         if(ioctl(Fd, MEMUNLOCK, &erase) != 0)
> +         {
> +                 perror("\nMTD Unlock failure");
> +                 close(Fd);
> +                 return 8;
> +                }
>           if (ioctl(Fd,MEMERASE,&erase) != 0)
>               {
>                   perror("\nMTD Erase failure");
>
> To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org

The unlock ioctl unlocks all of the flash sectors at once (because the
Intel flash's command unlocks
all of the sectors at once).  I put in a check for this in mtdpart.c
against the entire flash size but it looks like it was changed -
I also need to add a check in cfi_cmdset_0001.c for those that don't use
partitions.

FYI,  the request that is trying to erase or write to a locked sector
will return
an EROFS error.

Alice



To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org



More information about the linux-mtd mailing list