Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: maramaopercheseimorto@gmail.com (Alberto Panizzo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] [MXC] Armadillo500 Add support for Seiko Instruments S-35390A rtc over i2c.
Date: Thu, 15 Oct 2009 19:33:24 +0200	[thread overview]
Message-ID: <20091015193324.13059fff@Marramao-laptop> (raw)
In-Reply-To: <20091015193107.2207de95@Marramao-laptop>

[PATCH] Armadillo500 Add support for Seiko Instruments S-35390A rtc over i2c.

The RTC chip Seiko Instruments S-35390A is connected to the Application
Processor over the second bus i2c with the hard coded address 0x30.

Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
---
 arch/arm/mach-mx3/armadillo5x0.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mx3/armadillo5x0.c b/arch/arm/mach-mx3/armadillo5x0.c
index fa973e4..d10ee27 100644
--- a/arch/arm/mach-mx3/armadillo5x0.c
+++ b/arch/arm/mach-mx3/armadillo5x0.c
@@ -35,6 +35,7 @@
 #include <linux/io.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
+#include <linux/i2c.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -104,6 +105,13 @@ static int armadillo5x0_pins[] = {
 	MX31_PIN_CSPI2_MISO__SDA,
 };
 
+/* RTC over I2C*/
+#define ARMADILLO5X0_RTC_GPIO	IOMUX_TO_GPIO(MX31_PIN_SRXD4)
+
+static struct i2c_board_info armadillo5x0_i2c_rtc = {
+	I2C_BOARD_INFO("s35390a", 0x30),
+};
+
 /* GPIO BUTTONS */
 static struct gpio_keys_button armadillo5x0_buttons[] = {
 	{
@@ -373,6 +381,18 @@ static void __init armadillo5x0_init(void)
 
 	/* set NAND page size to 2k if not configured via boot mode pins */
 	__raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR);
+
+	/* RTC */
+	/* Get RTC IRQ and register the chip */
+	if (gpio_request(ARMADILLO5X0_RTC_GPIO, "rtc") == 0) {
+		if (gpio_direction_input(ARMADILLO5X0_RTC_GPIO) == 0)
+			armadillo5x0_i2c_rtc.irq = gpio_to_irq(ARMADILLO5X0_RTC_GPIO);
+		else
+			gpio_free(ARMADILLO5X0_RTC_GPIO);
+	}
+	if (armadillo5x0_i2c_rtc.irq == 0)
+		pr_warning("armadillo5x0_init: failed to get RTC IRQ\n");
+	i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1);
 }
 
 static void __init armadillo5x0_timer_init(void)
-- 
1.5.4.3

  reply	other threads:[~2009-10-15 17:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 17:13 [PATCH 0/4] [MXC] Armadillo500 patches to support various devices Alberto Panizzo
2009-10-15 17:24 ` [PATCH 1/4] [MXC] Armadillo500 Add support for onboard GPIO Buttons Alberto Panizzo
2009-10-15 17:29   ` [PATCH 2/4] [MXC] Armadillo500 Correct bus length for SMSC9118 on board chip Alberto Panizzo
2009-10-15 17:31     ` [PATCH 3/4] [MXC] Armadillo500 Add i2c second bus support Alberto Panizzo
2009-10-15 17:33       ` Alberto Panizzo [this message]
2009-10-19 14:27     ` [PATCH 2/4] [MXC] Armadillo500 Correct bus length for SMSC9118 on board chip Sascha Hauer
2009-10-21 21:40       ` Alberto Panizzo

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=20091015193324.13059fff@Marramao-laptop \
    --to=maramaopercheseimorto@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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