From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] mrst/vrtc: avoid using CMOS RTC ops
Date: Tue, 25 Jan 2011 14:26:28 +0000 [thread overview]
Message-ID: <20110125142627.9886.47807.stgit@bob.linux.org.uk> (raw)
In-Reply-To: <20110125142613.9886.69516.stgit@bob.linux.org.uk>
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
If we don't assign Moorestown specific wallclock init and ops function
the rtc/persisent clock code will use CMOS RTC for access, this will
crash Moorestown as the ioports are not present.
Also in the vrtc driver, we should avoid using CMOS access to check UIP status.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
arch/x86/platform/mrst/mrst.c | 2 ++
drivers/rtc/rtc-mrst.c | 13 ++++++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index ea6529e..dea829c 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -31,6 +31,7 @@
#include <asm/apic.h>
#include <asm/io_apic.h>
#include <asm/mrst.h>
+#include <asm/mrst-vrtc.h>
#include <asm/io.h>
#include <asm/i8259.h>
#include <asm/intel_scu_ipc.h>
@@ -268,6 +269,7 @@ void __init x86_mrst_early_setup(void)
x86_platform.calibrate_tsc = mrst_calibrate_tsc;
x86_platform.i8042_detect = mrst_i8042_detect;
+ x86_platform.wallclock_init = mrst_rtc_init;
x86_init.pci.init = pci_mrst_init;
x86_init.pci.fixup_irqs = x86_init_noop;
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index bcd0cf6..28e02e7 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -62,6 +62,17 @@ static inline int is_intr(u8 rtc_intr)
return rtc_intr & RTC_IRQMASK;
}
+static inline unsigned char vrtc_is_updating(void)
+{
+ unsigned char uip;
+ unsigned long flags;
+
+ spin_lock_irqsave(&rtc_lock, flags);
+ uip = (vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP);
+ spin_unlock_irqrestore(&rtc_lock, flags);
+ return uip;
+}
+
/*
* rtc_time's year contains the increment over 1900, but vRTC's YEAR
* register can't be programmed to value larger than 0x64, so vRTC
@@ -76,7 +87,7 @@ static int mrst_read_time(struct device *dev, struct rtc_time *time)
{
unsigned long flags;
- if (rtc_is_updating())
+ if (vrtc_is_updating())
mdelay(20);
spin_lock_irqsave(&rtc_lock, flags);
next prev parent reply other threads:[~2011-01-25 14:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-25 14:26 [PATCH 1/2] x86/platform: add a wallclock_init func to x86_platforms ops Alan Cox
2011-01-25 14:26 ` Alan Cox [this message]
[not found] ` <AANLkTi=KQ-5=h-iDPRtBRvy45jafQxxhyJu4UPCxZ6Lg@mail.gmail.com>
2011-01-27 1:50 ` [PATCH 2/2] mrst/vrtc: avoid using CMOS RTC ops Feng Tang
2011-01-25 15:20 ` [PATCH 1/2] x86/platform: add a wallclock_init func to x86_platforms ops Thomas Gleixner
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=20110125142627.9886.47807.stgit@bob.linux.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.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