ARM: OMAP2+: gpmc: Add low power support
authorPhilip, Avinash <avinashphilip@ti.com>
Mon, 27 Feb 2012 06:00:40 +0000 (11:30 +0530)
committerPhilip, Avinash <avinashphilip@ti.com>
Thu, 8 Mar 2012 11:56:23 +0000 (17:26 +0530)
This patch adds Callback functions to support low power transitions by
adding
1. pm_runtime API's to handle GPMC power transitions
2. GPMC save/restore context.

Signed-off-by: Philip, Avinash <avinashphilip@ti.com>
arch/arm/mach-omap2/gpmc-nand.c
arch/arm/mach-omap2/gpmc.c
arch/arm/plat-omap/include/plat/gpmc.h
arch/arm/plat-omap/include/plat/nand.h

index c12b286734e3a0e69e65edd6b634814d676a5195..0207a66df2f42b421efed16e574e672a80382707 100644 (file)
@@ -108,6 +108,8 @@ int __devinit gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
        }
 
        gpmc_nand_device.dev.platform_data = gpmc_nand_data;
+       gpmc_nand_data->ctrlr_suspend   = gpmc_suspend;
+       gpmc_nand_data->ctrlr_resume    = gpmc_resume;
 
        printk(KERN_INFO "Registering NAND on CS%d\n", gpmc_nand_data->cs);
 
index 50940c02566abf08cf2802a5e631fc2f1a07f304..c58a3361e236d4612bbf406a6eeb176009f46ce5 100644 (file)
@@ -740,6 +740,8 @@ static void __devinit gpmc_mem_init(void)
        }
 }
 
+struct device *gpmc_dev;
+
 static int __devinit gpmc_probe(struct platform_device *pdev)
 {
        u32 l;
@@ -751,6 +753,8 @@ static int __devinit gpmc_probe(struct platform_device *pdev)
        /* XXX: This should go away with HWMOD & runtime PM adaptation */
        gpmc_clk_init(&pdev->dev);
 
+       gpmc_dev = &pdev->dev;
+
        gpmc = devm_kzalloc(&pdev->dev, sizeof(struct gpmc), GFP_KERNEL);
        if (!gpmc)
                return -ENOMEM;
@@ -825,6 +829,20 @@ static struct platform_driver gpmc_driver = {
 
 module_platform_driver(gpmc_driver);
 
+int gpmc_suspend(void)
+{
+       omap3_gpmc_save_context();
+       pm_runtime_put_sync(gpmc_dev);
+       return 0;
+}
+
+int gpmc_resume(void)
+{
+       pm_runtime_get_sync(gpmc_dev);
+       omap3_gpmc_restore_context();
+       return 0;
+}
+
 #ifdef CONFIG_ARCH_OMAP3
 static struct omap3_gpmc_regs gpmc_context;
 
index 506b3a19c001f1d043ad47c4cd1488bf397a94c2..2b81fc6c04c97326baaf8c7b6dc90832cbaf03d6 100644 (file)
@@ -174,4 +174,6 @@ extern int gpmc_nand_write(int cs, int cmd, int wval);
 
 int gpmc_enable_hwecc(int ecc, int cs, int mode, int dev_width, int ecc_size);
 int gpmc_calculate_ecc(int ecc, int cs, const u_char *dat, u_char *ecc_code);
+int gpmc_suspend(void);
+int gpmc_resume(void);
 #endif
index 1bcff1da24a1b59ebd995d2c2fd8023f7b3b9f7f..9212a2e693e4df0380a5c3ff45d736789b53a60a 100644 (file)
@@ -30,6 +30,8 @@ struct omap_nand_platform_data {
        int                     devsize;
        enum omap_ecc           ecc_opt;
        bool                    elm_used;
+       int (*ctrlr_suspend) (void);
+       int (*ctrlr_resume) (void);
 };
 
 /* minimum size for IO mapping */