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