All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <mike@compulab.co.il>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Raphael Assenat <raph@8d.com>, Alessandro Zummo <a.zummo@towertech.it>
Subject: [PATCH] RTC v3020 fixes
Date: Thu, 23 Aug 2007 09:28:28 +0300	[thread overview]
Message-ID: <46CD290C.3020203@compulab.co.il> (raw)

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Raphael Assenat <raph@8d.com>

diff --git a/drivers/char/emv3020.c b/drivers/char/emv3020.c
index df7f1a4..1d93269 100644
--- a/drivers/char/emv3020.c
+++ b/drivers/char/emv3020.c
@@ -48,12 +48,16 @@ static void emv3020_set_reg(unsigned char address, unsigned char data)
 {
 	int i;

-	for ( i = 0; i < 4; i++ )
+	for ( i = 0; i < 4; i++ ) {
 		writel((address << (16-i)), EMV3020_VA_RTC);
+		udelay(1);
+	}

 	if ( address < 0xe)
-		for ( i = 0; i < 8; i++)
+		for ( i = 0; i < 8; i++) {
 			writel((data << (16-i)), EMV3020_VA_RTC);
+			udelay(1);
+		}
 }

 static unsigned char emv3020_get_reg(unsigned char address)
@@ -61,12 +65,16 @@ static unsigned char emv3020_get_reg(unsigned char address)
 	unsigned int data=0;
 	int i, tmp;

-	for ( i = 0; i < 4; i++ )
+	for ( i = 0; i < 4; i++ ) {
 		writel((address << (16-i)), EMV3020_VA_RTC);
+		udelay(1);
+	}
+

 	for ( i = 0; i < 8; i++ ) {
 		tmp = readl(EMV3020_VA_RTC);
 		data |= ((tmp & 0x10000) >> (16 - i));
+		udelay(1);
 	}

 	return data;
@@ -108,7 +116,7 @@ static int emv3020_rtc_gettime(struct rtc_time *dt)
 	BCD_TO_BIN(dt->tm_min);
 	BCD_TO_BIN(dt->tm_hour);
 	BCD_TO_BIN(dt->tm_mday);
-	BCD_TO_BIN(dt->tm_mon);
+	BCD_TO_BIN(dt->tm_mon - 1);
 	BCD_TO_BIN(dt->tm_wday);
 	BCD_TO_BIN(dt->tm_year);
 	dt->tm_year += 100;
@@ -148,7 +156,7 @@ static int emv3020_rtc_settime(struct rtc_time *dt)
 	emv3020_set_reg(0x03, dt->tm_min);
 	emv3020_set_reg(0x04, dt->tm_hour);
 	emv3020_set_reg(0x05, dt->tm_mday);
-	emv3020_set_reg(0x06, dt->tm_mon);
+	emv3020_set_reg(0x06, dt->tm_mon + 1);
 	emv3020_set_reg(0x08, dt->tm_wday);
 	emv3020_set_reg(0x07, dt->tm_year);



             reply	other threads:[~2007-08-23  6:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23  6:28 Mike Rapoport [this message]
2007-08-23  6:56 ` [PATCH] RTC v3020 fixes Satyam Sharma
2007-08-23  7:34   ` Mike
  -- strict thread matches above, loose matches on Subject: below --
2007-08-15  5:45 Mike Rapoport
2007-08-15 12:59 ` Raphaël Assénat
2007-08-15 14:02   ` Mike Rapoport

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=46CD290C.3020203@compulab.co.il \
    --to=mike@compulab.co.il \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raph@8d.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.