Re: Prevent Nand page writes on Power failure

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

 



On Mon, Feb 25, 2019 at 12:28:15PM +0100, Richard Weinberger wrote:
> On Mon, Feb 25, 2019 at 9:56 AM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote:
> > +static irqreturn_t gpmi_pwr_good_irq(int irq, void *dev_id)
> > +{
> > +       struct gpmi_nand_data *this = dev_id;
> > +       int level;
> > +
> > +       level = gpiod_get_value_cansleep(this->pwrgood_gpio);
> > +       if (level) {
> > +               mutex_lock(&this->nand.power_lock);
> > +       } else {
> > +               mutex_unlock(&this->nand.power_lock);
> > +               dev_info(this->dev, "Spurious Power Failure detected\n");
> > +       }
> 
> Hmm, not sure if it is wise to unlock after the power-low pin was toggled.
> Do you have a guarantee that the system, and most important the NAND chip,
> is in a well defined state after the power returns?

No, not at all ;)

I could remove the mutex_unlock() in the spurious power failure path,
but I think I'll figure out what to do when I see the message in the
logs.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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



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

  Powered by Linux