[U-Boot] [PATCH 1/3] nand: Add support for unlock.invert

Joe Hershberger joe.hershberger at gmail.com
Thu Aug 23 17:41:02 CEST 2012


Hi Scott,

On Wed, Aug 22, 2012 at 8:38 PM, Scott Wood <scottwood at freescale.com> wrote:
> On 08/22/2012 03:34 PM, Joe Hershberger wrote:
>> Hi Scott,
>>
>> On Fri, Aug 17, 2012 at 3:53 PM, Scott Wood <scottwood at freescale.com> wrote:
>>> On 08/17/2012 03:31 PM, Joe Hershberger wrote:
>>>> NAND unlock command allows an invert bit to be set to unlock all but
>>>> the selected page range.
>>>>
>>>> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
>>>> ---
>>>>  common/cmd_nand.c            | 13 ++++++++++---
>>>>  drivers/mtd/nand/nand_util.c |  9 ++++++---
>>>>  include/nand.h               |  4 ++--
>>>>  3 files changed, 18 insertions(+), 8 deletions(-)
>>>>
>>>> @@ -368,6 +369,8 @@ int nand_unlock(struct mtd_info *mtd, ulong start, ulong length)
>>>>
>>>>       /* submit ADDRESS of LAST page to unlock */
>>>>       page += (int)(length >> chip->page_shift);
>>>> +     if (invert)
>>>> +             page |= 1;
>>>>       chip->cmdfunc(mtd, NAND_CMD_UNLOCK2, -1, page & chip->pagemask);
>>>
>>> Why |= 1?  Is this some magic that the chip recognizes to implement
>>> "invert"?  Do all chips that support lock/unlock support this (none of
>>> the NAND chip manuals I have document lock/unlock at all as far as I
>>> could find)?  What if you want to unlock a non-inverted range that ends
>>> in a page with the low bit set?
>>
>> According to the data sheet for the part I'm working with
>> (MT29F4G08ABADAH4) the unlock command has 2 commands... 0x23 and 0x24.
>>  The invert bit only exists for 0x24 (NAND_CMD_UNLOCK2).  The format
>> of the unlock commands specifys that block addresses are used,
>> therefore the LSb would never be set.  This bit-0 is defined to be
>> "invert area" for 0x24 and always LOW for 0x23.
>
> Please add a code comment to this effect.

This is what the code does... Can you recommend a comment that you would like?

Thanks,
-Joe


More information about the U-Boot mailing list