aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2017-02-15 11:35:24 -0500
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-02-21 15:22:39 -0500
commit5e8bb41c514506358241c5eef09900b126190f54 (patch)
treebe58e054d345b55fca641d63595160b36e3da2fb
parent5594e88a440bb75ce6e7fe045b254503420df6d8 (diff)
ARM: Orion5x: ts78xx: remove RTC detection
The rtc-m48t86 driver now handles the RTC detection. Remove the redundant code from the platform. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-By: Alexander Clouter <alex+kernel@digriz.org.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c51
1 files changed, 12 insertions, 39 deletions
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index 8d597267d0c4..cb4c3747214a 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -109,50 +109,23 @@ static struct platform_device ts78xx_ts_rtc_device = {
109 .num_resources = 0, 109 .num_resources = 0,
110}; 110};
111 111
112/*
113 * TS uses some of the user storage space on the RTC chip so see if it is
114 * present; as it's an optional feature at purchase time and not all boards
115 * will have it present
116 *
117 * I've used the method TS use in their rtc7800.c example for the detection
118 *
119 * TODO: track down a guinea pig without an RTC to see if we can work out a
120 * better RTC detection routine
121 */
122static int ts78xx_ts_rtc_load(void) 112static int ts78xx_ts_rtc_load(void)
123{ 113{
124 int rc; 114 int rc;
125 unsigned char tmp_rtc0, tmp_rtc1; 115
126 116 if (ts78xx_fpga.supports.ts_rtc.init == 0) {
127 tmp_rtc0 = ts78xx_ts_rtc_readbyte(126); 117 rc = platform_device_register(&ts78xx_ts_rtc_device);
128 tmp_rtc1 = ts78xx_ts_rtc_readbyte(127); 118 if (!rc)
129 119 ts78xx_fpga.supports.ts_rtc.init = 1;
130 ts78xx_ts_rtc_writebyte(0x00, 126); 120 } else {
131 ts78xx_ts_rtc_writebyte(0x55, 127); 121 rc = platform_device_add(&ts78xx_ts_rtc_device);
132 if (ts78xx_ts_rtc_readbyte(127) == 0x55) {
133 ts78xx_ts_rtc_writebyte(0xaa, 127);
134 if (ts78xx_ts_rtc_readbyte(127) == 0xaa
135 && ts78xx_ts_rtc_readbyte(126) == 0x00) {
136 ts78xx_ts_rtc_writebyte(tmp_rtc0, 126);
137 ts78xx_ts_rtc_writebyte(tmp_rtc1, 127);
138
139 if (ts78xx_fpga.supports.ts_rtc.init == 0) {
140 rc = platform_device_register(&ts78xx_ts_rtc_device);
141 if (!rc)
142 ts78xx_fpga.supports.ts_rtc.init = 1;
143 } else
144 rc = platform_device_add(&ts78xx_ts_rtc_device);
145
146 if (rc)
147 pr_info("RTC could not be registered: %d\n",
148 rc);
149 return rc;
150 }
151 } 122 }
152 123
153 pr_info("RTC not found\n"); 124 if (rc)
154 return -ENODEV; 125 pr_info("RTC could not be registered: %d\n", rc);
155}; 126
127 return rc;
128}
156 129
157static void ts78xx_ts_rtc_unload(void) 130static void ts78xx_ts_rtc_unload(void)
158{ 131{