Skip to contentSkip to conversation

power management for NAND flash

PATCH In review Vitaly Wool 2 participants 4 messages Sep 12, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power management for NAND flash

Greetings,
the patch inlined below allows to suspend/resume NAND flash.
It's similar to what is implemented for NOR flashes in cfi_cmdset_0001.c/cfi_cmdset_0002.c. It's based on 2.6.10 kernel but applies to the current CVS snapshot.

Best regards,
Vitaly

include/linux/mtd/nand.h +1 -0
Index: linux-2.6.10/include/linux/mtd/nand.h
===================================================================
@@ -244,6 +244,7 @@
 	FL_ERASING,
 	FL_SYNCING,
 	FL_CACHEDPRG,
+	FL_PM_SUSPENDED,
 } nand_state_t;
 
 /* Keep gcc happy */
drivers/mtd/nand/nand_base.c +39 -5

80 lines not on this page · raw message

#1 lore raw

hoi :)

Quoted 1 line · Vitaly Wool

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?

Signature · 1 line
Martin Waitz
#2 lore raw

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

Quoted 14 lines · Martin Waitz

hoi :)

Quoted 3 lines · Vitaly Wool

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?

#3 lore raw

hoi :)

Quoted 1 line · Vitaly Wool

Hope that clarifies the whole thing :)

yeah, thanks a lot.
now it's clear how to integrate it into drivers.

Signature · 1 line
Martin Waitz