summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuang Shijie <b32955@freescale.com>2010-11-03 10:01:16 +0800
committerJustin Waters <justin.waters@timesys.com>2010-12-13 16:10:42 -0500
commite97e27ef86786f208675631063e92757106b3a1c (patch)
tree9795fb8b03a6906b6332759d15a00a2b28e65975
parent1059cad240243eba2d7c8beca0550f11f626e431 (diff)
ENGR00133178-10 NAND : add ddr_clk for imx50
In imx50, the low power feature is introduced into the system. We have to enable the ddr_clk explicitly before doing any DMA operations. So enable the ddr_clk in ->begin(), and disable it in ->end(); Signed-off-by: Huang Shijie <b32955@freescale.com>
-rw-r--r--drivers/mtd/nand/gpmi-nfc/gpmi-nfc-hal-v2.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-hal-v2.c b/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-hal-v2.c
index 0ca5a9e9fd4a..0a9c3d62b07b 100644
--- a/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-hal-v2.c
+++ b/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-hal-v2.c
@@ -32,6 +32,13 @@
*/
static int onfi_ddr_mode;
+/*
+ * In low-power mode, the system will shutdown the ddr_clk which is needed
+ * by the DMA.
+ */
+static struct clk *ddr_clk;
+
+
static void setup_ddr_timing(struct gpmi_nfc_data *this)
{
uint32_t value;
@@ -193,6 +200,13 @@ static int enable_micron_ddr(struct gpmi_nfc_data *this)
/* To check if we need to initialize something else*/
static int extra_init(struct gpmi_nfc_data *this)
{
+ ddr_clk = clk_get(NULL, "ddr_clk");
+ if (IS_ERR(ddr_clk)) {
+ printk(KERN_ERR "The ddr clock is gone!");
+ ddr_clk = NULL;
+ return -ENOENT;
+ }
+
if (is_onfi_nand(&this->device_info))
return enable_micron_ddr(this);
return 0;
@@ -439,6 +453,8 @@ static void begin(struct gpmi_nfc_data *this)
/* Enable the clock. */
+ if (ddr_clk)
+ clk_enable(ddr_clk);
clk_enable(resources->clock);
/* Get the timing information we need. */
@@ -464,6 +480,8 @@ static void end(struct gpmi_nfc_data *this)
/* Disable the clock. */
clk_disable(resources->clock);
+ if (ddr_clk)
+ clk_disable(ddr_clk);
}