diff options
author | Feng Tang <feng.tang@intel.com> | 2011-02-14 11:13:32 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-02-14 12:20:43 -0500 |
commit | 168202c7bf89d7a2abaf8deaf4bbed18a1f7b3a3 (patch) | |
tree | 7be510d8fcbc1c68582d1b3a64971e8a59e3d798 | |
parent | 6b617e224dfac0b64ed70dacdac50be6eb78a6a1 (diff) |
mrst/vrtc: Avoid using cmos rtc ops
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 in that the ioports are not present.
Also in vrtc driver, should avoid using cmos access to check UIP status.
[feng.tang@intel.com: use set_fixmap_offset_nocache() to simplify code]
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/platform/mrst/mrst.c | 2 | ||||
-rw-r--r-- | arch/x86/platform/mrst/vrtc.c | 16 | ||||
-rw-r--r-- | drivers/rtc/rtc-mrst.c | 13 |
3 files changed, 18 insertions, 13 deletions
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index fee0b4914e07..4c542c757cb4 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <asm/apic.h> | 31 | #include <asm/apic.h> |
32 | #include <asm/io_apic.h> | 32 | #include <asm/io_apic.h> |
33 | #include <asm/mrst.h> | 33 | #include <asm/mrst.h> |
34 | #include <asm/mrst-vrtc.h> | ||
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
35 | #include <asm/i8259.h> | 36 | #include <asm/i8259.h> |
36 | #include <asm/intel_scu_ipc.h> | 37 | #include <asm/intel_scu_ipc.h> |
@@ -294,6 +295,7 @@ void __init x86_mrst_early_setup(void) | |||
294 | 295 | ||
295 | x86_platform.calibrate_tsc = mrst_calibrate_tsc; | 296 | x86_platform.calibrate_tsc = mrst_calibrate_tsc; |
296 | x86_platform.i8042_detect = mrst_i8042_detect; | 297 | x86_platform.i8042_detect = mrst_i8042_detect; |
298 | x86_init.timers.wallclock_init = mrst_rtc_init; | ||
297 | x86_init.pci.init = pci_mrst_init; | 299 | x86_init.pci.init = pci_mrst_init; |
298 | x86_init.pci.fixup_irqs = x86_init_noop; | 300 | x86_init.pci.fixup_irqs = x86_init_noop; |
299 | 301 | ||
diff --git a/arch/x86/platform/mrst/vrtc.c b/arch/x86/platform/mrst/vrtc.c index 32cd7edd71a0..04cf645feb92 100644 --- a/arch/x86/platform/mrst/vrtc.c +++ b/arch/x86/platform/mrst/vrtc.c | |||
@@ -100,22 +100,14 @@ int vrtc_set_mmss(unsigned long nowtime) | |||
100 | 100 | ||
101 | void __init mrst_rtc_init(void) | 101 | void __init mrst_rtc_init(void) |
102 | { | 102 | { |
103 | unsigned long rtc_paddr; | 103 | unsigned long vrtc_paddr = sfi_mrtc_array[0].phys_addr; |
104 | void __iomem *virt_base; | ||
105 | 104 | ||
106 | sfi_table_parse(SFI_SIG_MRTC, NULL, NULL, sfi_parse_mrtc); | 105 | sfi_table_parse(SFI_SIG_MRTC, NULL, NULL, sfi_parse_mrtc); |
107 | if (!sfi_mrtc_num) | 106 | if (!sfi_mrtc_num || !vrtc_paddr) |
108 | return; | 107 | return; |
109 | 108 | ||
110 | rtc_paddr = sfi_mrtc_array[0].phys_addr; | 109 | vrtc_virt_base = (void __iomem *)set_fixmap_offset_nocache(FIX_LNW_VRTC, |
111 | 110 | vrtc_paddr); | |
112 | /* vRTC's register address may not be page aligned */ | ||
113 | set_fixmap_nocache(FIX_LNW_VRTC, rtc_paddr); | ||
114 | |||
115 | virt_base = (void __iomem *)__fix_to_virt(FIX_LNW_VRTC); | ||
116 | virt_base += rtc_paddr & ~PAGE_MASK; | ||
117 | vrtc_virt_base = virt_base; | ||
118 | |||
119 | x86_platform.get_wallclock = vrtc_get_time; | 111 | x86_platform.get_wallclock = vrtc_get_time; |
120 | x86_platform.set_wallclock = vrtc_set_mmss; | 112 | x86_platform.set_wallclock = vrtc_set_mmss; |
121 | } | 113 | } |
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c index bcd0cf63eb16..28e02e7580f4 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) | |||
62 | return rtc_intr & RTC_IRQMASK; | 62 | return rtc_intr & RTC_IRQMASK; |
63 | } | 63 | } |
64 | 64 | ||
65 | static inline unsigned char vrtc_is_updating(void) | ||
66 | { | ||
67 | unsigned char uip; | ||
68 | unsigned long flags; | ||
69 | |||
70 | spin_lock_irqsave(&rtc_lock, flags); | ||
71 | uip = (vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP); | ||
72 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
73 | return uip; | ||
74 | } | ||
75 | |||
65 | /* | 76 | /* |
66 | * rtc_time's year contains the increment over 1900, but vRTC's YEAR | 77 | * rtc_time's year contains the increment over 1900, but vRTC's YEAR |
67 | * register can't be programmed to value larger than 0x64, so vRTC | 78 | * 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) | |||
76 | { | 87 | { |
77 | unsigned long flags; | 88 | unsigned long flags; |
78 | 89 | ||
79 | if (rtc_is_updating()) | 90 | if (vrtc_is_updating()) |
80 | mdelay(20); | 91 | mdelay(20); |
81 | 92 | ||
82 | spin_lock_irqsave(&rtc_lock, flags); | 93 | spin_lock_irqsave(&rtc_lock, flags); |