[at91] refresh kernel patches
[openwrt/svn-archive/archive.git] / target / linux / at91 / patches-2.6.21 / 000-at91patches.patch
1 Index: linux-2.6.21.7/arch/arm/boot/compressed/head-at91rm9200.S
2 ===================================================================
3 --- linux-2.6.21.7.orig/arch/arm/boot/compressed/head-at91rm9200.S
4 +++ linux-2.6.21.7/arch/arm/boot/compressed/head-at91rm9200.S
5 @@ -67,6 +67,12 @@
6 cmp r7, r3
7 beq 99f
8
9 + @ Promwad Chub : 1181
10 + mov r3, #(MACH_TYPE_CHUB & 0xff)
11 + orr r3, r3, #(MACH_TYPE_CHUB & 0xff00)
12 + cmp r7, r3
13 + beq 99f
14 +
15 @ Unknown board, use the AT91RM9200DK board
16 @ mov r7, #MACH_TYPE_AT91RM9200
17 mov r7, #(MACH_TYPE_AT91RM9200DK & 0xff)
18 Index: linux-2.6.21.7/arch/arm/mach-at91/Kconfig
19 ===================================================================
20 --- linux-2.6.21.7.orig/arch/arm/mach-at91/Kconfig
21 +++ linux-2.6.21.7/arch/arm/mach-at91/Kconfig
22 @@ -17,6 +17,9 @@ config ARCH_AT91SAM9261
23 config ARCH_AT91SAM9263
24 bool "AT91SAM9263"
25
26 +config ARCH_AT91SAM9RL
27 + bool "AT91SAM9RL"
28 +
29 endchoice
30
31 # ----------------------------------------------------------
32 @@ -87,6 +90,12 @@ config MACH_KAFA
33 help
34 Select this if you are using Sperry-Sun's KAFA board.
35
36 +config MACH_CHUB
37 + bool "Promwad Chub board"
38 + depends on ARCH_AT91RM9200
39 + help
40 + Select this if you are using Promwad's Chub board.
41 +
42 endif
43
44 # ----------------------------------------------------------
45 @@ -111,6 +120,13 @@ config MACH_AT91SAM9260EK
46 Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit
47 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933>
48
49 +config MACH_CAM60
50 + bool "KwikByte CAM60 board"
51 + depends on ARCH_AT91SAM9260
52 + help
53 + Select this if you are using KwikByte's CAM60 board based on the Atmel AT91SAM9260.
54 + <http://www.kwikbyte.com>
55 +
56 endif
57
58 # ----------------------------------------------------------
59 @@ -145,6 +161,20 @@ endif
60
61 # ----------------------------------------------------------
62
63 +if ARCH_AT91SAM9RL
64 +
65 +comment "AT91SAM9RL Board Type"
66 +
67 +config MACH_AT91SAM9RLEK
68 + bool "Atmel AT91SAM9RL-EK Evaluation Kit"
69 + depends on ARCH_AT91SAM9RL
70 + help
71 + Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
72 +
73 +endif
74 +
75 +# ----------------------------------------------------------
76 +
77 comment "AT91 Board Options"
78
79 config MTD_AT91_DATAFLASH_CARD
80 @@ -160,6 +190,20 @@ config MTD_NAND_AT91_BUSWIDTH_16
81 On AT91SAM926x boards both types of NAND flash can be present
82 (8 and 16 bit data bus width).
83
84 +config CSB300_WAKE_SW0
85 + bool "CSB300 SW0 irq0 wakeup"
86 + depends on MACH_CSB337 && PM
87 + help
88 + If you have a CSB300 connected to your CSB337, this lets
89 + SW0 serve as a wakeup button. It uses IRQ0.
90 +
91 +config CSB300_WAKE_SW1
92 + bool "CSB300 SW1 gpio wakeup"
93 + depends on MACH_CSB337 && PM
94 + help
95 + If you have a CSB300 connected to your CSB337, this lets
96 + SW1 serve as a wakeup button. It uses GPIO.
97 +
98 # ----------------------------------------------------------
99
100 comment "AT91 Feature Selections"
101 @@ -170,6 +214,20 @@ config AT91_PROGRAMMABLE_CLOCKS
102 Select this if you need to program one or more of the PCK0..PCK3
103 programmable clock outputs.
104
105 +config ATMEL_TCLIB
106 + bool "Timer/Counter Library"
107 + help
108 + Select this if you want a library to allocate the Timer/Counter
109 + blocks found on many Atmel processors. This facilitates using
110 + these modules despite processor differences.
111 +
112 +config AT91_SLOW_CLOCK
113 + bool "Suspend-to-RAM uses slow clock mode (EXPERIMENTAL)"
114 + depends on PM && EXPERIMENTAL
115 + help
116 + Select this if you wish to put the CPU into slow clock mode
117 + while in the "Suspend to RAM" state, to save more power.
118 +
119 endmenu
120
121 endif
122 Index: linux-2.6.21.7/arch/arm/mach-at91/Makefile
123 ===================================================================
124 --- linux-2.6.21.7.orig/arch/arm/mach-at91/Makefile
125 +++ linux-2.6.21.7/arch/arm/mach-at91/Makefile
126 @@ -8,12 +8,15 @@ obj-n :=
127 obj- :=
128
129 obj-$(CONFIG_PM) += pm.o
130 +obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o
131 +obj-$(CONFIG_ATMEL_TCLIB) += tclib.o
132
133 # CPU-specific support
134 obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o
135 obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o
136 obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o
137 obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o
138 +obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o
139
140 # AT91RM9200 board-specific support
141 obj-$(CONFIG_MACH_ONEARM) += board-1arm.o
142 @@ -25,9 +28,11 @@ obj-$(CONFIG_MACH_CARMEVA) += board-carm
143 obj-$(CONFIG_MACH_KB9200) += board-kb9202.o
144 obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o
145 obj-$(CONFIG_MACH_KAFA) += board-kafa.o
146 +obj-$(CONFIG_MACH_CHUB) += board-chub.o
147
148 # AT91SAM9260 board-specific support
149 obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
150 +obj-$(CONFIG_MACH_CAM60) += board-cam60.o
151
152 # AT91SAM9261 board-specific support
153 obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o
154 @@ -35,9 +40,13 @@ obj-$(CONFIG_MACH_AT91SAM9261EK) += boar
155 # AT91SAM9263 board-specific support
156 obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
157
158 +# AT91SAM9RL board-specific support
159 +obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
160 +
161 # LEDs support
162 led-$(CONFIG_ARCH_AT91RM9200DK) += leds.o
163 led-$(CONFIG_MACH_AT91RM9200EK) += leds.o
164 +led-$(CONFIG_MACH_AT91SAM9261EK)+= leds.o
165 led-$(CONFIG_MACH_CSB337) += leds.o
166 led-$(CONFIG_MACH_CSB637) += leds.o
167 led-$(CONFIG_MACH_KB9200) += leds.o
168 @@ -45,7 +54,7 @@ led-$(CONFIG_MACH_KAFA) += leds.o
169 obj-$(CONFIG_LEDS) += $(led-y)
170
171 # VGA support
172 -#obj-$(CONFIG_FB_S1D13XXX) += ics1523.o
173 +obj-$(CONFIG_FB_S1D13XXX) += ics1523.o
174
175
176 ifeq ($(CONFIG_PM_DEBUG),y)
177 Index: linux-2.6.21.7/arch/arm/mach-at91/at91rm9200.c
178 ===================================================================
179 --- linux-2.6.21.7.orig/arch/arm/mach-at91/at91rm9200.c
180 +++ linux-2.6.21.7/arch/arm/mach-at91/at91rm9200.c
181 @@ -117,6 +117,21 @@ static struct clk pioD_clk = {
182 .pmc_mask = 1 << AT91RM9200_ID_PIOD,
183 .type = CLK_TYPE_PERIPHERAL,
184 };
185 +static struct clk ssc0_clk = {
186 + .name = "ssc0_clk",
187 + .pmc_mask = 1 << AT91RM9200_ID_SSC0,
188 + .type = CLK_TYPE_PERIPHERAL,
189 +};
190 +static struct clk ssc1_clk = {
191 + .name = "ssc1_clk",
192 + .pmc_mask = 1 << AT91RM9200_ID_SSC1,
193 + .type = CLK_TYPE_PERIPHERAL,
194 +};
195 +static struct clk ssc2_clk = {
196 + .name = "ssc2_clk",
197 + .pmc_mask = 1 << AT91RM9200_ID_SSC2,
198 + .type = CLK_TYPE_PERIPHERAL,
199 +};
200 static struct clk tc0_clk = {
201 .name = "tc0_clk",
202 .pmc_mask = 1 << AT91RM9200_ID_TC0,
203 @@ -161,7 +176,9 @@ static struct clk *periph_clocks[] __ini
204 &udc_clk,
205 &twi_clk,
206 &spi_clk,
207 - // ssc 0 .. ssc2
208 + &ssc0_clk,
209 + &ssc1_clk,
210 + &ssc2_clk,
211 &tc0_clk,
212 &tc1_clk,
213 &tc2_clk,
214 @@ -250,6 +267,33 @@ static void at91rm9200_reset(void)
215
216
217 /* --------------------------------------------------------------------
218 + * Timer/Counter library initialization
219 + * -------------------------------------------------------------------- */
220 +#ifdef CONFIG_ATMEL_TCLIB
221 +
222 +#include "tclib.h"
223 +
224 +static struct atmel_tcblock at91rm9200_tcblocks[] = {
225 + [0] = {
226 + .physaddr = AT91RM9200_BASE_TCB0,
227 + .irq = { AT91RM9200_ID_TC0, AT91RM9200_ID_TC1, AT91RM9200_ID_TC2 },
228 + .clk = { &tc0_clk, &tc1_clk, &tc2_clk },
229 + },
230 + [1] = {
231 + .physaddr = AT91RM9200_BASE_TCB1,
232 + .irq = { AT91RM9200_ID_TC3, AT91RM9200_ID_TC4, AT91RM9200_ID_TC5 },
233 + .clk = { &tc3_clk, &tc4_clk, &tc5_clk },
234 + },
235 +};
236 +
237 +#define at91rm9200_tc_init() atmel_tc_init(at91rm9200_tcblocks, ARRAY_SIZE(at91rm9200_tcblocks))
238 +
239 +#else
240 +#define at91rm9200_tc_init() do {} while(0)
241 +#endif
242 +
243 +
244 +/* --------------------------------------------------------------------
245 * AT91RM9200 processor initialization
246 * -------------------------------------------------------------------- */
247 void __init at91rm9200_initialize(unsigned long main_clock, unsigned short banks)
248 @@ -271,6 +315,9 @@ void __init at91rm9200_initialize(unsign
249
250 /* Initialize GPIO subsystem */
251 at91_gpio_init(at91rm9200_gpio, banks);
252 +
253 + /* Initialize the Timer/Counter blocks */
254 + at91rm9200_tc_init();
255 }
256
257
258 @@ -284,28 +331,28 @@ void __init at91rm9200_initialize(unsign
259 static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
260 7, /* Advanced Interrupt Controller (FIQ) */
261 7, /* System Peripherals */
262 - 0, /* Parallel IO Controller A */
263 - 0, /* Parallel IO Controller B */
264 - 0, /* Parallel IO Controller C */
265 - 0, /* Parallel IO Controller D */
266 - 6, /* USART 0 */
267 - 6, /* USART 1 */
268 - 6, /* USART 2 */
269 - 6, /* USART 3 */
270 + 1, /* Parallel IO Controller A */
271 + 1, /* Parallel IO Controller B */
272 + 1, /* Parallel IO Controller C */
273 + 1, /* Parallel IO Controller D */
274 + 5, /* USART 0 */
275 + 5, /* USART 1 */
276 + 5, /* USART 2 */
277 + 5, /* USART 3 */
278 0, /* Multimedia Card Interface */
279 - 4, /* USB Device Port */
280 - 0, /* Two-Wire Interface */
281 - 6, /* Serial Peripheral Interface */
282 - 5, /* Serial Synchronous Controller 0 */
283 - 5, /* Serial Synchronous Controller 1 */
284 - 5, /* Serial Synchronous Controller 2 */
285 + 2, /* USB Device Port */
286 + 6, /* Two-Wire Interface */
287 + 5, /* Serial Peripheral Interface */
288 + 4, /* Serial Synchronous Controller 0 */
289 + 4, /* Serial Synchronous Controller 1 */
290 + 4, /* Serial Synchronous Controller 2 */
291 0, /* Timer Counter 0 */
292 0, /* Timer Counter 1 */
293 0, /* Timer Counter 2 */
294 0, /* Timer Counter 3 */
295 0, /* Timer Counter 4 */
296 0, /* Timer Counter 5 */
297 - 3, /* USB Host port */
298 + 2, /* USB Host port */
299 3, /* Ethernet MAC */
300 0, /* Advanced Interrupt Controller (IRQ0) */
301 0, /* Advanced Interrupt Controller (IRQ1) */
302 Index: linux-2.6.21.7/arch/arm/mach-at91/at91rm9200_devices.c
303 ===================================================================
304 --- linux-2.6.21.7.orig/arch/arm/mach-at91/at91rm9200_devices.c
305 +++ linux-2.6.21.7/arch/arm/mach-at91/at91rm9200_devices.c
306 @@ -480,7 +480,18 @@ void __init at91_add_device_i2c(void) {}
307 * SPI
308 * -------------------------------------------------------------------- */
309
310 -#if defined(CONFIG_SPI_AT91) || defined(CONFIG_SPI_AT91_MODULE) || defined(CONFIG_AT91_SPI) || defined(CONFIG_AT91_SPI_MODULE)
311 +#if defined(CONFIG_AT91_SPI) || defined(CONFIG_AT91_SPI_MODULE) /* legacy SPI driver */
312 +#define SPI_DEVNAME "at91_spi"
313 +
314 +#elif defined(CONFIG_SPI_AT91) || defined(CONFIG_SPI_AT91_MODULE) /* SPI bitbanging driver */
315 +#define SPI_DEVNAME "at91_spi"
316 +
317 +#elif defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) /* new SPI driver */
318 +#define SPI_DEVNAME "atmel_spi"
319 +
320 +#endif
321 +
322 +#ifdef SPI_DEVNAME
323 static u64 spi_dmamask = 0xffffffffUL;
324
325 static struct resource spi_resources[] = {
326 @@ -497,7 +508,7 @@ static struct resource spi_resources[] =
327 };
328
329 static struct platform_device at91rm9200_spi_device = {
330 - .name = "at91_spi",
331 + .name = SPI_DEVNAME,
332 .id = 0,
333 .dev = {
334 .dma_mask = &spi_dmamask,
335 @@ -606,6 +617,32 @@ void __init at91_init_leds(u8 cpu_led, u
336 #endif
337
338
339 +#if defined(CONFIG_NEW_LEDS)
340 +
341 +static struct platform_device at91_leds = {
342 + .name = "at91_leds",
343 + .id = -1,
344 +};
345 +
346 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr)
347 +{
348 + if (!nr)
349 + return;
350 +
351 + at91_leds.dev.platform_data = leds;
352 +
353 + for ( ; nr; nr--, leds++) {
354 + leds->index = nr; /* first record stores number of leds */
355 + at91_set_gpio_output(leds->gpio, (leds->flags & 1) == 0);
356 + }
357 +
358 + platform_device_register(&at91_leds);
359 +}
360 +#else
361 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr) {}
362 +#endif
363 +
364 +
365 /* --------------------------------------------------------------------
366 * UART
367 * -------------------------------------------------------------------- */
368 Index: linux-2.6.21.7/arch/arm/mach-at91/at91sam9260.c
369 ===================================================================
370 --- linux-2.6.21.7.orig/arch/arm/mach-at91/at91sam9260.c
371 +++ linux-2.6.21.7/arch/arm/mach-at91/at91sam9260.c
372 @@ -119,6 +119,11 @@ static struct clk spi1_clk = {
373 .pmc_mask = 1 << AT91SAM9260_ID_SPI1,
374 .type = CLK_TYPE_PERIPHERAL,
375 };
376 +static struct clk ssc_clk = {
377 + .name = "ssc_clk",
378 + .pmc_mask = 1 << AT91SAM9260_ID_SSC,
379 + .type = CLK_TYPE_PERIPHERAL,
380 +};
381 static struct clk tc0_clk = {
382 .name = "tc0_clk",
383 .pmc_mask = 1 << AT91SAM9260_ID_TC0,
384 @@ -193,7 +198,7 @@ static struct clk *periph_clocks[] __ini
385 &twi_clk,
386 &spi0_clk,
387 &spi1_clk,
388 - // ssc
389 + &ssc_clk,
390 &tc0_clk,
391 &tc1_clk,
392 &tc2_clk,
393 @@ -264,6 +269,33 @@ static void at91sam9260_reset(void)
394
395
396 /* --------------------------------------------------------------------
397 + * Timer/Counter library initialization
398 + * -------------------------------------------------------------------- */
399 +#ifdef CONFIG_ATMEL_TCLIB
400 +
401 +#include "tclib.h"
402 +
403 +static struct atmel_tcblock at91sam9260_tcblocks[] = {
404 + [0] = {
405 + .physaddr = AT91SAM9260_BASE_TCB0,
406 + .irq = { AT91SAM9260_ID_TC0, AT91SAM9260_ID_TC1, AT91SAM9260_ID_TC2 },
407 + .clk = { &tc0_clk, &tc1_clk, &tc2_clk },
408 + },
409 + [1] = {
410 + .physaddr = AT91SAM9260_BASE_TCB1,
411 + .irq = { AT91SAM9260_ID_TC3, AT91SAM9260_ID_TC4, AT91SAM9260_ID_TC5 },
412 + .clk = { &tc3_clk, &tc4_clk, &tc5_clk },
413 + },
414 +};
415 +
416 +#define at91sam9260_tc_init() atmel_tc_init(at91sam9260_tcblocks, ARRAY_SIZE(at91sam9260_tcblocks))
417 +
418 +#else
419 +#define at91sam9260_tc_init() do {} while(0)
420 +#endif
421 +
422 +
423 +/* --------------------------------------------------------------------
424 * AT91SAM9260 processor initialization
425 * -------------------------------------------------------------------- */
426
427 @@ -310,6 +342,9 @@ void __init at91sam9260_initialize(unsig
428
429 /* Register GPIO subsystem */
430 at91_gpio_init(at91sam9260_gpio, 3);
431 +
432 + /* Initialize the Timer/Counter blocks */
433 + at91sam9260_tc_init();
434 }
435
436 /* --------------------------------------------------------------------
437 @@ -322,30 +357,30 @@ void __init at91sam9260_initialize(unsig
438 static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
439 7, /* Advanced Interrupt Controller */
440 7, /* System Peripherals */
441 - 0, /* Parallel IO Controller A */
442 - 0, /* Parallel IO Controller B */
443 - 0, /* Parallel IO Controller C */
444 + 1, /* Parallel IO Controller A */
445 + 1, /* Parallel IO Controller B */
446 + 1, /* Parallel IO Controller C */
447 0, /* Analog-to-Digital Converter */
448 - 6, /* USART 0 */
449 - 6, /* USART 1 */
450 - 6, /* USART 2 */
451 + 5, /* USART 0 */
452 + 5, /* USART 1 */
453 + 5, /* USART 2 */
454 0, /* Multimedia Card Interface */
455 - 4, /* USB Device Port */
456 - 0, /* Two-Wire Interface */
457 - 6, /* Serial Peripheral Interface 0 */
458 - 6, /* Serial Peripheral Interface 1 */
459 + 2, /* USB Device Port */
460 + 6, /* Two-Wire Interface */
461 + 5, /* Serial Peripheral Interface 0 */
462 + 5, /* Serial Peripheral Interface 1 */
463 5, /* Serial Synchronous Controller */
464 0,
465 0,
466 0, /* Timer Counter 0 */
467 0, /* Timer Counter 1 */
468 0, /* Timer Counter 2 */
469 - 3, /* USB Host port */
470 + 2, /* USB Host port */
471 3, /* Ethernet */
472 0, /* Image Sensor Interface */
473 - 6, /* USART 3 */
474 - 6, /* USART 4 */
475 - 6, /* USART 5 */
476 + 5, /* USART 3 */
477 + 5, /* USART 4 */
478 + 5, /* USART 5 */
479 0, /* Timer Counter 3 */
480 0, /* Timer Counter 4 */
481 0, /* Timer Counter 5 */
482 Index: linux-2.6.21.7/arch/arm/mach-at91/at91sam9260_devices.c
483 ===================================================================
484 --- linux-2.6.21.7.orig/arch/arm/mach-at91/at91sam9260_devices.c
485 +++ linux-2.6.21.7/arch/arm/mach-at91/at91sam9260_devices.c
486 @@ -527,6 +527,32 @@ void __init at91_init_leds(u8 cpu_led, u
487 #endif
488
489
490 +#if defined(CONFIG_NEW_LEDS)
491 +
492 +static struct platform_device at91_leds = {
493 + .name = "at91_leds",
494 + .id = -1,
495 +};
496 +
497 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr)
498 +{
499 + if (!nr)
500 + return;
501 +
502 + at91_leds.dev.platform_data = leds;
503 +
504 + for ( ; nr; nr--, leds++) {
505 + leds->index = nr; /* first record stores number of leds */
506 + at91_set_gpio_output(leds->gpio, (leds->flags & 1) == 0);
507 + }
508 +
509 + platform_device_register(&at91_leds);
510 +}
511 +#else
512 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr) {}
513 +#endif
514 +
515 +
516 /* --------------------------------------------------------------------
517 * UART
518 * -------------------------------------------------------------------- */
519 Index: linux-2.6.21.7/arch/arm/mach-at91/at91sam9261.c
520 ===================================================================
521 --- linux-2.6.21.7.orig/arch/arm/mach-at91/at91sam9261.c
522 +++ linux-2.6.21.7/arch/arm/mach-at91/at91sam9261.c
523 @@ -97,6 +97,21 @@ static struct clk spi1_clk = {
524 .pmc_mask = 1 << AT91SAM9261_ID_SPI1,
525 .type = CLK_TYPE_PERIPHERAL,
526 };
527 +static struct clk ssc0_clk = {
528 + .name = "ssc0_clk",
529 + .pmc_mask = 1 << AT91SAM9261_ID_SSC0,
530 + .type = CLK_TYPE_PERIPHERAL,
531 +};
532 +static struct clk ssc1_clk = {
533 + .name = "ssc1_clk",
534 + .pmc_mask = 1 << AT91SAM9261_ID_SSC1,
535 + .type = CLK_TYPE_PERIPHERAL,
536 +};
537 +static struct clk ssc2_clk = {
538 + .name = "ssc2_clk",
539 + .pmc_mask = 1 << AT91SAM9261_ID_SSC2,
540 + .type = CLK_TYPE_PERIPHERAL,
541 +};
542 static struct clk tc0_clk = {
543 .name = "tc0_clk",
544 .pmc_mask = 1 << AT91SAM9261_ID_TC0,
545 @@ -135,7 +150,9 @@ static struct clk *periph_clocks[] __ini
546 &twi_clk,
547 &spi0_clk,
548 &spi1_clk,
549 - // ssc 0 .. ssc2
550 + &ssc0_clk,
551 + &ssc1_clk,
552 + &ssc2_clk,
553 &tc0_clk,
554 &tc1_clk,
555 &tc2_clk,
556 @@ -230,6 +247,28 @@ static void at91sam9261_reset(void)
557
558
559 /* --------------------------------------------------------------------
560 + * Timer/Counter library initialization
561 + * -------------------------------------------------------------------- */
562 +#ifdef CONFIG_ATMEL_TCLIB
563 +
564 +#include "tclib.h"
565 +
566 +static struct atmel_tcblock at91sam9261_tcblocks[] = {
567 + [0] = {
568 + .physaddr = AT91SAM9261_BASE_TCB0,
569 + .irq = { AT91SAM9261_ID_TC0, AT91SAM9261_ID_TC1, AT91SAM9261_ID_TC2 },
570 + .clk = { &tc0_clk, &tc1_clk, &tc2_clk },
571 + }
572 +};
573 +
574 +#define at91sam9261_tc_init() atmel_tc_init(at91sam9261_tcblocks, ARRAY_SIZE(at91sam9261_tcblocks))
575 +
576 +#else
577 +#define at91sam9261_tc_init() do {} while(0)
578 +#endif
579 +
580 +
581 +/* --------------------------------------------------------------------
582 * AT91SAM9261 processor initialization
583 * -------------------------------------------------------------------- */
584
585 @@ -250,6 +289,9 @@ void __init at91sam9261_initialize(unsig
586
587 /* Register GPIO subsystem */
588 at91_gpio_init(at91sam9261_gpio, 3);
589 +
590 + /* Initialize the Timer/Counter blocks */
591 + at91sam9261_tc_init();
592 }
593
594 /* --------------------------------------------------------------------
595 @@ -262,25 +304,25 @@ void __init at91sam9261_initialize(unsig
596 static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
597 7, /* Advanced Interrupt Controller */
598 7, /* System Peripherals */
599 - 0, /* Parallel IO Controller A */
600 - 0, /* Parallel IO Controller B */
601 - 0, /* Parallel IO Controller C */
602 - 0,
603 - 6, /* USART 0 */
604 - 6, /* USART 1 */
605 - 6, /* USART 2 */
606 + 1, /* Parallel IO Controller A */
607 + 1, /* Parallel IO Controller B */
608 + 1, /* Parallel IO Controller C */
609 + 0,
610 + 5, /* USART 0 */
611 + 5, /* USART 1 */
612 + 5, /* USART 2 */
613 0, /* Multimedia Card Interface */
614 - 4, /* USB Device Port */
615 - 0, /* Two-Wire Interface */
616 - 6, /* Serial Peripheral Interface 0 */
617 - 6, /* Serial Peripheral Interface 1 */
618 - 5, /* Serial Synchronous Controller 0 */
619 - 5, /* Serial Synchronous Controller 1 */
620 - 5, /* Serial Synchronous Controller 2 */
621 + 2, /* USB Device Port */
622 + 6, /* Two-Wire Interface */
623 + 5, /* Serial Peripheral Interface 0 */
624 + 5, /* Serial Peripheral Interface 1 */
625 + 4, /* Serial Synchronous Controller 0 */
626 + 4, /* Serial Synchronous Controller 1 */
627 + 4, /* Serial Synchronous Controller 2 */
628 0, /* Timer Counter 0 */
629 0, /* Timer Counter 1 */
630 0, /* Timer Counter 2 */
631 - 3, /* USB Host port */
632 + 2, /* USB Host port */
633 3, /* LCD Controller */
634 0,
635 0,
636 Index: linux-2.6.21.7/arch/arm/mach-at91/at91sam9261_devices.c
637 ===================================================================
638 --- linux-2.6.21.7.orig/arch/arm/mach-at91/at91sam9261_devices.c
639 +++ linux-2.6.21.7/arch/arm/mach-at91/at91sam9261_devices.c
640 @@ -14,6 +14,9 @@
641 #include <asm/mach/map.h>
642
643 #include <linux/platform_device.h>
644 +#include <linux/fb.h>
645 +
646 +#include <video/atmel_lcdc.h>
647
648 #include <asm/arch/board.h>
649 #include <asm/arch/gpio.h>
650 @@ -430,9 +433,9 @@ void __init at91_add_device_spi(struct s
651 * LCD Controller
652 * -------------------------------------------------------------------- */
653
654 -#if defined(CONFIG_FB_AT91) || defined(CONFIG_FB_AT91_MODULE)
655 +#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
656 static u64 lcdc_dmamask = 0xffffffffUL;
657 -static struct at91fb_info lcdc_data;
658 +static struct atmel_lcdfb_info lcdc_data;
659
660 static struct resource lcdc_resources[] = {
661 [0] = {
662 @@ -455,7 +458,7 @@ static struct resource lcdc_resources[]
663 };
664
665 static struct platform_device at91_lcdc_device = {
666 - .name = "at91-fb",
667 + .name = "atmel_lcdfb",
668 .id = 0,
669 .dev = {
670 .dma_mask = &lcdc_dmamask,
671 @@ -466,7 +469,7 @@ static struct platform_device at91_lcdc_
672 .num_resources = ARRAY_SIZE(lcdc_resources),
673 };
674
675 -void __init at91_add_device_lcdc(struct at91fb_info *data)
676 +void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
677 {
678 if (!data) {
679 return;
680 @@ -499,7 +502,7 @@ void __init at91_add_device_lcdc(struct
681 platform_device_register(&at91_lcdc_device);
682 }
683 #else
684 -void __init at91_add_device_lcdc(struct at91fb_info *data) {}
685 +void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
686 #endif
687
688
689 @@ -525,6 +528,32 @@ void __init at91_init_leds(u8 cpu_led, u
690 #endif
691
692
693 +#if defined(CONFIG_NEW_LEDS)
694 +
695 +static struct platform_device at91_leds = {
696 + .name = "at91_leds",
697 + .id = -1,
698 +};
699 +
700 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr)
701 +{
702 + if (!nr)
703 + return;
704 +
705 + at91_leds.dev.platform_data = leds;
706 +
707 + for ( ; nr; nr--, leds++) {
708 + leds->index = nr; /* first record stores number of leds */
709 + at91_set_gpio_output(leds->gpio, (leds->flags & 1) == 0);
710 + }
711 +
712 + platform_device_register(&at91_leds);
713 +}
714 +#else
715 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr) {}
716 +#endif
717 +
718 +
719 /* --------------------------------------------------------------------
720 * UART
721 * -------------------------------------------------------------------- */
722 Index: linux-2.6.21.7/arch/arm/mach-at91/at91sam9263.c
723 ===================================================================
724 --- linux-2.6.21.7.orig/arch/arm/mach-at91/at91sam9263.c
725 +++ linux-2.6.21.7/arch/arm/mach-at91/at91sam9263.c
726 @@ -87,6 +87,11 @@ static struct clk mmc1_clk = {
727 .pmc_mask = 1 << AT91SAM9263_ID_MCI1,
728 .type = CLK_TYPE_PERIPHERAL,
729 };
730 +static struct clk can_clk = {
731 + .name = "can_clk",
732 + .pmc_mask = 1 << AT91SAM9263_ID_CAN,
733 + .type = CLK_TYPE_PERIPHERAL,
734 +};
735 static struct clk twi_clk = {
736 .name = "twi_clk",
737 .pmc_mask = 1 << AT91SAM9263_ID_TWI,
738 @@ -102,16 +107,46 @@ static struct clk spi1_clk = {
739 .pmc_mask = 1 << AT91SAM9263_ID_SPI1,
740 .type = CLK_TYPE_PERIPHERAL,
741 };
742 +static struct clk ssc0_clk = {
743 + .name = "ssc0_clk",
744 + .pmc_mask = 1 << AT91SAM9263_ID_SSC0,
745 + .type = CLK_TYPE_PERIPHERAL,
746 +};
747 +static struct clk ssc1_clk = {
748 + .name = "ssc1_clk",
749 + .pmc_mask = 1 << AT91SAM9263_ID_SSC1,
750 + .type = CLK_TYPE_PERIPHERAL,
751 +};
752 +static struct clk ac97_clk = {
753 + .name = "ac97_clk",
754 + .pmc_mask = 1 << AT91SAM9263_ID_AC97C,
755 + .type = CLK_TYPE_PERIPHERAL,
756 +};
757 static struct clk tcb_clk = {
758 .name = "tcb_clk",
759 .pmc_mask = 1 << AT91SAM9263_ID_TCB,
760 .type = CLK_TYPE_PERIPHERAL,
761 };
762 +static struct clk pwmc_clk = {
763 + .name = "pwmc_clk",
764 + .pmc_mask = 1 << AT91SAM9263_ID_PWMC,
765 + .type = CLK_TYPE_PERIPHERAL,
766 +};
767 static struct clk macb_clk = {
768 .name = "macb_clk",
769 .pmc_mask = 1 << AT91SAM9263_ID_EMAC,
770 .type = CLK_TYPE_PERIPHERAL,
771 };
772 +static struct clk dma_clk = {
773 + .name = "dma_clk",
774 + .pmc_mask = 1 << AT91SAM9263_ID_DMA,
775 + .type = CLK_TYPE_PERIPHERAL,
776 +};
777 +static struct clk twodge_clk = {
778 + .name = "2dge_clk",
779 + .pmc_mask = 1 << AT91SAM9263_ID_2DGE,
780 + .type = CLK_TYPE_PERIPHERAL,
781 +};
782 static struct clk udc_clk = {
783 .name = "udc_clk",
784 .pmc_mask = 1 << AT91SAM9263_ID_UDP,
785 @@ -142,20 +177,21 @@ static struct clk *periph_clocks[] __ini
786 &usart2_clk,
787 &mmc0_clk,
788 &mmc1_clk,
789 - // can
790 + &can_clk,
791 &twi_clk,
792 &spi0_clk,
793 &spi1_clk,
794 - // ssc0 .. ssc1
795 - // ac97
796 + &ssc0_clk,
797 + &ssc1_clk,
798 + &ac97_clk,
799 &tcb_clk,
800 - // pwmc
801 + &pwmc_clk,
802 &macb_clk,
803 - // 2dge
804 + &twodge_clk,
805 &udc_clk,
806 &isi_clk,
807 &lcdc_clk,
808 - // dma
809 + &dma_clk,
810 &ohci_clk,
811 // irq0 .. irq1
812 };
813 @@ -237,6 +273,28 @@ static void at91sam9263_reset(void)
814
815
816 /* --------------------------------------------------------------------
817 + * Timer/Counter library initialization
818 + * -------------------------------------------------------------------- */
819 +#ifdef CONFIG_ATMEL_TCLIB
820 +
821 +#include "tclib.h"
822 +
823 +static struct atmel_tcblock at91sam9263_tcblocks[] = {
824 + [0] = {
825 + .physaddr = AT91SAM9263_BASE_TCB0,
826 + .irq = { AT91SAM9263_ID_TCB, AT91SAM9263_ID_TCB, AT91SAM9263_ID_TCB },
827 + .clk = { &tcb_clk, &tcb_clk, &tcb_clk },
828 + }
829 +};
830 +
831 +#define at91sam9263_tc_init() atmel_tc_init(at91sam9263_tcblocks, ARRAY_SIZE(at91sam9263_tcblocks))
832 +
833 +#else
834 +#define at91sam9263_tc_init() do {} while(0)
835 +#endif
836 +
837 +
838 +/* --------------------------------------------------------------------
839 * AT91SAM9263 processor initialization
840 * -------------------------------------------------------------------- */
841
842 @@ -256,6 +314,9 @@ void __init at91sam9263_initialize(unsig
843
844 /* Register GPIO subsystem */
845 at91_gpio_init(at91sam9263_gpio, 5);
846 +
847 + /* Initialize the Timer/Counter blocks */
848 + at91sam9263_tc_init();
849 }
850
851 /* --------------------------------------------------------------------
852 @@ -268,34 +329,34 @@ void __init at91sam9263_initialize(unsig
853 static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
854 7, /* Advanced Interrupt Controller (FIQ) */
855 7, /* System Peripherals */
856 - 0, /* Parallel IO Controller A */
857 - 0, /* Parallel IO Controller B */
858 - 0, /* Parallel IO Controller C, D and E */
859 + 1, /* Parallel IO Controller A */
860 + 1, /* Parallel IO Controller B */
861 + 1, /* Parallel IO Controller C, D and E */
862 0,
863 0,
864 - 6, /* USART 0 */
865 - 6, /* USART 1 */
866 - 6, /* USART 2 */
867 + 5, /* USART 0 */
868 + 5, /* USART 1 */
869 + 5, /* USART 2 */
870 0, /* Multimedia Card Interface 0 */
871 0, /* Multimedia Card Interface 1 */
872 - 4, /* CAN */
873 - 0, /* Two-Wire Interface */
874 - 6, /* Serial Peripheral Interface 0 */
875 - 6, /* Serial Peripheral Interface 1 */
876 - 5, /* Serial Synchronous Controller 0 */
877 - 5, /* Serial Synchronous Controller 1 */
878 - 6, /* AC97 Controller */
879 + 3, /* CAN */
880 + 6, /* Two-Wire Interface */
881 + 5, /* Serial Peripheral Interface 0 */
882 + 5, /* Serial Peripheral Interface 1 */
883 + 4, /* Serial Synchronous Controller 0 */
884 + 4, /* Serial Synchronous Controller 1 */
885 + 5, /* AC97 Controller */
886 0, /* Timer Counter 0, 1 and 2 */
887 0, /* Pulse Width Modulation Controller */
888 3, /* Ethernet */
889 0,
890 0, /* 2D Graphic Engine */
891 - 3, /* USB Device Port */
892 + 2, /* USB Device Port */
893 0, /* Image Sensor Interface */
894 3, /* LDC Controller */
895 0, /* DMA Controller */
896 0,
897 - 3, /* USB Host port */
898 + 2, /* USB Host port */
899 0, /* Advanced Interrupt Controller (IRQ0) */
900 0, /* Advanced Interrupt Controller (IRQ1) */
901 };
902 Index: linux-2.6.21.7/arch/arm/mach-at91/at91sam9263_devices.c
903 ===================================================================
904 --- linux-2.6.21.7.orig/arch/arm/mach-at91/at91sam9263_devices.c
905 +++ linux-2.6.21.7/arch/arm/mach-at91/at91sam9263_devices.c
906 @@ -13,6 +13,9 @@
907 #include <asm/mach/map.h>
908
909 #include <linux/platform_device.h>
910 +#include <linux/fb.h>
911 +
912 +#include <video/atmel_lcdc.h>
913
914 #include <asm/arch/board.h>
915 #include <asm/arch/gpio.h>
916 @@ -573,6 +576,180 @@ void __init at91_add_device_spi(struct s
917
918
919 /* --------------------------------------------------------------------
920 + * AC97
921 + * -------------------------------------------------------------------- */
922 +
923 +#if defined(CONFIG_SND_AT91_AC97) || defined(CONFIG_SND_AT91_AC97_MODULE)
924 +static u64 ac97_dmamask = 0xffffffffUL;
925 +static struct atmel_ac97_data ac97_data;
926 +
927 +static struct resource ac97_resources[] = {
928 + [0] = {
929 + .start = AT91SAM9263_BASE_AC97C,
930 + .end = AT91SAM9263_BASE_AC97C + SZ_16K - 1,
931 + .flags = IORESOURCE_MEM,
932 + },
933 + [1] = {
934 + .start = AT91SAM9263_ID_AC97C,
935 + .end = AT91SAM9263_ID_AC97C,
936 + .flags = IORESOURCE_IRQ,
937 + },
938 +};
939 +
940 +static struct platform_device at91sam9263_ac97_device = {
941 + .name = "ac97c",
942 + .id = 1,
943 + .dev = {
944 + .dma_mask = &ac97_dmamask,
945 + .coherent_dma_mask = 0xffffffff,
946 + .platform_data = &ac97_data,
947 + },
948 + .resource = ac97_resources,
949 + .num_resources = ARRAY_SIZE(ac97_resources),
950 +};
951 +
952 +void __init at91_add_device_ac97(struct atmel_ac97_data *data)
953 +{
954 + if (!data)
955 + return;
956 +
957 + at91_set_A_periph(AT91_PIN_PB0, 0); /* AC97FS */
958 + at91_set_A_periph(AT91_PIN_PB1, 0); /* AC97CK */
959 + at91_set_A_periph(AT91_PIN_PB2, 0); /* AC97TX */
960 + at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */
961 +
962 + /* reset */
963 + if (data->reset_pin)
964 + at91_set_gpio_output(data->reset_pin, 0);
965 +
966 + ac97_data = *ek_data;
967 + platform_device_register(&at91sam9263_ac97_device);
968 +}
969 +#else
970 +void __init at91_add_device_ac97(struct atmel_ac97_data *data) {}
971 +#endif
972 +
973 +
974 +/* --------------------------------------------------------------------
975 + * Image Sensor Interface
976 + * -------------------------------------------------------------------- */
977 +
978 +#if defined(CONFIG_VIDEO_AT91_ISI) || defined(CONFIG_VIDEO_AT91_ISI_MODULE)
979 +
980 +struct resource isi_resources[] = {
981 + [0] = {
982 + .start = AT91SAM9263_BASE_ISI,
983 + .end = AT91SAM9263_BASE_ISI + SZ_16K - 1,
984 + .flags = IORESOURCE_MEM,
985 + },
986 + [1] = {
987 + .start = AT91SAM9263_ID_ISI,
988 + .end = AT91SAM9263_ID_ISI,
989 + .flags = IORESOURCE_IRQ,
990 + },
991 +};
992 +
993 +static struct platform_device at91sam9263_isi_device = {
994 + .name = "at91_isi",
995 + .id = -1,
996 + .resource = isi_resources,
997 + .num_resources = ARRAY_SIZE(isi_resources),
998 +};
999 +
1000 +void __init at91_add_device_isi(void)
1001 +{
1002 + at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */
1003 + at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */
1004 + at91_set_A_periph(AT91_PIN_PE2, 0); /* ISI_D2 */
1005 + at91_set_A_periph(AT91_PIN_PE3, 0); /* ISI_D3 */
1006 + at91_set_A_periph(AT91_PIN_PE4, 0); /* ISI_D4 */
1007 + at91_set_A_periph(AT91_PIN_PE5, 0); /* ISI_D5 */
1008 + at91_set_A_periph(AT91_PIN_PE6, 0); /* ISI_D6 */
1009 + at91_set_A_periph(AT91_PIN_PE7, 0); /* ISI_D7 */
1010 + at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */
1011 + at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */
1012 + at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */
1013 + at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */
1014 + at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */
1015 + at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */
1016 + at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */
1017 + at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */
1018 +}
1019 +#else
1020 +void __init at91_add_device_isi(void) {}
1021 +#endif
1022 +
1023 +
1024 +/* --------------------------------------------------------------------
1025 + * LCD Controller
1026 + * -------------------------------------------------------------------- */
1027 +
1028 +#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
1029 +static u64 lcdc_dmamask = 0xffffffffUL;
1030 +static struct atmel_lcdfb_info lcdc_data;
1031 +
1032 +static struct resource lcdc_resources[] = {
1033 + [0] = {
1034 + .start = AT91SAM9263_LCDC_BASE,
1035 + .end = AT91SAM9263_LCDC_BASE + SZ_4K - 1,
1036 + .flags = IORESOURCE_MEM,
1037 + },
1038 + [1] = {
1039 + .start = AT91SAM9263_ID_LCDC,
1040 + .end = AT91SAM9263_ID_LCDC,
1041 + .flags = IORESOURCE_IRQ,
1042 + },
1043 +};
1044 +
1045 +static struct platform_device at91_lcdc_device = {
1046 + .name = "atmel_lcdfb",
1047 + .id = 0,
1048 + .dev = {
1049 + .dma_mask = &lcdc_dmamask,
1050 + .coherent_dma_mask = 0xffffffff,
1051 + .platform_data = &lcdc_data,
1052 + },
1053 + .resource = lcdc_resources,
1054 + .num_resources = ARRAY_SIZE(lcdc_resources),
1055 +};
1056 +
1057 +void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
1058 +{
1059 + if (!data)
1060 + return;
1061 +
1062 + at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
1063 + at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
1064 + at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
1065 + at91_set_B_periph(AT91_PIN_PB9, 0); /* LCDCC */
1066 + at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDD2 */
1067 + at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDD3 */
1068 + at91_set_A_periph(AT91_PIN_PC8, 0); /* LCDD4 */
1069 + at91_set_A_periph(AT91_PIN_PC9, 0); /* LCDD5 */
1070 + at91_set_A_periph(AT91_PIN_PC10, 0); /* LCDD6 */
1071 + at91_set_A_periph(AT91_PIN_PC11, 0); /* LCDD7 */
1072 + at91_set_A_periph(AT91_PIN_PC14, 0); /* LCDD10 */
1073 + at91_set_A_periph(AT91_PIN_PC15, 0); /* LCDD11 */
1074 + at91_set_A_periph(AT91_PIN_PC16, 0); /* LCDD12 */
1075 + at91_set_B_periph(AT91_PIN_PC12, 0); /* LCDD13 */
1076 + at91_set_A_periph(AT91_PIN_PC18, 0); /* LCDD14 */
1077 + at91_set_A_periph(AT91_PIN_PC19, 0); /* LCDD15 */
1078 + at91_set_A_periph(AT91_PIN_PC22, 0); /* LCDD18 */
1079 + at91_set_A_periph(AT91_PIN_PC23, 0); /* LCDD19 */
1080 + at91_set_A_periph(AT91_PIN_PC24, 0); /* LCDD20 */
1081 + at91_set_B_periph(AT91_PIN_PC17, 0); /* LCDD21 */
1082 + at91_set_A_periph(AT91_PIN_PC26, 0); /* LCDD22 */
1083 + at91_set_A_periph(AT91_PIN_PC27, 0); /* LCDD23 */
1084 +
1085 + lcdc_data = *data;
1086 + platform_device_register(&at91_lcdc_device);
1087 +}
1088 +#else
1089 +void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
1090 +#endif
1091 +
1092 +
1093 +/* --------------------------------------------------------------------
1094 * LEDs
1095 * -------------------------------------------------------------------- */
1096
1097 @@ -594,6 +771,32 @@ void __init at91_init_leds(u8 cpu_led, u
1098 #endif
1099
1100
1101 +#if defined(CONFIG_NEW_LEDS)
1102 +
1103 +static struct platform_device at91_leds = {
1104 + .name = "at91_leds",
1105 + .id = -1,
1106 +};
1107 +
1108 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr)
1109 +{
1110 + if (!nr)
1111 + return;
1112 +
1113 + at91_leds.dev.platform_data = leds;
1114 +
1115 + for ( ; nr; nr--, leds++) {
1116 + leds->index = nr; /* first record stores number of leds */
1117 + at91_set_gpio_output(leds->gpio, (leds->flags & 1) == 0);
1118 + }
1119 +
1120 + platform_device_register(&at91_leds);
1121 +}
1122 +#else
1123 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr) {}
1124 +#endif
1125 +
1126 +
1127 /* --------------------------------------------------------------------
1128 * UART
1129 * -------------------------------------------------------------------- */
1130 Index: linux-2.6.21.7/arch/arm/mach-at91/at91sam9rl.c
1131 ===================================================================
1132 --- /dev/null
1133 +++ linux-2.6.21.7/arch/arm/mach-at91/at91sam9rl.c
1134 @@ -0,0 +1,366 @@
1135 +/*
1136 + * arch/arm/mach-at91/at91sam9rl.c
1137 + *
1138 + * Copyright (C) 2005 SAN People
1139 + * Copyright (C) 2007 Atmel Corporation
1140 + *
1141 + * This file is subject to the terms and conditions of the GNU General Public
1142 + * License. See the file COPYING in the main directory of this archive for
1143 + * more details.
1144 + */
1145 +
1146 +#include <linux/module.h>
1147 +
1148 +#include <asm/mach/arch.h>
1149 +#include <asm/mach/map.h>
1150 +#include <asm/arch/cpu.h>
1151 +#include <asm/arch/at91sam9rl.h>
1152 +#include <asm/arch/at91_pmc.h>
1153 +#include <asm/arch/at91_rstc.h>
1154 +
1155 +#include "generic.h"
1156 +#include "clock.h"
1157 +
1158 +static struct map_desc at91sam9rl_io_desc[] __initdata = {
1159 + {
1160 + .virtual = AT91_VA_BASE_SYS,
1161 + .pfn = __phys_to_pfn(AT91_BASE_SYS),
1162 + .length = SZ_16K,
1163 + .type = MT_DEVICE,
1164 + },
1165 +};
1166 +
1167 +static struct map_desc at91sam9rl_sram_desc[] __initdata = {
1168 + {
1169 + .pfn = __phys_to_pfn(AT91SAM9RL_SRAM_BASE),
1170 + .type = MT_DEVICE,
1171 + }
1172 +};
1173 +
1174 +/* --------------------------------------------------------------------
1175 + * Clocks
1176 + * -------------------------------------------------------------------- */
1177 +
1178 +/*
1179 + * The peripheral clocks.
1180 + */
1181 +static struct clk pioA_clk = {
1182 + .name = "pioA_clk",
1183 + .pmc_mask = 1 << AT91SAM9RL_ID_PIOA,
1184 + .type = CLK_TYPE_PERIPHERAL,
1185 +};
1186 +static struct clk pioB_clk = {
1187 + .name = "pioB_clk",
1188 + .pmc_mask = 1 << AT91SAM9RL_ID_PIOB,
1189 + .type = CLK_TYPE_PERIPHERAL,
1190 +};
1191 +static struct clk pioC_clk = {
1192 + .name = "pioC_clk",
1193 + .pmc_mask = 1 << AT91SAM9RL_ID_PIOC,
1194 + .type = CLK_TYPE_PERIPHERAL,
1195 +};
1196 +static struct clk pioD_clk = {
1197 + .name = "pioD_clk",
1198 + .pmc_mask = 1 << AT91SAM9RL_ID_PIOD,
1199 + .type = CLK_TYPE_PERIPHERAL,
1200 +};
1201 +static struct clk usart0_clk = {
1202 + .name = "usart0_clk",
1203 + .pmc_mask = 1 << AT91SAM9RL_ID_US0,
1204 + .type = CLK_TYPE_PERIPHERAL,
1205 +};
1206 +static struct clk usart1_clk = {
1207 + .name = "usart1_clk",
1208 + .pmc_mask = 1 << AT91SAM9RL_ID_US1,
1209 + .type = CLK_TYPE_PERIPHERAL,
1210 +};
1211 +static struct clk usart2_clk = {
1212 + .name = "usart2_clk",
1213 + .pmc_mask = 1 << AT91SAM9RL_ID_US2,
1214 + .type = CLK_TYPE_PERIPHERAL,
1215 +};
1216 +static struct clk usart3_clk = {
1217 + .name = "usart3_clk",
1218 + .pmc_mask = 1 << AT91SAM9RL_ID_US3,
1219 + .type = CLK_TYPE_PERIPHERAL,
1220 +};
1221 +static struct clk mmc_clk = {
1222 + .name = "mci_clk",
1223 + .pmc_mask = 1 << AT91SAM9RL_ID_MCI,
1224 + .type = CLK_TYPE_PERIPHERAL,
1225 +};
1226 +static struct clk twi0_clk = {
1227 + .name = "twi0_clk",
1228 + .pmc_mask = 1 << AT91SAM9RL_ID_TWI0,
1229 + .type = CLK_TYPE_PERIPHERAL,
1230 +};
1231 +static struct clk twi1_clk = {
1232 + .name = "twi1_clk",
1233 + .pmc_mask = 1 << AT91SAM9RL_ID_TWI1,
1234 + .type = CLK_TYPE_PERIPHERAL,
1235 +};
1236 +static struct clk spi_clk = {
1237 + .name = "spi_clk",
1238 + .pmc_mask = 1 << AT91SAM9RL_ID_SPI,
1239 + .type = CLK_TYPE_PERIPHERAL,
1240 +};
1241 +static struct clk ssc0_clk = {
1242 + .name = "ssc0_clk",
1243 + .pmc_mask = 1 << AT91SAM9RL_ID_SSC0,
1244 + .type = CLK_TYPE_PERIPHERAL,
1245 +};
1246 +static struct clk ssc1_clk = {
1247 + .name = "ssc1_clk",
1248 + .pmc_mask = 1 << AT91SAM9RL_ID_SSC1,
1249 + .type = CLK_TYPE_PERIPHERAL,
1250 +};
1251 +static struct clk tc0_clk = {
1252 + .name = "tc0_clk",
1253 + .pmc_mask = 1 << AT91SAM9RL_ID_TC0,
1254 + .type = CLK_TYPE_PERIPHERAL,
1255 +};
1256 +static struct clk tc1_clk = {
1257 + .name = "tc1_clk",
1258 + .pmc_mask = 1 << AT91SAM9RL_ID_TC1,
1259 + .type = CLK_TYPE_PERIPHERAL,
1260 +};
1261 +static struct clk tc2_clk = {
1262 + .name = "tc2_clk",
1263 + .pmc_mask = 1 << AT91SAM9RL_ID_TC2,
1264 + .type = CLK_TYPE_PERIPHERAL,
1265 +};
1266 +static struct clk pwmc_clk = {
1267 + .name = "pwmc_clk",
1268 + .pmc_mask = 1 << AT91SAM9RL_ID_PWMC,
1269 + .type = CLK_TYPE_PERIPHERAL,
1270 +};
1271 +static struct clk tsc_clk = {
1272 + .name = "tsc_clk",
1273 + .pmc_mask = 1 << AT91SAM9RL_ID_TSC,
1274 + .type = CLK_TYPE_PERIPHERAL,
1275 +};
1276 +static struct clk dma_clk = {
1277 + .name = "dma_clk",
1278 + .pmc_mask = 1 << AT91SAM9RL_ID_DMA,
1279 + .type = CLK_TYPE_PERIPHERAL,
1280 +};
1281 +static struct clk udphs_clk = {
1282 + .name = "udphs_clk",
1283 + .pmc_mask = 1 << AT91SAM9RL_ID_UDPHS,
1284 + .type = CLK_TYPE_PERIPHERAL,
1285 +};
1286 +static struct clk lcdc_clk = {
1287 + .name = "lcdc_clk",
1288 + .pmc_mask = 1 << AT91SAM9RL_ID_LCDC,
1289 + .type = CLK_TYPE_PERIPHERAL,
1290 +};
1291 +static struct clk ac97_clk = {
1292 + .name = "ac97_clk",
1293 + .pmc_mask = 1 << AT91SAM9RL_ID_AC97C,
1294 + .type = CLK_TYPE_PERIPHERAL,
1295 +};
1296 +
1297 +static struct clk *periph_clocks[] __initdata = {
1298 + &pioA_clk,
1299 + &pioB_clk,
1300 + &pioC_clk,
1301 + &pioD_clk,
1302 + &usart0_clk,
1303 + &usart1_clk,
1304 + &usart2_clk,
1305 + &usart3_clk,
1306 + &mmc_clk,
1307 + &twi0_clk,
1308 + &twi1_clk,
1309 + &spi_clk,
1310 + &ssc0_clk,
1311 + &ssc1_clk,
1312 + &tc0_clk,
1313 + &tc1_clk,
1314 + &tc2_clk,
1315 + &pwmc_clk,
1316 + &tsc_clk,
1317 + &dma_clk,
1318 + &udphs_clk,
1319 + &lcdc_clk,
1320 + &ac97_clk,
1321 + // irq0
1322 +};
1323 +
1324 +/*
1325 + * The two programmable clocks.
1326 + * You must configure pin multiplexing to bring these signals out.
1327 + */
1328 +static struct clk pck0 = {
1329 + .name = "pck0",
1330 + .pmc_mask = AT91_PMC_PCK0,
1331 + .type = CLK_TYPE_PROGRAMMABLE,
1332 + .id = 0,
1333 +};
1334 +static struct clk pck1 = {
1335 + .name = "pck1",
1336 + .pmc_mask = AT91_PMC_PCK1,
1337 + .type = CLK_TYPE_PROGRAMMABLE,
1338 + .id = 1,
1339 +};
1340 +
1341 +static void __init at91sam9rl_register_clocks(void)
1342 +{
1343 + int i;
1344 +
1345 + for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
1346 + clk_register(periph_clocks[i]);
1347 +
1348 + clk_register(&pck0);
1349 + clk_register(&pck1);
1350 +}
1351 +
1352 +/* --------------------------------------------------------------------
1353 + * GPIO
1354 + * -------------------------------------------------------------------- */
1355 +
1356 +static struct at91_gpio_bank at91sam9rl_gpio[] = {
1357 + {
1358 + .id = AT91SAM9RL_ID_PIOA,
1359 + .offset = AT91_PIOA,
1360 + .clock = &pioA_clk,
1361 + }, {
1362 + .id = AT91SAM9RL_ID_PIOB,
1363 + .offset = AT91_PIOB,
1364 + .clock = &pioB_clk,
1365 + }, {
1366 + .id = AT91SAM9RL_ID_PIOC,
1367 + .offset = AT91_PIOC,
1368 + .clock = &pioC_clk,
1369 + }, {
1370 + .id = AT91SAM9RL_ID_PIOD,
1371 + .offset = AT91_PIOD,
1372 + .clock = &pioD_clk,
1373 + }
1374 +};
1375 +
1376 +static void at91sam9rl_reset(void)
1377 +{
1378 + at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
1379 +}
1380 +
1381 +
1382 +/* --------------------------------------------------------------------
1383 + * Timer/Counter library initialization
1384 + * -------------------------------------------------------------------- */
1385 +#ifdef CONFIG_ATMEL_TCLIB
1386 +
1387 +#include "tclib.h"
1388 +
1389 +static struct atmel_tcblock at91sam9rl_tcblocks[] = {
1390 + [0] = {
1391 + .physaddr = AT91SAM9RL_BASE_TCB0,
1392 + .irq = { AT91SAM9RL_ID_TC0, AT91SAM9RL_ID_TC1, AT91SAM9RL_ID_TC2 },
1393 + .clk = { &tc0_clk, &tc1_clk, &tc2_clk },
1394 + }
1395 +};
1396 +
1397 +#define at91sam9rl_tc_init() atmel_tc_init(at91sam9rl_tcblocks, ARRAY_SIZE(at91sam9rl_tcblocks))
1398 +
1399 +#else
1400 +#define at91sam9rl_tc_init() do {} while(0)
1401 +#endif
1402 +
1403 +
1404 +/* --------------------------------------------------------------------
1405 + * AT91SAM9RL processor initialization
1406 + * -------------------------------------------------------------------- */
1407 +
1408 +void __init at91sam9rl_initialize(unsigned long main_clock)
1409 +{
1410 + unsigned long cidr, sram_size;
1411 +
1412 + /* Map peripherals */
1413 + iotable_init(at91sam9rl_io_desc, ARRAY_SIZE(at91sam9rl_io_desc));
1414 +
1415 + cidr = at91_sys_read(AT91_DBGU_CIDR);
1416 +
1417 + switch (cidr & AT91_CIDR_SRAMSIZ) {
1418 + case AT91_CIDR_SRAMSIZ_32K:
1419 + sram_size = 2 * SZ_16K;
1420 + break;
1421 + case AT91_CIDR_SRAMSIZ_16K:
1422 + default:
1423 + sram_size = SZ_16K;
1424 + }
1425 +
1426 + at91sam9rl_sram_desc->virtual = AT91_IO_VIRT_BASE - sram_size;
1427 + at91sam9rl_sram_desc->length = sram_size;
1428 +
1429 + /* Map SRAM */
1430 + iotable_init(at91sam9rl_sram_desc, ARRAY_SIZE(at91sam9rl_sram_desc));
1431 +
1432 + at91_arch_reset = at91sam9rl_reset;
1433 + at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
1434 +
1435 + /* Init clock subsystem */
1436 + at91_clock_init(main_clock);
1437 +
1438 + /* Register the processor-specific clocks */
1439 + at91sam9rl_register_clocks();
1440 +
1441 + /* Register GPIO subsystem */
1442 + at91_gpio_init(at91sam9rl_gpio, 4);
1443 +
1444 + /* Initialize the Timer/Counter blocks */
1445 + at91sam9rl_tc_init();
1446 +}
1447 +
1448 +/* --------------------------------------------------------------------
1449 + * Interrupt initialization
1450 + * -------------------------------------------------------------------- */
1451 +
1452 +/*
1453 + * The default interrupt priority levels (0 = lowest, 7 = highest).
1454 + */
1455 +static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {
1456 + 7, /* Advanced Interrupt Controller */
1457 + 7, /* System Peripherals */
1458 + 1, /* Parallel IO Controller A */
1459 + 1, /* Parallel IO Controller B */
1460 + 1, /* Parallel IO Controller C */
1461 + 1, /* Parallel IO Controller D */
1462 + 5, /* USART 0 */
1463 + 5, /* USART 1 */
1464 + 5, /* USART 2 */
1465 + 5, /* USART 3 */
1466 + 0, /* Multimedia Card Interface */
1467 + 6, /* Two-Wire Interface 0 */
1468 + 6, /* Two-Wire Interface 1 */
1469 + 5, /* Serial Peripheral Interface */
1470 + 4, /* Serial Synchronous Controller 0 */
1471 + 4, /* Serial Synchronous Controller 1 */
1472 + 0, /* Timer Counter 0 */
1473 + 0, /* Timer Counter 1 */
1474 + 0, /* Timer Counter 2 */
1475 + 0,
1476 + 0, /* Touch Screen Controller */
1477 + 0, /* DMA Controller */
1478 + 2, /* USB Device High speed port */
1479 + 2, /* LCD Controller */
1480 + 6, /* AC97 Controller */
1481 + 0,
1482 + 0,
1483 + 0,
1484 + 0,
1485 + 0,
1486 + 0,
1487 + 0, /* Advanced Interrupt Controller */
1488 +};
1489 +
1490 +void __init at91sam9rl_init_interrupts(unsigned int priority[NR_AIC_IRQS])
1491 +{
1492 + if (!priority)
1493 + priority = at91sam9rl_default_irq_priority;
1494 +
1495 + /* Initialize the AIC interrupt controller */
1496 + at91_aic_init(priority);
1497 +
1498 + /* Enable GPIO interrupts */
1499 + at91_gpio_irq_setup();
1500 +}
1501 Index: linux-2.6.21.7/arch/arm/mach-at91/at91sam9rl_devices.c
1502 ===================================================================
1503 --- /dev/null
1504 +++ linux-2.6.21.7/arch/arm/mach-at91/at91sam9rl_devices.c
1505 @@ -0,0 +1,660 @@
1506 +/*
1507 + * Copyright (C) 2007 Atmel Corporation
1508 + *
1509 + * This file is subject to the terms and conditions of the GNU General Public
1510 + * License. See the file COPYING in the main directory of this archive for
1511 + * more details.
1512 + */
1513 +
1514 +#include <asm/mach/arch.h>
1515 +#include <asm/mach/map.h>
1516 +
1517 +#include <linux/platform_device.h>
1518 +#include <linux/fb.h>
1519 +
1520 +#include <video/atmel_lcdc.h>
1521 +
1522 +#include <asm/arch/board.h>
1523 +#include <asm/arch/gpio.h>
1524 +#include <asm/arch/at91sam9rl.h>
1525 +#include <asm/arch/at91sam9rl_matrix.h>
1526 +#include <asm/arch/at91sam926x_mc.h>
1527 +
1528 +#include "generic.h"
1529 +
1530 +#define SZ_512 0x00000200
1531 +#define SZ_256 0x00000100
1532 +#define SZ_16 0x00000010
1533 +
1534 +
1535 +/* --------------------------------------------------------------------
1536 + * MMC / SD
1537 + * -------------------------------------------------------------------- */
1538 +
1539 +#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
1540 +static u64 mmc_dmamask = 0xffffffffUL;
1541 +static struct at91_mmc_data mmc_data;
1542 +
1543 +static struct resource mmc_resources[] = {
1544 + [0] = {
1545 + .start = AT91SAM9RL_BASE_MCI,
1546 + .end = AT91SAM9RL_BASE_MCI + SZ_16K - 1,
1547 + .flags = IORESOURCE_MEM,
1548 + },
1549 + [1] = {
1550 + .start = AT91SAM9RL_ID_MCI,
1551 + .end = AT91SAM9RL_ID_MCI,
1552 + .flags = IORESOURCE_IRQ,
1553 + },
1554 +};
1555 +
1556 +static struct platform_device at91sam9rl_mmc_device = {
1557 + .name = "at91_mci",
1558 + .id = -1,
1559 + .dev = {
1560 + .dma_mask = &mmc_dmamask,
1561 + .coherent_dma_mask = 0xffffffff,
1562 + .platform_data = &mmc_data,
1563 + },
1564 + .resource = mmc_resources,
1565 + .num_resources = ARRAY_SIZE(mmc_resources),
1566 +};
1567 +
1568 +void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
1569 +{
1570 + if (!data)
1571 + return;
1572 +
1573 + /* input/irq */
1574 + if (data->det_pin) {
1575 + at91_set_gpio_input(data->det_pin, 1);
1576 + at91_set_deglitch(data->det_pin, 1);
1577 + }
1578 + if (data->wp_pin)
1579 + at91_set_gpio_input(data->wp_pin, 1);
1580 + if (data->vcc_pin)
1581 + at91_set_gpio_output(data->vcc_pin, 0);
1582 +
1583 + /* CLK */
1584 + at91_set_A_periph(AT91_PIN_PA2, 0);
1585 +
1586 + /* CMD */
1587 + at91_set_A_periph(AT91_PIN_PA1, 1);
1588 +
1589 + /* DAT0, maybe DAT1..DAT3 */
1590 + at91_set_A_periph(AT91_PIN_PA0, 1);
1591 + if (data->wire4) {
1592 + at91_set_A_periph(AT91_PIN_PA3, 1);
1593 + at91_set_A_periph(AT91_PIN_PA4, 1);
1594 + at91_set_A_periph(AT91_PIN_PA5, 1);
1595 + }
1596 +
1597 + mmc_data = *data;
1598 + platform_device_register(&at91sam9rl_mmc_device);
1599 +}
1600 +#else
1601 +void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
1602 +#endif
1603 +
1604 +
1605 +/* --------------------------------------------------------------------
1606 + * NAND / SmartMedia
1607 + * -------------------------------------------------------------------- */
1608 +
1609 +#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
1610 +static struct at91_nand_data nand_data;
1611 +
1612 +#define NAND_BASE AT91_CHIPSELECT_3
1613 +
1614 +static struct resource nand_resources[] = {
1615 + {
1616 + .start = NAND_BASE,
1617 + .end = NAND_BASE + SZ_256M - 1,
1618 + .flags = IORESOURCE_MEM,
1619 + }
1620 +};
1621 +
1622 +static struct platform_device at91_nand_device = {
1623 + .name = "at91_nand",
1624 + .id = -1,
1625 + .dev = {
1626 + .platform_data = &nand_data,
1627 + },
1628 + .resource = nand_resources,
1629 + .num_resources = ARRAY_SIZE(nand_resources),
1630 +};
1631 +
1632 +void __init at91_add_device_nand(struct at91_nand_data *data)
1633 +{
1634 + unsigned long csa;
1635 +
1636 + if (!data)
1637 + return;
1638 +
1639 + csa = at91_sys_read(AT91_MATRIX_EBICSA);
1640 + at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
1641 +
1642 + /* set the bus interface characteristics */
1643 + at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
1644 + | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
1645 +
1646 + at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5)
1647 + | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5));
1648 +
1649 + at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7));
1650 +
1651 + at91_sys_write(AT91_SMC_MODE(3), AT91_SMC_DBW_8 | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1));
1652 +
1653 + /* enable pin */
1654 + if (data->enable_pin)
1655 + at91_set_gpio_output(data->enable_pin, 1);
1656 +
1657 + /* ready/busy pin */
1658 + if (data->rdy_pin)
1659 + at91_set_gpio_input(data->rdy_pin, 1);
1660 +
1661 + /* card detect pin */
1662 + if (data->det_pin)
1663 + at91_set_gpio_input(data->det_pin, 1);
1664 +
1665 + at91_set_A_periph(AT91_PIN_PB4, 0); /* NANDOE */
1666 + at91_set_A_periph(AT91_PIN_PB5, 0); /* NANDWE */
1667 +
1668 + nand_data = *data;
1669 + platform_device_register(&at91_nand_device);
1670 +}
1671 +
1672 +#else
1673 +void __init at91_add_device_nand(struct at91_nand_data *data) {}
1674 +#endif
1675 +
1676 +
1677 +/* --------------------------------------------------------------------
1678 + * TWI (i2c)
1679 + * -------------------------------------------------------------------- */
1680 +
1681 +#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
1682 +
1683 +static struct resource twi_resources[] = {
1684 + [0] = {
1685 + .start = AT91SAM9RL_BASE_TWI0,
1686 + .end = AT91SAM9RL_BASE_TWI0 + SZ_16K - 1,
1687 + .flags = IORESOURCE_MEM,
1688 + },
1689 + [1] = {
1690 + .start = AT91SAM9RL_ID_TWI0,
1691 + .end = AT91SAM9RL_ID_TWI0,
1692 + .flags = IORESOURCE_IRQ,
1693 + },
1694 +};
1695 +
1696 +static struct platform_device at91sam9rl_twi_device = {
1697 + .name = "at91_i2c",
1698 + .id = -1,
1699 + .resource = twi_resources,
1700 + .num_resources = ARRAY_SIZE(twi_resources),
1701 +};
1702 +
1703 +void __init at91_add_device_i2c(void)
1704 +{
1705 + /* pins used for TWI interface */
1706 + at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
1707 + at91_set_multi_drive(AT91_PIN_PA23, 1);
1708 +
1709 + at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
1710 + at91_set_multi_drive(AT91_PIN_PA24, 1);
1711 +
1712 + platform_device_register(&at91sam9rl_twi_device);
1713 +}
1714 +#else
1715 +void __init at91_add_device_i2c(void) {}
1716 +#endif
1717 +
1718 +
1719 +/* --------------------------------------------------------------------
1720 + * SPI
1721 + * -------------------------------------------------------------------- */
1722 +
1723 +#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
1724 +static u64 spi_dmamask = 0xffffffffUL;
1725 +
1726 +static struct resource spi_resources[] = {
1727 + [0] = {
1728 + .start = AT91SAM9RL_BASE_SPI,
1729 + .end = AT91SAM9RL_BASE_SPI + SZ_16K - 1,
1730 + .flags = IORESOURCE_MEM,
1731 + },
1732 + [1] = {
1733 + .start = AT91SAM9RL_ID_SPI,
1734 + .end = AT91SAM9RL_ID_SPI,
1735 + .flags = IORESOURCE_IRQ,
1736 + },
1737 +};
1738 +
1739 +static struct platform_device at91sam9rl_spi_device = {
1740 + .name = "atmel_spi",
1741 + .id = 0,
1742 + .dev = {
1743 + .dma_mask = &spi_dmamask,
1744 + .coherent_dma_mask = 0xffffffff,
1745 + },
1746 + .resource = spi_resources,
1747 + .num_resources = ARRAY_SIZE(spi_resources),
1748 +};
1749 +
1750 +static const unsigned spi_standard_cs[4] = { AT91_PIN_PA28, AT91_PIN_PB7, AT91_PIN_PD8, AT91_PIN_PD9 };
1751 +
1752 +
1753 +void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
1754 +{
1755 + int i;
1756 + unsigned long cs_pin;
1757 +
1758 + at91_set_A_periph(AT91_PIN_PA25, 0); /* MISO */
1759 + at91_set_A_periph(AT91_PIN_PA26, 0); /* MOSI */
1760 + at91_set_A_periph(AT91_PIN_PA27, 0); /* SPCK */
1761 +
1762 + /* Enable SPI chip-selects */
1763 + for (i = 0; i < nr_devices; i++) {
1764 + if (devices[i].controller_data)
1765 + cs_pin = (unsigned long) devices[i].controller_data;
1766 + else
1767 + cs_pin = spi_standard_cs[devices[i].chip_select];
1768 +
1769 + /* enable chip-select pin */
1770 + at91_set_gpio_output(cs_pin, 1);
1771 +
1772 + /* pass chip-select pin to driver */
1773 + devices[i].controller_data = (void *) cs_pin;
1774 + }
1775 +
1776 + spi_register_board_info(devices, nr_devices);
1777 + platform_device_register(&at91sam9rl_spi_device);
1778 +}
1779 +#else
1780 +void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
1781 +#endif
1782 +
1783 +
1784 +/* --------------------------------------------------------------------
1785 + * LCD Controller
1786 + * -------------------------------------------------------------------- */
1787 +
1788 +#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
1789 +static u64 lcdc_dmamask = 0xffffffffUL;
1790 +static struct atmel_lcdfb_info lcdc_data;
1791 +
1792 +static struct resource lcdc_resources[] = {
1793 + [0] = {
1794 + .start = AT91SAM9RL_LCDC_BASE,
1795 + .end = AT91SAM9RL_LCDC_BASE + SZ_4K - 1,
1796 + .flags = IORESOURCE_MEM,
1797 + },
1798 + [1] = {
1799 + .start = AT91SAM9RL_ID_LCDC,
1800 + .end = AT91SAM9RL_ID_LCDC,
1801 + .flags = IORESOURCE_IRQ,
1802 + },
1803 +#if defined(CONFIG_FB_INTSRAM)
1804 + [2] = {
1805 + .start = AT91SAM9RL_SRAM_BASE,
1806 + .end = AT91SAM9RL_SRAM_BASE + AT91SAM9RL_SRAM_SIZE - 1,
1807 + .flags = IORESOURCE_MEM,
1808 + },
1809 +#endif
1810 +};
1811 +
1812 +static struct platform_device at91_lcdc_device = {
1813 + .name = "atmel_lcdfb",
1814 + .id = 0,
1815 + .dev = {
1816 + .dma_mask = &lcdc_dmamask,
1817 + .coherent_dma_mask = 0xffffffff,
1818 + .platform_data = &lcdc_data,
1819 + },
1820 + .resource = lcdc_resources,
1821 + .num_resources = ARRAY_SIZE(lcdc_resources),
1822 +};
1823 +
1824 +void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
1825 +{
1826 + if (!data) {
1827 + return;
1828 + }
1829 +
1830 +#warning "Check this"
1831 + at91_set_B_periph(AT91_PIN_PC5, 0); /* LCDHSYNC */
1832 + at91_set_B_periph(AT91_PIN_PC6, 0); /* LCDDOTCK */
1833 + at91_set_B_periph(AT91_PIN_PC7, 0); /* LCDDEN */
1834 + at91_set_B_periph(AT91_PIN_PC3, 0); /* LCDCC */
1835 + at91_set_B_periph(AT91_PIN_PC9, 0); /* LCDD3 */
1836 + at91_set_B_periph(AT91_PIN_PC10, 0); /* LCDD4 */
1837 + at91_set_B_periph(AT91_PIN_PC11, 0); /* LCDD5 */
1838 + at91_set_B_periph(AT91_PIN_PC12, 0); /* LCDD6 */
1839 + at91_set_B_periph(AT91_PIN_PC13, 0); /* LCDD7 */
1840 + at91_set_B_periph(AT91_PIN_PC15, 0); /* LCDD11 */
1841 + at91_set_B_periph(AT91_PIN_PC16, 0); /* LCDD12 */
1842 + at91_set_B_periph(AT91_PIN_PC17, 0); /* LCDD13 */
1843 + at91_set_B_periph(AT91_PIN_PC18, 0); /* LCDD14 */
1844 + at91_set_B_periph(AT91_PIN_PC19, 0); /* LCDD15 */
1845 + at91_set_B_periph(AT91_PIN_PC20, 0); /* LCDD18 */
1846 + at91_set_B_periph(AT91_PIN_PC21, 0); /* LCDD19 */
1847 + at91_set_B_periph(AT91_PIN_PC22, 0); /* LCDD20 */
1848 + at91_set_B_periph(AT91_PIN_PC23, 0); /* LCDD21 */
1849 + at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */
1850 + at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */
1851 +
1852 + lcdc_data = *data;
1853 + platform_device_register(&at91_lcdc_device);
1854 +}
1855 +#else
1856 +void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
1857 +#endif
1858 +
1859 +
1860 +/* --------------------------------------------------------------------
1861 + * LEDs
1862 + * -------------------------------------------------------------------- */
1863 +
1864 +#if defined(CONFIG_LEDS)
1865 +u8 at91_leds_cpu;
1866 +u8 at91_leds_timer;
1867 +
1868 +void __init at91_init_leds(u8 cpu_led, u8 timer_led)
1869 +{
1870 + /* Enable GPIO to access the LEDs */
1871 + at91_set_gpio_output(cpu_led, 1);
1872 + at91_set_gpio_output(timer_led, 1);
1873 +
1874 + at91_leds_cpu = cpu_led;
1875 + at91_leds_timer = timer_led;
1876 +}
1877 +#else
1878 +void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
1879 +#endif
1880 +
1881 +
1882 +#if defined(CONFIG_NEW_LEDS)
1883 +
1884 +static struct platform_device at91_leds = {
1885 + .name = "at91_leds",
1886 + .id = -1,
1887 +};
1888 +
1889 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr)
1890 +{
1891 + if (!nr)
1892 + return;
1893 +
1894 + at91_leds.dev.platform_data = leds;
1895 +
1896 + for ( ; nr; nr--, leds++) {
1897 + leds->index = nr; /* first record stores number of leds */
1898 + at91_set_gpio_output(leds->gpio, (leds->flags & 1) == 0);
1899 + }
1900 +
1901 + platform_device_register(&at91_leds);
1902 +}
1903 +#else
1904 +void __init at91_gpio_leds(struct at91_gpio_led *leds, int nr) {}
1905 +#endif
1906 +
1907 +
1908 +/* --------------------------------------------------------------------
1909 + * UART
1910 + * -------------------------------------------------------------------- */
1911 +
1912 +#if defined(CONFIG_SERIAL_ATMEL)
1913 +static struct resource dbgu_resources[] = {
1914 + [0] = {
1915 + .start = AT91_VA_BASE_SYS + AT91_DBGU,
1916 + .end = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1,
1917 + .flags = IORESOURCE_MEM,
1918 + },
1919 + [1] = {
1920 + .start = AT91_ID_SYS,
1921 + .end = AT91_ID_SYS,
1922 + .flags = IORESOURCE_IRQ,
1923 + },
1924 +};
1925 +
1926 +static struct atmel_uart_data dbgu_data = {
1927 + .use_dma_tx = 0,
1928 + .use_dma_rx = 0, /* DBGU not capable of receive DMA */
1929 + .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
1930 +};
1931 +
1932 +static struct platform_device at91sam9rl_dbgu_device = {
1933 + .name = "atmel_usart",
1934 + .id = 0,
1935 + .dev = {
1936 + .platform_data = &dbgu_data,
1937 + .coherent_dma_mask = 0xffffffff,
1938 + },
1939 + .resource = dbgu_resources,
1940 + .num_resources = ARRAY_SIZE(dbgu_resources),
1941 +};
1942 +
1943 +static inline void configure_dbgu_pins(void)
1944 +{
1945 + at91_set_A_periph(AT91_PIN_PA21, 0); /* DRXD */
1946 + at91_set_A_periph(AT91_PIN_PA22, 1); /* DTXD */
1947 +}
1948 +
1949 +static struct resource uart0_resources[] = {
1950 + [0] = {
1951 + .start = AT91SAM9RL_BASE_US0,
1952 + .end = AT91SAM9RL_BASE_US0 + SZ_16K - 1,
1953 + .flags = IORESOURCE_MEM,
1954 + },
1955 + [1] = {
1956 + .start = AT91SAM9RL_ID_US0,
1957 + .end = AT91SAM9RL_ID_US0,
1958 + .flags = IORESOURCE_IRQ,
1959 + },
1960 +};
1961 +
1962 +static struct atmel_uart_data uart0_data = {
1963 + .use_dma_tx = 1,
1964 + .use_dma_rx = 1,
1965 +};
1966 +
1967 +static struct platform_device at91sam9rl_uart0_device = {
1968 + .name = "atmel_usart",
1969 + .id = 1,
1970 + .dev = {
1971 + .platform_data = &uart0_data,
1972 + .coherent_dma_mask = 0xffffffff,
1973 + },
1974 + .resource = uart0_resources,
1975 + .num_resources = ARRAY_SIZE(uart0_resources),
1976 +};
1977 +
1978 +static inline void configure_usart0_pins(void)
1979 +{
1980 + at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */
1981 + at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */
1982 + at91_set_A_periph(AT91_PIN_PA9, 0); /* RTS0 */
1983 + at91_set_A_periph(AT91_PIN_PA10, 0); /* CTS0 */
1984 +}
1985 +
1986 +static struct resource uart1_resources[] = {
1987 + [0] = {
1988 + .start = AT91SAM9RL_BASE_US1,
1989 + .end = AT91SAM9RL_BASE_US1 + SZ_16K - 1,
1990 + .flags = IORESOURCE_MEM,
1991 + },
1992 + [1] = {
1993 + .start = AT91SAM9RL_ID_US1,
1994 + .end = AT91SAM9RL_ID_US1,
1995 + .flags = IORESOURCE_IRQ,
1996 + },
1997 +};
1998 +
1999 +static struct atmel_uart_data uart1_data = {
2000 + .use_dma_tx = 1,
2001 + .use_dma_rx = 1,
2002 +};
2003 +
2004 +static struct platform_device at91sam9rl_uart1_device = {
2005 + .name = "atmel_usart",
2006 + .id = 2,
2007 + .dev = {
2008 + .platform_data = &uart1_data,
2009 + .coherent_dma_mask = 0xffffffff,
2010 + },
2011 + .resource = uart1_resources,
2012 + .num_resources = ARRAY_SIZE(uart1_resources),
2013 +};
2014 +
2015 +static inline void configure_usart1_pins(void)
2016 +{
2017 + at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */
2018 + at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */
2019 +}
2020 +
2021 +static struct resource uart2_resources[] = {
2022 + [0] = {
2023 + .start = AT91SAM9RL_BASE_US2,
2024 + .end = AT91SAM9RL_BASE_US2 + SZ_16K - 1,
2025 + .flags = IORESOURCE_MEM,
2026 + },
2027 + [1] = {
2028 + .start = AT91SAM9RL_ID_US2,
2029 + .end = AT91SAM9RL_ID_US2,
2030 + .flags = IORESOURCE_IRQ,
2031 + },
2032 +};
2033 +
2034 +static struct atmel_uart_data uart2_data = {
2035 + .use_dma_tx = 1,
2036 + .use_dma_rx = 1,
2037 +};
2038 +
2039 +static struct platform_device at91sam9rl_uart2_device = {
2040 + .name = "atmel_usart",
2041 + .id = 3,
2042 + .dev = {
2043 + .platform_data = &uart2_data,
2044 + .coherent_dma_mask = 0xffffffff,
2045 + },
2046 + .resource = uart2_resources,
2047 + .num_resources = ARRAY_SIZE(uart2_resources),
2048 +};
2049 +
2050 +static inline void configure_usart2_pins(void)
2051 +{
2052 + at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */
2053 + at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */
2054 +}
2055 +
2056 +static struct resource uart3_resources[] = {
2057 + [0] = {
2058 + .start = AT91SAM9RL_BASE_US3,
2059 + .end = AT91SAM9RL_BASE_US3 + SZ_16K - 1,
2060 + .flags = IORESOURCE_MEM,
2061 + },
2062 + [1] = {
2063 + .start = AT91SAM9RL_ID_US3,
2064 + .end = AT91SAM9RL_ID_US3,
2065 + .flags = IORESOURCE_IRQ,
2066 + },
2067 +};
2068 +
2069 +static struct atmel_uart_data uart3_data = {
2070 + .use_dma_tx = 1,
2071 + .use_dma_rx = 1,
2072 +};
2073 +
2074 +static struct platform_device at91sam9rl_uart3_device = {
2075 + .name = "atmel_usart",
2076 + .id = 4,
2077 + .dev = {
2078 + .platform_data = &uart3_data,
2079 + .coherent_dma_mask = 0xffffffff,
2080 + },
2081 + .resource = uart3_resources,
2082 + .num_resources = ARRAY_SIZE(uart3_resources),
2083 +};
2084 +
2085 +static inline void configure_usart3_pins(void)
2086 +{
2087 + at91_set_A_periph(AT91_PIN_PB0, 1); /* TXD3 */
2088 + at91_set_A_periph(AT91_PIN_PB1, 0); /* RXD3 */
2089 +}
2090 +
2091 +struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
2092 +struct platform_device *atmel_default_console_device; /* the serial console device */
2093 +
2094 +void __init at91_init_serial(struct at91_uart_config *config)
2095 +{
2096 + int i;
2097 +
2098 + /* Fill in list of supported UARTs */
2099 + for (i = 0; i < config->nr_tty; i++) {
2100 + switch (config->tty_map[i]) {
2101 + case 0:
2102 + configure_usart0_pins();
2103 + at91_uarts[i] = &at91sam9rl_uart0_device;
2104 + at91_clock_associate("usart0_clk", &at91sam9rl_uart0_device.dev, "usart");
2105 + break;
2106 + case 1:
2107 + configure_usart1_pins();
2108 + at91_uarts[i] = &at91sam9rl_uart1_device;
2109 + at91_clock_associate("usart1_clk", &at91sam9rl_uart1_device.dev, "usart");
2110 + break;
2111 + case 2:
2112 + configure_usart2_pins();
2113 + at91_uarts[i] = &at91sam9rl_uart2_device;
2114 + at91_clock_associate("usart2_clk", &at91sam9rl_uart2_device.dev, "usart");
2115 + break;
2116 + case 3:
2117 + configure_usart3_pins();
2118 + at91_uarts[i] = &at91sam9rl_uart3_device;
2119 + at91_clock_associate("usart3_clk", &at91sam9rl_uart3_device.dev, "usart");
2120 + break;
2121 + case 4:
2122 + configure_dbgu_pins();
2123 + at91_uarts[i] = &at91sam9rl_dbgu_device;
2124 + at91_clock_associate("mck", &at91sam9rl_dbgu_device.dev, "usart");
2125 + break;
2126 + default:
2127 + continue;
2128 + }
2129 + at91_uarts[i]->id = i; /* update ID number to mapped ID */
2130 + }
2131 +
2132 + /* Set serial console device */
2133 + if (config->console_tty < ATMEL_MAX_UART)
2134 + atmel_default_console_device = at91_uarts[config->console_tty];
2135 + if (!atmel_default_console_device)
2136 + printk(KERN_INFO "AT91: No default serial console defined.\n");
2137 +}
2138 +
2139 +void __init at91_add_device_serial(void)
2140 +{
2141 + int i;
2142 +
2143 + for (i = 0; i < ATMEL_MAX_UART; i++) {
2144 + if (at91_uarts[i])
2145 + platform_device_register(at91_uarts[i]);
2146 + }
2147 +}
2148 +#else
2149 +void __init at91_init_serial(struct at91_uart_config *config) {}
2150 +void __init at91_add_device_serial(void) {}
2151 +#endif
2152 +
2153 +
2154 +/* -------------------------------------------------------------------- */
2155 +
2156 +/*
2157 + * These devices are always present and don't need any board-specific
2158 + * setup.
2159 + */
2160 +static int __init at91_add_standard_devices(void)
2161 +{
2162 + return 0;
2163 +}
2164 +
2165 +arch_initcall(at91_add_standard_devices);
2166 Index: linux-2.6.21.7/arch/arm/mach-at91/board-cam60.c
2167 ===================================================================
2168 --- /dev/null
2169 +++ linux-2.6.21.7/arch/arm/mach-at91/board-cam60.c
2170 @@ -0,0 +1,148 @@
2171 +/*
2172 + * KwikByte CAM60
2173 + *
2174 + * based on board-sam9260ek.c
2175 + * Copyright (C) 2005 SAN People
2176 + * Copyright (C) 2006 Atmel
2177 + *
2178 + * This program is free software; you can redistribute it and/or modify
2179 + * it under the terms of the GNU General Public License as published by
2180 + * the Free Software Foundation; either version 2 of the License, or
2181 + * (at your option) any later version.
2182 + *
2183 + * This program is distributed in the hope that it will be useful,
2184 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2185 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2186 + * GNU General Public License for more details.
2187 + *
2188 + * You should have received a copy of the GNU General Public License
2189 + * along with this program; if not, write to the Free Software
2190 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2191 + */
2192 +
2193 +#include <linux/types.h>
2194 +#include <linux/init.h>
2195 +#include <linux/mm.h>
2196 +#include <linux/module.h>
2197 +#include <linux/platform_device.h>
2198 +#include <linux/spi/spi.h>
2199 +#include <linux/spi/flash.h>
2200 +
2201 +#include <asm/hardware.h>
2202 +#include <asm/setup.h>
2203 +#include <asm/mach-types.h>
2204 +#include <asm/irq.h>
2205 +
2206 +#include <asm/mach/arch.h>
2207 +#include <asm/mach/map.h>
2208 +#include <asm/mach/irq.h>
2209 +
2210 +#include <asm/arch/board.h>
2211 +#include <asm/arch/gpio.h>
2212 +#include <asm/arch/at91sam926x_mc.h>
2213 +
2214 +#include "generic.h"
2215 +
2216 +
2217 +/*
2218 + * Serial port configuration.
2219 + * 0 .. 5 = USART0 .. USART5
2220 + * 6 = DBGU
2221 + */
2222 +static struct at91_uart_config __initdata cam60_uart_config = {
2223 + .console_tty = 0, /* ttyS0 */
2224 + .nr_tty = 1,
2225 + .tty_map = { 6, -1, -1, -1, -1, -1, -1 } /* ttyS0, ..., ttyS6 */
2226 +};
2227 +
2228 +static void __init cam60_map_io(void)
2229 +{
2230 + /* Initialize processor: 10 MHz crystal */
2231 + at91sam9260_initialize(10000000);
2232 +
2233 + /* Setup the serial ports and console */
2234 + at91_init_serial(&cam60_uart_config);
2235 +}
2236 +
2237 +static void __init cam60_init_irq(void)
2238 +{
2239 + at91sam9260_init_interrupts(NULL);
2240 +}
2241 +
2242 +
2243 +/*
2244 + * SPI devices.
2245 + */
2246 +#if defined(CONFIG_MTD_DATAFLASH)
2247 +static struct mtd_partition __initdata cam60_spi_partitions[] = {
2248 + {
2249 + .name = "BOOT1",
2250 + .offset = 0,
2251 + .size = 4 * 1056,
2252 + },
2253 + {
2254 + .name = "BOOT2",
2255 + .offset = MTDPART_OFS_NXTBLK,
2256 + .size = 256 * 1056,
2257 + },
2258 + {
2259 + .name = "kernel",
2260 + .offset = MTDPART_OFS_NXTBLK,
2261 + .size = 2222 * 1056,
2262 + },
2263 + {
2264 + .name = "file system",
2265 + .offset = MTDPART_OFS_NXTBLK,
2266 + .size = MTDPART_SIZ_FULL,
2267 + },
2268 +};
2269 +
2270 +static struct flash_platform_data __initdata cam60_spi_flash_platform_data = {
2271 + .name = "spi_flash",
2272 + .parts = cam60_spi_partitions,
2273 + .nr_parts = ARRAY_SIZE(cam60_spi_partitions)
2274 +};
2275 +#endif
2276 +
2277 +static struct spi_board_info cam60_spi_devices[] = {
2278 +#if defined(CONFIG_MTD_DATAFLASH)
2279 + { /* DataFlash chip */
2280 + .modalias = "mtd_dataflash",
2281 + .chip_select = 0,
2282 + .max_speed_hz = 15 * 1000 * 1000,
2283 + .bus_num = 0,
2284 + .platform_data = &cam60_spi_flash_platform_data
2285 + },
2286 +#endif
2287 +};
2288 +
2289 +
2290 +/*
2291 + * MACB Ethernet device
2292 + */
2293 +static struct __initdata at91_eth_data cam60_macb_data = {
2294 + .phy_irq_pin = AT91_PIN_PB5,
2295 + .is_rmii = 0,
2296 +};
2297 +
2298 +
2299 +static void __init cam60_board_init(void)
2300 +{
2301 + /* Serial */
2302 + at91_add_device_serial();
2303 + /* SPI */
2304 + at91_add_device_spi(cam60_spi_devices, ARRAY_SIZE(cam60_spi_devices));
2305 + /* Ethernet */
2306 + at91_add_device_eth(&cam60_macb_data);
2307 +}
2308 +
2309 +MACHINE_START(CAM60, "KwikByte CAM60")
2310 + /* Maintainer: KwikByte */
2311 + .phys_io = AT91_BASE_SYS,
2312 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
2313 + .boot_params = AT91_SDRAM_BASE + 0x100,
2314 + .timer = &at91sam926x_timer,
2315 + .map_io = cam60_map_io,
2316 + .init_irq = cam60_init_irq,
2317 + .init_machine = cam60_board_init,
2318 +MACHINE_END
2319 Index: linux-2.6.21.7/arch/arm/mach-at91/board-chub.c
2320 ===================================================================
2321 --- /dev/null
2322 +++ linux-2.6.21.7/arch/arm/mach-at91/board-chub.c
2323 @@ -0,0 +1,132 @@
2324 +/*
2325 + * linux/arch/arm/mach-at91/board-chub.c
2326 + *
2327 + * Copyright (C) 2005 SAN People, adapted for Promwad Chub board
2328 + * by Kuten Ivan
2329 + *
2330 + * This program is free software; you can redistribute it and/or modify
2331 + * it under the terms of the GNU General Public License as published by
2332 + * the Free Software Foundation; either version 2 of the License, or
2333 + * (at your option) any later version.
2334 + *
2335 + * This program is distributed in the hope that it will be useful,
2336 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2337 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2338 + * GNU General Public License for more details.
2339 + *
2340 + * You should have received a copy of the GNU General Public License
2341 + * along with this program; if not, write to the Free Software
2342 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2343 + */
2344 +
2345 +#include <linux/types.h>
2346 +#include <linux/init.h>
2347 +#include <linux/mm.h>
2348 +#include <linux/module.h>
2349 +#include <linux/platform_device.h>
2350 +
2351 +#include <asm/hardware.h>
2352 +#include <asm/setup.h>
2353 +#include <asm/mach-types.h>
2354 +#include <asm/irq.h>
2355 +
2356 +#include <asm/mach/arch.h>
2357 +#include <asm/mach/map.h>
2358 +#include <asm/mach/irq.h>
2359 +
2360 +#include <asm/arch/board.h>
2361 +#include <asm/arch/gpio.h>
2362 +
2363 +#include "generic.h"
2364 +
2365 +/*
2366 + * Serial port configuration.
2367 + * 0 .. 3 = USART0 .. USART3
2368 + * 4 = DBGU
2369 + */
2370 +static struct at91_uart_config __initdata chub_uart_config = {
2371 + .console_tty = 0, /* ttyS0 */
2372 + .nr_tty = 5,
2373 + .tty_map = { 4, 0, 1, 2, 3 } /* ttyS0, ..., ttyS4 */
2374 +};
2375 +
2376 +static void __init chub_init_irq(void)
2377 +{
2378 + at91rm9200_init_interrupts(NULL);
2379 +}
2380 +
2381 +static void __init chub_map_io(void)
2382 +{
2383 + /* Initialize clocks: 18.432 MHz crystal */
2384 + at91rm9200_initialize(18432000, AT91RM9200_PQFP);
2385 +
2386 + /* Setup the serial ports and console */
2387 + at91_init_serial(&chub_uart_config);
2388 +}
2389 +
2390 +static struct at91_eth_data __initdata chub_eth_data = {
2391 + .phy_irq_pin = AT91_PIN_PB29,
2392 + .is_rmii = 0,
2393 +};
2394 +
2395 +static struct mtd_partition __initdata chub_nand_partition[] = {
2396 + {
2397 + .name = "NAND Partition 1",
2398 + .offset = 0,
2399 + .size = MTDPART_SIZ_FULL,
2400 + },
2401 +};
2402 +
2403 +static struct mtd_partition *nand_partitions(int size, int *num_partitions)
2404 +{
2405 + *num_partitions = ARRAY_SIZE(chub_nand_partition);
2406 + return chub_nand_partition;
2407 +}
2408 +
2409 +static struct at91_nand_data __initdata chub_nand_data = {
2410 + .ale = 22,
2411 + .cle = 21,
2412 + .enable_pin = AT91_PIN_PA27,
2413 + .partition_info = nand_partitions,
2414 +};
2415 +
2416 +static struct spi_board_info chub_spi_devices[] = {
2417 + { /* DataFlash chip */
2418 + .modalias = "mtd_dataflash",
2419 + .chip_select = 0,
2420 + .max_speed_hz = 15 * 1000 * 1000,
2421 + },
2422 +};
2423 +
2424 +static void __init chub_board_init(void)
2425 +{
2426 + /* Serial */
2427 + at91_add_device_serial();
2428 + /* I2C */
2429 + at91_add_device_i2c();
2430 + /* Ethernet */
2431 + at91_add_device_eth(&chub_eth_data);
2432 + /* SPI */
2433 + at91_add_device_spi(chub_spi_devices, ARRAY_SIZE(chub_spi_devices));
2434 + /* NAND Flash */
2435 + at91_add_device_nand(&chub_nand_data);
2436 + /* Disable write protect for NAND */
2437 + at91_set_gpio_output(AT91_PIN_PB7, 1);
2438 + /* Power enable for 3x RS-232 and 1x RS-485 */
2439 + at91_set_gpio_output(AT91_PIN_PB9, 1);
2440 + /* Disable write protect for FRAM */
2441 + at91_set_gpio_output(AT91_PIN_PA21, 1);
2442 + /* Disable write protect for Dataflash */
2443 + at91_set_gpio_output(AT91_PIN_PA19, 1);
2444 +}
2445 +
2446 +MACHINE_START(CHUB, "Promwad Chub")
2447 + /* Maintainer: Ivan Kuten AT Promwad DOT com */
2448 + .phys_io = AT91_BASE_SYS,
2449 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
2450 + .boot_params = AT91_SDRAM_BASE + 0x100,
2451 + .timer = &at91rm9200_timer,
2452 + .map_io = chub_map_io,
2453 + .init_irq = chub_init_irq,
2454 + .init_machine = chub_board_init,
2455 +MACHINE_END
2456 Index: linux-2.6.21.7/arch/arm/mach-at91/board-csb337.c
2457 ===================================================================
2458 --- linux-2.6.21.7.orig/arch/arm/mach-at91/board-csb337.c
2459 +++ linux-2.6.21.7/arch/arm/mach-at91/board-csb337.c
2460 @@ -24,6 +24,7 @@
2461 #include <linux/module.h>
2462 #include <linux/platform_device.h>
2463 #include <linux/spi/spi.h>
2464 +#include <linux/interrupt.h>
2465 #include <linux/mtd/physmap.h>
2466
2467 #include <asm/hardware.h>
2468 @@ -59,6 +60,7 @@ static void __init csb337_map_io(void)
2469
2470 /* Setup the LEDs */
2471 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
2472 + at91_set_gpio_output(AT91_PIN_PB2, 1); /* third (unused) LED */
2473
2474 /* Setup the serial ports and console */
2475 at91_init_serial(&csb337_uart_config);
2476 @@ -149,6 +151,55 @@ static struct platform_device csb_flash
2477 .num_resources = ARRAY_SIZE(csb_flash_resources),
2478 };
2479
2480 +static struct at91_gpio_led csb337_leds[] = {
2481 + {
2482 + .name = "led0",
2483 + .gpio = AT91_PIN_PB0,
2484 + .trigger = "heartbeat",
2485 + },
2486 + {
2487 + .name = "led1",
2488 + .gpio = AT91_PIN_PB1,
2489 + .trigger = "timer",
2490 + },
2491 + {
2492 + .name = "led2",
2493 + .gpio = AT91_PIN_PB2,
2494 + }
2495 +};
2496 +
2497 +#if defined(CONFIG_CSB300_WAKE_SW0) || defined(CONFIG_CSB300_WAKE_SW1)
2498 +static irqreturn_t switch_irq_handler(int irq, void *context)
2499 +{
2500 + return IRQ_HANDLED;
2501 +}
2502 +
2503 +static inline void __init switch_irq_setup(int irq, char *name, unsigned long mode)
2504 +{
2505 + int res;
2506 +
2507 + res = request_irq(irq, switch_irq_handler, IRQF_SAMPLE_RANDOM | mode, name, NULL);
2508 + if (res == 0)
2509 + enable_irq_wake(irq);
2510 +}
2511 +
2512 +static void __init csb300_switches(void)
2513 +{
2514 +#ifdef CONFIG_CSB300_WAKE_SW0
2515 + at91_set_A_periph(AT91_PIN_PB29, 1); /* IRQ0 */
2516 + switch_irq_setup(AT91RM9200_ID_IRQ0, "csb300_sw0", IRQF_TRIGGER_FALLING);
2517 +#endif
2518 +#ifdef CONFIG_CSB300_WAKE_SW1
2519 + at91_set_gpio_input(AT91_PIN_PB28, 1);
2520 + at91_set_deglitch(AT91_PIN_PB28, 1);
2521 + switch_irq_setup(AT91_PIN_PB28, "csb300_sw1", IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING);
2522 +#endif
2523 + /* there's also SW2 at PA21, GPIO or TIOA2 */
2524 +}
2525 +#else
2526 +static void __init csb300_switches(void) {}
2527 +#endif
2528 +
2529 static void __init csb337_board_init(void)
2530 {
2531 /* Serial */
2532 @@ -168,8 +219,12 @@ static void __init csb337_board_init(voi
2533 at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices));
2534 /* MMC */
2535 at91_add_device_mmc(0, &csb337_mmc_data);
2536 + /* LEDS */
2537 + at91_gpio_leds(csb337_leds, ARRAY_SIZE(csb337_leds));
2538 /* NOR flash */
2539 platform_device_register(&csb_flash);
2540 + /* Switches on CSB300 */
2541 + csb300_switches();
2542 }
2543
2544 MACHINE_START(CSB337, "Cogent CSB337")
2545 Index: linux-2.6.21.7/arch/arm/mach-at91/board-dk.c
2546 ===================================================================
2547 --- linux-2.6.21.7.orig/arch/arm/mach-at91/board-dk.c
2548 +++ linux-2.6.21.7/arch/arm/mach-at91/board-dk.c
2549 @@ -73,6 +73,185 @@ static void __init dk_init_irq(void)
2550 at91rm9200_init_interrupts(NULL);
2551 }
2552
2553 +#if defined(CONFIG_FB_S1D13XXX) || defined(CONFIG_FB_S1D13XXX_MODULE)
2554 +#include <video/s1d13xxxfb.h>
2555 +#include <asm/arch/ics1523.h>
2556 +
2557 +/* EPSON S1D13806 FB */
2558 +#define AT91_FB_REG_BASE 0x30000000L
2559 +#define AT91_FB_REG_SIZE 0x200
2560 +#define AT91_FB_VMEM_BASE 0x30200000L
2561 +#define AT91_FB_VMEM_SIZE 0x140000L
2562 +
2563 +static void __init dk_init_video(void)
2564 +{
2565 + /* NWAIT Signal */
2566 + at91_set_A_periph(AT91_PIN_PC6, 0);
2567 +
2568 + /* Initialization of the Static Memory Controller for Chip Select 2 */
2569 + at91_sys_write(AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */
2570 + | AT91_SMC_WSEN | AT91_SMC_NWS_(4) /* wait states */
2571 + | AT91_SMC_TDF_(1) /* float time */
2572 + );
2573 +
2574 + at91_ics1523_init();
2575 +}
2576 +
2577 +/* CRT: (active) 640x480 60Hz (PCLK=CLKI=25.175MHz)
2578 + Memory: Embedded SDRAM (MCLK=CLKI3=50.000MHz) (BUSCLK=60.000MHz) */
2579 +static const struct s1d13xxxfb_regval dk_s1dfb_initregs[] = {
2580 + {S1DREG_MISC, 0x00}, /* Enable Memory/Register select bit */
2581 + {S1DREG_COM_DISP_MODE, 0x00}, /* disable display output */
2582 + {S1DREG_GPIO_CNF0, 0x00},
2583 + {S1DREG_GPIO_CNF1, 0x00},
2584 + {S1DREG_GPIO_CTL0, 0x08},
2585 + {S1DREG_GPIO_CTL1, 0x00},
2586 + {S1DREG_CLK_CNF, 0x01}, /* no divide, MCLK source is CLKI3 0x02*/
2587 + {S1DREG_LCD_CLK_CNF, 0x00},
2588 + {S1DREG_CRT_CLK_CNF, 0x00},
2589 + {S1DREG_MPLUG_CLK_CNF, 0x00},
2590 + {S1DREG_CPU2MEM_WST_SEL, 0x01}, /* 2*period(MCLK) - 4ns > period(BCLK) */
2591 + {S1DREG_SDRAM_REF_RATE, 0x03}, /* 32768 <= MCLK <= 50000 (MHz) */
2592 + {S1DREG_SDRAM_TC0, 0x00}, /* MCLK source freq (MHz): */
2593 + {S1DREG_SDRAM_TC1, 0x01}, /* 42 <= MCLK <= 50 */
2594 + {S1DREG_MEM_CNF, 0x80}, /* SDRAM Initialization - needed before mem access */
2595 + {S1DREG_PANEL_TYPE, 0x25}, /* std TFT 16bit, 8bit SCP format 2, single passive LCD */
2596 + {S1DREG_MOD_RATE, 0x00}, /* toggle every FPFRAME */
2597 + {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* 680 pix */
2598 + {S1DREG_LCD_NDISP_HPER, 0x12}, /* 152 pix */
2599 + {S1DREG_TFT_FPLINE_START, 0x01}, /* 13 pix */
2600 + {S1DREG_TFT_FPLINE_PWIDTH, 0x0B}, /* 96 pix */
2601 + {S1DREG_LCD_DISP_VHEIGHT0, 0xDF},
2602 + {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* 480 lines */
2603 + {S1DREG_LCD_NDISP_VPER, 0x2C}, /* 44 lines */
2604 + {S1DREG_TFT_FPFRAME_START, 0x0A}, /* 10 lines */
2605 + {S1DREG_TFT_FPFRAME_PWIDTH, 0x01}, /* 2 lines */
2606 + {S1DREG_LCD_DISP_MODE, 0x05}, /* 16 bpp */
2607 + {S1DREG_LCD_MISC, 0x00}, /* dithering enabled, dual panel buffer enabled */
2608 + {S1DREG_LCD_DISP_START0, 0x00},
2609 + {S1DREG_LCD_DISP_START1, 0xC8},
2610 + {S1DREG_LCD_DISP_START2, 0x00},
2611 + {S1DREG_LCD_MEM_OFF0, 0x80},
2612 + {S1DREG_LCD_MEM_OFF1, 0x02},
2613 + {S1DREG_LCD_PIX_PAN, 0x00},
2614 + {S1DREG_LCD_DISP_FIFO_HTC, 0x3B},
2615 + {S1DREG_LCD_DISP_FIFO_LTC, 0x3C},
2616 + {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* 680 pix */
2617 + {S1DREG_CRT_NDISP_HPER, 0x13}, /* 160 pix */
2618 + {S1DREG_CRT_HRTC_START, 0x01}, /* 13 pix */
2619 + {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* 96 pix */
2620 + {S1DREG_CRT_DISP_VHEIGHT0, 0xDF},
2621 + {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* 480 lines */
2622 + {S1DREG_CRT_NDISP_VPER, 0x2B}, /* 44 lines */
2623 + {S1DREG_CRT_VRTC_START, 0x09}, /* 10 lines */
2624 + {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* 2 lines */
2625 + {S1DREG_TV_OUT_CTL, 0x10},
2626 + {S1DREG_CRT_DISP_MODE, 0x05}, /* 16 bpp */
2627 + {S1DREG_CRT_DISP_START0, 0x00},
2628 + {S1DREG_CRT_DISP_START1, 0x00},
2629 + {S1DREG_CRT_DISP_START2, 0x00},
2630 + {S1DREG_CRT_MEM_OFF0, 0x80},
2631 + {S1DREG_CRT_MEM_OFF1, 0x02},
2632 + {S1DREG_CRT_PIX_PAN, 0x00},
2633 + {S1DREG_CRT_DISP_FIFO_HTC, 0x3B},
2634 + {S1DREG_CRT_DISP_FIFO_LTC, 0x3C},
2635 + {S1DREG_LCD_CUR_CTL, 0x00}, /* inactive */
2636 + {S1DREG_LCD_CUR_START, 0x01},
2637 + {S1DREG_LCD_CUR_XPOS0, 0x00},
2638 + {S1DREG_LCD_CUR_XPOS1, 0x00},
2639 + {S1DREG_LCD_CUR_YPOS0, 0x00},
2640 + {S1DREG_LCD_CUR_YPOS1, 0x00},
2641 + {S1DREG_LCD_CUR_BCTL0, 0x00},
2642 + {S1DREG_LCD_CUR_GCTL0, 0x00},
2643 + {S1DREG_LCD_CUR_RCTL0, 0x00},
2644 + {S1DREG_LCD_CUR_BCTL1, 0x1F},
2645 + {S1DREG_LCD_CUR_GCTL1, 0x3F},
2646 + {S1DREG_LCD_CUR_RCTL1, 0x1F},
2647 + {S1DREG_LCD_CUR_FIFO_HTC, 0x00},
2648 + {S1DREG_CRT_CUR_CTL, 0x00}, /* inactive */
2649 + {S1DREG_CRT_CUR_START, 0x01},
2650 + {S1DREG_CRT_CUR_XPOS0, 0x00},
2651 + {S1DREG_CRT_CUR_XPOS1, 0x00},
2652 + {S1DREG_CRT_CUR_YPOS0, 0x00},
2653 + {S1DREG_CRT_CUR_YPOS1, 0x00},
2654 + {S1DREG_CRT_CUR_BCTL0, 0x00},
2655 + {S1DREG_CRT_CUR_GCTL0, 0x00},
2656 + {S1DREG_CRT_CUR_RCTL0, 0x00},
2657 + {S1DREG_CRT_CUR_BCTL1, 0x1F},
2658 + {S1DREG_CRT_CUR_GCTL1, 0x3F},
2659 + {S1DREG_CRT_CUR_RCTL1, 0x1F},
2660 + {S1DREG_CRT_CUR_FIFO_HTC, 0x00},
2661 + {S1DREG_BBLT_CTL0, 0x00},
2662 + {S1DREG_BBLT_CTL0, 0x00},
2663 + {S1DREG_BBLT_CC_EXP, 0x00},
2664 + {S1DREG_BBLT_OP, 0x00},
2665 + {S1DREG_BBLT_SRC_START0, 0x00},
2666 + {S1DREG_BBLT_SRC_START1, 0x00},
2667 + {S1DREG_BBLT_SRC_START2, 0x00},
2668 + {S1DREG_BBLT_DST_START0, 0x00},
2669 + {S1DREG_BBLT_DST_START1, 0x00},
2670 + {S1DREG_BBLT_DST_START2, 0x00},
2671 + {S1DREG_BBLT_MEM_OFF0, 0x00},
2672 + {S1DREG_BBLT_MEM_OFF1, 0x00},
2673 + {S1DREG_BBLT_WIDTH0, 0x00},
2674 + {S1DREG_BBLT_WIDTH1, 0x00},
2675 + {S1DREG_BBLT_HEIGHT0, 0x00},
2676 + {S1DREG_BBLT_HEIGHT1, 0x00},
2677 + {S1DREG_BBLT_BGC0, 0x00},
2678 + {S1DREG_BBLT_BGC1, 0x00},
2679 + {S1DREG_BBLT_FGC0, 0x00},
2680 + {S1DREG_BBLT_FGC1, 0x00},
2681 + {S1DREG_LKUP_MODE, 0x00}, /* LCD LUT r | LCD and CRT/TV LUT w */
2682 + {S1DREG_LKUP_ADDR, 0x00},
2683 + {S1DREG_PS_CNF, 0x00}, /* Power Save disable */
2684 + {S1DREG_PS_STATUS, 0x02}, /* LCD Panel down, mem up */
2685 + {S1DREG_CPU2MEM_WDOGT, 0x00},
2686 + {S1DREG_COM_DISP_MODE, 0x02}, /* enable CRT display output */
2687 +};
2688 +
2689 +static struct s1d13xxxfb_pdata dk_s1dfb_pdata = {
2690 + .initregs = dk_s1dfb_initregs,
2691 + .initregssize = ARRAY_SIZE(dk_s1dfb_initregs),
2692 + .platform_init_video = dk_init_video,
2693 +};
2694 +
2695 +static u64 s1dfb_dmamask = 0xffffffffUL;
2696 +
2697 +static struct resource dk_s1dfb_resource[] = {
2698 + [0] = { /* video mem */
2699 + .name = "s1d13806 memory",
2700 + .start = AT91_FB_VMEM_BASE,
2701 + .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1,
2702 + .flags = IORESOURCE_MEM,
2703 + },
2704 + [1] = { /* video registers */
2705 + .name = "s1d13806 registers",
2706 + .start = AT91_FB_REG_BASE,
2707 + .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1,
2708 + .flags = IORESOURCE_MEM,
2709 + },
2710 +};
2711 +
2712 +static struct platform_device dk_s1dfb_device = {
2713 + .name = "s1d13806fb",
2714 + .id = -1,
2715 + .dev = {
2716 + .dma_mask = &s1dfb_dmamask,
2717 + .coherent_dma_mask = 0xffffffff,
2718 + .platform_data = &dk_s1dfb_pdata,
2719 + },
2720 + .resource = dk_s1dfb_resource,
2721 + .num_resources = ARRAY_SIZE(dk_s1dfb_resource),
2722 +};
2723 +
2724 +static void __init dk_add_device_video(void)
2725 +{
2726 + platform_device_register(&dk_s1dfb_device);
2727 +}
2728 +#else
2729 +static void __init dk_add_device_video(void) {}
2730 +#endif
2731 +
2732 static struct at91_eth_data __initdata dk_eth_data = {
2733 .phy_irq_pin = AT91_PIN_PC4,
2734 .is_rmii = 1,
2735 @@ -151,7 +330,7 @@ static struct at91_nand_data __initdata
2736 #define DK_FLASH_SIZE 0x200000
2737
2738 static struct physmap_flash_data dk_flash_data = {
2739 - .width = 2,
2740 + .width = 2,
2741 };
2742
2743 static struct resource dk_flash_resource = {
2744 @@ -170,6 +349,13 @@ static struct platform_device dk_flash =
2745 .num_resources = 1,
2746 };
2747
2748 +static struct at91_gpio_led dk_leds[] = {
2749 + {
2750 + .name = "led0",
2751 + .gpio = AT91_PIN_PB2,
2752 + .trigger = "timer",
2753 + }
2754 +};
2755
2756 static void __init dk_board_init(void)
2757 {
2758 @@ -200,8 +386,10 @@ static void __init dk_board_init(void)
2759 at91_add_device_nand(&dk_nand_data);
2760 /* NOR Flash */
2761 platform_device_register(&dk_flash);
2762 + /* LEDs */
2763 + at91_gpio_leds(dk_leds, ARRAY_SIZE(dk_leds));
2764 /* VGA */
2765 -// dk_add_device_video();
2766 + dk_add_device_video();
2767 }
2768
2769 MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK")
2770 Index: linux-2.6.21.7/arch/arm/mach-at91/board-ek.c
2771 ===================================================================
2772 --- linux-2.6.21.7.orig/arch/arm/mach-at91/board-ek.c
2773 +++ linux-2.6.21.7/arch/arm/mach-at91/board-ek.c
2774 @@ -73,6 +73,187 @@ static void __init ek_init_irq(void)
2775 at91rm9200_init_interrupts(NULL);
2776 }
2777
2778 +#if defined(CONFIG_FB_S1D13XXX) || defined(CONFIG_FB_S1D13XXX_MODULE)
2779 +#include <video/s1d13xxxfb.h>
2780 +#include <asm/arch/ics1523.h>
2781 +
2782 +/* EPSON S1D13806 FB */
2783 +#define AT91_FB_REG_BASE 0x40000000L
2784 +#define AT91_FB_REG_SIZE 0x200
2785 +#define AT91_FB_VMEM_BASE 0x40200000L
2786 +#define AT91_FB_VMEM_SIZE 0x140000L
2787 +
2788 +static void __init ek_init_video(void)
2789 +{
2790 + /* NWAIT Signal */
2791 + at91_set_A_periph(AT91_PIN_PC6, 0);
2792 +
2793 + /* Initialization of the Static Memory Controller for Chip Select 3 */
2794 + at91_sys_write(AT91_SMC_CSR(3), AT91_SMC_DBW_16 /* 16 bit */
2795 + | AT91_SMC_WSEN | AT91_SMC_NWS_(5) /* wait states */
2796 + | AT91_SMC_TDF_(1) /* float time */
2797 + );
2798 +
2799 + at91_ics1523_init();
2800 +}
2801 +
2802 +/* CRT: (active) 640x480 60Hz (PCLK=CLKI=25.175MHz)
2803 + Memory: Embedded SDRAM (MCLK=CLKI3=50.000MHz) (BUSCLK=60.000MHz) */
2804 +static const struct s1d13xxxfb_regval ek_s1dfb_initregs[] = {
2805 + {S1DREG_MISC, 0x00}, /* Enable Memory/Register select bit */
2806 + {S1DREG_COM_DISP_MODE, 0x00}, /* disable display output */
2807 + {S1DREG_GPIO_CNF0, 0xFF}, // 0x00
2808 + {S1DREG_GPIO_CNF1, 0x1F}, // 0x08
2809 + {S1DREG_GPIO_CTL0, 0x00},
2810 + {S1DREG_GPIO_CTL1, 0x00},
2811 + {S1DREG_CLK_CNF, 0x01}, /* no divide, MCLK source is CLKI3 0x02*/
2812 + {S1DREG_LCD_CLK_CNF, 0x00},
2813 + {S1DREG_CRT_CLK_CNF, 0x00},
2814 + {S1DREG_MPLUG_CLK_CNF, 0x00},
2815 + {S1DREG_CPU2MEM_WST_SEL, 0x01}, /* 2*period(MCLK) - 4ns > period(BCLK) */
2816 + {S1DREG_SDRAM_REF_RATE, 0x03}, /* 32768 <= MCLK <= 50000 (MHz) */
2817 + {S1DREG_SDRAM_TC0, 0x00}, /* MCLK source freq (MHz): */
2818 + {S1DREG_SDRAM_TC1, 0x01}, /* 42 <= MCLK <= 50 */
2819 + {S1DREG_MEM_CNF, 0x80}, /* SDRAM Initialization - needed before mem access */
2820 + {S1DREG_PANEL_TYPE, 0x25}, /* std TFT 16bit, 8bit SCP format 2, single passive LCD */
2821 + {S1DREG_MOD_RATE, 0x00}, /* toggle every FPFRAME */
2822 + {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* 680 pix */
2823 + {S1DREG_LCD_NDISP_HPER, 0x12}, /* 152 pix */
2824 + {S1DREG_TFT_FPLINE_START, 0x01}, /* 13 pix */
2825 + {S1DREG_TFT_FPLINE_PWIDTH, 0x0B}, /* 96 pix */
2826 + {S1DREG_LCD_DISP_VHEIGHT0, 0xDF},
2827 + {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* 480 lines */
2828 + {S1DREG_LCD_NDISP_VPER, 0x2C}, /* 44 lines */
2829 + {S1DREG_TFT_FPFRAME_START, 0x0A}, /* 10 lines */
2830 + {S1DREG_TFT_FPFRAME_PWIDTH, 0x01}, /* 2 lines */
2831 + {S1DREG_LCD_DISP_MODE, 0x05}, /* 16 bpp */
2832 + {S1DREG_LCD_MISC, 0x00}, /* dithering enabled, dual panel buffer enabled */
2833 + {S1DREG_LCD_DISP_START0, 0x00},
2834 + {S1DREG_LCD_DISP_START1, 0xC8},
2835 + {S1DREG_LCD_DISP_START2, 0x00},
2836 + {S1DREG_LCD_MEM_OFF0, 0x80},
2837 + {S1DREG_LCD_MEM_OFF1, 0x02},
2838 + {S1DREG_LCD_PIX_PAN, 0x00},
2839 + {S1DREG_LCD_DISP_FIFO_HTC, 0x3B},
2840 + {S1DREG_LCD_DISP_FIFO_LTC, 0x3C},
2841 + {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* 680 pix */
2842 + {S1DREG_CRT_NDISP_HPER, 0x13}, /* 160 pix */
2843 + {S1DREG_CRT_HRTC_START, 0x01}, /* 13 pix */
2844 + {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* 96 pix */
2845 + {S1DREG_CRT_DISP_VHEIGHT0, 0xDF},
2846 + {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* 480 lines */
2847 + {S1DREG_CRT_NDISP_VPER, 0x2B}, /* 44 lines */
2848 + {S1DREG_CRT_VRTC_START, 0x09}, /* 10 lines */
2849 + {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* 2 lines */
2850 + {S1DREG_TV_OUT_CTL, 0x10},
2851 + {0x005E, 0x9F},
2852 + {0x005F, 0x00},
2853 + {S1DREG_CRT_DISP_MODE, 0x05}, /* 16 bpp */
2854 + {S1DREG_CRT_DISP_START0, 0x00},
2855 + {S1DREG_CRT_DISP_START1, 0x00},
2856 + {S1DREG_CRT_DISP_START2, 0x00},
2857 + {S1DREG_CRT_MEM_OFF0, 0x80},
2858 + {S1DREG_CRT_MEM_OFF1, 0x02},
2859 + {S1DREG_CRT_PIX_PAN, 0x00},
2860 + {S1DREG_CRT_DISP_FIFO_HTC, 0x3B},
2861 + {S1DREG_CRT_DISP_FIFO_LTC, 0x3C},
2862 + {S1DREG_LCD_CUR_CTL, 0x00}, /* inactive */
2863 + {S1DREG_LCD_CUR_START, 0x01},
2864 + {S1DREG_LCD_CUR_XPOS0, 0x00},
2865 + {S1DREG_LCD_CUR_XPOS1, 0x00},
2866 + {S1DREG_LCD_CUR_YPOS0, 0x00},
2867 + {S1DREG_LCD_CUR_YPOS1, 0x00},
2868 + {S1DREG_LCD_CUR_BCTL0, 0x00},
2869 + {S1DREG_LCD_CUR_GCTL0, 0x00},
2870 + {S1DREG_LCD_CUR_RCTL0, 0x00},
2871 + {S1DREG_LCD_CUR_BCTL1, 0x1F},
2872 + {S1DREG_LCD_CUR_GCTL1, 0x3F},
2873 + {S1DREG_LCD_CUR_RCTL1, 0x1F},
2874 + {S1DREG_LCD_CUR_FIFO_HTC, 0x00},
2875 + {S1DREG_CRT_CUR_CTL, 0x00}, /* inactive */
2876 + {S1DREG_CRT_CUR_START, 0x01},
2877 + {S1DREG_CRT_CUR_XPOS0, 0x00},
2878 + {S1DREG_CRT_CUR_XPOS1, 0x00},
2879 + {S1DREG_CRT_CUR_YPOS0, 0x00},
2880 + {S1DREG_CRT_CUR_YPOS1, 0x00},
2881 + {S1DREG_CRT_CUR_BCTL0, 0x00},
2882 + {S1DREG_CRT_CUR_GCTL0, 0x00},
2883 + {S1DREG_CRT_CUR_RCTL0, 0x00},
2884 + {S1DREG_CRT_CUR_BCTL1, 0x1F},
2885 + {S1DREG_CRT_CUR_GCTL1, 0x3F},
2886 + {S1DREG_CRT_CUR_RCTL1, 0x1F},
2887 + {S1DREG_CRT_CUR_FIFO_HTC, 0x00},
2888 + {S1DREG_BBLT_CTL0, 0x00},
2889 + {S1DREG_BBLT_CTL0, 0x00},
2890 + {S1DREG_BBLT_CC_EXP, 0x00},
2891 + {S1DREG_BBLT_OP, 0x00},
2892 + {S1DREG_BBLT_SRC_START0, 0x00},
2893 + {S1DREG_BBLT_SRC_START1, 0x00},
2894 + {S1DREG_BBLT_SRC_START2, 0x00},
2895 + {S1DREG_BBLT_DST_START0, 0x00},
2896 + {S1DREG_BBLT_DST_START1, 0x00},
2897 + {S1DREG_BBLT_DST_START2, 0x00},
2898 + {S1DREG_BBLT_MEM_OFF0, 0x00},
2899 + {S1DREG_BBLT_MEM_OFF1, 0x00},
2900 + {S1DREG_BBLT_WIDTH0, 0x00},
2901 + {S1DREG_BBLT_WIDTH1, 0x00},
2902 + {S1DREG_BBLT_HEIGHT0, 0x00},
2903 + {S1DREG_BBLT_HEIGHT1, 0x00},
2904 + {S1DREG_BBLT_BGC0, 0x00},
2905 + {S1DREG_BBLT_BGC1, 0x00},
2906 + {S1DREG_BBLT_FGC0, 0x00},
2907 + {S1DREG_BBLT_FGC1, 0x00},
2908 + {S1DREG_LKUP_MODE, 0x00}, /* LCD LUT r | LCD and CRT/TV LUT w */
2909 + {S1DREG_LKUP_ADDR, 0x00},
2910 + {S1DREG_PS_CNF, 0x10}, /* Power Save disable */
2911 + {S1DREG_PS_STATUS, 0x02}, /* LCD Panel down, mem up */
2912 + {S1DREG_CPU2MEM_WDOGT, 0x00},
2913 + {S1DREG_COM_DISP_MODE, 0x02}, /* enable CRT display output */
2914 +};
2915 +
2916 +static struct s1d13xxxfb_pdata ek_s1dfb_pdata = {
2917 + .initregs = ek_s1dfb_initregs,
2918 + .initregssize = ARRAY_SIZE(ek_s1dfb_initregs),
2919 + .platform_init_video = ek_init_video,
2920 +};
2921 +
2922 +static u64 s1dfb_dmamask = 0xffffffffUL;
2923 +
2924 +static struct resource ek_s1dfb_resource[] = {
2925 + [0] = { /* video mem */
2926 + .name = "s1d13806 memory",
2927 + .start = AT91_FB_VMEM_BASE,
2928 + .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1,
2929 + .flags = IORESOURCE_MEM,
2930 + },
2931 + [1] = { /* video registers */
2932 + .name = "s1d13806 registers",
2933 + .start = AT91_FB_REG_BASE,
2934 + .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1,
2935 + .flags = IORESOURCE_MEM,
2936 + },
2937 +};
2938 +
2939 +static struct platform_device ek_s1dfb_device = {
2940 + .name = "s1d13806fb",
2941 + .id = -1,
2942 + .dev = {
2943 + .dma_mask = &s1dfb_dmamask,
2944 + .coherent_dma_mask = 0xffffffff,
2945 + .platform_data = &ek_s1dfb_pdata,
2946 + },
2947 + .resource = ek_s1dfb_resource,
2948 + .num_resources = ARRAY_SIZE(ek_s1dfb_resource),
2949 +};
2950 +
2951 +static void __init ek_add_device_video(void)
2952 +{
2953 + platform_device_register(&ek_s1dfb_device);
2954 +}
2955 +#else
2956 +static void __init ek_add_device_video(void) {}
2957 +#endif
2958 +
2959 static struct at91_eth_data __initdata ek_eth_data = {
2960 .phy_irq_pin = AT91_PIN_PC4,
2961 .is_rmii = 1,
2962 @@ -113,7 +294,7 @@ static struct spi_board_info ek_spi_devi
2963 #define EK_FLASH_SIZE 0x200000
2964
2965 static struct physmap_flash_data ek_flash_data = {
2966 - .width = 2,
2967 + .width = 2,
2968 };
2969
2970 static struct resource ek_flash_resource = {
2971 @@ -132,6 +313,18 @@ static struct platform_device ek_flash =
2972 .num_resources = 1,
2973 };
2974
2975 +static struct at91_gpio_led ek_leds[] = {
2976 + {
2977 + .name = "led0",
2978 + .gpio = AT91_PIN_PB1,
2979 + .trigger = "heartbeat",
2980 + },
2981 + {
2982 + .name = "led1",
2983 + .gpio = AT91_PIN_PB2,
2984 + .trigger = "timer",
2985 + }
2986 +};
2987
2988 static void __init ek_board_init(void)
2989 {
2990 @@ -158,8 +351,10 @@ static void __init ek_board_init(void)
2991 #endif
2992 /* NOR Flash */
2993 platform_device_register(&ek_flash);
2994 + /* LEDs */
2995 + at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
2996 /* VGA */
2997 -// ek_add_device_video();
2998 + ek_add_device_video();
2999 }
3000
3001 MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK")
3002 Index: linux-2.6.21.7/arch/arm/mach-at91/board-kb9202.c
3003 ===================================================================
3004 --- linux-2.6.21.7.orig/arch/arm/mach-at91/board-kb9202.c
3005 +++ linux-2.6.21.7/arch/arm/mach-at91/board-kb9202.c
3006 @@ -37,6 +37,8 @@
3007 #include <asm/arch/board.h>
3008 #include <asm/arch/gpio.h>
3009
3010 +#include <asm/arch/at91rm9200_mc.h>
3011 +
3012 #include "generic.h"
3013
3014
3015 @@ -111,6 +113,48 @@ static struct at91_nand_data __initdata
3016 .partition_info = nand_partitions,
3017 };
3018
3019 +
3020 +#if defined(CONFIG_FB_S1D15605)
3021 +#warning "Rather pass reset pin via platform_data"
3022 +static struct resource kb9202_lcd_resources[] = {
3023 + [0] = {
3024 + .start = AT91_CHIPSELECT_2,
3025 + .end = AT91_CHIPSELECT_2 + 0x200FF,
3026 + .flags = IORESOURCE_MEM
3027 + },
3028 + [1] = { /* reset pin */
3029 + .start = AT91_PIN_PC22,
3030 + .end = AT91_PIN_PC22,
3031 + .flags = IORESOURCE_MEM
3032 + },
3033 +};
3034 +
3035 +static struct platform_device kb9202_lcd_device = {
3036 + .name = "s1d15605fb",
3037 + .id = 0,
3038 + .num_resources = ARRAY_SIZE(kb9202_lcd_resources),
3039 + .resource = kb9202_lcd_resources,
3040 +};
3041 +
3042 +static void __init kb9202_add_device_lcd(void)
3043 +{
3044 + /* In case the boot loader did not set the chip select mode and timing */
3045 + at91_sys_write(AT91_SMC_CSR(2),
3046 + AT91_SMC_WSEN | AT91_SMC_NWS_(18) | AT91_SMC_TDF_(1) | AT91_SMC_DBW_8 |
3047 + AT91_SMC_RWSETUP_(1) | AT91_SMC_RWHOLD_(1));
3048 +
3049 + /* Backlight pin = output, off */
3050 + at91_set_gpio_output(AT91_PIN_PC23, 0);
3051 +
3052 + /* Reset pin = output, in reset */
3053 + at91_set_gpio_output(AT91_PIN_PC22, 0);
3054 +
3055 + platform_device_register(&kb9202_lcd_device);
3056 +}
3057 +#else
3058 +static void __init kb9202_add_device_lcd(void) {}
3059 +#endif
3060 +
3061 static void __init kb9202_board_init(void)
3062 {
3063 /* Serial */
3064 @@ -129,6 +173,8 @@ static void __init kb9202_board_init(voi
3065 at91_add_device_spi(NULL, 0);
3066 /* NAND */
3067 at91_add_device_nand(&kb9202_nand_data);
3068 + /* LCD */
3069 + kb9202_add_device_lcd();
3070 }
3071
3072 MACHINE_START(KB9200, "KB920x")
3073 Index: linux-2.6.21.7/arch/arm/mach-at91/board-sam9260ek.c
3074 ===================================================================
3075 --- linux-2.6.21.7.orig/arch/arm/mach-at91/board-sam9260ek.c
3076 +++ linux-2.6.21.7/arch/arm/mach-at91/board-sam9260ek.c
3077 @@ -104,9 +104,9 @@ static struct spi_board_info ek_spi_devi
3078 },
3079 #endif
3080 #endif
3081 -#if defined(CONFIG_SND_AT73C213)
3082 +#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
3083 { /* AT73C213 DAC */
3084 - .modalias = "snd_at73c213",
3085 + .modalias = "at73c213",
3086 .chip_select = 0,
3087 .max_speed_hz = 10 * 1000 * 1000,
3088 .bus_num = 1,
3089 @@ -118,7 +118,7 @@ static struct spi_board_info ek_spi_devi
3090 /*
3091 * MACB Ethernet device
3092 */
3093 -static struct __initdata at91_eth_data ek_macb_data = {
3094 +static struct at91_eth_data __initdata ek_macb_data = {
3095 .phy_irq_pin = AT91_PIN_PA7,
3096 .is_rmii = 1,
3097 };
3098 @@ -188,6 +188,8 @@ static void __init ek_board_init(void)
3099 at91_add_device_eth(&ek_macb_data);
3100 /* MMC */
3101 at91_add_device_mmc(0, &ek_mmc_data);
3102 + /* I2C */
3103 + at91_add_device_i2c();
3104 }
3105
3106 MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
3107 Index: linux-2.6.21.7/arch/arm/mach-at91/board-sam9261ek.c
3108 ===================================================================
3109 --- linux-2.6.21.7.orig/arch/arm/mach-at91/board-sam9261ek.c
3110 +++ linux-2.6.21.7/arch/arm/mach-at91/board-sam9261ek.c
3111 @@ -25,7 +25,11 @@
3112 #include <linux/module.h>
3113 #include <linux/platform_device.h>
3114 #include <linux/spi/spi.h>
3115 +#include <linux/spi/ads7846.h>
3116 #include <linux/dm9000.h>
3117 +#include <linux/fb.h>
3118 +
3119 +#include <video/atmel_lcdc.h>
3120
3121 #include <asm/hardware.h>
3122 #include <asm/setup.h>
3123 @@ -59,6 +63,9 @@ static void __init ek_map_io(void)
3124 /* Initialize processor: 18.432 MHz crystal */
3125 at91sam9261_initialize(18432000);
3126
3127 + /* Setup the LEDs */
3128 + at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14);
3129 +
3130 /* Setup the serial ports and console */
3131 at91_init_serial(&ek_uart_config);
3132 }
3133 @@ -195,6 +202,41 @@ static struct at91_nand_data __initdata
3134 };
3135
3136 /*
3137 + * ADS7846 Touchscreen
3138 + */
3139 +#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
3140 +
3141 +static int ads7843_pendown_state(void)
3142 +{
3143 + return !at91_get_gpio_value(AT91_PIN_PC2); /* Touchscreen PENIRQ */
3144 +}
3145 +
3146 +static struct ads7846_platform_data ads_info = {
3147 + .model = 7843,
3148 + .x_min = 150,
3149 + .x_max = 3830,
3150 + .y_min = 190,
3151 + .y_max = 3830,
3152 + .vref_delay_usecs = 100,
3153 + .x_plate_ohms = 450,
3154 + .y_plate_ohms = 250,
3155 + .pressure_max = 15000,
3156 + .debounce_max = 1,
3157 + .debounce_rep = 0,
3158 + .debounce_tol = (~0),
3159 + .get_pendown_state = ads7843_pendown_state,
3160 +};
3161 +
3162 +static void __init ek_add_device_ts(void)
3163 +{
3164 + at91_set_B_periph(AT91_PIN_PC2, 1); /* External IRQ0, with pullup */
3165 + at91_set_gpio_input(AT91_PIN_PA11, 1); /* Touchscreen BUSY signal */
3166 +}
3167 +#else
3168 +static void __init ek_add_device_ts(void) {}
3169 +#endif
3170 +
3171 +/*
3172 * SPI devices
3173 */
3174 static struct spi_board_info ek_spi_devices[] = {
3175 @@ -204,6 +246,17 @@ static struct spi_board_info ek_spi_devi
3176 .max_speed_hz = 15 * 1000 * 1000,
3177 .bus_num = 0,
3178 },
3179 +#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
3180 + {
3181 + .modalias = "ads7846",
3182 + .chip_select = 2,
3183 + .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
3184 + .bus_num = 0,
3185 + .platform_data = &ads_info,
3186 + .irq = AT91SAM9261_ID_IRQ0,
3187 + .controller_data = AT91_PIN_PA28, /* CS pin */
3188 + },
3189 +#endif
3190 #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
3191 { /* DataFlash card - jumper (J12) configurable to CS3 or CS0 */
3192 .modalias = "mtd_dataflash",
3193 @@ -211,9 +264,9 @@ static struct spi_board_info ek_spi_devi
3194 .max_speed_hz = 15 * 1000 * 1000,
3195 .bus_num = 0,
3196 },
3197 -#elif defined(CONFIG_SND_AT73C213)
3198 +#elif defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
3199 { /* AT73C213 DAC */
3200 - .modalias = "snd_at73c213",
3201 + .modalias = "at73c213",
3202 .chip_select = 3,
3203 .max_speed_hz = 10 * 1000 * 1000,
3204 .bus_num = 0,
3205 @@ -222,6 +275,65 @@ static struct spi_board_info ek_spi_devi
3206 };
3207
3208
3209 +/*
3210 + * LCD Controller
3211 + */
3212 +#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
3213 +static struct fb_videomode at91_tft_vga_modes[] = {
3214 + {
3215 + .name = "TX09D50VM1CCA @ 60",
3216 + .refresh = 60,
3217 + .xres = 240, .yres = 320,
3218 + .pixclock = KHZ2PICOS(4965),
3219 +
3220 + .left_margin = 1, .right_margin = 33,
3221 + .upper_margin = 1, .lower_margin = 0,
3222 + .hsync_len = 5, .vsync_len = 1,
3223 +
3224 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
3225 + .vmode = FB_VMODE_NONINTERLACED,
3226 + },
3227 +};
3228 +
3229 +static struct fb_monspecs at91fb_default_monspecs = {
3230 + .manufacturer = "HIT",
3231 + .monitor = "TX09D50VM1CCA",
3232 +
3233 + .modedb = at91_tft_vga_modes,
3234 + .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
3235 + .hfmin = 15000,
3236 + .hfmax = 64000,
3237 + .vfmin = 50,
3238 + .vfmax = 150,
3239 +};
3240 +
3241 +#define AT91SAM9261_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
3242 + | ATMEL_LCDC_DISTYPE_TFT \
3243 + | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
3244 +
3245 +static void at91_lcdc_power_control(int on)
3246 +{
3247 + if (on)
3248 + at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */
3249 + else
3250 + at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */
3251 +}
3252 +
3253 +/* Driver datas */
3254 +static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
3255 + .default_bpp = 16,
3256 + .default_dmacon = ATMEL_LCDC_DMAEN,
3257 + .default_lcdcon2 = AT91SAM9261_DEFAULT_LCDCON2,
3258 + .default_monspecs = &at91fb_default_monspecs,
3259 + .atmel_lcdfb_power_control = at91_lcdc_power_control,
3260 + .guard_time = 1,
3261 +};
3262 +
3263 +#else
3264 +static struct atmel_lcdfb_info __initdata ek_lcdc_data;
3265 +#endif
3266 +
3267 +
3268 static void __init ek_board_init(void)
3269 {
3270 /* Serial */
3271 @@ -241,10 +353,14 @@ static void __init ek_board_init(void)
3272 #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
3273 /* SPI */
3274 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
3275 + /* Touchscreen */
3276 + ek_add_device_ts();
3277 #else
3278 /* MMC */
3279 at91_add_device_mmc(0, &ek_mmc_data);
3280 #endif
3281 + /* LCD Controller */
3282 + at91_add_device_lcdc(&ek_lcdc_data);
3283 }
3284
3285 MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
3286 Index: linux-2.6.21.7/arch/arm/mach-at91/board-sam9263ek.c
3287 ===================================================================
3288 --- linux-2.6.21.7.orig/arch/arm/mach-at91/board-sam9263ek.c
3289 +++ linux-2.6.21.7/arch/arm/mach-at91/board-sam9263ek.c
3290 @@ -25,6 +25,10 @@
3291 #include <linux/module.h>
3292 #include <linux/platform_device.h>
3293 #include <linux/spi/spi.h>
3294 +#include <linux/spi/ads7846.h>
3295 +#include <linux/fb.h>
3296 +
3297 +#include <video/atmel_lcdc.h>
3298
3299 #include <asm/hardware.h>
3300 #include <asm/setup.h>
3301 @@ -86,6 +90,40 @@ static struct at91_udc_data __initdata e
3302
3303
3304 /*
3305 + * ADS7846 Touchscreen
3306 + */
3307 +#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
3308 +static int ads7843_pendown_state(void)
3309 +{
3310 + return !at91_get_gpio_value(AT91_PIN_PA15); /* Touchscreen PENIRQ */
3311 +}
3312 +
3313 +static struct ads7846_platform_data ads_info = {
3314 + .model = 7843,
3315 + .x_min = 150,
3316 + .x_max = 3830,
3317 + .y_min = 190,
3318 + .y_max = 3830,
3319 + .vref_delay_usecs = 100,
3320 + .x_plate_ohms = 450,
3321 + .y_plate_ohms = 250,
3322 + .pressure_max = 15000,
3323 + .debounce_max = 1,
3324 + .debounce_rep = 0,
3325 + .debounce_tol = (~0),
3326 + .get_pendown_state = ads7843_pendown_state,
3327 +};
3328 +
3329 +static void __init ek_add_device_ts(void)
3330 +{
3331 + at91_set_B_periph(AT91_PIN_PA15, 1); /* External IRQ1, with pullup */
3332 + at91_set_gpio_input(AT91_PIN_PA31, 1); /* Touchscreen BUSY signal */
3333 +}
3334 +#else
3335 +static void __init ek_add_device_ts(void) {}
3336 +#endif
3337 +
3338 +/*
3339 * SPI devices.
3340 */
3341 static struct spi_board_info ek_spi_devices[] = {
3342 @@ -97,6 +135,16 @@ static struct spi_board_info ek_spi_devi
3343 .bus_num = 0,
3344 },
3345 #endif
3346 +#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
3347 + {
3348 + .modalias = "ads7846",
3349 + .chip_select = 3,
3350 + .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
3351 + .bus_num = 0,
3352 + .platform_data = &ads_info,
3353 + .irq = AT91SAM9263_ID_IRQ1,
3354 + },
3355 +#endif
3356 };
3357
3358
3359 @@ -112,6 +160,14 @@ static struct at91_mmc_data __initdata e
3360
3361
3362 /*
3363 + * MACB Ethernet device
3364 + */
3365 +static struct at91_eth_data __initdata ek_macb_data = {
3366 + .is_rmii = 1,
3367 +};
3368 +
3369 +
3370 +/*
3371 * NAND flash
3372 */
3373 static struct mtd_partition __initdata ek_nand_partition[] = {
3374 @@ -148,6 +204,73 @@ static struct at91_nand_data __initdata
3375 };
3376
3377
3378 +/*
3379 + * LCD Controller
3380 + */
3381 +#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
3382 +static struct fb_videomode at91_tft_vga_modes[] = {
3383 + {
3384 + .name = "TX09D50VM1CCA @ 60",
3385 + .refresh = 60,
3386 + .xres = 240, .yres = 320,
3387 + .pixclock = KHZ2PICOS(4965),
3388 +
3389 + .left_margin = 1, .right_margin = 33,
3390 + .upper_margin = 1, .lower_margin = 0,
3391 + .hsync_len = 5, .vsync_len = 1,
3392 +
3393 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
3394 + .vmode = FB_VMODE_NONINTERLACED,
3395 + },
3396 +};
3397 +
3398 +static struct fb_monspecs at91fb_default_monspecs = {
3399 + .manufacturer = "HIT",
3400 + .monitor = "TX09D70VM1CCA",
3401 +
3402 + .modedb = at91_tft_vga_modes,
3403 + .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
3404 + .hfmin = 15000,
3405 + .hfmax = 64000,
3406 + .vfmin = 50,
3407 + .vfmax = 150,
3408 +};
3409 +
3410 +#define AT91SAM9263_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
3411 + | ATMEL_LCDC_DISTYPE_TFT \
3412 + | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
3413 +
3414 +static void at91_lcdc_power_control(int on)
3415 +{
3416 + if (on)
3417 + at91_set_gpio_value(AT91_PIN_PD12, 0); /* power up */
3418 + else
3419 + at91_set_gpio_value(AT91_PIN_PD12, 1); /* power down */
3420 +}
3421 +
3422 +/* Driver datas */
3423 +static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
3424 + .default_bpp = 16,
3425 + .default_dmacon = ATMEL_LCDC_DMAEN,
3426 + .default_lcdcon2 = AT91SAM9263_DEFAULT_LCDCON2,
3427 + .default_monspecs = &at91fb_default_monspecs,
3428 + .atmel_lcdfb_power_control = at91_lcdc_power_control,
3429 + .guard_time = 1,
3430 +};
3431 +
3432 +#else
3433 +static struct atmel_lcdfb_info __initdata ek_lcdc_data;
3434 +#endif
3435 +
3436 +
3437 +/*
3438 + * AC97
3439 + */
3440 +static struct atmel_ac97_data ek_ac97_data = {
3441 + .reset_pin = AT91_PIN_PA13,
3442 +};
3443 +
3444 +
3445 static void __init ek_board_init(void)
3446 {
3447 /* Serial */
3448 @@ -157,11 +280,22 @@ static void __init ek_board_init(void)
3449 /* USB Device */
3450 at91_add_device_udc(&ek_udc_data);
3451 /* SPI */
3452 + at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */
3453 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
3454 + /* Touchscreen */
3455 + ek_add_device_ts();
3456 /* MMC */
3457 at91_add_device_mmc(1, &ek_mmc_data);
3458 + /* Ethernet */
3459 + at91_add_device_eth(&ek_macb_data);
3460 /* NAND */
3461 at91_add_device_nand(&ek_nand_data);
3462 + /* I2C */
3463 + at91_add_device_i2c();
3464 + /* LCD Controller */
3465 + at91_add_device_lcdc(&ek_lcdc_data);
3466 + /* AC97 */
3467 + at91_add_device_ac97(&ek_ac97_data);
3468 }
3469
3470 MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
3471 Index: linux-2.6.21.7/arch/arm/mach-at91/board-sam9rlek.c
3472 ===================================================================
3473 --- /dev/null
3474 +++ linux-2.6.21.7/arch/arm/mach-at91/board-sam9rlek.c
3475 @@ -0,0 +1,204 @@
3476 +/*
3477 + * Copyright (C) 2005 SAN People
3478 + * Copyright (C) 2007 Atmel Corporation
3479 + *
3480 + * This file is subject to the terms and conditions of the GNU General Public
3481 + * License. See the file COPYING in the main directory of this archive for
3482 + * more details.
3483 + */
3484 +
3485 +#include <linux/types.h>
3486 +#include <linux/init.h>
3487 +#include <linux/mm.h>
3488 +#include <linux/module.h>
3489 +#include <linux/platform_device.h>
3490 +#include <linux/spi/spi.h>
3491 +#include <linux/fb.h>
3492 +#include <linux/clk.h>
3493 +
3494 +#include <video/atmel_lcdc.h>
3495 +
3496 +#include <asm/hardware.h>
3497 +#include <asm/setup.h>
3498 +#include <asm/mach-types.h>
3499 +#include <asm/irq.h>
3500 +
3501 +#include <asm/mach/arch.h>
3502 +#include <asm/mach/map.h>
3503 +#include <asm/mach/irq.h>
3504 +
3505 +#include <asm/arch/board.h>
3506 +#include <asm/arch/gpio.h>
3507 +#include <asm/arch/at91sam926x_mc.h>
3508 +
3509 +#include "generic.h"
3510 +
3511 +
3512 +/*
3513 + * Serial port configuration.
3514 + * 0 .. 3 = USART0 .. USART3
3515 + * 4 = DBGU
3516 + */
3517 +static struct at91_uart_config __initdata ek_uart_config = {
3518 + .console_tty = 0, /* ttyS0 */
3519 + .nr_tty = 2,
3520 + .tty_map = { 4, 0, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
3521 +};
3522 +
3523 +static void __init ek_map_io(void)
3524 +{
3525 + /* Initialize processor: 12.000 MHz crystal */
3526 + at91sam9rl_initialize(12000000);
3527 +
3528 + /* Setup the serial ports and console */
3529 + at91_init_serial(&ek_uart_config);
3530 +}
3531 +