Re: [PATCH] power management for NAND flash

Vitaly Wool
2005-09-12T16:07:34Z

Hi Martin,

Exactly. We should.
But prior to shut off the clock/power down the flash we need to put the
flash driver into the corresponding state (suspended).

Thus, a typical suspend (pseudo) code for NAND flash will look the
following way:

static int chip_nand_suspend(struct device *dev, u32 state, u32 level)
{
int retval = 0;

#ifdef CONFIG_PM
struct mtd_info *mtd = dev_get_drvdata(dev);
if (mtd && mtd->suspend && level == SUSPEND_SAVE_STATE) {
retval = mtd->suspend(mtd);
if (retval == 0) {
/* shut off the clocks and power down the
controller here */
}
}
#endif
return retval;
}

with a resume routine doing just the oppsite.

Hope that clarifies the whole thing :)

Best regards,
Vitaly

Martin Waitz wrote:

>hoi :)
>
>On Mon, Sep 12, 2005 at 03:12:44PM +0400, Vitaly Wool wrote:
>
>
>>the patch inlined below allows to suspend/resume NAND flash.
>>
>>
>
>shouldn't we call the board driver while suspending,
>to allow to actually power down the NAND flash?
>
>
>