All of lore.kernel.org
 help / color / mirror / Atom feed
From: mcuos.com@gmail.com (Wan ZongShun)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] NUC900/rtc: change the waiting for device ready implement
Date: Tue, 18 May 2010 17:10:40 +0800	[thread overview]
Message-ID: <4BF25990.6070602@gmail.com> (raw)

Dear Alessandro,

This patch is to change the waiting for device ready implement
for winbond nuc900 platform.

Thanks!

Signed-off-by:Wan ZongShun<mcuos.com@gmail.com>

---
 drivers/rtc/rtc-nuc900.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c
index a351bd5..8684051 100644
--- a/drivers/rtc/rtc-nuc900.c
+++ b/drivers/rtc/rtc-nuc900.c
@@ -85,22 +85,21 @@ static irqreturn_t nuc900_rtc_interrupt(int irq, void *_rtc)

 static int *check_rtc_access_enable(struct nuc900_rtc *nuc900_rtc)
 {
-	unsigned int i;
+	unsigned int i, timeout = 0x1000, val;
 	__raw_writel(INIRRESET, nuc900_rtc->rtc_reg + REG_RTC_INIR);

 	mdelay(10);

 	__raw_writel(AERPOWERON, nuc900_rtc->rtc_reg + REG_RTC_AER);

-	for (i = 0; i < 1000; i++) {
-		if (__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB)
-			return 0;
-	}
+	while (!(__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB)
+								&& timeout--)
+		mdelay(1);

-	if ((__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB) == 0x0)
-		return ERR_PTR(-ENODEV);
+	if (timeout == 0x1000)
+		return ERR_PTR(-EPERM);

-	return ERR_PTR(-EPERM);
+	return 0;
 }

 static void nuc900_rtc_bcd2bin(unsigned int timereg,
-- 
1.6.3.3

             reply	other threads:[~2010-05-18  9:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18  9:10 Wan ZongShun [this message]
2010-05-18  9:24 ` [PATCH] NUC900/rtc: change the waiting for device ready implement Wan ZongShun
  -- strict thread matches above, loose matches on Subject: below --
2010-05-27  6:59 Wan ZongShun
2010-06-01  5:03 ` Wan ZongShun
2010-06-01 22:43 ` Andrew Morton
2010-06-02  7:06   ` Wan ZongShun

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=4BF25990.6070602@gmail.com \
    --to=mcuos.com@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 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.