ARM: OMAP2+: gpmc: nand support
authorAfzal Mohammed <afzal@ti.com>
Mon, 27 Feb 2012 13:52:54 +0000 (19:22 +0530)
committerPhilip, Avinash <avinashphilip@ti.com>
Thu, 8 Mar 2012 11:55:46 +0000 (17:25 +0530)
gpmc driver probe will check the capability of the
devices passed via platform data. Upon finding nand
device, gpmc nand initialization would be done. The
initialization function will internally create
platform device for nand.

Signed-off-by: Afzal Mohammed <afzal@ti.com>
arch/arm/mach-omap2/gpmc-nand.c
arch/arm/mach-omap2/gpmc.c

index 2de65d11069ea833cfb596f89b8b2cfded2bddc4..c12b286734e3a0e69e65edd6b634814d676a5195 100644 (file)
@@ -81,7 +81,7 @@ static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data
        return 0;
 }
 
-int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
+int __devinit gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
 {
        int err = 0;
        u8 cs = 0;
index cc97863076081f49628bf70ba6531233dab1633f..e046bf89fc6a4f96ed32c0dac1e20af04e1f8c42 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <asm/mach-types.h>
 #include <plat/gpmc.h>
+#include <plat/nand.h>
 
 #include <plat/sdrc.h>
 
@@ -741,6 +742,8 @@ static int __devinit gpmc_probe(struct platform_device *pdev)
        u32 l;
        int ret = -EINVAL;
        struct resource *res = NULL;
+       struct gpmc_devices_info *gpmc_device = pdev->dev.platform_data;
+       void *p;
 
        /* XXX: This should go away with HWMOD & runtime PM adaptation */
        gpmc_clk_init();
@@ -783,6 +786,9 @@ static int __devinit gpmc_probe(struct platform_device *pdev)
 
        gpmc_mem_init();
 
+       for (p = gpmc_device->pdata; p; gpmc_device++, p = gpmc_device->pdata)
+               if (gpmc_device->flag & GPMC_DEVICE_NAND)
+                       gpmc_nand_init((struct omap_nand_platform_data *) p);
        return 0;
 
 err_remap: