omap 32k counter/timer driver has been migrated to the
standard platform_driver, so platform hookup is required
to bind the driver,
   - omap1: Register platform_device for cpu_is_omap16xx()
   - omap2/3/4: Use hwmod database lookup mechanism to build the
     platform_device

Signed-off-by: Vaibhav Hiremath <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Cc: Benoit Cousson <[email protected]>
Cc: Tony Lindgren <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Kevin Hilman <[email protected]>
---
 arch/arm/mach-omap1/devices.c |   24 ++++++++++++++++++++++++
 arch/arm/mach-omap2/devices.c |   25 +++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 1d76a63..c7e99b3 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -34,6 +34,29 @@

 /*-------------------------------------------------------------------------*/

+#define OMAP16XX_TIMER_32K_BASE                0xfffbc400
+
+static struct resource omap_32k_resources[] = {
+       {
+               .start          = OMAP16XX_TIMER_32K_BASE,
+               .end            = SZ_4K,
+               .flags          = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device omap_32k_device = {
+       .name                   = "omap-counter-32k",
+       .id                     = -1,
+       .num_resources          = ARRAY_SIZE(omap_32k_resources),
+       .resource               = omap_32k_resources,
+};
+
+static void omap_init_32k(void)
+{
+       if (cpu_is_omap16xx())
+               (void) platform_device_register(&omap_32k_device);
+};
+
 #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)

 #define        OMAP_RTC_BASE           0xfffb4800
@@ -301,6 +324,7 @@ static int __init omap1_init_devices(void)
         * in alphabetical order so they're easier to sort through.
         */

+       omap_init_32k();
        omap_init_mbox();
        omap_init_rtc();
        omap_init_spi100k();
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 35d5dff..fee14d6 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -105,6 +105,30 @@ static int __init omap4_l3_init(void)
 }
 postcore_initcall(omap4_l3_init);

+static int __init omap_init_32k(void)
+{
+       int id = -1;
+       struct omap_hwmod *oh;
+       struct omap_device *od;
+       const char *oh_name = "counter_32k";
+       const char *dev_name = "omap-counter-32k";
+
+       if (!cpu_class_is_omap2())
+               return -ENODEV;
+
+       oh = omap_hwmod_lookup(oh_name);
+       if (!oh) {
+               pr_err("Could not lookup %s hwmod\n", oh_name);
+               return -ENODEV;
+       }
+
+       od = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
+       WARN(IS_ERR(od), "Can't build omap device for %s:%s.\n",
+                       dev_name, oh->name);
+
+       return 0;
+};
+
 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)

 static struct resource omap2cam_resources[] = {
@@ -700,6 +724,7 @@ static int __init omap2_init_devices(void)
         * please keep these calls, and their implementations above,
         * in alphabetical order so they're easier to sort through.
         */
+       omap_init_32k();
        omap_init_audio();
        omap_init_mcpdm();
        omap_init_dmic();
--
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to