[PATCH 2/5] mxc_nand: fix PM

Eric Bénard eric at eukrea.com
Fri May 21 08:32:01 EDT 2010


Hi Lothar,

Le 21/05/2010 13:41, Lothar Waßmann a écrit :
>> -	if (mtd) {
>> -		/* Enable the NFC clock */
>> +	if (!host->clk_act) {
>>   		clk_enable(host->clk);
>> -		mtd->resume(mtd);
>> +		host->clk_act = 1;
>>   	}
>>
> Since you are clearing host->clk_act during suspend, this will
> unconditionally enable the clock no matter what state it had before
> suspend (in case that's intended, the check for !host->clk_act is
> useless, since it will always yield true).

Yes, you're right.
In fact, the clock is turned on & off by mxc_nand_select_chip so when 
clk_enable & clk_disable are called in suspend & resume without checking 
it the clock is already active, I had log complaining for the clock 
already being off as mxc_nand_select_chip hard already turned it off, so 
I put the checks in both functions.

 > I think it's more sensible to leave host->clk_act alone, and reenable
 > the clock only if host->clk_act is set, so that the clock is left in
 > the same state after resume in which it was before suspend.
 >
OK I'll try this. In fact, I think the clock is always off when we reach 
suspend & resume as nand_base has already deselected the chip and thus 
the NFC's clock is turned off.

While we're at this : is there a good reason to select/deselect the chip 
at every access and turn on/off the clock at the same time ?

Eric



More information about the linux-arm-kernel mailing list