public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: "Girish" <girishsg@ti.com>
To: 'Tony Lindgren' <tony@atomide.com>
Cc: linux-omap@vger.kernel.org
Subject: [Resending PATCH 2/2] ARM: OMAP2: RTC board specific code: rebased
Date: Wed, 12 Mar 2008 16:18:11 +0530	[thread overview]
Message-ID: <000301c8842e$920fa500$988818ac@ent.ti.com> (raw)

This patch adds rtc-twl4030 board specific code for 3430.

Signed-off-by: Girish S G <girishsg@ti.com>
---
 arch/arm/configs/omap_3430sdp_defconfig |   16 +++++++-
 arch/arm/mach-omap2/board-3430sdp.c     |   61 ++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 1 deletion(-)

Index: linux-omap-git-20080128/arch/arm/configs/omap_3430sdp_defconfig
===================================================================
--- linux-omap-git-20080128.orig/arch/arm/configs/omap_3430sdp_defconfig	2008-01-26 04:27:28.000000000 +0530
+++ linux-omap-git-20080128/arch/arm/configs/omap_3430sdp_defconfig	2008-03-12 15:06:14.034349437 +0530
@@ -697,8 +697,22 @@
 # MMC/SD Host Controller Drivers
 #
 CONFIG_MMC_OMAP_HS=y
+
+#
+# RTC interface
+#
 CONFIG_RTC_LIB=y
-# CONFIG_RTC_CLASS is not set
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+
+#
+# I2C RTC driver
+#
+CONFIG_RTC_DRV_TWL4030=y
 
 #
 # DMA Engine support
Index: linux-omap-git-20080128/arch/arm/mach-omap2/board-3430sdp.c
===================================================================
--- linux-omap-git-20080128.orig/arch/arm/mach-omap2/board-3430sdp.c	2008-01-26 04:27:28.000000000 +0530
+++ linux-omap-git-20080128/arch/arm/mach-omap2/board-3430sdp.c	2008-03-12 14:50:03.504899960 +0530
@@ -37,9 +37,11 @@
 #include <asm/arch/keypad.h>
 #include <asm/arch/dma.h>
 #include <asm/arch/gpmc.h>
+#include <asm/arch/twl4030-rtc.h>
 
 #include <asm/io.h>
 #include <asm/delay.h>
+#include <asm/arch/control.h>
 
 #define	SDP3430_SMC91X_CS	3
 
@@ -47,6 +49,8 @@
 #define ENABLE_VAUX3_DEV_GRP	0x20
 
 
+#define TWL4030_MSECURE_GPIO	22
+
 static struct resource sdp3430_smc91x_resources[] = {
 	[0] = {
 		.start	= OMAP34XX_ETHR_START,
@@ -117,6 +121,60 @@
 	},
 };
 
+#ifdef CONFIG_RTC_DRV_TWL4030
+static int twl4030_rtc_init(void)
+{
+	int ret = 0;
+
+	/* 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);
+		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);
+
+		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);
+	}
+out:
+	return ret;
+}
+
+static void twl4030_rtc_exit(void)
+{
+	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
  *
@@ -207,6 +265,9 @@
 	&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)


             reply	other threads:[~2008-03-12 10:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 10:48 Girish [this message]
2008-03-13 11:35 ` [Resending PATCH 2/2] ARM: OMAP2: RTC board specific code: rebased Tony Lindgren
  -- strict thread matches above, loose matches on Subject: below --
2008-06-27 10:30 Girish. S. G.
2008-08-05 13:24 ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000301c8842e$920fa500$988818ac@ent.ti.com' \
    --to=girishsg@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox