Commit ebb22a05 authored by Thomas Gleixner's avatar Thomas Gleixner

rtc: mc146818: Dont test for bit 0-5 in Register D

The recent change to validate the RTC turned out to be overly tight.

While it cures the problem on the reporters machine it breaks machines
with Intel chipsets which use bit 0-5 of the D register. So check only
for bit 6 being 0 which is the case on these Intel machines as well.

Fixes: 211e5db1 ("rtc: mc146818: Detect and handle broken RTCs")
Reported-by: default avatarSerge Belyshev <belyshev@depni.sinp.msu.ru>
Reported-by: default avatarDirk Gouders <dirk@gouders.net>
Reported-by: default avatarBorislav Petkov <bp@suse.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarDirk Gouders <dirk@gouders.net>
Tested-by: default avatarLen Brown <len.brown@intel.com>
Tested-by: default avatarBorislav Petkov <bp@suse.de>
Acked-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/87zh0nbnha.fsf@nanos.tec.linutronix.de
parent 211e5db1
...@@ -805,8 +805,8 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) ...@@ -805,8 +805,8 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
spin_lock_irq(&rtc_lock); spin_lock_irq(&rtc_lock);
/* Ensure that the RTC is accessible. Bit 0-6 must be 0! */ /* Ensure that the RTC is accessible. Bit 6 must be 0! */
if ((CMOS_READ(RTC_VALID) & 0x7f) != 0) { if ((CMOS_READ(RTC_VALID) & 0x40) != 0) {
spin_unlock_irq(&rtc_lock); spin_unlock_irq(&rtc_lock);
dev_warn(dev, "not accessible\n"); dev_warn(dev, "not accessible\n");
retval = -ENXIO; retval = -ENXIO;
......
...@@ -21,8 +21,8 @@ unsigned int mc146818_get_time(struct rtc_time *time) ...@@ -21,8 +21,8 @@ unsigned int mc146818_get_time(struct rtc_time *time)
again: again:
spin_lock_irqsave(&rtc_lock, flags); spin_lock_irqsave(&rtc_lock, flags);
/* Ensure that the RTC is accessible. Bit 0-6 must be 0! */ /* Ensure that the RTC is accessible. Bit 6 must be 0! */
if (WARN_ON_ONCE((CMOS_READ(RTC_VALID) & 0x7f) != 0)) { if (WARN_ON_ONCE((CMOS_READ(RTC_VALID) & 0x40) != 0)) {
spin_unlock_irqrestore(&rtc_lock, flags); spin_unlock_irqrestore(&rtc_lock, flags);
memset(time, 0xff, sizeof(*time)); memset(time, 0xff, sizeof(*time));
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment