ARM: OMAP2+: gpmc: Adapt to HWMOD
authorAfzal Mohammed <afzal@ti.com>
Fri, 2 Mar 2012 06:07:33 +0000 (11:37 +0530)
committerPhilip, Avinash <avinashphilip@ti.com>
Thu, 8 Mar 2012 11:55:48 +0000 (17:25 +0530)
Create API for platforms to adapt gpmc to HWMOD

Signed-off-by: Afzal Mohammed <afzal@ti.com>
arch/arm/mach-omap2/devices.c
arch/arm/plat-omap/include/plat/gpmc.h

index f87742d7d6abac6ad7c78776e8a99042e149b07f..cc4a734c228eb13e8647126cfeb2c4df81634484 100644 (file)
@@ -49,6 +49,7 @@
 #include <plat/omap4-keypad.h>
 #include <plat/config_pwm.h>
 #include <plat/cpu.h>
+#include <plat/gpmc.h>
 
 /* LCD controller similar DA8xx */
 #include <video/da8xx-fb.h>
@@ -1656,3 +1657,27 @@ static int __init omap_init_wdt(void)
 }
 subsys_initcall(omap_init_wdt);
 #endif
+
+int __init omap_init_gpmc(struct gpmc_devices_info *pdata, int pdata_len)
+{
+       struct omap_hwmod *oh;
+       struct platform_device *pdev;
+       char *name = "omap-gpmc";
+       char *oh_name = "gpmc";
+
+       oh = omap_hwmod_lookup(oh_name);
+       if (!oh) {
+               pr_err("Could not look up %s\n", oh_name);
+               return -ENODEV;
+       }
+
+       pdev = omap_device_build(name, -1, oh, pdata,
+                                       pdata_len, NULL, 0, 0);
+       if (IS_ERR(pdev)) {
+               WARN(1, "Can't build omap_device for %s:%s.\n",
+                                               name, oh->name);
+               return PTR_ERR(pdev);
+       }
+
+       return 0;
+}
index a6098693c7d02de8c0e2dc6a581fd0b4b3439e21..2ab7d0a8999e32b1c08c94214c8cf16c26d95930 100644 (file)
@@ -144,6 +144,8 @@ struct gpmc_devices_info {
 #define        GPMC_DEVICE_SMS911X     (1 << 4)
 #define        GPMC_DEVICE_TUSB6010    (1 << 5)
 
+extern int omap_init_gpmc(struct gpmc_devices_info *pdata, int pdata_len);
+
 extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns);
 extern unsigned int gpmc_ps_to_ticks(unsigned int time_ps);
 extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);