diff mbox

[6/6] mtd: pxa3xx_nand: Gate/ungate the NAND clock in suspend/resume paths

Message ID 1446653626-14802-7-git-send-email-ezequiel@vanguardiasur.com.ar
State Accepted
Commit d55d31a6b8f65bb13e1912043a66295cc928967c
Headers show

Commit Message

Ezequiel Garcia Nov. 4, 2015, 4:13 p.m. UTC
The NAND clock can be disabled on suspend and enabled on resume.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 drivers/mtd/nand/pxa3xx_nand.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Robert Jarzmik Nov. 4, 2015, 9:16 p.m. UTC | #1
Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> writes:

> The NAND clock can be disabled on suspend and enabled on resume.
>
> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Won't registers set by firmware (IPL/SPL) be lost if you cut the clock ? For
example, NDREDEL ? And if so, shouldn't they be saved upon suspend and restored
upon resume ?

Cheers.

--
Robert
Ezequiel Garcia Nov. 4, 2015, 9:26 p.m. UTC | #2
On 4 November 2015 at 18:16, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> writes:
>
>> The NAND clock can be disabled on suspend and enabled on resume.
>>
>> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
> Won't registers set by firmware (IPL/SPL) be lost if you cut the clock ? For
> example, NDREDEL ? And if so, shouldn't they be saved upon suspend and restored
> upon resume ?
>

I'd say no, because we are gating the bus clock, not the interface clock.
And in that case, my tests would have failed, and they didn't.
Robert Jarzmik Nov. 4, 2015, 9:31 p.m. UTC | #3
Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> writes:

> On 4 November 2015 at 18:16, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> I'd say no, because we are gating the bus clock, not the interface clock.
> And in that case, my tests would have failed, and they didn't.

Then:
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
diff mbox

Patch

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 0e6eb6c1f9b3..13371d6e9ba5 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1936,12 +1936,18 @@  static int pxa3xx_nand_suspend(struct device *dev)
 		return -EAGAIN;
 	}
 
+	clk_disable(info->clk);
 	return 0;
 }
 
 static int pxa3xx_nand_resume(struct device *dev)
 {
 	struct pxa3xx_nand_info *info = dev_get_drvdata(dev);
+	int ret;
+
+	ret = clk_enable(info->clk);
+	if (ret < 0)
+		return ret;
 
 	/* We don't want to handle interrupt without calling mtd routine */
 	disable_int(info, NDCR_INT_MASK);