diff options
Diffstat (limited to 'arch/x86/platform/mrst')
-rw-r--r-- | arch/x86/platform/mrst/vrtc.c | 46 |
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 | |||
128 | static struct resource vrtc_resources[] = { | ||
129 | [0] = { | ||
130 | .flags = IORESOURCE_MEM, | ||
131 | }, | ||
132 | [1] = { | ||
133 | .flags = IORESOURCE_IRQ, | ||
134 | } | ||
135 | }; | ||
136 | |||
137 | static 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 */ | ||
145 | static 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 | |||
166 | module_init(mrst_device_create); | ||