From: Thomas Gleixner <tglx@linutronix.de>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
Alek Du <alek.du@intel.com>,
Arjan van de Ven <arjan@linux.intel.com>,
Feng Tang <feng.tang@intel.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/8] x86/mrst: add vrtc driver which serves as a wall clock device
Date: Tue, 11 May 2010 16:57:44 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.00.1005111643380.3401@localhost.localdomain> (raw)
In-Reply-To: <1273254108-3234-8-git-send-email-jacob.jun.pan@linux.intel.com>
On Fri, 7 May 2010, Jacob Pan wrote:
> --- /dev/null
> +++ b/arch/x86/include/asm/vrtc.h
> @@ -0,0 +1,27 @@
> +#ifndef _MRST_VRTC_H
> +#define _MRST_VRTC_H
> +
> +#ifdef CONFIG_X86_MRST
> +extern unsigned char vrtc_cmos_read(unsigned char reg);
> +extern void vrtc_cmos_write(unsigned char val, unsigned char reg);
> +extern unsigned long vrtc_get_time(void);
> +extern int vrtc_set_mmss(unsigned long nowtime);
> +extern void vrtc_set_base(void __iomem *base);
> +
> +#define MRST_VRTC_PGOFFSET (0xc00)
> +
> +#else
Errm. That's a MRST specific header and nothing outside of MRST is
using it. So why the #ifdef CONFIG_X86_MRST and the inline functions
in the #else path ?
> +static inline unsigned char vrtc_cmos_read(unsigned char reg)
> +{
> + return 0xff;
> +}
> +
> /**
> * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock,
> @@ -268,7 +269,24 @@ void __init mrst_time_init(void)
>
> void __init mrst_rtc_init(void)
> {
> + unsigned long rtc_paddr;
> + void __iomem *virt_base;
> +
> sfi_table_parse(SFI_SIG_MRTC, NULL, NULL, sfi_parse_mrtc);
> + if (!sfi_mrtc_num)
> + return;
> +
> + rtc_paddr = sfi_mrtc_array[0].phys_addr;
> +
> + /* vRTC's register address may not be page aligned */
> + set_fixmap_nocache(FIX_LNW_VRTC, rtc_paddr);
Why do we need a fixmap for that ? There is no need to setup RTC that
early. The first call is from timekeeping_init()
Also this RTC init code should be in vrtc.c
> +
> +static unsigned char __iomem *vrtc_virt_base;
> +
> +void vrtc_set_base(void __iomem *base)
> +{
> + vrtc_virt_base = base;
> +}
> +
> +unsigned char vrtc_cmos_read(unsigned char reg)
> +{
> + unsigned char retval;
> +
> + /* vRTC's registers range from 0x0 to 0xD */
> + if (reg > 0xd || !vrtc_virt_base)
> + return 0xff;
> +
> + lock_cmos_prefix(reg);
This lock_cmos magic should just die. I have no idea why something
wants or wanted to access the RTC from an NMI.
> + retval = __raw_readb(vrtc_virt_base + (reg << 2));
> + lock_cmos_suffix(reg);
> + return retval;
> +}
> +EXPORT_SYMBOL(vrtc_cmos_read);
> +
> +void vrtc_cmos_write(unsigned char val, unsigned char reg)
> +{
> + if (reg > 0xd || !vrtc_virt_base)
> + return;
> +
> + lock_cmos_prefix(reg);
> + __raw_writeb(val, vrtc_virt_base + (reg << 2));
> + lock_cmos_suffix(reg);
> +}
> +EXPORT_SYMBOL(vrtc_cmos_write);
> +
> +unsigned long vrtc_get_time(void)
> +{
> + u8 sec, min, hour, mday, mon;
> + u32 year;
> +
> + while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP))
> + cpu_relax();
> +
> + sec = vrtc_cmos_read(RTC_SECONDS);
> + min = vrtc_cmos_read(RTC_MINUTES);
> + hour = vrtc_cmos_read(RTC_HOURS);
> + mday = vrtc_cmos_read(RTC_DAY_OF_MONTH);
> + mon = vrtc_cmos_read(RTC_MONTH);
> + year = vrtc_cmos_read(RTC_YEAR);
> +
> + /* vRTC YEAR reg contains the offset to 1960 */
> + year += 1960;
> +
> + printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d "
> + "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
Please remove the debug noise
Thanks,
tglx
next prev parent reply other threads:[~2010-05-11 14:58 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 17:41 [PATCH 0/8] Moorestown changes in arch/x86 for 35 merge window Jacob Pan
2010-05-07 17:41 ` [PATCH 1/8] x86: avoid check hlt if no timer interrupts Jacob Pan
2010-05-07 20:32 ` RFD: Should we remove the HLT check? (was Re: [PATCH 1/8] x86: avoid check hlt if no timer interrupts) H. Peter Anvin
2010-05-07 20:33 ` Arjan van de Ven
2010-05-07 20:36 ` H. Peter Anvin
2010-05-07 22:24 ` Alan Cox
2010-05-07 22:27 ` H. Peter Anvin
2010-05-07 22:46 ` Alan Cox
2010-05-07 22:35 ` Arjan van de Ven
2010-05-07 20:54 ` Linus Torvalds
2010-05-07 21:04 ` H. Peter Anvin
2010-05-07 22:07 ` jacob pan
2010-05-07 17:41 ` [PATCH 2/8] x86/mrst/pci: return 0 for non-present pci bars Jacob Pan
2010-05-07 17:41 ` [PATCH 3/8] x86/apic: allow use of lapic timer early calibration result Jacob Pan
2010-05-11 13:46 ` Thomas Gleixner
2010-05-11 19:42 ` Pan, Jacob jun
2010-05-11 19:50 ` Thomas Gleixner
2010-05-11 20:46 ` Pan, Jacob jun
2010-05-11 20:51 ` H. Peter Anvin
2010-05-07 17:41 ` [PATCH 4/8] x86/mrst: change clock selection logic to support medfield Jacob Pan
2010-05-11 14:36 ` Thomas Gleixner
2010-05-11 15:30 ` Alan Cox
2010-05-11 15:50 ` Thomas Gleixner
2010-05-11 16:03 ` Alan Cox
2010-05-13 22:16 ` Pan, Jacob jun
2010-05-17 2:14 ` Du, Alek
2010-05-17 2:27 ` Du, Alek
2010-05-07 17:41 ` [PATCH 5/8] x86/apbt: support more timer configurations on mrst Jacob Pan
2010-05-07 17:41 ` [PATCH 6/8] x86/platform: add a wallclock_init func to x86_platforms ops Jacob Pan
2010-05-11 14:42 ` Thomas Gleixner
2010-05-07 17:41 ` [PATCH 7/8] x86/mrst: add vrtc driver which serves as a wall clock device Jacob Pan
2010-05-07 18:51 ` Joe Perches
2010-05-07 19:02 ` Alan Cox
2010-05-07 19:06 ` Joe Perches
2010-05-07 19:56 ` H. Peter Anvin
2010-05-10 9:17 ` Feng Tang
2010-05-10 18:22 ` H. Peter Anvin
2010-05-11 2:30 ` Feng Tang
2010-05-11 14:57 ` Thomas Gleixner [this message]
2010-05-12 2:34 ` Feng Tang
2010-05-17 9:15 ` Thomas Gleixner
2010-05-18 6:27 ` Feng Tang
2010-05-18 7:38 ` Thomas Gleixner
2010-05-18 20:43 ` john stultz
2010-05-18 21:02 ` Thomas Gleixner
2010-05-21 2:15 ` [PATCH 1/3] timekeeping: moving xtime's init to a later time Feng Tang
2010-05-21 2:16 ` [PATCH 2/3] x86: unify current 3 similar ways of saving IRQ info Feng Tang
2010-05-21 2:19 ` [PATCH 3/3] x86/mrst: add vrtc driver which serves as a wall clock device Feng Tang
2010-05-07 17:41 ` [PATCH 8/8] x86/mrst: Add nop functions to x86_init mpparse functions Jacob Pan
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=alpine.LFD.2.00.1005111643380.3401@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=alek.du@intel.com \
--cc=arjan@linux.intel.com \
--cc=feng.tang@intel.com \
--cc=hpa@zytor.com \
--cc=jacob.jun.pan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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