|
21 | 21 | #include <linux/linkage.h> |
22 | 22 | #include <linux/init.h> |
23 | 23 | #include <linux/major.h> |
24 | | -#include <linux/rtc.h> |
25 | 24 | #include <linux/interrupt.h> |
26 | 25 | #include <linux/module.h> |
| 26 | +#include <linux/platform_device.h> |
| 27 | +#include <linux/rtc/m48t59.h> |
27 | 28 |
|
28 | 29 | #include <asm/bootinfo.h> |
29 | 30 | #include <asm/bootinfo-vme.h> |
|
39 | 40 |
|
40 | 41 | extern t_bdid mvme_bdid; |
41 | 42 |
|
42 | | -static MK48T08ptr_t volatile rtc = (MK48T08ptr_t)MVME_RTC_BASE; |
43 | | - |
44 | 43 | static void mvme16x_get_model(char *model); |
45 | 44 | extern void mvme16x_sched_init(void); |
46 | | -extern int mvme16x_hwclk (int, struct rtc_time *); |
47 | 45 | extern void mvme16x_reset (void); |
48 | 46 |
|
49 | | -int bcd2int (unsigned char b); |
50 | | - |
51 | | - |
52 | 47 | unsigned short mvme16x_config; |
53 | 48 | EXPORT_SYMBOL(mvme16x_config); |
54 | 49 |
|
@@ -268,7 +263,6 @@ void __init config_mvme16x(void) |
268 | 263 |
|
269 | 264 | mach_sched_init = mvme16x_sched_init; |
270 | 265 | mach_init_IRQ = mvme16x_init_IRQ; |
271 | | - mach_hwclk = mvme16x_hwclk; |
272 | 266 | mach_reset = mvme16x_reset; |
273 | 267 | mach_get_model = mvme16x_get_model; |
274 | 268 | mach_get_hardware_list = mvme16x_get_hardware_list; |
@@ -312,6 +306,28 @@ void __init config_mvme16x(void) |
312 | 306 | } |
313 | 307 | } |
314 | 308 |
|
| 309 | +static struct resource m48t59_rsrc[] = { |
| 310 | + DEFINE_RES_MEM(MVME_RTC_BASE, 0x2000), |
| 311 | +}; |
| 312 | + |
| 313 | +static struct m48t59_plat_data m48t59_data = { |
| 314 | + .type = M48T59RTC_TYPE_M48T08, |
| 315 | + .yy_offset = 70, |
| 316 | +}; |
| 317 | + |
| 318 | +static int __init mvme16x_platform_init(void) |
| 319 | +{ |
| 320 | + if (!MACH_IS_MVME16x) |
| 321 | + return 0; |
| 322 | + |
| 323 | + platform_device_register_resndata(NULL, "rtc-m48t59", -1, |
| 324 | + m48t59_rsrc, ARRAY_SIZE(m48t59_rsrc), |
| 325 | + &m48t59_data, sizeof(m48t59_data)); |
| 326 | + return 0; |
| 327 | +} |
| 328 | + |
| 329 | +arch_initcall(mvme16x_platform_init); |
| 330 | + |
315 | 331 | static irqreturn_t mvme16x_abort_int (int irq, void *dev_id) |
316 | 332 | { |
317 | 333 | unsigned long *new = (unsigned long *)vectors; |
@@ -426,28 +442,3 @@ static u64 mvme16x_read_clk(struct clocksource *cs) |
426 | 442 |
|
427 | 443 | return ticks; |
428 | 444 | } |
429 | | - |
430 | | -int bcd2int (unsigned char b) |
431 | | -{ |
432 | | - return ((b>>4)*10 + (b&15)); |
433 | | -} |
434 | | - |
435 | | -int mvme16x_hwclk(int op, struct rtc_time *t) |
436 | | -{ |
437 | | - if (!op) { |
438 | | - rtc->ctrl = RTC_READ; |
439 | | - t->tm_year = bcd2int (rtc->bcd_year); |
440 | | - t->tm_mon = bcd2int(rtc->bcd_mth) - 1; |
441 | | - t->tm_mday = bcd2int (rtc->bcd_dom); |
442 | | - t->tm_hour = bcd2int (rtc->bcd_hr); |
443 | | - t->tm_min = bcd2int (rtc->bcd_min); |
444 | | - t->tm_sec = bcd2int (rtc->bcd_sec); |
445 | | - rtc->ctrl = 0; |
446 | | - if (t->tm_year < 70) |
447 | | - t->tm_year += 100; |
448 | | - } else { |
449 | | - /* FIXME Setting the time is not yet supported */ |
450 | | - return -EOPNOTSUPP; |
451 | | - } |
452 | | - return 0; |
453 | | -} |
0 commit comments