From 9f32a690f6236224a7f4893ec9568f59eafbfb56 Mon Sep 17 00:00:00 2001 From: "Ye.Li" Date: Fri, 10 Jul 2015 19:13:53 +0800 Subject: [PATCH] MLK-11236 mtd: gpmi-nand: Fix nand runtime PM issue Because of the delay of auto suspend, the nand clocks are delayed to disable when calling the clk_set_rate. This causes the clk_set_rate failed on some platforms like 6q/6qp, and finally lead the NAND not working. Signed-off-by: Ye.Li Signed-off-by: Fugang Duan (cherry picked from commit: 1334dd236d4401d6635accb6c8472d8a5ed088b5) --- drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c index 283f875fa47d..a45a3fd2bafe 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c @@ -957,9 +957,14 @@ static int enable_edo_mode(struct gpmi_nand_data *this, int mode) nand->select_chip(mtd, -1); + pm_runtime_get_sync(this->dev); + clk_disable_unprepare(r->clock[0]); /* [3] set the main IO clock, 100MHz for mode 5, 80MHz for mode 4. */ rate = (mode == 5) ? 100000000 : 80000000; clk_set_rate(r->clock[0], rate); + clk_prepare_enable(r->clock[0]); + pm_runtime_mark_last_busy(this->dev); + pm_runtime_put_autosuspend(this->dev); /* Let the gpmi_begin() re-compute the timing again. */ this->flags &= ~GPMI_TIMING_INIT_OK; -- 2.17.1