Re: [PATCH RFC 2/3] mtd: rawnand: Add support Macronix Block Protection function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mason,

masonccyang@xxxxxxxxxxx wrote on Tue, 8 Oct 2019 10:33:11 +0800:

> Hi Miquel,
> 
> > >   
> > > > Macronix AC series support using SET/GET_FEATURES to change
> > > > Block Protection and Unprotection.
> > > > 
> > > > MTD default _lock/_unlock function replacement by manufacturer
> > > > postponed initialization.   
> > > 
> > > Why would we do that?
> > > 
> > > Anyway your solution looks overkill, if we ever decide to
> > > implement these hooks for raw nand, it is better just to not
> > > overwrite them in nand_scan_tail() if they have been filled
> > > previously (ie. by the manufacturer code).  
> > 
> > Actually you should add two NAND hooks that do the interface with the
> > MTD hooks. In the NAND hooks, check that the request is to lock all the
> > device, otherwise return -ENOTSUPP.  
> 
> sorry, can't get your point.
> 
> Because the NAND entire chip will be protected if PT(protection) pin 
> is active high at power-on.

In your implementation of the locking, you should check that the
locking request is over the entire device, unless you can lock a
smaller portion of course.

> 
> > 
> > Then fill-in these two hooks from the manufacturer code, without the
> > postponed init.
> >   
> 
> But in the final of nand_scan_tail(), mtd->_lock/_unlock will be
> filled by NULL, right ?

The NAND core should set mtd->_lock/_unlock() to NAND specific hooks so
that the MTD layer is abstracted and and drivers do not see it. Then,
in the NAND helper, either there is no specific hook defined by a
manufacturer driver and you return -ENOTSUPP, or you execute the
defined hook.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux