aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/mrst
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2010-11-10 12:29:17 -0500
committerThomas Gleixner <tglx@linutronix.de>2010-11-11 05:34:27 -0500
commit0146f26145af75d53e12dbf23a36996aff373680 (patch)
tree3eb42ef8ccbf1af5fb85695accd8b8e84ebe0634 /arch/x86/platform/mrst
parent7309282c90d251cde77fe3b520a8276e25315c49 (diff)
rtc: Add drivers/rtc/rtc-mrst.c
Provide the standard kernel rtc driver interface on top of the vrtc layer added in the previous patch. Signed-off-by: Feng Tang <feng.tang@intel.com> LKML-Reference: <20101110172911.3311.20593.stgit@localhost.localdomain> [Fixed swapped arguments on IPC] Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> [Cleaned up and the device creation moved to arch/x86/platform] Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/platform/mrst')
-rw-r--r--arch/x86/platform/mrst/vrtc.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/x86/platform/mrst/vrtc.c b/arch/x86/platform/mrst/vrtc.c
index 4944bd521d2c..4d3f770456f7 100644
--- a/arch/x86/platform/mrst/vrtc.c
+++ b/arch/x86/platform/mrst/vrtc.c
@@ -20,6 +20,7 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/sfi.h> 22#include <linux/sfi.h>
23#include <linux/platform_device.h>
23 24
24#include <asm/mrst.h> 25#include <asm/mrst.h>
25#include <asm/mrst-vrtc.h> 26#include <asm/mrst-vrtc.h>
@@ -118,3 +119,48 @@ void __init mrst_rtc_init(void)
118 x86_platform.get_wallclock = vrtc_get_time; 119 x86_platform.get_wallclock = vrtc_get_time;
119 x86_platform.set_wallclock = vrtc_set_mmss; 120 x86_platform.set_wallclock = vrtc_set_mmss;
120} 121}
122
123/*
124 * The Moorestown platform has a memory mapped virtual RTC device that emulates
125 * the programming interface of the RTC.
126 */
127
128static struct resource vrtc_resources[] = {
129 [0] = {
130 .flags = IORESOURCE_MEM,
131 },
132 [1] = {
133 .flags = IORESOURCE_IRQ,
134 }
135};
136
137static struct platform_device vrtc_device = {
138 .name = "rtc_mrst",
139 .id = -1,
140 .resource = vrtc_resources,
141 .num_resources = ARRAY_SIZE(vrtc_resources),
142};
143
144/* Register the RTC device if appropriate */
145static int __init mrst_device_create(void)
146{
147 /* No Moorestown, no device */
148 if (!mrst_identify_cpu())
149 return -ENODEV;
150 /* No timer, no device */
151 if (!sfi_mrtc_num)
152 return -ENODEV;
153
154 /* iomem resource */
155 vrtc_resources[0].start = sfi_mrtc_array[0].phys_addr;
156 vrtc_resources[0].end = sfi_mrtc_array[0].phys_addr +
157 MRST_VRTC_MAP_SZ;
158 /* irq resource */
159 vrtc_resources[1].start = sfi_mrtc_array[0].irq;
160 vrtc_resources[1].end = sfi_mrtc_array[0].irq;
161
162 platform_device_register(&vrtc_device);
163 return 0;
164}
165
166module_init(mrst_device_create);