LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2/3] x86: fix cmos read and write to not use inb_p and outb_p
@ 2008-02-17 21:56 David P. Reed
  2008-02-17 22:24 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: David P. Reed @ 2008-02-17 21:56 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin; +Cc: linux-kernel, David P. Reed

[-- Attachment #1: fix-rtc-iodelay.patch --]
[-- Type: text/plain, Size: 1686 bytes --]

fix code to access CMOS rtc registers so that it does not use inb_p and
outb_p routines, which are deprecated.  Extensive research on all known CMOS RTC
chipset timing shows that there is no need for a delay in accessing the
registers of these chips even on old machines. These chipa are never on an
expansion bus, but have always been "motherboard" resources, either in the
processor chipset or explicitly on the motherboard, and they are not part of 
the ISA/LPC or PCI buses, so delays should not be based on bus timing.
The reason to fix it:
1) port 80 writes often hang some laptops that use ENE EC chipsets, esp. those
designed and manufactured by Quanta for HP;
2) RTC accesses are timing sensitive, and extra microseconds may matter;
3) the new "io_delay" function is calibrated by expansion bus timing needs,
thus is not appropriate for access to CMOS rtc registers.

Signed-off-by: David P. Reed <dpreed@reed.com>
Index: linux-2.6/arch/x86/kernel/rtc.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/rtc.c
+++ linux-2.6/arch/x86/kernel/rtc.c
@@ -151,8 +151,8 @@ unsigned char rtc_cmos_read(unsigned cha
 	unsigned char val;
 
 	lock_cmos_prefix(addr);
-	outb_p(addr, RTC_PORT(0));
-	val = inb_p(RTC_PORT(1));
+	outb(addr, RTC_PORT(0));
+	val = inb(RTC_PORT(1));
 	lock_cmos_suffix(addr);
 	return val;
 }
@@ -161,8 +161,8 @@ EXPORT_SYMBOL(rtc_cmos_read);
 void rtc_cmos_write(unsigned char val, unsigned char addr)
 {
 	lock_cmos_prefix(addr);
-	outb_p(addr, RTC_PORT(0));
-	outb_p(val, RTC_PORT(1));
+	outb(addr, RTC_PORT(0));
+	outb(val, RTC_PORT(1));
 	lock_cmos_suffix(addr);
 }
 EXPORT_SYMBOL(rtc_cmos_write);

-- 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/3] x86: fix cmos read and write to not use inb_p and outb_p
  2008-02-17 21:56 [PATCH 2/3] x86: fix cmos read and write to not use inb_p and outb_p David P. Reed
@ 2008-02-17 22:24 ` Alan Cox
  2008-02-18  3:07   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2008-02-17 22:24 UTC (permalink / raw)
  To: David P. Reed
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, linux-kernel,
	David P. Reed

On Sun, 17 Feb 2008 16:56:39 -0500 (EST)
"David P. Reed" <dpreed@reed.com> wrote:

> fix code to access CMOS rtc registers so that it does not use inb_p and
> outb_p routines, which are deprecated.

> Signed-off-by: David P. Reed <dpreed@reed.com>

Acked-by: Alan Cox <alan@redhat.com>

It is remotely possible that we will find we need the delays eventually,
but if we do the lot is localised into two methods so its easy to change
and this should be safe anyway.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/3] x86: fix cmos read and write to not use inb_p and outb_p
  2008-02-17 22:24 ` Alan Cox
@ 2008-02-18  3:07   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-02-18  3:07 UTC (permalink / raw)
  To: Alan Cox
  Cc: David P. Reed, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	linux-kernel


* Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> On Sun, 17 Feb 2008 16:56:39 -0500 (EST)
> "David P. Reed" <dpreed@reed.com> wrote:
> 
> > fix code to access CMOS rtc registers so that it does not use inb_p and
> > outb_p routines, which are deprecated.
> 
> > Signed-off-by: David P. Reed <dpreed@reed.com>
> 
> Acked-by: Alan Cox <alan@redhat.com>

thanks, i've queued this up in x86.git.

	Ingo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-18  3:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-17 21:56 [PATCH 2/3] x86: fix cmos read and write to not use inb_p and outb_p David P. Reed
2008-02-17 22:24 ` Alan Cox
2008-02-18  3:07   ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).