First stage of update for at91 devices to 2.6.25.10 kernel
[openwrt/svn-archive/archive.git] / target / linux / at91 / patches-2.6.25 / 000-at91patches.patch
1 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/Kconfig linux-2.6/arch/arm/mach-at91/Kconfig
2 --- linux-2.6.25/arch/arm/mach-at91/Kconfig 2008-05-03 00:15:44.000000000 +0200
3 +++ linux-2.6/arch/arm/mach-at91/Kconfig 2008-04-25 21:15:43.000000000 +0200
4 @@ -12,18 +12,28 @@
5
6 config ARCH_AT91SAM9260
7 bool "AT91SAM9260 or AT91SAM9XE"
8 + select GENERIC_TIME
9 + select GENERIC_CLOCKEVENTS
10
11 config ARCH_AT91SAM9261
12 bool "AT91SAM9261"
13 + select GENERIC_TIME
14 + select GENERIC_CLOCKEVENTS
15
16 config ARCH_AT91SAM9263
17 bool "AT91SAM9263"
18 + select GENERIC_TIME
19 + select GENERIC_CLOCKEVENTS
20
21 config ARCH_AT91SAM9RL
22 bool "AT91SAM9RL"
23 + select GENERIC_TIME
24 + select GENERIC_CLOCKEVENTS
25
26 config ARCH_AT91CAP9
27 bool "AT91CAP9"
28 + select GENERIC_TIME
29 + select GENERIC_CLOCKEVENTS
30
31 config ARCH_AT91X40
32 bool "AT91x40"
33 @@ -45,7 +55,7 @@
34 depends on ARCH_AT91RM9200
35 help
36 Select this if you are using Ajeco's 1ARM Single Board Computer.
37 - <http://www.ajeco.fi/products.htm>
38 + <http://www.ajeco.fi/eng/products_e.htm>
39
40 config ARCH_AT91RM9200DK
41 bool "Atmel AT91RM9200-DK Development board"
42 @@ -94,7 +104,7 @@
43 depends on ARCH_AT91RM9200
44 help
45 Select this if you are using KwikByte's KB920x board.
46 - <http://kwikbyte.com/KB9202_description_new.htm>
47 + <http://www.kwikbyte.com/KB9202.html>
48
49 config MACH_PICOTUX2XX
50 bool "picotux 200"
51 @@ -109,6 +119,38 @@
52 help
53 Select this if you are using Sperry-Sun's KAFA board.
54
55 +config MACH_CHUB
56 + bool "Promwad Chub board"
57 + depends on ARCH_AT91RM9200
58 + help
59 + Select this if you are using Promwad's Chub board.
60 +
61 +config MACH_HOMEMATIC
62 + bool "eQ-3 HomeMatic"
63 + depends on ARCH_AT91RM9200
64 + help
65 + Select this if you are using eQ-3's HomeMatic device.
66 + <http://www.eq-3.com>
67 +
68 +config MACH_ECBAT91
69 + bool "emQbit ECB_AT91 SBC"
70 + depends on ARCH_AT91RM9200
71 + help
72 + Select this if you are using emQbit's ECB_AT91 board.
73 + <http://wiki.emqbit.com/free-ecb-at91>
74 +
75 +config MACH_SWEDATMS
76 + bool "Sweda TMS Board"
77 + depends on ARCH_AT91RM9200
78 + help
79 + Select this if you are using Sweda TMS-100 board.
80 +
81 +config MACH_TT9200
82 + bool "Toptech TT9200"
83 + depends on ARCH_AT91RM9200
84 + help
85 + Select this if you are using Toptech's TT9200 board.
86 +
87 endif
88
89 # ----------------------------------------------------------
90 @@ -133,6 +175,34 @@
91 Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit
92 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933>
93
94 +config MACH_CAM60
95 + bool "KwikByte KB9260 (CAM60) board"
96 + depends on ARCH_AT91SAM9260
97 + help
98 + Select this if you are using KwikByte's KB9260 (CAM60) board based on the Atmel AT91SAM9260.
99 + <http://www.kwikbyte.com/KB9260.html>
100 +
101 +config MACH_SAM9_L9260
102 + bool "Olimex SAM9-L9260 board"
103 + depends on ARCH_AT91SAM9260
104 + help
105 + Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260.
106 + <http://www.olimex.com/dev/sam9-L9260.html>
107 +
108 +config MACH_USB_A9260
109 + bool "CALAO USB-A9260"
110 + depends on ARCH_AT91SAM9260
111 + help
112 + Select this if you are using a Calao Systems USB-A9260.
113 + <http://www.calao-systems.com>
114 +
115 +config MACH_QIL_A9260
116 + bool "CALAO QIL-A9260 board"
117 + depends on ARCH_AT91SAM9260
118 + help
119 + Select this if you are using a Calao Systems QIL-A9260 Board.
120 + <http://www.calao-systems.com>
121 +
122 endif
123
124 # ----------------------------------------------------------
125 @@ -163,6 +233,13 @@
126 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
127 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
128
129 +config MACH_USB_A9263
130 + bool "CALAO USB-A9263"
131 + depends on ARCH_AT91SAM9263
132 + help
133 + Select this if you are using a Calao Systems USB-A9263.
134 + <http://www.calao-systems.com>
135 +
136 endif
137
138 # ----------------------------------------------------------
139 @@ -216,7 +293,7 @@
140
141 config MTD_AT91_DATAFLASH_CARD
142 bool "Enable DataFlash Card support"
143 - depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK)
144 + depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_ECBAT91 || MACH_SAM9_L9260 || MACH_AT91CAP9ADK)
145 help
146 Enable support for the DataFlash card.
147
148 @@ -237,6 +314,19 @@
149 Select this if you need to program one or more of the PCK0..PCK3
150 programmable clock outputs.
151
152 +config AT91_SLOW_CLOCK
153 + bool "Suspend-to-RAM disables main oscillator"
154 + depends on SUSPEND
155 + help
156 + Select this if you want Suspend-to-RAM to save the most power
157 + possible (without powering off the CPU) by disabling the PLLs
158 + and main oscillator so that only the 32 KiHz clock is available.
159 +
160 + When only that slow-clock is available, some peripherals lose
161 + functionality. Many can't issue wakeup events unless faster
162 + clocks are available. Some lose their operating state and
163 + need to be completely re-initialized.
164 +
165 config AT91_TIMER_HZ
166 int "Kernel HZ (jiffies per second)"
167 range 32 1024
168 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/Makefile linux-2.6/arch/arm/mach-at91/Makefile
169 --- linux-2.6.25/arch/arm/mach-at91/Makefile 2008-05-03 00:15:44.000000000 +0200
170 +++ linux-2.6/arch/arm/mach-at91/Makefile 2008-04-25 21:15:43.000000000 +0200
171 @@ -28,16 +28,26 @@
172 obj-$(CONFIG_MACH_KB9200) += board-kb9202.o
173 obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o
174 obj-$(CONFIG_MACH_KAFA) += board-kafa.o
175 +obj-$(CONFIG_MACH_CHUB) += board-chub.o
176 obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o
177 +obj-$(CONFIG_MACH_HOMEMATIC) += board-homematic.o
178 +obj-$(CONFIG_MACH_ECBAT91) += board-ecbat91.o
179 +obj-$(CONFIG_MACH_SWEDATMS) += board-tms.o
180 +obj-$(CONFIG_MACH_TT9200) += board-tt9200.o
181
182 # AT91SAM9260 board-specific support
183 obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
184 +obj-$(CONFIG_MACH_CAM60) += board-cam60.o
185 +obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
186 +obj-$(CONFIG_MACH_USB_A9260) += board-usb-a9260.o
187 +obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
188
189 # AT91SAM9261 board-specific support
190 obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o
191
192 # AT91SAM9263 board-specific support
193 obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
194 +obj-$(CONFIG_MACH_USB_A9263) += board-usb-a9263.o
195
196 # AT91SAM9RL board-specific support
197 obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
198 @@ -50,9 +60,11 @@
199
200 # Drivers
201 obj-y += leds.o
202 +obj-$(CONFIG_FB_S1D13XXX) += ics1523.o
203
204 # Power Management
205 obj-$(CONFIG_PM) += pm.o
206 +obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o
207
208 ifeq ($(CONFIG_PM_DEBUG),y)
209 CFLAGS_pm.o += -DDEBUG
210 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91cap9.c linux-2.6/arch/arm/mach-at91/at91cap9.c
211 --- linux-2.6.25/arch/arm/mach-at91/at91cap9.c 2008-05-03 00:15:44.000000000 +0200
212 +++ linux-2.6/arch/arm/mach-at91/at91cap9.c 2008-05-05 22:01:39.000000000 +0200
213 @@ -13,12 +13,15 @@
214 */
215
216 #include <linux/module.h>
217 +#include <linux/pm.h>
218
219 #include <asm/mach/arch.h>
220 #include <asm/mach/map.h>
221 +#include <asm/arch/cpu.h>
222 #include <asm/arch/at91cap9.h>
223 #include <asm/arch/at91_pmc.h>
224 #include <asm/arch/at91_rstc.h>
225 +#include <asm/arch/at91_shdwc.h>
226
227 #include "generic.h"
228 #include "clock.h"
229 @@ -288,6 +291,12 @@
230 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
231 }
232
233 +static void at91cap9_poweroff(void)
234 +{
235 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
236 +}
237 +
238 +
239 /* --------------------------------------------------------------------
240 * AT91CAP9 processor initialization
241 * -------------------------------------------------------------------- */
242 @@ -298,6 +307,7 @@
243 iotable_init(at91cap9_io_desc, ARRAY_SIZE(at91cap9_io_desc));
244
245 at91_arch_reset = at91cap9_reset;
246 + pm_power_off = at91cap9_poweroff;
247 at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
248
249 /* Init clock subsystem */
250 @@ -308,6 +318,12 @@
251
252 /* Register GPIO subsystem */
253 at91_gpio_init(at91cap9_gpio, 4);
254 +
255 + /* Remember the silicon revision */
256 + if (cpu_is_at91cap9_revB())
257 + system_rev = 0xB;
258 + else if (cpu_is_at91cap9_revC())
259 + system_rev = 0xC;
260 }
261
262 /* --------------------------------------------------------------------
263 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91cap9_devices.c linux-2.6/arch/arm/mach-at91/at91cap9_devices.c
264 --- linux-2.6.25/arch/arm/mach-at91/at91cap9_devices.c 2008-05-03 00:15:44.000000000 +0200
265 +++ linux-2.6/arch/arm/mach-at91/at91cap9_devices.c 2008-05-05 22:01:39.000000000 +0200
266 @@ -13,18 +13,20 @@
267 */
268 #include <asm/mach/arch.h>
269 #include <asm/mach/map.h>
270 +#include <asm/mach/irq.h>
271
272 #include <linux/dma-mapping.h>
273 #include <linux/platform_device.h>
274 -#include <linux/mtd/physmap.h>
275 +#include <linux/i2c-gpio.h>
276
277 #include <video/atmel_lcdc.h>
278
279 #include <asm/arch/board.h>
280 +#include <asm/arch/cpu.h>
281 #include <asm/arch/gpio.h>
282 #include <asm/arch/at91cap9.h>
283 -#include <asm/arch/at91sam926x_mc.h>
284 #include <asm/arch/at91cap9_matrix.h>
285 +#include <asm/arch/at91sam9_smc.h>
286
287 #include "generic.h"
288
289 @@ -69,6 +71,9 @@
290 if (!data)
291 return;
292
293 + if (cpu_is_at91cap9_revB())
294 + set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH);
295 +
296 /* Enable VBus control for UHP ports */
297 for (i = 0; i < data->ports; i++) {
298 if (data->vbus_pin[i])
299 @@ -84,6 +89,110 @@
300
301
302 /* --------------------------------------------------------------------
303 + * USB HS Device (Gadget)
304 + * -------------------------------------------------------------------- */
305 +
306 +#if defined(CONFIG_USB_GADGET_ATMEL_USBA) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE)
307 +
308 +static struct resource usba_udc_resources[] = {
309 + [0] = {
310 + .start = AT91CAP9_UDPHS_FIFO,
311 + .end = AT91CAP9_UDPHS_FIFO + SZ_512K - 1,
312 + .flags = IORESOURCE_MEM,
313 + },
314 + [1] = {
315 + .start = AT91CAP9_BASE_UDPHS,
316 + .end = AT91CAP9_BASE_UDPHS + SZ_1K - 1,
317 + .flags = IORESOURCE_MEM,
318 + },
319 + [2] = {
320 + .start = AT91CAP9_ID_UDPHS,
321 + .end = AT91CAP9_ID_UDPHS,
322 + .flags = IORESOURCE_IRQ,
323 + },
324 +};
325 +
326 +#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
327 + [idx] = { \
328 + .name = nam, \
329 + .index = idx, \
330 + .fifo_size = maxpkt, \
331 + .nr_banks = maxbk, \
332 + .can_dma = dma, \
333 + .can_isoc = isoc, \
334 + }
335 +
336 +static struct usba_ep_data usba_udc_ep[] = {
337 + EP("ep0", 0, 64, 1, 0, 0),
338 + EP("ep1", 1, 1024, 3, 1, 1),
339 + EP("ep2", 2, 1024, 3, 1, 1),
340 + EP("ep3", 3, 1024, 2, 1, 1),
341 + EP("ep4", 4, 1024, 2, 1, 1),
342 + EP("ep5", 5, 1024, 2, 1, 0),
343 + EP("ep6", 6, 1024, 2, 1, 0),
344 + EP("ep7", 7, 1024, 2, 0, 0),
345 +};
346 +
347 +#undef EP
348 +
349 +/*
350 + * pdata doesn't have room for any endpoints, so we need to
351 + * append room for the ones we need right after it.
352 + */
353 +static struct {
354 + struct usba_platform_data pdata;
355 + struct usba_ep_data ep[8];
356 +} usba_udc_data;
357 +
358 +static struct platform_device at91_usba_udc_device = {
359 + .name = "atmel_usba_udc",
360 + .id = -1,
361 + .dev = {
362 + .platform_data = &usba_udc_data.pdata,
363 + },
364 + .resource = usba_udc_resources,
365 + .num_resources = ARRAY_SIZE(usba_udc_resources),
366 +};
367 +
368 +void __init at91_add_device_usba(struct usba_platform_data *data)
369 +{
370 + if (cpu_is_at91cap9_revB()) {
371 + set_irq_type(AT91CAP9_ID_UDPHS, IRQT_HIGH);
372 + at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS |
373 + AT91_MATRIX_UDPHS_BYPASS_LOCK);
374 + }
375 + else
376 + at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS);
377 +
378 + /*
379 + * Invalid pins are 0 on AT91, but the usba driver is shared
380 + * with AVR32, which use negative values instead. Once/if
381 + * gpio_is_valid() is ported to AT91, revisit this code.
382 + */
383 + usba_udc_data.pdata.vbus_pin = -EINVAL;
384 + usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
385 + memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));;
386 +
387 + if (data && data->vbus_pin > 0) {
388 + at91_set_gpio_input(data->vbus_pin, 0);
389 + at91_set_deglitch(data->vbus_pin, 1);
390 + usba_udc_data.pdata.vbus_pin = data->vbus_pin;
391 + }
392 +
393 + /* Pullup pin is handled internally by USB device peripheral */
394 +
395 + /* Clocks */
396 + at91_clock_associate("utmi_clk", &at91_usba_udc_device.dev, "hclk");
397 + at91_clock_associate("udphs_clk", &at91_usba_udc_device.dev, "pclk");
398 +
399 + platform_device_register(&at91_usba_udc_device);
400 +}
401 +#else
402 +void __init at91_add_device_usba(struct usba_platform_data *data) {}
403 +#endif
404 +
405 +
406 +/* --------------------------------------------------------------------
407 * Ethernet
408 * -------------------------------------------------------------------- */
409
410 @@ -246,7 +355,7 @@
411 }
412
413 mmc0_data = *data;
414 - at91_clock_associate("mci0_clk", &at91cap9_mmc1_device.dev, "mci_clk");
415 + at91_clock_associate("mci0_clk", &at91cap9_mmc0_device.dev, "mci_clk");
416 platform_device_register(&at91cap9_mmc0_device);
417 } else { /* MCI1 */
418 /* CLK */
419 @@ -283,10 +392,15 @@
420 #define NAND_BASE AT91_CHIPSELECT_3
421
422 static struct resource nand_resources[] = {
423 - {
424 + [0] = {
425 .start = NAND_BASE,
426 .end = NAND_BASE + SZ_256M - 1,
427 .flags = IORESOURCE_MEM,
428 + },
429 + [1] = {
430 + .start = AT91_BASE_SYS + AT91_ECC,
431 + .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1,
432 + .flags = IORESOURCE_MEM,
433 }
434 };
435
436 @@ -344,6 +458,7 @@
437 void __init at91_add_device_nand(struct at91_nand_data *data) {}
438 #endif
439
440 +
441 /* --------------------------------------------------------------------
442 * TWI (i2c)
443 * -------------------------------------------------------------------- */
444 @@ -532,17 +647,64 @@
445
446
447 /* --------------------------------------------------------------------
448 + * Timer/Counter block
449 + * -------------------------------------------------------------------- */
450 +
451 +#ifdef CONFIG_ATMEL_TCLIB
452 +
453 +static struct resource tcb_resources[] = {
454 + [0] = {
455 + .start = AT91CAP9_BASE_TCB0,
456 + .end = AT91CAP9_BASE_TCB0 + SZ_16K - 1,
457 + .flags = IORESOURCE_MEM,
458 + },
459 + [1] = {
460 + .start = AT91CAP9_ID_TCB,
461 + .end = AT91CAP9_ID_TCB,
462 + .flags = IORESOURCE_IRQ,
463 + },
464 +};
465 +
466 +static struct platform_device at91cap9_tcb_device = {
467 + .name = "atmel_tcb",
468 + .id = 0,
469 + .resource = tcb_resources,
470 + .num_resources = ARRAY_SIZE(tcb_resources),
471 +};
472 +
473 +static void __init at91_add_device_tc(void)
474 +{
475 + /* this chip has one clock and irq for all three TC channels */
476 + at91_clock_associate("tcb_clk", &at91cap9_tcb_device.dev, "t0_clk");
477 + platform_device_register(&at91cap9_tcb_device);
478 +}
479 +#else
480 +static void __init at91_add_device_tc(void) { }
481 +#endif
482 +
483 +
484 +/* --------------------------------------------------------------------
485 * RTT
486 * -------------------------------------------------------------------- */
487
488 +static struct resource rtt_resources[] = {
489 + {
490 + .start = AT91_BASE_SYS + AT91_RTT,
491 + .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
492 + .flags = IORESOURCE_MEM,
493 + }
494 +};
495 +
496 static struct platform_device at91cap9_rtt_device = {
497 .name = "at91_rtt",
498 - .id = -1,
499 - .num_resources = 0,
500 + .id = 0,
501 + .resource = rtt_resources,
502 + .num_resources = ARRAY_SIZE(rtt_resources),
503 };
504
505 static void __init at91_add_device_rtt(void)
506 {
507 + device_init_wakeup(&at91cap9_rtt_device.dev, 1);
508 platform_device_register(&at91cap9_rtt_device);
509 }
510
511 @@ -660,6 +822,9 @@
512 if (!data)
513 return;
514
515 + if (cpu_is_at91cap9_revB())
516 + set_irq_type(AT91CAP9_ID_LCDC, IRQT_HIGH);
517 +
518 at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
519 at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
520 at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
521 @@ -990,7 +1155,7 @@
522 at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */
523 }
524
525 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
526 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
527 struct platform_device *atmel_default_console_device; /* the serial console device */
528
529 void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
530 @@ -1031,8 +1196,6 @@
531 {
532 if (portnr < ATMEL_MAX_UART)
533 atmel_default_console_device = at91_uarts[portnr];
534 - if (!atmel_default_console_device)
535 - printk(KERN_INFO "AT91: No default serial console defined.\n");
536 }
537
538 void __init at91_add_device_serial(void)
539 @@ -1043,6 +1206,9 @@
540 if (at91_uarts[i])
541 platform_device_register(at91_uarts[i]);
542 }
543 +
544 + if (!atmel_default_console_device)
545 + printk(KERN_INFO "AT91: No default serial console defined.\n");
546 }
547 #else
548 void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
549 @@ -1060,6 +1226,7 @@
550 {
551 at91_add_device_rtt();
552 at91_add_device_watchdog();
553 + at91_add_device_tc();
554 return 0;
555 }
556
557 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91rm9200_devices.c linux-2.6/arch/arm/mach-at91/at91rm9200_devices.c
558 --- linux-2.6.25/arch/arm/mach-at91/at91rm9200_devices.c 2008-05-03 00:15:44.000000000 +0200
559 +++ linux-2.6/arch/arm/mach-at91/at91rm9200_devices.c 2008-04-25 21:15:43.000000000 +0200
560 @@ -513,7 +513,18 @@
561 * SPI
562 * -------------------------------------------------------------------- */
563
564 -#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
565 +#if defined(CONFIG_AT91_SPI) || defined(CONFIG_AT91_SPI_MODULE) /* legacy SPI driver */
566 +#define SPI_DEVNAME "at91_spi"
567 +
568 +#elif defined(CONFIG_SPI_AT91) || defined(CONFIG_SPI_AT91_MODULE) /* SPI bitbanging driver */
569 +#define SPI_DEVNAME "at91_spi"
570 +
571 +#elif defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) /* new SPI driver */
572 +#define SPI_DEVNAME "atmel_spi"
573 +
574 +#endif
575 +
576 +#ifdef SPI_DEVNAME
577 static u64 spi_dmamask = DMA_BIT_MASK(32);
578
579 static struct resource spi_resources[] = {
580 @@ -530,7 +541,7 @@
581 };
582
583 static struct platform_device at91rm9200_spi_device = {
584 - .name = "atmel_spi",
585 + .name = SPI_DEVNAME,
586 .id = 0,
587 .dev = {
588 .dma_mask = &spi_dmamask,
589 @@ -563,6 +574,12 @@
590 else
591 at91_set_gpio_output(cs_pin, 1);
592
593 +#if defined(CONFIG_AT91_SPI) || defined(CONFIG_AT91_SPI_MODULE)
594 + /*
595 + * Force peripheral mode when using the legacy SPI driver.
596 + */
597 + at91_set_A_periph(cs_pin, 0);
598 +#endif
599
600 /* pass chip-select pin to driver */
601 devices[i].controller_data = (void *) cs_pin;
602 @@ -577,6 +594,90 @@
603
604
605 /* --------------------------------------------------------------------
606 + * Timer/Counter blocks
607 + * -------------------------------------------------------------------- */
608 +
609 +#ifdef CONFIG_ATMEL_TCLIB
610 +
611 +static struct resource tcb0_resources[] = {
612 + [0] = {
613 + .start = AT91RM9200_BASE_TCB0,
614 + .end = AT91RM9200_BASE_TCB0 + SZ_16K - 1,
615 + .flags = IORESOURCE_MEM,
616 + },
617 + [1] = {
618 + .start = AT91RM9200_ID_TC0,
619 + .end = AT91RM9200_ID_TC0,
620 + .flags = IORESOURCE_IRQ,
621 + },
622 + [2] = {
623 + .start = AT91RM9200_ID_TC1,
624 + .end = AT91RM9200_ID_TC1,
625 + .flags = IORESOURCE_IRQ,
626 + },
627 + [3] = {
628 + .start = AT91RM9200_ID_TC2,
629 + .end = AT91RM9200_ID_TC2,
630 + .flags = IORESOURCE_IRQ,
631 + },
632 +};
633 +
634 +static struct platform_device at91rm9200_tcb0_device = {
635 + .name = "atmel_tcb",
636 + .id = 0,
637 + .resource = tcb0_resources,
638 + .num_resources = ARRAY_SIZE(tcb0_resources),
639 +};
640 +
641 +static struct resource tcb1_resources[] = {
642 + [0] = {
643 + .start = AT91RM9200_BASE_TCB1,
644 + .end = AT91RM9200_BASE_TCB1 + SZ_16K - 1,
645 + .flags = IORESOURCE_MEM,
646 + },
647 + [1] = {
648 + .start = AT91RM9200_ID_TC3,
649 + .end = AT91RM9200_ID_TC3,
650 + .flags = IORESOURCE_IRQ,
651 + },
652 + [2] = {
653 + .start = AT91RM9200_ID_TC4,
654 + .end = AT91RM9200_ID_TC4,
655 + .flags = IORESOURCE_IRQ,
656 + },
657 + [3] = {
658 + .start = AT91RM9200_ID_TC5,
659 + .end = AT91RM9200_ID_TC5,
660 + .flags = IORESOURCE_IRQ,
661 + },
662 +};
663 +
664 +static struct platform_device at91rm9200_tcb1_device = {
665 + .name = "atmel_tcb",
666 + .id = 1,
667 + .resource = tcb1_resources,
668 + .num_resources = ARRAY_SIZE(tcb1_resources),
669 +};
670 +
671 +static void __init at91_add_device_tc(void)
672 +{
673 + /* this chip has a separate clock and irq for each TC channel */
674 + at91_clock_associate("tc0_clk", &at91rm9200_tcb0_device.dev, "t0_clk");
675 + at91_clock_associate("tc1_clk", &at91rm9200_tcb0_device.dev, "t1_clk");
676 + at91_clock_associate("tc2_clk", &at91rm9200_tcb0_device.dev, "t2_clk");
677 + platform_device_register(&at91rm9200_tcb0_device);
678 +
679 + at91_clock_associate("tc3_clk", &at91rm9200_tcb1_device.dev, "t0_clk");
680 + at91_clock_associate("tc4_clk", &at91rm9200_tcb1_device.dev, "t1_clk");
681 + at91_clock_associate("tc5_clk", &at91rm9200_tcb1_device.dev, "t2_clk");
682 + platform_device_register(&at91rm9200_tcb1_device);
683 +}
684 +#else
685 +static void __init at91_add_device_tc(void) { }
686 +#endif
687 +
688 +
689 +/* --------------------------------------------------------------------
690 * RTC
691 * -------------------------------------------------------------------- */
692
693 @@ -589,6 +690,7 @@
694
695 static void __init at91_add_device_rtc(void)
696 {
697 + device_init_wakeup(&at91rm9200_rtc_device.dev, 1);
698 platform_device_register(&at91rm9200_rtc_device);
699 }
700 #else
701 @@ -1019,7 +1121,7 @@
702 at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */
703 }
704
705 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
706 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
707 struct platform_device *atmel_default_console_device; /* the serial console device */
708
709 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
710 @@ -1110,8 +1212,6 @@
711 {
712 if (portnr < ATMEL_MAX_UART)
713 atmel_default_console_device = at91_uarts[portnr];
714 - if (!atmel_default_console_device)
715 - printk(KERN_INFO "AT91: No default serial console defined.\n");
716 }
717
718 void __init at91_add_device_serial(void)
719 @@ -1122,6 +1222,9 @@
720 if (at91_uarts[i])
721 platform_device_register(at91_uarts[i]);
722 }
723 +
724 + if (!atmel_default_console_device)
725 + printk(KERN_INFO "AT91: No default serial console defined.\n");
726 }
727 #else
728 void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
729 @@ -1141,6 +1244,7 @@
730 {
731 at91_add_device_rtc();
732 at91_add_device_watchdog();
733 + at91_add_device_tc();
734 return 0;
735 }
736
737 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91rm9200_time.c linux-2.6/arch/arm/mach-at91/at91rm9200_time.c
738 --- linux-2.6.25/arch/arm/mach-at91/at91rm9200_time.c 2008-05-03 00:15:33.000000000 +0200
739 +++ linux-2.6/arch/arm/mach-at91/at91rm9200_time.c 2008-04-25 21:15:43.000000000 +0200
740 @@ -136,8 +136,6 @@
741 u32 alm;
742 int status = 0;
743
744 - BUG_ON(delta < 2);
745 -
746 /* Use "raw" primitives so we behave correctly on RT kernels. */
747 raw_local_irq_save(flags);
748
749 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9260.c linux-2.6/arch/arm/mach-at91/at91sam9260.c
750 --- linux-2.6.25/arch/arm/mach-at91/at91sam9260.c 2008-05-03 00:15:44.000000000 +0200
751 +++ linux-2.6/arch/arm/mach-at91/at91sam9260.c 2008-04-25 21:15:43.000000000 +0200
752 @@ -11,6 +11,7 @@
753 */
754
755 #include <linux/module.h>
756 +#include <linux/pm.h>
757
758 #include <asm/mach/arch.h>
759 #include <asm/mach/map.h>
760 @@ -18,6 +19,7 @@
761 #include <asm/arch/at91sam9260.h>
762 #include <asm/arch/at91_pmc.h>
763 #include <asm/arch/at91_rstc.h>
764 +#include <asm/arch/at91_shdwc.h>
765
766 #include "generic.h"
767 #include "clock.h"
768 @@ -267,6 +269,11 @@
769 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
770 }
771
772 +static void at91sam9260_poweroff(void)
773 +{
774 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
775 +}
776 +
777
778 /* --------------------------------------------------------------------
779 * AT91SAM9260 processor initialization
780 @@ -304,6 +311,7 @@
781 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc));
782
783 at91_arch_reset = at91sam9260_reset;
784 + pm_power_off = at91sam9260_poweroff;
785 at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
786 | (1 << AT91SAM9260_ID_IRQ2);
787
788 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9260_devices.c linux-2.6/arch/arm/mach-at91/at91sam9260_devices.c
789 --- linux-2.6.25/arch/arm/mach-at91/at91sam9260_devices.c 2008-05-03 00:15:44.000000000 +0200
790 +++ linux-2.6/arch/arm/mach-at91/at91sam9260_devices.c 2008-04-25 21:15:43.000000000 +0200
791 @@ -19,8 +19,8 @@
792 #include <asm/arch/board.h>
793 #include <asm/arch/gpio.h>
794 #include <asm/arch/at91sam9260.h>
795 -#include <asm/arch/at91sam926x_mc.h>
796 #include <asm/arch/at91sam9260_matrix.h>
797 +#include <asm/arch/at91sam9_smc.h>
798
799 #include "generic.h"
800
801 @@ -288,10 +288,15 @@
802 #define NAND_BASE AT91_CHIPSELECT_3
803
804 static struct resource nand_resources[] = {
805 - {
806 + [0] = {
807 .start = NAND_BASE,
808 .end = NAND_BASE + SZ_256M - 1,
809 .flags = IORESOURCE_MEM,
810 + },
811 + [1] = {
812 + .start = AT91_BASE_SYS + AT91_ECC,
813 + .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1,
814 + .flags = IORESOURCE_MEM,
815 }
816 };
817
818 @@ -540,6 +545,90 @@
819
820
821 /* --------------------------------------------------------------------
822 + * Timer/Counter blocks
823 + * -------------------------------------------------------------------- */
824 +
825 +#ifdef CONFIG_ATMEL_TCLIB
826 +
827 +static struct resource tcb0_resources[] = {
828 + [0] = {
829 + .start = AT91SAM9260_BASE_TCB0,
830 + .end = AT91SAM9260_BASE_TCB0 + SZ_16K - 1,
831 + .flags = IORESOURCE_MEM,
832 + },
833 + [1] = {
834 + .start = AT91SAM9260_ID_TC0,
835 + .end = AT91SAM9260_ID_TC0,
836 + .flags = IORESOURCE_IRQ,
837 + },
838 + [2] = {
839 + .start = AT91SAM9260_ID_TC1,
840 + .end = AT91SAM9260_ID_TC1,
841 + .flags = IORESOURCE_IRQ,
842 + },
843 + [3] = {
844 + .start = AT91SAM9260_ID_TC2,
845 + .end = AT91SAM9260_ID_TC2,
846 + .flags = IORESOURCE_IRQ,
847 + },
848 +};
849 +
850 +static struct platform_device at91sam9260_tcb0_device = {
851 + .name = "atmel_tcb",
852 + .id = 0,
853 + .resource = tcb0_resources,
854 + .num_resources = ARRAY_SIZE(tcb0_resources),
855 +};
856 +
857 +static struct resource tcb1_resources[] = {
858 + [0] = {
859 + .start = AT91SAM9260_BASE_TCB1,
860 + .end = AT91SAM9260_BASE_TCB1 + SZ_16K - 1,
861 + .flags = IORESOURCE_MEM,
862 + },
863 + [1] = {
864 + .start = AT91SAM9260_ID_TC3,
865 + .end = AT91SAM9260_ID_TC3,
866 + .flags = IORESOURCE_IRQ,
867 + },
868 + [2] = {
869 + .start = AT91SAM9260_ID_TC4,
870 + .end = AT91SAM9260_ID_TC4,
871 + .flags = IORESOURCE_IRQ,
872 + },
873 + [3] = {
874 + .start = AT91SAM9260_ID_TC5,
875 + .end = AT91SAM9260_ID_TC5,
876 + .flags = IORESOURCE_IRQ,
877 + },
878 +};
879 +
880 +static struct platform_device at91sam9260_tcb1_device = {
881 + .name = "atmel_tcb",
882 + .id = 1,
883 + .resource = tcb1_resources,
884 + .num_resources = ARRAY_SIZE(tcb1_resources),
885 +};
886 +
887 +static void __init at91_add_device_tc(void)
888 +{
889 + /* this chip has a separate clock and irq for each TC channel */
890 + at91_clock_associate("tc0_clk", &at91sam9260_tcb0_device.dev, "t0_clk");
891 + at91_clock_associate("tc1_clk", &at91sam9260_tcb0_device.dev, "t1_clk");
892 + at91_clock_associate("tc2_clk", &at91sam9260_tcb0_device.dev, "t2_clk");
893 + platform_device_register(&at91sam9260_tcb0_device);
894 +
895 + at91_clock_associate("tc3_clk", &at91sam9260_tcb1_device.dev, "t0_clk");
896 + at91_clock_associate("tc4_clk", &at91sam9260_tcb1_device.dev, "t1_clk");
897 + at91_clock_associate("tc5_clk", &at91sam9260_tcb1_device.dev, "t2_clk");
898 + platform_device_register(&at91sam9260_tcb1_device);
899 +}
900 +#else
901 +static void __init at91_add_device_tc(void) { }
902 +#endif
903 +
904 +
905 +/* --------------------------------------------------------------------
906 * RTT
907 * -------------------------------------------------------------------- */
908
909 @@ -553,13 +642,14 @@
910
911 static struct platform_device at91sam9260_rtt_device = {
912 .name = "at91_rtt",
913 - .id = -1,
914 + .id = 0,
915 .resource = rtt_resources,
916 .num_resources = ARRAY_SIZE(rtt_resources),
917 };
918
919 static void __init at91_add_device_rtt(void)
920 {
921 + device_init_wakeup(&at91sam9260_rtt_device.dev, 1);
922 platform_device_register(&at91sam9260_rtt_device);
923 }
924
925 @@ -962,7 +1052,7 @@
926 at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */
927 }
928
929 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
930 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
931 struct platform_device *atmel_default_console_device; /* the serial console device */
932
933 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
934 @@ -1073,8 +1163,6 @@
935 {
936 if (portnr < ATMEL_MAX_UART)
937 atmel_default_console_device = at91_uarts[portnr];
938 - if (!atmel_default_console_device)
939 - printk(KERN_INFO "AT91: No default serial console defined.\n");
940 }
941
942 void __init at91_add_device_serial(void)
943 @@ -1085,6 +1173,9 @@
944 if (at91_uarts[i])
945 platform_device_register(at91_uarts[i]);
946 }
947 +
948 + if (!atmel_default_console_device)
949 + printk(KERN_INFO "AT91: No default serial console defined.\n");
950 }
951 #else
952 void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
953 @@ -1103,6 +1194,7 @@
954 {
955 at91_add_device_rtt();
956 at91_add_device_watchdog();
957 + at91_add_device_tc();
958 return 0;
959 }
960
961 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9261.c linux-2.6/arch/arm/mach-at91/at91sam9261.c
962 --- linux-2.6.25/arch/arm/mach-at91/at91sam9261.c 2008-05-03 00:15:44.000000000 +0200
963 +++ linux-2.6/arch/arm/mach-at91/at91sam9261.c 2008-04-25 21:15:43.000000000 +0200
964 @@ -11,12 +11,14 @@
965 */
966
967 #include <linux/module.h>
968 +#include <linux/pm.h>
969
970 #include <asm/mach/arch.h>
971 #include <asm/mach/map.h>
972 #include <asm/arch/at91sam9261.h>
973 #include <asm/arch/at91_pmc.h>
974 #include <asm/arch/at91_rstc.h>
975 +#include <asm/arch/at91_shdwc.h>
976
977 #include "generic.h"
978 #include "clock.h"
979 @@ -245,6 +247,11 @@
980 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
981 }
982
983 +static void at91sam9261_poweroff(void)
984 +{
985 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
986 +}
987 +
988
989 /* --------------------------------------------------------------------
990 * AT91SAM9261 processor initialization
991 @@ -256,6 +263,7 @@
992 iotable_init(at91sam9261_io_desc, ARRAY_SIZE(at91sam9261_io_desc));
993
994 at91_arch_reset = at91sam9261_reset;
995 + pm_power_off = at91sam9261_poweroff;
996 at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
997 | (1 << AT91SAM9261_ID_IRQ2);
998
999 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9261_devices.c linux-2.6/arch/arm/mach-at91/at91sam9261_devices.c
1000 --- linux-2.6.25/arch/arm/mach-at91/at91sam9261_devices.c 2008-05-03 00:15:44.000000000 +0200
1001 +++ linux-2.6/arch/arm/mach-at91/at91sam9261_devices.c 2008-04-25 21:15:43.000000000 +0200
1002 @@ -24,7 +24,7 @@
1003 #include <asm/arch/gpio.h>
1004 #include <asm/arch/at91sam9261.h>
1005 #include <asm/arch/at91sam9261_matrix.h>
1006 -#include <asm/arch/at91sam926x_mc.h>
1007 +#include <asm/arch/at91sam9_smc.h>
1008
1009 #include "generic.h"
1010
1011 @@ -548,6 +548,55 @@
1012
1013
1014 /* --------------------------------------------------------------------
1015 + * Timer/Counter block
1016 + * -------------------------------------------------------------------- */
1017 +
1018 +#ifdef CONFIG_ATMEL_TCLIB
1019 +
1020 +static struct resource tcb_resources[] = {
1021 + [0] = {
1022 + .start = AT91SAM9261_BASE_TCB0,
1023 + .end = AT91SAM9261_BASE_TCB0 + SZ_16K - 1,
1024 + .flags = IORESOURCE_MEM,
1025 + },
1026 + [1] = {
1027 + .start = AT91SAM9261_ID_TC0,
1028 + .end = AT91SAM9261_ID_TC0,
1029 + .flags = IORESOURCE_IRQ,
1030 + },
1031 + [2] = {
1032 + .start = AT91SAM9261_ID_TC1,
1033 + .end = AT91SAM9261_ID_TC1,
1034 + .flags = IORESOURCE_IRQ,
1035 + },
1036 + [3] = {
1037 + .start = AT91SAM9261_ID_TC2,
1038 + .end = AT91SAM9261_ID_TC2,
1039 + .flags = IORESOURCE_IRQ,
1040 + },
1041 +};
1042 +
1043 +static struct platform_device at91sam9261_tcb_device = {
1044 + .name = "atmel_tcb",
1045 + .id = 0,
1046 + .resource = tcb_resources,
1047 + .num_resources = ARRAY_SIZE(tcb_resources),
1048 +};
1049 +
1050 +static void __init at91_add_device_tc(void)
1051 +{
1052 + /* this chip has a separate clock and irq for each TC channel */
1053 + at91_clock_associate("tc0_clk", &at91sam9261_tcb_device.dev, "t0_clk");
1054 + at91_clock_associate("tc1_clk", &at91sam9261_tcb_device.dev, "t1_clk");
1055 + at91_clock_associate("tc2_clk", &at91sam9261_tcb_device.dev, "t2_clk");
1056 + platform_device_register(&at91sam9261_tcb_device);
1057 +}
1058 +#else
1059 +static void __init at91_add_device_tc(void) { }
1060 +#endif
1061 +
1062 +
1063 +/* --------------------------------------------------------------------
1064 * RTT
1065 * -------------------------------------------------------------------- */
1066
1067 @@ -561,13 +610,14 @@
1068
1069 static struct platform_device at91sam9261_rtt_device = {
1070 .name = "at91_rtt",
1071 - .id = -1,
1072 + .id = 0,
1073 .resource = rtt_resources,
1074 .num_resources = ARRAY_SIZE(rtt_resources),
1075 };
1076
1077 static void __init at91_add_device_rtt(void)
1078 {
1079 + device_init_wakeup(&at91sam9261_rtt_device.dev, 1);
1080 platform_device_register(&at91sam9261_rtt_device);
1081 }
1082
1083 @@ -938,7 +988,7 @@
1084 at91_set_B_periph(AT91_PIN_PA16, 0); /* CTS2 */
1085 }
1086
1087 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1088 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1089 struct platform_device *atmel_default_console_device; /* the serial console device */
1090
1091 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
1092 @@ -1019,8 +1069,6 @@
1093 {
1094 if (portnr < ATMEL_MAX_UART)
1095 atmel_default_console_device = at91_uarts[portnr];
1096 - if (!atmel_default_console_device)
1097 - printk(KERN_INFO "AT91: No default serial console defined.\n");
1098 }
1099
1100 void __init at91_add_device_serial(void)
1101 @@ -1031,6 +1079,9 @@
1102 if (at91_uarts[i])
1103 platform_device_register(at91_uarts[i]);
1104 }
1105 +
1106 + if (!atmel_default_console_device)
1107 + printk(KERN_INFO "AT91: No default serial console defined.\n");
1108 }
1109 #else
1110 void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1111 @@ -1050,6 +1101,7 @@
1112 {
1113 at91_add_device_rtt();
1114 at91_add_device_watchdog();
1115 + at91_add_device_tc();
1116 return 0;
1117 }
1118
1119 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9263.c linux-2.6/arch/arm/mach-at91/at91sam9263.c
1120 --- linux-2.6.25/arch/arm/mach-at91/at91sam9263.c 2008-05-03 00:15:44.000000000 +0200
1121 +++ linux-2.6/arch/arm/mach-at91/at91sam9263.c 2008-04-25 21:15:43.000000000 +0200
1122 @@ -11,12 +11,14 @@
1123 */
1124
1125 #include <linux/module.h>
1126 +#include <linux/pm.h>
1127
1128 #include <asm/mach/arch.h>
1129 #include <asm/mach/map.h>
1130 #include <asm/arch/at91sam9263.h>
1131 #include <asm/arch/at91_pmc.h>
1132 #include <asm/arch/at91_rstc.h>
1133 +#include <asm/arch/at91_shdwc.h>
1134
1135 #include "generic.h"
1136 #include "clock.h"
1137 @@ -271,6 +273,11 @@
1138 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
1139 }
1140
1141 +static void at91sam9263_poweroff(void)
1142 +{
1143 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
1144 +}
1145 +
1146
1147 /* --------------------------------------------------------------------
1148 * AT91SAM9263 processor initialization
1149 @@ -282,6 +289,7 @@
1150 iotable_init(at91sam9263_io_desc, ARRAY_SIZE(at91sam9263_io_desc));
1151
1152 at91_arch_reset = at91sam9263_reset;
1153 + pm_power_off = at91sam9263_poweroff;
1154 at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
1155
1156 /* Init clock subsystem */
1157 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9263_devices.c linux-2.6/arch/arm/mach-at91/at91sam9263_devices.c
1158 --- linux-2.6.25/arch/arm/mach-at91/at91sam9263_devices.c 2008-05-03 00:15:44.000000000 +0200
1159 +++ linux-2.6/arch/arm/mach-at91/at91sam9263_devices.c 2008-04-25 21:16:23.000000000 +0200
1160 @@ -22,8 +22,8 @@
1161 #include <asm/arch/board.h>
1162 #include <asm/arch/gpio.h>
1163 #include <asm/arch/at91sam9263.h>
1164 -#include <asm/arch/at91sam926x_mc.h>
1165 #include <asm/arch/at91sam9263_matrix.h>
1166 +#include <asm/arch/at91sam9_smc.h>
1167
1168 #include "generic.h"
1169
1170 @@ -308,7 +308,7 @@
1171 }
1172
1173 mmc0_data = *data;
1174 - at91_clock_associate("mci0_clk", &at91sam9263_mmc1_device.dev, "mci_clk");
1175 + at91_clock_associate("mci0_clk", &at91sam9263_mmc0_device.dev, "mci_clk");
1176 platform_device_register(&at91sam9263_mmc0_device);
1177 } else { /* MCI1 */
1178 /* CLK */
1179 @@ -358,10 +358,15 @@
1180 #define NAND_BASE AT91_CHIPSELECT_3
1181
1182 static struct resource nand_resources[] = {
1183 - {
1184 + [0] = {
1185 .start = NAND_BASE,
1186 .end = NAND_BASE + SZ_256M - 1,
1187 .flags = IORESOURCE_MEM,
1188 + },
1189 + [1] = {
1190 + .start = AT91_BASE_SYS + AT91_ECC0,
1191 + .end = AT91_BASE_SYS + AT91_ECC0 + SZ_512 - 1,
1192 + .flags = IORESOURCE_MEM,
1193 }
1194 };
1195
1196 @@ -783,6 +788,43 @@
1197
1198
1199 /* --------------------------------------------------------------------
1200 + * Timer/Counter block
1201 + * -------------------------------------------------------------------- */
1202 +
1203 +#ifdef CONFIG_ATMEL_TCLIB
1204 +
1205 +static struct resource tcb_resources[] = {
1206 + [0] = {
1207 + .start = AT91SAM9263_BASE_TCB0,
1208 + .end = AT91SAM9263_BASE_TCB0 + SZ_16K - 1,
1209 + .flags = IORESOURCE_MEM,
1210 + },
1211 + [1] = {
1212 + .start = AT91SAM9263_ID_TCB,
1213 + .end = AT91SAM9263_ID_TCB,
1214 + .flags = IORESOURCE_IRQ,
1215 + },
1216 +};
1217 +
1218 +static struct platform_device at91sam9263_tcb_device = {
1219 + .name = "atmel_tcb",
1220 + .id = 0,
1221 + .resource = tcb_resources,
1222 + .num_resources = ARRAY_SIZE(tcb_resources),
1223 +};
1224 +
1225 +static void __init at91_add_device_tc(void)
1226 +{
1227 + /* this chip has one clock and irq for all three TC channels */
1228 + at91_clock_associate("tcb_clk", &at91sam9263_tcb_device.dev, "t0_clk");
1229 + platform_device_register(&at91sam9263_tcb_device);
1230 +}
1231 +#else
1232 +static void __init at91_add_device_tc(void) { }
1233 +#endif
1234 +
1235 +
1236 +/* --------------------------------------------------------------------
1237 * RTT
1238 * -------------------------------------------------------------------- */
1239
1240 @@ -818,7 +860,9 @@
1241
1242 static void __init at91_add_device_rtt(void)
1243 {
1244 + device_init_wakeup(&at91sam9263_rtt0_device.dev, 1);
1245 platform_device_register(&at91sam9263_rtt0_device);
1246 + device_init_wakeup(&at91sam9263_rtt1_device.dev, 1);
1247 platform_device_register(&at91sam9263_rtt1_device);
1248 }
1249
1250 @@ -933,9 +977,6 @@
1251 }
1252
1253 /*
1254 - * Return the device node so that board init code can use it as the
1255 - * parent for the device node reflecting how it's used on this board.
1256 - *
1257 * SSC controllers are accessed through library code, instead of any
1258 * kind of all-singing/all-dancing driver. For example one could be
1259 * used by a particular I2S audio codec's driver, while another one
1260 @@ -1146,7 +1187,7 @@
1261 at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */
1262 }
1263
1264 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1265 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1266 struct platform_device *atmel_default_console_device; /* the serial console device */
1267
1268 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
1269 @@ -1227,8 +1268,6 @@
1270 {
1271 if (portnr < ATMEL_MAX_UART)
1272 atmel_default_console_device = at91_uarts[portnr];
1273 - if (!atmel_default_console_device)
1274 - printk(KERN_INFO "AT91: No default serial console defined.\n");
1275 }
1276
1277 void __init at91_add_device_serial(void)
1278 @@ -1239,9 +1278,12 @@
1279 if (at91_uarts[i])
1280 platform_device_register(at91_uarts[i]);
1281 }
1282 +
1283 + if (!atmel_default_console_device)
1284 + printk(KERN_INFO "AT91: No default serial console defined.\n");
1285 }
1286 #else
1287 -void __init at91_init_serial(struct at91_uart_config *config) {}
1288 +void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1289 void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1290 void __init at91_set_serial_console(unsigned portnr) {}
1291 void __init at91_add_device_serial(void) {}
1292 @@ -1257,6 +1299,7 @@
1293 {
1294 at91_add_device_rtt();
1295 at91_add_device_watchdog();
1296 + at91_add_device_tc();
1297 return 0;
1298 }
1299
1300 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam926x_time.c linux-2.6/arch/arm/mach-at91/at91sam926x_time.c
1301 --- linux-2.6.25/arch/arm/mach-at91/at91sam926x_time.c 2008-05-03 00:15:44.000000000 +0200
1302 +++ linux-2.6/arch/arm/mach-at91/at91sam926x_time.c 2008-04-25 21:15:43.000000000 +0200
1303 @@ -1,23 +1,20 @@
1304 /*
1305 - * linux/arch/arm/mach-at91/at91sam926x_time.c
1306 + * at91sam926x_time.c - Periodic Interval Timer (PIT) for at91sam926x
1307 *
1308 * Copyright (C) 2005-2006 M. Amine SAYA, ATMEL Rousset, France
1309 * Revision 2005 M. Nicolas Diremdjian, ATMEL Rousset, France
1310 + * Converted to ClockSource/ClockEvents by David Brownell.
1311 *
1312 * This program is free software; you can redistribute it and/or modify
1313 * it under the terms of the GNU General Public License version 2 as
1314 * published by the Free Software Foundation.
1315 */
1316 -
1317 -#include <linux/init.h>
1318 #include <linux/interrupt.h>
1319 #include <linux/irq.h>
1320 #include <linux/kernel.h>
1321 -#include <linux/sched.h>
1322 -#include <linux/time.h>
1323 +#include <linux/clk.h>
1324 +#include <linux/clockchips.h>
1325
1326 -#include <asm/hardware.h>
1327 -#include <asm/io.h>
1328 #include <asm/mach/time.h>
1329
1330 #include <asm/arch/at91_pit.h>
1331 @@ -26,85 +23,167 @@
1332 #define PIT_CPIV(x) ((x) & AT91_PIT_CPIV)
1333 #define PIT_PICNT(x) (((x) & AT91_PIT_PICNT) >> 20)
1334
1335 +static u32 pit_cycle; /* write-once */
1336 +static u32 pit_cnt; /* access only w/system irq blocked */
1337 +
1338 +
1339 /*
1340 - * Returns number of microseconds since last timer interrupt. Note that interrupts
1341 - * will have been disabled by do_gettimeofday()
1342 - * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
1343 + * Clocksource: just a monotonic counter of MCK/16 cycles.
1344 + * We don't care whether or not PIT irqs are enabled.
1345 */
1346 -static unsigned long at91sam926x_gettimeoffset(void)
1347 +static cycle_t read_pit_clk(void)
1348 {
1349 - unsigned long elapsed;
1350 - unsigned long t = at91_sys_read(AT91_PIT_PIIR);
1351 + unsigned long flags;
1352 + u32 elapsed;
1353 + u32 t;
1354 +
1355 + raw_local_irq_save(flags);
1356 + elapsed = pit_cnt;
1357 + t = at91_sys_read(AT91_PIT_PIIR);
1358 + raw_local_irq_restore(flags);
1359 +
1360 + elapsed += PIT_PICNT(t) * pit_cycle;
1361 + elapsed += PIT_CPIV(t);
1362 + return elapsed;
1363 +}
1364 +
1365 +static struct clocksource pit_clk = {
1366 + .name = "pit",
1367 + .rating = 175,
1368 + .read = read_pit_clk,
1369 + .shift = 20,
1370 + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
1371 +};
1372 +
1373
1374 - elapsed = (PIT_PICNT(t) * LATCH) + PIT_CPIV(t); /* hardware clock cycles */
1375 +/*
1376 + * Clockevent device: interrupts every 1/HZ (== pit_cycles * MCK/16)
1377 + */
1378 +static void
1379 +pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
1380 +{
1381 + unsigned long flags;
1382
1383 - return (unsigned long)(elapsed * jiffies_to_usecs(1)) / LATCH;
1384 + switch (mode) {
1385 + case CLOCK_EVT_MODE_PERIODIC:
1386 + /* update clocksource counter, then enable the IRQ */
1387 + raw_local_irq_save(flags);
1388 + pit_cnt += pit_cycle * PIT_PICNT(at91_sys_read(AT91_PIT_PIVR));
1389 + at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN
1390 + | AT91_PIT_PITIEN);
1391 + raw_local_irq_restore(flags);
1392 + break;
1393 + case CLOCK_EVT_MODE_ONESHOT:
1394 + BUG();
1395 + /* FALLTHROUGH */
1396 + case CLOCK_EVT_MODE_SHUTDOWN:
1397 + case CLOCK_EVT_MODE_UNUSED:
1398 + /* disable irq, leaving the clocksource active */
1399 + at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
1400 + break;
1401 + case CLOCK_EVT_MODE_RESUME:
1402 + break;
1403 + }
1404 }
1405
1406 +static struct clock_event_device pit_clkevt = {
1407 + .name = "pit",
1408 + .features = CLOCK_EVT_FEAT_PERIODIC,
1409 + .shift = 32,
1410 + .rating = 100,
1411 + .cpumask = CPU_MASK_CPU0,
1412 + .set_mode = pit_clkevt_mode,
1413 +};
1414 +
1415 +
1416 /*
1417 * IRQ handler for the timer.
1418 */
1419 -static irqreturn_t at91sam926x_timer_interrupt(int irq, void *dev_id)
1420 +static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
1421 {
1422 - volatile long nr_ticks;
1423
1424 - if (at91_sys_read(AT91_PIT_SR) & AT91_PIT_PITS) { /* This is a shared interrupt */
1425 - /* Get number to ticks performed before interrupt and clear PIT interrupt */
1426 + /* The PIT interrupt may be disabled, and is shared */
1427 + if ((pit_clkevt.mode == CLOCK_EVT_MODE_PERIODIC)
1428 + && (at91_sys_read(AT91_PIT_SR) & AT91_PIT_PITS)) {
1429 + unsigned nr_ticks;
1430 +
1431 + /* Get number of ticks performed before irq, and ack it */
1432 nr_ticks = PIT_PICNT(at91_sys_read(AT91_PIT_PIVR));
1433 do {
1434 - timer_tick();
1435 + pit_cnt += pit_cycle;
1436 + pit_clkevt.event_handler(&pit_clkevt);
1437 nr_ticks--;
1438 } while (nr_ticks);
1439
1440 return IRQ_HANDLED;
1441 - } else
1442 - return IRQ_NONE; /* not handled */
1443 + }
1444 +
1445 + return IRQ_NONE;
1446 }
1447
1448 -static struct irqaction at91sam926x_timer_irq = {
1449 +static struct irqaction at91sam926x_pit_irq = {
1450 .name = "at91_tick",
1451 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
1452 - .handler = at91sam926x_timer_interrupt
1453 + .handler = at91sam926x_pit_interrupt
1454 };
1455
1456 -void at91sam926x_timer_reset(void)
1457 +static void at91sam926x_pit_reset(void)
1458 {
1459 - /* Disable timer */
1460 + /* Disable timer and irqs */
1461 at91_sys_write(AT91_PIT_MR, 0);
1462
1463 - /* Clear any pending interrupts */
1464 - (void) at91_sys_read(AT91_PIT_PIVR);
1465 + /* Clear any pending interrupts, wait for PIT to stop counting */
1466 + while (PIT_CPIV(at91_sys_read(AT91_PIT_PIVR)) != 0)
1467 + cpu_relax();
1468
1469 - /* Set Period Interval timer and enable its interrupt */
1470 - at91_sys_write(AT91_PIT_MR, (LATCH & AT91_PIT_PIV) | AT91_PIT_PITIEN | AT91_PIT_PITEN);
1471 + /* Start PIT but don't enable IRQ */
1472 + at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
1473 }
1474
1475 /*
1476 - * Set up timer interrupt.
1477 + * Set up both clocksource and clockevent support.
1478 */
1479 -void __init at91sam926x_timer_init(void)
1480 +static void __init at91sam926x_pit_init(void)
1481 {
1482 + unsigned long pit_rate;
1483 + unsigned bits;
1484 +
1485 + /*
1486 + * Use our actual MCK to figure out how many MCK/16 ticks per
1487 + * 1/HZ period (instead of a compile-time constant LATCH).
1488 + */
1489 + pit_rate = clk_get_rate(clk_get(NULL, "mck")) / 16;
1490 + pit_cycle = (pit_rate + HZ/2) / HZ;
1491 + WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0);
1492 +
1493 /* Initialize and enable the timer */
1494 - at91sam926x_timer_reset();
1495 + at91sam926x_pit_reset();
1496
1497 - /* Make IRQs happen for the system timer. */
1498 - setup_irq(AT91_ID_SYS, &at91sam926x_timer_irq);
1499 + /*
1500 + * Register clocksource. The high order bits of PIV are unused,
1501 + * so this isn't a 32-bit counter unless we get clockevent irqs.
1502 + */
1503 + pit_clk.mult = clocksource_hz2mult(pit_rate, pit_clk.shift);
1504 + bits = 12 /* PICNT */ + ilog2(pit_cycle) /* PIV */;
1505 + pit_clk.mask = CLOCKSOURCE_MASK(bits);
1506 + clocksource_register(&pit_clk);
1507 +
1508 + /* Set up irq handler */
1509 + setup_irq(AT91_ID_SYS, &at91sam926x_pit_irq);
1510 +
1511 + /* Set up and register clockevents */
1512 + pit_clkevt.mult = div_sc(pit_rate, NSEC_PER_SEC, pit_clkevt.shift);
1513 + clockevents_register_device(&pit_clkevt);
1514 }
1515
1516 -#ifdef CONFIG_PM
1517 -static void at91sam926x_timer_suspend(void)
1518 +static void at91sam926x_pit_suspend(void)
1519 {
1520 /* Disable timer */
1521 at91_sys_write(AT91_PIT_MR, 0);
1522 }
1523 -#else
1524 -#define at91sam926x_timer_suspend NULL
1525 -#endif
1526
1527 struct sys_timer at91sam926x_timer = {
1528 - .init = at91sam926x_timer_init,
1529 - .offset = at91sam926x_gettimeoffset,
1530 - .suspend = at91sam926x_timer_suspend,
1531 - .resume = at91sam926x_timer_reset,
1532 + .init = at91sam926x_pit_init,
1533 + .suspend = at91sam926x_pit_suspend,
1534 + .resume = at91sam926x_pit_reset,
1535 };
1536 -
1537 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9rl.c linux-2.6/arch/arm/mach-at91/at91sam9rl.c
1538 --- linux-2.6.25/arch/arm/mach-at91/at91sam9rl.c 2007-10-09 22:31:38.000000000 +0200
1539 +++ linux-2.6/arch/arm/mach-at91/at91sam9rl.c 2008-04-25 21:15:43.000000000 +0200
1540 @@ -10,6 +10,7 @@
1541 */
1542
1543 #include <linux/module.h>
1544 +#include <linux/pm.h>
1545
1546 #include <asm/mach/arch.h>
1547 #include <asm/mach/map.h>
1548 @@ -17,6 +18,7 @@
1549 #include <asm/arch/at91sam9rl.h>
1550 #include <asm/arch/at91_pmc.h>
1551 #include <asm/arch/at91_rstc.h>
1552 +#include <asm/arch/at91_shdwc.h>
1553
1554 #include "generic.h"
1555 #include "clock.h"
1556 @@ -244,6 +246,11 @@
1557 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
1558 }
1559
1560 +static void at91sam9rl_poweroff(void)
1561 +{
1562 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
1563 +}
1564 +
1565
1566 /* --------------------------------------------------------------------
1567 * AT91SAM9RL processor initialization
1568 @@ -274,6 +281,7 @@
1569 iotable_init(at91sam9rl_sram_desc, ARRAY_SIZE(at91sam9rl_sram_desc));
1570
1571 at91_arch_reset = at91sam9rl_reset;
1572 + pm_power_off = at91sam9rl_poweroff;
1573 at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
1574
1575 /* Init clock subsystem */
1576 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9rl_devices.c linux-2.6/arch/arm/mach-at91/at91sam9rl_devices.c
1577 --- linux-2.6.25/arch/arm/mach-at91/at91sam9rl_devices.c 2008-05-03 00:15:44.000000000 +0200
1578 +++ linux-2.6/arch/arm/mach-at91/at91sam9rl_devices.c 2008-05-02 00:52:36.000000000 +0200
1579 @@ -20,12 +20,107 @@
1580 #include <asm/arch/gpio.h>
1581 #include <asm/arch/at91sam9rl.h>
1582 #include <asm/arch/at91sam9rl_matrix.h>
1583 -#include <asm/arch/at91sam926x_mc.h>
1584 +#include <asm/arch/at91sam9_smc.h>
1585
1586 #include "generic.h"
1587
1588
1589 /* --------------------------------------------------------------------
1590 + * USB HS Device (Gadget)
1591 + * -------------------------------------------------------------------- */
1592 +
1593 +#if defined(CONFIG_USB_GADGET_ATMEL_USBA) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE)
1594 +
1595 +static struct resource usba_udc_resources[] = {
1596 + [0] = {
1597 + .start = AT91SAM9RL_UDPHS_FIFO,
1598 + .end = AT91SAM9RL_UDPHS_FIFO + SZ_512K - 1,
1599 + .flags = IORESOURCE_MEM,
1600 + },
1601 + [1] = {
1602 + .start = AT91SAM9RL_BASE_UDPHS,
1603 + .end = AT91SAM9RL_BASE_UDPHS + SZ_1K - 1,
1604 + .flags = IORESOURCE_MEM,
1605 + },
1606 + [2] = {
1607 + .start = AT91SAM9RL_ID_UDPHS,
1608 + .end = AT91SAM9RL_ID_UDPHS,
1609 + .flags = IORESOURCE_IRQ,
1610 + },
1611 +};
1612 +
1613 +#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
1614 + [idx] = { \
1615 + .name = nam, \
1616 + .index = idx, \
1617 + .fifo_size = maxpkt, \
1618 + .nr_banks = maxbk, \
1619 + .can_dma = dma, \
1620 + .can_isoc = isoc, \
1621 + }
1622 +
1623 +static struct usba_ep_data usba_udc_ep[] __initdata = {
1624 + EP("ep0", 0, 64, 1, 0, 0),
1625 + EP("ep1", 1, 1024, 2, 1, 1),
1626 + EP("ep2", 2, 1024, 2, 1, 1),
1627 + EP("ep3", 3, 1024, 3, 1, 0),
1628 + EP("ep4", 4, 1024, 3, 1, 0),
1629 + EP("ep5", 5, 1024, 3, 1, 1),
1630 + EP("ep6", 6, 1024, 3, 1, 1),
1631 +};
1632 +
1633 +#undef EP
1634 +
1635 +/*
1636 + * pdata doesn't have room for any endpoints, so we need to
1637 + * append room for the ones we need right after it.
1638 + */
1639 +static struct {
1640 + struct usba_platform_data pdata;
1641 + struct usba_ep_data ep[7];
1642 +} usba_udc_data;
1643 +
1644 +static struct platform_device at91_usba_udc_device = {
1645 + .name = "atmel_usba_udc",
1646 + .id = -1,
1647 + .dev = {
1648 + .platform_data = &usba_udc_data.pdata,
1649 + },
1650 + .resource = usba_udc_resources,
1651 + .num_resources = ARRAY_SIZE(usba_udc_resources),
1652 +};
1653 +
1654 +void __init at91_add_device_usba(struct usba_platform_data *data)
1655 +{
1656 + /*
1657 + * Invalid pins are 0 on AT91, but the usba driver is shared
1658 + * with AVR32, which use negative values instead. Once/if
1659 + * gpio_is_valid() is ported to AT91, revisit this code.
1660 + */
1661 + usba_udc_data.pdata.vbus_pin = -EINVAL;
1662 + usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
1663 + memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));;
1664 +
1665 + if (data && data->vbus_pin > 0) {
1666 + at91_set_gpio_input(data->vbus_pin, 0);
1667 + at91_set_deglitch(data->vbus_pin, 1);
1668 + usba_udc_data.pdata.vbus_pin = data->vbus_pin;
1669 + }
1670 +
1671 + /* Pullup pin is handled internally by USB device peripheral */
1672 +
1673 + /* Clocks */
1674 + at91_clock_associate("utmi_clk", &at91_usba_udc_device.dev, "hclk");
1675 + at91_clock_associate("udphs_clk", &at91_usba_udc_device.dev, "pclk");
1676 +
1677 + platform_device_register(&at91_usba_udc_device);
1678 +}
1679 +#else
1680 +void __init at91_add_device_usba(struct usba_platform_data *data) {}
1681 +#endif
1682 +
1683 +
1684 +/* --------------------------------------------------------------------
1685 * MMC / SD
1686 * -------------------------------------------------------------------- */
1687
1688 @@ -105,10 +200,15 @@
1689 #define NAND_BASE AT91_CHIPSELECT_3
1690
1691 static struct resource nand_resources[] = {
1692 - {
1693 + [0] = {
1694 .start = NAND_BASE,
1695 .end = NAND_BASE + SZ_256M - 1,
1696 .flags = IORESOURCE_MEM,
1697 + },
1698 + [1] = {
1699 + .start = AT91_BASE_SYS + AT91_ECC,
1700 + .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1,
1701 + .flags = IORESOURCE_MEM,
1702 }
1703 };
1704
1705 @@ -385,6 +485,100 @@
1706
1707
1708 /* --------------------------------------------------------------------
1709 + * Timer/Counter block
1710 + * -------------------------------------------------------------------- */
1711 +
1712 +#ifdef CONFIG_ATMEL_TCLIB
1713 +
1714 +static struct resource tcb_resources[] = {
1715 + [0] = {
1716 + .start = AT91SAM9RL_BASE_TCB0,
1717 + .end = AT91SAM9RL_BASE_TCB0 + SZ_16K - 1,
1718 + .flags = IORESOURCE_MEM,
1719 + },
1720 + [1] = {
1721 + .start = AT91SAM9RL_ID_TC0,
1722 + .end = AT91SAM9RL_ID_TC0,
1723 + .flags = IORESOURCE_IRQ,
1724 + },
1725 + [2] = {
1726 + .start = AT91SAM9RL_ID_TC1,
1727 + .end = AT91SAM9RL_ID_TC1,
1728 + .flags = IORESOURCE_IRQ,
1729 + },
1730 + [3] = {
1731 + .start = AT91SAM9RL_ID_TC2,
1732 + .end = AT91SAM9RL_ID_TC2,
1733 + .flags = IORESOURCE_IRQ,
1734 + },
1735 +};
1736 +
1737 +static struct platform_device at91sam9rl_tcb_device = {
1738 + .name = "atmel_tcb",
1739 + .id = 0,
1740 + .resource = tcb_resources,
1741 + .num_resources = ARRAY_SIZE(tcb_resources),
1742 +};
1743 +
1744 +static void __init at91_add_device_tc(void)
1745 +{
1746 + /* this chip has a separate clock and irq for each TC channel */
1747 + at91_clock_associate("tc0_clk", &at91sam9rl_tcb_device.dev, "t0_clk");
1748 + at91_clock_associate("tc1_clk", &at91sam9rl_tcb_device.dev, "t1_clk");
1749 + at91_clock_associate("tc2_clk", &at91sam9rl_tcb_device.dev, "t2_clk");
1750 + platform_device_register(&at91sam9rl_tcb_device);
1751 +}
1752 +#else
1753 +static void __init at91_add_device_tc(void) { }
1754 +#endif
1755 +
1756 +
1757 +/* --------------------------------------------------------------------
1758 + * Touchscreen
1759 + * -------------------------------------------------------------------- */
1760 +
1761 +#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
1762 +static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
1763 +
1764 +static struct resource tsadcc_resources[] = {
1765 + [0] = {
1766 + .start = AT91SAM9RL_BASE_TSC,
1767 + .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
1768 + .flags = IORESOURCE_MEM,
1769 + },
1770 + [1] = {
1771 + .start = AT91SAM9RL_ID_TSC,
1772 + .end = AT91SAM9RL_ID_TSC,
1773 + .flags = IORESOURCE_IRQ,
1774 + }
1775 +};
1776 +
1777 +static struct platform_device at91_tsadcc_device = {
1778 + .name = "atmel_tsadcc",
1779 + .id = -1,
1780 + .dev = {
1781 + .dma_mask = &tsadcc_dmamask,
1782 + .coherent_dma_mask = DMA_BIT_MASK(32),
1783 + },
1784 + .resource = tsadcc_resources,
1785 + .num_resources = ARRAY_SIZE(tsadcc_resources),
1786 +};
1787 +
1788 +void __init at91_add_device_tsadcc(void)
1789 +{
1790 + at91_set_A_periph(AT91_PIN_PA17, 0); /* AD0_XR */
1791 + at91_set_A_periph(AT91_PIN_PA18, 0); /* AD1_XL */
1792 + at91_set_A_periph(AT91_PIN_PA19, 0); /* AD2_YT */
1793 + at91_set_A_periph(AT91_PIN_PA20, 0); /* AD3_TB */
1794 +
1795 + platform_device_register(&at91_tsadcc_device);
1796 +}
1797 +#else
1798 +void __init at91_add_device_tsadcc(void) {}
1799 +#endif
1800 +
1801 +
1802 +/* --------------------------------------------------------------------
1803 * RTC
1804 * -------------------------------------------------------------------- */
1805
1806 @@ -397,6 +591,7 @@
1807
1808 static void __init at91_add_device_rtc(void)
1809 {
1810 + device_init_wakeup(&at91sam9rl_rtc_device.dev, 1);
1811 platform_device_register(&at91sam9rl_rtc_device);
1812 }
1813 #else
1814 @@ -418,13 +613,14 @@
1815
1816 static struct platform_device at91sam9rl_rtt_device = {
1817 .name = "at91_rtt",
1818 - .id = -1,
1819 + .id = 0,
1820 .resource = rtt_resources,
1821 .num_resources = ARRAY_SIZE(rtt_resources),
1822 };
1823
1824 static void __init at91_add_device_rtt(void)
1825 {
1826 + device_init_wakeup(&at91sam9rl_rtt_device.dev, 1);
1827 platform_device_register(&at91sam9rl_rtt_device);
1828 }
1829
1830 @@ -539,9 +735,6 @@
1831 }
1832
1833 /*
1834 - * Return the device node so that board init code can use it as the
1835 - * parent for the device node reflecting how it's used on this board.
1836 - *
1837 * SSC controllers are accessed through library code, instead of any
1838 * kind of all-singing/all-dancing driver. For example one could be
1839 * used by a particular I2S audio codec's driver, while another one
1840 @@ -802,7 +995,7 @@
1841 at91_set_B_periph(AT91_PIN_PD3, 0); /* CTS3 */
1842 }
1843
1844 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1845 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1846 struct platform_device *atmel_default_console_device; /* the serial console device */
1847
1848 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
1849 @@ -893,8 +1086,6 @@
1850 {
1851 if (portnr < ATMEL_MAX_UART)
1852 atmel_default_console_device = at91_uarts[portnr];
1853 - if (!atmel_default_console_device)
1854 - printk(KERN_INFO "AT91: No default serial console defined.\n");
1855 }
1856
1857 void __init at91_add_device_serial(void)
1858 @@ -905,6 +1096,9 @@
1859 if (at91_uarts[i])
1860 platform_device_register(at91_uarts[i]);
1861 }
1862 +
1863 + if (!atmel_default_console_device)
1864 + printk(KERN_INFO "AT91: No default serial console defined.\n");
1865 }
1866 #else
1867 void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1868 @@ -925,6 +1119,7 @@
1869 at91_add_device_rtc();
1870 at91_add_device_rtt();
1871 at91_add_device_watchdog();
1872 + at91_add_device_tc();
1873 return 0;
1874 }
1875
1876 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-cam60.c linux-2.6/arch/arm/mach-at91/board-cam60.c
1877 --- linux-2.6.25/arch/arm/mach-at91/board-cam60.c 1970-01-01 02:00:00.000000000 +0200
1878 +++ linux-2.6/arch/arm/mach-at91/board-cam60.c 2008-04-25 21:15:43.000000000 +0200
1879 @@ -0,0 +1,180 @@
1880 +/*
1881 + * KwikByte CAM60 (KB9260)
1882 + *
1883 + * based on board-sam9260ek.c
1884 + * Copyright (C) 2005 SAN People
1885 + * Copyright (C) 2006 Atmel
1886 + *
1887 + * This program is free software; you can redistribute it and/or modify
1888 + * it under the terms of the GNU General Public License as published by
1889 + * the Free Software Foundation; either version 2 of the License, or
1890 + * (at your option) any later version.
1891 + *
1892 + * This program is distributed in the hope that it will be useful,
1893 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1894 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1895 + * GNU General Public License for more details.
1896 + *
1897 + * You should have received a copy of the GNU General Public License
1898 + * along with this program; if not, write to the Free Software
1899 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1900 + */
1901 +
1902 +#include <linux/types.h>
1903 +#include <linux/init.h>
1904 +#include <linux/mm.h>
1905 +#include <linux/module.h>
1906 +#include <linux/platform_device.h>
1907 +#include <linux/spi/spi.h>
1908 +#include <linux/spi/flash.h>
1909 +
1910 +#include <asm/hardware.h>
1911 +#include <asm/setup.h>
1912 +#include <asm/mach-types.h>
1913 +#include <asm/irq.h>
1914 +
1915 +#include <asm/mach/arch.h>
1916 +#include <asm/mach/map.h>
1917 +#include <asm/mach/irq.h>
1918 +
1919 +#include <asm/arch/board.h>
1920 +#include <asm/arch/gpio.h>
1921 +
1922 +#include "generic.h"
1923 +
1924 +
1925 +static void __init cam60_map_io(void)
1926 +{
1927 + /* Initialize processor: 10 MHz crystal */
1928 + at91sam9260_initialize(10000000);
1929 +
1930 + /* DGBU on ttyS0. (Rx & Tx only) */
1931 + at91_register_uart(0, 0, 0);
1932 +
1933 + /* set serial console to ttyS0 (ie, DBGU) */
1934 + at91_set_serial_console(0);
1935 +}
1936 +
1937 +static void __init cam60_init_irq(void)
1938 +{
1939 + at91sam9260_init_interrupts(NULL);
1940 +}
1941 +
1942 +
1943 +/*
1944 + * USB Host
1945 + */
1946 +static struct at91_usbh_data __initdata cam60_usbh_data = {
1947 + .ports = 1,
1948 +};
1949 +
1950 +
1951 +/*
1952 + * SPI devices.
1953 + */
1954 +#if defined(CONFIG_MTD_DATAFLASH)
1955 +static struct mtd_partition __initdata cam60_spi_partitions[] = {
1956 + {
1957 + .name = "BOOT1",
1958 + .offset = 0,
1959 + .size = 4 * 1056,
1960 + },
1961 + {
1962 + .name = "BOOT2",
1963 + .offset = MTDPART_OFS_NXTBLK,
1964 + .size = 256 * 1056,
1965 + },
1966 + {
1967 + .name = "kernel",
1968 + .offset = MTDPART_OFS_NXTBLK,
1969 + .size = 2222 * 1056,
1970 + },
1971 + {
1972 + .name = "file system",
1973 + .offset = MTDPART_OFS_NXTBLK,
1974 + .size = MTDPART_SIZ_FULL,
1975 + },
1976 +};
1977 +
1978 +static struct flash_platform_data __initdata cam60_spi_flash_platform_data = {
1979 + .name = "spi_flash",
1980 + .parts = cam60_spi_partitions,
1981 + .nr_parts = ARRAY_SIZE(cam60_spi_partitions)
1982 +};
1983 +#endif
1984 +
1985 +static struct spi_board_info cam60_spi_devices[] = {
1986 +#if defined(CONFIG_MTD_DATAFLASH)
1987 + { /* DataFlash chip */
1988 + .modalias = "mtd_dataflash",
1989 + .chip_select = 0,
1990 + .max_speed_hz = 15 * 1000 * 1000,
1991 + .bus_num = 0,
1992 + .platform_data = &cam60_spi_flash_platform_data
1993 + },
1994 +#endif
1995 +};
1996 +
1997 +
1998 +/*
1999 + * MACB Ethernet device
2000 + */
2001 +static struct __initdata at91_eth_data cam60_macb_data = {
2002 + .phy_irq_pin = AT91_PIN_PB5,
2003 + .is_rmii = 0,
2004 +};
2005 +
2006 +
2007 +/*
2008 + * NAND Flash
2009 + */
2010 +static struct mtd_partition __initdata cam60_nand_partition[] = {
2011 + {
2012 + .name = "nand_fs",
2013 + .offset = 0,
2014 + .size = MTDPART_SIZ_FULL,
2015 + },
2016 +};
2017 +
2018 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
2019 +{
2020 + *num_partitions = ARRAY_SIZE(cam60_nand_partition);
2021 + return cam60_nand_partition;
2022 +}
2023 +
2024 +static struct at91_nand_data __initdata cam60_nand_data = {
2025 + .ale = 21,
2026 + .cle = 22,
2027 + // .det_pin = ... not there
2028 + .rdy_pin = AT91_PIN_PA9,
2029 + .enable_pin = AT91_PIN_PA7,
2030 + .partition_info = nand_partitions,
2031 +};
2032 +
2033 +
2034 +static void __init cam60_board_init(void)
2035 +{
2036 + /* Serial */
2037 + at91_add_device_serial();
2038 + /* SPI */
2039 + at91_add_device_spi(cam60_spi_devices, ARRAY_SIZE(cam60_spi_devices));
2040 + /* Ethernet */
2041 + at91_add_device_eth(&cam60_macb_data);
2042 + /* USB Host */
2043 + /* enable USB power supply circuit */
2044 + at91_set_gpio_output(AT91_PIN_PB18, 1);
2045 + at91_add_device_usbh(&cam60_usbh_data);
2046 + /* NAND */
2047 + at91_add_device_nand(&cam60_nand_data);
2048 +}
2049 +
2050 +MACHINE_START(CAM60, "KwikByte CAM60")
2051 + /* Maintainer: KwikByte */
2052 + .phys_io = AT91_BASE_SYS,
2053 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
2054 + .boot_params = AT91_SDRAM_BASE + 0x100,
2055 + .timer = &at91sam926x_timer,
2056 + .map_io = cam60_map_io,
2057 + .init_irq = cam60_init_irq,
2058 + .init_machine = cam60_board_init,
2059 +MACHINE_END
2060 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-cap9adk.c linux-2.6/arch/arm/mach-at91/board-cap9adk.c
2061 --- linux-2.6.25/arch/arm/mach-at91/board-cap9adk.c 2008-05-03 00:15:44.000000000 +0200
2062 +++ linux-2.6/arch/arm/mach-at91/board-cap9adk.c 2008-05-05 22:01:39.000000000 +0200
2063 @@ -36,16 +36,14 @@
2064 #include <asm/hardware.h>
2065 #include <asm/setup.h>
2066 #include <asm/mach-types.h>
2067 -#include <asm/irq.h>
2068
2069 #include <asm/mach/arch.h>
2070 #include <asm/mach/map.h>
2071 -#include <asm/mach/irq.h>
2072
2073 #include <asm/arch/board.h>
2074 #include <asm/arch/gpio.h>
2075 #include <asm/arch/at91cap9_matrix.h>
2076 -#include <asm/arch/at91sam926x_mc.h>
2077 +#include <asm/arch/at91sam9_smc.h>
2078
2079 #include "generic.h"
2080
2081 @@ -78,6 +76,12 @@
2082 .ports = 2,
2083 };
2084
2085 +/*
2086 + * USB HS Device port
2087 + */
2088 +static struct usba_platform_data __initdata cap9adk_usba_udc_data = {
2089 + .vbus_pin = AT91_PIN_PB31,
2090 +};
2091
2092 /*
2093 * ADS7846 Touchscreen
2094 @@ -130,7 +134,7 @@
2095 {
2096 .modalias = "ads7846",
2097 .chip_select = 3, /* can be 2 or 3, depending on J2 jumper */
2098 - .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
2099 + .max_speed_hz = 125000 * 16, /* max sample rate * clocks per sample */
2100 .bus_num = 0,
2101 .platform_data = &ads_info,
2102 .irq = AT91_PIN_PC4,
2103 @@ -324,8 +328,9 @@
2104 /* Serial */
2105 at91_add_device_serial();
2106 /* USB Host */
2107 - set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH);
2108 at91_add_device_usbh(&cap9adk_usbh_data);
2109 + /* USB HS */
2110 + at91_add_device_usba(&cap9adk_usba_udc_data);
2111 /* SPI */
2112 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices));
2113 /* Touchscreen */
2114 @@ -341,7 +346,6 @@
2115 /* I2C */
2116 at91_add_device_i2c(NULL, 0);
2117 /* LCD Controller */
2118 - set_irq_type(AT91CAP9_ID_LCDC, IRQT_HIGH);
2119 at91_add_device_lcdc(&cap9adk_lcdc_data);
2120 /* AC97 */
2121 at91_add_device_ac97(&cap9adk_ac97_data);
2122 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-carmeva.c linux-2.6/arch/arm/mach-at91/board-carmeva.c
2123 --- linux-2.6.25/arch/arm/mach-at91/board-carmeva.c 2008-05-03 00:15:33.000000000 +0200
2124 +++ linux-2.6/arch/arm/mach-at91/board-carmeva.c 2008-04-25 21:15:43.000000000 +0200
2125 @@ -40,24 +40,21 @@
2126 #include "generic.h"
2127
2128
2129 -/*
2130 - * Serial port configuration.
2131 - * 0 .. 3 = USART0 .. USART3
2132 - * 4 = DBGU
2133 - */
2134 -static struct at91_uart_config __initdata carmeva_uart_config = {
2135 - .console_tty = 0, /* ttyS0 */
2136 - .nr_tty = 2,
2137 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2138 -};
2139 -
2140 static void __init carmeva_map_io(void)
2141 {
2142 /* Initialize processor: 20.000 MHz crystal */
2143 at91rm9200_initialize(20000000, AT91RM9200_BGA);
2144
2145 - /* Setup the serial ports and console */
2146 - at91_init_serial(&carmeva_uart_config);
2147 + /* DBGU on ttyS0. (Rx & Tx only) */
2148 + at91_register_uart(0, 0, 0);
2149 +
2150 + /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
2151 + at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
2152 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
2153 + | ATMEL_UART_RI);
2154 +
2155 + /* set serial console to ttyS0 (ie, DBGU) */
2156 + at91_set_serial_console(0);
2157 }
2158
2159 static void __init carmeva_init_irq(void)
2160 @@ -117,6 +114,30 @@
2161 },
2162 };
2163
2164 +static struct gpio_led carmeva_leds[] = {
2165 + { /* "user led 1", LED9 */
2166 + .name = "led9",
2167 + .gpio = AT91_PIN_PA21,
2168 + .active_low = 1,
2169 + .default_trigger = "heartbeat",
2170 + },
2171 + { /* "user led 2", LED10 */
2172 + .name = "led10",
2173 + .gpio = AT91_PIN_PA25,
2174 + .active_low = 1,
2175 + },
2176 + { /* "user led 3", LED11 */
2177 + .name = "led11",
2178 + .gpio = AT91_PIN_PA26,
2179 + .active_low = 1,
2180 + },
2181 + { /* "user led 4", LED12 */
2182 + .name = "led12",
2183 + .gpio = AT91_PIN_PA18,
2184 + .active_low = 1,
2185 + }
2186 +};
2187 +
2188 static void __init carmeva_board_init(void)
2189 {
2190 /* Serial */
2191 @@ -135,6 +156,8 @@
2192 // at91_add_device_cf(&carmeva_cf_data);
2193 /* MMC */
2194 at91_add_device_mmc(0, &carmeva_mmc_data);
2195 + /* LEDs */
2196 + at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds));
2197 }
2198
2199 MACHINE_START(CARMEVA, "Carmeva")
2200 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-chub.c linux-2.6/arch/arm/mach-at91/board-chub.c
2201 --- linux-2.6.25/arch/arm/mach-at91/board-chub.c 1970-01-01 02:00:00.000000000 +0200
2202 +++ linux-2.6/arch/arm/mach-at91/board-chub.c 2008-04-25 21:15:43.000000000 +0200
2203 @@ -0,0 +1,132 @@
2204 +/*
2205 + * linux/arch/arm/mach-at91/board-chub.c
2206 + *
2207 + * Copyright (C) 2005 SAN People, adapted for Promwad Chub board
2208 + * by Kuten Ivan
2209 + *
2210 + * This program is free software; you can redistribute it and/or modify
2211 + * it under the terms of the GNU General Public License as published by
2212 + * the Free Software Foundation; either version 2 of the License, or
2213 + * (at your option) any later version.
2214 + *
2215 + * This program is distributed in the hope that it will be useful,
2216 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2217 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2218 + * GNU General Public License for more details.
2219 + *
2220 + * You should have received a copy of the GNU General Public License
2221 + * along with this program; if not, write to the Free Software
2222 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2223 + */
2224 +
2225 +#include <linux/types.h>
2226 +#include <linux/init.h>
2227 +#include <linux/mm.h>
2228 +#include <linux/module.h>
2229 +#include <linux/platform_device.h>
2230 +
2231 +#include <asm/hardware.h>
2232 +#include <asm/setup.h>
2233 +#include <asm/mach-types.h>
2234 +#include <asm/irq.h>
2235 +
2236 +#include <asm/mach/arch.h>
2237 +#include <asm/mach/map.h>
2238 +#include <asm/mach/irq.h>
2239 +
2240 +#include <asm/arch/board.h>
2241 +#include <asm/arch/gpio.h>
2242 +
2243 +#include "generic.h"
2244 +
2245 +/*
2246 + * Serial port configuration.
2247 + * 0 .. 3 = USART0 .. USART3
2248 + * 4 = DBGU
2249 + */
2250 +static struct at91_uart_config __initdata chub_uart_config = {
2251 + .console_tty = 0, /* ttyS0 */
2252 + .nr_tty = 5,
2253 + .tty_map = { 4, 0, 1, 2, 3 } /* ttyS0, ..., ttyS4 */
2254 +};
2255 +
2256 +static void __init chub_init_irq(void)
2257 +{
2258 + at91rm9200_init_interrupts(NULL);
2259 +}
2260 +
2261 +static void __init chub_map_io(void)
2262 +{
2263 + /* Initialize clocks: 18.432 MHz crystal */
2264 + at91rm9200_initialize(18432000, AT91RM9200_PQFP);
2265 +
2266 + /* Setup the serial ports and console */
2267 + at91_init_serial(&chub_uart_config);
2268 +}
2269 +
2270 +static struct at91_eth_data __initdata chub_eth_data = {
2271 + .phy_irq_pin = AT91_PIN_PB29,
2272 + .is_rmii = 0,
2273 +};
2274 +
2275 +static struct mtd_partition __initdata chub_nand_partition[] = {
2276 + {
2277 + .name = "NAND Partition 1",
2278 + .offset = 0,
2279 + .size = MTDPART_SIZ_FULL,
2280 + },
2281 +};
2282 +
2283 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
2284 +{
2285 + *num_partitions = ARRAY_SIZE(chub_nand_partition);
2286 + return chub_nand_partition;
2287 +}
2288 +
2289 +static struct at91_nand_data __initdata chub_nand_data = {
2290 + .ale = 22,
2291 + .cle = 21,
2292 + .enable_pin = AT91_PIN_PA27,
2293 + .partition_info = nand_partitions,
2294 +};
2295 +
2296 +static struct spi_board_info chub_spi_devices[] = {
2297 + { /* DataFlash chip */
2298 + .modalias = "mtd_dataflash",
2299 + .chip_select = 0,
2300 + .max_speed_hz = 15 * 1000 * 1000,
2301 + },
2302 +};
2303 +
2304 +static void __init chub_board_init(void)
2305 +{
2306 + /* Serial */
2307 + at91_add_device_serial();
2308 + /* I2C */
2309 + at91_add_device_i2c(NULL, 0);
2310 + /* Ethernet */
2311 + at91_add_device_eth(&chub_eth_data);
2312 + /* SPI */
2313 + at91_add_device_spi(chub_spi_devices, ARRAY_SIZE(chub_spi_devices));
2314 + /* NAND Flash */
2315 + at91_add_device_nand(&chub_nand_data);
2316 + /* Disable write protect for NAND */
2317 + at91_set_gpio_output(AT91_PIN_PB7, 1);
2318 + /* Power enable for 3x RS-232 and 1x RS-485 */
2319 + at91_set_gpio_output(AT91_PIN_PB9, 1);
2320 + /* Disable write protect for FRAM */
2321 + at91_set_gpio_output(AT91_PIN_PA21, 1);
2322 + /* Disable write protect for Dataflash */
2323 + at91_set_gpio_output(AT91_PIN_PA19, 1);
2324 +}
2325 +
2326 +MACHINE_START(CHUB, "Promwad Chub")
2327 + /* Maintainer: Ivan Kuten AT Promwad DOT com */
2328 + .phys_io = AT91_BASE_SYS,
2329 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
2330 + .boot_params = AT91_SDRAM_BASE + 0x100,
2331 + .timer = &at91rm9200_timer,
2332 + .map_io = chub_map_io,
2333 + .init_irq = chub_init_irq,
2334 + .init_machine = chub_board_init,
2335 +MACHINE_END
2336 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-csb337.c linux-2.6/arch/arm/mach-at91/board-csb337.c
2337 --- linux-2.6.25/arch/arm/mach-at91/board-csb337.c 2008-05-03 00:15:44.000000000 +0200
2338 +++ linux-2.6/arch/arm/mach-at91/board-csb337.c 2008-05-02 00:05:42.000000000 +0200
2339 @@ -61,6 +61,7 @@
2340
2341 /* Setup the LEDs */
2342 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
2343 + at91_set_gpio_output(AT91_PIN_PB2, 1); /* third (unused) LED */
2344
2345 /* Setup the serial ports and console */
2346 at91_init_serial(&csb337_uart_config);
2347 @@ -202,11 +203,11 @@
2348
2349 static void __init csb300_add_device_buttons(void)
2350 {
2351 - at91_set_gpio_input(AT91_PIN_PB29, 0); /* sw0 */
2352 + at91_set_gpio_input(AT91_PIN_PB29, 1); /* sw0 */
2353 at91_set_deglitch(AT91_PIN_PB29, 1);
2354 - at91_set_gpio_input(AT91_PIN_PB28, 0); /* sw1 */
2355 + at91_set_gpio_input(AT91_PIN_PB28, 1); /* sw1 */
2356 at91_set_deglitch(AT91_PIN_PB28, 1);
2357 - at91_set_gpio_input(AT91_PIN_PA21, 0); /* sw2 */
2358 + at91_set_gpio_input(AT91_PIN_PA21, 1); /* sw2 */
2359 at91_set_deglitch(AT91_PIN_PA21, 1);
2360
2361 platform_device_register(&csb300_button_device);
2362 @@ -233,7 +234,7 @@
2363 .gpio = AT91_PIN_PB0,
2364 .active_low = 1,
2365 .default_trigger = "ide-disk",
2366 - },
2367 + }
2368 };
2369
2370
2371 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-csb637.c linux-2.6/arch/arm/mach-at91/board-csb637.c
2372 --- linux-2.6.25/arch/arm/mach-at91/board-csb637.c 2008-05-03 00:15:33.000000000 +0200
2373 +++ linux-2.6/arch/arm/mach-at91/board-csb637.c 2008-04-25 21:15:43.000000000 +0200
2374 @@ -40,27 +40,16 @@
2375 #include "generic.h"
2376
2377
2378 -/*
2379 - * Serial port configuration.
2380 - * 0 .. 3 = USART0 .. USART3
2381 - * 4 = DBGU
2382 - */
2383 -static struct at91_uart_config __initdata csb637_uart_config = {
2384 - .console_tty = 0, /* ttyS0 */
2385 - .nr_tty = 2,
2386 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2387 -};
2388 -
2389 static void __init csb637_map_io(void)
2390 {
2391 /* Initialize processor: 3.6864 MHz crystal */
2392 at91rm9200_initialize(3686400, AT91RM9200_BGA);
2393
2394 - /* Setup the LEDs */
2395 - at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
2396 + /* DBGU on ttyS0. (Rx & Tx only) */
2397 + at91_register_uart(0, 0, 0);
2398
2399 - /* Setup the serial ports and console */
2400 - at91_init_serial(&csb637_uart_config);
2401 + /* make console=ttyS0 (ie, DBGU) the default */
2402 + at91_set_serial_console(0);
2403 }
2404
2405 static void __init csb637_init_irq(void)
2406 @@ -118,8 +107,19 @@
2407 .num_resources = ARRAY_SIZE(csb_flash_resources),
2408 };
2409
2410 +static struct gpio_led csb_leds[] = {
2411 + { /* "d1", red */
2412 + .name = "d1",
2413 + .gpio = AT91_PIN_PB2,
2414 + .active_low = 1,
2415 + .default_trigger = "heartbeat",
2416 + }
2417 +};
2418 +
2419 static void __init csb637_board_init(void)
2420 {
2421 + /* LED(s) */
2422 + at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds));
2423 /* Serial */
2424 at91_add_device_serial();
2425 /* Ethernet */
2426 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-dk.c linux-2.6/arch/arm/mach-at91/board-dk.c
2427 --- linux-2.6.25/arch/arm/mach-at91/board-dk.c 2008-05-03 00:15:44.000000000 +0200
2428 +++ linux-2.6/arch/arm/mach-at91/board-dk.c 2008-05-03 00:44:06.000000000 +0200
2429 @@ -25,6 +25,7 @@
2430 #include <linux/init.h>
2431 #include <linux/mm.h>
2432 #include <linux/module.h>
2433 +#include <linux/dma-mapping.h>
2434 #include <linux/platform_device.h>
2435 #include <linux/spi/spi.h>
2436 #include <linux/mtd/physmap.h>
2437 @@ -45,17 +46,6 @@
2438 #include "generic.h"
2439
2440
2441 -/*
2442 - * Serial port configuration.
2443 - * 0 .. 3 = USART0 .. USART3
2444 - * 4 = DBGU
2445 - */
2446 -static struct at91_uart_config __initdata dk_uart_config = {
2447 - .console_tty = 0, /* ttyS0 */
2448 - .nr_tty = 2,
2449 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2450 -};
2451 -
2452 static void __init dk_map_io(void)
2453 {
2454 /* Initialize processor: 18.432 MHz crystal */
2455 @@ -64,8 +54,16 @@
2456 /* Setup the LEDs */
2457 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
2458
2459 - /* Setup the serial ports and console */
2460 - at91_init_serial(&dk_uart_config);
2461 + /* DBGU on ttyS0. (Rx & Tx only) */
2462 + at91_register_uart(0, 0, 0);
2463 +
2464 + /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
2465 + at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
2466 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
2467 + | ATMEL_UART_RI);
2468 +
2469 + /* set serial console to ttyS0 (ie, DBGU) */
2470 + at91_set_serial_console(0);
2471 }
2472
2473 static void __init dk_init_irq(void)
2474 @@ -73,6 +71,185 @@
2475 at91rm9200_init_interrupts(NULL);
2476 }
2477
2478 +#if defined(CONFIG_FB_S1D13XXX) || defined(CONFIG_FB_S1D13XXX_MODULE)
2479 +#include <video/s1d13xxxfb.h>
2480 +#include <asm/arch/ics1523.h>
2481 +
2482 +/* EPSON S1D13806 FB */
2483 +#define AT91_FB_REG_BASE 0x30000000L
2484 +#define AT91_FB_REG_SIZE 0x200
2485 +#define AT91_FB_VMEM_BASE 0x30200000L
2486 +#define AT91_FB_VMEM_SIZE 0x140000L
2487 +
2488 +static void dk_init_video(void)
2489 +{
2490 + /* NWAIT Signal */
2491 + at91_set_A_periph(AT91_PIN_PC6, 0);
2492 +
2493 + /* Initialization of the Static Memory Controller for Chip Select 2 */
2494 + at91_sys_write(AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */
2495 + | AT91_SMC_WSEN | AT91_SMC_NWS_(4) /* wait states */
2496 + | AT91_SMC_TDF_(1) /* float time */
2497 + );
2498 +
2499 + at91_ics1523_init();
2500 +}
2501 +
2502 +/* CRT: (active) 640x480 60Hz (PCLK=CLKI=25.175MHz)
2503 + Memory: Embedded SDRAM (MCLK=CLKI3=50.000MHz) (BUSCLK=60.000MHz) */
2504 +static const struct s1d13xxxfb_regval dk_s1dfb_initregs[] = {
2505 + {S1DREG_MISC, 0x00}, /* Enable Memory/Register select bit */
2506 + {S1DREG_COM_DISP_MODE, 0x00}, /* disable display output */
2507 + {S1DREG_GPIO_CNF0, 0x00},
2508 + {S1DREG_GPIO_CNF1, 0x00},
2509 + {S1DREG_GPIO_CTL0, 0x08},
2510 + {S1DREG_GPIO_CTL1, 0x00},
2511 + {S1DREG_CLK_CNF, 0x01}, /* no divide, MCLK source is CLKI3 0x02*/
2512 + {S1DREG_LCD_CLK_CNF, 0x00},
2513 + {S1DREG_CRT_CLK_CNF, 0x00},
2514 + {S1DREG_MPLUG_CLK_CNF, 0x00},
2515 + {S1DREG_CPU2MEM_WST_SEL, 0x01}, /* 2*period(MCLK) - 4ns > period(BCLK) */
2516 + {S1DREG_SDRAM_REF_RATE, 0x03}, /* 32768 <= MCLK <= 50000 (MHz) */
2517 + {S1DREG_SDRAM_TC0, 0x00}, /* MCLK source freq (MHz): */
2518 + {S1DREG_SDRAM_TC1, 0x01}, /* 42 <= MCLK <= 50 */
2519 + {S1DREG_MEM_CNF, 0x80}, /* SDRAM Initialization - needed before mem access */
2520 + {S1DREG_PANEL_TYPE, 0x25}, /* std TFT 16bit, 8bit SCP format 2, single passive LCD */
2521 + {S1DREG_MOD_RATE, 0x00}, /* toggle every FPFRAME */
2522 + {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* 680 pix */
2523 + {S1DREG_LCD_NDISP_HPER, 0x12}, /* 152 pix */
2524 + {S1DREG_TFT_FPLINE_START, 0x01}, /* 13 pix */
2525 + {S1DREG_TFT_FPLINE_PWIDTH, 0x0B}, /* 96 pix */
2526 + {S1DREG_LCD_DISP_VHEIGHT0, 0xDF},
2527 + {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* 480 lines */
2528 + {S1DREG_LCD_NDISP_VPER, 0x2C}, /* 44 lines */
2529 + {S1DREG_TFT_FPFRAME_START, 0x0A}, /* 10 lines */
2530 + {S1DREG_TFT_FPFRAME_PWIDTH, 0x01}, /* 2 lines */
2531 + {S1DREG_LCD_DISP_MODE, 0x05}, /* 16 bpp */
2532 + {S1DREG_LCD_MISC, 0x00}, /* dithering enabled, dual panel buffer enabled */
2533 + {S1DREG_LCD_DISP_START0, 0x00},
2534 + {S1DREG_LCD_DISP_START1, 0xC8},
2535 + {S1DREG_LCD_DISP_START2, 0x00},
2536 + {S1DREG_LCD_MEM_OFF0, 0x80},
2537 + {S1DREG_LCD_MEM_OFF1, 0x02},
2538 + {S1DREG_LCD_PIX_PAN, 0x00},
2539 + {S1DREG_LCD_DISP_FIFO_HTC, 0x3B},
2540 + {S1DREG_LCD_DISP_FIFO_LTC, 0x3C},
2541 + {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* 680 pix */
2542 + {S1DREG_CRT_NDISP_HPER, 0x13}, /* 160 pix */
2543 + {S1DREG_CRT_HRTC_START, 0x01}, /* 13 pix */
2544 + {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* 96 pix */
2545 + {S1DREG_CRT_DISP_VHEIGHT0, 0xDF},
2546 + {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* 480 lines */
2547 + {S1DREG_CRT_NDISP_VPER, 0x2B}, /* 44 lines */
2548 + {S1DREG_CRT_VRTC_START, 0x09}, /* 10 lines */
2549 + {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* 2 lines */
2550 + {S1DREG_TV_OUT_CTL, 0x10},
2551 + {S1DREG_CRT_DISP_MODE, 0x05}, /* 16 bpp */
2552 + {S1DREG_CRT_DISP_START0, 0x00},
2553 + {S1DREG_CRT_DISP_START1, 0x00},
2554 + {S1DREG_CRT_DISP_START2, 0x00},
2555 + {S1DREG_CRT_MEM_OFF0, 0x80},
2556 + {S1DREG_CRT_MEM_OFF1, 0x02},
2557 + {S1DREG_CRT_PIX_PAN, 0x00},
2558 + {S1DREG_CRT_DISP_FIFO_HTC, 0x3B},
2559 + {S1DREG_CRT_DISP_FIFO_LTC, 0x3C},
2560 + {S1DREG_LCD_CUR_CTL, 0x00}, /* inactive */
2561 + {S1DREG_LCD_CUR_START, 0x01},
2562 + {S1DREG_LCD_CUR_XPOS0, 0x00},
2563 + {S1DREG_LCD_CUR_XPOS1, 0x00},
2564 + {S1DREG_LCD_CUR_YPOS0, 0x00},
2565 + {S1DREG_LCD_CUR_YPOS1, 0x00},
2566 + {S1DREG_LCD_CUR_BCTL0, 0x00},
2567 + {S1DREG_LCD_CUR_GCTL0, 0x00},
2568 + {S1DREG_LCD_CUR_RCTL0, 0x00},
2569 + {S1DREG_LCD_CUR_BCTL1, 0x1F},
2570 + {S1DREG_LCD_CUR_GCTL1, 0x3F},
2571 + {S1DREG_LCD_CUR_RCTL1, 0x1F},
2572 + {S1DREG_LCD_CUR_FIFO_HTC, 0x00},
2573 + {S1DREG_CRT_CUR_CTL, 0x00}, /* inactive */
2574 + {S1DREG_CRT_CUR_START, 0x01},
2575 + {S1DREG_CRT_CUR_XPOS0, 0x00},
2576 + {S1DREG_CRT_CUR_XPOS1, 0x00},
2577 + {S1DREG_CRT_CUR_YPOS0, 0x00},
2578 + {S1DREG_CRT_CUR_YPOS1, 0x00},
2579 + {S1DREG_CRT_CUR_BCTL0, 0x00},
2580 + {S1DREG_CRT_CUR_GCTL0, 0x00},
2581 + {S1DREG_CRT_CUR_RCTL0, 0x00},
2582 + {S1DREG_CRT_CUR_BCTL1, 0x1F},
2583 + {S1DREG_CRT_CUR_GCTL1, 0x3F},
2584 + {S1DREG_CRT_CUR_RCTL1, 0x1F},
2585 + {S1DREG_CRT_CUR_FIFO_HTC, 0x00},
2586 + {S1DREG_BBLT_CTL0, 0x00},
2587 + {S1DREG_BBLT_CTL0, 0x00},
2588 + {S1DREG_BBLT_CC_EXP, 0x00},
2589 + {S1DREG_BBLT_OP, 0x00},
2590 + {S1DREG_BBLT_SRC_START0, 0x00},
2591 + {S1DREG_BBLT_SRC_START1, 0x00},
2592 + {S1DREG_BBLT_SRC_START2, 0x00},
2593 + {S1DREG_BBLT_DST_START0, 0x00},
2594 + {S1DREG_BBLT_DST_START1, 0x00},
2595 + {S1DREG_BBLT_DST_START2, 0x00},
2596 + {S1DREG_BBLT_MEM_OFF0, 0x00},
2597 + {S1DREG_BBLT_MEM_OFF1, 0x00},
2598 + {S1DREG_BBLT_WIDTH0, 0x00},
2599 + {S1DREG_BBLT_WIDTH1, 0x00},
2600 + {S1DREG_BBLT_HEIGHT0, 0x00},
2601 + {S1DREG_BBLT_HEIGHT1, 0x00},
2602 + {S1DREG_BBLT_BGC0, 0x00},
2603 + {S1DREG_BBLT_BGC1, 0x00},
2604 + {S1DREG_BBLT_FGC0, 0x00},
2605 + {S1DREG_BBLT_FGC1, 0x00},
2606 + {S1DREG_LKUP_MODE, 0x00}, /* LCD LUT r | LCD and CRT/TV LUT w */
2607 + {S1DREG_LKUP_ADDR, 0x00},
2608 + {S1DREG_PS_CNF, 0x00}, /* Power Save disable */
2609 + {S1DREG_PS_STATUS, 0x02}, /* LCD Panel down, mem up */
2610 + {S1DREG_CPU2MEM_WDOGT, 0x00},
2611 + {S1DREG_COM_DISP_MODE, 0x02}, /* enable CRT display output */
2612 +};
2613 +
2614 +static struct s1d13xxxfb_pdata dk_s1dfb_pdata = {
2615 + .initregs = dk_s1dfb_initregs,
2616 + .initregssize = ARRAY_SIZE(dk_s1dfb_initregs),
2617 + .platform_init_video = dk_init_video,
2618 +};
2619 +
2620 +static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
2621 +
2622 +static struct resource dk_s1dfb_resource[] = {
2623 + [0] = { /* video mem */
2624 + .name = "s1d13806 memory",
2625 + .start = AT91_FB_VMEM_BASE,
2626 + .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1,
2627 + .flags = IORESOURCE_MEM,
2628 + },
2629 + [1] = { /* video registers */
2630 + .name = "s1d13806 registers",
2631 + .start = AT91_FB_REG_BASE,
2632 + .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1,
2633 + .flags = IORESOURCE_MEM,
2634 + },
2635 +};
2636 +
2637 +static struct platform_device dk_s1dfb_device = {
2638 + .name = "s1d13806fb",
2639 + .id = -1,
2640 + .dev = {
2641 + .dma_mask = &s1dfb_dmamask,
2642 + .coherent_dma_mask = DMA_BIT_MASK(32),
2643 + .platform_data = &dk_s1dfb_pdata,
2644 + },
2645 + .resource = dk_s1dfb_resource,
2646 + .num_resources = ARRAY_SIZE(dk_s1dfb_resource),
2647 +};
2648 +
2649 +static void __init dk_add_device_video(void)
2650 +{
2651 + platform_device_register(&dk_s1dfb_device);
2652 +}
2653 +#else
2654 +static void __init dk_add_device_video(void) {}
2655 +#endif
2656 +
2657 static struct at91_eth_data __initdata dk_eth_data = {
2658 .phy_irq_pin = AT91_PIN_PC4,
2659 .is_rmii = 1,
2660 @@ -164,7 +341,7 @@
2661 #define DK_FLASH_SIZE 0x200000
2662
2663 static struct physmap_flash_data dk_flash_data = {
2664 - .width = 2,
2665 + .width = 2,
2666 };
2667
2668 static struct resource dk_flash_resource = {
2669 @@ -223,8 +400,12 @@
2670 platform_device_register(&dk_flash);
2671 /* LEDs */
2672 at91_gpio_leds(dk_leds, ARRAY_SIZE(dk_leds));
2673 + /* SSC (to LM4549 audio codec) */
2674 + at91_add_device_ssc(AT91RM9200_ID_SSC1, ATMEL_SSC_TD | ATMEL_SSC_RX);
2675 + /* SSC (to SI3021 line interface) */
2676 + at91_add_device_ssc(AT91RM9200_ID_SSC2, ATMEL_SSC_TD | ATMEL_SSC_TK | ATMEL_SSC_RD | ATMEL_SSC_RF);
2677 /* VGA */
2678 -// dk_add_device_video();
2679 + dk_add_device_video();
2680 }
2681
2682 MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK")
2683 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-eb9200.c linux-2.6/arch/arm/mach-at91/board-eb9200.c
2684 --- linux-2.6.25/arch/arm/mach-at91/board-eb9200.c 2008-05-03 00:15:33.000000000 +0200
2685 +++ linux-2.6/arch/arm/mach-at91/board-eb9200.c 2008-04-25 21:15:43.000000000 +0200
2686 @@ -40,24 +40,24 @@
2687 #include "generic.h"
2688
2689
2690 -/*
2691 - * Serial port configuration.
2692 - * 0 .. 3 = USART0 .. USART3
2693 - * 4 = DBGU
2694 - */
2695 -static struct at91_uart_config __initdata eb9200_uart_config = {
2696 - .console_tty = 0, /* ttyS0 */
2697 - .nr_tty = 2,
2698 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2699 -};
2700 -
2701 static void __init eb9200_map_io(void)
2702 {
2703 /* Initialize processor: 18.432 MHz crystal */
2704 at91rm9200_initialize(18432000, AT91RM9200_BGA);
2705
2706 - /* Setup the serial ports and console */
2707 - at91_init_serial(&eb9200_uart_config);
2708 + /* DBGU on ttyS0. (Rx & Tx only) */
2709 + at91_register_uart(0, 0, 0);
2710 +
2711 + /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
2712 + at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
2713 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
2714 + | ATMEL_UART_RI);
2715 +
2716 + /* USART2 on ttyS2. (Rx, Tx) - IRDA */
2717 + at91_register_uart(AT91RM9200_ID_US2, 2, 0);
2718 +
2719 + /* set serial console to ttyS0 (ie, DBGU) */
2720 + at91_set_serial_console(0);
2721 }
2722
2723 static void __init eb9200_init_irq(void)
2724 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-ecbat91.c linux-2.6/arch/arm/mach-at91/board-ecbat91.c
2725 --- linux-2.6.25/arch/arm/mach-at91/board-ecbat91.c 1970-01-01 02:00:00.000000000 +0200
2726 +++ linux-2.6/arch/arm/mach-at91/board-ecbat91.c 2008-04-25 21:15:43.000000000 +0200
2727 @@ -0,0 +1,178 @@
2728 +/*
2729 + * linux/arch/arm/mach-at91rm9200/board-ecbat91.c
2730 + * Copyright (C) 2007 emQbit.com.
2731 + *
2732 + * We started from board-dk.c, which is Copyright (C) 2005 SAN People.
2733 + *
2734 + * This program is free software; you can redistribute it and/or modify
2735 + * it under the terms of the GNU General Public License as published by
2736 + * the Free Software Foundation; either version 2 of the License, or
2737 + * (at your option) any later version.
2738 + *
2739 + * This program is distributed in the hope that it will be useful,
2740 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2741 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2742 + * GNU General Public License for more details.
2743 + *
2744 + * You should have received a copy of the GNU General Public License
2745 + * along with this program; if not, write to the Free Software
2746 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2747 + */
2748 +
2749 +#include <linux/types.h>
2750 +#include <linux/init.h>
2751 +#include <linux/mm.h>
2752 +#include <linux/module.h>
2753 +#include <linux/platform_device.h>
2754 +#include <linux/spi/spi.h>
2755 +#include <linux/spi/flash.h>
2756 +
2757 +#include <asm/hardware.h>
2758 +#include <asm/setup.h>
2759 +#include <asm/mach-types.h>
2760 +#include <asm/irq.h>
2761 +
2762 +#include <asm/mach/arch.h>
2763 +#include <asm/mach/map.h>
2764 +#include <asm/mach/irq.h>
2765 +
2766 +#include <asm/arch/board.h>
2767 +#include <asm/arch/gpio.h>
2768 +
2769 +#include "generic.h"
2770 +
2771 +
2772 +static void __init ecb_at91map_io(void)
2773 +{
2774 + /* Initialize processor: 18.432 MHz crystal */
2775 + at91rm9200_initialize(18432000, AT91RM9200_PQFP);
2776 +
2777 + /* Setup the LEDs */
2778 + at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
2779 +
2780 + /* DBGU on ttyS0. (Rx & Tx only) */
2781 + at91_register_uart(0, 0, 0);
2782 +
2783 + /* USART0 on ttyS1. (Rx & Tx only) */
2784 + at91_register_uart(AT91RM9200_ID_US0, 1, 0);
2785 +
2786 + /* set serial console to ttyS0 (ie, DBGU) */
2787 + at91_set_serial_console(0);
2788 +}
2789 +
2790 +static void __init ecb_at91init_irq(void)
2791 +{
2792 + at91rm9200_init_interrupts(NULL);
2793 +}
2794 +
2795 +static struct at91_eth_data __initdata ecb_at91eth_data = {
2796 + .phy_irq_pin = AT91_PIN_PC4,
2797 + .is_rmii = 0,
2798 +};
2799 +
2800 +static struct at91_usbh_data __initdata ecb_at91usbh_data = {
2801 + .ports = 1,
2802 +};
2803 +
2804 +static struct at91_mmc_data __initdata ecb_at91mmc_data = {
2805 + .slot_b = 0,
2806 + .wire4 = 1,
2807 +};
2808 +
2809 +
2810 +#if defined(CONFIG_MTD_DATAFLASH)
2811 +static struct mtd_partition __initdata my_flash0_partitions[] =
2812 +{
2813 + { /* 0x8400 */
2814 + .name = "Darrell-loader",
2815 + .offset = 0,
2816 + .size = 12* 1056,
2817 + },
2818 + {
2819 + .name = "U-boot",
2820 + .offset = MTDPART_OFS_NXTBLK,
2821 + .size = 110 * 1056,
2822 + },
2823 + { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
2824 + .name = "Uoot-env",
2825 + .offset = MTDPART_OFS_NXTBLK,
2826 + .size = 8 * 1056,
2827 + },
2828 + { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
2829 + .name = "Kernel",
2830 + .offset = MTDPART_OFS_NXTBLK,
2831 + .size = 1534 * 1056,
2832 + },
2833 + { /* 190200 - jffs2 root filesystem */
2834 + .name = "Filesystem",
2835 + .offset = MTDPART_OFS_NXTBLK,
2836 + .size = MTDPART_SIZ_FULL, /* 26 sectors */
2837 + }
2838 +};
2839 +
2840 +static struct flash_platform_data __initdata my_flash0_platform = {
2841 + .name = "Removable flash card",
2842 + .parts = my_flash0_partitions,
2843 + .nr_parts = ARRAY_SIZE(my_flash0_partitions)
2844 +};
2845 +
2846 +#endif
2847 +
2848 +static struct spi_board_info __initdata ecb_at91spi_devices[] = {
2849 + { /* DataFlash chip */
2850 + .modalias = "mtd_dataflash",
2851 + .chip_select = 0,
2852 + .max_speed_hz = 10 * 1000 * 1000,
2853 + .bus_num = 0,
2854 +#if defined(CONFIG_MTD_DATAFLASH)
2855 + .platform_data = &my_flash0_platform,
2856 +#endif
2857 + },
2858 + { /* User accessable spi - cs1 (250KHz) */
2859 + .modalias = "spi-cs1",
2860 + .chip_select = 1,
2861 + .max_speed_hz = 250 * 1000,
2862 + },
2863 + { /* User accessable spi - cs2 (1MHz) */
2864 + .modalias = "spi-cs2",
2865 + .chip_select = 2,
2866 + .max_speed_hz = 1 * 1000 * 1000,
2867 + },
2868 + { /* User accessable spi - cs3 (10MHz) */
2869 + .modalias = "spi-cs3",
2870 + .chip_select = 3,
2871 + .max_speed_hz = 10 * 1000 * 1000,
2872 + },
2873 +};
2874 +
2875 +static void __init ecb_at91board_init(void)
2876 +{
2877 + /* Serial */
2878 + at91_add_device_serial();
2879 +
2880 + /* Ethernet */
2881 + at91_add_device_eth(&ecb_at91eth_data);
2882 +
2883 + /* USB Host */
2884 + at91_add_device_usbh(&ecb_at91usbh_data);
2885 +
2886 + /* I2C */
2887 + at91_add_device_i2c(NULL, 0);
2888 +
2889 + /* MMC */
2890 + at91_add_device_mmc(0, &ecb_at91mmc_data);
2891 +
2892 + /* SPI */
2893 + at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));
2894 +}
2895 +
2896 +MACHINE_START(ECBAT91, "emQbit's ECB_AT91")
2897 + /* Maintainer: emQbit.com */
2898 + .phys_io = AT91_BASE_SYS,
2899 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
2900 + .boot_params = AT91_SDRAM_BASE + 0x100,
2901 + .timer = &at91rm9200_timer,
2902 + .map_io = ecb_at91map_io,
2903 + .init_irq = ecb_at91init_irq,
2904 + .init_machine = ecb_at91board_init,
2905 +MACHINE_END
2906 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-ek.c linux-2.6/arch/arm/mach-at91/board-ek.c
2907 --- linux-2.6.25/arch/arm/mach-at91/board-ek.c 2008-05-03 00:15:44.000000000 +0200
2908 +++ linux-2.6/arch/arm/mach-at91/board-ek.c 2008-05-03 00:44:38.000000000 +0200
2909 @@ -25,6 +25,7 @@
2910 #include <linux/init.h>
2911 #include <linux/mm.h>
2912 #include <linux/module.h>
2913 +#include <linux/dma-mapping.h>
2914 #include <linux/platform_device.h>
2915 #include <linux/spi/spi.h>
2916 #include <linux/mtd/physmap.h>
2917 @@ -45,17 +46,6 @@
2918 #include "generic.h"
2919
2920
2921 -/*
2922 - * Serial port configuration.
2923 - * 0 .. 3 = USART0 .. USART3
2924 - * 4 = DBGU
2925 - */
2926 -static struct at91_uart_config __initdata ek_uart_config = {
2927 - .console_tty = 0, /* ttyS0 */
2928 - .nr_tty = 2,
2929 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2930 -};
2931 -
2932 static void __init ek_map_io(void)
2933 {
2934 /* Initialize processor: 18.432 MHz crystal */
2935 @@ -64,8 +54,16 @@
2936 /* Setup the LEDs */
2937 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
2938
2939 - /* Setup the serial ports and console */
2940 - at91_init_serial(&ek_uart_config);
2941 + /* DBGU on ttyS0. (Rx & Tx only) */
2942 + at91_register_uart(0, 0, 0);
2943 +
2944 + /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
2945 + at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
2946 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
2947 + | ATMEL_UART_RI);
2948 +
2949 + /* set serial console to ttyS0 (ie, DBGU) */
2950 + at91_set_serial_console(0);
2951 }
2952
2953 static void __init ek_init_irq(void)
2954 @@ -73,6 +71,187 @@
2955 at91rm9200_init_interrupts(NULL);
2956 }
2957
2958 +#if defined(CONFIG_FB_S1D13XXX) || defined(CONFIG_FB_S1D13XXX_MODULE)
2959 +#include <video/s1d13xxxfb.h>
2960 +#include <asm/arch/ics1523.h>
2961 +
2962 +/* EPSON S1D13806 FB */
2963 +#define AT91_FB_REG_BASE 0x40000000L
2964 +#define AT91_FB_REG_SIZE 0x200
2965 +#define AT91_FB_VMEM_BASE 0x40200000L
2966 +#define AT91_FB_VMEM_SIZE 0x140000L
2967 +
2968 +static void ek_init_video(void)
2969 +{
2970 + /* NWAIT Signal */
2971 + at91_set_A_periph(AT91_PIN_PC6, 0);
2972 +
2973 + /* Initialization of the Static Memory Controller for Chip Select 3 */
2974 + at91_sys_write(AT91_SMC_CSR(3), AT91_SMC_DBW_16 /* 16 bit */
2975 + | AT91_SMC_WSEN | AT91_SMC_NWS_(5) /* wait states */
2976 + | AT91_SMC_TDF_(1) /* float time */
2977 + );
2978 +
2979 + at91_ics1523_init();
2980 +}
2981 +
2982 +/* CRT: (active) 640x480 60Hz (PCLK=CLKI=25.175MHz)
2983 + Memory: Embedded SDRAM (MCLK=CLKI3=50.000MHz) (BUSCLK=60.000MHz) */
2984 +static const struct s1d13xxxfb_regval ek_s1dfb_initregs[] = {
2985 + {S1DREG_MISC, 0x00}, /* Enable Memory/Register select bit */
2986 + {S1DREG_COM_DISP_MODE, 0x00}, /* disable display output */
2987 + {S1DREG_GPIO_CNF0, 0xFF}, // 0x00
2988 + {S1DREG_GPIO_CNF1, 0x1F}, // 0x08
2989 + {S1DREG_GPIO_CTL0, 0x00},
2990 + {S1DREG_GPIO_CTL1, 0x00},
2991 + {S1DREG_CLK_CNF, 0x01}, /* no divide, MCLK source is CLKI3 0x02*/
2992 + {S1DREG_LCD_CLK_CNF, 0x00},
2993 + {S1DREG_CRT_CLK_CNF, 0x00},
2994 + {S1DREG_MPLUG_CLK_CNF, 0x00},
2995 + {S1DREG_CPU2MEM_WST_SEL, 0x01}, /* 2*period(MCLK) - 4ns > period(BCLK) */
2996 + {S1DREG_SDRAM_REF_RATE, 0x03}, /* 32768 <= MCLK <= 50000 (MHz) */
2997 + {S1DREG_SDRAM_TC0, 0x00}, /* MCLK source freq (MHz): */
2998 + {S1DREG_SDRAM_TC1, 0x01}, /* 42 <= MCLK <= 50 */
2999 + {S1DREG_MEM_CNF, 0x80}, /* SDRAM Initialization - needed before mem access */
3000 + {S1DREG_PANEL_TYPE, 0x25}, /* std TFT 16bit, 8bit SCP format 2, single passive LCD */
3001 + {S1DREG_MOD_RATE, 0x00}, /* toggle every FPFRAME */
3002 + {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* 680 pix */
3003 + {S1DREG_LCD_NDISP_HPER, 0x12}, /* 152 pix */
3004 + {S1DREG_TFT_FPLINE_START, 0x01}, /* 13 pix */
3005 + {S1DREG_TFT_FPLINE_PWIDTH, 0x0B}, /* 96 pix */
3006 + {S1DREG_LCD_DISP_VHEIGHT0, 0xDF},
3007 + {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* 480 lines */
3008 + {S1DREG_LCD_NDISP_VPER, 0x2C}, /* 44 lines */
3009 + {S1DREG_TFT_FPFRAME_START, 0x0A}, /* 10 lines */
3010 + {S1DREG_TFT_FPFRAME_PWIDTH, 0x01}, /* 2 lines */
3011 + {S1DREG_LCD_DISP_MODE, 0x05}, /* 16 bpp */
3012 + {S1DREG_LCD_MISC, 0x00}, /* dithering enabled, dual panel buffer enabled */
3013 + {S1DREG_LCD_DISP_START0, 0x00},
3014 + {S1DREG_LCD_DISP_START1, 0xC8},
3015 + {S1DREG_LCD_DISP_START2, 0x00},
3016 + {S1DREG_LCD_MEM_OFF0, 0x80},
3017 + {S1DREG_LCD_MEM_OFF1, 0x02},
3018 + {S1DREG_LCD_PIX_PAN, 0x00},
3019 + {S1DREG_LCD_DISP_FIFO_HTC, 0x3B},
3020 + {S1DREG_LCD_DISP_FIFO_LTC, 0x3C},
3021 + {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* 680 pix */
3022 + {S1DREG_CRT_NDISP_HPER, 0x13}, /* 160 pix */
3023 + {S1DREG_CRT_HRTC_START, 0x01}, /* 13 pix */
3024 + {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* 96 pix */
3025 + {S1DREG_CRT_DISP_VHEIGHT0, 0xDF},
3026 + {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* 480 lines */
3027 + {S1DREG_CRT_NDISP_VPER, 0x2B}, /* 44 lines */
3028 + {S1DREG_CRT_VRTC_START, 0x09}, /* 10 lines */
3029 + {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* 2 lines */
3030 + {S1DREG_TV_OUT_CTL, 0x10},
3031 + {0x005E, 0x9F},
3032 + {0x005F, 0x00},
3033 + {S1DREG_CRT_DISP_MODE, 0x05}, /* 16 bpp */
3034 + {S1DREG_CRT_DISP_START0, 0x00},
3035 + {S1DREG_CRT_DISP_START1, 0x00},
3036 + {S1DREG_CRT_DISP_START2, 0x00},
3037 + {S1DREG_CRT_MEM_OFF0, 0x80},
3038 + {S1DREG_CRT_MEM_OFF1, 0x02},
3039 + {S1DREG_CRT_PIX_PAN, 0x00},
3040 + {S1DREG_CRT_DISP_FIFO_HTC, 0x3B},
3041 + {S1DREG_CRT_DISP_FIFO_LTC, 0x3C},
3042 + {S1DREG_LCD_CUR_CTL, 0x00}, /* inactive */
3043 + {S1DREG_LCD_CUR_START, 0x01},
3044 + {S1DREG_LCD_CUR_XPOS0, 0x00},
3045 + {S1DREG_LCD_CUR_XPOS1, 0x00},
3046 + {S1DREG_LCD_CUR_YPOS0, 0x00},
3047 + {S1DREG_LCD_CUR_YPOS1, 0x00},
3048 + {S1DREG_LCD_CUR_BCTL0, 0x00},
3049 + {S1DREG_LCD_CUR_GCTL0, 0x00},
3050 + {S1DREG_LCD_CUR_RCTL0, 0x00},
3051 + {S1DREG_LCD_CUR_BCTL1, 0x1F},
3052 + {S1DREG_LCD_CUR_GCTL1, 0x3F},
3053 + {S1DREG_LCD_CUR_RCTL1, 0x1F},
3054 + {S1DREG_LCD_CUR_FIFO_HTC, 0x00},
3055 + {S1DREG_CRT_CUR_CTL, 0x00}, /* inactive */
3056 + {S1DREG_CRT_CUR_START, 0x01},
3057 + {S1DREG_CRT_CUR_XPOS0, 0x00},
3058 + {S1DREG_CRT_CUR_XPOS1, 0x00},
3059 + {S1DREG_CRT_CUR_YPOS0, 0x00},
3060 + {S1DREG_CRT_CUR_YPOS1, 0x00},
3061 + {S1DREG_CRT_CUR_BCTL0, 0x00},
3062 + {S1DREG_CRT_CUR_GCTL0, 0x00},
3063 + {S1DREG_CRT_CUR_RCTL0, 0x00},
3064 + {S1DREG_CRT_CUR_BCTL1, 0x1F},
3065 + {S1DREG_CRT_CUR_GCTL1, 0x3F},
3066 + {S1DREG_CRT_CUR_RCTL1, 0x1F},
3067 + {S1DREG_CRT_CUR_FIFO_HTC, 0x00},
3068 + {S1DREG_BBLT_CTL0, 0x00},
3069 + {S1DREG_BBLT_CTL0, 0x00},
3070 + {S1DREG_BBLT_CC_EXP, 0x00},
3071 + {S1DREG_BBLT_OP, 0x00},
3072 + {S1DREG_BBLT_SRC_START0, 0x00},
3073 + {S1DREG_BBLT_SRC_START1, 0x00},
3074 + {S1DREG_BBLT_SRC_START2, 0x00},
3075 + {S1DREG_BBLT_DST_START0, 0x00},
3076 + {S1DREG_BBLT_DST_START1, 0x00},
3077 + {S1DREG_BBLT_DST_START2, 0x00},
3078 + {S1DREG_BBLT_MEM_OFF0, 0x00},
3079 + {S1DREG_BBLT_MEM_OFF1, 0x00},
3080 + {S1DREG_BBLT_WIDTH0, 0x00},
3081 + {S1DREG_BBLT_WIDTH1, 0x00},
3082 + {S1DREG_BBLT_HEIGHT0, 0x00},
3083 + {S1DREG_BBLT_HEIGHT1, 0x00},
3084 + {S1DREG_BBLT_BGC0, 0x00},
3085 + {S1DREG_BBLT_BGC1, 0x00},
3086 + {S1DREG_BBLT_FGC0, 0x00},
3087 + {S1DREG_BBLT_FGC1, 0x00},
3088 + {S1DREG_LKUP_MODE, 0x00}, /* LCD LUT r | LCD and CRT/TV LUT w */
3089 + {S1DREG_LKUP_ADDR, 0x00},
3090 + {S1DREG_PS_CNF, 0x10}, /* Power Save disable */
3091 + {S1DREG_PS_STATUS, 0x02}, /* LCD Panel down, mem up */
3092 + {S1DREG_CPU2MEM_WDOGT, 0x00},
3093 + {S1DREG_COM_DISP_MODE, 0x02}, /* enable CRT display output */
3094 +};
3095 +
3096 +static struct s1d13xxxfb_pdata ek_s1dfb_pdata = {
3097 + .initregs = ek_s1dfb_initregs,
3098 + .initregssize = ARRAY_SIZE(ek_s1dfb_initregs),
3099 + .platform_init_video = ek_init_video,
3100 +};
3101 +
3102 +static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
3103 +
3104 +static struct resource ek_s1dfb_resource[] = {
3105 + [0] = { /* video mem */
3106 + .name = "s1d13806 memory",
3107 + .start = AT91_FB_VMEM_BASE,
3108 + .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1,
3109 + .flags = IORESOURCE_MEM,
3110 + },
3111 + [1] = { /* video registers */
3112 + .name = "s1d13806 registers",
3113 + .start = AT91_FB_REG_BASE,
3114 + .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1,
3115 + .flags = IORESOURCE_MEM,
3116 + },
3117 +};
3118 +
3119 +static struct platform_device ek_s1dfb_device = {
3120 + .name = "s1d13806fb",
3121 + .id = -1,
3122 + .dev = {
3123 + .dma_mask = &s1dfb_dmamask,
3124 + .coherent_dma_mask = DMA_BIT_MASK(32),
3125 + .platform_data = &ek_s1dfb_pdata,
3126 + },
3127 + .resource = ek_s1dfb_resource,
3128 + .num_resources = ARRAY_SIZE(ek_s1dfb_resource),
3129 +};
3130 +
3131 +static void __init ek_add_device_video(void)
3132 +{
3133 + platform_device_register(&ek_s1dfb_device);
3134 +}
3135 +#else
3136 +static void __init ek_add_device_video(void) {}
3137 +#endif
3138 +
3139 static struct at91_eth_data __initdata ek_eth_data = {
3140 .phy_irq_pin = AT91_PIN_PC4,
3141 .is_rmii = 1,
3142 @@ -122,7 +301,7 @@
3143 #define EK_FLASH_SIZE 0x200000
3144
3145 static struct physmap_flash_data ek_flash_data = {
3146 - .width = 2,
3147 + .width = 2,
3148 };
3149
3150 static struct resource ek_flash_resource = {
3151 @@ -189,7 +368,7 @@
3152 /* LEDs */
3153 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
3154 /* VGA */
3155 -// ek_add_device_video();
3156 + ek_add_device_video();
3157 }
3158
3159 MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK")
3160 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-homematic.c linux-2.6/arch/arm/mach-at91/board-homematic.c
3161 --- linux-2.6.25/arch/arm/mach-at91/board-homematic.c 1970-01-01 02:00:00.000000000 +0200
3162 +++ linux-2.6/arch/arm/mach-at91/board-homematic.c 2008-04-25 21:15:43.000000000 +0200
3163 @@ -0,0 +1,163 @@
3164 +/*
3165 + * linux/arch/arm/mach-at91/board-homematic.c
3166 + *
3167 + * Copyright (C) 2007 eQ-3 Entwicklung GmbH
3168 + *
3169 + * based on work
3170 + * Copyright (C) 2005 SAN People
3171 + *
3172 + * This program is free software; you can redistribute it and/or modify
3173 + * it under the terms of the GNU General Public License as published by
3174 + * the Free Software Foundation; either version 2 of the License, or
3175 + * (at your option) any later version.
3176 + *
3177 + * This program is distributed in the hope that it will be useful,
3178 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3179 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3180 + * GNU General Public License for more details.
3181 + *
3182 + * You should have received a copy of the GNU General Public License
3183 + * along with this program; if not, write to the Free Software
3184 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3185 + */
3186 +
3187 +#include <linux/types.h>
3188 +#include <linux/init.h>
3189 +#include <linux/mm.h>
3190 +#include <linux/module.h>
3191 +#include <linux/platform_device.h>
3192 +#include <linux/spi/spi.h>
3193 +#include <linux/mtd/physmap.h>
3194 +
3195 +#include <asm/hardware.h>
3196 +#include <asm/setup.h>
3197 +#include <asm/mach-types.h>
3198 +#include <asm/irq.h>
3199 +
3200 +#include <asm/mach/arch.h>
3201 +#include <asm/mach/map.h>
3202 +#include <asm/mach/irq.h>
3203 +
3204 +#include <asm/arch/board.h>
3205 +#include <asm/arch/gpio.h>
3206 +#include <asm/arch/at91rm9200_mc.h>
3207 +
3208 +#include "generic.h"
3209 +
3210 +
3211 +/*
3212 + * Serial port configuration.
3213 + * 0 .. 3 = USART0 .. USART3
3214 + * 4 = DBGU
3215 + */
3216 +static struct at91_uart_config __initdata homematic_uart_config = {
3217 + .console_tty = 0, /* ttyS0 */
3218 + .nr_tty = 2,
3219 + .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
3220 +};
3221 +
3222 +static void __init homematic_map_io(void)
3223 +{
3224 + /* Initialize processor: 18.432 MHz crystal */
3225 + at91rm9200_initialize(18432000, AT91RM9200_BGA);
3226 +
3227 + /* Setup the serial ports and console */
3228 + at91_init_serial(&homematic_uart_config);
3229 +}
3230 +
3231 +static void __init homematic_init_irq(void)
3232 +{
3233 + at91rm9200_init_interrupts(NULL);
3234 +}
3235 +
3236 +static struct at91_eth_data __initdata homematic_eth_data = {
3237 + .phy_irq_pin = AT91_PIN_PC4,
3238 + .is_rmii = 0,
3239 +};
3240 +
3241 +static struct at91_usbh_data __initdata homematic_usbh_data = {
3242 + .ports = 2,
3243 +};
3244 +
3245 +static struct at91_udc_data __initdata homematic_udc_data = {
3246 + .vbus_pin = AT91_PIN_PD4,
3247 + .pullup_pin = AT91_PIN_PD5,
3248 +};
3249 +
3250 +static struct at91_mmc_data __initdata homematic_mmc_data = {
3251 + .slot_b = 0,
3252 + .wire4 = 1,
3253 +};
3254 +
3255 +static struct spi_board_info homematic_spi_devices[] = {
3256 + { /* DataFlash chip */
3257 + .modalias = "mtd_dataflash",
3258 + .chip_select = 0,
3259 + .max_speed_hz = 15 * 1000 * 1000,
3260 + },
3261 +};
3262 +
3263 +static struct mtd_partition __initdata homematic_nand_partition[] = {
3264 + {
3265 + .name = "root",
3266 + .offset = 0,
3267 + .size = 0x02000000,
3268 + }, {
3269 + .name = "storage",
3270 + .offset = 0x02000000,
3271 + .size = MTDPART_SIZ_FULL,
3272 + },
3273 +};
3274 +
3275 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
3276 +{
3277 + *num_partitions = ARRAY_SIZE(homematic_nand_partition);
3278 + return homematic_nand_partition;
3279 +}
3280 +
3281 +static struct at91_nand_data __initdata homematic_nand_data = {
3282 + .ale = 22,
3283 + .cle = 21,
3284 +// .det_pin = AT91_PIN_PB1,
3285 + .rdy_pin = AT91_PIN_PC2,
3286 + .enable_pin = AT91_PIN_PC0,
3287 + .partition_info = nand_partitions,
3288 +};
3289 +
3290 +static void __init homematic_board_init(void)
3291 +{
3292 + /* Serial */
3293 + at91_add_device_serial();
3294 + /* Ethernet */
3295 + at91_add_device_eth(&homematic_eth_data);
3296 + /* USB Host */
3297 + at91_add_device_usbh(&homematic_usbh_data);
3298 + /* USB Device */
3299 + at91_add_device_udc(&homematic_udc_data);
3300 + at91_set_multi_drive(homematic_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
3301 + /* I2C */
3302 + at91_add_device_i2c(NULL, 0);
3303 + /* SPI */
3304 + at91_add_device_spi(homematic_spi_devices, ARRAY_SIZE(homematic_spi_devices));
3305 +#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
3306 + /* DataFlash card */
3307 + at91_set_gpio_output(AT91_PIN_PB7, 0);
3308 +#else
3309 + /* MMC */
3310 + at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
3311 + at91_add_device_mmc(0, &homematic_mmc_data);
3312 +#endif
3313 + /* NAND */
3314 + at91_add_device_nand(&homematic_nand_data);
3315 +}
3316 +
3317 +MACHINE_START(HOMEMATIC, "HomeMatic")
3318 + /* Maintainer: eQ-3 */
3319 + .phys_io = AT91_BASE_SYS,
3320 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
3321 + .boot_params = AT91_SDRAM_BASE + 0x100,
3322 + .timer = &at91rm9200_timer,
3323 + .map_io = homematic_map_io,
3324 + .init_irq = homematic_init_irq,
3325 + .init_machine = homematic_board_init,
3326 +MACHINE_END
3327 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-kb9202.c linux-2.6/arch/arm/mach-at91/board-kb9202.c
3328 --- linux-2.6.25/arch/arm/mach-at91/board-kb9202.c 2008-05-03 00:15:33.000000000 +0200
3329 +++ linux-2.6/arch/arm/mach-at91/board-kb9202.c 2008-04-25 21:15:43.000000000 +0200
3330 @@ -37,19 +37,10 @@
3331 #include <asm/arch/board.h>
3332 #include <asm/arch/gpio.h>
3333
3334 -#include "generic.h"
3335 +#include <asm/arch/at91rm9200_mc.h>
3336
3337 +#include "generic.h"
3338
3339 -/*
3340 - * Serial port configuration.
3341 - * 0 .. 3 = USART0 .. USART3
3342 - * 4 = DBGU
3343 - */
3344 -static struct at91_uart_config __initdata kb9202_uart_config = {
3345 - .console_tty = 0, /* ttyS0 */
3346 - .nr_tty = 3,
3347 - .tty_map = { 4, 0, 1, -1, -1 } /* ttyS0, ..., ttyS4 */
3348 -};
3349
3350 static void __init kb9202_map_io(void)
3351 {
3352 @@ -59,8 +50,20 @@
3353 /* Set up the LEDs */
3354 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
3355
3356 - /* Setup the serial ports and console */
3357 - at91_init_serial(&kb9202_uart_config);
3358 + /* DBGU on ttyS0. (Rx & Tx only) */
3359 + at91_register_uart(0, 0, 0);
3360 +
3361 + /* USART0 on ttyS1 (Rx & Tx only) */
3362 + at91_register_uart(AT91RM9200_ID_US0, 1, 0);
3363 +
3364 + /* USART1 on ttyS2 (Rx & Tx only) - IRDA (optional) */
3365 + at91_register_uart(AT91RM9200_ID_US1, 2, 0);
3366 +
3367 + /* USART3 on ttyS3 (Rx, Tx, CTS, RTS) - RS485 (optional) */
3368 + at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
3369 +
3370 + /* set serial console to ttyS0 (ie, DBGU) */
3371 + at91_set_serial_console(0);
3372 }
3373
3374 static void __init kb9202_init_irq(void)
3375 @@ -111,6 +114,48 @@
3376 .partition_info = nand_partitions,
3377 };
3378
3379 +
3380 +#if defined(CONFIG_FB_S1D15605)
3381 +#warning "The Reset pin must be passed via platform_data, not this way"
3382 +static struct resource kb9202_lcd_resources[] = {
3383 + [0] = {
3384 + .start = AT91_CHIPSELECT_2,
3385 + .end = AT91_CHIPSELECT_2 + 0x200FF,
3386 + .flags = IORESOURCE_MEM
3387 + },
3388 + [1] = { /* reset pin */
3389 + .start = AT91_PIN_PC22,
3390 + .end = AT91_PIN_PC22,
3391 + .flags = IORESOURCE_MEM
3392 + },
3393 +};
3394 +
3395 +static struct platform_device kb9202_lcd_device = {
3396 + .name = "s1d15605fb",
3397 + .id = 0,
3398 + .num_resources = ARRAY_SIZE(kb9202_lcd_resources),
3399 + .resource = kb9202_lcd_resources,
3400 +};
3401 +
3402 +static void __init kb9202_add_device_lcd(void)
3403 +{
3404 + /* In case the boot loader did not set the chip select mode and timing */
3405 + at91_sys_write(AT91_SMC_CSR(2),
3406 + AT91_SMC_WSEN | AT91_SMC_NWS_(18) | AT91_SMC_TDF_(1) | AT91_SMC_DBW_8 |
3407 + AT91_SMC_RWSETUP_(1) | AT91_SMC_RWHOLD_(1));
3408 +
3409 + /* Backlight pin = output, off */
3410 + at91_set_gpio_output(AT91_PIN_PC23, 0);
3411 +
3412 + /* Reset pin = output, in reset */
3413 + at91_set_gpio_output(AT91_PIN_PC22, 0);
3414 +
3415 + platform_device_register(&kb9202_lcd_device);
3416 +}
3417 +#else
3418 +static void __init kb9202_add_device_lcd(void) {}
3419 +#endif
3420 +
3421 static void __init kb9202_board_init(void)
3422 {
3423 /* Serial */
3424 @@ -129,6 +174,8 @@
3425 at91_add_device_spi(NULL, 0);
3426 /* NAND */
3427 at91_add_device_nand(&kb9202_nand_data);
3428 + /* LCD */
3429 + kb9202_add_device_lcd();
3430 }
3431
3432 MACHINE_START(KB9200, "KB920x")
3433 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-qil-a9260.c linux-2.6/arch/arm/mach-at91/board-qil-a9260.c
3434 --- linux-2.6.25/arch/arm/mach-at91/board-qil-a9260.c 1970-01-01 02:00:00.000000000 +0200
3435 +++ linux-2.6/arch/arm/mach-at91/board-qil-a9260.c 2008-04-25 21:15:43.000000000 +0200
3436 @@ -0,0 +1,255 @@
3437 +/*
3438 + * linux/arch/arm/mach-at91/board-qil-a9260.c
3439 + *
3440 + * Copyright (C) 2005 SAN People
3441 + * Copyright (C) 2006 Atmel
3442 + * Copyright (C) 2007 Calao-systems
3443 + *
3444 + * This program is free software; you can redistribute it and/or modify
3445 + * it under the terms of the GNU General Public License as published by
3446 + * the Free Software Foundation; either version 2 of the License, or
3447 + * (at your option) any later version.
3448 + *
3449 + * This program is distributed in the hope that it will be useful,
3450 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3451 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3452 + * GNU General Public License for more details.
3453 + *
3454 + * You should have received a copy of the GNU General Public License
3455 + * along with this program; if not, write to the Free Software
3456 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3457 + */
3458 +
3459 +#include <linux/types.h>
3460 +#include <linux/init.h>
3461 +#include <linux/mm.h>
3462 +#include <linux/module.h>
3463 +#include <linux/platform_device.h>
3464 +#include <linux/spi/spi.h>
3465 +#include <linux/gpio_keys.h>
3466 +#include <linux/input.h>
3467 +#include <linux/clk.h>
3468 +
3469 +#include <asm/hardware.h>
3470 +#include <asm/setup.h>
3471 +#include <asm/mach-types.h>
3472 +#include <asm/irq.h>
3473 +
3474 +#include <asm/mach/arch.h>
3475 +#include <asm/mach/map.h>
3476 +#include <asm/mach/irq.h>
3477 +
3478 +#include <asm/arch/board.h>
3479 +#include <asm/arch/gpio.h>
3480 +#include <asm/arch/at91_shdwc.h>
3481 +
3482 +#include "generic.h"
3483 +
3484 +
3485 +static void __init ek_map_io(void)
3486 +{
3487 + /* Initialize processor: 12.000 MHz crystal */
3488 + at91sam9260_initialize(12000000);
3489 +
3490 + /* DGBU on ttyS0. (Rx & Tx only) */
3491 + at91_register_uart(0, 0, 0);
3492 +
3493 + /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
3494 + at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
3495 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
3496 + | ATMEL_UART_RI);
3497 +
3498 + /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
3499 + at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
3500 +
3501 + /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
3502 + at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
3503 +
3504 + /* set serial console to ttyS1 (ie, USART0) */
3505 + at91_set_serial_console(1);
3506 +
3507 +}
3508 +
3509 +static void __init ek_init_irq(void)
3510 +{
3511 + at91sam9260_init_interrupts(NULL);
3512 +}
3513 +
3514 +
3515 +/*
3516 + * USB Host port
3517 + */
3518 +static struct at91_usbh_data __initdata ek_usbh_data = {
3519 + .ports = 2,
3520 +};
3521 +
3522 +/*
3523 + * USB Device port
3524 + */