Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: IP27: Switch over to RTC class driver

This patchset removes some dead code and creates a platform device
for the RTC class driver.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Thomas Bogendoerfer and committed by
Ralf Baechle
3ec066cd 5f119f29

+22 -77
+22 -77
arch/mips/sgi-ip27/ip27-timer.c
··· 13 13 #include <linux/time.h> 14 14 #include <linux/timex.h> 15 15 #include <linux/mm.h> 16 + #include <linux/platform_device.h> 16 17 17 18 #include <asm/time.h> 18 19 #include <asm/pgtable.h> 19 20 #include <asm/sgialib.h> 20 21 #include <asm/sn/ioc3.h> 21 - #include <asm/m48t35.h> 22 22 #include <asm/sn/klconfig.h> 23 23 #include <asm/sn/arch.h> 24 24 #include <asm/sn/addrs.h> ··· 28 28 29 29 #define TICK_SIZE (tick_nsec / 1000) 30 30 31 - #if 0 32 - static int set_rtc_mmss(unsigned long nowtime) 33 - { 34 - int retval = 0; 35 - int real_seconds, real_minutes, cmos_minutes; 36 - struct m48t35_rtc *rtc; 37 - nasid_t nid; 38 - 39 - nid = get_nasid(); 40 - rtc = (struct m48t35_rtc *)(KL_CONFIG_CH_CONS_INFO(nid)->memory_base + 41 - IOC3_BYTEBUS_DEV0); 42 - 43 - rtc->control |= M48T35_RTC_READ; 44 - cmos_minutes = BCD2BIN(rtc->min); 45 - rtc->control &= ~M48T35_RTC_READ; 46 - 47 - /* 48 - * Since we're only adjusting minutes and seconds, don't interfere with 49 - * hour overflow. This avoids messing with unknown time zones but 50 - * requires your RTC not to be off by more than 15 minutes 51 - */ 52 - real_seconds = nowtime % 60; 53 - real_minutes = nowtime / 60; 54 - if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1) 55 - real_minutes += 30; /* correct for half hour time zone */ 56 - real_minutes %= 60; 57 - 58 - if (abs(real_minutes - cmos_minutes) < 30) { 59 - real_seconds = BIN2BCD(real_seconds); 60 - real_minutes = BIN2BCD(real_minutes); 61 - rtc->control |= M48T35_RTC_SET; 62 - rtc->sec = real_seconds; 63 - rtc->min = real_minutes; 64 - rtc->control &= ~M48T35_RTC_SET; 65 - } else { 66 - printk(KERN_WARNING 67 - "set_rtc_mmss: can't update from %d to %d\n", 68 - cmos_minutes, real_minutes); 69 - retval = -1; 70 - } 71 - 72 - return retval; 73 - } 74 - #endif 75 - 76 31 /* Includes for ioc3_init(). */ 77 32 #include <asm/sn/types.h> 78 33 #include <asm/sn/sn0/addrs.h> 79 34 #include <asm/sn/sn0/hubni.h> 80 35 #include <asm/sn/sn0/hubio.h> 81 36 #include <asm/pci/bridge.h> 82 - 83 - unsigned long read_persistent_clock(void) 84 - { 85 - unsigned int year, month, date, hour, min, sec; 86 - struct m48t35_rtc *rtc; 87 - nasid_t nid; 88 - 89 - nid = get_nasid(); 90 - rtc = (struct m48t35_rtc *)(KL_CONFIG_CH_CONS_INFO(nid)->memory_base + 91 - IOC3_BYTEBUS_DEV0); 92 - 93 - rtc->control |= M48T35_RTC_READ; 94 - sec = rtc->sec; 95 - min = rtc->min; 96 - hour = rtc->hour; 97 - date = rtc->date; 98 - month = rtc->month; 99 - year = rtc->year; 100 - rtc->control &= ~M48T35_RTC_READ; 101 - 102 - sec = BCD2BIN(sec); 103 - min = BCD2BIN(min); 104 - hour = BCD2BIN(hour); 105 - date = BCD2BIN(date); 106 - month = BCD2BIN(month); 107 - year = BCD2BIN(year); 108 - 109 - year += 1970; 110 - 111 - return mktime(year, month, date, hour, min, sec); 112 - } 113 37 114 38 static void enable_rt_irq(unsigned int irq) 115 39 { ··· 210 286 211 287 void __cpuinit hub_rtc_init(cnodeid_t cnode) 212 288 { 289 + 213 290 /* 214 291 * We only need to initialize the current node. 215 292 * If this is not the current node then it is a cpuless ··· 226 301 LOCAL_HUB_S(PI_RT_PEND_B, 0); 227 302 } 228 303 } 304 + 305 + static int __init sgi_ip27_rtc_devinit(void) 306 + { 307 + struct resource res; 308 + 309 + memset(&res, 0, sizeof(res)); 310 + res.start = XPHYSADDR(KL_CONFIG_CH_CONS_INFO(master_nasid)->memory_base + 311 + IOC3_BYTEBUS_DEV0); 312 + res.end = res.start + 32767; 313 + res.flags = IORESOURCE_MEM; 314 + 315 + return IS_ERR(platform_device_register_simple("rtc-m48t35", -1, 316 + &res, 1)); 317 + } 318 + 319 + /* 320 + * kludge make this a device_initcall after ioc3 resource conflicts 321 + * are resolved 322 + */ 323 + late_initcall(sgi_ip27_rtc_devinit);