aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion5x
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index baa25d0fd5c9..778b11860ee6 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -117,6 +117,7 @@ static struct platform_device ts78xx_ts_rtc_device = {
117 */ 117 */
118static int ts78xx_ts_rtc_load(void) 118static int ts78xx_ts_rtc_load(void)
119{ 119{
120 int rc;
120 unsigned char tmp_rtc0, tmp_rtc1; 121 unsigned char tmp_rtc0, tmp_rtc1;
121 122
122 tmp_rtc0 = ts78xx_ts_rtc_readbyte(126); 123 tmp_rtc0 = ts78xx_ts_rtc_readbyte(126);
@@ -130,16 +131,18 @@ static int ts78xx_ts_rtc_load(void)
130 && ts78xx_ts_rtc_readbyte(126) == 0x00) { 131 && ts78xx_ts_rtc_readbyte(126) == 0x00) {
131 ts78xx_ts_rtc_writebyte(tmp_rtc0, 126); 132 ts78xx_ts_rtc_writebyte(tmp_rtc0, 126);
132 ts78xx_ts_rtc_writebyte(tmp_rtc1, 127); 133 ts78xx_ts_rtc_writebyte(tmp_rtc1, 127);
134
133 if (ts78xx_fpga.supports.ts_rtc.init == 0) { 135 if (ts78xx_fpga.supports.ts_rtc.init == 0) {
134 ts78xx_fpga.supports.ts_rtc.init = 1; 136 rc = platform_device_register(&ts78xx_ts_rtc_device);
135 platform_device_register(&ts78xx_ts_rtc_device); 137 if (!rc)
138 ts78xx_fpga.supports.ts_rtc.init = 1;
136 } else 139 } else
137 platform_device_add(&ts78xx_ts_rtc_device); 140 rc = platform_device_add(&ts78xx_ts_rtc_device);
138 return 0; 141
142 return rc;
139 } 143 }
140 } 144 }
141 145
142 ts78xx_fpga.supports.ts_rtc.present = 0;
143 return -ENODEV; 146 return -ENODEV;
144}; 147};
145 148
@@ -150,7 +153,7 @@ static void ts78xx_ts_rtc_unload(void)
150#else 153#else
151static int ts78xx_ts_rtc_load(void) 154static int ts78xx_ts_rtc_load(void)
152{ 155{
153 return 0; 156 return -ENODEV;
154} 157}
155 158
156static void ts78xx_ts_rtc_unload(void) 159static void ts78xx_ts_rtc_unload(void)
@@ -184,8 +187,11 @@ static int ts78xx_fpga_load_devices(void)
184 187
185 if (ts78xx_fpga.supports.ts_rtc.present == 1) { 188 if (ts78xx_fpga.supports.ts_rtc.present == 1) {
186 tmp = ts78xx_ts_rtc_load(); 189 tmp = ts78xx_ts_rtc_load();
187 if (tmp) 190 if (tmp) {
188 printk(KERN_INFO "TS-78xx RTC not detected or enabled\n"); 191 printk(KERN_INFO "TS-78xx RTC"
192 " not detected or enabled\n");
193 ts78xx_fpga.supports.ts_rtc.present = 0;
194 }
189 ret |= tmp; 195 ret |= tmp;
190 } 196 }
191 197