|
2 | 2 | #include <linux/errno.h>
|
3 | 3 | #include <linux/gpio.h>
|
4 | 4 | #include <linux/spi/spi.h>
|
5 |
| -#ifdef CONFIG_ARCH_BCM2708 |
6 |
| -#include <mach/platform.h> |
7 |
| -#endif |
8 | 5 | #include "fbtft.h"
|
9 | 6 |
|
10 | 7 | int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len)
|
@@ -129,171 +126,6 @@ int fbtft_read_spi(struct fbtft_par *par, void *buf, size_t len)
|
129 | 126 | }
|
130 | 127 | EXPORT_SYMBOL(fbtft_read_spi);
|
131 | 128 |
|
132 |
| - |
133 |
| -#ifdef CONFIG_ARCH_BCM2708 |
134 |
| - |
135 |
| -/* |
136 |
| - * Raspberry Pi |
137 |
| - * - writing directly to the registers is 40-50% faster than |
138 |
| - * optimized use of gpiolib |
139 |
| - */ |
140 |
| - |
141 |
| -#define GPIOSET(no, ishigh) \ |
142 |
| -do { \ |
143 |
| - if (ishigh) \ |
144 |
| - set |= (1 << (no)); \ |
145 |
| - else \ |
146 |
| - reset |= (1 << (no)); \ |
147 |
| -} while (0) |
148 |
| - |
149 |
| -int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) |
150 |
| -{ |
151 |
| - unsigned int set = 0; |
152 |
| - unsigned int reset = 0; |
153 |
| - u8 data; |
154 |
| - |
155 |
| - fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, |
156 |
| - "%s(len=%d): ", __func__, len); |
157 |
| - |
158 |
| - while (len--) { |
159 |
| - data = *(u8 *) buf; |
160 |
| - buf++; |
161 |
| - |
162 |
| - /* Set data */ |
163 |
| - GPIOSET(par->gpio.db[0], (data&0x01)); |
164 |
| - GPIOSET(par->gpio.db[1], (data&0x02)); |
165 |
| - GPIOSET(par->gpio.db[2], (data&0x04)); |
166 |
| - GPIOSET(par->gpio.db[3], (data&0x08)); |
167 |
| - GPIOSET(par->gpio.db[4], (data&0x10)); |
168 |
| - GPIOSET(par->gpio.db[5], (data&0x20)); |
169 |
| - GPIOSET(par->gpio.db[6], (data&0x40)); |
170 |
| - GPIOSET(par->gpio.db[7], (data&0x80)); |
171 |
| - writel(set, __io_address(GPIO_BASE+0x1C)); |
172 |
| - writel(reset, __io_address(GPIO_BASE+0x28)); |
173 |
| - |
174 |
| - /* Pulse /WR low */ |
175 |
| - writel((1<<par->gpio.wr), __io_address(GPIO_BASE+0x28)); |
176 |
| - writel(0, __io_address(GPIO_BASE+0x28)); /* used as a delay */ |
177 |
| - writel((1<<par->gpio.wr), __io_address(GPIO_BASE+0x1C)); |
178 |
| - |
179 |
| - set = 0; |
180 |
| - reset = 0; |
181 |
| - } |
182 |
| - |
183 |
| - return 0; |
184 |
| -} |
185 |
| -EXPORT_SYMBOL(fbtft_write_gpio8_wr); |
186 |
| - |
187 |
| -int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len) |
188 |
| -{ |
189 |
| - unsigned int set = 0; |
190 |
| - unsigned int reset = 0; |
191 |
| - u16 data; |
192 |
| - |
193 |
| - fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, |
194 |
| - "%s(len=%d): ", __func__, len); |
195 |
| - |
196 |
| - while (len) { |
197 |
| - len -= 2; |
198 |
| - data = *(u16 *) buf; |
199 |
| - buf += 2; |
200 |
| - |
201 |
| - /* Start writing by pulling down /WR */ |
202 |
| - gpio_set_value(par->gpio.wr, 0); |
203 |
| - |
204 |
| - /* Set data */ |
205 |
| - GPIOSET(par->gpio.db[0], (data&0x0001)); |
206 |
| - GPIOSET(par->gpio.db[1], (data&0x0002)); |
207 |
| - GPIOSET(par->gpio.db[2], (data&0x0004)); |
208 |
| - GPIOSET(par->gpio.db[3], (data&0x0008)); |
209 |
| - GPIOSET(par->gpio.db[4], (data&0x0010)); |
210 |
| - GPIOSET(par->gpio.db[5], (data&0x0020)); |
211 |
| - GPIOSET(par->gpio.db[6], (data&0x0040)); |
212 |
| - GPIOSET(par->gpio.db[7], (data&0x0080)); |
213 |
| - |
214 |
| - GPIOSET(par->gpio.db[8], (data&0x0100)); |
215 |
| - GPIOSET(par->gpio.db[9], (data&0x0200)); |
216 |
| - GPIOSET(par->gpio.db[10], (data&0x0400)); |
217 |
| - GPIOSET(par->gpio.db[11], (data&0x0800)); |
218 |
| - GPIOSET(par->gpio.db[12], (data&0x1000)); |
219 |
| - GPIOSET(par->gpio.db[13], (data&0x2000)); |
220 |
| - GPIOSET(par->gpio.db[14], (data&0x4000)); |
221 |
| - GPIOSET(par->gpio.db[15], (data&0x8000)); |
222 |
| - |
223 |
| - writel(set, __io_address(GPIO_BASE+0x1C)); |
224 |
| - writel(reset, __io_address(GPIO_BASE+0x28)); |
225 |
| - |
226 |
| - /* Pullup /WR */ |
227 |
| - gpio_set_value(par->gpio.wr, 1); |
228 |
| - |
229 |
| - set = 0; |
230 |
| - reset = 0; |
231 |
| - } |
232 |
| - |
233 |
| - return 0; |
234 |
| -} |
235 |
| -EXPORT_SYMBOL(fbtft_write_gpio16_wr); |
236 |
| - |
237 |
| -int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, void *buf, size_t len) |
238 |
| -{ |
239 |
| - unsigned int set = 0; |
240 |
| - unsigned int reset = 0; |
241 |
| - u16 data; |
242 |
| - |
243 |
| - fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, |
244 |
| - "%s(len=%d): ", __func__, len); |
245 |
| - |
246 |
| - while (len) { |
247 |
| - len -= 2; |
248 |
| - data = *(u16 *) buf; |
249 |
| - buf += 2; |
250 |
| - |
251 |
| - /* Start writing by pulling down /WR */ |
252 |
| - gpio_set_value(par->gpio.wr, 0); |
253 |
| - |
254 |
| - /* Low byte */ |
255 |
| - GPIOSET(par->gpio.db[0], (data&0x0001)); |
256 |
| - GPIOSET(par->gpio.db[1], (data&0x0002)); |
257 |
| - GPIOSET(par->gpio.db[2], (data&0x0004)); |
258 |
| - GPIOSET(par->gpio.db[3], (data&0x0008)); |
259 |
| - GPIOSET(par->gpio.db[4], (data&0x0010)); |
260 |
| - GPIOSET(par->gpio.db[5], (data&0x0020)); |
261 |
| - GPIOSET(par->gpio.db[6], (data&0x0040)); |
262 |
| - GPIOSET(par->gpio.db[7], (data&0x0080)); |
263 |
| - writel(set, __io_address(GPIO_BASE+0x1C)); |
264 |
| - writel(reset, __io_address(GPIO_BASE+0x28)); |
265 |
| - |
266 |
| - /* Pulse 'latch' high */ |
267 |
| - gpio_set_value(par->gpio.latch, 1); |
268 |
| - gpio_set_value(par->gpio.latch, 0); |
269 |
| - |
270 |
| - /* High byte */ |
271 |
| - GPIOSET(par->gpio.db[0], (data&0x0100)); |
272 |
| - GPIOSET(par->gpio.db[1], (data&0x0200)); |
273 |
| - GPIOSET(par->gpio.db[2], (data&0x0400)); |
274 |
| - GPIOSET(par->gpio.db[3], (data&0x0800)); |
275 |
| - GPIOSET(par->gpio.db[4], (data&0x1000)); |
276 |
| - GPIOSET(par->gpio.db[5], (data&0x2000)); |
277 |
| - GPIOSET(par->gpio.db[6], (data&0x4000)); |
278 |
| - GPIOSET(par->gpio.db[7], (data&0x8000)); |
279 |
| - writel(set, __io_address(GPIO_BASE+0x1C)); |
280 |
| - writel(reset, __io_address(GPIO_BASE+0x28)); |
281 |
| - |
282 |
| - /* Pullup /WR */ |
283 |
| - gpio_set_value(par->gpio.wr, 1); |
284 |
| - |
285 |
| - set = 0; |
286 |
| - reset = 0; |
287 |
| - } |
288 |
| - |
289 |
| - return 0; |
290 |
| -} |
291 |
| -EXPORT_SYMBOL(fbtft_write_gpio16_wr_latched); |
292 |
| - |
293 |
| -#undef GPIOSET |
294 |
| - |
295 |
| -#else |
296 |
| - |
297 | 129 | /*
|
298 | 130 | * Optimized use of gpiolib is twice as fast as no optimization
|
299 | 131 | * only one driver can use the optimized version at a time
|
@@ -405,5 +237,3 @@ int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, void *buf, size_t len)
|
405 | 237 | return -1;
|
406 | 238 | }
|
407 | 239 | EXPORT_SYMBOL(fbtft_write_gpio16_wr_latched);
|
408 |
| - |
409 |
| -#endif /* CONFIG_ARCH_BCM2708 */ |
0 commit comments