]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/board-3430sdp.c
twl4030: improve rtc device setup
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-3430sdp.c
index 004955a6f8554797f4515460be57e7b930a5c72e..fa35c5ef26429b077ad163042bd3cbfa9f3355d5 100644 (file)
@@ -20,9 +20,9 @@
 #include <linux/workqueue.h>
 #include <linux/err.h>
 #include <linux/clk.h>
-#include <linux/i2c/twl4030.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
+#include <linux/i2c/twl4030.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -129,20 +129,20 @@ static struct platform_device sdp3430_kp_device = {
 
 static int ts_gpio;
 
-#ifdef CONFIG_RTC_DRV_TWL4030
-static int twl4030_rtc_init(void)
+static int __init msecure_init(void)
 {
        int ret = 0;
 
+#ifdef CONFIG_RTC_DRV_TWL4030
        /* 3430ES2.0 doesn't have msecure/gpio-22 line connected to T2 */
        if (is_device_type_gp() && is_sil_rev_less_than(OMAP3430_REV_ES2_0)) {
                u32 msecure_pad_config_reg = omap_ctrl_base_get() + 0xA3C;
                int mux_mask = 0x04;
                u16 tmp;
 
-               ret = omap_request_gpio(TWL4030_MSECURE_GPIO);
+               ret = gpio_request(TWL4030_MSECURE_GPIO, "msecure");
                if (ret < 0) {
-                       printk(KERN_ERR "twl4030_rtc_init: can't"
+                       printk(KERN_ERR "msecure_init: can't"
                                "reserve GPIO:%d !\n", TWL4030_MSECURE_GPIO);
                        goto out;
                }
@@ -151,41 +151,18 @@ static int twl4030_rtc_init(void)
                 * is low. Make msecure line high in order to change the
                 * TWL4030 RTC time and calender registers.
                 */
-               omap_set_gpio_direction(TWL4030_MSECURE_GPIO, 0);
-
                tmp = omap_readw(msecure_pad_config_reg);
                tmp &= 0xF8; /* To enable mux mode 03/04 = GPIO_RTC */
                tmp |= mux_mask;/* To enable mux mode 03/04 = GPIO_RTC */
                omap_writew(tmp, msecure_pad_config_reg);
 
-               omap_set_gpio_dataout(TWL4030_MSECURE_GPIO, 1);
+               gpio_direction_output(TWL4030_MSECURE_GPIO, 1);
        }
 out:
+#endif
        return ret;
 }
 
-static void twl4030_rtc_exit(void)
-{
-       if (is_device_type_gp() &&
-                       is_sil_rev_less_than(OMAP3430_REV_ES2_0)) {
-               omap_free_gpio(TWL4030_MSECURE_GPIO);
-       }
-}
-
-static struct twl4030rtc_platform_data sdp3430_twl4030rtc_data = {
-       .init = &twl4030_rtc_init,
-       .exit = &twl4030_rtc_exit,
-};
-
-static struct platform_device sdp3430_twl4030rtc_device = {
-       .name = "twl4030_rtc",
-       .id = -1,
-       .dev = {
-       .platform_data = &sdp3430_twl4030rtc_data,
-       },
-};
-#endif
-
 /**
  * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq
  *
@@ -276,9 +253,6 @@ static struct platform_device *sdp3430_devices[] __initdata = {
        &sdp3430_smc91x_device,
        &sdp3430_kp_device,
        &sdp3430_lcd_device,
-#ifdef CONFIG_RTC_DRV_TWL4030
-       &sdp3430_twl4030rtc_device,
-#endif
 };
 
 static inline void __init sdp3430_init_smc91x(void)
@@ -359,6 +333,7 @@ static void __init omap_3430sdp_init(void)
                                ARRAY_SIZE(sdp3430_spi_board_info));
        ads7846_dev_init();
        sdp3430_flash_init();
+       msecure_init();
        twl4030_bci_battery_init();
        omap_serial_init();
        usb_musb_init();