Commit 09c13e83 authored by Dmitry Krivoschekov's avatar Dmitry Krivoschekov Committed by Tony Lindgren

ARM: OMAP2: TWL4030 RTC driver (v2)

This patch adds TWL4030 Real-Time Clock support for OMAP2430.
Signed-off-by: default avatarDmitry Krivoschekov <dkrivoschekov@ru.mvista.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 2d36de85
......@@ -38,6 +38,7 @@
#include <asm/arch/keypad.h>
#include <asm/arch/gpmc.h>
#include <asm/arch/mcspi.h>
#include <asm/arch/twl4030-rtc.h>
#include <asm/io.h>
......@@ -50,6 +51,8 @@
* that driver is used for the touchscreen. */
#define TS_GPIO 24
#define TWL4030_MSECURE_GPIO 118
static struct mtd_partition sdp2430_partitions[] = {
/* bootloader (U-Boot, etc) in first sector */
{
......@@ -183,11 +186,51 @@ static struct platform_device sdp2430_kp_device = {
},
};
static int twl4030_rtc_init(void)
{
int ret = 0;
ret = omap_request_gpio(TWL4030_MSECURE_GPIO);
if (ret < 0) {
printk(KERN_ERR "twl4030_rtc_init: can't reserve GPIO:%d !\n",
TWL4030_MSECURE_GPIO);
goto out;
}
/*
* TWL4030 will be in secure mode if msecure line from OMAP 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); /*dir out */
omap_set_gpio_dataout(TWL4030_MSECURE_GPIO, 1);
out:
return ret;
}
static void twl4030_rtc_exit(void)
{
omap_free_gpio(TWL4030_MSECURE_GPIO);
}
static struct twl4030rtc_platform_data sdp2430_twl4030rtc_data = {
.init = &twl4030_rtc_init,
.exit = &twl4030_rtc_exit,
};
static struct platform_device sdp2430_twl4030rtc_device = {
.name = "twl4030_rtc",
.id = -1,
.dev = {
.platform_data = &sdp2430_twl4030rtc_data,
},
};
static struct platform_device *sdp2430_devices[] __initdata = {
&sdp2430_smc91x_device,
&sdp2430_flash_device,
&sdp2430_kp_device,
&sdp2430_lcd_device,
&sdp2430_twl4030rtc_device,
};
static void ads7846_dev_init(void)
......
......@@ -213,6 +213,16 @@ config RTC_DRV_PCF8583
This driver can also be built as a module. If so, the module
will be called rtc-pcf8583.
config RTC_DRV_TWL4030
tristate "OMAP TWL4030 Real Time Clock"
depends on RTC_CLASS && TWL4030_CORE
help
If you say yes here you get support for internal Real-Time
Clock of TWL4030 chip.
This driver can also be built as a module. If so, the module
will be called rtc-twl4030.
comment "SPI RTC drivers"
depends on RTC_CLASS
......
......@@ -41,3 +41,4 @@ obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o
obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o
obj-$(CONFIG_RTC_DRV_BFIN) += rtc-bfin.o
obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl4030.o
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment