diff options
author | Joshua Kinard <kumba@gentoo.org> | 2015-04-16 15:49:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:11 -0400 |
commit | 15beb694c66146e1133b9ff81d54e3ef3daa1d7c (patch) | |
tree | de69c469d7f6260c51f8d22a6e0492c7f58f12f2 /arch/mips/sgi-ip32/ip32-platform.c | |
parent | 9e522c0d28d1418c2983ffbc3903f7bed3354180 (diff) |
mips: ip32: add platform data hooks to use DS1685 driver
This modifies the IP32 (SGI O2) platform and reset code to utilize the new
rtc-ds1685 driver. The old mc146818rtc.h header is removed and ip32_defconfig
is updated as well.
Signed-off-by: Joshua Kinard <kumba@gentoo.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mips/sgi-ip32/ip32-platform.c')
-rw-r--r-- | arch/mips/sgi-ip32/ip32-platform.c | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/arch/mips/sgi-ip32/ip32-platform.c b/arch/mips/sgi-ip32/ip32-platform.c index 511e9ff2acfd..b522477129a5 100644 --- a/arch/mips/sgi-ip32/ip32-platform.c +++ b/arch/mips/sgi-ip32/ip32-platform.c | |||
@@ -9,10 +9,13 @@ | |||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
11 | #include <linux/serial_8250.h> | 11 | #include <linux/serial_8250.h> |
12 | #include <linux/rtc/ds1685.h> | ||
12 | 13 | ||
13 | #include <asm/ip32/mace.h> | 14 | #include <asm/ip32/mace.h> |
14 | #include <asm/ip32/ip32_ints.h> | 15 | #include <asm/ip32/ip32_ints.h> |
15 | 16 | ||
17 | extern void ip32_prepare_poweroff(void); | ||
18 | |||
16 | #define MACEISA_SERIAL1_OFFS offsetof(struct sgi_mace, isa.serial1) | 19 | #define MACEISA_SERIAL1_OFFS offsetof(struct sgi_mace, isa.serial1) |
17 | #define MACEISA_SERIAL2_OFFS offsetof(struct sgi_mace, isa.serial2) | 20 | #define MACEISA_SERIAL2_OFFS offsetof(struct sgi_mace, isa.serial2) |
18 | 21 | ||
@@ -90,18 +93,47 @@ static __init int sgio2btns_devinit(void) | |||
90 | 93 | ||
91 | device_initcall(sgio2btns_devinit); | 94 | device_initcall(sgio2btns_devinit); |
92 | 95 | ||
93 | static struct resource sgio2_cmos_rsrc[] = { | 96 | #define MACE_RTC_RES_START (MACE_BASE + offsetof(struct sgi_mace, isa.rtc)) |
97 | #define MACE_RTC_RES_END (MACE_RTC_RES_START + 32767) | ||
98 | |||
99 | static struct resource ip32_rtc_resources[] = { | ||
94 | { | 100 | { |
95 | .start = 0x70, | 101 | .start = MACEISA_RTC_IRQ, |
96 | .end = 0x71, | 102 | .end = MACEISA_RTC_IRQ, |
97 | .flags = IORESOURCE_IO | 103 | .flags = IORESOURCE_IRQ |
104 | }, { | ||
105 | .start = MACE_RTC_RES_START, | ||
106 | .end = MACE_RTC_RES_END, | ||
107 | .flags = IORESOURCE_MEM, | ||
98 | } | 108 | } |
99 | }; | 109 | }; |
100 | 110 | ||
101 | static __init int sgio2_cmos_devinit(void) | 111 | /* RTC registers on IP32 are each padded by 256 bytes (0x100). */ |
112 | static struct ds1685_rtc_platform_data | ||
113 | ip32_rtc_platform_data[] = { | ||
114 | { | ||
115 | .regstep = 0x100, | ||
116 | .bcd_mode = true, | ||
117 | .no_irq = false, | ||
118 | .uie_unsupported = false, | ||
119 | .alloc_io_resources = true, | ||
120 | .plat_prepare_poweroff = ip32_prepare_poweroff, | ||
121 | }, | ||
122 | }; | ||
123 | |||
124 | struct platform_device ip32_rtc_device = { | ||
125 | .name = "rtc-ds1685", | ||
126 | .id = -1, | ||
127 | .dev = { | ||
128 | .platform_data = ip32_rtc_platform_data, | ||
129 | }, | ||
130 | .num_resources = ARRAY_SIZE(ip32_rtc_resources), | ||
131 | .resource = ip32_rtc_resources, | ||
132 | }; | ||
133 | |||
134 | +static int __init sgio2_rtc_devinit(void) | ||
102 | { | 135 | { |
103 | return IS_ERR(platform_device_register_simple("rtc_cmos", -1, | 136 | return platform_device_register(&ip32_rtc_device); |
104 | sgio2_cmos_rsrc, 1)); | ||
105 | } | 137 | } |
106 | 138 | ||
107 | device_initcall(sgio2_cmos_devinit); | 139 | device_initcall(sgio2_cmos_devinit); |