1 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/Kconfig linux-2.6/arch/arm/mach-at91/Kconfig
2 --- linux-2.6.25/arch/arm/mach-at91/Kconfig 2008-05-03 00:15:44.000000000 +0200
3 +++ linux-2.6/arch/arm/mach-at91/Kconfig 2008-04-25 21:15:43.000000000 +0200
6 config ARCH_AT91SAM9260
7 bool "AT91SAM9260 or AT91SAM9XE"
9 + select GENERIC_CLOCKEVENTS
11 config ARCH_AT91SAM9261
14 + select GENERIC_CLOCKEVENTS
16 config ARCH_AT91SAM9263
19 + select GENERIC_CLOCKEVENTS
21 config ARCH_AT91SAM9RL
24 + select GENERIC_CLOCKEVENTS
29 + select GENERIC_CLOCKEVENTS
34 depends on ARCH_AT91RM9200
36 Select this if you are using Ajeco's 1ARM Single Board Computer.
37 - <http://www.ajeco.fi/products.htm>
38 + <http://www.ajeco.fi/eng/products_e.htm>
40 config ARCH_AT91RM9200DK
41 bool "Atmel AT91RM9200-DK Development board"
43 depends on ARCH_AT91RM9200
45 Select this if you are using KwikByte's KB920x board.
46 - <http://kwikbyte.com/KB9202_description_new.htm>
47 + <http://www.kwikbyte.com/KB9202.html>
49 config MACH_PICOTUX2XX
53 Select this if you are using Sperry-Sun's KAFA board.
56 + bool "Promwad Chub board"
57 + depends on ARCH_AT91RM9200
59 + Select this if you are using Promwad's Chub board.
61 +config MACH_HOMEMATIC
62 + bool "eQ-3 HomeMatic"
63 + depends on ARCH_AT91RM9200
65 + Select this if you are using eQ-3's HomeMatic device.
66 + <http://www.eq-3.com>
69 + bool "emQbit ECB_AT91 SBC"
70 + depends on ARCH_AT91RM9200
72 + Select this if you are using emQbit's ECB_AT91 board.
73 + <http://wiki.emqbit.com/free-ecb-at91>
76 + bool "Sweda TMS Board"
77 + depends on ARCH_AT91RM9200
79 + Select this if you are using Sweda TMS-100 board.
82 + bool "Toptech TT9200"
83 + depends on ARCH_AT91RM9200
85 + Select this if you are using Toptech's TT9200 board.
89 # ----------------------------------------------------------
91 Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit
92 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933>
95 + bool "KwikByte KB9260 (CAM60) board"
96 + depends on ARCH_AT91SAM9260
98 + Select this if you are using KwikByte's KB9260 (CAM60) board based on the Atmel AT91SAM9260.
99 + <http://www.kwikbyte.com/KB9260.html>
101 +config MACH_SAM9_L9260
102 + bool "Olimex SAM9-L9260 board"
103 + depends on ARCH_AT91SAM9260
105 + Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260.
106 + <http://www.olimex.com/dev/sam9-L9260.html>
108 +config MACH_USB_A9260
109 + bool "CALAO USB-A9260"
110 + depends on ARCH_AT91SAM9260
112 + Select this if you are using a Calao Systems USB-A9260.
113 + <http://www.calao-systems.com>
115 +config MACH_QIL_A9260
116 + bool "CALAO QIL-A9260 board"
117 + depends on ARCH_AT91SAM9260
119 + Select this if you are using a Calao Systems QIL-A9260 Board.
120 + <http://www.calao-systems.com>
124 # ----------------------------------------------------------
126 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
127 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
129 +config MACH_USB_A9263
130 + bool "CALAO USB-A9263"
131 + depends on ARCH_AT91SAM9263
133 + Select this if you are using a Calao Systems USB-A9263.
134 + <http://www.calao-systems.com>
138 # ----------------------------------------------------------
141 config MTD_AT91_DATAFLASH_CARD
142 bool "Enable DataFlash Card support"
143 - depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK)
144 + depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_ECBAT91 || MACH_SAM9_L9260 || MACH_AT91CAP9ADK)
146 Enable support for the DataFlash card.
149 Select this if you need to program one or more of the PCK0..PCK3
150 programmable clock outputs.
152 +config AT91_SLOW_CLOCK
153 + bool "Suspend-to-RAM disables main oscillator"
156 + Select this if you want Suspend-to-RAM to save the most power
157 + possible (without powering off the CPU) by disabling the PLLs
158 + and main oscillator so that only the 32 KiHz clock is available.
160 + When only that slow-clock is available, some peripherals lose
161 + functionality. Many can't issue wakeup events unless faster
162 + clocks are available. Some lose their operating state and
163 + need to be completely re-initialized.
166 int "Kernel HZ (jiffies per second)"
168 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/Makefile linux-2.6/arch/arm/mach-at91/Makefile
169 --- linux-2.6.25/arch/arm/mach-at91/Makefile 2008-05-03 00:15:44.000000000 +0200
170 +++ linux-2.6/arch/arm/mach-at91/Makefile 2008-04-25 21:15:43.000000000 +0200
172 obj-$(CONFIG_MACH_KB9200) += board-kb9202.o
173 obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o
174 obj-$(CONFIG_MACH_KAFA) += board-kafa.o
175 +obj-$(CONFIG_MACH_CHUB) += board-chub.o
176 obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o
177 +obj-$(CONFIG_MACH_HOMEMATIC) += board-homematic.o
178 +obj-$(CONFIG_MACH_ECBAT91) += board-ecbat91.o
179 +obj-$(CONFIG_MACH_SWEDATMS) += board-tms.o
180 +obj-$(CONFIG_MACH_TT9200) += board-tt9200.o
182 # AT91SAM9260 board-specific support
183 obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
184 +obj-$(CONFIG_MACH_CAM60) += board-cam60.o
185 +obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
186 +obj-$(CONFIG_MACH_USB_A9260) += board-usb-a9260.o
187 +obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
189 # AT91SAM9261 board-specific support
190 obj-$(CONFIG_MACH_AT91SAM9261EK) += board-sam9261ek.o
192 # AT91SAM9263 board-specific support
193 obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
194 +obj-$(CONFIG_MACH_USB_A9263) += board-usb-a9263.o
196 # AT91SAM9RL board-specific support
197 obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
202 +obj-$(CONFIG_FB_S1D13XXX) += ics1523.o
205 obj-$(CONFIG_PM) += pm.o
206 +obj-$(CONFIG_AT91_SLOW_CLOCK) += pm_slowclock.o
208 ifeq ($(CONFIG_PM_DEBUG),y)
209 CFLAGS_pm.o += -DDEBUG
210 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91cap9.c linux-2.6/arch/arm/mach-at91/at91cap9.c
211 --- linux-2.6.25/arch/arm/mach-at91/at91cap9.c 2008-05-03 00:15:44.000000000 +0200
212 +++ linux-2.6/arch/arm/mach-at91/at91cap9.c 2008-05-05 22:01:39.000000000 +0200
216 #include <linux/module.h>
217 +#include <linux/pm.h>
219 #include <asm/mach/arch.h>
220 #include <asm/mach/map.h>
221 +#include <asm/arch/cpu.h>
222 #include <asm/arch/at91cap9.h>
223 #include <asm/arch/at91_pmc.h>
224 #include <asm/arch/at91_rstc.h>
225 +#include <asm/arch/at91_shdwc.h>
230 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
233 +static void at91cap9_poweroff(void)
235 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
239 /* --------------------------------------------------------------------
240 * AT91CAP9 processor initialization
241 * -------------------------------------------------------------------- */
243 iotable_init(at91cap9_io_desc, ARRAY_SIZE(at91cap9_io_desc));
245 at91_arch_reset = at91cap9_reset;
246 + pm_power_off = at91cap9_poweroff;
247 at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
249 /* Init clock subsystem */
252 /* Register GPIO subsystem */
253 at91_gpio_init(at91cap9_gpio, 4);
255 + /* Remember the silicon revision */
256 + if (cpu_is_at91cap9_revB())
258 + else if (cpu_is_at91cap9_revC())
262 /* --------------------------------------------------------------------
263 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91cap9_devices.c linux-2.6/arch/arm/mach-at91/at91cap9_devices.c
264 --- linux-2.6.25/arch/arm/mach-at91/at91cap9_devices.c 2008-05-03 00:15:44.000000000 +0200
265 +++ linux-2.6/arch/arm/mach-at91/at91cap9_devices.c 2008-05-05 22:01:39.000000000 +0200
268 #include <asm/mach/arch.h>
269 #include <asm/mach/map.h>
270 +#include <asm/mach/irq.h>
272 #include <linux/dma-mapping.h>
273 #include <linux/platform_device.h>
274 -#include <linux/mtd/physmap.h>
275 +#include <linux/i2c-gpio.h>
277 #include <video/atmel_lcdc.h>
279 #include <asm/arch/board.h>
280 +#include <asm/arch/cpu.h>
281 #include <asm/arch/gpio.h>
282 #include <asm/arch/at91cap9.h>
283 -#include <asm/arch/at91sam926x_mc.h>
284 #include <asm/arch/at91cap9_matrix.h>
285 +#include <asm/arch/at91sam9_smc.h>
293 + if (cpu_is_at91cap9_revB())
294 + set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH);
296 /* Enable VBus control for UHP ports */
297 for (i = 0; i < data->ports; i++) {
298 if (data->vbus_pin[i])
302 /* --------------------------------------------------------------------
303 + * USB HS Device (Gadget)
304 + * -------------------------------------------------------------------- */
306 +#if defined(CONFIG_USB_GADGET_ATMEL_USBA) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE)
308 +static struct resource usba_udc_resources[] = {
310 + .start = AT91CAP9_UDPHS_FIFO,
311 + .end = AT91CAP9_UDPHS_FIFO + SZ_512K - 1,
312 + .flags = IORESOURCE_MEM,
315 + .start = AT91CAP9_BASE_UDPHS,
316 + .end = AT91CAP9_BASE_UDPHS + SZ_1K - 1,
317 + .flags = IORESOURCE_MEM,
320 + .start = AT91CAP9_ID_UDPHS,
321 + .end = AT91CAP9_ID_UDPHS,
322 + .flags = IORESOURCE_IRQ,
326 +#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
330 + .fifo_size = maxpkt, \
331 + .nr_banks = maxbk, \
333 + .can_isoc = isoc, \
336 +static struct usba_ep_data usba_udc_ep[] = {
337 + EP("ep0", 0, 64, 1, 0, 0),
338 + EP("ep1", 1, 1024, 3, 1, 1),
339 + EP("ep2", 2, 1024, 3, 1, 1),
340 + EP("ep3", 3, 1024, 2, 1, 1),
341 + EP("ep4", 4, 1024, 2, 1, 1),
342 + EP("ep5", 5, 1024, 2, 1, 0),
343 + EP("ep6", 6, 1024, 2, 1, 0),
344 + EP("ep7", 7, 1024, 2, 0, 0),
350 + * pdata doesn't have room for any endpoints, so we need to
351 + * append room for the ones we need right after it.
354 + struct usba_platform_data pdata;
355 + struct usba_ep_data ep[8];
358 +static struct platform_device at91_usba_udc_device = {
359 + .name = "atmel_usba_udc",
362 + .platform_data = &usba_udc_data.pdata,
364 + .resource = usba_udc_resources,
365 + .num_resources = ARRAY_SIZE(usba_udc_resources),
368 +void __init at91_add_device_usba(struct usba_platform_data *data)
370 + if (cpu_is_at91cap9_revB()) {
371 + set_irq_type(AT91CAP9_ID_UDPHS, IRQT_HIGH);
372 + at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS |
373 + AT91_MATRIX_UDPHS_BYPASS_LOCK);
376 + at91_sys_write(AT91_MATRIX_UDPHS, AT91_MATRIX_SELECT_UDPHS);
379 + * Invalid pins are 0 on AT91, but the usba driver is shared
380 + * with AVR32, which use negative values instead. Once/if
381 + * gpio_is_valid() is ported to AT91, revisit this code.
383 + usba_udc_data.pdata.vbus_pin = -EINVAL;
384 + usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
385 + memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));;
387 + if (data && data->vbus_pin > 0) {
388 + at91_set_gpio_input(data->vbus_pin, 0);
389 + at91_set_deglitch(data->vbus_pin, 1);
390 + usba_udc_data.pdata.vbus_pin = data->vbus_pin;
393 + /* Pullup pin is handled internally by USB device peripheral */
396 + at91_clock_associate("utmi_clk", &at91_usba_udc_device.dev, "hclk");
397 + at91_clock_associate("udphs_clk", &at91_usba_udc_device.dev, "pclk");
399 + platform_device_register(&at91_usba_udc_device);
402 +void __init at91_add_device_usba(struct usba_platform_data *data) {}
406 +/* --------------------------------------------------------------------
408 * -------------------------------------------------------------------- */
414 - at91_clock_associate("mci0_clk", &at91cap9_mmc1_device.dev, "mci_clk");
415 + at91_clock_associate("mci0_clk", &at91cap9_mmc0_device.dev, "mci_clk");
416 platform_device_register(&at91cap9_mmc0_device);
419 @@ -283,10 +392,15 @@
420 #define NAND_BASE AT91_CHIPSELECT_3
422 static struct resource nand_resources[] = {
426 .end = NAND_BASE + SZ_256M - 1,
427 .flags = IORESOURCE_MEM,
430 + .start = AT91_BASE_SYS + AT91_ECC,
431 + .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1,
432 + .flags = IORESOURCE_MEM,
437 void __init at91_add_device_nand(struct at91_nand_data *data) {}
441 /* --------------------------------------------------------------------
443 * -------------------------------------------------------------------- */
444 @@ -532,17 +647,64 @@
447 /* --------------------------------------------------------------------
448 + * Timer/Counter block
449 + * -------------------------------------------------------------------- */
451 +#ifdef CONFIG_ATMEL_TCLIB
453 +static struct resource tcb_resources[] = {
455 + .start = AT91CAP9_BASE_TCB0,
456 + .end = AT91CAP9_BASE_TCB0 + SZ_16K - 1,
457 + .flags = IORESOURCE_MEM,
460 + .start = AT91CAP9_ID_TCB,
461 + .end = AT91CAP9_ID_TCB,
462 + .flags = IORESOURCE_IRQ,
466 +static struct platform_device at91cap9_tcb_device = {
467 + .name = "atmel_tcb",
469 + .resource = tcb_resources,
470 + .num_resources = ARRAY_SIZE(tcb_resources),
473 +static void __init at91_add_device_tc(void)
475 + /* this chip has one clock and irq for all three TC channels */
476 + at91_clock_associate("tcb_clk", &at91cap9_tcb_device.dev, "t0_clk");
477 + platform_device_register(&at91cap9_tcb_device);
480 +static void __init at91_add_device_tc(void) { }
484 +/* --------------------------------------------------------------------
486 * -------------------------------------------------------------------- */
488 +static struct resource rtt_resources[] = {
490 + .start = AT91_BASE_SYS + AT91_RTT,
491 + .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
492 + .flags = IORESOURCE_MEM,
496 static struct platform_device at91cap9_rtt_device = {
499 - .num_resources = 0,
501 + .resource = rtt_resources,
502 + .num_resources = ARRAY_SIZE(rtt_resources),
505 static void __init at91_add_device_rtt(void)
507 + device_init_wakeup(&at91cap9_rtt_device.dev, 1);
508 platform_device_register(&at91cap9_rtt_device);
515 + if (cpu_is_at91cap9_revB())
516 + set_irq_type(AT91CAP9_ID_LCDC, IRQT_HIGH);
518 at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
519 at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
520 at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
522 at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */
525 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
526 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
527 struct platform_device *atmel_default_console_device; /* the serial console device */
529 void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
530 @@ -1031,8 +1196,6 @@
532 if (portnr < ATMEL_MAX_UART)
533 atmel_default_console_device = at91_uarts[portnr];
534 - if (!atmel_default_console_device)
535 - printk(KERN_INFO "AT91: No default serial console defined.\n");
538 void __init at91_add_device_serial(void)
539 @@ -1043,6 +1206,9 @@
541 platform_device_register(at91_uarts[i]);
544 + if (!atmel_default_console_device)
545 + printk(KERN_INFO "AT91: No default serial console defined.\n");
548 void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
549 @@ -1060,6 +1226,7 @@
551 at91_add_device_rtt();
552 at91_add_device_watchdog();
553 + at91_add_device_tc();
557 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91rm9200_devices.c linux-2.6/arch/arm/mach-at91/at91rm9200_devices.c
558 --- linux-2.6.25/arch/arm/mach-at91/at91rm9200_devices.c 2008-05-03 00:15:44.000000000 +0200
559 +++ linux-2.6/arch/arm/mach-at91/at91rm9200_devices.c 2008-04-25 21:15:43.000000000 +0200
562 * -------------------------------------------------------------------- */
564 -#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
565 +#if defined(CONFIG_AT91_SPI) || defined(CONFIG_AT91_SPI_MODULE) /* legacy SPI driver */
566 +#define SPI_DEVNAME "at91_spi"
568 +#elif defined(CONFIG_SPI_AT91) || defined(CONFIG_SPI_AT91_MODULE) /* SPI bitbanging driver */
569 +#define SPI_DEVNAME "at91_spi"
571 +#elif defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) /* new SPI driver */
572 +#define SPI_DEVNAME "atmel_spi"
577 static u64 spi_dmamask = DMA_BIT_MASK(32);
579 static struct resource spi_resources[] = {
583 static struct platform_device at91rm9200_spi_device = {
584 - .name = "atmel_spi",
585 + .name = SPI_DEVNAME,
588 .dma_mask = &spi_dmamask,
591 at91_set_gpio_output(cs_pin, 1);
593 +#if defined(CONFIG_AT91_SPI) || defined(CONFIG_AT91_SPI_MODULE)
595 + * Force peripheral mode when using the legacy SPI driver.
597 + at91_set_A_periph(cs_pin, 0);
600 /* pass chip-select pin to driver */
601 devices[i].controller_data = (void *) cs_pin;
605 /* --------------------------------------------------------------------
606 + * Timer/Counter blocks
607 + * -------------------------------------------------------------------- */
609 +#ifdef CONFIG_ATMEL_TCLIB
611 +static struct resource tcb0_resources[] = {
613 + .start = AT91RM9200_BASE_TCB0,
614 + .end = AT91RM9200_BASE_TCB0 + SZ_16K - 1,
615 + .flags = IORESOURCE_MEM,
618 + .start = AT91RM9200_ID_TC0,
619 + .end = AT91RM9200_ID_TC0,
620 + .flags = IORESOURCE_IRQ,
623 + .start = AT91RM9200_ID_TC1,
624 + .end = AT91RM9200_ID_TC1,
625 + .flags = IORESOURCE_IRQ,
628 + .start = AT91RM9200_ID_TC2,
629 + .end = AT91RM9200_ID_TC2,
630 + .flags = IORESOURCE_IRQ,
634 +static struct platform_device at91rm9200_tcb0_device = {
635 + .name = "atmel_tcb",
637 + .resource = tcb0_resources,
638 + .num_resources = ARRAY_SIZE(tcb0_resources),
641 +static struct resource tcb1_resources[] = {
643 + .start = AT91RM9200_BASE_TCB1,
644 + .end = AT91RM9200_BASE_TCB1 + SZ_16K - 1,
645 + .flags = IORESOURCE_MEM,
648 + .start = AT91RM9200_ID_TC3,
649 + .end = AT91RM9200_ID_TC3,
650 + .flags = IORESOURCE_IRQ,
653 + .start = AT91RM9200_ID_TC4,
654 + .end = AT91RM9200_ID_TC4,
655 + .flags = IORESOURCE_IRQ,
658 + .start = AT91RM9200_ID_TC5,
659 + .end = AT91RM9200_ID_TC5,
660 + .flags = IORESOURCE_IRQ,
664 +static struct platform_device at91rm9200_tcb1_device = {
665 + .name = "atmel_tcb",
667 + .resource = tcb1_resources,
668 + .num_resources = ARRAY_SIZE(tcb1_resources),
671 +static void __init at91_add_device_tc(void)
673 + /* this chip has a separate clock and irq for each TC channel */
674 + at91_clock_associate("tc0_clk", &at91rm9200_tcb0_device.dev, "t0_clk");
675 + at91_clock_associate("tc1_clk", &at91rm9200_tcb0_device.dev, "t1_clk");
676 + at91_clock_associate("tc2_clk", &at91rm9200_tcb0_device.dev, "t2_clk");
677 + platform_device_register(&at91rm9200_tcb0_device);
679 + at91_clock_associate("tc3_clk", &at91rm9200_tcb1_device.dev, "t0_clk");
680 + at91_clock_associate("tc4_clk", &at91rm9200_tcb1_device.dev, "t1_clk");
681 + at91_clock_associate("tc5_clk", &at91rm9200_tcb1_device.dev, "t2_clk");
682 + platform_device_register(&at91rm9200_tcb1_device);
685 +static void __init at91_add_device_tc(void) { }
689 +/* --------------------------------------------------------------------
691 * -------------------------------------------------------------------- */
695 static void __init at91_add_device_rtc(void)
697 + device_init_wakeup(&at91rm9200_rtc_device.dev, 1);
698 platform_device_register(&at91rm9200_rtc_device);
701 @@ -1019,7 +1121,7 @@
702 at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */
705 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
706 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
707 struct platform_device *atmel_default_console_device; /* the serial console device */
709 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
710 @@ -1110,8 +1212,6 @@
712 if (portnr < ATMEL_MAX_UART)
713 atmel_default_console_device = at91_uarts[portnr];
714 - if (!atmel_default_console_device)
715 - printk(KERN_INFO "AT91: No default serial console defined.\n");
718 void __init at91_add_device_serial(void)
719 @@ -1122,6 +1222,9 @@
721 platform_device_register(at91_uarts[i]);
724 + if (!atmel_default_console_device)
725 + printk(KERN_INFO "AT91: No default serial console defined.\n");
728 void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
729 @@ -1141,6 +1244,7 @@
731 at91_add_device_rtc();
732 at91_add_device_watchdog();
733 + at91_add_device_tc();
737 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91rm9200_time.c linux-2.6/arch/arm/mach-at91/at91rm9200_time.c
738 --- linux-2.6.25/arch/arm/mach-at91/at91rm9200_time.c 2008-05-03 00:15:33.000000000 +0200
739 +++ linux-2.6/arch/arm/mach-at91/at91rm9200_time.c 2008-04-25 21:15:43.000000000 +0200
746 /* Use "raw" primitives so we behave correctly on RT kernels. */
747 raw_local_irq_save(flags);
749 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9260.c linux-2.6/arch/arm/mach-at91/at91sam9260.c
750 --- linux-2.6.25/arch/arm/mach-at91/at91sam9260.c 2008-05-03 00:15:44.000000000 +0200
751 +++ linux-2.6/arch/arm/mach-at91/at91sam9260.c 2008-04-25 21:15:43.000000000 +0200
755 #include <linux/module.h>
756 +#include <linux/pm.h>
758 #include <asm/mach/arch.h>
759 #include <asm/mach/map.h>
761 #include <asm/arch/at91sam9260.h>
762 #include <asm/arch/at91_pmc.h>
763 #include <asm/arch/at91_rstc.h>
764 +#include <asm/arch/at91_shdwc.h>
769 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
772 +static void at91sam9260_poweroff(void)
774 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
778 /* --------------------------------------------------------------------
779 * AT91SAM9260 processor initialization
781 iotable_init(at91sam9260_sram_desc, ARRAY_SIZE(at91sam9260_sram_desc));
783 at91_arch_reset = at91sam9260_reset;
784 + pm_power_off = at91sam9260_poweroff;
785 at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
786 | (1 << AT91SAM9260_ID_IRQ2);
788 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9260_devices.c linux-2.6/arch/arm/mach-at91/at91sam9260_devices.c
789 --- linux-2.6.25/arch/arm/mach-at91/at91sam9260_devices.c 2008-05-03 00:15:44.000000000 +0200
790 +++ linux-2.6/arch/arm/mach-at91/at91sam9260_devices.c 2008-04-25 21:15:43.000000000 +0200
792 #include <asm/arch/board.h>
793 #include <asm/arch/gpio.h>
794 #include <asm/arch/at91sam9260.h>
795 -#include <asm/arch/at91sam926x_mc.h>
796 #include <asm/arch/at91sam9260_matrix.h>
797 +#include <asm/arch/at91sam9_smc.h>
801 @@ -288,10 +288,15 @@
802 #define NAND_BASE AT91_CHIPSELECT_3
804 static struct resource nand_resources[] = {
808 .end = NAND_BASE + SZ_256M - 1,
809 .flags = IORESOURCE_MEM,
812 + .start = AT91_BASE_SYS + AT91_ECC,
813 + .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1,
814 + .flags = IORESOURCE_MEM,
821 /* --------------------------------------------------------------------
822 + * Timer/Counter blocks
823 + * -------------------------------------------------------------------- */
825 +#ifdef CONFIG_ATMEL_TCLIB
827 +static struct resource tcb0_resources[] = {
829 + .start = AT91SAM9260_BASE_TCB0,
830 + .end = AT91SAM9260_BASE_TCB0 + SZ_16K - 1,
831 + .flags = IORESOURCE_MEM,
834 + .start = AT91SAM9260_ID_TC0,
835 + .end = AT91SAM9260_ID_TC0,
836 + .flags = IORESOURCE_IRQ,
839 + .start = AT91SAM9260_ID_TC1,
840 + .end = AT91SAM9260_ID_TC1,
841 + .flags = IORESOURCE_IRQ,
844 + .start = AT91SAM9260_ID_TC2,
845 + .end = AT91SAM9260_ID_TC2,
846 + .flags = IORESOURCE_IRQ,
850 +static struct platform_device at91sam9260_tcb0_device = {
851 + .name = "atmel_tcb",
853 + .resource = tcb0_resources,
854 + .num_resources = ARRAY_SIZE(tcb0_resources),
857 +static struct resource tcb1_resources[] = {
859 + .start = AT91SAM9260_BASE_TCB1,
860 + .end = AT91SAM9260_BASE_TCB1 + SZ_16K - 1,
861 + .flags = IORESOURCE_MEM,
864 + .start = AT91SAM9260_ID_TC3,
865 + .end = AT91SAM9260_ID_TC3,
866 + .flags = IORESOURCE_IRQ,
869 + .start = AT91SAM9260_ID_TC4,
870 + .end = AT91SAM9260_ID_TC4,
871 + .flags = IORESOURCE_IRQ,
874 + .start = AT91SAM9260_ID_TC5,
875 + .end = AT91SAM9260_ID_TC5,
876 + .flags = IORESOURCE_IRQ,
880 +static struct platform_device at91sam9260_tcb1_device = {
881 + .name = "atmel_tcb",
883 + .resource = tcb1_resources,
884 + .num_resources = ARRAY_SIZE(tcb1_resources),
887 +static void __init at91_add_device_tc(void)
889 + /* this chip has a separate clock and irq for each TC channel */
890 + at91_clock_associate("tc0_clk", &at91sam9260_tcb0_device.dev, "t0_clk");
891 + at91_clock_associate("tc1_clk", &at91sam9260_tcb0_device.dev, "t1_clk");
892 + at91_clock_associate("tc2_clk", &at91sam9260_tcb0_device.dev, "t2_clk");
893 + platform_device_register(&at91sam9260_tcb0_device);
895 + at91_clock_associate("tc3_clk", &at91sam9260_tcb1_device.dev, "t0_clk");
896 + at91_clock_associate("tc4_clk", &at91sam9260_tcb1_device.dev, "t1_clk");
897 + at91_clock_associate("tc5_clk", &at91sam9260_tcb1_device.dev, "t2_clk");
898 + platform_device_register(&at91sam9260_tcb1_device);
901 +static void __init at91_add_device_tc(void) { }
905 +/* --------------------------------------------------------------------
907 * -------------------------------------------------------------------- */
909 @@ -553,13 +642,14 @@
911 static struct platform_device at91sam9260_rtt_device = {
915 .resource = rtt_resources,
916 .num_resources = ARRAY_SIZE(rtt_resources),
919 static void __init at91_add_device_rtt(void)
921 + device_init_wakeup(&at91sam9260_rtt_device.dev, 1);
922 platform_device_register(&at91sam9260_rtt_device);
926 at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */
929 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
930 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
931 struct platform_device *atmel_default_console_device; /* the serial console device */
933 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
934 @@ -1073,8 +1163,6 @@
936 if (portnr < ATMEL_MAX_UART)
937 atmel_default_console_device = at91_uarts[portnr];
938 - if (!atmel_default_console_device)
939 - printk(KERN_INFO "AT91: No default serial console defined.\n");
942 void __init at91_add_device_serial(void)
943 @@ -1085,6 +1173,9 @@
945 platform_device_register(at91_uarts[i]);
948 + if (!atmel_default_console_device)
949 + printk(KERN_INFO "AT91: No default serial console defined.\n");
952 void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
953 @@ -1103,6 +1194,7 @@
955 at91_add_device_rtt();
956 at91_add_device_watchdog();
957 + at91_add_device_tc();
961 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9261.c linux-2.6/arch/arm/mach-at91/at91sam9261.c
962 --- linux-2.6.25/arch/arm/mach-at91/at91sam9261.c 2008-05-03 00:15:44.000000000 +0200
963 +++ linux-2.6/arch/arm/mach-at91/at91sam9261.c 2008-04-25 21:15:43.000000000 +0200
967 #include <linux/module.h>
968 +#include <linux/pm.h>
970 #include <asm/mach/arch.h>
971 #include <asm/mach/map.h>
972 #include <asm/arch/at91sam9261.h>
973 #include <asm/arch/at91_pmc.h>
974 #include <asm/arch/at91_rstc.h>
975 +#include <asm/arch/at91_shdwc.h>
980 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
983 +static void at91sam9261_poweroff(void)
985 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
989 /* --------------------------------------------------------------------
990 * AT91SAM9261 processor initialization
992 iotable_init(at91sam9261_io_desc, ARRAY_SIZE(at91sam9261_io_desc));
994 at91_arch_reset = at91sam9261_reset;
995 + pm_power_off = at91sam9261_poweroff;
996 at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
997 | (1 << AT91SAM9261_ID_IRQ2);
999 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9261_devices.c linux-2.6/arch/arm/mach-at91/at91sam9261_devices.c
1000 --- linux-2.6.25/arch/arm/mach-at91/at91sam9261_devices.c 2008-05-03 00:15:44.000000000 +0200
1001 +++ linux-2.6/arch/arm/mach-at91/at91sam9261_devices.c 2008-04-25 21:15:43.000000000 +0200
1003 #include <asm/arch/gpio.h>
1004 #include <asm/arch/at91sam9261.h>
1005 #include <asm/arch/at91sam9261_matrix.h>
1006 -#include <asm/arch/at91sam926x_mc.h>
1007 +#include <asm/arch/at91sam9_smc.h>
1009 #include "generic.h"
1011 @@ -548,6 +548,55 @@
1014 /* --------------------------------------------------------------------
1015 + * Timer/Counter block
1016 + * -------------------------------------------------------------------- */
1018 +#ifdef CONFIG_ATMEL_TCLIB
1020 +static struct resource tcb_resources[] = {
1022 + .start = AT91SAM9261_BASE_TCB0,
1023 + .end = AT91SAM9261_BASE_TCB0 + SZ_16K - 1,
1024 + .flags = IORESOURCE_MEM,
1027 + .start = AT91SAM9261_ID_TC0,
1028 + .end = AT91SAM9261_ID_TC0,
1029 + .flags = IORESOURCE_IRQ,
1032 + .start = AT91SAM9261_ID_TC1,
1033 + .end = AT91SAM9261_ID_TC1,
1034 + .flags = IORESOURCE_IRQ,
1037 + .start = AT91SAM9261_ID_TC2,
1038 + .end = AT91SAM9261_ID_TC2,
1039 + .flags = IORESOURCE_IRQ,
1043 +static struct platform_device at91sam9261_tcb_device = {
1044 + .name = "atmel_tcb",
1046 + .resource = tcb_resources,
1047 + .num_resources = ARRAY_SIZE(tcb_resources),
1050 +static void __init at91_add_device_tc(void)
1052 + /* this chip has a separate clock and irq for each TC channel */
1053 + at91_clock_associate("tc0_clk", &at91sam9261_tcb_device.dev, "t0_clk");
1054 + at91_clock_associate("tc1_clk", &at91sam9261_tcb_device.dev, "t1_clk");
1055 + at91_clock_associate("tc2_clk", &at91sam9261_tcb_device.dev, "t2_clk");
1056 + platform_device_register(&at91sam9261_tcb_device);
1059 +static void __init at91_add_device_tc(void) { }
1063 +/* --------------------------------------------------------------------
1065 * -------------------------------------------------------------------- */
1067 @@ -561,13 +610,14 @@
1069 static struct platform_device at91sam9261_rtt_device = {
1073 .resource = rtt_resources,
1074 .num_resources = ARRAY_SIZE(rtt_resources),
1077 static void __init at91_add_device_rtt(void)
1079 + device_init_wakeup(&at91sam9261_rtt_device.dev, 1);
1080 platform_device_register(&at91sam9261_rtt_device);
1084 at91_set_B_periph(AT91_PIN_PA16, 0); /* CTS2 */
1087 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1088 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1089 struct platform_device *atmel_default_console_device; /* the serial console device */
1091 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
1092 @@ -1019,8 +1069,6 @@
1094 if (portnr < ATMEL_MAX_UART)
1095 atmel_default_console_device = at91_uarts[portnr];
1096 - if (!atmel_default_console_device)
1097 - printk(KERN_INFO "AT91: No default serial console defined.\n");
1100 void __init at91_add_device_serial(void)
1101 @@ -1031,6 +1079,9 @@
1103 platform_device_register(at91_uarts[i]);
1106 + if (!atmel_default_console_device)
1107 + printk(KERN_INFO "AT91: No default serial console defined.\n");
1110 void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1111 @@ -1050,6 +1101,7 @@
1113 at91_add_device_rtt();
1114 at91_add_device_watchdog();
1115 + at91_add_device_tc();
1119 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9263.c linux-2.6/arch/arm/mach-at91/at91sam9263.c
1120 --- linux-2.6.25/arch/arm/mach-at91/at91sam9263.c 2008-05-03 00:15:44.000000000 +0200
1121 +++ linux-2.6/arch/arm/mach-at91/at91sam9263.c 2008-04-25 21:15:43.000000000 +0200
1125 #include <linux/module.h>
1126 +#include <linux/pm.h>
1128 #include <asm/mach/arch.h>
1129 #include <asm/mach/map.h>
1130 #include <asm/arch/at91sam9263.h>
1131 #include <asm/arch/at91_pmc.h>
1132 #include <asm/arch/at91_rstc.h>
1133 +#include <asm/arch/at91_shdwc.h>
1135 #include "generic.h"
1137 @@ -271,6 +273,11 @@
1138 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
1141 +static void at91sam9263_poweroff(void)
1143 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
1147 /* --------------------------------------------------------------------
1148 * AT91SAM9263 processor initialization
1150 iotable_init(at91sam9263_io_desc, ARRAY_SIZE(at91sam9263_io_desc));
1152 at91_arch_reset = at91sam9263_reset;
1153 + pm_power_off = at91sam9263_poweroff;
1154 at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
1156 /* Init clock subsystem */
1157 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9263_devices.c linux-2.6/arch/arm/mach-at91/at91sam9263_devices.c
1158 --- linux-2.6.25/arch/arm/mach-at91/at91sam9263_devices.c 2008-05-03 00:15:44.000000000 +0200
1159 +++ linux-2.6/arch/arm/mach-at91/at91sam9263_devices.c 2008-04-25 21:16:23.000000000 +0200
1161 #include <asm/arch/board.h>
1162 #include <asm/arch/gpio.h>
1163 #include <asm/arch/at91sam9263.h>
1164 -#include <asm/arch/at91sam926x_mc.h>
1165 #include <asm/arch/at91sam9263_matrix.h>
1166 +#include <asm/arch/at91sam9_smc.h>
1168 #include "generic.h"
1174 - at91_clock_associate("mci0_clk", &at91sam9263_mmc1_device.dev, "mci_clk");
1175 + at91_clock_associate("mci0_clk", &at91sam9263_mmc0_device.dev, "mci_clk");
1176 platform_device_register(&at91sam9263_mmc0_device);
1179 @@ -358,10 +358,15 @@
1180 #define NAND_BASE AT91_CHIPSELECT_3
1182 static struct resource nand_resources[] = {
1186 .end = NAND_BASE + SZ_256M - 1,
1187 .flags = IORESOURCE_MEM,
1190 + .start = AT91_BASE_SYS + AT91_ECC0,
1191 + .end = AT91_BASE_SYS + AT91_ECC0 + SZ_512 - 1,
1192 + .flags = IORESOURCE_MEM,
1196 @@ -783,6 +788,43 @@
1199 /* --------------------------------------------------------------------
1200 + * Timer/Counter block
1201 + * -------------------------------------------------------------------- */
1203 +#ifdef CONFIG_ATMEL_TCLIB
1205 +static struct resource tcb_resources[] = {
1207 + .start = AT91SAM9263_BASE_TCB0,
1208 + .end = AT91SAM9263_BASE_TCB0 + SZ_16K - 1,
1209 + .flags = IORESOURCE_MEM,
1212 + .start = AT91SAM9263_ID_TCB,
1213 + .end = AT91SAM9263_ID_TCB,
1214 + .flags = IORESOURCE_IRQ,
1218 +static struct platform_device at91sam9263_tcb_device = {
1219 + .name = "atmel_tcb",
1221 + .resource = tcb_resources,
1222 + .num_resources = ARRAY_SIZE(tcb_resources),
1225 +static void __init at91_add_device_tc(void)
1227 + /* this chip has one clock and irq for all three TC channels */
1228 + at91_clock_associate("tcb_clk", &at91sam9263_tcb_device.dev, "t0_clk");
1229 + platform_device_register(&at91sam9263_tcb_device);
1232 +static void __init at91_add_device_tc(void) { }
1236 +/* --------------------------------------------------------------------
1238 * -------------------------------------------------------------------- */
1242 static void __init at91_add_device_rtt(void)
1244 + device_init_wakeup(&at91sam9263_rtt0_device.dev, 1);
1245 platform_device_register(&at91sam9263_rtt0_device);
1246 + device_init_wakeup(&at91sam9263_rtt1_device.dev, 1);
1247 platform_device_register(&at91sam9263_rtt1_device);
1254 - * Return the device node so that board init code can use it as the
1255 - * parent for the device node reflecting how it's used on this board.
1257 * SSC controllers are accessed through library code, instead of any
1258 * kind of all-singing/all-dancing driver. For example one could be
1259 * used by a particular I2S audio codec's driver, while another one
1260 @@ -1146,7 +1187,7 @@
1261 at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */
1264 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1265 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1266 struct platform_device *atmel_default_console_device; /* the serial console device */
1268 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
1269 @@ -1227,8 +1268,6 @@
1271 if (portnr < ATMEL_MAX_UART)
1272 atmel_default_console_device = at91_uarts[portnr];
1273 - if (!atmel_default_console_device)
1274 - printk(KERN_INFO "AT91: No default serial console defined.\n");
1277 void __init at91_add_device_serial(void)
1278 @@ -1239,9 +1278,12 @@
1280 platform_device_register(at91_uarts[i]);
1283 + if (!atmel_default_console_device)
1284 + printk(KERN_INFO "AT91: No default serial console defined.\n");
1287 -void __init at91_init_serial(struct at91_uart_config *config) {}
1288 +void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1289 void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1290 void __init at91_set_serial_console(unsigned portnr) {}
1291 void __init at91_add_device_serial(void) {}
1292 @@ -1257,6 +1299,7 @@
1294 at91_add_device_rtt();
1295 at91_add_device_watchdog();
1296 + at91_add_device_tc();
1300 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam926x_time.c linux-2.6/arch/arm/mach-at91/at91sam926x_time.c
1301 --- linux-2.6.25/arch/arm/mach-at91/at91sam926x_time.c 2008-05-03 00:15:44.000000000 +0200
1302 +++ linux-2.6/arch/arm/mach-at91/at91sam926x_time.c 2008-04-25 21:15:43.000000000 +0200
1305 - * linux/arch/arm/mach-at91/at91sam926x_time.c
1306 + * at91sam926x_time.c - Periodic Interval Timer (PIT) for at91sam926x
1308 * Copyright (C) 2005-2006 M. Amine SAYA, ATMEL Rousset, France
1309 * Revision 2005 M. Nicolas Diremdjian, ATMEL Rousset, France
1310 + * Converted to ClockSource/ClockEvents by David Brownell.
1312 * This program is free software; you can redistribute it and/or modify
1313 * it under the terms of the GNU General Public License version 2 as
1314 * published by the Free Software Foundation.
1317 -#include <linux/init.h>
1318 #include <linux/interrupt.h>
1319 #include <linux/irq.h>
1320 #include <linux/kernel.h>
1321 -#include <linux/sched.h>
1322 -#include <linux/time.h>
1323 +#include <linux/clk.h>
1324 +#include <linux/clockchips.h>
1326 -#include <asm/hardware.h>
1327 -#include <asm/io.h>
1328 #include <asm/mach/time.h>
1330 #include <asm/arch/at91_pit.h>
1331 @@ -26,85 +23,167 @@
1332 #define PIT_CPIV(x) ((x) & AT91_PIT_CPIV)
1333 #define PIT_PICNT(x) (((x) & AT91_PIT_PICNT) >> 20)
1335 +static u32 pit_cycle; /* write-once */
1336 +static u32 pit_cnt; /* access only w/system irq blocked */
1340 - * Returns number of microseconds since last timer interrupt. Note that interrupts
1341 - * will have been disabled by do_gettimeofday()
1342 - * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
1343 + * Clocksource: just a monotonic counter of MCK/16 cycles.
1344 + * We don't care whether or not PIT irqs are enabled.
1346 -static unsigned long at91sam926x_gettimeoffset(void)
1347 +static cycle_t read_pit_clk(void)
1349 - unsigned long elapsed;
1350 - unsigned long t = at91_sys_read(AT91_PIT_PIIR);
1351 + unsigned long flags;
1355 + raw_local_irq_save(flags);
1356 + elapsed = pit_cnt;
1357 + t = at91_sys_read(AT91_PIT_PIIR);
1358 + raw_local_irq_restore(flags);
1360 + elapsed += PIT_PICNT(t) * pit_cycle;
1361 + elapsed += PIT_CPIV(t);
1365 +static struct clocksource pit_clk = {
1368 + .read = read_pit_clk,
1370 + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
1374 - elapsed = (PIT_PICNT(t) * LATCH) + PIT_CPIV(t); /* hardware clock cycles */
1376 + * Clockevent device: interrupts every 1/HZ (== pit_cycles * MCK/16)
1379 +pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
1381 + unsigned long flags;
1383 - return (unsigned long)(elapsed * jiffies_to_usecs(1)) / LATCH;
1385 + case CLOCK_EVT_MODE_PERIODIC:
1386 + /* update clocksource counter, then enable the IRQ */
1387 + raw_local_irq_save(flags);
1388 + pit_cnt += pit_cycle * PIT_PICNT(at91_sys_read(AT91_PIT_PIVR));
1389 + at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN
1390 + | AT91_PIT_PITIEN);
1391 + raw_local_irq_restore(flags);
1393 + case CLOCK_EVT_MODE_ONESHOT:
1396 + case CLOCK_EVT_MODE_SHUTDOWN:
1397 + case CLOCK_EVT_MODE_UNUSED:
1398 + /* disable irq, leaving the clocksource active */
1399 + at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
1401 + case CLOCK_EVT_MODE_RESUME:
1406 +static struct clock_event_device pit_clkevt = {
1408 + .features = CLOCK_EVT_FEAT_PERIODIC,
1411 + .cpumask = CPU_MASK_CPU0,
1412 + .set_mode = pit_clkevt_mode,
1417 * IRQ handler for the timer.
1419 -static irqreturn_t at91sam926x_timer_interrupt(int irq, void *dev_id)
1420 +static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
1422 - volatile long nr_ticks;
1424 - if (at91_sys_read(AT91_PIT_SR) & AT91_PIT_PITS) { /* This is a shared interrupt */
1425 - /* Get number to ticks performed before interrupt and clear PIT interrupt */
1426 + /* The PIT interrupt may be disabled, and is shared */
1427 + if ((pit_clkevt.mode == CLOCK_EVT_MODE_PERIODIC)
1428 + && (at91_sys_read(AT91_PIT_SR) & AT91_PIT_PITS)) {
1429 + unsigned nr_ticks;
1431 + /* Get number of ticks performed before irq, and ack it */
1432 nr_ticks = PIT_PICNT(at91_sys_read(AT91_PIT_PIVR));
1435 + pit_cnt += pit_cycle;
1436 + pit_clkevt.event_handler(&pit_clkevt);
1442 - return IRQ_NONE; /* not handled */
1448 -static struct irqaction at91sam926x_timer_irq = {
1449 +static struct irqaction at91sam926x_pit_irq = {
1450 .name = "at91_tick",
1451 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
1452 - .handler = at91sam926x_timer_interrupt
1453 + .handler = at91sam926x_pit_interrupt
1456 -void at91sam926x_timer_reset(void)
1457 +static void at91sam926x_pit_reset(void)
1459 - /* Disable timer */
1460 + /* Disable timer and irqs */
1461 at91_sys_write(AT91_PIT_MR, 0);
1463 - /* Clear any pending interrupts */
1464 - (void) at91_sys_read(AT91_PIT_PIVR);
1465 + /* Clear any pending interrupts, wait for PIT to stop counting */
1466 + while (PIT_CPIV(at91_sys_read(AT91_PIT_PIVR)) != 0)
1469 - /* Set Period Interval timer and enable its interrupt */
1470 - at91_sys_write(AT91_PIT_MR, (LATCH & AT91_PIT_PIV) | AT91_PIT_PITIEN | AT91_PIT_PITEN);
1471 + /* Start PIT but don't enable IRQ */
1472 + at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN);
1476 - * Set up timer interrupt.
1477 + * Set up both clocksource and clockevent support.
1479 -void __init at91sam926x_timer_init(void)
1480 +static void __init at91sam926x_pit_init(void)
1482 + unsigned long pit_rate;
1486 + * Use our actual MCK to figure out how many MCK/16 ticks per
1487 + * 1/HZ period (instead of a compile-time constant LATCH).
1489 + pit_rate = clk_get_rate(clk_get(NULL, "mck")) / 16;
1490 + pit_cycle = (pit_rate + HZ/2) / HZ;
1491 + WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0);
1493 /* Initialize and enable the timer */
1494 - at91sam926x_timer_reset();
1495 + at91sam926x_pit_reset();
1497 - /* Make IRQs happen for the system timer. */
1498 - setup_irq(AT91_ID_SYS, &at91sam926x_timer_irq);
1500 + * Register clocksource. The high order bits of PIV are unused,
1501 + * so this isn't a 32-bit counter unless we get clockevent irqs.
1503 + pit_clk.mult = clocksource_hz2mult(pit_rate, pit_clk.shift);
1504 + bits = 12 /* PICNT */ + ilog2(pit_cycle) /* PIV */;
1505 + pit_clk.mask = CLOCKSOURCE_MASK(bits);
1506 + clocksource_register(&pit_clk);
1508 + /* Set up irq handler */
1509 + setup_irq(AT91_ID_SYS, &at91sam926x_pit_irq);
1511 + /* Set up and register clockevents */
1512 + pit_clkevt.mult = div_sc(pit_rate, NSEC_PER_SEC, pit_clkevt.shift);
1513 + clockevents_register_device(&pit_clkevt);
1517 -static void at91sam926x_timer_suspend(void)
1518 +static void at91sam926x_pit_suspend(void)
1521 at91_sys_write(AT91_PIT_MR, 0);
1524 -#define at91sam926x_timer_suspend NULL
1527 struct sys_timer at91sam926x_timer = {
1528 - .init = at91sam926x_timer_init,
1529 - .offset = at91sam926x_gettimeoffset,
1530 - .suspend = at91sam926x_timer_suspend,
1531 - .resume = at91sam926x_timer_reset,
1532 + .init = at91sam926x_pit_init,
1533 + .suspend = at91sam926x_pit_suspend,
1534 + .resume = at91sam926x_pit_reset,
1537 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9rl.c linux-2.6/arch/arm/mach-at91/at91sam9rl.c
1538 --- linux-2.6.25/arch/arm/mach-at91/at91sam9rl.c 2007-10-09 22:31:38.000000000 +0200
1539 +++ linux-2.6/arch/arm/mach-at91/at91sam9rl.c 2008-04-25 21:15:43.000000000 +0200
1543 #include <linux/module.h>
1544 +#include <linux/pm.h>
1546 #include <asm/mach/arch.h>
1547 #include <asm/mach/map.h>
1549 #include <asm/arch/at91sam9rl.h>
1550 #include <asm/arch/at91_pmc.h>
1551 #include <asm/arch/at91_rstc.h>
1552 +#include <asm/arch/at91_shdwc.h>
1554 #include "generic.h"
1556 @@ -244,6 +246,11 @@
1557 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
1560 +static void at91sam9rl_poweroff(void)
1562 + at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW);
1566 /* --------------------------------------------------------------------
1567 * AT91SAM9RL processor initialization
1569 iotable_init(at91sam9rl_sram_desc, ARRAY_SIZE(at91sam9rl_sram_desc));
1571 at91_arch_reset = at91sam9rl_reset;
1572 + pm_power_off = at91sam9rl_poweroff;
1573 at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
1575 /* Init clock subsystem */
1576 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/at91sam9rl_devices.c linux-2.6/arch/arm/mach-at91/at91sam9rl_devices.c
1577 --- linux-2.6.25/arch/arm/mach-at91/at91sam9rl_devices.c 2008-05-03 00:15:44.000000000 +0200
1578 +++ linux-2.6/arch/arm/mach-at91/at91sam9rl_devices.c 2008-05-02 00:52:36.000000000 +0200
1579 @@ -20,12 +20,107 @@
1580 #include <asm/arch/gpio.h>
1581 #include <asm/arch/at91sam9rl.h>
1582 #include <asm/arch/at91sam9rl_matrix.h>
1583 -#include <asm/arch/at91sam926x_mc.h>
1584 +#include <asm/arch/at91sam9_smc.h>
1586 #include "generic.h"
1589 /* --------------------------------------------------------------------
1590 + * USB HS Device (Gadget)
1591 + * -------------------------------------------------------------------- */
1593 +#if defined(CONFIG_USB_GADGET_ATMEL_USBA) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE)
1595 +static struct resource usba_udc_resources[] = {
1597 + .start = AT91SAM9RL_UDPHS_FIFO,
1598 + .end = AT91SAM9RL_UDPHS_FIFO + SZ_512K - 1,
1599 + .flags = IORESOURCE_MEM,
1602 + .start = AT91SAM9RL_BASE_UDPHS,
1603 + .end = AT91SAM9RL_BASE_UDPHS + SZ_1K - 1,
1604 + .flags = IORESOURCE_MEM,
1607 + .start = AT91SAM9RL_ID_UDPHS,
1608 + .end = AT91SAM9RL_ID_UDPHS,
1609 + .flags = IORESOURCE_IRQ,
1613 +#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
1617 + .fifo_size = maxpkt, \
1618 + .nr_banks = maxbk, \
1620 + .can_isoc = isoc, \
1623 +static struct usba_ep_data usba_udc_ep[] __initdata = {
1624 + EP("ep0", 0, 64, 1, 0, 0),
1625 + EP("ep1", 1, 1024, 2, 1, 1),
1626 + EP("ep2", 2, 1024, 2, 1, 1),
1627 + EP("ep3", 3, 1024, 3, 1, 0),
1628 + EP("ep4", 4, 1024, 3, 1, 0),
1629 + EP("ep5", 5, 1024, 3, 1, 1),
1630 + EP("ep6", 6, 1024, 3, 1, 1),
1636 + * pdata doesn't have room for any endpoints, so we need to
1637 + * append room for the ones we need right after it.
1640 + struct usba_platform_data pdata;
1641 + struct usba_ep_data ep[7];
1644 +static struct platform_device at91_usba_udc_device = {
1645 + .name = "atmel_usba_udc",
1648 + .platform_data = &usba_udc_data.pdata,
1650 + .resource = usba_udc_resources,
1651 + .num_resources = ARRAY_SIZE(usba_udc_resources),
1654 +void __init at91_add_device_usba(struct usba_platform_data *data)
1657 + * Invalid pins are 0 on AT91, but the usba driver is shared
1658 + * with AVR32, which use negative values instead. Once/if
1659 + * gpio_is_valid() is ported to AT91, revisit this code.
1661 + usba_udc_data.pdata.vbus_pin = -EINVAL;
1662 + usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep);
1663 + memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep));;
1665 + if (data && data->vbus_pin > 0) {
1666 + at91_set_gpio_input(data->vbus_pin, 0);
1667 + at91_set_deglitch(data->vbus_pin, 1);
1668 + usba_udc_data.pdata.vbus_pin = data->vbus_pin;
1671 + /* Pullup pin is handled internally by USB device peripheral */
1674 + at91_clock_associate("utmi_clk", &at91_usba_udc_device.dev, "hclk");
1675 + at91_clock_associate("udphs_clk", &at91_usba_udc_device.dev, "pclk");
1677 + platform_device_register(&at91_usba_udc_device);
1680 +void __init at91_add_device_usba(struct usba_platform_data *data) {}
1684 +/* --------------------------------------------------------------------
1686 * -------------------------------------------------------------------- */
1688 @@ -105,10 +200,15 @@
1689 #define NAND_BASE AT91_CHIPSELECT_3
1691 static struct resource nand_resources[] = {
1695 .end = NAND_BASE + SZ_256M - 1,
1696 .flags = IORESOURCE_MEM,
1699 + .start = AT91_BASE_SYS + AT91_ECC,
1700 + .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1,
1701 + .flags = IORESOURCE_MEM,
1705 @@ -385,6 +485,100 @@
1708 /* --------------------------------------------------------------------
1709 + * Timer/Counter block
1710 + * -------------------------------------------------------------------- */
1712 +#ifdef CONFIG_ATMEL_TCLIB
1714 +static struct resource tcb_resources[] = {
1716 + .start = AT91SAM9RL_BASE_TCB0,
1717 + .end = AT91SAM9RL_BASE_TCB0 + SZ_16K - 1,
1718 + .flags = IORESOURCE_MEM,
1721 + .start = AT91SAM9RL_ID_TC0,
1722 + .end = AT91SAM9RL_ID_TC0,
1723 + .flags = IORESOURCE_IRQ,
1726 + .start = AT91SAM9RL_ID_TC1,
1727 + .end = AT91SAM9RL_ID_TC1,
1728 + .flags = IORESOURCE_IRQ,
1731 + .start = AT91SAM9RL_ID_TC2,
1732 + .end = AT91SAM9RL_ID_TC2,
1733 + .flags = IORESOURCE_IRQ,
1737 +static struct platform_device at91sam9rl_tcb_device = {
1738 + .name = "atmel_tcb",
1740 + .resource = tcb_resources,
1741 + .num_resources = ARRAY_SIZE(tcb_resources),
1744 +static void __init at91_add_device_tc(void)
1746 + /* this chip has a separate clock and irq for each TC channel */
1747 + at91_clock_associate("tc0_clk", &at91sam9rl_tcb_device.dev, "t0_clk");
1748 + at91_clock_associate("tc1_clk", &at91sam9rl_tcb_device.dev, "t1_clk");
1749 + at91_clock_associate("tc2_clk", &at91sam9rl_tcb_device.dev, "t2_clk");
1750 + platform_device_register(&at91sam9rl_tcb_device);
1753 +static void __init at91_add_device_tc(void) { }
1757 +/* --------------------------------------------------------------------
1759 + * -------------------------------------------------------------------- */
1761 +#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
1762 +static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
1764 +static struct resource tsadcc_resources[] = {
1766 + .start = AT91SAM9RL_BASE_TSC,
1767 + .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
1768 + .flags = IORESOURCE_MEM,
1771 + .start = AT91SAM9RL_ID_TSC,
1772 + .end = AT91SAM9RL_ID_TSC,
1773 + .flags = IORESOURCE_IRQ,
1777 +static struct platform_device at91_tsadcc_device = {
1778 + .name = "atmel_tsadcc",
1781 + .dma_mask = &tsadcc_dmamask,
1782 + .coherent_dma_mask = DMA_BIT_MASK(32),
1784 + .resource = tsadcc_resources,
1785 + .num_resources = ARRAY_SIZE(tsadcc_resources),
1788 +void __init at91_add_device_tsadcc(void)
1790 + at91_set_A_periph(AT91_PIN_PA17, 0); /* AD0_XR */
1791 + at91_set_A_periph(AT91_PIN_PA18, 0); /* AD1_XL */
1792 + at91_set_A_periph(AT91_PIN_PA19, 0); /* AD2_YT */
1793 + at91_set_A_periph(AT91_PIN_PA20, 0); /* AD3_TB */
1795 + platform_device_register(&at91_tsadcc_device);
1798 +void __init at91_add_device_tsadcc(void) {}
1802 +/* --------------------------------------------------------------------
1804 * -------------------------------------------------------------------- */
1808 static void __init at91_add_device_rtc(void)
1810 + device_init_wakeup(&at91sam9rl_rtc_device.dev, 1);
1811 platform_device_register(&at91sam9rl_rtc_device);
1814 @@ -418,13 +613,14 @@
1816 static struct platform_device at91sam9rl_rtt_device = {
1820 .resource = rtt_resources,
1821 .num_resources = ARRAY_SIZE(rtt_resources),
1824 static void __init at91_add_device_rtt(void)
1826 + device_init_wakeup(&at91sam9rl_rtt_device.dev, 1);
1827 platform_device_register(&at91sam9rl_rtt_device);
1834 - * Return the device node so that board init code can use it as the
1835 - * parent for the device node reflecting how it's used on this board.
1837 * SSC controllers are accessed through library code, instead of any
1838 * kind of all-singing/all-dancing driver. For example one could be
1839 * used by a particular I2S audio codec's driver, while another one
1841 at91_set_B_periph(AT91_PIN_PD3, 0); /* CTS3 */
1844 -static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1845 +static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
1846 struct platform_device *atmel_default_console_device; /* the serial console device */
1848 void __init __deprecated at91_init_serial(struct at91_uart_config *config)
1849 @@ -893,8 +1086,6 @@
1851 if (portnr < ATMEL_MAX_UART)
1852 atmel_default_console_device = at91_uarts[portnr];
1853 - if (!atmel_default_console_device)
1854 - printk(KERN_INFO "AT91: No default serial console defined.\n");
1857 void __init at91_add_device_serial(void)
1858 @@ -905,6 +1096,9 @@
1860 platform_device_register(at91_uarts[i]);
1863 + if (!atmel_default_console_device)
1864 + printk(KERN_INFO "AT91: No default serial console defined.\n");
1867 void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1868 @@ -925,6 +1119,7 @@
1869 at91_add_device_rtc();
1870 at91_add_device_rtt();
1871 at91_add_device_watchdog();
1872 + at91_add_device_tc();
1876 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-cam60.c linux-2.6/arch/arm/mach-at91/board-cam60.c
1877 --- linux-2.6.25/arch/arm/mach-at91/board-cam60.c 1970-01-01 02:00:00.000000000 +0200
1878 +++ linux-2.6/arch/arm/mach-at91/board-cam60.c 2008-04-25 21:15:43.000000000 +0200
1881 + * KwikByte CAM60 (KB9260)
1883 + * based on board-sam9260ek.c
1884 + * Copyright (C) 2005 SAN People
1885 + * Copyright (C) 2006 Atmel
1887 + * This program is free software; you can redistribute it and/or modify
1888 + * it under the terms of the GNU General Public License as published by
1889 + * the Free Software Foundation; either version 2 of the License, or
1890 + * (at your option) any later version.
1892 + * This program is distributed in the hope that it will be useful,
1893 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1894 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1895 + * GNU General Public License for more details.
1897 + * You should have received a copy of the GNU General Public License
1898 + * along with this program; if not, write to the Free Software
1899 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1902 +#include <linux/types.h>
1903 +#include <linux/init.h>
1904 +#include <linux/mm.h>
1905 +#include <linux/module.h>
1906 +#include <linux/platform_device.h>
1907 +#include <linux/spi/spi.h>
1908 +#include <linux/spi/flash.h>
1910 +#include <asm/hardware.h>
1911 +#include <asm/setup.h>
1912 +#include <asm/mach-types.h>
1913 +#include <asm/irq.h>
1915 +#include <asm/mach/arch.h>
1916 +#include <asm/mach/map.h>
1917 +#include <asm/mach/irq.h>
1919 +#include <asm/arch/board.h>
1920 +#include <asm/arch/gpio.h>
1922 +#include "generic.h"
1925 +static void __init cam60_map_io(void)
1927 + /* Initialize processor: 10 MHz crystal */
1928 + at91sam9260_initialize(10000000);
1930 + /* DGBU on ttyS0. (Rx & Tx only) */
1931 + at91_register_uart(0, 0, 0);
1933 + /* set serial console to ttyS0 (ie, DBGU) */
1934 + at91_set_serial_console(0);
1937 +static void __init cam60_init_irq(void)
1939 + at91sam9260_init_interrupts(NULL);
1946 +static struct at91_usbh_data __initdata cam60_usbh_data = {
1954 +#if defined(CONFIG_MTD_DATAFLASH)
1955 +static struct mtd_partition __initdata cam60_spi_partitions[] = {
1963 + .offset = MTDPART_OFS_NXTBLK,
1964 + .size = 256 * 1056,
1968 + .offset = MTDPART_OFS_NXTBLK,
1969 + .size = 2222 * 1056,
1972 + .name = "file system",
1973 + .offset = MTDPART_OFS_NXTBLK,
1974 + .size = MTDPART_SIZ_FULL,
1978 +static struct flash_platform_data __initdata cam60_spi_flash_platform_data = {
1979 + .name = "spi_flash",
1980 + .parts = cam60_spi_partitions,
1981 + .nr_parts = ARRAY_SIZE(cam60_spi_partitions)
1985 +static struct spi_board_info cam60_spi_devices[] = {
1986 +#if defined(CONFIG_MTD_DATAFLASH)
1987 + { /* DataFlash chip */
1988 + .modalias = "mtd_dataflash",
1990 + .max_speed_hz = 15 * 1000 * 1000,
1992 + .platform_data = &cam60_spi_flash_platform_data
1999 + * MACB Ethernet device
2001 +static struct __initdata at91_eth_data cam60_macb_data = {
2002 + .phy_irq_pin = AT91_PIN_PB5,
2010 +static struct mtd_partition __initdata cam60_nand_partition[] = {
2012 + .name = "nand_fs",
2014 + .size = MTDPART_SIZ_FULL,
2018 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
2020 + *num_partitions = ARRAY_SIZE(cam60_nand_partition);
2021 + return cam60_nand_partition;
2024 +static struct at91_nand_data __initdata cam60_nand_data = {
2027 + // .det_pin = ... not there
2028 + .rdy_pin = AT91_PIN_PA9,
2029 + .enable_pin = AT91_PIN_PA7,
2030 + .partition_info = nand_partitions,
2034 +static void __init cam60_board_init(void)
2037 + at91_add_device_serial();
2039 + at91_add_device_spi(cam60_spi_devices, ARRAY_SIZE(cam60_spi_devices));
2041 + at91_add_device_eth(&cam60_macb_data);
2043 + /* enable USB power supply circuit */
2044 + at91_set_gpio_output(AT91_PIN_PB18, 1);
2045 + at91_add_device_usbh(&cam60_usbh_data);
2047 + at91_add_device_nand(&cam60_nand_data);
2050 +MACHINE_START(CAM60, "KwikByte CAM60")
2051 + /* Maintainer: KwikByte */
2052 + .phys_io = AT91_BASE_SYS,
2053 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
2054 + .boot_params = AT91_SDRAM_BASE + 0x100,
2055 + .timer = &at91sam926x_timer,
2056 + .map_io = cam60_map_io,
2057 + .init_irq = cam60_init_irq,
2058 + .init_machine = cam60_board_init,
2060 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-cap9adk.c linux-2.6/arch/arm/mach-at91/board-cap9adk.c
2061 --- linux-2.6.25/arch/arm/mach-at91/board-cap9adk.c 2008-05-03 00:15:44.000000000 +0200
2062 +++ linux-2.6/arch/arm/mach-at91/board-cap9adk.c 2008-05-05 22:01:39.000000000 +0200
2064 #include <asm/hardware.h>
2065 #include <asm/setup.h>
2066 #include <asm/mach-types.h>
2067 -#include <asm/irq.h>
2069 #include <asm/mach/arch.h>
2070 #include <asm/mach/map.h>
2071 -#include <asm/mach/irq.h>
2073 #include <asm/arch/board.h>
2074 #include <asm/arch/gpio.h>
2075 #include <asm/arch/at91cap9_matrix.h>
2076 -#include <asm/arch/at91sam926x_mc.h>
2077 +#include <asm/arch/at91sam9_smc.h>
2079 #include "generic.h"
2086 + * USB HS Device port
2088 +static struct usba_platform_data __initdata cap9adk_usba_udc_data = {
2089 + .vbus_pin = AT91_PIN_PB31,
2093 * ADS7846 Touchscreen
2096 .modalias = "ads7846",
2097 .chip_select = 3, /* can be 2 or 3, depending on J2 jumper */
2098 - .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
2099 + .max_speed_hz = 125000 * 16, /* max sample rate * clocks per sample */
2101 .platform_data = &ads_info,
2102 .irq = AT91_PIN_PC4,
2105 at91_add_device_serial();
2107 - set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH);
2108 at91_add_device_usbh(&cap9adk_usbh_data);
2110 + at91_add_device_usba(&cap9adk_usba_udc_data);
2112 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices));
2116 at91_add_device_i2c(NULL, 0);
2117 /* LCD Controller */
2118 - set_irq_type(AT91CAP9_ID_LCDC, IRQT_HIGH);
2119 at91_add_device_lcdc(&cap9adk_lcdc_data);
2121 at91_add_device_ac97(&cap9adk_ac97_data);
2122 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-carmeva.c linux-2.6/arch/arm/mach-at91/board-carmeva.c
2123 --- linux-2.6.25/arch/arm/mach-at91/board-carmeva.c 2008-05-03 00:15:33.000000000 +0200
2124 +++ linux-2.6/arch/arm/mach-at91/board-carmeva.c 2008-04-25 21:15:43.000000000 +0200
2126 #include "generic.h"
2130 - * Serial port configuration.
2131 - * 0 .. 3 = USART0 .. USART3
2134 -static struct at91_uart_config __initdata carmeva_uart_config = {
2135 - .console_tty = 0, /* ttyS0 */
2137 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2140 static void __init carmeva_map_io(void)
2142 /* Initialize processor: 20.000 MHz crystal */
2143 at91rm9200_initialize(20000000, AT91RM9200_BGA);
2145 - /* Setup the serial ports and console */
2146 - at91_init_serial(&carmeva_uart_config);
2147 + /* DBGU on ttyS0. (Rx & Tx only) */
2148 + at91_register_uart(0, 0, 0);
2150 + /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
2151 + at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
2152 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
2155 + /* set serial console to ttyS0 (ie, DBGU) */
2156 + at91_set_serial_console(0);
2159 static void __init carmeva_init_irq(void)
2160 @@ -117,6 +114,30 @@
2164 +static struct gpio_led carmeva_leds[] = {
2165 + { /* "user led 1", LED9 */
2167 + .gpio = AT91_PIN_PA21,
2169 + .default_trigger = "heartbeat",
2171 + { /* "user led 2", LED10 */
2173 + .gpio = AT91_PIN_PA25,
2176 + { /* "user led 3", LED11 */
2178 + .gpio = AT91_PIN_PA26,
2181 + { /* "user led 4", LED12 */
2183 + .gpio = AT91_PIN_PA18,
2188 static void __init carmeva_board_init(void)
2192 // at91_add_device_cf(&carmeva_cf_data);
2194 at91_add_device_mmc(0, &carmeva_mmc_data);
2196 + at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds));
2199 MACHINE_START(CARMEVA, "Carmeva")
2200 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-chub.c linux-2.6/arch/arm/mach-at91/board-chub.c
2201 --- linux-2.6.25/arch/arm/mach-at91/board-chub.c 1970-01-01 02:00:00.000000000 +0200
2202 +++ linux-2.6/arch/arm/mach-at91/board-chub.c 2008-04-25 21:15:43.000000000 +0200
2205 + * linux/arch/arm/mach-at91/board-chub.c
2207 + * Copyright (C) 2005 SAN People, adapted for Promwad Chub board
2210 + * This program is free software; you can redistribute it and/or modify
2211 + * it under the terms of the GNU General Public License as published by
2212 + * the Free Software Foundation; either version 2 of the License, or
2213 + * (at your option) any later version.
2215 + * This program is distributed in the hope that it will be useful,
2216 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2217 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2218 + * GNU General Public License for more details.
2220 + * You should have received a copy of the GNU General Public License
2221 + * along with this program; if not, write to the Free Software
2222 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2225 +#include <linux/types.h>
2226 +#include <linux/init.h>
2227 +#include <linux/mm.h>
2228 +#include <linux/module.h>
2229 +#include <linux/platform_device.h>
2231 +#include <asm/hardware.h>
2232 +#include <asm/setup.h>
2233 +#include <asm/mach-types.h>
2234 +#include <asm/irq.h>
2236 +#include <asm/mach/arch.h>
2237 +#include <asm/mach/map.h>
2238 +#include <asm/mach/irq.h>
2240 +#include <asm/arch/board.h>
2241 +#include <asm/arch/gpio.h>
2243 +#include "generic.h"
2246 + * Serial port configuration.
2247 + * 0 .. 3 = USART0 .. USART3
2250 +static struct at91_uart_config __initdata chub_uart_config = {
2251 + .console_tty = 0, /* ttyS0 */
2253 + .tty_map = { 4, 0, 1, 2, 3 } /* ttyS0, ..., ttyS4 */
2256 +static void __init chub_init_irq(void)
2258 + at91rm9200_init_interrupts(NULL);
2261 +static void __init chub_map_io(void)
2263 + /* Initialize clocks: 18.432 MHz crystal */
2264 + at91rm9200_initialize(18432000, AT91RM9200_PQFP);
2266 + /* Setup the serial ports and console */
2267 + at91_init_serial(&chub_uart_config);
2270 +static struct at91_eth_data __initdata chub_eth_data = {
2271 + .phy_irq_pin = AT91_PIN_PB29,
2275 +static struct mtd_partition __initdata chub_nand_partition[] = {
2277 + .name = "NAND Partition 1",
2279 + .size = MTDPART_SIZ_FULL,
2283 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
2285 + *num_partitions = ARRAY_SIZE(chub_nand_partition);
2286 + return chub_nand_partition;
2289 +static struct at91_nand_data __initdata chub_nand_data = {
2292 + .enable_pin = AT91_PIN_PA27,
2293 + .partition_info = nand_partitions,
2296 +static struct spi_board_info chub_spi_devices[] = {
2297 + { /* DataFlash chip */
2298 + .modalias = "mtd_dataflash",
2300 + .max_speed_hz = 15 * 1000 * 1000,
2304 +static void __init chub_board_init(void)
2307 + at91_add_device_serial();
2309 + at91_add_device_i2c(NULL, 0);
2311 + at91_add_device_eth(&chub_eth_data);
2313 + at91_add_device_spi(chub_spi_devices, ARRAY_SIZE(chub_spi_devices));
2315 + at91_add_device_nand(&chub_nand_data);
2316 + /* Disable write protect for NAND */
2317 + at91_set_gpio_output(AT91_PIN_PB7, 1);
2318 + /* Power enable for 3x RS-232 and 1x RS-485 */
2319 + at91_set_gpio_output(AT91_PIN_PB9, 1);
2320 + /* Disable write protect for FRAM */
2321 + at91_set_gpio_output(AT91_PIN_PA21, 1);
2322 + /* Disable write protect for Dataflash */
2323 + at91_set_gpio_output(AT91_PIN_PA19, 1);
2326 +MACHINE_START(CHUB, "Promwad Chub")
2327 + /* Maintainer: Ivan Kuten AT Promwad DOT com */
2328 + .phys_io = AT91_BASE_SYS,
2329 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
2330 + .boot_params = AT91_SDRAM_BASE + 0x100,
2331 + .timer = &at91rm9200_timer,
2332 + .map_io = chub_map_io,
2333 + .init_irq = chub_init_irq,
2334 + .init_machine = chub_board_init,
2336 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-csb337.c linux-2.6/arch/arm/mach-at91/board-csb337.c
2337 --- linux-2.6.25/arch/arm/mach-at91/board-csb337.c 2008-05-03 00:15:44.000000000 +0200
2338 +++ linux-2.6/arch/arm/mach-at91/board-csb337.c 2008-05-02 00:05:42.000000000 +0200
2341 /* Setup the LEDs */
2342 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
2343 + at91_set_gpio_output(AT91_PIN_PB2, 1); /* third (unused) LED */
2345 /* Setup the serial ports and console */
2346 at91_init_serial(&csb337_uart_config);
2347 @@ -202,11 +203,11 @@
2349 static void __init csb300_add_device_buttons(void)
2351 - at91_set_gpio_input(AT91_PIN_PB29, 0); /* sw0 */
2352 + at91_set_gpio_input(AT91_PIN_PB29, 1); /* sw0 */
2353 at91_set_deglitch(AT91_PIN_PB29, 1);
2354 - at91_set_gpio_input(AT91_PIN_PB28, 0); /* sw1 */
2355 + at91_set_gpio_input(AT91_PIN_PB28, 1); /* sw1 */
2356 at91_set_deglitch(AT91_PIN_PB28, 1);
2357 - at91_set_gpio_input(AT91_PIN_PA21, 0); /* sw2 */
2358 + at91_set_gpio_input(AT91_PIN_PA21, 1); /* sw2 */
2359 at91_set_deglitch(AT91_PIN_PA21, 1);
2361 platform_device_register(&csb300_button_device);
2363 .gpio = AT91_PIN_PB0,
2365 .default_trigger = "ide-disk",
2371 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-csb637.c linux-2.6/arch/arm/mach-at91/board-csb637.c
2372 --- linux-2.6.25/arch/arm/mach-at91/board-csb637.c 2008-05-03 00:15:33.000000000 +0200
2373 +++ linux-2.6/arch/arm/mach-at91/board-csb637.c 2008-04-25 21:15:43.000000000 +0200
2375 #include "generic.h"
2379 - * Serial port configuration.
2380 - * 0 .. 3 = USART0 .. USART3
2383 -static struct at91_uart_config __initdata csb637_uart_config = {
2384 - .console_tty = 0, /* ttyS0 */
2386 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2389 static void __init csb637_map_io(void)
2391 /* Initialize processor: 3.6864 MHz crystal */
2392 at91rm9200_initialize(3686400, AT91RM9200_BGA);
2394 - /* Setup the LEDs */
2395 - at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
2396 + /* DBGU on ttyS0. (Rx & Tx only) */
2397 + at91_register_uart(0, 0, 0);
2399 - /* Setup the serial ports and console */
2400 - at91_init_serial(&csb637_uart_config);
2401 + /* make console=ttyS0 (ie, DBGU) the default */
2402 + at91_set_serial_console(0);
2405 static void __init csb637_init_irq(void)
2406 @@ -118,8 +107,19 @@
2407 .num_resources = ARRAY_SIZE(csb_flash_resources),
2410 +static struct gpio_led csb_leds[] = {
2413 + .gpio = AT91_PIN_PB2,
2415 + .default_trigger = "heartbeat",
2419 static void __init csb637_board_init(void)
2422 + at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds));
2424 at91_add_device_serial();
2426 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-dk.c linux-2.6/arch/arm/mach-at91/board-dk.c
2427 --- linux-2.6.25/arch/arm/mach-at91/board-dk.c 2008-05-03 00:15:44.000000000 +0200
2428 +++ linux-2.6/arch/arm/mach-at91/board-dk.c 2008-05-03 00:44:06.000000000 +0200
2430 #include <linux/init.h>
2431 #include <linux/mm.h>
2432 #include <linux/module.h>
2433 +#include <linux/dma-mapping.h>
2434 #include <linux/platform_device.h>
2435 #include <linux/spi/spi.h>
2436 #include <linux/mtd/physmap.h>
2438 #include "generic.h"
2442 - * Serial port configuration.
2443 - * 0 .. 3 = USART0 .. USART3
2446 -static struct at91_uart_config __initdata dk_uart_config = {
2447 - .console_tty = 0, /* ttyS0 */
2449 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2452 static void __init dk_map_io(void)
2454 /* Initialize processor: 18.432 MHz crystal */
2456 /* Setup the LEDs */
2457 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
2459 - /* Setup the serial ports and console */
2460 - at91_init_serial(&dk_uart_config);
2461 + /* DBGU on ttyS0. (Rx & Tx only) */
2462 + at91_register_uart(0, 0, 0);
2464 + /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
2465 + at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
2466 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
2469 + /* set serial console to ttyS0 (ie, DBGU) */
2470 + at91_set_serial_console(0);
2473 static void __init dk_init_irq(void)
2475 at91rm9200_init_interrupts(NULL);
2478 +#if defined(CONFIG_FB_S1D13XXX) || defined(CONFIG_FB_S1D13XXX_MODULE)
2479 +#include <video/s1d13xxxfb.h>
2480 +#include <asm/arch/ics1523.h>
2482 +/* EPSON S1D13806 FB */
2483 +#define AT91_FB_REG_BASE 0x30000000L
2484 +#define AT91_FB_REG_SIZE 0x200
2485 +#define AT91_FB_VMEM_BASE 0x30200000L
2486 +#define AT91_FB_VMEM_SIZE 0x140000L
2488 +static void dk_init_video(void)
2490 + /* NWAIT Signal */
2491 + at91_set_A_periph(AT91_PIN_PC6, 0);
2493 + /* Initialization of the Static Memory Controller for Chip Select 2 */
2494 + at91_sys_write(AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */
2495 + | AT91_SMC_WSEN | AT91_SMC_NWS_(4) /* wait states */
2496 + | AT91_SMC_TDF_(1) /* float time */
2499 + at91_ics1523_init();
2502 +/* CRT: (active) 640x480 60Hz (PCLK=CLKI=25.175MHz)
2503 + Memory: Embedded SDRAM (MCLK=CLKI3=50.000MHz) (BUSCLK=60.000MHz) */
2504 +static const struct s1d13xxxfb_regval dk_s1dfb_initregs[] = {
2505 + {S1DREG_MISC, 0x00}, /* Enable Memory/Register select bit */
2506 + {S1DREG_COM_DISP_MODE, 0x00}, /* disable display output */
2507 + {S1DREG_GPIO_CNF0, 0x00},
2508 + {S1DREG_GPIO_CNF1, 0x00},
2509 + {S1DREG_GPIO_CTL0, 0x08},
2510 + {S1DREG_GPIO_CTL1, 0x00},
2511 + {S1DREG_CLK_CNF, 0x01}, /* no divide, MCLK source is CLKI3 0x02*/
2512 + {S1DREG_LCD_CLK_CNF, 0x00},
2513 + {S1DREG_CRT_CLK_CNF, 0x00},
2514 + {S1DREG_MPLUG_CLK_CNF, 0x00},
2515 + {S1DREG_CPU2MEM_WST_SEL, 0x01}, /* 2*period(MCLK) - 4ns > period(BCLK) */
2516 + {S1DREG_SDRAM_REF_RATE, 0x03}, /* 32768 <= MCLK <= 50000 (MHz) */
2517 + {S1DREG_SDRAM_TC0, 0x00}, /* MCLK source freq (MHz): */
2518 + {S1DREG_SDRAM_TC1, 0x01}, /* 42 <= MCLK <= 50 */
2519 + {S1DREG_MEM_CNF, 0x80}, /* SDRAM Initialization - needed before mem access */
2520 + {S1DREG_PANEL_TYPE, 0x25}, /* std TFT 16bit, 8bit SCP format 2, single passive LCD */
2521 + {S1DREG_MOD_RATE, 0x00}, /* toggle every FPFRAME */
2522 + {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* 680 pix */
2523 + {S1DREG_LCD_NDISP_HPER, 0x12}, /* 152 pix */
2524 + {S1DREG_TFT_FPLINE_START, 0x01}, /* 13 pix */
2525 + {S1DREG_TFT_FPLINE_PWIDTH, 0x0B}, /* 96 pix */
2526 + {S1DREG_LCD_DISP_VHEIGHT0, 0xDF},
2527 + {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* 480 lines */
2528 + {S1DREG_LCD_NDISP_VPER, 0x2C}, /* 44 lines */
2529 + {S1DREG_TFT_FPFRAME_START, 0x0A}, /* 10 lines */
2530 + {S1DREG_TFT_FPFRAME_PWIDTH, 0x01}, /* 2 lines */
2531 + {S1DREG_LCD_DISP_MODE, 0x05}, /* 16 bpp */
2532 + {S1DREG_LCD_MISC, 0x00}, /* dithering enabled, dual panel buffer enabled */
2533 + {S1DREG_LCD_DISP_START0, 0x00},
2534 + {S1DREG_LCD_DISP_START1, 0xC8},
2535 + {S1DREG_LCD_DISP_START2, 0x00},
2536 + {S1DREG_LCD_MEM_OFF0, 0x80},
2537 + {S1DREG_LCD_MEM_OFF1, 0x02},
2538 + {S1DREG_LCD_PIX_PAN, 0x00},
2539 + {S1DREG_LCD_DISP_FIFO_HTC, 0x3B},
2540 + {S1DREG_LCD_DISP_FIFO_LTC, 0x3C},
2541 + {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* 680 pix */
2542 + {S1DREG_CRT_NDISP_HPER, 0x13}, /* 160 pix */
2543 + {S1DREG_CRT_HRTC_START, 0x01}, /* 13 pix */
2544 + {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* 96 pix */
2545 + {S1DREG_CRT_DISP_VHEIGHT0, 0xDF},
2546 + {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* 480 lines */
2547 + {S1DREG_CRT_NDISP_VPER, 0x2B}, /* 44 lines */
2548 + {S1DREG_CRT_VRTC_START, 0x09}, /* 10 lines */
2549 + {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* 2 lines */
2550 + {S1DREG_TV_OUT_CTL, 0x10},
2551 + {S1DREG_CRT_DISP_MODE, 0x05}, /* 16 bpp */
2552 + {S1DREG_CRT_DISP_START0, 0x00},
2553 + {S1DREG_CRT_DISP_START1, 0x00},
2554 + {S1DREG_CRT_DISP_START2, 0x00},
2555 + {S1DREG_CRT_MEM_OFF0, 0x80},
2556 + {S1DREG_CRT_MEM_OFF1, 0x02},
2557 + {S1DREG_CRT_PIX_PAN, 0x00},
2558 + {S1DREG_CRT_DISP_FIFO_HTC, 0x3B},
2559 + {S1DREG_CRT_DISP_FIFO_LTC, 0x3C},
2560 + {S1DREG_LCD_CUR_CTL, 0x00}, /* inactive */
2561 + {S1DREG_LCD_CUR_START, 0x01},
2562 + {S1DREG_LCD_CUR_XPOS0, 0x00},
2563 + {S1DREG_LCD_CUR_XPOS1, 0x00},
2564 + {S1DREG_LCD_CUR_YPOS0, 0x00},
2565 + {S1DREG_LCD_CUR_YPOS1, 0x00},
2566 + {S1DREG_LCD_CUR_BCTL0, 0x00},
2567 + {S1DREG_LCD_CUR_GCTL0, 0x00},
2568 + {S1DREG_LCD_CUR_RCTL0, 0x00},
2569 + {S1DREG_LCD_CUR_BCTL1, 0x1F},
2570 + {S1DREG_LCD_CUR_GCTL1, 0x3F},
2571 + {S1DREG_LCD_CUR_RCTL1, 0x1F},
2572 + {S1DREG_LCD_CUR_FIFO_HTC, 0x00},
2573 + {S1DREG_CRT_CUR_CTL, 0x00}, /* inactive */
2574 + {S1DREG_CRT_CUR_START, 0x01},
2575 + {S1DREG_CRT_CUR_XPOS0, 0x00},
2576 + {S1DREG_CRT_CUR_XPOS1, 0x00},
2577 + {S1DREG_CRT_CUR_YPOS0, 0x00},
2578 + {S1DREG_CRT_CUR_YPOS1, 0x00},
2579 + {S1DREG_CRT_CUR_BCTL0, 0x00},
2580 + {S1DREG_CRT_CUR_GCTL0, 0x00},
2581 + {S1DREG_CRT_CUR_RCTL0, 0x00},
2582 + {S1DREG_CRT_CUR_BCTL1, 0x1F},
2583 + {S1DREG_CRT_CUR_GCTL1, 0x3F},
2584 + {S1DREG_CRT_CUR_RCTL1, 0x1F},
2585 + {S1DREG_CRT_CUR_FIFO_HTC, 0x00},
2586 + {S1DREG_BBLT_CTL0, 0x00},
2587 + {S1DREG_BBLT_CTL0, 0x00},
2588 + {S1DREG_BBLT_CC_EXP, 0x00},
2589 + {S1DREG_BBLT_OP, 0x00},
2590 + {S1DREG_BBLT_SRC_START0, 0x00},
2591 + {S1DREG_BBLT_SRC_START1, 0x00},
2592 + {S1DREG_BBLT_SRC_START2, 0x00},
2593 + {S1DREG_BBLT_DST_START0, 0x00},
2594 + {S1DREG_BBLT_DST_START1, 0x00},
2595 + {S1DREG_BBLT_DST_START2, 0x00},
2596 + {S1DREG_BBLT_MEM_OFF0, 0x00},
2597 + {S1DREG_BBLT_MEM_OFF1, 0x00},
2598 + {S1DREG_BBLT_WIDTH0, 0x00},
2599 + {S1DREG_BBLT_WIDTH1, 0x00},
2600 + {S1DREG_BBLT_HEIGHT0, 0x00},
2601 + {S1DREG_BBLT_HEIGHT1, 0x00},
2602 + {S1DREG_BBLT_BGC0, 0x00},
2603 + {S1DREG_BBLT_BGC1, 0x00},
2604 + {S1DREG_BBLT_FGC0, 0x00},
2605 + {S1DREG_BBLT_FGC1, 0x00},
2606 + {S1DREG_LKUP_MODE, 0x00}, /* LCD LUT r | LCD and CRT/TV LUT w */
2607 + {S1DREG_LKUP_ADDR, 0x00},
2608 + {S1DREG_PS_CNF, 0x00}, /* Power Save disable */
2609 + {S1DREG_PS_STATUS, 0x02}, /* LCD Panel down, mem up */
2610 + {S1DREG_CPU2MEM_WDOGT, 0x00},
2611 + {S1DREG_COM_DISP_MODE, 0x02}, /* enable CRT display output */
2614 +static struct s1d13xxxfb_pdata dk_s1dfb_pdata = {
2615 + .initregs = dk_s1dfb_initregs,
2616 + .initregssize = ARRAY_SIZE(dk_s1dfb_initregs),
2617 + .platform_init_video = dk_init_video,
2620 +static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
2622 +static struct resource dk_s1dfb_resource[] = {
2623 + [0] = { /* video mem */
2624 + .name = "s1d13806 memory",
2625 + .start = AT91_FB_VMEM_BASE,
2626 + .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1,
2627 + .flags = IORESOURCE_MEM,
2629 + [1] = { /* video registers */
2630 + .name = "s1d13806 registers",
2631 + .start = AT91_FB_REG_BASE,
2632 + .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1,
2633 + .flags = IORESOURCE_MEM,
2637 +static struct platform_device dk_s1dfb_device = {
2638 + .name = "s1d13806fb",
2641 + .dma_mask = &s1dfb_dmamask,
2642 + .coherent_dma_mask = DMA_BIT_MASK(32),
2643 + .platform_data = &dk_s1dfb_pdata,
2645 + .resource = dk_s1dfb_resource,
2646 + .num_resources = ARRAY_SIZE(dk_s1dfb_resource),
2649 +static void __init dk_add_device_video(void)
2651 + platform_device_register(&dk_s1dfb_device);
2654 +static void __init dk_add_device_video(void) {}
2657 static struct at91_eth_data __initdata dk_eth_data = {
2658 .phy_irq_pin = AT91_PIN_PC4,
2661 #define DK_FLASH_SIZE 0x200000
2663 static struct physmap_flash_data dk_flash_data = {
2668 static struct resource dk_flash_resource = {
2669 @@ -223,8 +400,12 @@
2670 platform_device_register(&dk_flash);
2672 at91_gpio_leds(dk_leds, ARRAY_SIZE(dk_leds));
2673 + /* SSC (to LM4549 audio codec) */
2674 + at91_add_device_ssc(AT91RM9200_ID_SSC1, ATMEL_SSC_TD | ATMEL_SSC_RX);
2675 + /* SSC (to SI3021 line interface) */
2676 + at91_add_device_ssc(AT91RM9200_ID_SSC2, ATMEL_SSC_TD | ATMEL_SSC_TK | ATMEL_SSC_RD | ATMEL_SSC_RF);
2678 -// dk_add_device_video();
2679 + dk_add_device_video();
2682 MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK")
2683 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-eb9200.c linux-2.6/arch/arm/mach-at91/board-eb9200.c
2684 --- linux-2.6.25/arch/arm/mach-at91/board-eb9200.c 2008-05-03 00:15:33.000000000 +0200
2685 +++ linux-2.6/arch/arm/mach-at91/board-eb9200.c 2008-04-25 21:15:43.000000000 +0200
2687 #include "generic.h"
2691 - * Serial port configuration.
2692 - * 0 .. 3 = USART0 .. USART3
2695 -static struct at91_uart_config __initdata eb9200_uart_config = {
2696 - .console_tty = 0, /* ttyS0 */
2698 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2701 static void __init eb9200_map_io(void)
2703 /* Initialize processor: 18.432 MHz crystal */
2704 at91rm9200_initialize(18432000, AT91RM9200_BGA);
2706 - /* Setup the serial ports and console */
2707 - at91_init_serial(&eb9200_uart_config);
2708 + /* DBGU on ttyS0. (Rx & Tx only) */
2709 + at91_register_uart(0, 0, 0);
2711 + /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
2712 + at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
2713 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
2716 + /* USART2 on ttyS2. (Rx, Tx) - IRDA */
2717 + at91_register_uart(AT91RM9200_ID_US2, 2, 0);
2719 + /* set serial console to ttyS0 (ie, DBGU) */
2720 + at91_set_serial_console(0);
2723 static void __init eb9200_init_irq(void)
2724 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-ecbat91.c linux-2.6/arch/arm/mach-at91/board-ecbat91.c
2725 --- linux-2.6.25/arch/arm/mach-at91/board-ecbat91.c 1970-01-01 02:00:00.000000000 +0200
2726 +++ linux-2.6/arch/arm/mach-at91/board-ecbat91.c 2008-04-25 21:15:43.000000000 +0200
2729 + * linux/arch/arm/mach-at91rm9200/board-ecbat91.c
2730 + * Copyright (C) 2007 emQbit.com.
2732 + * We started from board-dk.c, which is Copyright (C) 2005 SAN People.
2734 + * This program is free software; you can redistribute it and/or modify
2735 + * it under the terms of the GNU General Public License as published by
2736 + * the Free Software Foundation; either version 2 of the License, or
2737 + * (at your option) any later version.
2739 + * This program is distributed in the hope that it will be useful,
2740 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2741 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2742 + * GNU General Public License for more details.
2744 + * You should have received a copy of the GNU General Public License
2745 + * along with this program; if not, write to the Free Software
2746 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2749 +#include <linux/types.h>
2750 +#include <linux/init.h>
2751 +#include <linux/mm.h>
2752 +#include <linux/module.h>
2753 +#include <linux/platform_device.h>
2754 +#include <linux/spi/spi.h>
2755 +#include <linux/spi/flash.h>
2757 +#include <asm/hardware.h>
2758 +#include <asm/setup.h>
2759 +#include <asm/mach-types.h>
2760 +#include <asm/irq.h>
2762 +#include <asm/mach/arch.h>
2763 +#include <asm/mach/map.h>
2764 +#include <asm/mach/irq.h>
2766 +#include <asm/arch/board.h>
2767 +#include <asm/arch/gpio.h>
2769 +#include "generic.h"
2772 +static void __init ecb_at91map_io(void)
2774 + /* Initialize processor: 18.432 MHz crystal */
2775 + at91rm9200_initialize(18432000, AT91RM9200_PQFP);
2777 + /* Setup the LEDs */
2778 + at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
2780 + /* DBGU on ttyS0. (Rx & Tx only) */
2781 + at91_register_uart(0, 0, 0);
2783 + /* USART0 on ttyS1. (Rx & Tx only) */
2784 + at91_register_uart(AT91RM9200_ID_US0, 1, 0);
2786 + /* set serial console to ttyS0 (ie, DBGU) */
2787 + at91_set_serial_console(0);
2790 +static void __init ecb_at91init_irq(void)
2792 + at91rm9200_init_interrupts(NULL);
2795 +static struct at91_eth_data __initdata ecb_at91eth_data = {
2796 + .phy_irq_pin = AT91_PIN_PC4,
2800 +static struct at91_usbh_data __initdata ecb_at91usbh_data = {
2804 +static struct at91_mmc_data __initdata ecb_at91mmc_data = {
2810 +#if defined(CONFIG_MTD_DATAFLASH)
2811 +static struct mtd_partition __initdata my_flash0_partitions[] =
2814 + .name = "Darrell-loader",
2820 + .offset = MTDPART_OFS_NXTBLK,
2821 + .size = 110 * 1056,
2823 + { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
2824 + .name = "Uoot-env",
2825 + .offset = MTDPART_OFS_NXTBLK,
2828 + { /* 1336 (167 blocks) pages * 1056 bytes = 0x158700 bytes */
2830 + .offset = MTDPART_OFS_NXTBLK,
2831 + .size = 1534 * 1056,
2833 + { /* 190200 - jffs2 root filesystem */
2834 + .name = "Filesystem",
2835 + .offset = MTDPART_OFS_NXTBLK,
2836 + .size = MTDPART_SIZ_FULL, /* 26 sectors */
2840 +static struct flash_platform_data __initdata my_flash0_platform = {
2841 + .name = "Removable flash card",
2842 + .parts = my_flash0_partitions,
2843 + .nr_parts = ARRAY_SIZE(my_flash0_partitions)
2848 +static struct spi_board_info __initdata ecb_at91spi_devices[] = {
2849 + { /* DataFlash chip */
2850 + .modalias = "mtd_dataflash",
2852 + .max_speed_hz = 10 * 1000 * 1000,
2854 +#if defined(CONFIG_MTD_DATAFLASH)
2855 + .platform_data = &my_flash0_platform,
2858 + { /* User accessable spi - cs1 (250KHz) */
2859 + .modalias = "spi-cs1",
2861 + .max_speed_hz = 250 * 1000,
2863 + { /* User accessable spi - cs2 (1MHz) */
2864 + .modalias = "spi-cs2",
2866 + .max_speed_hz = 1 * 1000 * 1000,
2868 + { /* User accessable spi - cs3 (10MHz) */
2869 + .modalias = "spi-cs3",
2871 + .max_speed_hz = 10 * 1000 * 1000,
2875 +static void __init ecb_at91board_init(void)
2878 + at91_add_device_serial();
2881 + at91_add_device_eth(&ecb_at91eth_data);
2884 + at91_add_device_usbh(&ecb_at91usbh_data);
2887 + at91_add_device_i2c(NULL, 0);
2890 + at91_add_device_mmc(0, &ecb_at91mmc_data);
2893 + at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));
2896 +MACHINE_START(ECBAT91, "emQbit's ECB_AT91")
2897 + /* Maintainer: emQbit.com */
2898 + .phys_io = AT91_BASE_SYS,
2899 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
2900 + .boot_params = AT91_SDRAM_BASE + 0x100,
2901 + .timer = &at91rm9200_timer,
2902 + .map_io = ecb_at91map_io,
2903 + .init_irq = ecb_at91init_irq,
2904 + .init_machine = ecb_at91board_init,
2906 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-ek.c linux-2.6/arch/arm/mach-at91/board-ek.c
2907 --- linux-2.6.25/arch/arm/mach-at91/board-ek.c 2008-05-03 00:15:44.000000000 +0200
2908 +++ linux-2.6/arch/arm/mach-at91/board-ek.c 2008-05-03 00:44:38.000000000 +0200
2910 #include <linux/init.h>
2911 #include <linux/mm.h>
2912 #include <linux/module.h>
2913 +#include <linux/dma-mapping.h>
2914 #include <linux/platform_device.h>
2915 #include <linux/spi/spi.h>
2916 #include <linux/mtd/physmap.h>
2918 #include "generic.h"
2922 - * Serial port configuration.
2923 - * 0 .. 3 = USART0 .. USART3
2926 -static struct at91_uart_config __initdata ek_uart_config = {
2927 - .console_tty = 0, /* ttyS0 */
2929 - .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
2932 static void __init ek_map_io(void)
2934 /* Initialize processor: 18.432 MHz crystal */
2936 /* Setup the LEDs */
2937 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
2939 - /* Setup the serial ports and console */
2940 - at91_init_serial(&ek_uart_config);
2941 + /* DBGU on ttyS0. (Rx & Tx only) */
2942 + at91_register_uart(0, 0, 0);
2944 + /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
2945 + at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
2946 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
2949 + /* set serial console to ttyS0 (ie, DBGU) */
2950 + at91_set_serial_console(0);
2953 static void __init ek_init_irq(void)
2955 at91rm9200_init_interrupts(NULL);
2958 +#if defined(CONFIG_FB_S1D13XXX) || defined(CONFIG_FB_S1D13XXX_MODULE)
2959 +#include <video/s1d13xxxfb.h>
2960 +#include <asm/arch/ics1523.h>
2962 +/* EPSON S1D13806 FB */
2963 +#define AT91_FB_REG_BASE 0x40000000L
2964 +#define AT91_FB_REG_SIZE 0x200
2965 +#define AT91_FB_VMEM_BASE 0x40200000L
2966 +#define AT91_FB_VMEM_SIZE 0x140000L
2968 +static void ek_init_video(void)
2970 + /* NWAIT Signal */
2971 + at91_set_A_periph(AT91_PIN_PC6, 0);
2973 + /* Initialization of the Static Memory Controller for Chip Select 3 */
2974 + at91_sys_write(AT91_SMC_CSR(3), AT91_SMC_DBW_16 /* 16 bit */
2975 + | AT91_SMC_WSEN | AT91_SMC_NWS_(5) /* wait states */
2976 + | AT91_SMC_TDF_(1) /* float time */
2979 + at91_ics1523_init();
2982 +/* CRT: (active) 640x480 60Hz (PCLK=CLKI=25.175MHz)
2983 + Memory: Embedded SDRAM (MCLK=CLKI3=50.000MHz) (BUSCLK=60.000MHz) */
2984 +static const struct s1d13xxxfb_regval ek_s1dfb_initregs[] = {
2985 + {S1DREG_MISC, 0x00}, /* Enable Memory/Register select bit */
2986 + {S1DREG_COM_DISP_MODE, 0x00}, /* disable display output */
2987 + {S1DREG_GPIO_CNF0, 0xFF}, // 0x00
2988 + {S1DREG_GPIO_CNF1, 0x1F}, // 0x08
2989 + {S1DREG_GPIO_CTL0, 0x00},
2990 + {S1DREG_GPIO_CTL1, 0x00},
2991 + {S1DREG_CLK_CNF, 0x01}, /* no divide, MCLK source is CLKI3 0x02*/
2992 + {S1DREG_LCD_CLK_CNF, 0x00},
2993 + {S1DREG_CRT_CLK_CNF, 0x00},
2994 + {S1DREG_MPLUG_CLK_CNF, 0x00},
2995 + {S1DREG_CPU2MEM_WST_SEL, 0x01}, /* 2*period(MCLK) - 4ns > period(BCLK) */
2996 + {S1DREG_SDRAM_REF_RATE, 0x03}, /* 32768 <= MCLK <= 50000 (MHz) */
2997 + {S1DREG_SDRAM_TC0, 0x00}, /* MCLK source freq (MHz): */
2998 + {S1DREG_SDRAM_TC1, 0x01}, /* 42 <= MCLK <= 50 */
2999 + {S1DREG_MEM_CNF, 0x80}, /* SDRAM Initialization - needed before mem access */
3000 + {S1DREG_PANEL_TYPE, 0x25}, /* std TFT 16bit, 8bit SCP format 2, single passive LCD */
3001 + {S1DREG_MOD_RATE, 0x00}, /* toggle every FPFRAME */
3002 + {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* 680 pix */
3003 + {S1DREG_LCD_NDISP_HPER, 0x12}, /* 152 pix */
3004 + {S1DREG_TFT_FPLINE_START, 0x01}, /* 13 pix */
3005 + {S1DREG_TFT_FPLINE_PWIDTH, 0x0B}, /* 96 pix */
3006 + {S1DREG_LCD_DISP_VHEIGHT0, 0xDF},
3007 + {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* 480 lines */
3008 + {S1DREG_LCD_NDISP_VPER, 0x2C}, /* 44 lines */
3009 + {S1DREG_TFT_FPFRAME_START, 0x0A}, /* 10 lines */
3010 + {S1DREG_TFT_FPFRAME_PWIDTH, 0x01}, /* 2 lines */
3011 + {S1DREG_LCD_DISP_MODE, 0x05}, /* 16 bpp */
3012 + {S1DREG_LCD_MISC, 0x00}, /* dithering enabled, dual panel buffer enabled */
3013 + {S1DREG_LCD_DISP_START0, 0x00},
3014 + {S1DREG_LCD_DISP_START1, 0xC8},
3015 + {S1DREG_LCD_DISP_START2, 0x00},
3016 + {S1DREG_LCD_MEM_OFF0, 0x80},
3017 + {S1DREG_LCD_MEM_OFF1, 0x02},
3018 + {S1DREG_LCD_PIX_PAN, 0x00},
3019 + {S1DREG_LCD_DISP_FIFO_HTC, 0x3B},
3020 + {S1DREG_LCD_DISP_FIFO_LTC, 0x3C},
3021 + {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* 680 pix */
3022 + {S1DREG_CRT_NDISP_HPER, 0x13}, /* 160 pix */
3023 + {S1DREG_CRT_HRTC_START, 0x01}, /* 13 pix */
3024 + {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* 96 pix */
3025 + {S1DREG_CRT_DISP_VHEIGHT0, 0xDF},
3026 + {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* 480 lines */
3027 + {S1DREG_CRT_NDISP_VPER, 0x2B}, /* 44 lines */
3028 + {S1DREG_CRT_VRTC_START, 0x09}, /* 10 lines */
3029 + {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* 2 lines */
3030 + {S1DREG_TV_OUT_CTL, 0x10},
3033 + {S1DREG_CRT_DISP_MODE, 0x05}, /* 16 bpp */
3034 + {S1DREG_CRT_DISP_START0, 0x00},
3035 + {S1DREG_CRT_DISP_START1, 0x00},
3036 + {S1DREG_CRT_DISP_START2, 0x00},
3037 + {S1DREG_CRT_MEM_OFF0, 0x80},
3038 + {S1DREG_CRT_MEM_OFF1, 0x02},
3039 + {S1DREG_CRT_PIX_PAN, 0x00},
3040 + {S1DREG_CRT_DISP_FIFO_HTC, 0x3B},
3041 + {S1DREG_CRT_DISP_FIFO_LTC, 0x3C},
3042 + {S1DREG_LCD_CUR_CTL, 0x00}, /* inactive */
3043 + {S1DREG_LCD_CUR_START, 0x01},
3044 + {S1DREG_LCD_CUR_XPOS0, 0x00},
3045 + {S1DREG_LCD_CUR_XPOS1, 0x00},
3046 + {S1DREG_LCD_CUR_YPOS0, 0x00},
3047 + {S1DREG_LCD_CUR_YPOS1, 0x00},
3048 + {S1DREG_LCD_CUR_BCTL0, 0x00},
3049 + {S1DREG_LCD_CUR_GCTL0, 0x00},
3050 + {S1DREG_LCD_CUR_RCTL0, 0x00},
3051 + {S1DREG_LCD_CUR_BCTL1, 0x1F},
3052 + {S1DREG_LCD_CUR_GCTL1, 0x3F},
3053 + {S1DREG_LCD_CUR_RCTL1, 0x1F},
3054 + {S1DREG_LCD_CUR_FIFO_HTC, 0x00},
3055 + {S1DREG_CRT_CUR_CTL, 0x00}, /* inactive */
3056 + {S1DREG_CRT_CUR_START, 0x01},
3057 + {S1DREG_CRT_CUR_XPOS0, 0x00},
3058 + {S1DREG_CRT_CUR_XPOS1, 0x00},
3059 + {S1DREG_CRT_CUR_YPOS0, 0x00},
3060 + {S1DREG_CRT_CUR_YPOS1, 0x00},
3061 + {S1DREG_CRT_CUR_BCTL0, 0x00},
3062 + {S1DREG_CRT_CUR_GCTL0, 0x00},
3063 + {S1DREG_CRT_CUR_RCTL0, 0x00},
3064 + {S1DREG_CRT_CUR_BCTL1, 0x1F},
3065 + {S1DREG_CRT_CUR_GCTL1, 0x3F},
3066 + {S1DREG_CRT_CUR_RCTL1, 0x1F},
3067 + {S1DREG_CRT_CUR_FIFO_HTC, 0x00},
3068 + {S1DREG_BBLT_CTL0, 0x00},
3069 + {S1DREG_BBLT_CTL0, 0x00},
3070 + {S1DREG_BBLT_CC_EXP, 0x00},
3071 + {S1DREG_BBLT_OP, 0x00},
3072 + {S1DREG_BBLT_SRC_START0, 0x00},
3073 + {S1DREG_BBLT_SRC_START1, 0x00},
3074 + {S1DREG_BBLT_SRC_START2, 0x00},
3075 + {S1DREG_BBLT_DST_START0, 0x00},
3076 + {S1DREG_BBLT_DST_START1, 0x00},
3077 + {S1DREG_BBLT_DST_START2, 0x00},
3078 + {S1DREG_BBLT_MEM_OFF0, 0x00},
3079 + {S1DREG_BBLT_MEM_OFF1, 0x00},
3080 + {S1DREG_BBLT_WIDTH0, 0x00},
3081 + {S1DREG_BBLT_WIDTH1, 0x00},
3082 + {S1DREG_BBLT_HEIGHT0, 0x00},
3083 + {S1DREG_BBLT_HEIGHT1, 0x00},
3084 + {S1DREG_BBLT_BGC0, 0x00},
3085 + {S1DREG_BBLT_BGC1, 0x00},
3086 + {S1DREG_BBLT_FGC0, 0x00},
3087 + {S1DREG_BBLT_FGC1, 0x00},
3088 + {S1DREG_LKUP_MODE, 0x00}, /* LCD LUT r | LCD and CRT/TV LUT w */
3089 + {S1DREG_LKUP_ADDR, 0x00},
3090 + {S1DREG_PS_CNF, 0x10}, /* Power Save disable */
3091 + {S1DREG_PS_STATUS, 0x02}, /* LCD Panel down, mem up */
3092 + {S1DREG_CPU2MEM_WDOGT, 0x00},
3093 + {S1DREG_COM_DISP_MODE, 0x02}, /* enable CRT display output */
3096 +static struct s1d13xxxfb_pdata ek_s1dfb_pdata = {
3097 + .initregs = ek_s1dfb_initregs,
3098 + .initregssize = ARRAY_SIZE(ek_s1dfb_initregs),
3099 + .platform_init_video = ek_init_video,
3102 +static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
3104 +static struct resource ek_s1dfb_resource[] = {
3105 + [0] = { /* video mem */
3106 + .name = "s1d13806 memory",
3107 + .start = AT91_FB_VMEM_BASE,
3108 + .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1,
3109 + .flags = IORESOURCE_MEM,
3111 + [1] = { /* video registers */
3112 + .name = "s1d13806 registers",
3113 + .start = AT91_FB_REG_BASE,
3114 + .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1,
3115 + .flags = IORESOURCE_MEM,
3119 +static struct platform_device ek_s1dfb_device = {
3120 + .name = "s1d13806fb",
3123 + .dma_mask = &s1dfb_dmamask,
3124 + .coherent_dma_mask = DMA_BIT_MASK(32),
3125 + .platform_data = &ek_s1dfb_pdata,
3127 + .resource = ek_s1dfb_resource,
3128 + .num_resources = ARRAY_SIZE(ek_s1dfb_resource),
3131 +static void __init ek_add_device_video(void)
3133 + platform_device_register(&ek_s1dfb_device);
3136 +static void __init ek_add_device_video(void) {}
3139 static struct at91_eth_data __initdata ek_eth_data = {
3140 .phy_irq_pin = AT91_PIN_PC4,
3143 #define EK_FLASH_SIZE 0x200000
3145 static struct physmap_flash_data ek_flash_data = {
3150 static struct resource ek_flash_resource = {
3153 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
3155 -// ek_add_device_video();
3156 + ek_add_device_video();
3159 MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK")
3160 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-homematic.c linux-2.6/arch/arm/mach-at91/board-homematic.c
3161 --- linux-2.6.25/arch/arm/mach-at91/board-homematic.c 1970-01-01 02:00:00.000000000 +0200
3162 +++ linux-2.6/arch/arm/mach-at91/board-homematic.c 2008-04-25 21:15:43.000000000 +0200
3165 + * linux/arch/arm/mach-at91/board-homematic.c
3167 + * Copyright (C) 2007 eQ-3 Entwicklung GmbH
3170 + * Copyright (C) 2005 SAN People
3172 + * This program is free software; you can redistribute it and/or modify
3173 + * it under the terms of the GNU General Public License as published by
3174 + * the Free Software Foundation; either version 2 of the License, or
3175 + * (at your option) any later version.
3177 + * This program is distributed in the hope that it will be useful,
3178 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3179 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3180 + * GNU General Public License for more details.
3182 + * You should have received a copy of the GNU General Public License
3183 + * along with this program; if not, write to the Free Software
3184 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3187 +#include <linux/types.h>
3188 +#include <linux/init.h>
3189 +#include <linux/mm.h>
3190 +#include <linux/module.h>
3191 +#include <linux/platform_device.h>
3192 +#include <linux/spi/spi.h>
3193 +#include <linux/mtd/physmap.h>
3195 +#include <asm/hardware.h>
3196 +#include <asm/setup.h>
3197 +#include <asm/mach-types.h>
3198 +#include <asm/irq.h>
3200 +#include <asm/mach/arch.h>
3201 +#include <asm/mach/map.h>
3202 +#include <asm/mach/irq.h>
3204 +#include <asm/arch/board.h>
3205 +#include <asm/arch/gpio.h>
3206 +#include <asm/arch/at91rm9200_mc.h>
3208 +#include "generic.h"
3212 + * Serial port configuration.
3213 + * 0 .. 3 = USART0 .. USART3
3216 +static struct at91_uart_config __initdata homematic_uart_config = {
3217 + .console_tty = 0, /* ttyS0 */
3219 + .tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
3222 +static void __init homematic_map_io(void)
3224 + /* Initialize processor: 18.432 MHz crystal */
3225 + at91rm9200_initialize(18432000, AT91RM9200_BGA);
3227 + /* Setup the serial ports and console */
3228 + at91_init_serial(&homematic_uart_config);
3231 +static void __init homematic_init_irq(void)
3233 + at91rm9200_init_interrupts(NULL);
3236 +static struct at91_eth_data __initdata homematic_eth_data = {
3237 + .phy_irq_pin = AT91_PIN_PC4,
3241 +static struct at91_usbh_data __initdata homematic_usbh_data = {
3245 +static struct at91_udc_data __initdata homematic_udc_data = {
3246 + .vbus_pin = AT91_PIN_PD4,
3247 + .pullup_pin = AT91_PIN_PD5,
3250 +static struct at91_mmc_data __initdata homematic_mmc_data = {
3255 +static struct spi_board_info homematic_spi_devices[] = {
3256 + { /* DataFlash chip */
3257 + .modalias = "mtd_dataflash",
3259 + .max_speed_hz = 15 * 1000 * 1000,
3263 +static struct mtd_partition __initdata homematic_nand_partition[] = {
3267 + .size = 0x02000000,
3269 + .name = "storage",
3270 + .offset = 0x02000000,
3271 + .size = MTDPART_SIZ_FULL,
3275 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
3277 + *num_partitions = ARRAY_SIZE(homematic_nand_partition);
3278 + return homematic_nand_partition;
3281 +static struct at91_nand_data __initdata homematic_nand_data = {
3284 +// .det_pin = AT91_PIN_PB1,
3285 + .rdy_pin = AT91_PIN_PC2,
3286 + .enable_pin = AT91_PIN_PC0,
3287 + .partition_info = nand_partitions,
3290 +static void __init homematic_board_init(void)
3293 + at91_add_device_serial();
3295 + at91_add_device_eth(&homematic_eth_data);
3297 + at91_add_device_usbh(&homematic_usbh_data);
3299 + at91_add_device_udc(&homematic_udc_data);
3300 + at91_set_multi_drive(homematic_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
3302 + at91_add_device_i2c(NULL, 0);
3304 + at91_add_device_spi(homematic_spi_devices, ARRAY_SIZE(homematic_spi_devices));
3305 +#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
3306 + /* DataFlash card */
3307 + at91_set_gpio_output(AT91_PIN_PB7, 0);
3310 + at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
3311 + at91_add_device_mmc(0, &homematic_mmc_data);
3314 + at91_add_device_nand(&homematic_nand_data);
3317 +MACHINE_START(HOMEMATIC, "HomeMatic")
3318 + /* Maintainer: eQ-3 */
3319 + .phys_io = AT91_BASE_SYS,
3320 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
3321 + .boot_params = AT91_SDRAM_BASE + 0x100,
3322 + .timer = &at91rm9200_timer,
3323 + .map_io = homematic_map_io,
3324 + .init_irq = homematic_init_irq,
3325 + .init_machine = homematic_board_init,
3327 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-kb9202.c linux-2.6/arch/arm/mach-at91/board-kb9202.c
3328 --- linux-2.6.25/arch/arm/mach-at91/board-kb9202.c 2008-05-03 00:15:33.000000000 +0200
3329 +++ linux-2.6/arch/arm/mach-at91/board-kb9202.c 2008-04-25 21:15:43.000000000 +0200
3331 #include <asm/arch/board.h>
3332 #include <asm/arch/gpio.h>
3334 -#include "generic.h"
3335 +#include <asm/arch/at91rm9200_mc.h>
3337 +#include "generic.h"
3340 - * Serial port configuration.
3341 - * 0 .. 3 = USART0 .. USART3
3344 -static struct at91_uart_config __initdata kb9202_uart_config = {
3345 - .console_tty = 0, /* ttyS0 */
3347 - .tty_map = { 4, 0, 1, -1, -1 } /* ttyS0, ..., ttyS4 */
3350 static void __init kb9202_map_io(void)
3353 /* Set up the LEDs */
3354 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
3356 - /* Setup the serial ports and console */
3357 - at91_init_serial(&kb9202_uart_config);
3358 + /* DBGU on ttyS0. (Rx & Tx only) */
3359 + at91_register_uart(0, 0, 0);
3361 + /* USART0 on ttyS1 (Rx & Tx only) */
3362 + at91_register_uart(AT91RM9200_ID_US0, 1, 0);
3364 + /* USART1 on ttyS2 (Rx & Tx only) - IRDA (optional) */
3365 + at91_register_uart(AT91RM9200_ID_US1, 2, 0);
3367 + /* USART3 on ttyS3 (Rx, Tx, CTS, RTS) - RS485 (optional) */
3368 + at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
3370 + /* set serial console to ttyS0 (ie, DBGU) */
3371 + at91_set_serial_console(0);
3374 static void __init kb9202_init_irq(void)
3375 @@ -111,6 +114,48 @@
3376 .partition_info = nand_partitions,
3380 +#if defined(CONFIG_FB_S1D15605)
3381 +#warning "The Reset pin must be passed via platform_data, not this way"
3382 +static struct resource kb9202_lcd_resources[] = {
3384 + .start = AT91_CHIPSELECT_2,
3385 + .end = AT91_CHIPSELECT_2 + 0x200FF,
3386 + .flags = IORESOURCE_MEM
3388 + [1] = { /* reset pin */
3389 + .start = AT91_PIN_PC22,
3390 + .end = AT91_PIN_PC22,
3391 + .flags = IORESOURCE_MEM
3395 +static struct platform_device kb9202_lcd_device = {
3396 + .name = "s1d15605fb",
3398 + .num_resources = ARRAY_SIZE(kb9202_lcd_resources),
3399 + .resource = kb9202_lcd_resources,
3402 +static void __init kb9202_add_device_lcd(void)
3404 + /* In case the boot loader did not set the chip select mode and timing */
3405 + at91_sys_write(AT91_SMC_CSR(2),
3406 + AT91_SMC_WSEN | AT91_SMC_NWS_(18) | AT91_SMC_TDF_(1) | AT91_SMC_DBW_8 |
3407 + AT91_SMC_RWSETUP_(1) | AT91_SMC_RWHOLD_(1));
3409 + /* Backlight pin = output, off */
3410 + at91_set_gpio_output(AT91_PIN_PC23, 0);
3412 + /* Reset pin = output, in reset */
3413 + at91_set_gpio_output(AT91_PIN_PC22, 0);
3415 + platform_device_register(&kb9202_lcd_device);
3418 +static void __init kb9202_add_device_lcd(void) {}
3421 static void __init kb9202_board_init(void)
3425 at91_add_device_spi(NULL, 0);
3427 at91_add_device_nand(&kb9202_nand_data);
3429 + kb9202_add_device_lcd();
3432 MACHINE_START(KB9200, "KB920x")
3433 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-qil-a9260.c linux-2.6/arch/arm/mach-at91/board-qil-a9260.c
3434 --- linux-2.6.25/arch/arm/mach-at91/board-qil-a9260.c 1970-01-01 02:00:00.000000000 +0200
3435 +++ linux-2.6/arch/arm/mach-at91/board-qil-a9260.c 2008-04-25 21:15:43.000000000 +0200
3438 + * linux/arch/arm/mach-at91/board-qil-a9260.c
3440 + * Copyright (C) 2005 SAN People
3441 + * Copyright (C) 2006 Atmel
3442 + * Copyright (C) 2007 Calao-systems
3444 + * This program is free software; you can redistribute it and/or modify
3445 + * it under the terms of the GNU General Public License as published by
3446 + * the Free Software Foundation; either version 2 of the License, or
3447 + * (at your option) any later version.
3449 + * This program is distributed in the hope that it will be useful,
3450 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3451 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3452 + * GNU General Public License for more details.
3454 + * You should have received a copy of the GNU General Public License
3455 + * along with this program; if not, write to the Free Software
3456 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3459 +#include <linux/types.h>
3460 +#include <linux/init.h>
3461 +#include <linux/mm.h>
3462 +#include <linux/module.h>
3463 +#include <linux/platform_device.h>
3464 +#include <linux/spi/spi.h>
3465 +#include <linux/gpio_keys.h>
3466 +#include <linux/input.h>
3467 +#include <linux/clk.h>
3469 +#include <asm/hardware.h>
3470 +#include <asm/setup.h>
3471 +#include <asm/mach-types.h>
3472 +#include <asm/irq.h>
3474 +#include <asm/mach/arch.h>
3475 +#include <asm/mach/map.h>
3476 +#include <asm/mach/irq.h>
3478 +#include <asm/arch/board.h>
3479 +#include <asm/arch/gpio.h>
3480 +#include <asm/arch/at91_shdwc.h>
3482 +#include "generic.h"
3485 +static void __init ek_map_io(void)
3487 + /* Initialize processor: 12.000 MHz crystal */
3488 + at91sam9260_initialize(12000000);
3490 + /* DGBU on ttyS0. (Rx & Tx only) */
3491 + at91_register_uart(0, 0, 0);
3493 + /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
3494 + at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
3495 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
3498 + /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
3499 + at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
3501 + /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
3502 + at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
3504 + /* set serial console to ttyS1 (ie, USART0) */
3505 + at91_set_serial_console(1);
3509 +static void __init ek_init_irq(void)
3511 + at91sam9260_init_interrupts(NULL);
3518 +static struct at91_usbh_data __initdata ek_usbh_data = {
3525 +static struct at91_udc_data __initdata ek_udc_data = {
3526 + .vbus_pin = AT91_PIN_PC5,
3527 + .pullup_pin = 0, /* pull-up driven by UDC */
3533 +static struct spi_board_info ek_spi_devices[] = {
3534 +#if defined(CONFIG_RTC_DRV_M41T94)
3535 + { /* M41T94 RTC */
3536 + .modalias = "m41t94",
3538 + .max_speed_hz = 1 * 1000 * 1000,
3545 + * MACB Ethernet device
3547 +static struct at91_eth_data __initdata ek_macb_data = {
3548 + .phy_irq_pin = AT91_PIN_PA31,
3555 +static struct mtd_partition __initdata ek_nand_partition[] = {
3557 + .name = "Uboot & Kernel",
3558 + .offset = 0x00000000,
3559 + .size = 16 * 1024 * 1024,
3562 + .name = "Root FS",
3563 + .offset = 0x01000000,
3564 + .size = 120 * 1024 * 1024,
3568 + .offset = 0x08800000,
3569 + .size = 120 * 1024 * 1024,
3573 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
3575 + *num_partitions = ARRAY_SIZE(ek_nand_partition);
3576 + return ek_nand_partition;
3579 +static struct at91_nand_data __initdata ek_nand_data = {
3582 +// .det_pin = ... not connected
3583 + .rdy_pin = AT91_PIN_PC13,
3584 + .enable_pin = AT91_PIN_PC14,
3585 + .partition_info = nand_partitions,
3586 +#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
3587 + .bus_width_16 = 1,
3589 + .bus_width_16 = 0,
3596 +static struct at91_mmc_data __initdata ek_mmc_data = {
3599 +// .det_pin = ... not connected
3600 +// .wp_pin = ... not connected
3601 +// .vcc_pin = ... not connected
3607 +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
3608 +static struct gpio_keys_button ek_buttons[] = {
3609 + { /* USER PUSH BUTTON */
3610 + .code = KEY_ENTER,
3611 + .gpio = AT91_PIN_PB10,
3613 + .desc = "user_pb",
3618 +static struct gpio_keys_platform_data ek_button_data = {
3619 + .buttons = ek_buttons,
3620 + .nbuttons = ARRAY_SIZE(ek_buttons),
3623 +static struct platform_device ek_button_device = {
3624 + .name = "gpio-keys",
3626 + .num_resources = 0,
3628 + .platform_data = &ek_button_data,
3632 +static void __init ek_add_device_buttons(void)
3634 + at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
3635 + at91_set_deglitch(AT91_PIN_PB10, 1);
3637 + platform_device_register(&ek_button_device);
3640 +static void __init ek_add_device_buttons(void) {}
3646 +static struct gpio_led ek_leds[] = {
3647 + { /* user_led (green) */
3648 + .name = "user_led",
3649 + .gpio = AT91_PIN_PB21,
3651 + .default_trigger = "heartbeat",
3655 +static void __init ek_board_init(void)
3658 + at91_add_device_serial();
3660 + at91_add_device_usbh(&ek_usbh_data);
3662 + at91_add_device_udc(&ek_udc_data);
3664 + at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
3666 + at91_add_device_nand(&ek_nand_data);
3668 + at91_add_device_i2c(NULL, 0);
3670 + at91_add_device_eth(&ek_macb_data);
3672 + at91_add_device_mmc(0, &ek_mmc_data);
3673 + /* Push Buttons */
3674 + ek_add_device_buttons();
3676 + at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
3677 + /* shutdown controller, wakeup button (5 msec low) */
3678 + at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
3679 + | AT91_SHDW_RTTWKEN);
3682 +MACHINE_START(QIL_A9260, "CALAO QIL_A9260")
3683 + /* Maintainer: calao-systems */
3684 + .phys_io = AT91_BASE_SYS,
3685 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
3686 + .boot_params = AT91_SDRAM_BASE + 0x100,
3687 + .timer = &at91sam926x_timer,
3688 + .map_io = ek_map_io,
3689 + .init_irq = ek_init_irq,
3690 + .init_machine = ek_board_init,
3692 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-sam9-l9260.c linux-2.6/arch/arm/mach-at91/board-sam9-l9260.c
3693 --- linux-2.6.25/arch/arm/mach-at91/board-sam9-l9260.c 1970-01-01 02:00:00.000000000 +0200
3694 +++ linux-2.6/arch/arm/mach-at91/board-sam9-l9260.c 2008-04-25 21:15:43.000000000 +0200
3697 + * linux/arch/arm/mach-at91/board-sam9-l9260.c
3699 + * Copyright (C) 2005 SAN People
3700 + * Copyright (C) 2006 Atmel
3701 + * Copyright (C) 2007 Olimex Ltd
3703 + * This program is free software; you can redistribute it and/or modify
3704 + * it under the terms of the GNU General Public License as published by
3705 + * the Free Software Foundation; either version 2 of the License, or
3706 + * (at your option) any later version.
3708 + * This program is distributed in the hope that it will be useful,
3709 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3710 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3711 + * GNU General Public License for more details.
3713 + * You should have received a copy of the GNU General Public License
3714 + * along with this program; if not, write to the Free Software
3715 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3718 +#include <linux/types.h>
3719 +#include <linux/init.h>
3720 +#include <linux/mm.h>
3721 +#include <linux/module.h>
3722 +#include <linux/platform_device.h>
3723 +#include <linux/spi/spi.h>
3725 +#include <asm/hardware.h>
3726 +#include <asm/setup.h>
3727 +#include <asm/mach-types.h>
3728 +#include <asm/irq.h>
3730 +#include <asm/mach/arch.h>
3731 +#include <asm/mach/map.h>
3732 +#include <asm/mach/irq.h>
3734 +#include <asm/arch/board.h>
3735 +#include <asm/arch/gpio.h>
3737 +#include "generic.h"
3740 +static void __init ek_map_io(void)
3742 + /* Initialize processor: 18.432 MHz crystal */
3743 + at91sam9260_initialize(18432000);
3745 + /* Setup the LEDs */
3746 + at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6);
3748 + /* DBGU on ttyS0. (Rx & Tx only) */
3749 + at91_register_uart(0, 0, 0);
3751 + /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
3752 + at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
3753 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
3756 + /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
3757 + at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
3759 + /* set serial console to ttyS0 (ie, DBGU) */
3760 + at91_set_serial_console(0);
3763 +static void __init ek_init_irq(void)
3765 + at91sam9260_init_interrupts(NULL);
3772 +static struct at91_usbh_data __initdata ek_usbh_data = {
3779 +static struct at91_udc_data __initdata ek_udc_data = {
3780 + .vbus_pin = AT91_PIN_PC5,
3781 + .pullup_pin = 0, /* pull-up driven by UDC */
3788 +static struct spi_board_info ek_spi_devices[] = {
3789 +#if !defined(CONFIG_MMC_AT91)
3790 + { /* DataFlash chip */
3791 + .modalias = "mtd_dataflash",
3793 + .max_speed_hz = 15 * 1000 * 1000,
3796 +#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
3797 + { /* DataFlash card */
3798 + .modalias = "mtd_dataflash",
3800 + .max_speed_hz = 15 * 1000 * 1000,
3809 + * MACB Ethernet device
3811 +static struct at91_eth_data __initdata ek_macb_data = {
3812 + .phy_irq_pin = AT91_PIN_PA7,
3820 +static struct mtd_partition __initdata ek_nand_partition[] = {
3822 + .name = "Bootloader Area",
3824 + .size = 10 * 1024 * 1024,
3827 + .name = "User Area",
3828 + .offset = 10 * 1024 * 1024,
3829 + .size = MTDPART_SIZ_FULL,
3833 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
3835 + *num_partitions = ARRAY_SIZE(ek_nand_partition);
3836 + return ek_nand_partition;
3839 +static struct at91_nand_data __initdata ek_nand_data = {
3842 +// .det_pin = ... not connected
3843 + .rdy_pin = AT91_PIN_PC13,
3844 + .enable_pin = AT91_PIN_PC14,
3845 + .partition_info = nand_partitions,
3846 +#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
3847 + .bus_width_16 = 1,
3849 + .bus_width_16 = 0,
3857 +static struct at91_mmc_data __initdata ek_mmc_data = {
3860 + .det_pin = AT91_PIN_PC8,
3861 + .wp_pin = AT91_PIN_PC4,
3862 +// .vcc_pin = ... not connected
3865 +static void __init ek_board_init(void)
3868 + at91_add_device_serial();
3870 + at91_add_device_usbh(&ek_usbh_data);
3872 + at91_add_device_udc(&ek_udc_data);
3874 + at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
3876 + at91_add_device_nand(&ek_nand_data);
3878 + at91_add_device_eth(&ek_macb_data);
3880 + at91_add_device_mmc(0, &ek_mmc_data);
3882 + at91_add_device_i2c(NULL, 0);
3885 +MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260")
3886 + /* Maintainer: Olimex */
3887 + .phys_io = AT91_BASE_SYS,
3888 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
3889 + .boot_params = AT91_SDRAM_BASE + 0x100,
3890 + .timer = &at91sam926x_timer,
3891 + .map_io = ek_map_io,
3892 + .init_irq = ek_init_irq,
3893 + .init_machine = ek_board_init,
3895 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-sam9260ek.c linux-2.6/arch/arm/mach-at91/board-sam9260ek.c
3896 --- linux-2.6.25/arch/arm/mach-at91/board-sam9260ek.c 2008-05-03 00:15:33.000000000 +0200
3897 +++ linux-2.6/arch/arm/mach-at91/board-sam9260ek.c 2008-05-01 23:56:24.000000000 +0200
3899 #include <linux/module.h>
3900 #include <linux/platform_device.h>
3901 #include <linux/spi/spi.h>
3902 +#include <linux/spi/at73c213.h>
3903 +#include <linux/clk.h>
3904 +#include <linux/gpio_keys.h>
3905 +#include <linux/input.h>
3907 #include <asm/hardware.h>
3908 #include <asm/setup.h>
3911 #include <asm/arch/board.h>
3912 #include <asm/arch/gpio.h>
3913 -#include <asm/arch/at91sam926x_mc.h>
3914 +#include <asm/arch/at91_shdwc.h>
3916 #include "generic.h"
3920 - * Serial port configuration.
3921 - * 0 .. 5 = USART0 .. USART5
3924 -static struct at91_uart_config __initdata ek_uart_config = {
3925 - .console_tty = 0, /* ttyS0 */
3927 - .tty_map = { 6, 0, 1, -1, -1, -1, -1 } /* ttyS0, ..., ttyS6 */
3930 static void __init ek_map_io(void)
3932 /* Initialize processor: 18.432 MHz crystal */
3933 at91sam9260_initialize(18432000);
3935 - /* Setup the serial ports and console */
3936 - at91_init_serial(&ek_uart_config);
3937 + /* DGBU on ttyS0. (Rx & Tx only) */
3938 + at91_register_uart(0, 0, 0);
3940 + /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
3941 + at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
3942 + | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
3945 + /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
3946 + at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
3948 + /* set serial console to ttyS0 (ie, DBGU) */
3949 + at91_set_serial_console(0);
3952 static void __init ek_init_irq(void)
3959 +static struct at73c213_board_info at73c213_data = {
3961 + .shortname = "AT91SAM9260-EK external DAC",
3964 +#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
3965 +static void __init at73c213_set_clk(struct at73c213_board_info *info)
3970 + pck0 = clk_get(NULL, "pck0");
3971 + plla = clk_get(NULL, "plla");
3973 + /* AT73C213 MCK Clock */
3974 + at91_set_B_periph(AT91_PIN_PC1, 0); /* PCK0 */
3976 + clk_set_parent(pck0, plla);
3979 + info->dac_clk = pck0;
3982 +static void __init at73c213_set_clk(struct at73c213_board_info *info) {}
3988 static struct spi_board_info ek_spi_devices[] = {
3991 .max_speed_hz = 10 * 1000 * 1000,
3993 + .mode = SPI_MODE_1,
3994 + .platform_data = &at73c213_data,
3998 @@ -172,6 +207,74 @@
3999 // .vcc_pin = ... not connected
4006 +static struct gpio_led ek_leds[] = {
4007 + { /* "bottom" led, green, userled1 to be defined */
4009 + .gpio = AT91_PIN_PA6,
4011 + .default_trigger = "none",
4013 + { /* "power" led, yellow */
4015 + .gpio = AT91_PIN_PA9,
4016 + .default_trigger = "heartbeat",
4024 +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
4025 +static struct gpio_keys_button ek_buttons[] = {
4027 + .gpio = AT91_PIN_PA30,
4029 + .desc = "Button 3",
4034 + .gpio = AT91_PIN_PA31,
4036 + .desc = "Button 4",
4042 +static struct gpio_keys_platform_data ek_button_data = {
4043 + .buttons = ek_buttons,
4044 + .nbuttons = ARRAY_SIZE(ek_buttons),
4047 +static struct platform_device ek_button_device = {
4048 + .name = "gpio-keys",
4050 + .num_resources = 0,
4052 + .platform_data = &ek_button_data,
4056 +static void __init ek_add_device_buttons(void)
4058 + at91_set_gpio_input(AT91_PIN_PA30, 1); /* btn3 */
4059 + at91_set_deglitch(AT91_PIN_PA30, 1);
4060 + at91_set_gpio_input(AT91_PIN_PA31, 1); /* btn4 */
4061 + at91_set_deglitch(AT91_PIN_PA31, 1);
4063 + platform_device_register(&ek_button_device);
4066 +static void __init ek_add_device_buttons(void) {}
4070 static void __init ek_board_init(void)
4073 @@ -190,6 +293,16 @@
4074 at91_add_device_mmc(0, &ek_mmc_data);
4076 at91_add_device_i2c(NULL, 0);
4077 + /* SSC (to AT73C213) */
4078 + at73c213_set_clk(&at73c213_data);
4079 + at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
4081 + at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
4082 + /* Push Buttons */
4083 + ek_add_device_buttons();
4084 + /* shutdown controller, wakeup button (5 msec low) */
4085 + at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
4086 + | AT91_SHDW_RTTWKEN);
4089 MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
4090 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-sam9261ek.c linux-2.6/arch/arm/mach-at91/board-sam9261ek.c
4091 --- linux-2.6.25/arch/arm/mach-at91/board-sam9261ek.c 2008-05-03 00:15:44.000000000 +0200
4092 +++ linux-2.6/arch/arm/mach-at91/board-sam9261ek.c 2008-05-01 23:53:20.000000000 +0200
4094 #include <linux/platform_device.h>
4095 #include <linux/spi/spi.h>
4096 #include <linux/spi/ads7846.h>
4097 +#include <linux/spi/at73c213.h>
4098 +#include <linux/clk.h>
4099 #include <linux/dm9000.h>
4100 #include <linux/fb.h>
4101 #include <linux/gpio_keys.h>
4104 #include <asm/arch/board.h>
4105 #include <asm/arch/gpio.h>
4106 -#include <asm/arch/at91sam926x_mc.h>
4107 +#include <asm/arch/at91sam9_smc.h>
4108 +#include <asm/arch/at91_shdwc.h>
4110 #include "generic.h"
4114 - * Serial port configuration.
4115 - * 0 .. 2 = USART0 .. USART2
4118 -static struct at91_uart_config __initdata ek_uart_config = {
4119 - .console_tty = 0, /* ttyS0 */
4121 - .tty_map = { 3, -1, -1, -1 } /* ttyS0, ..., ttyS3 */
4124 static void __init ek_map_io(void)
4126 /* Initialize processor: 18.432 MHz crystal */
4128 /* Setup the LEDs */
4129 at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14);
4131 - /* Setup the serial ports and console */
4132 - at91_init_serial(&ek_uart_config);
4133 + /* DGBU on ttyS0. (Rx & Tx only) */
4134 + at91_register_uart(0, 0, 0);
4136 + /* set serial console to ttyS0 (ie, DBGU) */
4137 + at91_set_serial_console(0);
4140 static void __init ek_init_irq(void)
4141 @@ -239,6 +234,35 @@
4147 +static struct at73c213_board_info at73c213_data = {
4149 + .shortname = "AT91SAM9261-EK external DAC",
4152 +#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
4153 +static void __init at73c213_set_clk(struct at73c213_board_info *info)
4158 + pck2 = clk_get(NULL, "pck2");
4159 + plla = clk_get(NULL, "plla");
4161 + /* AT73C213 MCK Clock */
4162 + at91_set_B_periph(AT91_PIN_PB31, 0); /* PCK2 */
4164 + clk_set_parent(pck2, plla);
4167 + info->dac_clk = pck2;
4170 +static void __init at73c213_set_clk(struct at73c213_board_info *info) {}
4176 static struct spi_board_info ek_spi_devices[] = {
4177 @@ -252,10 +276,11 @@
4179 .modalias = "ads7846",
4181 - .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
4182 + .max_speed_hz = 125000 * 16, /* max sample rate * clocks per sample */
4184 .platform_data = &ads_info,
4185 .irq = AT91SAM9261_ID_IRQ0,
4186 + .controller_data = (void *) AT91_PIN_PA28, /* CS pin */
4189 #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
4192 .max_speed_hz = 10 * 1000 * 1000,
4194 + .mode = SPI_MODE_1,
4195 + .platform_data = &at73c213_data,
4196 + .controller_data = (void*) AT91_PIN_PA29, /* default for CS3 is PA6, but it must be PA29 */
4200 @@ -408,24 +436,28 @@
4207 .gpio = AT91_PIN_PA26,
4214 .gpio = AT91_PIN_PA25,
4221 .gpio = AT91_PIN_PA24,
4229 @@ -445,13 +477,13 @@
4231 static void __init ek_add_device_buttons(void)
4233 - at91_set_gpio_input(AT91_PIN_PA27, 0); /* btn0 */
4234 + at91_set_gpio_input(AT91_PIN_PA27, 1); /* btn0 */
4235 at91_set_deglitch(AT91_PIN_PA27, 1);
4236 - at91_set_gpio_input(AT91_PIN_PA26, 0); /* btn1 */
4237 + at91_set_gpio_input(AT91_PIN_PA26, 1); /* btn1 */
4238 at91_set_deglitch(AT91_PIN_PA26, 1);
4239 - at91_set_gpio_input(AT91_PIN_PA25, 0); /* btn2 */
4240 + at91_set_gpio_input(AT91_PIN_PA25, 1); /* btn2 */
4241 at91_set_deglitch(AT91_PIN_PA25, 1);
4242 - at91_set_gpio_input(AT91_PIN_PA24, 0); /* btn3 */
4243 + at91_set_gpio_input(AT91_PIN_PA24, 1); /* btn3 */
4244 at91_set_deglitch(AT91_PIN_PA24, 1);
4246 platform_device_register(&ek_button_device);
4247 @@ -460,6 +492,29 @@
4248 static void __init ek_add_device_buttons(void) {}
4254 +static struct gpio_led ek_leds[] = {
4255 + { /* "bottom" led, green, userled1 to be defined */
4257 + .gpio = AT91_PIN_PA14,
4259 + .default_trigger = "none",
4261 + { /* "top" led, green, userled2 to be defined */
4263 + .gpio = AT91_PIN_PA13,
4265 + .default_trigger = "none",
4267 + { /* "power" led, yellow */
4269 + .gpio = AT91_PIN_PA23,
4270 + .default_trigger = "heartbeat",
4274 static void __init ek_board_init(void)
4278 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
4281 + /* SSC (to AT73C213) */
4282 + at73c213_set_clk(&at73c213_data);
4283 + at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX);
4286 at91_add_device_mmc(0, &ek_mmc_data);
4287 @@ -489,6 +547,11 @@
4288 at91_add_device_lcdc(&ek_lcdc_data);
4290 ek_add_device_buttons();
4292 + at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
4293 + /* shutdown controller, wakeup button (5 msec low) */
4294 + at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
4295 + | AT91_SHDW_RTTWKEN);
4298 MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
4299 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-sam9263ek.c linux-2.6/arch/arm/mach-at91/board-sam9263ek.c
4300 --- linux-2.6.25/arch/arm/mach-at91/board-sam9263ek.c 2008-05-03 00:15:44.000000000 +0200
4301 +++ linux-2.6/arch/arm/mach-at91/board-sam9263ek.c 2008-05-01 23:53:20.000000000 +0200
4304 #include <asm/arch/board.h>
4305 #include <asm/arch/gpio.h>
4306 -#include <asm/arch/at91sam926x_mc.h>
4307 +#include <asm/arch/at91_shdwc.h>
4309 #include "generic.h"
4313 - * Serial port configuration.
4314 - * 0 .. 2 = USART0 .. USART2
4317 -static struct at91_uart_config __initdata ek_uart_config = {
4318 - .console_tty = 0, /* ttyS0 */
4320 - .tty_map = { 3, 0, -1, -1, } /* ttyS0, ..., ttyS3 */
4323 static void __init ek_map_io(void)
4325 /* Initialize processor: 16.367 MHz crystal */
4326 at91sam9263_initialize(16367660);
4328 - /* Setup the serial ports and console */
4329 - at91_init_serial(&ek_uart_config);
4330 + /* DGBU on ttyS0. (Rx & Tx only) */
4331 + at91_register_uart(0, 0, 0);
4333 + /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
4334 + at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
4336 + /* set serial console to ttyS0 (ie, DBGU) */
4337 + at91_set_serial_console(0);
4340 static void __init ek_init_irq(void)
4343 .modalias = "ads7846",
4345 - .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
4346 + .max_speed_hz = 125000 * 16, /* max sample rate * clocks per sample */
4348 .platform_data = &ads_info,
4349 .irq = AT91SAM9263_ID_IRQ1,
4352 static void __init ek_add_device_buttons(void)
4354 - at91_set_GPIO_periph(AT91_PIN_PC5, 0); /* left button */
4355 + at91_set_GPIO_periph(AT91_PIN_PC5, 1); /* left button */
4356 at91_set_deglitch(AT91_PIN_PC5, 1);
4357 - at91_set_GPIO_periph(AT91_PIN_PC4, 0); /* right button */
4358 + at91_set_GPIO_periph(AT91_PIN_PC4, 1); /* right button */
4359 at91_set_deglitch(AT91_PIN_PC4, 1);
4361 platform_device_register(&ek_button_device);
4364 .gpio = AT91_PIN_PB7,
4365 .default_trigger = "heartbeat",
4372 at91_add_device_ac97(&ek_ac97_data);
4374 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
4375 + /* shutdown controller, wakeup button (5 msec low) */
4376 + at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
4377 + | AT91_SHDW_RTTWKEN);
4380 MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
4381 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-sam9rlek.c linux-2.6/arch/arm/mach-at91/board-sam9rlek.c
4382 --- linux-2.6.25/arch/arm/mach-at91/board-sam9rlek.c 2008-05-03 00:15:33.000000000 +0200
4383 +++ linux-2.6/arch/arm/mach-at91/board-sam9rlek.c 2008-04-25 21:15:43.000000000 +0200
4386 #include <asm/arch/board.h>
4387 #include <asm/arch/gpio.h>
4388 -#include <asm/arch/at91sam926x_mc.h>
4389 +#include <asm/arch/at91_shdwc.h>
4391 #include "generic.h"
4395 - * Serial port configuration.
4396 - * 0 .. 3 = USART0 .. USART3
4399 -static struct at91_uart_config __initdata ek_uart_config = {
4400 - .console_tty = 0, /* ttyS0 */
4402 - .tty_map = { 4, 0, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
4405 static void __init ek_map_io(void)
4407 /* Initialize processor: 12.000 MHz crystal */
4408 at91sam9rl_initialize(12000000);
4410 - /* Setup the serial ports and console */
4411 - at91_init_serial(&ek_uart_config);
4412 + /* DGBU on ttyS0. (Rx & Tx only) */
4413 + at91_register_uart(0, 0, 0);
4415 + /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
4416 + at91_register_uart(AT91SAM9RL_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
4418 + /* set serial console to ttyS0 (ie, DBGU) */
4419 + at91_set_serial_console(0);
4422 static void __init ek_init_irq(void)
4427 + * USB HS Device port
4429 +static struct usba_platform_data __initdata ek_usba_udc_data = {
4430 + .vbus_pin = AT91_PIN_PA8,
4437 static struct at91_mmc_data __initdata ek_mmc_data = {
4441 at91_add_device_serial();
4443 + at91_add_device_usba(&ek_usba_udc_data);
4445 at91_add_device_i2c(NULL, 0);
4448 at91_add_device_mmc(0, &ek_mmc_data);
4449 /* LCD Controller */
4450 at91_add_device_lcdc(&ek_lcdc_data);
4451 + /* shutdown controller, wakeup button (5 msec low) */
4452 + at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
4453 + | AT91_SHDW_RTTWKEN);
4456 MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK")
4457 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-tms.c linux-2.6/arch/arm/mach-at91/board-tms.c
4458 --- linux-2.6.25/arch/arm/mach-at91/board-tms.c 1970-01-01 02:00:00.000000000 +0200
4459 +++ linux-2.6/arch/arm/mach-at91/board-tms.c 2008-04-25 21:15:43.000000000 +0200
4462 +* linux/arch/arm/mach-at91/board-tms.c
4464 +* Copyright (C) 2005 SAN People
4466 +* Adapted from board-dk to sweda TMS-100 by Luiz de Barros <lboneto@gmail.com>
4468 +* This program is free software; you can redistribute it and/or modify
4469 +* it under the terms of the GNU General Public License as published by
4470 +* the Free Software Foundation; either version 2 of the License, or
4471 +* (at your option) any later version.
4473 +* This program is distributed in the hope that it will be useful,
4474 +* but WITHOUT ANY WARRANTY; without even the implied warranty of
4475 +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4476 +* GNU General Public License for more details.
4478 +* You should have received a copy of the GNU General Public License
4479 +* along with this program; if not, write to the Free Software
4480 +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4483 +#include <linux/types.h>
4484 +#include <linux/init.h>
4485 +#include <linux/mm.h>
4486 +#include <linux/module.h>
4487 +#include <linux/platform_device.h>
4488 +#include <linux/spi/spi.h>
4489 +#include <linux/mtd/physmap.h>
4491 +#include <asm/hardware.h>
4492 +#include <asm/setup.h>
4493 +#include <asm/mach-types.h>
4494 +#include <asm/irq.h>
4496 +#include <asm/mach/arch.h>
4497 +#include <asm/mach/map.h>
4498 +#include <asm/mach/irq.h>
4500 +#include <asm/arch/board.h>
4501 +#include <asm/arch/gpio.h>
4502 +#include <asm/arch/at91rm9200_mc.h>
4504 +#include "generic.h"
4505 +#include <linux/serial_8250.h>
4508 +#define SERIAL_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP| UPF_SHARE_IRQ)
4509 +#define SERIAL_CLK (1843200)
4512 +/*---------------------------------------------------------------------
4516 +#define PORT(_base, _irq) \
4518 + .mapbase = _base, \
4520 + .uartclk = SERIAL_CLK, \
4521 + .iotype = UPIO_MEM, \
4523 + .flags = SERIAL_FLAGS, \
4526 +static struct plat_serial8250_port tms_data[] = {
4527 + PORT(0x70000000, AT91_PIN_PC3),
4528 + PORT(0x80000000, AT91_PIN_PC5),
4532 +static struct platform_device tms_device = {
4533 + .name = "serial8250",
4534 + .id = PLAT8250_DEV_PLATFORM,
4537 + .platform_data = &tms_data,
4541 +static void setup_external_uart(void)
4543 + at91_sys_write(AT91_SMC_CSR(2),
4548 + | AT91_SMC_NWS_(32) /* wait states */
4549 + | AT91_SMC_RWSETUP_(6) /* setup time */
4550 + | AT91_SMC_RWHOLD_(4) /* hold time */
4553 + at91_sys_write(AT91_SMC_CSR(6),
4558 + | AT91_SMC_NWS_(32) /* wait states */
4559 + | AT91_SMC_RWSETUP_(6) /* setup time */
4560 + | AT91_SMC_RWHOLD_(4) /* hold time */
4563 + at91_sys_write(AT91_SMC_CSR(7),
4568 + | AT91_SMC_NWS_(32) /* wait states */
4569 + | AT91_SMC_RWSETUP_(6) /* setup time */
4570 + | AT91_SMC_RWHOLD_(4) /* hold time */
4573 + platform_device_register(&tms_device);
4578 + * Serial port configuration.
4579 + * 0 .. 3 = USART0 .. USART3
4582 +static struct at91_uart_config __initdata tms_uart_config = {
4583 + .console_tty = 0, /* ttyS0 */
4585 + .tty_map = { 4, 0, 1, 2, 3 } /* ttyS0, ..., ttyS4 */
4588 +static void __init tms_map_io(void)
4590 + /* Initialize processor: 18.432 MHz crystal */
4591 + at91rm9200_initialize(18432000, AT91RM9200_BGA);
4593 + /* Setup the LEDs */
4594 + at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
4596 + /* Setup the serial ports and console */
4597 + at91_init_serial(&tms_uart_config);
4600 +static void __init tms_init_irq(void)
4602 + at91rm9200_init_interrupts(NULL);
4606 +static struct at91_eth_data __initdata tms_eth_data = {
4607 + .phy_irq_pin = AT91_PIN_PC4,
4611 +static struct at91_usbh_data __initdata tms_usbh_data = {
4615 +static struct spi_board_info tms_spi_devices[] = {
4616 + { /* DataFlash chip */
4617 + .modalias = "mtd_dataflash",
4619 + .max_speed_hz = 15 * 1000 * 1000,
4621 + { /* DataFlash chip */
4622 + .modalias = "mtd_dataflash",
4624 + .max_speed_hz = 15 * 1000 * 1000,
4628 +static struct i2c_board_info __initdata tms_i2c_devices[] = {
4630 + I2C_BOARD_INFO("isl1208", 0x6f),
4634 +static void __init tms_board_init(void)
4637 + at91_add_device_serial();
4639 + at91_add_device_eth(&tms_eth_data);
4640 + at91_add_device_usbh(&tms_usbh_data);
4642 + at91_add_device_i2c(tms_i2c_devices, ARRAY_SIZE(tms_i2c_devices));
4644 + at91_add_device_spi(tms_spi_devices, ARRAY_SIZE(tms_spi_devices));
4645 + /* Two port external UART */
4646 + setup_external_uart();
4649 +MACHINE_START(SWEDATMS, "Sweda TMS-100 Board")
4650 + /* Maintainer: Luiz de Barros */
4651 + .phys_io = AT91_BASE_SYS,
4652 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
4653 + .boot_params = AT91_SDRAM_BASE + 0x100,
4654 + .timer = &at91rm9200_timer,
4655 + .map_io = tms_map_io,
4656 + .init_irq = tms_init_irq,
4657 + .init_machine = tms_board_init,
4659 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-tt9200.c linux-2.6/arch/arm/mach-at91/board-tt9200.c
4660 --- linux-2.6.25/arch/arm/mach-at91/board-tt9200.c 1970-01-01 02:00:00.000000000 +0200
4661 +++ linux-2.6/arch/arm/mach-at91/board-tt9200.c 2008-04-25 21:15:43.000000000 +0200
4664 + * linux/arch/arm/mach-at91rm9200/board-tt9200.c
4665 + * Copyright (C) 2007 Toptechnology
4667 + * Based on board-ecbat91.c
4669 + * This program is free software; you can redistribute it and/or modify
4670 + * it under the terms of the GNU General Public License as published by
4671 + * the Free Software Foundation; either version 2 of the License, or
4672 + * (at your option) any later version.
4674 + * This program is distributed in the hope that it will be useful,
4675 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4676 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4677 + * GNU General Public License for more details.
4679 + * You should have received a copy of the GNU General Public License
4680 + * along with this program; if not, write to the Free Software
4681 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4684 +#include <linux/types.h>
4685 +#include <linux/init.h>
4686 +#include <linux/mm.h>
4687 +#include <linux/module.h>
4688 +#include <linux/platform_device.h>
4689 +#include <linux/spi/spi.h>
4690 +#include <linux/spi/flash.h>
4692 +#include <asm/hardware.h>
4693 +#include <asm/setup.h>
4694 +#include <asm/mach-types.h>
4695 +#include <asm/irq.h>
4697 +#include <asm/mach/arch.h>
4698 +#include <asm/mach/map.h>
4699 +#include <asm/mach/irq.h>
4701 +#include <asm/arch/board.h>
4702 +#include <asm/arch/gpio.h>
4704 +#include "generic.h"
4707 +static void __init tt9200_map_io(void)
4709 + /* Initialize processor: 18.432 MHz crystal */
4710 + at91rm9200_initialize(18432000, AT91RM9200_PQFP);
4712 + /* Setup the LEDs */
4713 + at91_init_leds(AT91_PIN_PB27, AT91_PIN_PB27);
4715 + /* DBGU on ttyS0. (Rx & Tx only) */
4716 + at91_register_uart(0, 0, 0);
4718 + /* USART0 on ttyS1. (Rx & Tx only) */
4719 + at91_register_uart(AT91RM9200_ID_US0, 1, 0);
4721 + /* USART1 on ttyS2. (Rx & Tx only) */
4722 + at91_register_uart(AT91RM9200_ID_US1, 2, 0);
4724 + /* USART2 on ttyS3. (Rx & Tx only) */
4725 + at91_register_uart(AT91RM9200_ID_US2, 3, 0);
4727 + /* USART3 on ttyS4. (Rx, Tx, CTS, RTS) */
4728 + at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS | ATMEL_UART_RTS);
4730 + /* Console on ttyS0 (ie, DBGU) */
4731 + at91_set_serial_console(0);
4734 +static void __init tt9200_init_irq(void)
4736 + at91rm9200_init_interrupts(NULL);
4739 +static struct at91_eth_data __initdata tt9200_eth_data = {
4740 + .phy_irq_pin = AT91_PIN_PB29,
4744 +static struct at91_usbh_data __initdata tt9200_usbh_data = {
4748 +static struct i2c_board_info __initdata tt9200_i2c_devices[] = {
4750 + I2C_BOARD_INFO("rtc-m41t80", 0x68),
4755 +static struct at91_mmc_data __initdata tt9200_mmc_data = {
4761 +#if defined(CONFIG_MTD_DATAFLASH)
4762 +static struct mtd_partition __initdata tt9200_flash_partitions[] =
4765 + .name = "Darrell",
4767 + .size = 12 * 1056,
4771 + .offset = MTDPART_OFS_NXTBLK,
4772 + .size = 110 * 1056,
4775 + .name = "U-boot env",
4776 + .offset = MTDPART_OFS_NXTBLK,
4781 + .offset = MTDPART_OFS_NXTBLK,
4782 + .size = 1534 * 1056,
4785 + .name = "Filesystem",
4786 + .offset = MTDPART_OFS_NXTBLK,
4787 + .size = MTDPART_SIZ_FULL,
4791 +static struct flash_platform_data __initdata tt9200_flash_platform = {
4792 + .name = "SPI Dataflash",
4793 + .parts = tt9200_flash_partitions,
4794 + .nr_parts = ARRAY_SIZE(tt9200_flash_partitions)
4799 +static struct spi_board_info __initdata tt9200_spi_devices[] = {
4800 + { /* DataFlash chip */
4801 + .modalias = "mtd_dataflash",
4804 + .max_speed_hz = 5 * 1000 * 1000,
4806 +#if defined(CONFIG_MTD_DATAFLASH)
4807 + .platform_data = &tt9200_flash_platform,
4812 +static struct gpio_led tt9200_leds[] = {
4815 + .gpio = AT91_PIN_PB27,
4817 + .default_trigger = "heartbeat",
4821 +static void __init tt9200_board_init(void)
4824 + at91_add_device_serial();
4827 + at91_add_device_eth(&tt9200_eth_data);
4830 + at91_add_device_usbh(&tt9200_usbh_data);
4833 + at91_add_device_i2c(tt9200_i2c_devices, ARRAY_SIZE(tt9200_i2c_devices));
4836 + at91_add_device_mmc(0, &tt9200_mmc_data);
4839 + at91_gpio_leds(tt9200_leds, ARRAY_SIZE(tt9200_leds));
4842 + at91_add_device_spi(tt9200_spi_devices, ARRAY_SIZE(tt9200_spi_devices));
4845 +MACHINE_START(TT9200, "Toptech TT9200")
4846 + /* Maintainer: toptech.com.ar */
4847 + .phys_io = AT91_BASE_SYS,
4848 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
4849 + .boot_params = AT91_SDRAM_BASE + 0x100,
4850 + .timer = &at91rm9200_timer,
4851 + .map_io = tt9200_map_io,
4852 + .init_irq = tt9200_init_irq,
4853 + .init_machine = tt9200_board_init,
4855 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-usb-a9260.c linux-2.6/arch/arm/mach-at91/board-usb-a9260.c
4856 --- linux-2.6.25/arch/arm/mach-at91/board-usb-a9260.c 1970-01-01 02:00:00.000000000 +0200
4857 +++ linux-2.6/arch/arm/mach-at91/board-usb-a9260.c 2008-04-25 21:15:43.000000000 +0200
4860 + * linux/arch/arm/mach-at91/board-usb-a9260.c
4862 + * Copyright (C) 2005 SAN People
4863 + * Copyright (C) 2006 Atmel
4864 + * Copyright (C) 2007 Calao-systems
4866 + * This program is free software; you can redistribute it and/or modify
4867 + * it under the terms of the GNU General Public License as published by
4868 + * the Free Software Foundation; either version 2 of the License, or
4869 + * (at your option) any later version.
4871 + * This program is distributed in the hope that it will be useful,
4872 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4873 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4874 + * GNU General Public License for more details.
4876 + * You should have received a copy of the GNU General Public License
4877 + * along with this program; if not, write to the Free Software
4878 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4881 +#include <linux/types.h>
4882 +#include <linux/init.h>
4883 +#include <linux/mm.h>
4884 +#include <linux/module.h>
4885 +#include <linux/platform_device.h>
4886 +#include <linux/spi/spi.h>
4887 +#include <linux/gpio_keys.h>
4888 +#include <linux/input.h>
4889 +#include <linux/clk.h>
4891 +#include <asm/hardware.h>
4892 +#include <asm/setup.h>
4893 +#include <asm/mach-types.h>
4894 +#include <asm/irq.h>
4896 +#include <asm/mach/arch.h>
4897 +#include <asm/mach/map.h>
4898 +#include <asm/mach/irq.h>
4900 +#include <asm/arch/board.h>
4901 +#include <asm/arch/gpio.h>
4902 +#include <asm/arch/at91_shdwc.h>
4904 +#include "generic.h"
4907 +static void __init ek_map_io(void)
4909 + /* Initialize processor: 12.000 MHz crystal */
4910 + at91sam9260_initialize(12000000);
4912 + /* DGBU on ttyS0. (Rx & Tx only) */
4913 + at91_register_uart(0, 0, 0);
4915 + /* set serial console to ttyS0 (ie, DBGU) */
4916 + at91_set_serial_console(0);
4919 +static void __init ek_init_irq(void)
4921 + at91sam9260_init_interrupts(NULL);
4928 +static struct at91_usbh_data __initdata ek_usbh_data = {
4935 +static struct at91_udc_data __initdata ek_udc_data = {
4936 + .vbus_pin = AT91_PIN_PC5,
4937 + .pullup_pin = 0, /* pull-up driven by UDC */
4941 + * MACB Ethernet device
4943 +static struct at91_eth_data __initdata ek_macb_data = {
4944 + .phy_irq_pin = AT91_PIN_PA31,
4951 +static struct mtd_partition __initdata ek_nand_partition[] = {
4953 + .name = "Uboot & Kernel",
4954 + .offset = 0x00000000,
4955 + .size = 16 * 1024 * 1024,
4958 + .name = "Root FS",
4959 + .offset = 0x01000000,
4960 + .size = 120 * 1024 * 1024,
4964 + .offset = 0x08800000,
4965 + .size = 120 * 1024 * 1024,
4969 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
4971 + *num_partitions = ARRAY_SIZE(ek_nand_partition);
4972 + return ek_nand_partition;
4975 +static struct at91_nand_data __initdata ek_nand_data = {
4978 +// .det_pin = ... not connected
4979 + .rdy_pin = AT91_PIN_PC13,
4980 + .enable_pin = AT91_PIN_PC14,
4981 + .partition_info = nand_partitions,
4982 +#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
4983 + .bus_width_16 = 1,
4985 + .bus_width_16 = 0,
4993 +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
4994 +static struct gpio_keys_button ek_buttons[] = {
4995 + { /* USER PUSH BUTTON */
4996 + .code = KEY_ENTER,
4997 + .gpio = AT91_PIN_PB10,
4999 + .desc = "user_pb",
5004 +static struct gpio_keys_platform_data ek_button_data = {
5005 + .buttons = ek_buttons,
5006 + .nbuttons = ARRAY_SIZE(ek_buttons),
5009 +static struct platform_device ek_button_device = {
5010 + .name = "gpio-keys",
5012 + .num_resources = 0,
5014 + .platform_data = &ek_button_data,
5018 +static void __init ek_add_device_buttons(void)
5020 + at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
5021 + at91_set_deglitch(AT91_PIN_PB10, 1);
5023 + platform_device_register(&ek_button_device);
5026 +static void __init ek_add_device_buttons(void) {}
5032 +static struct gpio_led ek_leds[] = {
5033 + { /* user_led (green) */
5034 + .name = "user_led",
5035 + .gpio = AT91_PIN_PB21,
5037 + .default_trigger = "heartbeat",
5041 +static void __init ek_board_init(void)
5044 + at91_add_device_serial();
5046 + at91_add_device_usbh(&ek_usbh_data);
5048 + at91_add_device_udc(&ek_udc_data);
5050 + at91_add_device_nand(&ek_nand_data);
5052 + at91_add_device_i2c(NULL, 0);
5054 + at91_add_device_eth(&ek_macb_data);
5055 + /* Push Buttons */
5056 + ek_add_device_buttons();
5058 + at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
5059 + /* shutdown controller, wakeup button (5 msec low) */
5060 + at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
5061 + | AT91_SHDW_RTTWKEN);
5064 +MACHINE_START(USB_A9260, "CALAO USB_A9260")
5065 + /* Maintainer: calao-systems */
5066 + .phys_io = AT91_BASE_SYS,
5067 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
5068 + .boot_params = AT91_SDRAM_BASE + 0x100,
5069 + .timer = &at91sam926x_timer,
5070 + .map_io = ek_map_io,
5071 + .init_irq = ek_init_irq,
5072 + .init_machine = ek_board_init,
5074 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/board-usb-a9263.c linux-2.6/arch/arm/mach-at91/board-usb-a9263.c
5075 --- linux-2.6.25/arch/arm/mach-at91/board-usb-a9263.c 1970-01-01 02:00:00.000000000 +0200
5076 +++ linux-2.6/arch/arm/mach-at91/board-usb-a9263.c 2008-04-25 21:15:43.000000000 +0200
5079 + * linux/arch/arm/mach-at91/board-usb-a9263.c
5081 + * Copyright (C) 2005 SAN People
5082 + * Copyright (C) 2007 Atmel Corporation.
5083 + * Copyright (C) 2007 Calao-systems
5085 + * This program is free software; you can redistribute it and/or modify
5086 + * it under the terms of the GNU General Public License as published by
5087 + * the Free Software Foundation; either version 2 of the License, or
5088 + * (at your option) any later version.
5090 + * This program is distributed in the hope that it will be useful,
5091 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5092 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5093 + * GNU General Public License for more details.
5095 + * You should have received a copy of the GNU General Public License
5096 + * along with this program; if not, write to the Free Software
5097 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5100 +#include <linux/types.h>
5101 +#include <linux/init.h>
5102 +#include <linux/mm.h>
5103 +#include <linux/module.h>
5104 +#include <linux/platform_device.h>
5105 +#include <linux/spi/spi.h>
5106 +#include <linux/gpio_keys.h>
5107 +#include <linux/input.h>
5109 +#include <asm/hardware.h>
5110 +#include <asm/setup.h>
5111 +#include <asm/mach-types.h>
5112 +#include <asm/irq.h>
5114 +#include <asm/mach/arch.h>
5115 +#include <asm/mach/map.h>
5116 +#include <asm/mach/irq.h>
5118 +#include <asm/arch/board.h>
5119 +#include <asm/arch/gpio.h>
5120 +#include <asm/arch/at91_shdwc.h>
5122 +#include "generic.h"
5125 +static void __init ek_map_io(void)
5127 + /* Initialize processor: 12.00 MHz crystal */
5128 + at91sam9263_initialize(12000000);
5130 + /* DGBU on ttyS0. (Rx & Tx only) */
5131 + at91_register_uart(0, 0, 0);
5133 + /* set serial console to ttyS0 (ie, DBGU) */
5134 + at91_set_serial_console(0);
5137 +static void __init ek_init_irq(void)
5139 + at91sam9263_init_interrupts(NULL);
5146 +static struct at91_usbh_data __initdata ek_usbh_data = {
5153 +static struct at91_udc_data __initdata ek_udc_data = {
5154 + .vbus_pin = AT91_PIN_PB11,
5155 + .pullup_pin = 0, /* pull-up driven by UDC */
5161 +static struct spi_board_info ek_spi_devices[] = {
5162 +#if !defined(CONFIG_MMC_AT91)
5163 + { /* DataFlash chip */
5164 + .modalias = "mtd_dataflash",
5166 + .max_speed_hz = 15 * 1000 * 1000,
5173 + * MACB Ethernet device
5175 +static struct at91_eth_data __initdata ek_macb_data = {
5176 + .phy_irq_pin = AT91_PIN_PE31,
5183 +static struct mtd_partition __initdata ek_nand_partition[] = {
5185 + .name = "Linux Kernel",
5186 + .offset = 0x00000000,
5187 + .size = 16 * 1024 * 1024,
5190 + .name = "Root FS",
5191 + .offset = 0x01000000,
5192 + .size = 120 * 1024 * 1024,
5196 + .offset = 0x08800000,
5197 + .size = 120 * 1024 * 1024,
5201 +static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
5203 + *num_partitions = ARRAY_SIZE(ek_nand_partition);
5204 + return ek_nand_partition;
5207 +static struct at91_nand_data __initdata ek_nand_data = {
5210 +// .det_pin = ... not connected
5211 + .rdy_pin = AT91_PIN_PA22,
5212 + .enable_pin = AT91_PIN_PD15,
5213 + .partition_info = nand_partitions,
5214 +#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
5215 + .bus_width_16 = 1,
5217 + .bus_width_16 = 0,
5224 +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
5225 +static struct gpio_keys_button ek_buttons[] = {
5226 + { /* USER PUSH BUTTON */
5227 + .code = KEY_ENTER,
5228 + .gpio = AT91_PIN_PB10,
5230 + .desc = "user_pb",
5235 +static struct gpio_keys_platform_data ek_button_data = {
5236 + .buttons = ek_buttons,
5237 + .nbuttons = ARRAY_SIZE(ek_buttons),
5240 +static struct platform_device ek_button_device = {
5241 + .name = "gpio-keys",
5243 + .num_resources = 0,
5245 + .platform_data = &ek_button_data,
5249 +static void __init ek_add_device_buttons(void)
5251 + at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
5252 + at91_set_deglitch(AT91_PIN_PB10, 1);
5254 + platform_device_register(&ek_button_device);
5257 +static void __init ek_add_device_buttons(void) {}
5263 +static struct gpio_led ek_leds[] = {
5264 + { /* user_led (green) */
5265 + .name = "user_led",
5266 + .gpio = AT91_PIN_PB21,
5268 + .default_trigger = "heartbeat",
5273 +static void __init ek_board_init(void)
5276 + at91_add_device_serial();
5278 + at91_add_device_usbh(&ek_usbh_data);
5280 + at91_add_device_udc(&ek_udc_data);
5282 + at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
5284 + at91_add_device_eth(&ek_macb_data);
5286 + at91_add_device_nand(&ek_nand_data);
5288 + at91_add_device_i2c(NULL, 0);
5289 + /* Push Buttons */
5290 + ek_add_device_buttons();
5292 + at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
5293 + /* shutdown controller, wakeup button (5 msec low) */
5294 + at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
5295 + | AT91_SHDW_RTTWKEN);
5298 +MACHINE_START(USB_A9263, "CALAO USB_A9263")
5299 + /* Maintainer: calao-systems */
5300 + .phys_io = AT91_BASE_SYS,
5301 + .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
5302 + .boot_params = AT91_SDRAM_BASE + 0x100,
5303 + .timer = &at91sam926x_timer,
5304 + .map_io = ek_map_io,
5305 + .init_irq = ek_init_irq,
5306 + .init_machine = ek_board_init,
5308 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/clock.c linux-2.6/arch/arm/mach-at91/clock.c
5309 --- linux-2.6.25/arch/arm/mach-at91/clock.c 2008-05-03 00:15:44.000000000 +0200
5310 +++ linux-2.6/arch/arm/mach-at91/clock.c 2008-04-25 21:15:43.000000000 +0200
5312 #include <asm/arch/cpu.h>
5315 +#include "generic.h"
5319 @@ -113,12 +114,34 @@
5320 at91_sys_write(AT91_PMC_SCDR, clk->pmc_mask);
5323 +static void pmc_uckr_mode(struct clk *clk, int is_on)
5325 + unsigned int uckr = at91_sys_read(AT91_CKGR_UCKR);
5328 + is_on = AT91_PMC_LOCKU;
5329 + at91_sys_write(AT91_CKGR_UCKR, uckr | clk->pmc_mask);
5331 + at91_sys_write(AT91_CKGR_UCKR, uckr & ~(clk->pmc_mask));
5335 + } while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKU) != is_on);
5338 /* USB function clocks (PLLB must be 48 MHz) */
5339 static struct clk udpck = {
5342 .mode = pmc_sys_mode,
5344 +static struct clk utmi_clk = {
5345 + .name = "utmi_clk",
5346 + .parent = &main_clk,
5347 + .pmc_mask = AT91_PMC_UPLLEN, /* in CKGR_UCKR */
5348 + .mode = pmc_uckr_mode,
5349 + .type = CLK_TYPE_PLL,
5351 static struct clk uhpck = {
5354 @@ -254,6 +277,23 @@
5356 /*------------------------------------------------------------------------*/
5360 +int clk_must_disable(struct clk *clk)
5362 + if (!at91_suspend_entering_slow_clock())
5365 + while (clk->parent)
5366 + clk = clk->parent;
5367 + return clk != &clk32k;
5369 +EXPORT_SYMBOL(clk_must_disable);
5373 +/*------------------------------------------------------------------------*/
5375 #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
5380 static int at91_clk_show(struct seq_file *s, void *unused)
5382 - u32 scsr, pcsr, sr;
5383 + u32 scsr, pcsr, uckr = 0, sr;
5386 seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR));
5387 @@ -370,7 +410,10 @@
5388 seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR));
5389 seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR));
5390 seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR));
5391 - seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR));
5392 + if (!cpu_is_at91sam9rl())
5393 + seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR));
5394 + if (cpu_is_at91cap9() || cpu_is_at91sam9rl())
5395 + seq_printf(s, "UCKR = %8x\n", uckr = at91_sys_read(AT91_CKGR_UCKR));
5396 seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR));
5397 seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR));
5400 state = (scsr & clk->pmc_mask) ? "on" : "off";
5401 else if (clk->mode == pmc_periph_mode)
5402 state = (pcsr & clk->pmc_mask) ? "on" : "off";
5403 + else if (clk->mode == pmc_uckr_mode)
5404 + state = (uckr & clk->pmc_mask) ? "on" : "off";
5405 else if (clk->pmc_mask)
5406 state = (sr & clk->pmc_mask) ? "on" : "off";
5407 else if (clk == &clk32k || clk == &main_clk)
5408 @@ -583,6 +628,17 @@
5409 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init);
5412 + * USB HS clock init
5414 + if (cpu_is_at91cap9() || cpu_is_at91sam9rl()) {
5416 + * multiplier is hard-wired to 40
5417 + * (obtain the USB High Speed 480 MHz when input is 12 MHz)
5419 + utmi_clk.rate_hz = 40 * utmi_clk.parent->rate_hz;
5423 * MCK and CPU derive from one of those primary clocks.
5424 * For now, assume this parentage won't change.
5427 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
5428 list_add_tail(&standard_pmc_clocks[i]->node, &clocks);
5430 + if (cpu_is_at91cap9() || cpu_is_at91sam9rl())
5431 + list_add_tail(&utmi_clk.node, &clocks);
5433 /* MCK and CPU clock are "always on" */
5436 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/generic.h linux-2.6/arch/arm/mach-at91/generic.h
5437 --- linux-2.6.25/arch/arm/mach-at91/generic.h 2008-05-03 00:15:44.000000000 +0200
5438 +++ linux-2.6/arch/arm/mach-at91/generic.h 2008-04-25 21:15:43.000000000 +0200
5440 /* Power Management */
5441 extern void at91_irq_suspend(void);
5442 extern void at91_irq_resume(void);
5443 +extern int at91_suspend_entering_slow_clock(void);
5446 #define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */
5447 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/gpio.c linux-2.6/arch/arm/mach-at91/gpio.c
5448 --- linux-2.6.25/arch/arm/mach-at91/gpio.c 2008-05-03 00:15:44.000000000 +0200
5449 +++ linux-2.6/arch/arm/mach-at91/gpio.c 2008-04-25 21:15:43.000000000 +0200
5452 /*--------------------------------------------------------------------------*/
5454 -/* This lock class tells lockdep that GPIO irqs are in a different
5456 + * This lock class tells lockdep that GPIO irqs are in a different
5457 * category than their parents, so it won't report false recursion.
5459 static struct lock_class_key gpio_lock_class;
5461 data->regbase = data->offset + (void __iomem *)AT91_VA_BASE_SYS;
5463 /* AT91SAM9263_ID_PIOCDE groups PIOC, PIOD, PIOE */
5464 + /* AT91CAP9_ID_PIOABCD groups PIOA, PIOB, PIOC, PIOD */
5465 if (last && last->id == data->id)
5468 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/ics1523.c linux-2.6/arch/arm/mach-at91/ics1523.c
5469 --- linux-2.6.25/arch/arm/mach-at91/ics1523.c 1970-01-01 02:00:00.000000000 +0200
5470 +++ linux-2.6/arch/arm/mach-at91/ics1523.c 2008-04-25 21:15:43.000000000 +0200
5473 + * arch/arm/mach-at91rm9200/ics1523.c
5475 + * Copyright (C) 2003 ATMEL Rousset
5477 + * This program is free software; you can redistribute it and/or modify
5478 + * it under the terms of the GNU General Public License as published by
5479 + * the Free Software Foundation; either version 2 of the License, or
5480 + * (at your option) any later version.
5482 + * This program is distributed in the hope that it will be useful,
5483 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5484 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5485 + * GNU General Public License for more details.
5487 + * You should have received a copy of the GNU General Public License
5488 + * along with this program; if not, write to the Free Software
5489 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5492 +#include <asm/hardware.h>
5493 +#include <asm/io.h>
5495 +#include <linux/clk.h>
5496 +#include <linux/delay.h>
5497 +#include <linux/err.h>
5498 +#include <linux/init.h>
5499 +#include <linux/kernel.h>
5501 +#include <asm/arch/ics1523.h>
5502 +#include <asm/arch/at91_twi.h>
5503 +#include <asm/arch/gpio.h>
5506 +#define AT91_TWI_ERROR (AT91_TWI_NACK | AT91_TWI_UNRE | AT91_TWI_OVRE)
5509 +static void __iomem *twi_base;
5511 +#define at91_twi_read(reg) __raw_readl(twi_base + (reg))
5512 +#define at91_twi_write(reg, val) __raw_writel((val), twi_base + (reg))
5515 +/* -----------------------------------------------------------------------------
5516 + * Initialization of TWI CLOCK
5517 + * ----------------------------------------------------------------------------- */
5519 +static void at91_ics1523_SetTwiClock(unsigned int mck_khz)
5523 + /* Here, CKDIV = 1 and CHDIV = CLDIV ==> CLDIV = CHDIV = 1/4*((Fmclk/FTWI) -6) */
5524 + sclock = (10*mck_khz / ICS_TRANSFER_RATE);
5525 + if (sclock % 10 >= 5)
5526 + sclock = (sclock /10) - 5;
5528 + sclock = (sclock /10)- 6;
5529 + sclock = (sclock + (4 - sclock %4)) >> 2; /* div 4 */
5531 + at91_twi_write(AT91_TWI_CWGR, 0x00010000 | sclock | (sclock << 8));
5534 +/* -----------------------------------------------------------------------------
5535 + * Read a byte with TWI Interface from the Clock Generator ICS1523
5536 + * ----------------------------------------------------------------------------- */
5538 +static int at91_ics1523_ReadByte(unsigned char reg_address, unsigned char *data_in)
5540 + int Status, nb_trial;
5542 + at91_twi_write(AT91_TWI_MMR, AT91_TWI_MREAD | AT91_TWI_IADRSZ_1 | ((ICS_ADDR << 16) & AT91_TWI_DADR));
5543 + at91_twi_write(AT91_TWI_IADR, reg_address);
5544 + at91_twi_write(AT91_TWI_CR, AT91_TWI_START | AT91_TWI_STOP);
5546 + /* Program temporizing period (300us) */
5549 + /* Wait TXcomplete ... */
5551 + Status = at91_twi_read(AT91_TWI_SR);
5552 + while (!(Status & AT91_TWI_TXCOMP) && (nb_trial < 10)) {
5554 + Status = at91_twi_read(AT91_TWI_SR);
5557 + if (Status & AT91_TWI_TXCOMP) {
5558 + *data_in = (unsigned char) at91_twi_read(AT91_TWI_RHR);
5559 + return ICS1523_ACCESS_OK;
5562 + return ICS1523_ACCESS_ERROR;
5565 +/* -----------------------------------------------------------------------------
5566 + * Write a byte with TWI Interface to the Clock Generator ICS1523
5567 + * ----------------------------------------------------------------------------- */
5569 +static int at91_ics1523_WriteByte(unsigned char reg_address, unsigned char data_out)
5571 + int Status, nb_trial;
5573 + at91_twi_write(AT91_TWI_MMR, AT91_TWI_IADRSZ_1 | ((ICS_ADDR << 16) & AT91_TWI_DADR));
5574 + at91_twi_write(AT91_TWI_IADR, reg_address);
5575 + at91_twi_write(AT91_TWI_THR, data_out);
5576 + at91_twi_write(AT91_TWI_CR, AT91_TWI_START | AT91_TWI_STOP);
5578 + /* Program temporizing period (300us) */
5582 + Status = at91_twi_read(AT91_TWI_SR);
5583 + while (!(Status & AT91_TWI_TXCOMP) && (nb_trial < 10)) {
5585 + if (Status & AT91_TWI_ERROR) {
5586 + /* If Underrun OR NACK - Start again */
5587 + at91_twi_write(AT91_TWI_CR, AT91_TWI_START | AT91_TWI_STOP);
5589 + /* Program temporizing period (300us) */
5592 + Status = at91_twi_read(AT91_TWI_SR);
5595 + if (Status & AT91_TWI_TXCOMP)
5596 + return ICS1523_ACCESS_OK;
5598 + return ICS1523_ACCESS_ERROR;
5601 +/* -----------------------------------------------------------------------------
5602 + * Initialization of the Clock Generator ICS1523
5603 + * ----------------------------------------------------------------------------- */
5605 +int at91_ics1523_init(void)
5608 + int ack = ICS1523_ACCESS_OK;
5609 + unsigned int status = 0xffffffff;
5610 + struct clk *twi_clk;
5612 + /* Map in TWI peripheral */
5613 + twi_base = ioremap(AT91RM9200_BASE_TWI, SZ_16K);
5617 + /* pins used for TWI interface */
5618 + at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */
5619 + at91_set_multi_drive(AT91_PIN_PA25, 1);
5620 + at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */
5621 + at91_set_multi_drive(AT91_PIN_PA26, 1);
5623 + /* Enable the TWI clock */
5624 + twi_clk = clk_get(NULL, "twi_clk");
5625 + if (IS_ERR(twi_clk))
5626 + return ICS1523_ACCESS_ERROR;
5627 + clk_enable(twi_clk);
5629 + /* Disable interrupts */
5630 + at91_twi_write(AT91_TWI_IDR, -1);
5632 + /* Reset peripheral */
5633 + at91_twi_write(AT91_TWI_CR, AT91_TWI_SWRST);
5635 + /* Set Master mode */
5636 + at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN);
5638 + /* Set TWI Clock Waveform Generator Register */
5639 + at91_ics1523_SetTwiClock(60000); /* MCK in KHz = 60000 KHz */
5641 + /* ICS1523 Initialisation */
5642 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_ICR, (unsigned char) 0);
5643 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_OE, (unsigned char) (ICS_OEF | ICS_OET2 | ICS_OETCK));
5644 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_OD, (unsigned char) (ICS_INSEL | 0x7F));
5645 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_DPAO, (unsigned char) 0);
5650 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_ICR, (unsigned char) (ICS_ENDLS | ICS_ENPLS | ICS_PDEN /*| ICS_FUNCSEL*/));
5651 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_LCR, (unsigned char) (ICS_PSD | ICS_PFD));
5652 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_FD0, (unsigned char) 0x39) ; /* 0x7A */
5653 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_FD1, (unsigned char) 0x00);
5654 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_SWRST, (unsigned char) (ICS_PLLR));
5656 + /* Program 1ms temporizing period */
5659 + at91_ics1523_ReadByte ((unsigned char) ICS_SR, (char *)&status);
5660 + } while (!((unsigned int) status & (unsigned int) ICS_PLLLOCK) && (nb_trial < 10));
5662 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_DPAC, (unsigned char) 0x03) ; /* 0x01 */
5663 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_SWRST, (unsigned char) (ICS_DPAR));
5665 + /* Program 1ms temporizing period */
5668 + ack |= at91_ics1523_WriteByte ((unsigned char) ICS_DPAO, (unsigned char) 0x00);
5670 + /* Program 1ms temporizing period */
5673 + /* All done - cleanup */
5674 + iounmap(twi_base);
5675 + clk_disable(twi_clk);
5680 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/pm.c linux-2.6/arch/arm/mach-at91/pm.c
5681 --- linux-2.6.25/arch/arm/mach-at91/pm.c 2008-05-03 00:15:44.000000000 +0200
5682 +++ linux-2.6/arch/arm/mach-at91/pm.c 2008-04-25 21:15:43.000000000 +0200
5683 @@ -26,12 +26,144 @@
5684 #include <asm/mach-types.h>
5686 #include <asm/arch/at91_pmc.h>
5687 -#include <asm/arch/at91rm9200_mc.h>
5688 #include <asm/arch/gpio.h>
5689 #include <asm/arch/cpu.h>
5691 #include "generic.h"
5693 +#ifdef CONFIG_ARCH_AT91RM9200
5694 +#include <asm/arch/at91rm9200_mc.h>
5697 + * The AT91RM9200 goes into self-refresh mode with this command, and will
5698 + * terminate self-refresh automatically on the next SDRAM access.
5700 +#define sdram_selfrefresh_enable() at91_sys_write(AT91_SDRAMC_SRR, 1)
5701 +#define sdram_selfrefresh_disable() do {} while (0)
5703 +#elif defined(CONFIG_ARCH_AT91CAP9)
5704 +#include <asm/arch/at91cap9_ddrsdr.h>
5706 +static u32 saved_lpr;
5708 +static inline void sdram_selfrefresh_enable(void)
5712 + saved_lpr = at91_sys_read(AT91_DDRSDRC_LPR);
5714 + lpr = saved_lpr & ~AT91_DDRSDRC_LPCB;
5715 + at91_sys_write(AT91_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH);
5718 +#define sdram_selfrefresh_disable() at91_sys_write(AT91_DDRSDRC_LPR, saved_lpr)
5721 +#include <asm/arch/at91sam9_sdramc.h>
5723 +#ifdef CONFIG_ARCH_AT91SAM9263
5725 + * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
5726 + * handle those cases both here and in the Suspend-To-RAM support.
5728 +#define AT91_SDRAMC AT91_SDRAMC0
5729 +#warning Assuming EB1 SDRAM controller is *NOT* used
5732 +static u32 saved_lpr;
5734 +static inline void sdram_selfrefresh_enable(void)
5738 + saved_lpr = at91_sys_read(AT91_SDRAMC_LPR);
5740 + lpr = saved_lpr & ~AT91_SDRAMC_LPCB;
5741 + at91_sys_write(AT91_SDRAMC_LPR, lpr | AT91_SDRAMC_LPCB_SELF_REFRESH);
5744 +#define sdram_selfrefresh_disable() at91_sys_write(AT91_SDRAMC_LPR, saved_lpr)
5747 + * FIXME: The AT91SAM9263 has a second EBI controller which may have
5748 + * additional SDRAM. pm_slowclock.S will require a similar fix.
5755 + * Show the reason for the previous system reset.
5757 +#if defined(AT91_SHDWC)
5759 +#include <asm/arch/at91_rstc.h>
5760 +#include <asm/arch/at91_shdwc.h>
5762 +static void __init show_reset_status(void)
5764 + static char reset[] __initdata = "reset";
5766 + static char general[] __initdata = "general";
5767 + static char wakeup[] __initdata = "wakeup";
5768 + static char watchdog[] __initdata = "watchdog";
5769 + static char software[] __initdata = "software";
5770 + static char user[] __initdata = "user";
5771 + static char unknown[] __initdata = "unknown";
5773 + static char signal[] __initdata = "signal";
5774 + static char rtc[] __initdata = "rtc";
5775 + static char rtt[] __initdata = "rtt";
5776 + static char restore[] __initdata = "power-restored";
5778 + char *reason, *r2 = reset;
5779 + u32 reset_type, wake_type;
5781 + reset_type = at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_RSTTYP;
5782 + wake_type = at91_sys_read(AT91_SHDW_SR);
5784 + switch (reset_type) {
5785 + case AT91_RSTC_RSTTYP_GENERAL:
5788 + case AT91_RSTC_RSTTYP_WAKEUP:
5789 + /* board-specific code enabled the wakeup sources */
5792 + /* "wakeup signal" */
5793 + if (wake_type & AT91_SHDW_WAKEUP0)
5797 + if (wake_type & AT91_SHDW_RTTWK) /* rtt wakeup */
5799 + else if (wake_type & AT91_SHDW_RTCWK) /* rtc wakeup */
5801 + else if (wake_type == 0) /* power-restored wakeup */
5803 + else /* unknown wakeup */
5807 + case AT91_RSTC_RSTTYP_WATCHDOG:
5808 + reason = watchdog;
5810 + case AT91_RSTC_RSTTYP_SOFTWARE:
5811 + reason = software;
5813 + case AT91_RSTC_RSTTYP_USER:
5820 + pr_info("AT91: Starting after %s %s\n", reason, r2);
5823 +static void __init show_reset_status(void) {}
5827 static int at91_pm_valid_state(suspend_state_t state)
5830 * Verify that all the clocks are correct before entering
5833 +#warning "This should probably be moved to clocks.c"
5834 static int at91_pm_verify_clocks(void)
5837 @@ -107,24 +240,24 @@
5841 - * Call this from platform driver suspend() to see how deeply to suspend.
5842 + * This is called from clk_must_disable(), to see how deeply to suspend.
5843 * For example, some controllers (like OHCI) need one of the PLL clocks
5844 * in order to act as a wakeup source, and those are not available when
5845 * going into slow clock mode.
5847 - * REVISIT: generalize as clk_will_be_available(clk)? Other platforms have
5848 - * the very same problem (but not using at91 main_clk), and it'd be better
5849 - * to add one generic API rather than lots of platform-specific ones.
5851 int at91_suspend_entering_slow_clock(void)
5853 return (target_state == PM_SUSPEND_MEM);
5855 -EXPORT_SYMBOL(at91_suspend_entering_slow_clock);
5858 static void (*slow_clock)(void);
5860 +#ifdef CONFIG_AT91_SLOW_CLOCK
5861 +extern void at91_slow_clock(void);
5862 +extern u32 at91_slow_clock_sz;
5866 static int at91_pm_enter(suspend_state_t state)
5868 @@ -158,11 +291,14 @@
5869 * turning off the main oscillator; reverse on wakeup.
5872 +#ifdef CONFIG_AT91_SLOW_CLOCK
5873 + /* copy slow_clock handler to SRAM, and call it */
5874 + memcpy(slow_clock, at91_slow_clock, at91_slow_clock_sz);
5879 - /* DEVELOPMENT ONLY */
5880 - pr_info("AT91: PM - no slow clock mode yet ...\n");
5881 + pr_info("AT91: PM - no slow clock mode enabled ...\n");
5882 /* FALLTHROUGH leaving master clock alone */
5885 @@ -175,13 +311,15 @@
5886 case PM_SUSPEND_STANDBY:
5888 * NOTE: the Wait-for-Interrupt instruction needs to be
5889 - * in icache so the SDRAM stays in self-refresh mode until
5890 - * the wakeup IRQ occurs.
5891 + * in icache so no SDRAM accesses are needed until the
5892 + * wakeup IRQ occurs and self-refresh is terminated.
5894 asm("b 1f; .align 5; 1:");
5895 asm("mcr p15, 0, r0, c7, c10, 4"); /* drain write buffer */
5896 - at91_sys_write(AT91_SDRAMC_SRR, 1); /* self-refresh mode */
5897 - /* fall though to next state */
5898 + sdram_selfrefresh_enable();
5899 + asm("mcr p15, 0, r0, c7, c0, 4"); /* wait for interrupt */
5900 + sdram_selfrefresh_disable();
5904 asm("mcr p15, 0, r0, c7, c0, 4"); /* wait for interrupt */
5906 at91_sys_read(AT91_AIC_IPR) & at91_sys_read(AT91_AIC_IMR));
5909 + sdram_selfrefresh_disable();
5910 target_state = PM_SUSPEND_ON;
5913 @@ -220,21 +359,20 @@
5915 static int __init at91_pm_init(void)
5917 - printk("AT91: Power Management\n");
5919 -#ifdef CONFIG_AT91_PM_SLOW_CLOCK
5920 - /* REVISIT allocations of SRAM should be dynamically managed.
5921 - * FIQ handlers and other components will want SRAM/TCM too...
5923 - slow_clock = (void *) (AT91_VA_BASE_SRAM + (3 * SZ_4K));
5924 - memcpy(slow_clock, at91rm9200_slow_clock, at91rm9200_slow_clock_sz);
5925 +#ifdef CONFIG_AT91_SLOW_CLOCK
5926 + slow_clock = (void *) (AT91_IO_VIRT_BASE - at91_slow_clock_sz);
5929 - /* Disable SDRAM low-power mode. Cannot be used with self-refresh. */
5930 + pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : ""));
5932 +#ifdef CONFIG_ARCH_AT91RM9200
5933 + /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */
5934 at91_sys_write(AT91_SDRAMC_LPR, 0);
5937 suspend_set_ops(&at91_pm_ops);
5939 + show_reset_status();
5942 arch_initcall(at91_pm_init);
5943 diff -urN -x CVS linux-2.6.25/arch/arm/mach-at91/pm_slowclock.S linux-2.6/arch/arm/mach-at91/pm_slowclock.S
5944 --- linux-2.6.25/arch/arm/mach-at91/pm_slowclock.S 1970-01-01 02:00:00.000000000 +0200
5945 +++ linux-2.6/arch/arm/mach-at91/pm_slowclock.S 2008-05-03 01:00:33.000000000 +0200
5948 + * arch/arm/mach-at91/pm_slow_clock.S
5950 + * Copyright (C) 2006 Savin Zlobec
5952 + * AT91SAM9 support:
5953 + * Copyright (C) 2007 Anti Sullin <anti.sullin@artecdesign.ee
5955 + * This program is free software; you can redistribute it and/or modify
5956 + * it under the terms of the GNU General Public License version 2 as
5957 + * published by the Free Software Foundation.
5961 +#include <linux/linkage.h>
5962 +#include <asm/hardware.h>
5963 +#include <asm/arch/at91_pmc.h>
5965 +#ifdef CONFIG_ARCH_AT91RM9200
5966 +#include <asm/arch/at91rm9200_mc.h>
5967 +#elif defined(CONFIG_ARCH_AT91CAP9)
5968 +#include <asm/arch/at91cap9_ddrsdr.h>
5970 +#include <asm/arch/at91sam9_sdramc.h>
5974 +#ifdef CONFIG_ARCH_AT91SAM9263
5976 + * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
5977 + * handle those cases both here and in the Suspend-To-RAM support.
5979 +#define AT91_SDRAMC AT91_SDRAMC0
5980 +#warning Assuming EB1 SDRAM controller is *NOT* used
5984 + * When SLOWDOWN_MASTER_CLOCK is defined we will also slow down the Master
5985 + * clock during suspend by adjusting its prescalar and divisor.
5986 + * NOTE: This hasn't been shown to be stable on SAM9s; and on the RM9200 there
5987 + * are errata regarding adjusting the prescalar and divisor.
5989 +#undef SLOWDOWN_MASTER_CLOCK
5991 +#define MCKRDY_TIMEOUT 1000
5992 +#define MOSCRDY_TIMEOUT 1000
5993 +#define PLLALOCK_TIMEOUT 1000
5994 +#define PLLBLOCK_TIMEOUT 1000
5998 + * Wait until master clock is ready (after switching master clock source)
6000 + .macro wait_mckrdy
6001 + mov r4, #MCKRDY_TIMEOUT
6005 + ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)]
6006 + tst r3, #AT91_PMC_MCKRDY
6012 + * Wait until master oscillator has stabilized.
6014 + .macro wait_moscrdy
6015 + mov r4, #MOSCRDY_TIMEOUT
6019 + ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)]
6020 + tst r3, #AT91_PMC_MOSCS
6026 + * Wait until PLLA has locked.
6028 + .macro wait_pllalock
6029 + mov r4, #PLLALOCK_TIMEOUT
6033 + ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)]
6034 + tst r3, #AT91_PMC_LOCKA
6040 + * Wait until PLLB has locked.
6042 + .macro wait_pllblock
6043 + mov r4, #PLLBLOCK_TIMEOUT
6047 + ldr r3, [r1, #(AT91_PMC_SR - AT91_PMC)]
6048 + tst r3, #AT91_PMC_LOCKB
6055 +ENTRY(at91_slow_clock)
6056 + /* Save registers on stack */
6057 + stmfd sp!, {r0 - r12, lr}
6061 + * R1 = Base address of AT91_PMC
6062 + * R2 = Base address of AT91_SDRAMC (or AT91_SYS on AT91RM9200)
6063 + * R3 = temporary register
6064 + * R4 = temporary register
6066 + ldr r1, .at91_va_base_pmc
6067 + ldr r2, .at91_va_base_sdramc
6069 + /* Drain write buffer */
6070 + mcr p15, 0, r0, c7, c10, 4
6072 +#ifdef CONFIG_ARCH_AT91RM9200
6073 + /* Put SDRAM in self-refresh mode */
6075 + str r3, [r2, #AT91_SDRAMC_SRR]
6076 +#elif defined(CONFIG_ARCH_AT91CAP9)
6077 + /* Enable SDRAM self-refresh mode */
6078 + ldr r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC]
6079 + str r3, .saved_sam9_lpr
6081 + mov r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH
6082 + str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC]
6084 + /* Enable SDRAM self-refresh mode */
6085 + ldr r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC]
6086 + str r3, .saved_sam9_lpr
6088 + mov r3, #AT91_SDRAMC_LPCB_SELF_REFRESH
6089 + str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC]
6092 + /* Save Master clock setting */
6093 + ldr r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
6094 + str r3, .saved_mckr
6097 + * Set the Master clock source to slow clock
6099 + bic r3, r3, #AT91_PMC_CSS
6100 + str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
6104 +#ifdef SLOWDOWN_MASTER_CLOCK
6106 + * Set the Master Clock PRES and MDIV fields.
6108 + * See AT91RM9200 errata #27 and #28 for details.
6111 + str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
6116 + /* Save PLLA setting and disable it */
6117 + ldr r3, [r1, #(AT91_CKGR_PLLAR - AT91_PMC)]
6118 + str r3, .saved_pllar
6120 + mov r3, #AT91_PMC_PLLCOUNT
6121 + orr r3, r3, #(1 << 29) /* bit 29 always set */
6122 + str r3, [r1, #(AT91_CKGR_PLLAR - AT91_PMC)]
6126 + /* Save PLLB setting and disable it */
6127 + ldr r3, [r1, #(AT91_CKGR_PLLBR - AT91_PMC)]
6128 + str r3, .saved_pllbr
6130 + mov r3, #AT91_PMC_PLLCOUNT
6131 + str r3, [r1, #(AT91_CKGR_PLLBR - AT91_PMC)]
6135 + /* Turn off the main oscillator */
6136 + ldr r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)]
6137 + bic r3, r3, #AT91_PMC_MOSCEN
6138 + str r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)]
6140 + /* Wait for interrupt */
6141 + mcr p15, 0, r0, c7, c0, 4
6143 + /* Turn on the main oscillator */
6144 + ldr r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)]
6145 + orr r3, r3, #AT91_PMC_MOSCEN
6146 + str r3, [r1, #(AT91_CKGR_MOR - AT91_PMC)]
6150 + /* Restore PLLB setting */
6151 + ldr r3, .saved_pllbr
6152 + str r3, [r1, #(AT91_CKGR_PLLBR - AT91_PMC)]
6156 + /* Restore PLLA setting */
6157 + ldr r3, .saved_pllar
6158 + str r3, [r1, #(AT91_CKGR_PLLAR - AT91_PMC)]
6162 +#ifdef SLOWDOWN_MASTER_CLOCK
6164 + * First set PRES if it was not 0,
6165 + * than set CSS and MDIV fields.
6167 + * See AT91RM9200 errata #27 and #28 for details.
6169 + ldr r3, .saved_mckr
6170 + tst r3, #AT91_PMC_PRES
6172 + and r3, r3, #AT91_PMC_PRES
6173 + str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
6179 + * Restore master clock setting
6181 +2: ldr r3, .saved_mckr
6182 + str r3, [r1, #(AT91_PMC_MCKR - AT91_PMC)]
6186 +#ifdef CONFIG_ARCH_AT91RM9200
6187 + /* Do nothing - self-refresh is automatically disabled. */
6188 +#elif defined(CONFIG_ARCH_AT91CAP9)
6189 + /* Restore LPR on AT91CAP9 */
6190 + ldr r3, .saved_sam9_lpr
6191 + str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC]
6193 + /* Restore LPR on AT91SAM9 */
6194 + ldr r3, .saved_sam9_lpr
6195 + str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC]
6198 + /* Restore registers, and return */
6199 + ldmfd sp!, {r0 - r12, pc}
6215 + .word AT91_VA_BASE_SYS + AT91_PMC
6217 +#ifdef CONFIG_ARCH_AT91RM9200
6218 +.at91_va_base_sdramc:
6219 + .word AT91_VA_BASE_SYS
6220 +#elif defined(CONFIG_ARCH_AT91CAP9)
6221 +.at91_va_base_sdramc:
6222 + .word AT91_VA_BASE_SYS + AT91_DDRSDRC
6224 +.at91_va_base_sdramc:
6225 + .word AT91_VA_BASE_SYS + AT91_SDRAMC
6228 +ENTRY(at91_slow_clock_sz)
6229 + .word .-at91_slow_clock
6230 diff -urN -x CVS linux-2.6.25/arch/arm/mach-ks8695/Makefile linux-2.6/arch/arm/mach-ks8695/Makefile
6231 --- linux-2.6.25/arch/arm/mach-ks8695/Makefile 2008-05-03 00:15:44.000000000 +0200
6232 +++ linux-2.6/arch/arm/mach-ks8695/Makefile 2007-12-31 15:04:45.000000000 +0200
6234 # PCI support is optional
6235 obj-$(CONFIG_PCI) += pci.o
6238 +obj-$(CONFIG_LEDS) += leds.o
6240 # Board-specific support
6241 obj-$(CONFIG_MACH_KS8695) += board-micrel.o
6242 diff -urN -x CVS linux-2.6.25/arch/arm/mach-ks8695/devices.c linux-2.6/arch/arm/mach-ks8695/devices.c
6243 --- linux-2.6.25/arch/arm/mach-ks8695/devices.c 2007-10-09 22:31:38.000000000 +0200
6244 +++ linux-2.6/arch/arm/mach-ks8695/devices.c 2007-12-31 10:43:55.000000000 +0200
6245 @@ -176,6 +176,27 @@
6249 +/* --------------------------------------------------------------------
6251 + * -------------------------------------------------------------------- */
6253 +#if defined(CONFIG_LEDS)
6254 +short ks8695_leds_cpu = -1;
6255 +short ks8695_leds_timer = -1;
6257 +void __init ks8695_init_leds(u8 cpu_led, u8 timer_led)
6259 + /* Enable GPIO to access the LEDs */
6260 + gpio_direction_output(cpu_led, 1);
6261 + gpio_direction_output(timer_led, 1);
6263 + ks8695_leds_cpu = cpu_led;
6264 + ks8695_leds_timer = timer_led;
6267 +void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) {}
6270 /* -------------------------------------------------------------------- */
6273 diff -urN -x CVS linux-2.6.25/arch/arm/mach-ks8695/gpio.c linux-2.6/arch/arm/mach-ks8695/gpio.c
6274 --- linux-2.6.25/arch/arm/mach-ks8695/gpio.c 2008-05-03 00:15:44.000000000 +0200
6275 +++ linux-2.6/arch/arm/mach-ks8695/gpio.c 2007-12-31 14:49:20.000000000 +0200
6277 /* set line state */
6278 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
6285 __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPD);
6287 /* set pin as output */
6289 /* set output line state */
6290 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
6297 __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPD);
6299 local_irq_restore(flags);
6303 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
6304 - return (x & (1 << pin)) != 0;
6305 + return (x & IOPD_(pin)) != 0;
6307 EXPORT_SYMBOL(gpio_get_value);
6309 diff -urN -x CVS linux-2.6.25/arch/arm/mach-ks8695/leds.c linux-2.6/arch/arm/mach-ks8695/leds.c
6310 --- linux-2.6.25/arch/arm/mach-ks8695/leds.c 1970-01-01 02:00:00.000000000 +0200
6311 +++ linux-2.6/arch/arm/mach-ks8695/leds.c 2007-12-31 15:18:25.000000000 +0200
6314 + * LED driver for KS8695-based boards.
6316 + * Copyright (C) Andrew Victor
6318 + * This program is free software; you can redistribute it and/or modify
6319 + * it under the terms of the GNU General Public License version 2 as
6320 + * published by the Free Software Foundation.
6323 +#include <linux/kernel.h>
6324 +#include <linux/module.h>
6325 +#include <linux/init.h>
6327 +#include <asm/mach-types.h>
6328 +#include <asm/leds.h>
6329 +#include <asm/arch/devices.h>
6330 +#include <asm/arch/gpio.h>
6333 +static inline void ks8695_led_on(unsigned int led)
6335 + gpio_set_value(led, 0);
6338 +static inline void ks8695_led_off(unsigned int led)
6340 + gpio_set_value(led, 1);
6343 +static inline void ks8695_led_toggle(unsigned int led)
6345 + unsigned long is_off = gpio_get_value(led);
6347 + ks8695_led_on(led);
6349 + ks8695_led_off(led);
6354 + * Handle LED events.
6356 +static void ks8695_leds_event(led_event_t evt)
6358 + unsigned long flags;
6360 + local_irq_save(flags);
6363 + case led_start: /* System startup */
6364 + ks8695_led_on(ks8695_leds_cpu);
6367 + case led_stop: /* System stop / suspend */
6368 + ks8695_led_off(ks8695_leds_cpu);
6371 +#ifdef CONFIG_LEDS_TIMER
6372 + case led_timer: /* Every 50 timer ticks */
6373 + ks8695_led_toggle(ks8695_leds_timer);
6377 +#ifdef CONFIG_LEDS_CPU
6378 + case led_idle_start: /* Entering idle state */
6379 + ks8695_led_off(ks8695_leds_cpu);
6382 + case led_idle_end: /* Exit idle state */
6383 + ks8695_led_on(ks8695_leds_cpu);
6391 + local_irq_restore(flags);
6395 +static int __init leds_init(void)
6397 + if ((ks8695_leds_timer == -1) || (ks8695_leds_cpu == -1))
6400 + leds_event = ks8695_leds_event;
6402 + leds_event(led_start);
6406 +__initcall(leds_init);
6407 diff -urN -x CVS linux-2.6.25/arch/arm/mach-ks8695/pci.c linux-2.6/arch/arm/mach-ks8695/pci.c
6408 --- linux-2.6.25/arch/arm/mach-ks8695/pci.c 2008-05-03 00:15:44.000000000 +0200
6409 +++ linux-2.6/arch/arm/mach-ks8695/pci.c 2008-05-08 22:03:41.000000000 +0200
6411 .write = ks8695_pci_writeconfig,
6414 -static struct pci_bus *ks8695_pci_scan_bus(int nr, struct pci_sys_data *sys)
6415 +static struct pci_bus* __init ks8695_pci_scan_bus(int nr, struct pci_sys_data *sys)
6417 return pci_scan_bus(sys->busnr, &ks8695_pci_ops, sys);
6419 diff -urN -x CVS linux-2.6.25/drivers/char/Kconfig linux-2.6/drivers/char/Kconfig
6420 --- linux-2.6.25/drivers/char/Kconfig 2008-05-03 00:15:47.000000000 +0200
6421 +++ linux-2.6/drivers/char/Kconfig 2008-03-09 15:14:46.000000000 +0200
6422 @@ -1056,5 +1056,21 @@
6424 source "drivers/s390/char/Kconfig"
6427 + bool "SPI driver (legacy) for AT91RM9200 processors"
6428 + depends on ARCH_AT91RM9200
6431 + The SPI driver gives access to this serial bus on the AT91RM9200
6435 + bool "SPI device interface (legacy) for AT91RM9200 processors"
6436 + depends on ARCH_AT91RM9200 && AT91_SPI
6439 + The SPI driver gives user mode access to this serial
6440 + bus on the AT91RM9200 processor.
6444 diff -urN -x CVS linux-2.6.25/drivers/char/Makefile linux-2.6/drivers/char/Makefile
6445 --- linux-2.6.25/drivers/char/Makefile 2008-05-03 00:15:47.000000000 +0200
6446 +++ linux-2.6/drivers/char/Makefile 2008-03-09 15:14:46.000000000 +0200
6448 obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o
6449 obj-$(CONFIG_GPIO_TB0219) += tb0219.o
6450 obj-$(CONFIG_TELCLOCK) += tlclk.o
6451 +obj-$(CONFIG_AT91_SPI) += at91_spi.o
6452 +obj-$(CONFIG_AT91_SPIDEV) += at91_spidev.o
6454 obj-$(CONFIG_MWAVE) += mwave/
6455 obj-$(CONFIG_AGP) += agp/
6456 diff -urN -x CVS linux-2.6.25/drivers/char/at91_spi.c linux-2.6/drivers/char/at91_spi.c
6457 --- linux-2.6.25/drivers/char/at91_spi.c 1970-01-01 02:00:00.000000000 +0200
6458 +++ linux-2.6/drivers/char/at91_spi.c 2008-04-18 17:38:01.000000000 +0200
6461 + * Serial Peripheral Interface (SPI) driver for the Atmel AT91RM9200 (Thunder)
6463 + * Copyright (C) SAN People (Pty) Ltd
6465 + * This program is free software; you can redistribute it and/or
6466 + * modify it under the terms of the GNU General Public License
6467 + * as published by the Free Software Foundation; either version
6468 + * 2 of the License, or (at your option) any later version.
6471 +#include <linux/init.h>
6472 +#include <linux/dma-mapping.h>
6473 +#include <linux/module.h>
6474 +#include <linux/sched.h>
6475 +#include <linux/completion.h>
6476 +#include <linux/interrupt.h>
6477 +#include <linux/clk.h>
6478 +#include <linux/platform_device.h>
6479 +#include <linux/atmel_pdc.h>
6480 +#include <asm/io.h>
6481 +#include <asm/semaphore.h>
6483 +#include <asm/arch/at91_spi.h>
6484 +#include <asm/arch/board.h>
6485 +#include <asm/arch/spi.h>
6489 +static struct spi_local spi_dev[NR_SPI_DEVICES]; /* state of the SPI devices */
6490 +static int spi_enabled = 0;
6491 +static struct semaphore spi_lock; /* protect access to SPI bus */
6492 +static int current_device = -1; /* currently selected SPI device */
6493 +static struct clk *spi_clk; /* SPI clock */
6494 +static void __iomem *spi_base; /* SPI peripheral base-address */
6496 +DECLARE_COMPLETION(transfer_complete);
6499 +#define at91_spi_read(reg) __raw_readl(spi_base + (reg))
6500 +#define at91_spi_write(reg, val) __raw_writel((val), spi_base + (reg))
6503 +/* ......................................................................... */
6506 + * Access and enable the SPI bus.
6507 + * This MUST be called before any transfers are performed.
6509 +void spi_access_bus(short device)
6511 + /* Ensure that requested device is valid */
6512 + if ((device < 0) || (device >= NR_SPI_DEVICES))
6513 + panic("at91_spi: spi_access_bus called with invalid device");
6515 + if (spi_enabled == 0) {
6516 + clk_enable(spi_clk); /* Enable Peripheral clock */
6517 + at91_spi_write(AT91_SPI_CR, AT91_SPI_SPIEN); /* Enable SPI */
6519 + printk("SPI on\n");
6524 + /* Lock the SPI bus */
6526 + current_device = device;
6528 + /* Configure SPI bus for device */
6529 + at91_spi_write(AT91_SPI_MR, AT91_SPI_MSTR | AT91_SPI_MODFDIS | (spi_dev[device].pcs << 16));
6533 + * Relinquish control of the SPI bus.
6535 +void spi_release_bus(short device)
6537 + if (device != current_device)
6538 + panic("at91_spi: spi_release called with invalid device");
6540 + /* Release the SPI bus */
6541 + current_device = -1;
6545 + if (spi_enabled == 0) {
6546 + at91_spi_write(AT91_SPI_CR, AT91_SPI_SPIDIS); /* Disable SPI */
6547 + clk_disable(spi_clk); /* Disable Peripheral clock */
6549 + printk("SPI off\n");
6555 + * Perform a data transfer over the SPI bus
6557 +int spi_transfer(struct spi_transfer_list* list)
6559 + struct spi_local *device = (struct spi_local *) &spi_dev[current_device];
6563 + panic("at91_spi: spi_transfer called with NULL transfer list");
6564 + if (current_device == -1)
6565 + panic("at91_spi: spi_transfer called without acquiring bus");
6568 + printk("SPI transfer start [%i]\n", list->nr_transfers);
6571 + /* If we are in 16-bit mode, we need to modify what we pass to the PDC */
6572 + tx_size = (at91_spi_read(AT91_SPI_CSR(current_device)) & AT91_SPI_BITS_16) ? 2 : 1;
6574 + /* Store transfer list */
6575 + device->xfers = list;
6578 + /* Assume there must be at least one transfer */
6579 + device->tx = dma_map_single(NULL, list->tx[0], list->txlen[0], DMA_TO_DEVICE);
6580 + device->rx = dma_map_single(NULL, list->rx[0], list->rxlen[0], DMA_FROM_DEVICE);
6582 + /* Program PDC registers */
6583 + at91_spi_write(ATMEL_PDC_TPR, device->tx);
6584 + at91_spi_write(ATMEL_PDC_RPR, device->rx);
6585 + at91_spi_write(ATMEL_PDC_TCR, list->txlen[0] / tx_size);
6586 + at91_spi_write(ATMEL_PDC_RCR, list->rxlen[0] / tx_size);
6588 + /* Is there a second transfer? */
6589 + if (list->nr_transfers > 1) {
6590 + device->txnext = dma_map_single(NULL, list->tx[1], list->txlen[1], DMA_TO_DEVICE);
6591 + device->rxnext = dma_map_single(NULL, list->rx[1], list->rxlen[1], DMA_FROM_DEVICE);
6593 + /* Program Next PDC registers */
6594 + at91_spi_write(ATMEL_PDC_TNPR, device->txnext);
6595 + at91_spi_write(ATMEL_PDC_RNPR, device->rxnext);
6596 + at91_spi_write(ATMEL_PDC_TNCR, list->txlen[1] / tx_size);
6597 + at91_spi_write(ATMEL_PDC_RNCR, list->rxlen[1] / tx_size);
6600 + device->txnext = 0;
6601 + device->rxnext = 0;
6602 + at91_spi_write(ATMEL_PDC_TNCR, 0);
6603 + at91_spi_write(ATMEL_PDC_RNCR, 0);
6606 + // TODO: If we are doing consecutive transfers (at high speed, or
6607 + // small buffers), then it might be worth modifying the 'Delay between
6608 + // Consecutive Transfers' in the CSR registers.
6609 + // This is an issue if we cannot chain the next buffer fast enough
6610 + // in the interrupt handler.
6612 + /* Enable transmitter and receiver */
6613 + at91_spi_write(ATMEL_PDC_PTCR, ATMEL_PDC_RXTEN | ATMEL_PDC_TXTEN);
6615 + at91_spi_write(AT91_SPI_IER, AT91_SPI_ENDRX); /* enable buffer complete interrupt */
6616 + wait_for_completion(&transfer_complete);
6619 + printk("SPI transfer end\n");
6625 +/* ......................................................................... */
6628 + * Handle interrupts from the SPI controller.
6630 +static irqreturn_t at91spi_interrupt(int irq, void *dev_id)
6632 + unsigned int status;
6633 + struct spi_local *device = (struct spi_local *) &spi_dev[current_device];
6634 + struct spi_transfer_list *list = device->xfers;
6637 + printk("SPI interrupt %i\n", current_device);
6641 + panic("at91_spi: spi_interrupt with a NULL transfer list");
6643 + status = at91_spi_read(AT91_SPI_SR) & at91_spi_read(AT91_SPI_IMR); /* read status */
6645 + dma_unmap_single(NULL, device->tx, list->txlen[list->curr], DMA_TO_DEVICE);
6646 + dma_unmap_single(NULL, device->rx, list->rxlen[list->curr], DMA_FROM_DEVICE);
6648 + device->tx = device->txnext; /* move next transfer to current transfer */
6649 + device->rx = device->rxnext;
6651 + list->curr = list->curr + 1;
6652 + if (list->curr == list->nr_transfers) { /* all transfers complete */
6653 + at91_spi_write(AT91_SPI_IDR, AT91_SPI_ENDRX); /* disable interrupt */
6655 + /* Disable transmitter and receiver */
6656 + at91_spi_write(ATMEL_PDC_PTCR, ATMEL_PDC_RXTDIS | ATMEL_PDC_TXTDIS);
6658 + device->xfers = NULL;
6659 + complete(&transfer_complete);
6661 + else if (list->curr+1 == list->nr_transfers) { /* no more next transfers */
6662 + device->txnext = 0;
6663 + device->rxnext = 0;
6664 + at91_spi_write(ATMEL_PDC_TNCR, 0);
6665 + at91_spi_write(ATMEL_PDC_RNCR, 0);
6668 + int i = (list->curr)+1;
6670 + /* If we are in 16-bit mode, we need to modify what we pass to the PDC */
6671 + int tx_size = (at91_spi_read(AT91_SPI_CSR(current_device)) & AT91_SPI_BITS_16) ? 2 : 1;
6673 + device->txnext = dma_map_single(NULL, list->tx[i], list->txlen[i], DMA_TO_DEVICE);
6674 + device->rxnext = dma_map_single(NULL, list->rx[i], list->rxlen[i], DMA_FROM_DEVICE);
6675 + at91_spi_write(ATMEL_PDC_TNPR, device->txnext);
6676 + at91_spi_write(ATMEL_PDC_RNPR, device->rxnext);
6677 + at91_spi_write(ATMEL_PDC_TNCR, list->txlen[i] / tx_size);
6678 + at91_spi_write(ATMEL_PDC_RNCR, list->rxlen[i] / tx_size);
6680 + return IRQ_HANDLED;
6683 +/* ......................................................................... */
6686 + * Initialize the SPI controller
6688 +static int __init at91spi_probe(struct platform_device *pdev)
6691 + unsigned long scbr;
6692 + struct resource *res;
6694 + init_MUTEX(&spi_lock);
6696 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
6700 + if (!request_mem_region(res->start, res->end - res->start + 1, "at91_spi"))
6703 + spi_base = ioremap(res->start, res->end - res->start + 1);
6705 + release_mem_region(res->start, res->end - res->start + 1);
6709 + spi_clk = clk_get(NULL, "spi_clk");
6710 + if (IS_ERR(spi_clk)) {
6711 + printk(KERN_ERR "at91_spi: no clock defined\n");
6712 + iounmap(spi_base);
6713 + release_mem_region(res->start, res->end - res->start + 1);
6717 + at91_spi_write(AT91_SPI_CR, AT91_SPI_SWRST); /* software reset of SPI controller */
6720 + * Calculate the correct SPI baud-rate divisor.
6722 + scbr = clk_get_rate(spi_clk) / (2 * DEFAULT_SPI_CLK);
6723 + scbr = scbr + 1; /* round up */
6725 + printk(KERN_INFO "at91_spi: Baud rate set to %ld\n", clk_get_rate(spi_clk) / (2 * scbr));
6727 + /* Set Chip Select registers to good defaults */
6728 + for (i = 0; i < 4; i++) {
6729 + at91_spi_write(AT91_SPI_CSR(i), AT91_SPI_CPOL | AT91_SPI_BITS_8 | (16 << 16) | (scbr << 8));
6732 + at91_spi_write(ATMEL_PDC_PTCR, ATMEL_PDC_RXTDIS | ATMEL_PDC_TXTDIS);
6734 + memset(&spi_dev, 0, sizeof(spi_dev));
6735 + spi_dev[0].pcs = 0xE;
6736 + spi_dev[1].pcs = 0xD;
6737 + spi_dev[2].pcs = 0xB;
6738 + spi_dev[3].pcs = 0x7;
6740 + if (request_irq(AT91RM9200_ID_SPI, at91spi_interrupt, 0, "spi", NULL)) {
6742 + iounmap(spi_base);
6743 + release_mem_region(res->start, res->end - res->start + 1);
6747 + at91_spi_write(AT91_SPI_CR, AT91_SPI_SPIEN); /* Enable SPI */
6752 +static int __devexit at91spi_remove(struct platform_device *pdev)
6754 + struct resource *res;
6756 + at91_spi_write(AT91_SPI_CR, AT91_SPI_SPIDIS); /* Disable SPI */
6759 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
6760 + iounmap(spi_base);
6761 + release_mem_region(res->start, res->end - res->start + 1);
6763 + free_irq(AT91RM9200_ID_SPI, 0);
6767 +static struct platform_driver at91spi_driver = {
6768 + .probe = at91spi_probe,
6769 + .remove = __devexit_p(at91spi_remove),
6771 + .name = "at91_spi",
6772 + .owner = THIS_MODULE,
6776 +static int __init at91spi_init(void)
6778 + return platform_driver_register(&at91spi_driver);
6781 +static void __exit at91spi_exit(void)
6783 + platform_driver_unregister(&at91spi_driver);
6786 +EXPORT_SYMBOL(spi_access_bus);
6787 +EXPORT_SYMBOL(spi_release_bus);
6788 +EXPORT_SYMBOL(spi_transfer);
6790 +module_init(at91spi_init);
6791 +module_exit(at91spi_exit);
6793 +MODULE_LICENSE("GPL")
6794 +MODULE_AUTHOR("Andrew Victor")
6795 +MODULE_DESCRIPTION("SPI driver for Atmel AT91RM9200")
6796 +MODULE_ALIAS("platform:at91_spi");
6797 diff -urN -x CVS linux-2.6.25/drivers/char/at91_spidev.c linux-2.6/drivers/char/at91_spidev.c
6798 --- linux-2.6.25/drivers/char/at91_spidev.c 1970-01-01 02:00:00.000000000 +0200
6799 +++ linux-2.6/drivers/char/at91_spidev.c 2007-12-31 15:18:43.000000000 +0200
6802 + * User-space interface to the SPI bus on Atmel AT91RM9200
6804 + * Copyright (C) 2003 SAN People (Pty) Ltd
6806 + * Based on SPI driver by Rick Bronson
6808 + * This program is free software; you can redistribute it and/or
6809 + * modify it under the terms of the GNU General Public License
6810 + * as published by the Free Software Foundation; either version
6811 + * 2 of the License, or (at your option) any later version.
6814 +#include <linux/module.h>
6815 +#include <linux/init.h>
6816 +#include <linux/slab.h>
6817 +#include <linux/highmem.h>
6818 +#include <linux/pagemap.h>
6819 +#include <asm/arch/spi.h>
6821 +#ifdef CONFIG_DEVFS_FS
6822 +#include <linux/devfs_fs_kernel.h>
6826 +#undef DEBUG_SPIDEV
6828 +/* ......................................................................... */
6831 + * Read or Write to SPI bus.
6833 +static ssize_t spidev_rd_wr(struct file *file, char *buf, size_t count, loff_t *offset)
6835 + unsigned int spi_device = (unsigned int) file->private_data;
6837 + struct mm_struct * mm;
6838 + struct page ** maplist;
6839 + struct spi_transfer_list* list;
6842 + unsigned int ofs, pagelen;
6849 + list = kmalloc(sizeof(struct spi_transfer_list), GFP_KERNEL);
6856 + pgcount = ((unsigned long)buf+count+PAGE_SIZE-1)/PAGE_SIZE - (unsigned long)buf/PAGE_SIZE;
6858 + if (pgcount >= MAX_SPI_TRANSFERS) {
6863 + maplist = kmalloc (pgcount * sizeof (struct page *), GFP_KERNEL);
6869 + flush_cache_all();
6870 + down_read(&mm->mmap_sem);
6871 + err= get_user_pages(current, mm, (unsigned long)buf, pgcount, 1, 0, maplist, NULL);
6872 + up_read(&mm->mmap_sem);
6881 +#ifdef DEBUG_SPIDEV
6882 + printk("spidev_rd_rw: %i %i\n", count, pgcount);
6885 + /* Set default return value = transfer length */
6889 + * At this point, the virtual area buf[0] .. buf[count-1] will have
6890 + * corresponding pages mapped in the physical memory and locked until
6891 + * we unmap the kiobuf. The pages cannot be swapped out or moved
6894 + ofs = (unsigned long) buf & (PAGE_SIZE -1);
6895 + pagelen = PAGE_SIZE - ofs;
6896 + if (count < pagelen)
6899 + for (i = 0; i < pgcount; i++) {
6900 + flush_dcache_page(maplist[i]);
6902 + list->tx[i] = list->rx[i] = page_address(maplist[i]) + ofs;
6903 + list->txlen[i] = list->rxlen[i] = pagelen;
6905 +#ifdef DEBUG_SPIDEV
6906 + printk(" %i: %x (%i)\n", i, list->tx[i], list->txlen[i]);
6909 + ofs = 0; /* all subsequent transfers start at beginning of a page */
6910 + count = count - pagelen;
6911 + pagelen = (count < PAGE_SIZE) ? count : PAGE_SIZE;
6913 + list->nr_transfers = pgcount;
6915 + /* Perform transfer on SPI bus */
6916 + spi_access_bus(spi_device);
6917 + spi_transfer(list);
6918 + spi_release_bus(spi_device);
6920 + while (pgcount--) {
6921 + page_cache_release (maplist[pgcount]);
6923 + flush_cache_all();
6931 +static int spidev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
6933 + int spi_device = MINOR(inode->i_rdev);
6935 + if (spi_device >= NR_SPI_DEVICES)
6938 + // TODO: This interface can be used to configure the SPI bus.
6939 + // Configurable options could include: Speed, Clock Polarity, Clock Phase
6943 + return -ENOIOCTLCMD;
6948 + * Open the SPI device
6950 +static int spidev_open(struct inode *inode, struct file *file)
6952 + unsigned int spi_device = MINOR(inode->i_rdev);
6954 + if (spi_device >= NR_SPI_DEVICES)
6958 + * 'private_data' is actually a pointer, but we overload it with the
6959 + * value we want to store.
6961 + file->private_data = (void *)spi_device;
6967 + * Close the SPI device
6969 +static int spidev_close(struct inode *inode, struct file *file)
6974 +/* ......................................................................... */
6976 +static struct file_operations spidev_fops = {
6977 + .owner = THIS_MODULE,
6978 + .llseek = no_llseek,
6979 + .read = spidev_rd_wr,
6980 + .write = (int (*) (struct file *file, const char *buf, size_t count, loff_t *offset))spidev_rd_wr,
6981 + .ioctl = spidev_ioctl,
6982 + .open = spidev_open,
6983 + .release = spidev_close,
6987 + * Install the SPI /dev interface driver
6989 +static int __init at91_spidev_init(void)
6991 +#ifdef CONFIG_DEVFS_FS
6995 + if (register_chrdev(SPI_MAJOR, "spi", &spidev_fops)) {
6996 + printk(KERN_ERR "at91_spidev: Unable to get major %d for SPI bus\n", SPI_MAJOR);
7000 +#ifdef CONFIG_DEVFS_FS
7001 + devfs_mk_dir("spi");
7002 + for (i = 0; i < NR_SPI_DEVICES; i++) {
7003 + devfs_mk_cdev(MKDEV(SPI_MAJOR, i), S_IFCHR | S_IRUSR | S_IWUSR, "spi/%d",i);
7006 + printk(KERN_INFO "AT91 SPI driver loaded\n");
7012 + * Remove the SPI /dev interface driver
7014 +static void __exit at91_spidev_exit(void)
7016 +#ifdef CONFIG_DEVFS_FS
7018 + for (i = 0; i < NR_SPI_DEVICES; i++) {
7019 + devfs_remove("spi/%d", i);
7022 + devfs_remove("spi");
7025 + unregister_chrdev(SPI_MAJOR, "spi");
7028 +module_init(at91_spidev_init);
7029 +module_exit(at91_spidev_exit);
7031 +MODULE_LICENSE("GPL")
7032 +MODULE_AUTHOR("Andrew Victor")
7033 +MODULE_DESCRIPTION("SPI /dev interface for Atmel AT91RM9200")
7034 diff -urN -x CVS linux-2.6.25/drivers/i2c/busses/Kconfig linux-2.6/drivers/i2c/busses/Kconfig
7035 --- linux-2.6.25/drivers/i2c/busses/Kconfig 2008-05-03 00:15:47.000000000 +0200
7036 +++ linux-2.6/drivers/i2c/busses/Kconfig 2008-04-02 22:11:28.000000000 +0200
7038 to support combined I2C messages. Use the i2c-gpio driver
7039 unless your system can cope with those limitations.
7041 +config I2C_AT91_CLOCKRATE
7042 + prompt "Atmel AT91 I2C/TWI clock-rate"
7043 + depends on I2C_AT91
7047 + Set the AT91 I2C/TWI clock-rate.
7050 tristate "Au1550/Au1200 SMBus interface"
7051 depends on SOC_AU1550 || SOC_AU1200
7052 @@ -626,6 +634,14 @@
7053 This driver can also be built as a module. If so, the module
7054 will be called i2c-voodoo3.
7057 + tristate "PCA9564"
7059 + select I2C_ALGOPCA
7061 + This driver support the Philips PCA 9564 Parallel bus to I2C
7065 tristate "PCA9564 on an ISA bus"
7067 diff -urN -x CVS linux-2.6.25/drivers/i2c/busses/Makefile linux-2.6/drivers/i2c/busses/Makefile
7068 --- linux-2.6.25/drivers/i2c/busses/Makefile 2008-05-03 00:15:47.000000000 +0200
7069 +++ linux-2.6/drivers/i2c/busses/Makefile 2008-03-09 15:14:46.000000000 +0200
7071 obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o
7072 obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o
7073 obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o
7074 +obj-$(CONFIG_I2C_PCA) += i2c-pca.o
7075 obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o
7076 obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o
7077 obj-$(CONFIG_I2C_PMCMSP) += i2c-pmcmsp.o
7078 diff -urN -x CVS linux-2.6.25/drivers/i2c/busses/i2c-at91.c linux-2.6/drivers/i2c/busses/i2c-at91.c
7079 --- linux-2.6.25/drivers/i2c/busses/i2c-at91.c 2008-05-03 00:15:35.000000000 +0200
7080 +++ linux-2.6/drivers/i2c/busses/i2c-at91.c 2008-01-16 13:15:34.000000000 +0200
7082 #include <asm/arch/board.h>
7083 #include <asm/arch/cpu.h>
7085 -#define TWI_CLOCK 100000 /* Hz. max 400 Kbits/sec */
7087 +/* Clockrate is configurable - max 400 Kbits/sec */
7088 +static unsigned int clockrate = CONFIG_I2C_AT91_CLOCKRATE;
7089 +module_param(clockrate, uint, 0);
7090 +MODULE_PARM_DESC(clockrate, "The TWI clockrate");
7092 static struct clk *twi_clk;
7093 static void __iomem *twi_base;
7095 at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN); /* Set Master mode */
7097 /* Calcuate clock dividers */
7098 - cdiv = (clk_get_rate(twi_clk) / (2 * TWI_CLOCK)) - 3;
7099 + cdiv = (clk_get_rate(twi_clk) / (2 * clockrate)) - 3;
7100 cdiv = cdiv + 1; /* round up */
7102 while (cdiv > 255) {
7107 - if (cpu_is_at91rm9200()) { /* AT91RM9200 Errata #22 */
7109 - printk(KERN_ERR "AT91 I2C: Invalid TWI_CLOCK value!\n");
7112 + if (cpu_is_at91rm9200() && (ckdiv > 5)) { /* AT91RM9200 Errata #22 */
7113 + printk(KERN_ERR "AT91 I2C: Invalid TWI clockrate!\n");
7115 + } else if (ckdiv > 7) {
7116 + printk(KERN_ERR "AT91 I2C: Invalid TWI clockrate!\n");
7120 at91_twi_write(AT91_TWI_CWGR, (ckdiv << 16) | (cdiv << 8) | cdiv);
7121 diff -urN -x CVS linux-2.6.25/drivers/i2c/busses/i2c-pca.c linux-2.6/drivers/i2c/busses/i2c-pca.c
7122 --- linux-2.6.25/drivers/i2c/busses/i2c-pca.c 1970-01-01 02:00:00.000000000 +0200
7123 +++ linux-2.6/drivers/i2c/busses/i2c-pca.c 2007-12-31 15:18:43.000000000 +0200
7126 + * Platform driver for PCA9564 I2C bus controller.
7128 + * (C) 2006 Andrew Victor
7130 + * Based on i2c-pca-isa.c driver for PCA9564 on ISA boards
7131 + * Copyright (C) 2004 Arcom Control Systems
7133 + * This program is free software; you can redistribute it and/or modify
7134 + * it under the terms of the GNU General Public License as published by
7135 + * the Free Software Foundation; either version 2 of the License, or
7136 + * (at your option) any later version.
7138 + * This program is distributed in the hope that it will be useful,
7139 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7140 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7141 + * GNU General Public License for more details.
7143 + * You should have received a copy of the GNU General Public License
7144 + * along with this program; if not, write to the Free Software
7145 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7148 +#include <linux/kernel.h>
7149 +#include <linux/module.h>
7150 +#include <linux/moduleparam.h>
7151 +#include <linux/delay.h>
7152 +#include <linux/init.h>
7153 +#include <linux/interrupt.h>
7154 +#include <linux/wait.h>
7155 +#include <linux/platform_device.h>
7157 +#include <linux/i2c.h>
7158 +#include <linux/i2c-algo-pca.h>
7160 +#include <asm/io.h>
7162 +#include "../algos/i2c-algo-pca.h"
7164 +#define PCA_OWN_ADDRESS 0x55 /* our address for slave mode */
7165 +#define PCA_CLOCK I2C_PCA_CON_59kHz
7167 +//#define REG_SHIFT 2
7168 +#define REG_SHIFT 0
7172 +#define PCA_IO_SIZE 4
7174 +static void __iomem *base_addr;
7176 +static wait_queue_head_t pca_wait;
7178 +static int pca_getown(struct i2c_algo_pca_data *adap)
7180 + return PCA_OWN_ADDRESS;
7183 +static int pca_getclock(struct i2c_algo_pca_data *adap)
7188 +static void pca_writebyte(struct i2c_algo_pca_data *adap, int reg, int val)
7191 + static char *names[] = { "T/O", "DAT", "ADR", "CON" };
7192 + printk("*** write %s at %#lx <= %#04x\n", names[reg], (unsigned long) base_addr+reg, val);
7195 + outb(val, base_addr + (reg << REG_SHIFT));
7198 +static int pca_readbyte(struct i2c_algo_pca_data *adap, int reg)
7203 + res = inb(base_addr + (reg << REG_SHIFT));
7206 + static char *names[] = { "STA", "DAT", "ADR", "CON" };
7207 + printk("*** read %s => %#04x\n", names[reg], res);
7213 +static int pca_waitforinterrupt(struct i2c_algo_pca_data *adap)
7218 + ret = wait_event_interruptible(pca_wait,
7219 + pca_readbyte(adap, I2C_PCA_CON) & I2C_PCA_CON_SI);
7221 + while ((pca_readbyte(adap, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0)
7227 +static irqreturn_t pca_handler(int this_irq, void *dev_id)
7229 + wake_up_interruptible(&pca_wait);
7230 + return IRQ_HANDLED;
7233 +static struct i2c_algo_pca_data pca_i2c_data = {
7234 + .get_own = pca_getown,
7235 + .get_clock = pca_getclock,
7236 + .write_byte = pca_writebyte,
7237 + .read_byte = pca_readbyte,
7238 + .wait_for_interrupt = pca_waitforinterrupt,
7241 +static struct i2c_adapter pca_i2c_ops = {
7242 + .owner = THIS_MODULE,
7243 + .id = I2C_HW_A_PLAT,
7244 + .algo_data = &pca_i2c_data,
7245 + .name = "PCA9564",
7246 + .class = I2C_CLASS_HWMON,
7249 +static int __devinit pca_i2c_probe(struct platform_device *pdev)
7251 + struct resource *res;
7253 + init_waitqueue_head(&pca_wait);
7255 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
7259 + if (!request_mem_region(res->start, PCA_IO_SIZE, "PCA9564"))
7262 + base_addr = ioremap(res->start, PCA_IO_SIZE);
7263 + if (base_addr == NULL)
7266 + irq = platform_get_irq(pdev, 0);
7268 + if (request_irq(irq, pca_handler, 0, "pca9564", NULL) < 0) {
7269 + printk(KERN_ERR "i2c-pca: Request irq%d failed\n", irq);
7274 + /* set up the driverfs linkage to our parent device */
7275 + pca_i2c_ops.dev.parent = &pdev->dev;
7277 + if (i2c_pca_add_bus(&pca_i2c_ops) < 0) {
7278 + printk(KERN_ERR "i2c-pca: Failed to add i2c bus\n");
7286 + free_irq(irq, &pca_i2c_ops);
7289 + iounmap(base_addr);
7292 + release_mem_region(res->start, PCA_IO_SIZE);
7296 +static int __devexit pca_i2c_remove(struct platform_device *pdev)
7298 + struct resource *res;
7300 + i2c_del_adapter(&pca_i2c_ops);
7303 + free_irq(irq, NULL);
7305 + iounmap(base_addr);
7307 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
7308 + release_mem_region(res->start, PCA_IO_SIZE);
7313 +static struct platform_driver pca_i2c_driver = {
7314 + .probe = pca_i2c_probe,
7315 + .remove = __devexit_p(pca_i2c_remove),
7317 + .name = "pca9564",
7318 + .owner = THIS_MODULE,
7322 +static int __init pca_i2c_init(void)
7324 + return platform_driver_register(&pca_i2c_driver);
7327 +static void __exit pca_i2c_exit(void)
7329 + platform_driver_unregister(&pca_i2c_driver);
7332 +module_init(pca_i2c_init);
7333 +module_exit(pca_i2c_exit);
7335 +MODULE_AUTHOR("Andrew Victor");
7336 +MODULE_DESCRIPTION("PCA9564 platform driver");
7337 +MODULE_LICENSE("GPL");
7338 diff -urN -x CVS linux-2.6.25/drivers/mmc/host/at91_mci.c linux-2.6/drivers/mmc/host/at91_mci.c
7339 --- linux-2.6.25/drivers/mmc/host/at91_mci.c 2008-05-03 00:15:48.000000000 +0200
7340 +++ linux-2.6/drivers/mmc/host/at91_mci.c 2008-04-18 17:32:40.000000000 +0200
7341 @@ -659,13 +659,14 @@
7342 /* maybe switch power to the card */
7343 if (host->board->vcc_pin) {
7344 switch (ios->power_mode) {
7345 - case MMC_POWER_OFF:
7346 - gpio_set_value(host->board->vcc_pin, 0);
7348 - case MMC_POWER_UP:
7349 - case MMC_POWER_ON:
7350 - gpio_set_value(host->board->vcc_pin, 1);
7352 + case MMC_POWER_OFF:
7353 + gpio_set_value(host->board->vcc_pin, 0);
7355 + case MMC_POWER_UP:
7356 + gpio_set_value(host->board->vcc_pin, 1);
7363 diff -urN -x CVS linux-2.6.25/drivers/mtd/devices/Kconfig linux-2.6/drivers/mtd/devices/Kconfig
7364 --- linux-2.6.25/drivers/mtd/devices/Kconfig 2008-05-03 00:15:36.000000000 +0200
7365 +++ linux-2.6/drivers/mtd/devices/Kconfig 2007-12-31 10:44:25.000000000 +0200
7366 @@ -270,5 +270,17 @@
7367 LinuxBIOS or if you need to recover a DiskOnChip Millennium on which
7368 you have managed to wipe the first block.
7371 +config MTD_AT91_DATAFLASH
7372 + tristate "AT91RM9200 DataFlash AT45DBxxx (legacy driver)"
7373 + depends on MTD && ARCH_AT91RM9200 && AT91_SPI
7375 + This enables access to the DataFlash (AT45DBxxx) on the AT91RM9200.
7376 + If you have such a board, say 'Y'.
7378 +config DATAFLASH_ALWAYS_ADD_DEVICE
7379 + bool "Register whole DataFlash device"
7380 + depends on MTD_AT91_DATAFLASH
7382 + Always add the whole DataFlash device when using MTD partitions.
7385 diff -urN -x CVS linux-2.6.25/drivers/mtd/devices/Makefile linux-2.6/drivers/mtd/devices/Makefile
7386 --- linux-2.6.25/drivers/mtd/devices/Makefile 2008-05-03 00:15:36.000000000 +0200
7387 +++ linux-2.6/drivers/mtd/devices/Makefile 2007-12-31 10:48:27.000000000 +0200
7389 obj-$(CONFIG_MTD_BLOCK2MTD) += block2mtd.o
7390 obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o
7391 obj-$(CONFIG_MTD_M25P80) += m25p80.o
7392 +obj-$(CONFIG_MTD_AT91_DATAFLASH)+= at91_dataflash.o
7393 diff -urN -x CVS linux-2.6.25/drivers/mtd/devices/at91_dataflash.c linux-2.6/drivers/mtd/devices/at91_dataflash.c
7394 --- linux-2.6.25/drivers/mtd/devices/at91_dataflash.c 1970-01-01 02:00:00.000000000 +0200
7395 +++ linux-2.6/drivers/mtd/devices/at91_dataflash.c 2007-12-31 15:18:43.000000000 +0200
7398 + * Atmel DataFlash driver for Atmel AT91RM9200 (Thunder)
7400 + * Copyright (C) SAN People (Pty) Ltd
7402 + * This program is free software; you can redistribute it and/or
7403 + * modify it under the terms of the GNU General Public License
7404 + * as published by the Free Software Foundation; either version
7405 + * 2 of the License, or (at your option) any later version.
7408 +#include <linux/module.h>
7409 +#include <linux/init.h>
7410 +#include <linux/slab.h>
7411 +#include <linux/pci.h>
7412 +#include <linux/mtd/mtd.h>
7413 +#include <linux/mtd/partitions.h>
7415 +#include <asm/mach-types.h>
7417 +#include <asm/arch/spi.h>
7420 +#undef DEBUG_DATAFLASH
7422 +#define DATAFLASH_MAX_DEVICES 4 /* max number of dataflash devices */
7424 +#define OP_READ_CONTINUOUS 0xE8
7425 +#define OP_READ_PAGE 0xD2
7426 +#define OP_READ_BUFFER1 0xD4
7427 +#define OP_READ_BUFFER2 0xD6
7428 +#define OP_READ_STATUS 0xD7
7430 +#define OP_ERASE_PAGE 0x81
7431 +#define OP_ERASE_BLOCK 0x50
7433 +#define OP_TRANSFER_BUF1 0x53
7434 +#define OP_TRANSFER_BUF2 0x55
7435 +#define OP_COMPARE_BUF1 0x60
7436 +#define OP_COMPARE_BUF2 0x61
7438 +#define OP_PROGRAM_VIA_BUF1 0x82
7439 +#define OP_PROGRAM_VIA_BUF2 0x85
7441 +struct dataflash_local
7443 + int spi; /* SPI chip-select number */
7445 + unsigned int page_size; /* number of bytes per page */
7446 + unsigned short page_offset; /* page offset in flash address */
7450 +/* Detected DataFlash devices */
7451 +static struct mtd_info* mtd_devices[DATAFLASH_MAX_DEVICES];
7452 +static int nr_devices = 0;
7454 +/* ......................................................................... */
7456 +#ifdef CONFIG_MTD_PARTITIONS
7458 +static struct mtd_partition static_partitions_2M[] =
7461 + .name = "bootloader",
7463 + .size = 1 * 32 * 8 * 528, /* 1st sector = 32 blocks * 8 pages * 528 bytes */
7464 + .mask_flags = MTD_WRITEABLE, /* read-only */
7468 + .offset = MTDPART_OFS_NXTBLK,
7469 + .size = 6 * 32 * 8 * 528, /* 6 sectors */
7472 + .name = "filesystem",
7473 + .offset = MTDPART_OFS_NXTBLK,
7474 + .size = MTDPART_SIZ_FULL, /* rest = 9 sectors */
7478 +static struct mtd_partition static_partitions_4M[] =
7481 + .name = "bootloader",
7483 + .size = 1 * 64 * 8 * 528, /* 1st sector = 64 blocks * 8 pages * 528 bytes */
7484 + .mask_flags = MTD_WRITEABLE, /* read-only */
7488 + .offset = MTDPART_OFS_NXTBLK,
7489 + .size = 4 * 64 * 8 * 528, /* 4 sectors */
7492 + .name = "filesystem",
7493 + .offset = MTDPART_OFS_NXTBLK,
7494 + .size = MTDPART_SIZ_FULL, /* rest = 11 sectors */
7498 +#if defined(CONFIG_MACH_KAFA)
7499 +static struct mtd_partition static_partitions_8M[] =
7504 + size: 16 * 1056, /* 160 Kb */
7505 + mask_flags: MTD_WRITEABLE, /* read-only */
7509 + offset: MTDPART_OFS_APPEND, /* Sperry, NXTBLK is broken */
7510 + size: 128 * 1056, /* 1 MB */
7514 + offset: MTDPART_OFS_APPEND, /* Sperry, NXTBLK is broken */
7515 + size: 1024 * 1056, /* 1 MB */
7518 + name: "filesystem",
7519 + offset: MTDPART_OFS_APPEND, /* Sperry, NXTBLK is broken */
7520 + size: MTDPART_SIZ_FULL,
7524 +#elif defined(CONFIG_MACH_MULTMDP)
7526 +static struct mtd_partition static_partitions_8M[] =
7529 + .name = "bootloader",
7531 + .size = 12 * 1056, /* 1st sector = 32 blocks * 8 pages * 1056 bytes */
7532 + .mask_flags = MTD_WRITEABLE, /* read-only */
7535 + .name = "configuration",
7536 + .offset = MTDPART_OFS_NXTBLK,
7537 + .size = 20 * 1056,
7541 + .offset = MTDPART_OFS_NXTBLK,
7542 + .size = 1520 * 1056,
7545 + .name = "filesystem",
7546 + .offset = MTDPART_OFS_NXTBLK,
7547 + .size = MTDPART_SIZ_FULL,
7553 +static struct mtd_partition static_partitions_8M[] =
7556 + .name = "bootloader",
7558 + .size = 1 * 32 * 8 * 1056, /* 1st sector = 32 blocks * 8 pages * 1056 bytes */
7559 + .mask_flags = MTD_WRITEABLE, /* read-only */
7563 + .offset = MTDPART_OFS_NXTBLK,
7564 + .size = 5 * 32 * 8 * 1056, /* 5 sectors */
7567 + .name = "filesystem",
7568 + .offset = MTDPART_OFS_NXTBLK,
7569 + .size = MTDPART_SIZ_FULL, /* rest = 26 sectors */
7574 +static const char *part_probes[] = { "cmdlinepart", NULL, };
7578 +/* ......................................................................... */
7580 +/* Allocate a single SPI transfer descriptor. We're assuming that if multiple
7581 + SPI transfers occur at the same time, spi_access_bus() will serialize them.
7582 + If this is not valid, then either (i) each dataflash 'priv' structure
7583 + needs it's own transfer descriptor, (ii) we lock this one, or (iii) use
7584 + another mechanism. */
7585 +static struct spi_transfer_list* spi_transfer_desc;
7588 + * Perform a SPI transfer to access the DataFlash device.
7590 +static int do_spi_transfer(int nr, char* tx, int tx_len, char* rx, int rx_len,
7591 + char* txnext, int txnext_len, char* rxnext, int rxnext_len)
7593 + struct spi_transfer_list* list = spi_transfer_desc;
7595 + list->tx[0] = tx; list->txlen[0] = tx_len;
7596 + list->rx[0] = rx; list->rxlen[0] = rx_len;
7598 + list->tx[1] = txnext; list->txlen[1] = txnext_len;
7599 + list->rx[1] = rxnext; list->rxlen[1] = rxnext_len;
7601 + list->nr_transfers = nr;
7603 + return spi_transfer(list);
7606 +/* ......................................................................... */
7609 + * Poll the DataFlash device until it is READY.
7611 +static void at91_dataflash_waitready(void)
7613 + char* command = kmalloc(2, GFP_KERNEL);
7619 + command[0] = OP_READ_STATUS;
7622 + do_spi_transfer(1, command, 2, command, 2, NULL, 0, NULL, 0);
7623 + } while ((command[1] & 0x80) == 0);
7629 + * Return the status of the DataFlash device.
7631 +static unsigned short at91_dataflash_status(void)
7633 + unsigned short status;
7634 + char* command = kmalloc(2, GFP_KERNEL);
7639 + command[0] = OP_READ_STATUS;
7642 + do_spi_transfer(1, command, 2, command, 2, NULL, 0, NULL, 0);
7643 + status = command[1];
7649 +/* ......................................................................... */
7652 + * Erase blocks of flash.
7654 +static int at91_dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
7656 + struct dataflash_local *priv = (struct dataflash_local *) mtd->priv;
7657 + unsigned int pageaddr;
7660 +#ifdef DEBUG_DATAFLASH
7661 + printk("dataflash_erase: addr=%i len=%i\n", instr->addr, instr->len);
7664 + /* Sanity checks */
7665 + if (instr->addr + instr->len > mtd->size)
7667 + if ((instr->len % mtd->erasesize != 0) || (instr->len % priv->page_size != 0))
7669 + if ((instr->addr % priv->page_size) != 0)
7672 + command = kmalloc(4, GFP_KERNEL);
7676 + while (instr->len > 0) {
7677 + /* Calculate flash page address */
7678 + pageaddr = (instr->addr / priv->page_size) << priv->page_offset;
7680 + command[0] = OP_ERASE_PAGE;
7681 + command[1] = (pageaddr & 0x00FF0000) >> 16;
7682 + command[2] = (pageaddr & 0x0000FF00) >> 8;
7684 +#ifdef DEBUG_DATAFLASH
7685 + printk("ERASE: (%x) %x %x %x [%i]\n", command[0], command[1], command[2], command[3], pageaddr);
7688 + /* Send command to SPI device */
7689 + spi_access_bus(priv->spi);
7690 + do_spi_transfer(1, command, 4, command, 4, NULL, 0, NULL, 0);
7692 + at91_dataflash_waitready(); /* poll status until ready */
7693 + spi_release_bus(priv->spi);
7695 + instr->addr += priv->page_size; /* next page */
7696 + instr->len -= priv->page_size;
7701 + /* Inform MTD subsystem that erase is complete */
7702 + instr->state = MTD_ERASE_DONE;
7703 + if (instr->callback)
7704 + instr->callback(instr);
7710 + * Read from the DataFlash device.
7711 + * from : Start offset in flash device
7712 + * len : Amount to read
7713 + * retlen : About of data actually read
7714 + * buf : Buffer containing the data
7716 +static int at91_dataflash_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
7718 + struct dataflash_local *priv = (struct dataflash_local *) mtd->priv;
7719 + unsigned int addr;
7722 +#ifdef DEBUG_DATAFLASH
7723 + printk("dataflash_read: %lli .. %lli\n", from, from+len);
7728 + /* Sanity checks */
7731 + if (from + len > mtd->size)
7734 + /* Calculate flash page/byte address */
7735 + addr = (((unsigned)from / priv->page_size) << priv->page_offset) + ((unsigned)from % priv->page_size);
7737 + command = kmalloc(8, GFP_KERNEL);
7741 + command[0] = OP_READ_CONTINUOUS;
7742 + command[1] = (addr & 0x00FF0000) >> 16;
7743 + command[2] = (addr & 0x0000FF00) >> 8;
7744 + command[3] = (addr & 0x000000FF);
7745 +#ifdef DEBUG_DATAFLASH
7746 + printk("READ: (%x) %x %x %x\n", command[0], command[1], command[2], command[3]);
7749 + /* Send command to SPI device */
7750 + spi_access_bus(priv->spi);
7751 + do_spi_transfer(2, command, 8, command, 8, buf, len, buf, len);
7752 + spi_release_bus(priv->spi);
7760 + * Write to the DataFlash device.
7761 + * to : Start offset in flash device
7762 + * len : Amount to write
7763 + * retlen : Amount of data actually written
7764 + * buf : Buffer containing the data
7766 +static int at91_dataflash_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf)
7768 + struct dataflash_local *priv = (struct dataflash_local *) mtd->priv;
7769 + unsigned int pageaddr, addr, offset, writelen;
7772 + unsigned short status;
7775 + char* tmpbuf = NULL;
7777 +#ifdef DEBUG_DATAFLASH
7778 + printk("dataflash_write: %lli .. %lli\n", to, to+len);
7783 + /* Sanity checks */
7786 + if (to + len > mtd->size)
7789 + command = kmalloc(4, GFP_KERNEL);
7793 + pageaddr = ((unsigned)to / priv->page_size);
7794 + offset = ((unsigned)to % priv->page_size);
7795 + if (offset + len > priv->page_size)
7796 + writelen = priv->page_size - offset;
7799 + writebuf = (u_char *)buf;
7802 + /* Allocate temporary buffer */
7803 + tmpbuf = kmalloc(priv->page_size, GFP_KERNEL);
7809 + /* Gain access to the SPI bus */
7810 + spi_access_bus(priv->spi);
7812 + while (remaining > 0) {
7813 +#ifdef DEBUG_DATAFLASH
7814 + printk("write @ %i:%i len=%i\n", pageaddr, offset, writelen);
7817 + /* (1) Transfer to Buffer1 */
7818 + if (writelen != priv->page_size) {
7819 + addr = pageaddr << priv->page_offset;
7820 + command[0] = OP_TRANSFER_BUF1;
7821 + command[1] = (addr & 0x00FF0000) >> 16;
7822 + command[2] = (addr & 0x0000FF00) >> 8;
7824 +#ifdef DEBUG_DATAFLASH
7825 + printk("TRANSFER: (%x) %x %x %x\n", command[0], command[1], command[2], command[3]);
7827 + do_spi_transfer(1, command, 4, command, 4, NULL, 0, NULL, 0);
7828 + at91_dataflash_waitready();
7831 + /* (2) Program via Buffer1 */
7832 + addr = (pageaddr << priv->page_offset) + offset;
7833 + command[0] = OP_PROGRAM_VIA_BUF1;
7834 + command[1] = (addr & 0x00FF0000) >> 16;
7835 + command[2] = (addr & 0x0000FF00) >> 8;
7836 + command[3] = (addr & 0x000000FF);
7837 +#ifdef DEBUG_DATAFLASH
7838 + printk("PROGRAM: (%x) %x %x %x\n", command[0], command[1], command[2], command[3]);
7840 + do_spi_transfer(2, command, 4, command, 4, writebuf, writelen, tmpbuf, writelen);
7841 + at91_dataflash_waitready();
7843 + /* (3) Compare to Buffer1 */
7844 + addr = pageaddr << priv->page_offset;
7845 + command[0] = OP_COMPARE_BUF1;
7846 + command[1] = (addr & 0x00FF0000) >> 16;
7847 + command[2] = (addr & 0x0000FF00) >> 8;
7849 +#ifdef DEBUG_DATAFLASH
7850 + printk("COMPARE: (%x) %x %x %x\n", command[0], command[1], command[2], command[3]);
7852 + do_spi_transfer(1, command, 4, command, 4, NULL, 0, NULL, 0);
7853 + at91_dataflash_waitready();
7855 + /* Get result of the compare operation */
7856 + status = at91_dataflash_status();
7857 + if (status & 0x40) {
7858 + printk("at91_dataflash: Write error on page %i\n", pageaddr);
7864 + remaining = remaining - writelen;
7867 + writebuf += writelen;
7868 + *retlen += writelen;
7870 + if (remaining > priv->page_size)
7871 + writelen = priv->page_size;
7873 + writelen = remaining;
7876 + /* Release SPI bus */
7877 + spi_release_bus(priv->spi);
7884 +/* ......................................................................... */
7887 + * Initialize and register DataFlash device with MTD subsystem.
7889 +static int __init add_dataflash(int channel, char *name, int IDsize,
7890 + int nr_pages, int pagesize, int pageoffset)
7892 + struct mtd_info *device;
7893 + struct dataflash_local *priv;
7894 +#ifdef CONFIG_MTD_PARTITIONS
7895 + struct mtd_partition *mtd_parts = 0;
7896 + int mtd_parts_nr = 0;
7899 + if (nr_devices >= DATAFLASH_MAX_DEVICES) {
7900 + printk(KERN_ERR "at91_dataflash: Too many devices detected\n");
7904 + device = kmalloc(sizeof(struct mtd_info) + strlen(name) + 8, GFP_KERNEL);
7907 + memset(device, 0, sizeof(struct mtd_info));
7909 + device->name = (char *)&device[1];
7910 + sprintf(device->name, "%s.spi%d", name, channel);
7911 + device->size = nr_pages * pagesize;
7912 + device->erasesize = pagesize;
7913 + device->writesize = pagesize;
7914 + device->owner = THIS_MODULE;
7915 + device->type = MTD_DATAFLASH;
7916 + device->flags = MTD_WRITEABLE;
7917 + device->erase = at91_dataflash_erase;
7918 + device->read = at91_dataflash_read;
7919 + device->write = at91_dataflash_write;
7921 + priv = (struct dataflash_local *) kmalloc(sizeof(struct dataflash_local), GFP_KERNEL);
7926 + memset(priv, 0, sizeof(struct dataflash_local));
7928 + priv->spi = channel;
7929 + priv->page_size = pagesize;
7930 + priv->page_offset = pageoffset;
7931 + device->priv = priv;
7933 + mtd_devices[nr_devices] = device;
7935 + printk("at91_dataflash: %s detected [spi%i] (%i bytes)\n", name, channel, device->size);
7937 +#ifdef CONFIG_MTD_PARTITIONS
7938 +#ifdef CONFIG_MTD_CMDLINE_PARTS
7939 + mtd_parts_nr = parse_mtd_partitions(device, part_probes, &mtd_parts, 0);
7941 + if (mtd_parts_nr <= 0) {
7944 + mtd_parts = static_partitions_2M;
7945 + mtd_parts_nr = ARRAY_SIZE(static_partitions_2M);
7948 + mtd_parts = static_partitions_4M;
7949 + mtd_parts_nr = ARRAY_SIZE(static_partitions_4M);
7952 + mtd_parts = static_partitions_8M;
7953 + mtd_parts_nr = ARRAY_SIZE(static_partitions_8M);
7958 + if (mtd_parts_nr > 0) {
7959 +#ifdef CONFIG_DATAFLASH_ALWAYS_ADD_DEVICE
7960 + add_mtd_device(device);
7962 + return add_mtd_partitions(device, mtd_parts, mtd_parts_nr);
7965 + return add_mtd_device(device); /* add whole device */
7969 + * Detect and initialize DataFlash device connected to specified SPI channel.
7971 + * Device Density ID code Nr Pages Page Size Page offset
7972 + * AT45DB011B 1Mbit (128K) xx0011xx (0x0c) 512 264 9
7973 + * AT45DB021B 2Mbit (256K) xx0101xx (0x14) 1025 264 9
7974 + * AT45DB041B 4Mbit (512K) xx0111xx (0x1c) 2048 264 9
7975 + * AT45DB081B 8Mbit (1M) xx1001xx (0x24) 4096 264 9
7976 + * AT45DB0161B 16Mbit (2M) xx1011xx (0x2c) 4096 528 10
7977 + * AT45DB0321B 32Mbit (4M) xx1101xx (0x34) 8192 528 10
7978 + * AT45DB0642 64Mbit (8M) xx1111xx (0x3c) 8192 1056 11
7979 + * AT45DB1282 128Mbit (16M) xx0100xx (0x10) 16384 1056 11
7981 +static int __init at91_dataflash_detect(int channel)
7984 + unsigned short status;
7986 + spi_access_bus(channel);
7987 + status = at91_dataflash_status();
7988 + spi_release_bus(channel);
7989 + if (status != 0xff) { /* no dataflash device there */
7990 + switch (status & 0x3c) {
7991 + case 0x0c: /* 0 0 1 1 */
7992 + res = add_dataflash(channel, "AT45DB011B", SZ_128K, 512, 264, 9);
7994 + case 0x14: /* 0 1 0 1 */
7995 + res = add_dataflash(channel, "AT45DB021B", SZ_256K, 1025, 264, 9);
7997 + case 0x1c: /* 0 1 1 1 */
7998 + res = add_dataflash(channel, "AT45DB041B", SZ_512K, 2048, 264, 9);
8000 + case 0x24: /* 1 0 0 1 */
8001 + res = add_dataflash(channel, "AT45DB081B", SZ_1M, 4096, 264, 9);
8003 + case 0x2c: /* 1 0 1 1 */
8004 + res = add_dataflash(channel, "AT45DB161B", SZ_2M, 4096, 528, 10);
8006 + case 0x34: /* 1 1 0 1 */
8007 + res = add_dataflash(channel, "AT45DB321B", SZ_4M, 8192, 528, 10);
8009 + case 0x3c: /* 1 1 1 1 */
8010 + res = add_dataflash(channel, "AT45DB642", SZ_8M, 8192, 1056, 11);
8012 +// Currently unsupported since Atmel removed the "Main Memory Program via Buffer" commands.
8013 +// case 0x10: /* 0 1 0 0 */
8014 +// res = add_dataflash(channel, "AT45DB1282", SZ_16M, 16384, 1056, 11);
8017 + printk(KERN_ERR "at91_dataflash: Unknown device (%x)\n", status & 0x3c);
8024 +static int __init at91_dataflash_init(void)
8026 + spi_transfer_desc = kmalloc(sizeof(struct spi_transfer_list), GFP_KERNEL);
8027 + if (!spi_transfer_desc)
8030 + /* DataFlash (SPI chip select 0) */
8031 + at91_dataflash_detect(0);
8033 + if (machine_is_sweda_tms())
8034 + at91_dataflash_detect(1); /* DataFlash device (SPI chip select 1) */
8036 +#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
8037 + /* DataFlash card (SPI chip select 3) */
8038 + at91_dataflash_detect(3);
8044 +static void __exit at91_dataflash_exit(void)
8048 + for (i = 0; i < DATAFLASH_MAX_DEVICES; i++) {
8049 + if (mtd_devices[i]) {
8050 +#ifdef CONFIG_MTD_PARTITIONS
8051 + del_mtd_partitions(mtd_devices[i]);
8053 + del_mtd_device(mtd_devices[i]);
8055 + kfree(mtd_devices[i]->priv);
8056 + kfree(mtd_devices[i]);
8060 + kfree(spi_transfer_desc);
8064 +module_init(at91_dataflash_init);
8065 +module_exit(at91_dataflash_exit);
8067 +MODULE_LICENSE("GPL");
8068 +MODULE_AUTHOR("Andrew Victor");
8069 +MODULE_DESCRIPTION("DataFlash driver for Atmel AT91RM9200");
8070 diff -urN -x CVS linux-2.6.25/drivers/mtd/nand/Kconfig linux-2.6/drivers/mtd/nand/Kconfig
8071 --- linux-2.6.25/drivers/mtd/nand/Kconfig 2008-05-03 00:15:48.000000000 +0200
8072 +++ linux-2.6/drivers/mtd/nand/Kconfig 2008-04-18 17:52:53.000000000 +0200
8073 @@ -273,12 +273,53 @@
8074 If you say "m", the module will be called "cs553x_nand.ko".
8076 config MTD_NAND_AT91
8077 - bool "Support for NAND Flash / SmartMedia on AT91"
8078 + tristate "Support for NAND Flash / SmartMedia on AT91"
8079 depends on ARCH_AT91
8081 Enables support for NAND Flash / Smart Media Card interface
8082 on Atmel AT91 processors.
8085 + prompt "ECC management for NAND Flash / SmartMedia on AT91"
8086 + depends on MTD_NAND_AT91
8088 +config MTD_NAND_AT91_ECC_SOFT
8089 + bool "Software ECC"
8090 + depends on MTD_NAND_AT91
8092 + Uses software ECC.
8094 + NB : hardware and software ECC schemes are incompatible.
8095 + If you switch from one to another, you'll have to erase your
8098 +config MTD_NAND_AT91_ECC_HW
8099 + bool "Hardware ECC"
8100 + depends on MTD_NAND_AT91 && (ARCH_AT91SAM9260 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91CAP9)
8102 + Uses hardware ECC provided by the AT91 processor
8103 + instead of software ECC.
8104 + The hardware ECC controller is capable of single bit error
8105 + correction and 2-bit random detection per page.
8107 + NB : hardware and software ECC schemes are incompatible.
8108 + If you switch from one to another, you'll have to erase your
8113 +config MTD_NAND_AT91_ECC_NONE
8114 + bool "No ECC (Testing Only)"
8115 + depends on MTD_NAND_AT91
8117 + No ECC will be used.
8118 + It's not a good idea and it should be reserved for testing
8125 config MTD_NAND_CM_X270
8126 tristate "Support for NAND Flash on CM-X270 modules"
8127 depends on MTD_NAND && MACH_ARMCORE
8128 diff -urN -x CVS linux-2.6.25/drivers/mtd/nand/at91_nand.c linux-2.6/drivers/mtd/nand/at91_nand.c
8129 --- linux-2.6.25/drivers/mtd/nand/at91_nand.c 2008-05-03 00:15:48.000000000 +0200
8130 +++ linux-2.6/drivers/mtd/nand/at91_nand.c 2008-05-03 00:53:39.000000000 +0200
8132 * Derived from drivers/mtd/spia.c
8133 * Copyright (C) 2000 Steven J. Hill (sjhill@cotw.com)
8136 + * Add Hardware ECC support for AT91SAM9260 / AT91SAM9263
8137 + * Richard Genoud (richard.genoud@gmail.com), Adeneo Copyright (C) 2007
8139 + * Derived from Das U-Boot source code
8140 + * (u-boot-1.1.5/board/atmel/at91sam9263ek/nand.c)
8141 + * (C) Copyright 2006 ATMEL Rousset, Lacressonniere Nicolas
8144 * This program is free software; you can redistribute it and/or modify
8145 * it under the terms of the GNU General Public License version 2 as
8146 * published by the Free Software Foundation.
8148 #include <asm/hardware.h>
8149 #include <asm/arch/board.h>
8150 #include <asm/arch/gpio.h>
8151 +#include <asm/arch/at91_ecc.h>
8153 +#ifdef CONFIG_MTD_NAND_AT91_ECC_HW
8159 +#ifdef CONFIG_MTD_NAND_AT91_ECC_NONE
8165 +/* Register access macros */
8166 +#define ecc_readl(base, reg) __raw_readl(base + reg)
8167 +#define ecc_writel(base, reg, value) __raw_writel((value), base + reg)
8171 + * OOB layout for large page size.
8172 + * bad block info is on bytes 0 and 1
8173 + * the bytes must be consecutives to avoid several NAND_CMD_RNDOUT during read.
8175 +static struct nand_ecclayout at91_oobinfo_large = {
8177 + .eccpos = {60, 61, 62, 63},
8178 + .oobfree = { {2, 58} },
8182 + * OOB layout for small page size
8183 + * bad block info is on bytes 4 and 5
8184 + * the bytes must be consecutives to avoid several NAND_CMD_RNDOUT during read.
8186 +static struct nand_ecclayout at91_oobinfo_small = {
8188 + .eccpos = {0, 1, 2, 3},
8189 + .oobfree = { {6, 10} },
8192 struct at91_nand_host {
8193 struct nand_chip nand_chip;
8194 struct mtd_info mtd;
8195 void __iomem *io_base;
8196 struct at91_nand_data *board;
8197 + struct device *dev;
8198 + void __iomem *ecc;
8202 + * Enable NAND chip-select.
8204 +static void at91_nand_enable(struct at91_nand_host *host)
8206 + if (host->board->enable_pin)
8207 + at91_set_gpio_value(host->board->enable_pin, 0);
8211 + * Disable NAND chip-select.
8213 +static void at91_nand_disable(struct at91_nand_host *host)
8215 + if (host->board->enable_pin)
8216 + at91_set_gpio_value(host->board->enable_pin, 1);
8220 * Hardware specific access to control-lines
8222 static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
8224 struct nand_chip *nand_chip = mtd->priv;
8225 struct at91_nand_host *host = nand_chip->priv;
8227 + if (ctrl & NAND_CTRL_CHANGE) {
8228 + if (ctrl & NAND_NCE)
8229 + at91_nand_enable(host);
8231 + at91_nand_disable(host);
8234 if (cmd == NAND_CMD_NONE)
8237 @@ -65,27 +141,249 @@
8242 + * write oob for small pages
8244 -static void at91_nand_enable(struct at91_nand_host *host)
8245 +static int at91_nand_write_oob_512(struct mtd_info *mtd,
8246 + struct nand_chip *chip, int page)
8248 - if (host->board->enable_pin)
8249 - at91_set_gpio_value(host->board->enable_pin, 0);
8250 + int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad;
8251 + int eccsize = chip->ecc.size, length = mtd->oobsize;
8252 + int len, pos, status = 0;
8253 + const uint8_t *bufpoi = chip->oob_poi;
8255 + pos = eccsize + chunk;
8257 + chip->cmdfunc(mtd, NAND_CMD_SEQIN, pos, page);
8258 + len = min_t(int, length, chunk);
8259 + chip->write_buf(mtd, bufpoi, len);
8263 + chip->write_buf(mtd, bufpoi, length);
8265 + chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
8266 + status = chip->waitfunc(mtd, chip);
8268 + return status & NAND_STATUS_FAIL ? -EIO : 0;
8274 + * read oob for small pages
8276 -static void at91_nand_disable(struct at91_nand_host *host)
8277 +static int at91_nand_read_oob_512(struct mtd_info *mtd,
8278 + struct nand_chip *chip, int page, int sndcmd)
8280 - if (host->board->enable_pin)
8281 - at91_set_gpio_value(host->board->enable_pin, 1);
8283 + chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
8286 + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
8291 + * Calculate HW ECC
8293 + * mtd: MTD block structure
8294 + * dat: raw data (unused)
8295 + * ecc_code: buffer for ECC
8297 +static int at91_nand_calculate(struct mtd_info *mtd,
8298 + const u_char *dat, unsigned char *ecc_code)
8300 + struct nand_chip *nand_chip = mtd->priv;
8301 + struct at91_nand_host *host = nand_chip->priv;
8302 + uint32_t *eccpos = nand_chip->ecc.layout->eccpos;
8303 + unsigned int ecc_value;
8305 + /* get the first 2 ECC bytes */
8306 + ecc_value = ecc_readl(host->ecc, AT91_ECC_PR) & (AT91_ECC_BITADDR | AT91_ECC_WORDADDR);
8308 + ecc_code[eccpos[0]] = ecc_value & 0xFF;
8309 + ecc_code[eccpos[1]] = (ecc_value >> 8) & 0xFF;
8311 + /* get the last 2 ECC bytes */
8312 + ecc_value = ecc_readl(host->ecc, AT91_ECC_NPR) & AT91_ECC_NPARITY;
8314 + ecc_code[eccpos[2]] = ecc_value & 0xFF;
8315 + ecc_code[eccpos[3]] = (ecc_value >> 8) & 0xFF;
8321 + * HW ECC read page function
8323 + * mtd: mtd info structure
8324 + * chip: nand chip info structure
8325 + * buf: buffer to store read data
8327 +static int at91_nand_read_page(struct mtd_info *mtd,
8328 + struct nand_chip *chip, uint8_t *buf)
8330 + int eccsize = chip->ecc.size;
8331 + int eccbytes = chip->ecc.bytes;
8332 + uint32_t *eccpos = chip->ecc.layout->eccpos;
8334 + uint8_t *oob = chip->oob_poi;
8338 + /* read the page */
8339 + chip->read_buf(mtd, p, eccsize);
8341 + /* move to ECC position if needed */
8342 + if (eccpos[0] != 0) {
8344 + * This only works on large pages because the ECC controller
8345 + * waits for NAND_CMD_RNDOUTSTART after the NAND_CMD_RNDOUT.
8346 + * Anyway, for small pages, the eccpos[0] == 0
8348 + chip->cmdfunc(mtd, NAND_CMD_RNDOUT,
8349 + mtd->writesize + eccpos[0], -1);
8352 + /* the ECC controller needs to read the ECC just after the data */
8353 + ecc_pos = oob + eccpos[0];
8354 + chip->read_buf(mtd, ecc_pos, eccbytes);
8356 + /* check if there's an error */
8357 + stat = chip->ecc.correct(mtd, p, oob, NULL);
8360 + mtd->ecc_stats.failed++;
8362 + mtd->ecc_stats.corrected += stat;
8364 + /* get back to oob start (end of page) */
8365 + chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
8367 + /* read the oob */
8368 + chip->read_buf(mtd, oob, mtd->oobsize);
8374 + * HW ECC Correction
8376 + * mtd: MTD block structure
8377 + * dat: raw data read from the chip
8378 + * read_ecc: ECC from the chip (unused)
8381 + * Detect and correct a 1 bit error for a page
8383 +static int at91_nand_correct(struct mtd_info *mtd, u_char *dat,
8384 + u_char *read_ecc, u_char *isnull)
8386 + struct nand_chip *nand_chip = mtd->priv;
8387 + struct at91_nand_host *host = nand_chip->priv;
8388 + unsigned int ecc_status;
8389 + unsigned int ecc_word, ecc_bit;
8391 + /* get the status from the Status Register */
8392 + ecc_status = ecc_readl(host->ecc, AT91_ECC_SR);
8394 + /* if there's no error */
8395 + if (likely(!(ecc_status & AT91_ECC_RECERR)))
8398 + /* get error bit offset (4 bits) */
8399 + ecc_bit = ecc_readl(host->ecc, AT91_ECC_PR) & AT91_ECC_BITADDR;
8400 + /* get word address (12 bits) */
8401 + ecc_word = ecc_readl(host->ecc, AT91_ECC_PR) & AT91_ECC_WORDADDR;
8404 + /* if there are multiple errors */
8405 + if (ecc_status & AT91_ECC_MULERR) {
8406 + /* Check if it is a freshly erased block (filled with 0xff) */
8407 + if ((ecc_bit == AT91_ECC_BITADDR)
8408 + && (ecc_word == (AT91_ECC_WORDADDR >> 4))) {
8409 + /* the block has just been erased, return OK */
8413 + * It doesn't seems to be a freshly-erased block.
8414 + * We can't correct so many errors.
8416 + dev_dbg(host->dev, "at91_nand : multiple errors detected."
8417 + " Unable to correct.\n");
8421 + /* if there's a single bit error : we can correct it */
8422 + if (ecc_status & AT91_ECC_ECCERR) {
8424 + * There's nothing much to do here.
8425 + * The bit error is on the ECC itself.
8427 + dev_dbg(host->dev, "at91_nand : one bit error on ECC code."
8428 + " Nothing to correct\n");
8432 + dev_dbg(host->dev, "at91_nand : one bit error on data."
8433 + " (word offset in the page :"
8434 + " 0x%x bit offset : 0x%x)\n",
8435 + ecc_word, ecc_bit);
8436 + /* correct the error */
8437 + if (nand_chip->options & NAND_BUSWIDTH_16) {
8438 + /* 16 bits words */
8439 + ((unsigned short *) dat)[ecc_word] ^= (1 << ecc_bit);
8441 + /* 8 bits words */
8442 + dat[ecc_word] ^= (1 << ecc_bit);
8444 + dev_dbg(host->dev, "at91_nand : error corrected\n");
8449 + * Enable HW ECC : unsused
8451 +static void at91_nand_hwctl(struct mtd_info *mtd, int mode) { ; }
8454 + * Over-ride the standard functions with our optimized versions.
8455 + * We can use read/write blocks to move data to/from the controller.
8457 +static void at91_read_buf8(struct mtd_info *mtd, u8 *buf, int len)
8459 + struct nand_chip *nand_chip = mtd->priv;
8461 + __raw_readsb(nand_chip->IO_ADDR_R, buf, len);
8464 +static void at91_read_buf16(struct mtd_info *mtd, u8 *buf, int len)
8466 + struct nand_chip *nand_chip = mtd->priv;
8468 + __raw_readsw(nand_chip->IO_ADDR_R, buf, len / 2);
8471 +static void at91_write_buf8(struct mtd_info *mtd, const u8 *buf, int len)
8473 + struct nand_chip *nand_chip = mtd->priv;
8475 + __raw_writesb(nand_chip->IO_ADDR_W, buf, len);
8478 +static void at91_write_buf16(struct mtd_info *mtd, const u8 *buf, int len)
8480 + struct nand_chip *nand_chip = mtd->priv;
8482 + __raw_writesw(nand_chip->IO_ADDR_W, buf, len / 2);
8486 #ifdef CONFIG_MTD_PARTITIONS
8487 -const char *part_probes[] = { "cmdlinepart", NULL };
8488 +static const char *part_probes[] = { "cmdlinepart", NULL };
8491 +static char* ecc_modes[] __initdata = { "No", "Software", "Hardware" };
8494 * Probe for the NAND device.
8497 struct at91_nand_host *host;
8498 struct mtd_info *mtd;
8499 struct nand_chip *nand_chip;
8500 + struct resource *regs;
8501 + struct resource *mem;
8504 #ifdef CONFIG_MTD_PARTITIONS
8505 @@ -108,8 +408,13 @@
8509 - host->io_base = ioremap(pdev->resource[0].start,
8510 - pdev->resource[0].end - pdev->resource[0].start + 1);
8511 + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
8513 + printk(KERN_ERR "at91_nand: can't get I/O resource mem\n");
8517 + host->io_base = ioremap(mem->start, mem->end - mem->start + 1);
8518 if (host->io_base == NULL) {
8519 printk(KERN_ERR "at91_nand: ioremap failed\n");
8523 nand_chip = &host->nand_chip;
8524 host->board = pdev->dev.platform_data;
8525 + host->dev = &pdev->dev;
8527 nand_chip->priv = host; /* link the private data structures */
8528 mtd->priv = nand_chip;
8529 @@ -132,11 +438,40 @@
8530 if (host->board->rdy_pin)
8531 nand_chip->dev_ready = at91_nand_device_ready;
8533 + regs = platform_get_resource(pdev, IORESOURCE_MEM, 1);
8534 + if (!regs && hard_ecc) {
8535 + printk(KERN_ERR "at91_nand: can't get I/O resource "
8536 + "regs\nFalling back on software ECC\n");
8539 nand_chip->ecc.mode = NAND_ECC_SOFT; /* enable ECC */
8541 + nand_chip->ecc.mode = NAND_ECC_NONE;
8542 + if (hard_ecc && regs) {
8543 + host->ecc = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS);
8544 + host->ecc += regs->start;
8546 + nand_chip->ecc.mode = NAND_ECC_HW_SYNDROME; /* HW SYNDROME ECC */
8547 + nand_chip->ecc.calculate = at91_nand_calculate; /* function called after a write */
8548 + nand_chip->ecc.correct = at91_nand_correct; /* function called after a read */
8549 + nand_chip->ecc.hwctl = at91_nand_hwctl; /* unused */
8550 + nand_chip->ecc.read_page = at91_nand_read_page; /* read page function */
8551 + nand_chip->ecc.bytes = 4; /* 4 ECC bytes for any page size */
8552 + nand_chip->ecc.prepad = 0;
8553 + nand_chip->ecc.postpad = 0;
8556 nand_chip->chip_delay = 20; /* 20us command delay time */
8558 - if (host->board->bus_width_16) /* 16-bit bus width */
8559 + if (host->board->bus_width_16) { /* 16-bit bus width */
8560 nand_chip->options |= NAND_BUSWIDTH_16;
8561 + nand_chip->read_buf = at91_read_buf16;
8562 + nand_chip->write_buf = at91_write_buf16;
8565 + nand_chip->read_buf = at91_read_buf8;
8566 + nand_chip->write_buf = at91_write_buf8;
8569 platform_set_drvdata(pdev, host);
8570 at91_nand_enable(host);
8571 @@ -149,8 +484,60 @@
8575 - /* Scan to find existance of the device */
8576 - if (nand_scan(mtd, 1)) {
8577 + /* first scan to find the device and get the page size */
8578 + if (nand_scan_ident(mtd, 1)) {
8583 + if (nand_chip->ecc.mode == NAND_ECC_HW_SYNDROME) {
8584 + /* ECC is calculated for the whole page (1 step) */
8585 + nand_chip->ecc.size = mtd->writesize;
8587 + /* set ECC page size and oob layout */
8588 + switch (mtd->writesize) {
8590 + nand_chip->ecc.layout = &at91_oobinfo_small;
8591 + nand_chip->ecc.read_oob = at91_nand_read_oob_512;
8592 + nand_chip->ecc.write_oob = at91_nand_write_oob_512;
8593 + ecc_writel(host->ecc, AT91_ECC_MR, AT91_ECC_PAGESIZE_528);
8596 + nand_chip->ecc.layout = &at91_oobinfo_large;
8597 + ecc_writel(host->ecc, AT91_ECC_MR, AT91_ECC_PAGESIZE_1056);
8600 + nand_chip->ecc.layout = &at91_oobinfo_large;
8601 + ecc_writel(host->ecc, AT91_ECC_MR, AT91_ECC_PAGESIZE_2112);
8604 + nand_chip->ecc.layout = &at91_oobinfo_large;
8605 + ecc_writel(host->ecc, AT91_ECC_MR, AT91_ECC_PAGESIZE_4224);
8609 + * Page size not supported by HW ECC.
8610 + * So switch back to soft ECC
8612 + nand_chip->ecc.mode = NAND_ECC_SOFT;
8613 + nand_chip->ecc.calculate = NULL;
8614 + nand_chip->ecc.correct = NULL;
8615 + nand_chip->ecc.hwctl = NULL;
8616 + nand_chip->ecc.read_page = NULL;
8617 + nand_chip->ecc.postpad = 0;
8618 + nand_chip->ecc.prepad = 0;
8619 + nand_chip->ecc.bytes = 0;
8624 + printk(KERN_INFO "AT91 NAND: %i-bit, %s ECC\n",
8625 + (nand_chip->options & NAND_BUSWIDTH_16) ? 16 : 8,
8626 + ecc_modes[nand_chip->ecc.mode]
8629 + /* second phase scan */
8630 + if (nand_scan_tail(mtd)) {
8634 @@ -179,8 +566,11 @@
8638 +#ifdef CONFIG_MTD_PARTITIONS
8644 at91_nand_disable(host);
8645 platform_set_drvdata(pdev, NULL);
8648 * Remove a NAND device.
8650 -static int __devexit at91_nand_remove(struct platform_device *pdev)
8651 +static int __exit at91_nand_remove(struct platform_device *pdev)
8653 struct at91_nand_host *host = platform_get_drvdata(pdev);
8654 struct mtd_info *mtd = &host->mtd;
8658 static struct platform_driver at91_nand_driver = {
8659 - .probe = at91_nand_probe,
8660 - .remove = at91_nand_remove,
8661 + .remove = __exit_p(at91_nand_remove),
8663 .name = "at91_nand",
8664 .owner = THIS_MODULE,
8667 static int __init at91_nand_init(void)
8669 - return platform_driver_register(&at91_nand_driver);
8670 + return platform_driver_probe(&at91_nand_driver, at91_nand_probe);
8676 MODULE_LICENSE("GPL");
8677 MODULE_AUTHOR("Rick Bronson");
8678 -MODULE_DESCRIPTION("NAND/SmartMedia driver for AT91RM9200");
8679 +MODULE_DESCRIPTION("NAND/SmartMedia driver for AT91RM9200 / AT91SAM9 / AT91CAP9");
8680 diff -urN -x CVS linux-2.6.25/drivers/net/arm/Kconfig linux-2.6/drivers/net/arm/Kconfig
8681 --- linux-2.6.25/drivers/net/arm/Kconfig 2007-10-09 22:31:38.000000000 +0200
8682 +++ linux-2.6/drivers/net/arm/Kconfig 2008-03-04 21:52:40.000000000 +0200
8685 This is a driver for the ethernet hardware included in EP93xx CPUs.
8686 Say Y if you are building a kernel for EP93xx based devices.
8688 +config ARM_KS8695_ETHER
8689 + tristate "KS8695 Ethernet support"
8690 + depends on NET_ETHERNET && ARM && ARCH_KS8695
8692 + If you wish to compile a kernel for an KS8695-based board
8693 + and enable Ethernet support, then select this option.
8694 diff -urN -x CVS linux-2.6.25/drivers/net/arm/Makefile linux-2.6/drivers/net/arm/Makefile
8695 --- linux-2.6.25/drivers/net/arm/Makefile 2007-10-09 22:31:38.000000000 +0200
8696 +++ linux-2.6/drivers/net/arm/Makefile 2008-03-04 21:51:41.000000000 +0200
8698 obj-$(CONFIG_ARM_ETHER1) += ether1.o
8699 obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o
8700 obj-$(CONFIG_EP93XX_ETH) += ep93xx_eth.o
8701 +obj-$(CONFIG_ARM_KS8695_ETHER) += ks8695_ether.o
8702 diff -urN -x CVS linux-2.6.25/drivers/net/arm/at91_ether.c linux-2.6/drivers/net/arm/at91_ether.c
8703 --- linux-2.6.25/drivers/net/arm/at91_ether.c 2008-05-03 00:15:48.000000000 +0200
8704 +++ linux-2.6/drivers/net/arm/at91_ether.c 2008-05-08 21:47:22.000000000 +0200
8706 if (!(phy & (1 << 0)))
8709 - else if (lp->phy_type == MII_KS8721_ID) {
8710 + else if ((lp->phy_type == MII_KS8721_ID) || (lp->phy_type == MII_KSZ8041_ID)) {
8711 read_phy(lp->phy_address, MII_TPISTATUS, &phy); /* ack interrupt in Micrel PHY */
8712 if (!(phy & ((1 << 2) | 1)))
8715 dsintr = (1 << 15) | ( 1 << 14);
8716 write_phy(lp->phy_address, MII_BCMINTR_REG, dsintr);
8718 - else if (lp->phy_type == MII_KS8721_ID) { /* for Micrel PHY */
8719 + else if ((lp->phy_type == MII_KS8721_ID) || (lp->phy_type == MII_KSZ8041_ID)) { /* for Micrel PHY */
8720 dsintr = (1 << 10) | ( 1 << 8);
8721 write_phy(lp->phy_address, MII_TPISTATUS, dsintr);
8724 dsintr = ~(1 << 14);
8725 write_phy(lp->phy_address, MII_BCMINTR_REG, dsintr);
8727 - else if (lp->phy_type == MII_KS8721_ID) { /* for Micrel PHY */
8728 + else if ((lp->phy_type == MII_KS8721_ID) || (lp->phy_type == MII_KSZ8041_ID)) { /* for Micrel PHY */
8729 read_phy(lp->phy_address, MII_TPISTATUS, &dsintr);
8730 dsintr = ~((1 << 10) | (1 << 8));
8731 write_phy(lp->phy_address, MII_TPISTATUS, dsintr);
8734 lp->skb_length = skb->len;
8735 lp->skb_physaddr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE);
8736 - lp->stats.tx_bytes += skb->len;
8737 + dev->stats.tx_bytes += skb->len;
8739 /* Set address of the data in the Transmit Address register */
8740 at91_emac_write(AT91_EMAC_TAR, lp->skb_physaddr);
8741 @@ -843,34 +843,32 @@
8743 static struct net_device_stats *at91ether_stats(struct net_device *dev)
8745 - struct at91_private *lp = netdev_priv(dev);
8746 - int ale, lenerr, seqe, lcol, ecol;
8747 + int ale, lenerr, seqe, ecol;
8749 if (netif_running(dev)) {
8750 - lp->stats.rx_packets += at91_emac_read(AT91_EMAC_OK); /* Good frames received */
8751 + dev->stats.rx_packets += at91_emac_read(AT91_EMAC_OK); /* Good frames received */
8752 ale = at91_emac_read(AT91_EMAC_ALE);
8753 - lp->stats.rx_frame_errors += ale; /* Alignment errors */
8754 + dev->stats.rx_frame_errors += ale; /* Alignment errors */
8755 lenerr = at91_emac_read(AT91_EMAC_ELR) + at91_emac_read(AT91_EMAC_USF);
8756 - lp->stats.rx_length_errors += lenerr; /* Excessive Length or Undersize Frame error */
8757 + dev->stats.rx_length_errors += lenerr; /* Excessive Length or Undersize Frame error */
8758 seqe = at91_emac_read(AT91_EMAC_SEQE);
8759 - lp->stats.rx_crc_errors += seqe; /* CRC error */
8760 - lp->stats.rx_fifo_errors += at91_emac_read(AT91_EMAC_DRFC); /* Receive buffer not available */
8761 - lp->stats.rx_errors += (ale + lenerr + seqe
8762 + dev->stats.rx_crc_errors += seqe; /* CRC error */
8763 + dev->stats.rx_fifo_errors += at91_emac_read(AT91_EMAC_DRFC); /* Receive buffer not available */
8764 + dev->stats.rx_errors += (ale + lenerr + seqe
8765 + at91_emac_read(AT91_EMAC_CDE) + at91_emac_read(AT91_EMAC_RJB));
8767 - lp->stats.tx_packets += at91_emac_read(AT91_EMAC_FRA); /* Frames successfully transmitted */
8768 - lp->stats.tx_fifo_errors += at91_emac_read(AT91_EMAC_TUE); /* Transmit FIFO underruns */
8769 - lp->stats.tx_carrier_errors += at91_emac_read(AT91_EMAC_CSE); /* Carrier Sense errors */
8770 - lp->stats.tx_heartbeat_errors += at91_emac_read(AT91_EMAC_SQEE);/* Heartbeat error */
8771 + dev->stats.tx_packets += at91_emac_read(AT91_EMAC_FRA); /* Frames successfully transmitted */
8772 + dev->stats.tx_fifo_errors += at91_emac_read(AT91_EMAC_TUE); /* Transmit FIFO underruns */
8773 + dev->stats.tx_carrier_errors += at91_emac_read(AT91_EMAC_CSE); /* Carrier Sense errors */
8774 + dev->stats.tx_heartbeat_errors += at91_emac_read(AT91_EMAC_SQEE);/* Heartbeat error */
8776 - lcol = at91_emac_read(AT91_EMAC_LCOL);
8777 + dev->stats.tx_window_errors += at91_emac_read(AT91_EMAC_LCOL); /* Late collisions */
8778 ecol = at91_emac_read(AT91_EMAC_ECOL);
8779 - lp->stats.tx_window_errors += lcol; /* Late collisions */
8780 - lp->stats.tx_aborted_errors += ecol; /* 16 collisions */
8781 + dev->stats.tx_aborted_errors += ecol; /* 16 collisions */
8783 - lp->stats.collisions += (at91_emac_read(AT91_EMAC_SCOL) + at91_emac_read(AT91_EMAC_MCOL) + lcol + ecol);
8784 + dev->stats.collisions += (at91_emac_read(AT91_EMAC_SCOL) + at91_emac_read(AT91_EMAC_MCOL) + ecol);
8786 - return &lp->stats;
8787 + return &dev->stats;
8791 @@ -896,16 +894,16 @@
8793 skb->protocol = eth_type_trans(skb, dev);
8794 dev->last_rx = jiffies;
8795 - lp->stats.rx_bytes += pktlen;
8796 + dev->stats.rx_bytes += pktlen;
8800 - lp->stats.rx_dropped += 1;
8801 + dev->stats.rx_dropped += 1;
8802 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
8805 if (dlist->descriptors[lp->rxBuffIndex].size & EMAC_MULTICAST)
8806 - lp->stats.multicast++;
8807 + dev->stats.multicast++;
8809 dlist->descriptors[lp->rxBuffIndex].addr &= ~EMAC_DESC_DONE; /* reset ownership bit */
8810 if (lp->rxBuffIndex == MAX_RX_DESCR-1) /* wrap after last buffer */
8812 if (intstatus & AT91_EMAC_TCOM) { /* Transmit complete */
8813 /* The TCOM bit is set even if the transmission failed. */
8814 if (intstatus & (AT91_EMAC_TUND | AT91_EMAC_RTRY))
8815 - lp->stats.tx_errors += 1;
8816 + dev->stats.tx_errors += 1;
8819 dev_kfree_skb_irq(lp->skb);
8820 @@ -978,15 +976,22 @@
8821 struct net_device *dev;
8822 struct at91_private *lp;
8825 + struct resource *res;
8827 DECLARE_MAC_BUF(mac);
8829 dev = alloc_etherdev(sizeof(struct at91_private));
8833 - dev->base_addr = AT91_VA_BASE_EMAC;
8834 - dev->irq = AT91RM9200_ID_EMAC;
8835 + /* Get I/O base address and IRQ */
8836 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
8841 + dev->base_addr = res->start;
8842 + dev->irq = platform_get_irq(pdev, 0);
8844 /* Install the interrupt handler */
8845 if (request_irq(dev->irq, at91ether_interrupt, 0, dev->name, dev)) {
8846 @@ -1043,7 +1048,9 @@
8847 } else if (machine_is_csb337()) {
8848 /* mix link activity status into LED2 link state */
8849 write_phy(phy_address, MII_LEDCTRL_REG, 0x0d22);
8851 + } else if (machine_is_ecbat91())
8852 + write_phy(phy_address, MII_LEDCTRL_REG, 0x156A);
8855 spin_unlock_irq(&lp->lock);
8857 @@ -1058,12 +1065,12 @@
8858 lp->phy_address = phy_address; /* MDI address of PHY */
8860 /* Register the network interface */
8861 - res = register_netdev(dev);
8863 + ret = register_netdev(dev);
8865 free_irq(dev->irq, dev);
8867 dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys);
8872 /* Determine current link speed */
8873 @@ -1101,6 +1108,8 @@
8874 printk(KERN_INFO "%s: National Semiconductor DP83848 PHY\n", dev->name);
8875 else if (phy_type == MII_AC101L_ID)
8876 printk(KERN_INFO "%s: Altima AC101L PHY\n", dev->name);
8877 + else if (phy_type == MII_KSZ8041_ID)
8878 + printk(KERN_INFO "%s: Micrel KSZ8041 PHY\n", dev->name);
8879 else if (phy_type == MII_KS8721_ID)
8880 printk(KERN_INFO "%s: Micrel KS8721 PHY\n", dev->name);
8881 else if (phy_type == MII_T78Q21x3_ID)
8882 @@ -1146,6 +1155,7 @@
8883 case MII_DP83847_ID: /* National Semiconductor DP83847: */
8884 case MII_DP83848_ID: /* National Semiconductor DP83848: */
8885 case MII_AC101L_ID: /* Altima AC101L: PHY_ID1 = 0x22, PHY_ID2 = 0x5520 */
8886 + case MII_KSZ8041_ID: /* Micrel KSZ8041: PHY_ID1 = 0x22, PHY_ID2 = 0x1512 */
8887 case MII_KS8721_ID: /* Micrel KS8721: PHY_ID1 = 0x22, PHY_ID2 = 0x1610 */
8888 case MII_T78Q21x3_ID: /* Teridian 78Q21x3: PHY_ID1 = 0x0E, PHY_ID2 = 7237 */
8889 case MII_LAN83C185_ID: /* SMSC LAN83C185: PHY_ID1 = 0x0007, PHY_ID2 = 0xC0A1 */
8890 @@ -1246,3 +1256,4 @@
8891 MODULE_LICENSE("GPL");
8892 MODULE_DESCRIPTION("AT91RM9200 EMAC Ethernet driver");
8893 MODULE_AUTHOR("Andrew Victor");
8894 +MODULE_ALIAS("platform:" DRV_NAME);
8895 diff -urN -x CVS linux-2.6.25/drivers/net/arm/at91_ether.h linux-2.6/drivers/net/arm/at91_ether.h
8896 --- linux-2.6.25/drivers/net/arm/at91_ether.h 2007-10-09 22:31:38.000000000 +0200
8897 +++ linux-2.6/drivers/net/arm/at91_ether.h 2008-05-08 21:47:31.000000000 +0200
8899 /* Altima AC101L PHY */
8900 #define MII_AC101L_ID 0x00225520
8902 +/* Micrel KSZ8041 PHY */
8903 +#define MII_KSZ8041_ID 0x00221510
8905 /* Micrel KS8721 PHY */
8906 #define MII_KS8721_ID 0x00221610
8912 - struct net_device_stats stats;
8913 struct mii_if_info mii; /* ethtool support */
8914 struct at91_eth_data board_data; /* board-specific configuration */
8915 struct clk *ether_clk; /* clock */
8916 diff -urN -x CVS linux-2.6.25/drivers/net/arm/ks8695_ether.c linux-2.6/drivers/net/arm/ks8695_ether.c
8917 --- linux-2.6.25/drivers/net/arm/ks8695_ether.c 1970-01-01 02:00:00.000000000 +0200
8918 +++ linux-2.6/drivers/net/arm/ks8695_ether.c 2008-05-08 21:52:35.000000000 +0200
8921 + * Ethernet driver for the Kendin/Micrel KS8695.
8923 + * Copyright (C) 2006 Andrew Victor
8925 + * This program is free software; you can redistribute it and/or
8926 + * modify it under the terms of the GNU General Public License
8927 + * as published by the Free Software Foundation; either version
8928 + * 2 of the License, or (at your option) any later version.
8931 +#include <linux/module.h>
8932 +#include <linux/init.h>
8933 +#include <linux/mii.h>
8934 +#include <linux/netdevice.h>
8935 +#include <linux/etherdevice.h>
8936 +#include <linux/skbuff.h>
8937 +#include <linux/dma-mapping.h>
8938 +#include <linux/delay.h>
8939 +#include <linux/ethtool.h>
8940 +#include <linux/platform_device.h>
8942 +#include <asm/io.h>
8943 +#include <asm/mach/irq.h>
8944 +#include <asm/uaccess.h>
8945 +#include <asm/arch/regs-wan.h>
8946 +#include <asm/arch/regs-lan.h>
8947 +#include <asm/arch/regs-hpna.h>
8948 +#include <asm/arch/regs-switch.h>
8949 +#include <asm/arch/regs-misc.h>
8951 +#include <asm/arch/regs-irq.h>
8953 +#include "ks8695_ether.h"
8956 +#define DRV_NAME "ks8695_ether"
8957 +#define DRV_VERSION "0.01"
8959 +/* ..................................................................... */
8961 +static inline unsigned long ks8695_read(struct net_device *dev, unsigned int reg)
8963 + return __raw_readl(dev->base_addr + reg);
8966 +static inline void ks8695_write(struct net_device *dev, unsigned int reg, unsigned long value)
8968 + __raw_writel(value, dev->base_addr + reg);
8972 +/* ......................... ADDRESS MANAGEMENT ........................ */
8974 +#define KS8695_NR_ADDRESSES 16
8977 + * Add the specified multicast addresses to the Additional Station
8978 + * Address registers.
8980 +static void ks8695_set_mcast_address(struct net_device *dev, struct dev_mc_list *addr, int nr_addr)
8982 + unsigned long low, high;
8985 + /* Set multicast addresses in Additional Station Address registers */
8986 + for (i = 0; i < nr_addr; i++, addr = addr->next) {
8987 + if (!addr) break; /* unexpected end of list */
8988 + else if (i == KS8695_NR_ADDRESSES) break; /* too many addresses */
8990 + low = (addr->dmi_addr[2] << 24) | (addr->dmi_addr[3] << 16) | (addr->dmi_addr[4] << 8) | (addr->dmi_addr[5]);
8991 + high = (addr->dmi_addr[0] << 8) | (addr->dmi_addr[1]);
8993 + ks8695_write(dev, KS8695_WMAAL_(i), low);
8994 + ks8695_write(dev, KS8695_WMAAH_(i), WMAAH_E | high);
8997 + /* Clear the remaining Additional Station Addresses */
8998 + for (; i < KS8695_NR_ADDRESSES; i++) {
8999 + ks8695_write(dev, KS8695_WMAAL_(i), 0);
9000 + ks8695_write(dev, KS8695_WMAAH_(i), 0);
9005 + * Enable/Disable promiscuous and multicast modes.
9007 +static void ks8695eth_set_multi(struct net_device *dev)
9009 + unsigned long ctrl;
9011 + ctrl = ks8695_read(dev, KS8695_WMDRXC);
9013 + if (dev->flags & IFF_PROMISC) /* enable promiscuous mode */
9014 + ctrl |= WMDRXC_WMRA;
9015 + else if (dev->flags & ~IFF_PROMISC) /* disable promiscuous mode */
9016 + ctrl &= ~WMDRXC_WMRA;
9018 + if (dev->flags & IFF_ALLMULTI) /* enable all multicast mode */
9019 + ctrl |= WMDRXC_WMRM;
9020 + else if (dev->mc_count > KS8695_NR_ADDRESSES) /* more specific multicast addresses than can be handled in hardware */
9021 + ctrl |= WMDRXC_WMRM;
9022 + else if (dev->mc_count > 0) { /* enable specific multicasts */
9023 + ctrl &= ~WMDRXC_WMRM;
9024 + ks8695_set_mcast_address(dev, dev->mc_list, dev->mc_count);
9026 + else if (dev->flags & ~IFF_ALLMULTI) { /* disable multicast mode */
9027 + ctrl &= ~WMDRXC_WMRM;
9028 + ks8695_set_mcast_address(dev, NULL, 0);
9031 + ks8695_write(dev, KS8695_WMDRXC, ctrl);
9035 + * Program the hardware MAC address from dev->dev_addr.
9037 +static void update_mac_address(struct net_device *dev)
9039 + unsigned long low, high;
9041 + low = (dev->dev_addr[2] << 24) | (dev->dev_addr[3] << 16) | (dev->dev_addr[4] << 8) | (dev->dev_addr[5]);
9042 + high = (dev->dev_addr[0] << 8) | (dev->dev_addr[1]);
9044 + ks8695_write(dev, KS8695_WMAL, low);
9045 + ks8695_write(dev, KS8695_WMAH, high);
9049 + * Store the new hardware address in dev->dev_addr, and update the MAC.
9051 +static int ks8695eth_set_mac(struct net_device *dev, void* addr)
9053 + struct sockaddr *address = addr;
9054 + DECLARE_MAC_BUF(mac);
9056 + if (!is_valid_ether_addr(address->sa_data))
9057 + return -EADDRNOTAVAIL;
9059 + memcpy(dev->dev_addr, address->sa_data, dev->addr_len);
9060 + update_mac_address(dev);
9062 + printk("%s: Setting MAC address to %s\n", dev->name, print_mac(mac, dev->dev_addr));
9068 + * Retrieve the MAC address set by the bootloader.
9070 +static void __init get_mac_address(struct net_device *dev)
9072 + unsigned char addr[6];
9073 + unsigned long low, high;
9075 + low = ks8695_read(dev, KS8695_WMAL);
9076 + high = ks8695_read(dev, KS8695_WMAH);
9078 + addr[0] = (high & 0xff00) >> 8;
9079 + addr[1] = (high & 0xff);
9080 + addr[2] = (low & 0xff000000) >> 24;
9081 + addr[3] = (low & 0xff0000) >> 16;
9082 + addr[4] = (low & 0xff00) >> 8;
9083 + addr[5] = (low & 0xff);
9085 + if (is_valid_ether_addr(addr))
9086 + memcpy(dev->dev_addr, &addr, 6);
9090 +/* ......................... ETHTOOL SUPPORT ........................... */
9093 + * Get device-specific settings.
9095 +static int ks8695eth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9097 + unsigned long ctrl;
9099 + /* the defaults for all ports */
9100 + cmd->supported = SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full
9101 + | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full
9102 + | SUPPORTED_TP | SUPPORTED_MII;
9103 + cmd->advertising = ADVERTISED_TP | ADVERTISED_MII;
9104 + cmd->port = PORT_MII;
9105 + cmd->transceiver = XCVR_INTERNAL;
9107 + if (dev->base_addr == KS8695_HPNA_VA) {
9108 + cmd->phy_address = 0;
9109 + cmd->autoneg = AUTONEG_DISABLE; /* not supported for HPNA */
9111 + ctrl = __raw_readl(KS8695_MISC_VA + KS8695_HMC);
9112 + cmd->speed = (ctrl & HMC_HSS) ? SPEED_100 : SPEED_10;
9113 + cmd->duplex = (ctrl & HMC_HDS) ? DUPLEX_FULL : DUPLEX_HALF;
9115 + else if (dev->base_addr == KS8695_WAN_VA) {
9116 + cmd->supported |= (SUPPORTED_Autoneg | SUPPORTED_Pause);
9117 + cmd->phy_address = 0;
9119 + ctrl = __raw_readl(KS8695_MISC_VA + KS8695_WMC);
9120 + if ((ctrl & WMC_WAND) == 0) { /* auto-negotiation is enabled */
9121 + cmd->advertising |= ADVERTISED_Autoneg;
9122 + if (ctrl & WMC_WANA100F)
9123 + cmd->advertising |= ADVERTISED_100baseT_Full;
9124 + if (ctrl & WMC_WANA100H)
9125 + cmd->advertising |= ADVERTISED_100baseT_Half;
9126 + if (ctrl & WMC_WANA10F)
9127 + cmd->advertising |= ADVERTISED_10baseT_Full;
9128 + if (ctrl & WMC_WANA10H)
9129 + cmd->advertising |= ADVERTISED_10baseT_Half;
9130 + if (ctrl & WMC_WANAP)
9131 + cmd->advertising |= ADVERTISED_Pause;
9132 + cmd->autoneg = AUTONEG_ENABLE;
9134 + cmd->speed = (ctrl & WMC_WSS) ? SPEED_100 : SPEED_10;
9135 + cmd->duplex = (ctrl & WMC_WDS) ? DUPLEX_FULL : DUPLEX_HALF;
9137 + else { /* auto-negotiation is disabled */
9138 + cmd->autoneg = AUTONEG_DISABLE;
9140 + cmd->speed = (ctrl & WMC_WANF100) ? SPEED_100 : SPEED_10;
9141 + cmd->duplex = (ctrl & WMC_WANFF) ? DUPLEX_FULL : DUPLEX_HALF;
9144 + else if (dev->base_addr == KS8695_LAN_VA) {
9145 + // TODO: Implement for Switch ports
9152 + * Set device-specific settings.
9154 +static int ks8695eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9156 + unsigned long ctrl;
9158 + if ((cmd->speed != SPEED_10) && (cmd->speed != SPEED_100))
9160 + if ((cmd->duplex != DUPLEX_HALF) && (cmd->duplex != DUPLEX_FULL))
9162 + if (cmd->port != PORT_MII)
9164 + if (cmd->transceiver != XCVR_INTERNAL)
9166 + if ((cmd->autoneg != AUTONEG_DISABLE) && (cmd->autoneg != AUTONEG_ENABLE))
9169 + if (cmd->autoneg == AUTONEG_ENABLE) {
9170 + if ((cmd->advertising & (ADVERTISED_10baseT_Half |
9171 + ADVERTISED_10baseT_Full |
9172 + ADVERTISED_100baseT_Half |
9173 + ADVERTISED_100baseT_Full)) == 0)
9176 + if (dev->base_addr == KS8695_HPNA_VA)
9177 + return -EINVAL; /* HPNA does not support auto-negotiation. */
9178 + else if (dev->base_addr == KS8695_WAN_VA) {
9179 + ctrl = __raw_readl(KS8695_MISC_VA + KS8695_WMC);
9181 + ctrl &= ~(WMC_WAND | WMC_WANA100F | WMC_WANA100H | WMC_WANA10F | WMC_WANA10H);
9182 + if (cmd->advertising & ADVERTISED_100baseT_Full)
9183 + ctrl |= WMC_WANA100F;
9184 + if (cmd->advertising & ADVERTISED_100baseT_Half)
9185 + ctrl |= WMC_WANA100H;
9186 + if (cmd->advertising & ADVERTISED_10baseT_Full)
9187 + ctrl |= WMC_WANA10F;
9188 + if (cmd->advertising & ADVERTISED_10baseT_Half)
9189 + ctrl |= WMC_WANA10H;
9191 + ctrl |= WMC_WANR; /* force a re-negotiation */
9192 + __raw_writel(ctrl, KS8695_MISC_VA + KS8695_WMC);
9194 + else if (dev->base_addr == KS8695_LAN_VA) {
9195 + // TODO: Implement for Switch ports
9200 + if (dev->base_addr == KS8695_HPNA_VA) {
9201 + ctrl = __raw_readl(KS8695_MISC_VA + KS8695_HMC);
9203 + ctrl &= ~(HMC_HSS | HMC_HDS);
9204 + if (cmd->speed == SPEED_100)
9206 + if (cmd->duplex == DUPLEX_FULL)
9209 + __raw_writel(ctrl, KS8695_MISC_VA + KS8695_HMC);
9211 + else if (dev->base_addr == KS8695_WAN_VA) {
9212 + ctrl = __raw_readl(KS8695_MISC_VA + KS8695_WMC);
9214 + ctrl |= WMC_WAND; /* disable auto-negotiation */
9215 + ctrl &= ~(WMC_WANF100 | WMC_WANFF);
9216 + if (cmd->speed == SPEED_100)
9217 + ctrl |= WMC_WANF100;
9218 + if (cmd->duplex == DUPLEX_FULL)
9219 + ctrl |= WMC_WANFF;
9221 + __raw_writel(ctrl, KS8695_MISC_VA + KS8695_WMC);
9223 + else if (dev->base_addr == KS8695_LAN_VA) {
9224 + // TODO: Implement for Switch ports
9232 + * Restart the auto-negotiation.
9234 +static int ks8695eth_nwayreset(struct net_device *dev)
9236 + unsigned long ctrl;
9238 + if (dev->base_addr == KS8695_HPNA_VA) /* HPNA has no auto-negotiation */
9240 + else if (dev->base_addr == KS8695_WAN_VA) {
9241 + ctrl = __raw_readl(KS8695_MISC_VA + KS8695_WMC);
9243 + if ((ctrl & WMC_WAND) == 0)
9244 + __raw_writel(ctrl | WMC_WANR, KS8695_MISC_VA + KS8695_WMC);
9246 + return -EINVAL; /* auto-negitiation not enabled */
9248 + else if (dev->base_addr == KS8695_LAN_VA) {
9249 + // TODO: Implement for Switch ports
9255 +static void ks8695eth_get_pause(struct net_device *dev, struct ethtool_pauseparam *param)
9257 + unsigned long ctrl;
9259 + if (dev->base_addr == KS8695_HPNA_VA)
9261 + else if (dev->base_addr == KS8695_WAN_VA) {
9262 + ctrl = __raw_readl(KS8695_MISC_VA + KS8695_WMC); /* advertise Pause */
9263 + param->autoneg = (ctrl & WMC_WANAP);
9265 + ctrl = ks8695_read(dev, KS8695_WMDRXC); /* current Tx Flow-control */
9266 + param->rx_pause = (ctrl & WMDRXC_WMRFCE);
9268 + ctrl = ks8695_read(dev, KS8695_WMDRXC); /* current Rx Flow-control */
9269 + param->tx_pause = (ctrl & WMDTXC_WMTFCE);
9271 + else if (dev->base_addr == KS8695_LAN_VA) {
9272 + // TODO: Implement for Switch ports
9276 +static int ks8695eth_set_pause(struct net_device *dev, struct ethtool_pauseparam *param)
9283 +static u32 ks8695eth_get_link(struct net_device *dev)
9285 + unsigned long ctrl;
9287 + if (dev->base_addr == KS8695_HPNA_VA)
9288 + return 1; /* HPNA always has link */
9289 + else if (dev->base_addr == KS8695_WAN_VA) {
9290 + ctrl = __raw_readl(KS8695_MISC_VA + KS8695_WMC);
9291 + return (ctrl & WMC_WLS);
9293 + else if (dev->base_addr == KS8695_LAN_VA) {
9294 + // TODO: Implement for Switch ports
9301 + * Report driver information.
9303 +static void ks8695eth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
9305 + strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
9306 + strlcpy(info->version, DRV_VERSION, sizeof(info->version));
9307 + strlcpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info));
9310 +static struct ethtool_ops ks8695eth_ethtool_ops = {
9311 + .get_settings = ks8695eth_get_settings,
9312 + .set_settings = ks8695eth_set_settings,
9313 + .get_drvinfo = ks8695eth_get_drvinfo,
9314 + .nway_reset = ks8695eth_nwayreset,
9315 + .get_pauseparam = ks8695eth_get_pause,
9316 + .set_pauseparam = ks8695eth_set_pause,
9317 + .get_link = ks8695eth_get_link,
9321 +/* ................................ MAC ................................ */
9324 + * Setup the RX DMA descriptors, and enable and start the DMA receiver.
9326 +static void ks8695eth_start_rx(struct net_device *dev)
9328 + struct ks8695eth_priv *lp = (struct ks8695eth_priv *) dev->priv;
9329 + unsigned long ctrl;
9332 + /* Setup the DMA descriptors */
9333 + for (i = 0; i < MAX_RX_DESC; i++) {
9334 + lp->rxdma[i].length = MAX_RXBUF_SIZE;
9335 + lp->rxdma[i].addr = (unsigned long) lp->rxSkb[i].dma;
9336 + lp->rxdma[i].next = (unsigned long) lp->rxdma_phys + (sizeof(struct rx_descriptor) * (i+1));
9337 + lp->rxdma[i].status = RDES_OWN;
9340 + /* Create ring of DMA descriptors */
9341 + lp->rxdma[MAX_RX_DESC-1].next = (unsigned long) lp->rxdma_phys; /* phys address of 1st descriptor */
9343 + /* Reset receive index (since hardware was reset) */
9346 + /* Program address of 1st descriptor in KS8695 */
9347 + ks8695_write(dev, KS8695_WRDLB, (unsigned long) lp->rxdma_phys);
9349 + /* Enable and start the DMA Receiver */
9350 + ctrl = ks8695_read(dev, KS8695_WMDRXC);
9351 + ks8695_write(dev, KS8695_WMDRXC, ctrl | WMDRXC_WMRE);
9352 + ks8695_write(dev, KS8695_WMDRSC, 0);
9356 + * Stop the DMA receiver.
9358 +static void ks8695eth_stop_rx(struct net_device *dev)
9360 + unsigned long ctrl;
9362 + /* Disable receive DMA */
9363 + ctrl = ks8695_read(dev, KS8695_WMDRXC);
9364 + ks8695_write(dev, KS8695_WMDRXC, ctrl & ~WMDRXC_WMRE);
9368 + * Setup the TX DMA descriptors, and enable DMA transmitter.
9370 +static void ks8695eth_start_tx(struct net_device *dev)
9372 + struct ks8695eth_priv *lp = (struct ks8695eth_priv *) dev->priv;
9373 + unsigned long ctrl;
9376 + /* Setup the DMA descriptors */
9377 + for (i = 0; i < MAX_TX_DESC; i++) {
9378 + lp->txdma[i].ownership = 0;
9379 + lp->txdma[i].status = 0;
9380 + lp->txdma[i].addr = 0;
9381 + lp->txdma[i].next = (unsigned long) lp->txdma_phys + (sizeof(struct tx_descriptor) * (i+1));
9384 + /* Create ring of DMA descriptors */
9385 + lp->txdma[MAX_TX_DESC-1].next = (unsigned long) lp->txdma_phys; /* phys address of 1st desc */
9387 + /* Reset transmit indexes (since hardware was reset) */
9391 + /* Program address of 1st descriptor in KS8695 */
9392 + ks8695_write(dev, KS8695_WTDLB, (unsigned long) lp->txdma_phys);
9394 + /* Enable the DMA transmitter (will be started on first packet) */
9395 + ctrl = ks8695_read(dev, KS8695_WMDTXC);
9396 + ks8695_write(dev, KS8695_WMDTXC, ctrl | WMDTXC_WMTE);
9400 + * Stop the DMA transmitter.
9402 +static void ks8695eth_stop_tx(struct net_device *dev)
9404 + struct ks8695eth_priv *lp = (struct ks8695eth_priv *) dev->priv;
9405 + unsigned long ctrl;
9408 + /* Disable transmit DMA */
9409 + ctrl = ks8695_read(dev, KS8695_WMDTXC);
9410 + ks8695_write(dev, KS8695_WMDTXC, ctrl & ~WMDTXC_WMTE);
9412 + /* Clear any pending skb's still on transmit queue */
9413 + for (i = 0; i < MAX_TX_DESC; i++) {
9414 + lp->txdma[i].ownership = 0;
9415 + lp->txdma[i].status = 0;
9416 + lp->txdma[i].addr = 0;
9418 + if (lp->txSkb[i].skb) {
9419 + dma_unmap_single(lp->dev, lp->txSkb[i].dma, lp->txSkb[i].length, DMA_TO_DEVICE);
9420 + dev_kfree_skb_irq(lp->txSkb[i].skb);
9421 + lp->txSkb[i].skb = NULL;
9427 + * Reset the MAC hardware.
9429 +static void ks8695eth_hw_reset(struct net_device *dev)
9431 + /* Perform hardware reset */
9432 + ks8695_write(dev, KS8695_WMDTXC, WMDTXC_WMTRST);
9433 + while (ks8695_read(dev, KS8695_WMDTXC) & WMDTXC_WMTRST) { barrier(); }
9435 + /* Initialize the hardware */
9436 + ks8695_write(dev, KS8695_WMDRXC, WMDRXC_WMRU | WMDRXC_WMRB); /* RX: receive Unicast & Broadcast */
9437 + ks8695_write(dev, KS8695_WMDTXC, WMDTXC_WMTEP | WMDTXC_WMTAC); /* TX: add Padding & CRC */
9439 + // TODO: Can set Rx/Tx PBL: (Micrel using 8)
9440 + // TODO: Enable hardware checksumming.
9441 + // TODO: Enable Rx/Tx flow-control
9445 + * Enable or Disable the IRQs associated with a network interface.
9447 +static void ks8695eth_set_irq(struct net_device *dev, short enable)
9449 + struct ks8695eth_priv *lp = (struct ks8695eth_priv *) dev->priv;
9452 + for (i = 0; i < NR_IRQS; i++) {
9453 + if (lp->irqs & (1 << i)) {
9463 + * Open the ethernet interface.
9465 +static int ks8695eth_open(struct net_device *dev)
9467 + if (!is_valid_ether_addr(dev->dev_addr))
9468 + return -EADDRNOTAVAIL;
9470 + /* MUST reset hardware in _open() */
9471 + ks8695eth_hw_reset(dev);
9473 + /* Update the MAC address (incase user has changed it) */
9474 + update_mac_address(dev);
9477 + ks8695eth_start_tx(dev);
9478 + ks8695eth_start_rx(dev);
9480 + /* Enable interrupts */
9481 + ks8695eth_set_irq(dev, 1);
9483 + netif_start_queue(dev);
9488 + * Close the ethernet interface.
9490 +static int ks8695eth_close(struct net_device *dev)
9493 + ks8695eth_stop_rx(dev);
9494 + ks8695eth_stop_tx(dev);
9496 + /* Disable interrupts */
9497 + ks8695eth_set_irq(dev, 0);
9499 + netif_stop_queue(dev);
9504 + * Return the current statistics.
9506 +static struct net_device_stats *ks8695eth_stats(struct net_device *dev)
9508 + return &dev->stats;
9512 + * Queue a packet for transmission in next TX DMA descriptor.
9514 +static int ks8695eth_xmit_frame(struct sk_buff *skb, struct net_device *dev)
9516 + struct ks8695eth_priv *lp = (struct ks8695eth_priv *) dev->priv;
9519 + /* Packets are added to head of array */
9522 + /* Store packet information */
9523 + lp->txSkb[i].skb = skb;
9524 + lp->txSkb[i].length = skb->len;
9525 + lp->txSkb[i].dma = dma_map_single(lp->dev, skb->data, skb->len, DMA_TO_DEVICE);
9527 + spin_lock_irq(&lp->tx_lock);
9529 + /* Set Tx descriptor information */
9530 + lp->txdma[i].addr = lp->txSkb[i].dma;
9531 + lp->txdma[i].status = TDES_IC | TDES_FS | TDES_LS | (lp->txSkb[i].length & TDES_TBS);
9532 + lp->txdma[i].ownership = TDES_OWN;
9534 + /* Start the DMA transmitter (if necessary) */
9535 + ks8695_write(dev, KS8695_WMDTSC, 0);
9537 + lp->tx_head = (lp->tx_head + 1) % MAX_TX_DESC;
9538 + if (lp->tx_head == lp->tx_tail) /* no more descriptors */
9539 + netif_stop_queue(dev);
9541 + spin_unlock_irq(&lp->tx_lock);
9543 + dev->trans_start = jiffies;
9547 +/* ..................................................................... */
9550 + * The link state of the WAN port has changed.
9551 + * (Called from interrupt context)
9553 +static void ks8695eth_wan_link(struct net_device *dev)
9555 + unsigned long ctrl;
9557 + ctrl = __raw_readl(KS8695_MISC_VA + KS8695_WMC);
9558 + if (ctrl & WMC_WLS) {
9559 + netif_carrier_on(dev);
9560 + printk(KERN_INFO "%s: Link is now %s-%s\n", dev->name,
9561 + (ctrl & WMC_WSS) ? "100" : "10",
9562 + (ctrl & WMC_WDS) ? "FullDuplex" : "HalfDuplex");
9565 + netif_carrier_off(dev);
9566 + printk(KERN_INFO "%s: Link down.\n", dev->name);
9570 +/* ..................................................................... */
9573 + * A frame has been received. Exteract from buffer descriptor and deliver to
9575 + * (Called from interrupt context)
9577 +static void ks8695eth_rx_interrupt(struct net_device *dev)
9579 + struct ks8695eth_priv *lp = (struct ks8695eth_priv *) dev->priv;
9580 + struct sk_buff *skb;
9581 + unsigned long flags;
9582 + unsigned int pktlen;
9584 + while (!(lp->rxdma[lp->rx_idx].status & RDES_OWN)) {
9585 + flags = lp->rxdma[lp->rx_idx].status;
9587 + if ((flags & (RDES_FS | RDES_LS)) != (RDES_FS | RDES_LS)) {
9588 + printk(KERN_ERR "%s: Spanning packet detected\n", dev->name);
9592 + /* handle errors */
9593 + if (flags & (RDES_ES | RDES_RE)) {
9594 + dev->stats.rx_errors++;
9596 + if (flags & RDES_TL) /* Frame too long */
9597 + dev->stats.rx_length_errors++;
9598 + else if (flags & RDES_RF) /* Runt frame */
9599 + dev->stats.rx_length_errors++;
9600 + else if (flags & RDES_CE) /* CRC error */
9601 + dev->stats.rx_crc_errors++;
9602 + else if (flags & RDES_RE) /* MII error */
9603 + dev->stats.rx_missed_errors++;
9604 + // TODO: If hardware checksumming, then check IP/TCP/UDP errors.
9609 + pktlen = flags & RDES_FLEN;
9610 + pktlen = pktlen - 4; /* remove CRC */
9612 + // OLD CALL: consistent_sync(lp->rxSkb[lp->rx_idx].skb->data, MAX_RXBUF_SIZE, DMA_FROM_DEVICE);
9613 + dma_sync_single_for_cpu(lp->dev, lp->rxSkb[lp->rx_idx].dma, MAX_RXBUF_SIZE, DMA_FROM_DEVICE);
9615 + skb = dev_alloc_skb(pktlen+2); /* +2 to align IP header */
9617 + dev->stats.rx_dropped++;
9618 + printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name);
9622 + skb_reserve(skb, 2); /* align IP header */
9623 + memcpy(skb_put(skb, pktlen), lp->rxSkb[lp->rx_idx].skb->data, pktlen);
9625 + skb->protocol = eth_type_trans(skb, dev);
9628 + /* update statistics */
9629 + dev->stats.rx_packets++;
9630 + dev->stats.rx_bytes += pktlen;
9631 + if (flags & RDES_MF)
9632 + dev->stats.multicast++;
9633 + dev->last_rx = jiffies;
9636 + lp->rxdma[lp->rx_idx].status = RDES_OWN; /* reset ownership bit */
9638 + lp->rx_idx = (lp->rx_idx + 1) % MAX_RX_DESC; /* next descriptor */
9641 + /* restart DMA receiver incase it was suspended */
9642 + ks8695_write(dev, KS8695_WMDRSC, 0);
9646 + * A packet has been transmitted.
9647 + * (Called from interrupt context)
9649 +static void ks8695eth_tx_interrupt(struct net_device *dev)
9651 + struct ks8695eth_priv *lp = (struct ks8695eth_priv *) dev->priv;
9654 + /* Packets are removed from tail of array */
9657 + // TODO: Loop through multiple times?
9659 + if (lp->txSkb[i].skb) {
9660 + /* update statistics */
9661 + dev->stats.tx_packets++;
9662 + dev->stats.tx_bytes += lp->txSkb[i].length;
9665 + dma_unmap_single(lp->dev, lp->txSkb[i].dma, lp->txSkb[i].length, DMA_TO_DEVICE);
9666 + dev_kfree_skb_irq(lp->txSkb[i].skb);
9667 + lp->txSkb[i].skb = NULL;
9669 + /* Not necessary to clear descriptor since we still own it */
9672 + lp->tx_tail = (lp->tx_tail + 1) % MAX_TX_DESC;
9674 + netif_wake_queue(dev);
9678 + * MAC interrupt handler
9680 +static irqreturn_t ks8695eth_interrupt(int irq, void *dev_id)
9682 + struct net_device *dev = (struct net_device *) dev_id;
9685 + case KS8695_IRQ_LAN_RX_STATUS:
9686 + case KS8695_IRQ_HPNA_RX_STATUS:
9687 + case KS8695_IRQ_WAN_RX_STATUS:
9688 + ks8695eth_rx_interrupt(dev);
9689 + return IRQ_HANDLED;
9691 + case KS8695_IRQ_LAN_TX_STATUS:
9692 + case KS8695_IRQ_HPNA_TX_STATUS:
9693 + case KS8695_IRQ_WAN_TX_STATUS:
9694 + ks8695eth_tx_interrupt(dev);
9695 + return IRQ_HANDLED;
9697 + case KS8695_IRQ_WAN_LINK:
9698 + ks8695eth_wan_link(dev);
9699 + return IRQ_HANDLED;
9707 +/* ..................................................................... */
9710 + * Initialize the WAN hardware to known defaults.
9712 +static void __init ks8695eth_init_wan(void)
9714 + unsigned long ctrl;
9716 + /* Support auto-negotiation */
9717 + ctrl = WMC_WANAP | WMC_WANA100F | WMC_WANA100H | WMC_WANA10F | WMC_WANA10H;
9719 + /* LED0 = Activity , LED1 = Link */
9720 + ctrl |= (WLED0S_ACTIVITY | WLED1S_LINK);
9722 + /* Restart Auto-negotiation */
9725 + __raw_writel(ctrl, KS8695_MISC_VA + KS8695_WMC);
9727 + __raw_writel(0, KS8695_MISC_VA + KS8695_WPPM);
9728 + __raw_writel(0, KS8695_MISC_VA + KS8695_PPS);
9732 + * Initialize the LAN Switch hardware to known defaults.
9734 +static void __init ks8695eth_init_switch(void)
9736 + unsigned long ctrl;
9738 + ctrl = 0x40819e00; /* default */
9740 + /* LED0 = Speed LED1 = Link/Activity */
9741 + ctrl &= ~(SEC0_LLED1S | SEC0_LLED0S);
9742 + ctrl |= (LLED0S_LINK | LLED1S_LINK_ACTIVITY);
9744 + /* Enable Switch */
9745 + ctrl |= SEC0_ENABLE;
9747 + __raw_writel(ctrl, KS8695_SWITCH_VA + KS8695_SEC0);
9749 + __raw_writel(0x9400100, KS8695_SWITCH_VA + KS8695_SEC1); /* reset defaults */
9752 +static int ks8695eth_hook_irqs(struct platform_device *pdev, struct net_device *dev, unsigned long *irqset)
9754 + struct resource *res;
9757 + while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, i))) {
9758 + set_irq_flags(res->start, IRQF_VALID | IRQF_NOAUTOEN);
9760 + ret = request_irq(res->start, ks8695eth_interrupt, IRQF_DISABLED | IRQF_SHARED, res->name, dev);
9762 + printk(KERN_ERR "%s: return_irq %u failed\n", dev->name, res->start);
9766 + *irqset |= (1 << res->start);
9768 + // TODO: Can set different priorities for interrupts [0x BB AA FF].
9776 +static int __init ks8695eth_probe(struct platform_device *pdev)
9778 + struct net_device *dev;
9779 + struct ks8695eth_priv *lp;
9780 + struct resource *res;
9781 + int i = 0, ret, size;
9782 + DECLARE_MAC_BUF(mac);
9784 + /* Create ethernet device */
9785 + dev = alloc_etherdev(sizeof(struct ks8695eth_priv));
9789 + /* Get I/O base address */
9790 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
9795 + dev->base_addr = res->start;
9797 + lp = (struct ks8695eth_priv *) dev->priv;
9799 + /* Retreive MAC address before the MAC registers are reset */
9800 + get_mac_address(dev);
9802 + /* Reset the hardware */
9803 + ks8695_write(dev, KS8695_WMDTXC, WMDTXC_WMTRST);
9804 + while (ks8695_read(dev, KS8695_WMDTXC) & WMDTXC_WMTRST) { barrier(); }
9807 + dev->irq = platform_get_irq(pdev, 0);
9808 + ret = ks8695eth_hook_irqs(pdev, dev, &lp->irqs);
9813 + /* Allocate DMA-able memory for Tx descriptor */
9814 + size = sizeof(struct tx_descriptor) * MAX_TX_DESC;
9815 + lp->txdma = dma_alloc_coherent(&pdev->dev, size, &lp->txdma_phys, GFP_KERNEL);
9816 + if (lp->txdma == NULL) {
9821 + memset(lp->txdma, 0, size);
9825 + /* Allocate DMA-able memory for Rx descriptor */
9826 + size = sizeof(struct rx_descriptor) * MAX_RX_DESC;
9827 + lp->rxdma = dma_alloc_coherent(&pdev->dev, size, &lp->rxdma_phys, GFP_KERNEL);
9828 + if (lp->rxdma == NULL) {
9830 + // Free TX descriptor memory.
9834 + memset(lp->rxdma, 0, size);
9837 + /* Allocate DMA-able memory for Rx Data */
9838 + for (i = 0; i < MAX_RX_DESC; i++) {
9839 + lp->rxSkb[i].skb = alloc_skb(MAX_RXBUF_SIZE, GFP_KERNEL);
9840 + if (lp->rxSkb[i].skb == NULL) {
9844 + lp->rxSkb[i].length = MAX_RXBUF_SIZE;
9845 + lp->rxSkb[i].dma = dma_map_single(&pdev->dev, lp->rxSkb[i].skb->data, MAX_RXBUF_SIZE, DMA_FROM_DEVICE);
9848 + spin_lock_init(&lp->tx_lock);
9850 + platform_set_drvdata(pdev, dev);
9853 + dev->open = ks8695eth_open;
9854 + dev->stop = ks8695eth_close;
9855 + dev->hard_start_xmit = ks8695eth_xmit_frame;
9856 + dev->get_stats = ks8695eth_stats;
9857 + dev->set_multicast_list = ks8695eth_set_multi;
9858 + dev->set_mac_address = ks8695eth_set_mac;
9859 + dev->ethtool_ops = &ks8695eth_ethtool_ops;
9861 + SET_NETDEV_DEV(dev, &pdev->dev);
9862 + lp->dev = &pdev->dev;
9864 + if (dev->base_addr == KS8695_WAN_VA)
9865 + ks8695eth_init_wan();
9866 + else if (dev->base_addr == KS8695_LAN_VA)
9867 + ks8695eth_init_switch();
9869 + /* Register the network interface */
9870 + ret = register_netdev(dev);
9874 +// dma_free_coherent(&pdev->dev, sizeof(struct ks8695_tx_dma), lp->txdma, lp->txdma_phys);
9875 +// dma_free_coherent(&pdev->dev, sizeof(struct ks8695_rx_dma), lp->rxdma, lp->rxdma_phys);
9879 + printk(KERN_INFO "%s: KS8695 ethernet (%s)\n", dev->name, print_mac(mac, dev->dev_addr));
9884 +static int __devexit ks8695eth_remove(struct platform_device *pdev)
9886 + struct net_device *dev = platform_get_drvdata(pdev);
9887 +// struct ks8695eth_priv *lp = (struct ks8695eth_priv *) dev->priv;
9889 + unregister_netdev(dev);
9892 +// dma_free_coherent(&pdev->dev, sizeof(struct ks8695_tx_dma), lp->txdma, lp->txdma_phys);
9893 +// dma_free_coherent(&pdev->dev, sizeof(struct ks8695_rx_dma), lp->rxdma, lp->rxdma_phys);
9895 + platform_set_drvdata(pdev, NULL);
9900 +static struct platform_driver ks8695ether_driver = {
9901 + .probe = ks8695eth_probe,
9902 + .remove = __devexit_p(ks8695eth_remove),
9907 + .owner = THIS_MODULE,
9912 +static int __init ks8695eth_init(void)
9914 + return platform_driver_register(&ks8695ether_driver);
9917 +static void __exit ks8695eth_exit(void)
9919 + platform_driver_unregister(&ks8695ether_driver);
9922 +module_init(ks8695eth_init);
9923 +module_exit(ks8695eth_exit);
9925 +MODULE_LICENSE("GPL");
9926 +MODULE_DESCRIPTION("KS8695 Ethernet driver");
9927 +MODULE_AUTHOR("Andrew Victor");
9928 +MODULE_ALIAS("platform:" DRV_NAME);
9929 diff -urN -x CVS linux-2.6.25/drivers/net/arm/ks8695_ether.h linux-2.6/drivers/net/arm/ks8695_ether.h
9930 --- linux-2.6.25/drivers/net/arm/ks8695_ether.h 1970-01-01 02:00:00.000000000 +0200
9931 +++ linux-2.6/drivers/net/arm/ks8695_ether.h 2008-05-08 21:51:23.000000000 +0200
9934 + * Ethernet driver for the Micrel/Kendin KS8695 (Centaur)
9936 + * (C) 2006 Andrew Victor
9940 +#ifndef KS8695_ETHERNET
9941 +#define KS8695_ETHERNET
9943 +/* .... Hardware Descriptors ................................................ */
9945 +struct rx_descriptor {
9946 + unsigned long status;
9947 + unsigned long length;
9948 + unsigned long addr;
9949 + unsigned long next;
9952 +#define RDES_OWN (1 << 31) /* Ownership */
9953 +#define RDES_FS (1 << 30) /* First Descriptor */
9954 +#define RDES_LS (1 << 29) /* Last Descriptor */
9955 +#define RDES_IPE (1 << 28) /* IP Checksum error */
9956 +#define RDES_TCPE (1 << 27) /* TCP Checksum error */
9957 +#define RDES_UDPE (1 << 26) /* UDP Checksum error */
9958 +#define RDES_ES (1 << 25) /* Error summary */
9959 +#define RDES_MF (1 << 24) /* Multicast Frame */
9960 +#define RDES_RE (1 << 19) /* MII Error reported */
9961 +#define RDES_TL (1 << 18) /* Frame too Long */
9962 +#define RDES_RF (1 << 17) /* Runt Frame */
9963 +#define RDES_CE (1 << 16) /* CRC error */
9964 +#define RDES_FT (1 << 15) /* Frame Type */
9965 +#define RDES_FLEN (0x7ff) /* Frame Length */
9967 +#define RDES_RER (1 << 25) /* Receive End of Ring */
9968 +#define RDES_RBS (0x7ff) /* Receive Buffer Size */
9971 +struct tx_descriptor {
9972 + unsigned long ownership;
9973 + unsigned long status;
9974 + unsigned long addr;
9975 + unsigned long next;
9978 +#define TDES_OWN (1 << 31) /* Ownership */
9980 +#define TDES_IC (1 << 31) /* Interrupt on Completion */
9981 +#define TDES_FS (1 << 30) /* First Segment */
9982 +#define TDES_LS (1 << 29) /* Last Segment */
9983 +#define TDES_IPCKG (1 << 28) /* IP Checksum generate */
9984 +#define TDES_TCPCKG (1 << 27) /* TCP Checksum generate */
9985 +#define TDES_UDPCKG (1 << 26) /* UDP Checksum generate */
9986 +#define TDES_TER (1 << 25) /* Transmit End of Ring */
9987 +#define TDES_TBS (0x7ff) /* Transmit Buffer Size */
9990 +/* .... ..................................................................... */
9992 +#define MAX_RX_DESC 16 /* number of receive descriptors */
9993 +#define MAX_TX_DESC 8 /* number of transmit descriptors */
9994 +#define MAX_RXBUF_SIZE 0x600 /* 1518 rounded-up */
9996 +struct ks8695_buffer
9998 + struct sk_buff *skb;
10000 + unsigned long length;
10004 +struct ks8695eth_priv
10006 + struct device *dev;
10007 + unsigned long irqs; /* IRQ bitset */
10010 + struct tx_descriptor *txdma; /* Tx DMA descriptors */
10011 + dma_addr_t txdma_phys; /* TX DMA descriptors (phys address) */
10012 + unsigned int tx_head; /* descriptor index (add) */
10013 + unsigned int tx_tail; /* descriptor index (remove) */
10014 + spinlock_t tx_lock;
10015 + struct ks8695_buffer txSkb[MAX_TX_DESC]; /* packets being transmitted */
10018 + struct rx_descriptor *rxdma; /* Rx DMA descriptors */
10019 + dma_addr_t rxdma_phys; /* Rx DMA descriptors (phys address) */
10020 + unsigned int rx_idx; /* descriptor index */
10021 + struct ks8695_buffer rxSkb[MAX_RX_DESC];
10025 diff -urN -x CVS linux-2.6.25/drivers/rtc/Kconfig linux-2.6/drivers/rtc/Kconfig
10026 --- linux-2.6.25/drivers/rtc/Kconfig 2008-05-03 00:15:49.000000000 +0200
10027 +++ linux-2.6/drivers/rtc/Kconfig 2008-04-15 21:48:11.000000000 +0200
10028 @@ -487,12 +487,12 @@
10029 this is powered by the backup power supply.
10031 config RTC_DRV_AT91SAM9
10032 - tristate "AT91SAM9x"
10033 + tristate "AT91SAM9x or AT91CAP9"
10034 depends on ARCH_AT91 && !(ARCH_AT91RM9200 || ARCH_AT91X40)
10036 - RTC driver for the Atmel AT91SAM9x internal RTT (Real Time Timer).
10037 - These timers are powered by the backup power supply (such as a
10038 - small coin cell battery), but do not need to be used as RTCs.
10039 + RTC driver for the Atmel AT91SAM9x and AT91CAP9 internal RTT (Real
10040 + Time Timer). These timers are powered by the backup power supply
10041 + (such as a small coin cell battery), but do not need to be used as RTCs.
10043 (On AT91SAM9rl chips you probably want to use the dedicated RTC
10044 module and leave the RTT available for other uses.)
10045 diff -urN -x CVS linux-2.6.25/drivers/rtc/rtc-at91rm9200.c linux-2.6/drivers/rtc/rtc-at91rm9200.c
10046 --- linux-2.6.25/drivers/rtc/rtc-at91rm9200.c 2008-05-03 00:15:49.000000000 +0200
10047 +++ linux-2.6/drivers/rtc/rtc-at91rm9200.c 2008-04-25 23:15:05.000000000 +0200
10049 #include <linux/completion.h>
10051 #include <asm/uaccess.h>
10052 -#include <asm/rtc.h>
10054 -#include <asm/mach/time.h>
10056 #include <asm/arch/at91_rtc.h>
10058 @@ -307,12 +304,6 @@
10062 - /* cpu init code should really have flagged this device as
10063 - * being wake-capable; if it didn't, do that here.
10065 - if (!device_can_wakeup(&pdev->dev))
10066 - device_init_wakeup(&pdev->dev, 1);
10068 rtc = rtc_device_register(pdev->name, &pdev->dev,
10069 &at91_rtc_ops, THIS_MODULE);
10071 diff -urN -x CVS linux-2.6.25/drivers/rtc/rtc-at91sam9.c linux-2.6/drivers/rtc/rtc-at91sam9.c
10072 --- linux-2.6.25/drivers/rtc/rtc-at91sam9.c 2008-05-03 00:15:49.000000000 +0200
10073 +++ linux-2.6/drivers/rtc/rtc-at91sam9.c 2008-05-05 22:01:39.000000000 +0200
10076 #include <asm/mach/time.h>
10077 #include <asm/arch/board.h>
10078 +#include <asm/arch/cpu.h>
10079 #include <asm/arch/at91_rtt.h>
10082 @@ -150,6 +151,9 @@
10087 + * Read alarm time and date in RTC
10089 static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
10091 struct sam9_rtc *rtc = dev_get_drvdata(dev);
10092 @@ -176,6 +180,9 @@
10097 + * Set alarm time and date in RTC
10099 static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
10101 struct sam9_rtc *rtc = dev_get_drvdata(dev);
10102 @@ -321,10 +328,6 @@
10106 - /* platform setup code should have handled this; sigh */
10107 - if (!device_can_wakeup(&pdev->dev))
10108 - device_init_wakeup(&pdev->dev, 1);
10110 platform_set_drvdata(pdev, rtc);
10111 rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS);
10112 rtc->rtt += r->start;
10113 diff -urN -x CVS linux-2.6.25/drivers/spi/Kconfig linux-2.6/drivers/spi/Kconfig
10114 --- linux-2.6.25/drivers/spi/Kconfig 2008-05-03 00:15:50.000000000 +0200
10115 +++ linux-2.6/drivers/spi/Kconfig 2008-03-09 15:14:53.000000000 +0200
10116 @@ -105,6 +105,15 @@
10117 inexpensive battery powered microcontroller evaluation board.
10118 This same cable can be used to flash new firmware.
10121 + tristate "AT91RM9200 Bitbang SPI Master"
10122 + depends on SPI_MASTER && ARCH_AT91RM9200 && !SPI_ATMEL && EXPERIMENTAL
10123 + select SPI_BITBANG
10125 + This is dumb PIO bitbanging driver for the Atmel AT91RM9200.
10126 + The SPI_ATMEL driver will be its replacement, using the native
10127 + SPI hardware and its DMA controller.
10130 tristate "Freescale iMX SPI controller"
10131 depends on SPI_MASTER && ARCH_IMX && EXPERIMENTAL
10132 diff -urN -x CVS linux-2.6.25/drivers/spi/Makefile linux-2.6/drivers/spi/Makefile
10133 --- linux-2.6.25/drivers/spi/Makefile 2008-05-03 00:15:50.000000000 +0200
10134 +++ linux-2.6/drivers/spi/Makefile 2008-03-09 17:54:27.000000000 +0200
10136 obj-$(CONFIG_SPI_TXX9) += spi_txx9.o
10137 obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o
10138 obj-$(CONFIG_SPI_SH_SCI) += spi_sh_sci.o
10139 +obj-$(CONFIG_SPI_AT91) += spi_at91_bitbang.o
10140 # ... add above this line ...
10142 # SPI protocol drivers (device/link on bus)
10143 diff -urN -x CVS linux-2.6.25/drivers/spi/spi_at91_bitbang.c linux-2.6/drivers/spi/spi_at91_bitbang.c
10144 --- linux-2.6.25/drivers/spi/spi_at91_bitbang.c 1970-01-01 02:00:00.000000000 +0200
10145 +++ linux-2.6/drivers/spi/spi_at91_bitbang.c 2008-04-18 17:38:19.000000000 +0200
10148 + * at91_spi.c - at91 SPI driver (BOOTSTRAP/BITBANG VERSION)
10150 + * Copyright (C) 2006 David Brownell
10152 + * This program is free software; you can redistribute it and/or modify
10153 + * it under the terms of the GNU General Public License as published by
10154 + * the Free Software Foundation; either version 2 of the License, or
10155 + * (at your option) any later version.
10157 + * This program is distributed in the hope that it will be useful,
10158 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10159 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10160 + * GNU General Public License for more details.
10162 + * You should have received a copy of the GNU General Public License
10163 + * along with this program; if not, write to the Free Software
10164 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
10166 +#include <linux/kernel.h>
10167 +#include <linux/init.h>
10168 +#include <linux/platform_device.h>
10170 +#include <linux/spi/spi.h>
10171 +#include <linux/spi/spi_bitbang.h>
10173 +#include <asm/arch/gpio.h>
10177 + * FIXME this bitbanging version is just to help bootstrap systems until
10178 + * there's a native SPI+IRQ+DMA controller driver ... such a driver should
10179 + * be a drop-in replacement for this one, and much faster.
10183 + * - other at91 parts (like at91sam9) have multiple controllers
10184 + * and different pin muxing; this version is at91rm9200 specfic.
10186 + * - at91sam9261 SPI0 pins are directly muxed with MMC/SD pins.
10188 + * - rm9200 spi chipselects drop wrongly, so the native driver
10189 + * will need to use gpios much like this does.
10191 + * - real hardware only allows 8..16 bits per word, while this
10192 + * bitbanger allows 1..32 (incompatible superset).
10194 + * - this disregards clock parameters. with inlined gpio calls,
10195 + * gcc 3.4.4 produces about 1.5 mbit/sec, more than 2x faster
10196 + * than using the subroutined veresion from txrx_word().
10198 + * - suspend/resume and <linux/clk.h> support is missing ...
10201 +#define spi_miso_bit AT91_PIN_PA0
10202 +#define spi_mosi_bit AT91_PIN_PA1
10203 +#define spi_sck_bit AT91_PIN_PA2
10206 + struct spi_bitbang bitbang;
10207 + struct platform_device *pdev;
10210 +/*----------------------------------------------------------------------*/
10212 +static inline void setsck(struct spi_device *spi, int is_on)
10214 + at91_set_gpio_value(spi_sck_bit, is_on);
10217 +static inline void setmosi(struct spi_device *spi, int is_on)
10219 + at91_set_gpio_value(spi_mosi_bit, is_on);
10222 +static inline int getmiso(struct spi_device *spi)
10224 + return at91_get_gpio_value(spi_miso_bit);
10227 +static void at91_spi_chipselect(struct spi_device *spi, int is_active)
10229 + unsigned long cs = (unsigned long) spi->controller_data;
10231 + /* set default clock polarity */
10233 + setsck(spi, spi->mode & SPI_CPOL);
10235 + /* only support active-low (default) */
10236 + at91_set_gpio_value(cs, !is_active);
10240 + * NOTE: this is "as fast as we can"; it should be a function of
10241 + * the device clock ...
10243 +#define spidelay(X) do{} while(0)
10245 +#define EXPAND_BITBANG_TXRX
10246 +#include <linux/spi/spi_bitbang.h>
10248 +static u32 at91_spi_txrx_word_mode0(struct spi_device *spi,
10249 + unsigned nsecs, u32 word, u8 bits)
10251 + return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, 8);
10254 +static u32 at91_spi_txrx_word_mode1(struct spi_device *spi,
10255 + unsigned nsecs, u32 word, u8 bits)
10257 + return bitbang_txrx_be_cpha1(spi, nsecs, 0, word, 8);
10260 +static u32 at91_spi_txrx_word_mode2(struct spi_device *spi,
10261 + unsigned nsecs, u32 word, u8 bits)
10263 + return bitbang_txrx_be_cpha0(spi, nsecs, 1, word, 8);
10266 +static u32 at91_spi_txrx_word_mode3(struct spi_device *spi,
10267 + unsigned nsecs, u32 word, u8 bits)
10269 + return bitbang_txrx_be_cpha1(spi, nsecs, 1, word, 8);
10272 +/*----------------------------------------------------------------------*/
10274 +static int __init at91_spi_probe(struct platform_device *pdev)
10277 + struct spi_master *master;
10278 + struct at91_spi *at91_spi;
10280 + if (pdev->id != 0) /* SPI0 bus */
10283 + master = spi_alloc_master(&pdev->dev, sizeof *at91_spi);
10287 + at91_spi = spi_master_get_devdata(master);
10288 + at91_spi->pdev = pdev;
10289 + platform_set_drvdata(pdev, at91_spi);
10291 + /* SPI and bitbang hookup */
10292 + master->bus_num = 0;
10293 + master->num_chipselect = 4;
10295 + at91_spi->bitbang.master = spi_master_get(master);
10296 + at91_spi->bitbang.chipselect = at91_spi_chipselect;
10297 + at91_spi->bitbang.txrx_word[SPI_MODE_0] = at91_spi_txrx_word_mode0;
10298 + at91_spi->bitbang.txrx_word[SPI_MODE_1] = at91_spi_txrx_word_mode1;
10299 + at91_spi->bitbang.txrx_word[SPI_MODE_2] = at91_spi_txrx_word_mode2;
10300 + at91_spi->bitbang.txrx_word[SPI_MODE_3] = at91_spi_txrx_word_mode3;
10302 + status = spi_bitbang_start(&at91_spi->bitbang);
10304 + (void) spi_master_put(at91_spi->bitbang.master);
10309 +static int __exit at91_spi_remove(struct platform_device *pdev)
10311 + struct at91_spi *at91_spi = platform_get_drvdata(pdev);
10314 + /* stop() unregisters child devices too */
10315 + status = spi_bitbang_stop(&at91_spi->bitbang);
10316 + (void) spi_master_put(at91_spi->bitbang.master);
10318 + platform_set_drvdata(pdev, NULL);
10322 +static struct platform_driver at91_spi_driver = {
10323 + .probe = at91_spi_probe,
10324 + .remove = __exit_p(at91_spi_remove),
10326 + .name = "at91_spi",
10327 + .owner = THIS_MODULE,
10331 +static int __init at91_spi_init(void)
10333 + at91_set_gpio_output(spi_sck_bit, 0);
10334 + at91_set_gpio_output(spi_mosi_bit, 0);
10335 + at91_set_gpio_input(spi_miso_bit, 1 /* pullup */);
10337 + /* register driver */
10338 + return platform_driver_register(&at91_spi_driver);
10341 +static void __exit at91_spi_exit(void)
10343 + platform_driver_unregister(&at91_spi_driver);
10346 +device_initcall(at91_spi_init);
10347 +module_exit(at91_spi_exit);
10349 +MODULE_ALIAS("at91_spi.0");
10351 +MODULE_DESCRIPTION("AT91 SPI support (BOOTSTRAP/BITBANG VERSION)");
10352 +MODULE_AUTHOR("David Brownell");
10353 +MODULE_LICENSE("GPL");
10354 +MODULE_ALIAS("platform:at91_spi");
10355 diff -urN -x CVS linux-2.6.25/drivers/usb/gadget/Kconfig linux-2.6/drivers/usb/gadget/Kconfig
10356 --- linux-2.6.25/drivers/usb/gadget/Kconfig 2008-05-03 00:15:50.000000000 +0200
10357 +++ linux-2.6/drivers/usb/gadget/Kconfig 2008-04-18 19:23:34.000000000 +0200
10358 @@ -118,10 +118,10 @@
10359 config USB_GADGET_ATMEL_USBA
10360 boolean "Atmel USBA"
10361 select USB_GADGET_DUALSPEED
10363 + depends on AVR32 || ARCH_AT91CAP9 || ARCH_AT91SAM9RL
10365 USBA is the integrated high-speed USB Device controller on
10366 - the AT32AP700x processors from Atmel.
10367 + the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel.
10369 config USB_ATMEL_USBA
10371 diff -urN -x CVS linux-2.6.25/drivers/usb/gadget/at91_udc.c linux-2.6/drivers/usb/gadget/at91_udc.c
10372 --- linux-2.6.25/drivers/usb/gadget/at91_udc.c 2008-05-03 00:15:50.000000000 +0200
10373 +++ linux-2.6/drivers/usb/gadget/at91_udc.c 2008-04-15 21:48:12.000000000 +0200
10374 @@ -1827,7 +1827,7 @@
10376 if ((!udc->suspended && udc->addr)
10378 - || at91_suspend_entering_slow_clock()) {
10379 + || clk_must_disable(udc->fclk)) {
10383 diff -urN -x CVS linux-2.6.25/drivers/usb/gadget/atmel_usba_udc.c linux-2.6/drivers/usb/gadget/atmel_usba_udc.c
10384 --- linux-2.6.25/drivers/usb/gadget/atmel_usba_udc.c 2008-05-03 00:15:50.000000000 +0200
10385 +++ linux-2.6/drivers/usb/gadget/atmel_usba_udc.c 2008-05-03 01:07:46.000000000 +0200
10387 #include <linux/platform_device.h>
10388 #include <linux/usb/ch9.h>
10389 #include <linux/usb/gadget.h>
10390 +#include <linux/usb/atmel_usba_udc.h>
10391 #include <linux/delay.h>
10393 #include <asm/gpio.h>
10397 static struct usba_udc the_udc;
10398 +static struct usba_ep *usba_ep;
10400 #ifdef CONFIG_USB_GADGET_DEBUG_FS
10401 #include <linux/debugfs.h>
10402 @@ -324,53 +326,6 @@
10406 -static void copy_to_fifo(void __iomem *fifo, const void *buf, int len)
10408 - unsigned long tmp;
10410 - DBG(DBG_FIFO, "copy to FIFO (len %d):\n", len);
10411 - for (; len > 0; len -= 4, buf += 4, fifo += 4) {
10412 - tmp = *(unsigned long *)buf;
10414 - DBG(DBG_FIFO, " -> %08lx\n", tmp);
10415 - __raw_writel(tmp, fifo);
10418 - DBG(DBG_FIFO, " -> %02lx\n", tmp >> 24);
10419 - __raw_writeb(tmp >> 24, fifo);
10428 -static void copy_from_fifo(void *buf, void __iomem *fifo, int len)
10431 - unsigned long *w;
10432 - unsigned char *b;
10434 - unsigned long tmp;
10436 - DBG(DBG_FIFO, "copy from FIFO (len %d):\n", len);
10437 - for (p.w = buf; len > 0; len -= 4, p.w++, fifo += 4) {
10439 - tmp = __raw_readl(fifo);
10441 - DBG(DBG_FIFO, " -> %08lx\n", tmp);
10444 - tmp = __raw_readb(fifo);
10446 - DBG(DBG_FIFO, " -> %02lx\n", tmp);
10453 static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req)
10455 unsigned int transaction_len;
10456 @@ -387,7 +342,7 @@
10457 ep->ep.name, req, transaction_len,
10458 req->last_transaction ? ", done" : "");
10460 - copy_to_fifo(ep->fifo, req->req.buf + req->req.actual, transaction_len);
10461 + memcpy_toio(ep->fifo, req->req.buf + req->req.actual, transaction_len);
10462 usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY);
10463 req->req.actual += transaction_len;
10465 @@ -476,7 +431,7 @@
10466 bytecount = req->req.length - req->req.actual;
10469 - copy_from_fifo(req->req.buf + req->req.actual,
10470 + memcpy_fromio(req->req.buf + req->req.actual,
10471 ep->fifo, bytecount);
10472 req->req.actual += bytecount;
10474 @@ -1029,33 +984,6 @@
10475 .set_selfpowered = usba_udc_set_selfpowered,
10478 -#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
10481 - .ops = &usba_ep_ops, \
10483 - .maxpacket = maxpkt, \
10485 - .udc = &the_udc, \
10486 - .queue = LIST_HEAD_INIT(usba_ep[idx].queue), \
10487 - .fifo_size = maxpkt, \
10488 - .nr_banks = maxbk, \
10490 - .can_dma = dma, \
10491 - .can_isoc = isoc, \
10494 -static struct usba_ep usba_ep[] = {
10495 - EP("ep0", 0, 64, 1, 0, 0),
10496 - EP("ep1in-bulk", 1, 512, 2, 1, 1),
10497 - EP("ep2out-bulk", 2, 512, 2, 1, 1),
10498 - EP("ep3in-int", 3, 64, 3, 1, 0),
10499 - EP("ep4out-int", 4, 64, 3, 1, 0),
10500 - EP("ep5in-iso", 5, 1024, 3, 1, 1),
10501 - EP("ep6out-iso", 6, 1024, 3, 1, 1),
10505 static struct usb_endpoint_descriptor usba_ep0_desc = {
10506 .bLength = USB_DT_ENDPOINT_SIZE,
10507 .bDescriptorType = USB_DT_ENDPOINT,
10508 @@ -1074,7 +1002,6 @@
10509 static struct usba_udc the_udc = {
10511 .ops = &usba_udc_ops,
10512 - .ep0 = &usba_ep[0].ep,
10513 .ep_list = LIST_HEAD_INIT(the_udc.gadget.ep_list),
10515 .name = "atmel_usba_udc",
10516 @@ -1231,7 +1158,7 @@
10518 usba_ep_writel(ep, CTL_ENB, USBA_EPT_ENABLE);
10519 usba_writel(udc, TST, USBA_TST_PKT_MODE);
10520 - copy_to_fifo(ep->fifo, test_packet_buffer,
10521 + memcpy_toio(ep->fifo, test_packet_buffer,
10522 sizeof(test_packet_buffer));
10523 usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY);
10524 dev_info(dev, "Entering Test_Packet mode...\n");
10525 @@ -1530,13 +1457,13 @@
10526 DBG(DBG_HW, "Packet length: %u\n", pkt_len);
10527 if (pkt_len != sizeof(crq)) {
10528 pr_warning("udc: Invalid packet length %u "
10529 - "(expected %lu)\n", pkt_len, sizeof(crq));
10530 + "(expected %zu)\n", pkt_len, sizeof(crq));
10531 set_protocol_stall(udc, ep);
10535 DBG(DBG_FIFO, "Copying ctrl request from 0x%p:\n", ep->fifo);
10536 - copy_from_fifo(crq.data, ep->fifo, sizeof(crq));
10537 + memcpy_fromio(crq.data, ep->fifo, sizeof(crq));
10539 /* Free up one bank in the FIFO so that we can
10540 * generate or receive a reply right away. */
10541 @@ -1908,7 +1835,7 @@
10543 regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID);
10544 fifo = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID);
10545 - if (!regs || !fifo)
10546 + if (!regs || !fifo || !pdata)
10549 irq = platform_get_irq(pdev, 0);
10550 @@ -1956,16 +1883,44 @@
10551 usba_writel(udc, CTRL, 0);
10554 + usba_ep = kmalloc(sizeof(struct usba_ep) * pdata->num_ep,
10557 + goto err_alloc_ep;
10559 + the_udc.gadget.ep0 = &usba_ep[0].ep;
10561 INIT_LIST_HEAD(&usba_ep[0].ep.ep_list);
10562 usba_ep[0].ep_regs = udc->regs + USBA_EPT_BASE(0);
10563 usba_ep[0].dma_regs = udc->regs + USBA_DMA_BASE(0);
10564 usba_ep[0].fifo = udc->fifo + USBA_FIFO_BASE(0);
10565 - for (i = 1; i < ARRAY_SIZE(usba_ep); i++) {
10566 + usba_ep[0].ep.ops = &usba_ep_ops;
10567 + usba_ep[0].ep.name = pdata->ep[0].name;
10568 + usba_ep[0].ep.maxpacket = pdata->ep[0].fifo_size;
10569 + usba_ep[0].udc = &the_udc;
10570 + INIT_LIST_HEAD(&usba_ep[0].queue);
10571 + usba_ep[0].fifo_size = pdata->ep[0].fifo_size;
10572 + usba_ep[0].nr_banks = pdata->ep[0].nr_banks;
10573 + usba_ep[0].index = pdata->ep[0].index;
10574 + usba_ep[0].can_dma = pdata->ep[0].can_dma;
10575 + usba_ep[0].can_isoc = pdata->ep[0].can_isoc;
10577 + for (i = 1; i < pdata->num_ep; i++) {
10578 struct usba_ep *ep = &usba_ep[i];
10580 ep->ep_regs = udc->regs + USBA_EPT_BASE(i);
10581 ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
10582 ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
10583 + ep->ep.ops = &usba_ep_ops;
10584 + ep->ep.name = pdata->ep[i].name;
10585 + ep->ep.maxpacket = pdata->ep[i].fifo_size;
10586 + ep->udc = &the_udc;
10587 + INIT_LIST_HEAD(&ep->queue);
10588 + ep->fifo_size = pdata->ep[i].fifo_size;
10589 + ep->nr_banks = pdata->ep[i].nr_banks;
10590 + ep->index = pdata->ep[i].index;
10591 + ep->can_dma = pdata->ep[i].can_dma;
10592 + ep->can_isoc = pdata->ep[i].can_isoc;
10594 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
10596 @@ -1984,7 +1939,7 @@
10597 goto err_device_add;
10600 - if (pdata && pdata->vbus_pin != GPIO_PIN_NONE) {
10601 + if (pdata->vbus_pin >= 0) {
10602 if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
10603 udc->vbus_pin = pdata->vbus_pin;
10605 @@ -2004,7 +1959,7 @@
10608 usba_init_debugfs(udc);
10609 - for (i = 1; i < ARRAY_SIZE(usba_ep); i++)
10610 + for (i = 1; i < pdata->num_ep; i++)
10611 usba_ep_init_debugfs(udc, &usba_ep[i]);
10614 @@ -2012,6 +1967,8 @@
10616 free_irq(irq, udc);
10620 iounmap(udc->fifo);
10622 iounmap(udc->regs);
10623 @@ -2029,10 +1986,11 @@
10625 struct usba_udc *udc;
10627 + struct usba_platform_data *pdata = pdev->dev.platform_data;
10629 udc = platform_get_drvdata(pdev);
10631 - for (i = 1; i < ARRAY_SIZE(usba_ep); i++)
10632 + for (i = 1; i < pdata->num_ep; i++)
10633 usba_ep_cleanup_debugfs(&usba_ep[i]);
10634 usba_cleanup_debugfs(udc);
10636 diff -urN -x CVS linux-2.6.25/drivers/usb/host/ohci-at91.c linux-2.6/drivers/usb/host/ohci-at91.c
10637 --- linux-2.6.25/drivers/usb/host/ohci-at91.c 2008-05-03 00:15:50.000000000 +0200
10638 +++ linux-2.6/drivers/usb/host/ohci-at91.c 2008-04-15 21:48:12.000000000 +0200
10639 @@ -330,7 +330,7 @@
10641 * REVISIT: some boards will be able to turn VBUS off...
10643 - if (at91_suspend_entering_slow_clock()) {
10644 + if (clk_must_disable(fclk)) {
10645 ohci_usb_reset (ohci);
10648 diff -urN -x CVS linux-2.6.25/drivers/video/Kconfig linux-2.6/drivers/video/Kconfig
10649 --- linux-2.6.25/drivers/video/Kconfig 2008-05-03 00:15:50.000000000 +0200
10650 +++ linux-2.6/drivers/video/Kconfig 2008-04-02 22:11:30.000000000 +0200
10651 @@ -889,6 +889,17 @@
10652 framebuffer. Product specs at
10653 <http://www.erd.epson.com/vdc/html/products.htm>.
10655 +config FB_S1D15605
10656 + tristate "Epson S1D15605 framebuffer support"
10658 + default m if MACH_KB9200
10659 + select FB_CFB_FILLRECT
10660 + select FB_CFB_COPYAREA
10661 + select FB_CFB_IMAGEBLIT
10663 + Build in support for the S1D15605 Epson Research 128x64
10664 + LCD controller as a framebuffer.
10667 tristate "Epson S1D13XXX framebuffer support"
10669 diff -urN -x CVS linux-2.6.25/drivers/video/Makefile linux-2.6/drivers/video/Makefile
10670 --- linux-2.6.25/drivers/video/Makefile 2008-05-03 00:15:50.000000000 +0200
10671 +++ linux-2.6/drivers/video/Makefile 2008-04-02 22:11:30.000000000 +0200
10673 obj-$(CONFIG_FB_SA1100) += sa1100fb.o
10674 obj-$(CONFIG_FB_HIT) += hitfb.o
10675 obj-$(CONFIG_FB_EPSON1355) += epson1355fb.o
10676 -obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o
10677 +obj-$(CONFIG_FB_S1D15605) += s1d15605fb.o
10678 +obj-$(CONFIG_FB_ATMEL) += atmel_lcdfb.o
10679 obj-$(CONFIG_FB_PVR2) += pvr2fb.o
10680 obj-$(CONFIG_FB_VOODOO1) += sstfb.o
10681 obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o
10682 diff -urN -x CVS linux-2.6.25/drivers/video/atmel_lcdfb.c linux-2.6/drivers/video/atmel_lcdfb.c
10683 --- linux-2.6.25/drivers/video/atmel_lcdfb.c 2008-05-03 00:15:50.000000000 +0200
10684 +++ linux-2.6/drivers/video/atmel_lcdfb.c 2008-04-03 00:27:47.000000000 +0200
10686 #define ATMEL_LCDC_CVAL_DEFAULT 0xc8
10687 #define ATMEL_LCDC_DMA_BURST_LEN 8
10689 -#if defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91CAP9)
10690 +#if defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91CAP9) || defined(CONFIG_ARCH_AT91SAM9RL)
10691 #define ATMEL_LCDC_FIFO_SIZE 2048
10693 #define ATMEL_LCDC_FIFO_SIZE 512
10694 @@ -903,11 +903,45 @@
10698 -static struct platform_driver atmel_lcdfb_driver = {
10699 - .remove = __exit_p(atmel_lcdfb_remove),
10702 +static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
10704 + struct fb_info *info = platform_get_drvdata(pdev);
10705 + struct atmel_lcdfb_info *sinfo = info->par;
10707 + sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
10708 + lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
10709 + if (sinfo->atmel_lcdfb_power_control)
10710 + sinfo->atmel_lcdfb_power_control(0);
10711 + atmel_lcdfb_stop_clock(sinfo);
10713 -// FIXME need suspend, resume
10717 +static int atmel_lcdfb_resume(struct platform_device *pdev)
10719 + struct fb_info *info = platform_get_drvdata(pdev);
10720 + struct atmel_lcdfb_info *sinfo = info->par;
10722 + atmel_lcdfb_start_clock(sinfo);
10723 + if (sinfo->atmel_lcdfb_power_control)
10724 + sinfo->atmel_lcdfb_power_control(1);
10725 + lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
10731 +#define atmel_lcdfb_suspend NULL
10732 +#define atmel_lcdfb_resume NULL
10736 +static struct platform_driver atmel_lcdfb_driver = {
10737 + .remove = __exit_p(atmel_lcdfb_remove),
10738 + .suspend = atmel_lcdfb_suspend,
10739 + .resume = atmel_lcdfb_resume,
10741 .name = "atmel_lcdfb",
10742 .owner = THIS_MODULE,
10743 diff -urN -x CVS linux-2.6.25/drivers/video/backlight/Kconfig linux-2.6/drivers/video/backlight/Kconfig
10744 --- linux-2.6.25/drivers/video/backlight/Kconfig 2008-05-03 00:15:50.000000000 +0200
10745 +++ linux-2.6/drivers/video/backlight/Kconfig 2008-03-09 18:51:50.000000000 +0200
10746 @@ -112,3 +112,11 @@
10748 If you have a Intel LE80578 (Carillo Ranch) say Y to enable the
10751 +config BACKLIGHT_KB920x
10752 + tristate "KwikByte KB9202 Backlight Driver"
10753 + depends on BACKLIGHT_CLASS_DEVICE && MACH_KB9200
10756 + If you have a KwikByte KB9202 board, say Y to enable the
10757 + backlight driver.
10758 diff -urN -x CVS linux-2.6.25/drivers/video/backlight/Makefile linux-2.6/drivers/video/backlight/Makefile
10759 --- linux-2.6.25/drivers/video/backlight/Makefile 2008-05-03 00:15:50.000000000 +0200
10760 +++ linux-2.6/drivers/video/backlight/Makefile 2008-03-09 15:14:55.000000000 +0200
10762 obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
10763 obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
10764 obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
10765 +obj-$(CONFIG_BACKLIGHT_KB920x) += kb920x_bl.o
10766 diff -urN -x CVS linux-2.6.25/drivers/video/backlight/kb920x_bl.c linux-2.6/drivers/video/backlight/kb920x_bl.c
10767 --- linux-2.6.25/drivers/video/backlight/kb920x_bl.c 1970-01-01 02:00:00.000000000 +0200
10768 +++ linux-2.6/drivers/video/backlight/kb920x_bl.c 2008-03-09 21:41:20.000000000 +0200
10771 + * Backlight Driver for KB9202
10773 + * Copyright (c) 2006 KwikByte
10775 + * Based on Sharp's Corgi Backlight Driver
10777 + * This file is subject to the terms and conditions of the GNU General Public
10778 + * License. See the file "COPYING" in the main directory of this archive
10779 + * for more details.
10782 +#include <linux/module.h>
10783 +#include <linux/kernel.h>
10784 +#include <linux/init.h>
10785 +#include <linux/platform_device.h>
10786 +#include <linux/spinlock.h>
10787 +#include <linux/fb.h>
10788 +#include <linux/backlight.h>
10790 +#include <asm/arch/gpio.h>
10792 +/* The backlight is on(1)/off(0) */
10793 +#define KB9202_DEFAULT_INTENSITY 1
10794 +#define KB9202_MAX_INTENSITY 1
10796 +static int kb9202bl_suspended;
10797 +static int current_intensity = 0;
10798 +static DEFINE_SPINLOCK(bl_lock);
10800 +static int kb9202bl_set_intensity(struct backlight_device *bd)
10802 + unsigned long flags;
10803 + int intensity = bd->props.brightness;
10805 + if (bd->props.power != FB_BLANK_UNBLANK)
10807 + if (bd->props.fb_blank != FB_BLANK_UNBLANK)
10809 + if (kb9202bl_suspended)
10812 + if ((!current_intensity) && (bd->props.power == FB_BLANK_UNBLANK))
10815 + spin_lock_irqsave(&bl_lock, flags);
10817 + gpio_set_value(AT91_PIN_PC23, 1);
10819 + gpio_set_value(AT91_PIN_PC23, 0);
10820 + spin_unlock_irqrestore(&bl_lock, flags);
10822 + current_intensity = intensity;
10827 +static int kb9202bl_get_intensity(struct backlight_device *bd)
10829 + return current_intensity;
10832 +static struct backlight_ops kb9202bl_ops = {
10833 + .get_brightness = kb9202bl_get_intensity,
10834 + .update_status = kb9202bl_set_intensity,
10837 +static int __init kb9202bl_probe(struct platform_device *pdev)
10839 + struct backlight_device *bd;
10841 + bd = backlight_device_register ("kb9202-bl", &pdev->dev, NULL, &kb9202bl_ops);
10843 + return PTR_ERR(bd);
10845 + platform_set_drvdata(pdev, bd);
10847 + bd->props.max_brightness = KB9202_MAX_INTENSITY;
10848 + bd->props.brightness = KB9202_DEFAULT_INTENSITY;
10849 + (void) kb9202bl_set_intensity(bd);
10854 +static int kb9202bl_remove(struct platform_device *pdev)
10856 + struct backlight_device *bd = platform_get_drvdata(pdev);
10858 + bd->props.brightness = 0;
10859 + bd->props.power = 0;
10860 + (void) kb9202bl_set_intensity(bd);
10862 + backlight_device_unregister(bd);
10868 +static int kb9202bl_suspend(struct platform_device *pdev, pm_message_t state)
10870 + struct backlight_device *bd = platform_get_drvdata(pdev);
10872 + kb9202bl_suspended = 1;
10873 + (void) kb9202bl_set_intensity(bd);
10877 +static int kb9202bl_resume(struct platform_device *pdev)
10879 + struct backlight_device *bd = platform_get_drvdata(pdev);
10881 + kb9202bl_suspended = 0;
10882 + (void) kb9202bl_set_intensity(bd);
10886 +#define kb9202bl_suspend NULL
10887 +#define kb9202bl_resume NULL
10890 +static struct platform_driver kb9202bl_driver = {
10891 + .probe = kb9202bl_probe,
10892 + .remove = kb9202bl_remove,
10893 + .suspend = kb9202bl_suspend,
10894 + .resume = kb9202bl_resume,
10896 + .name = "kb9202-bl",
10897 + .owner = THIS_MODULE,
10901 +static struct platform_device *kb9202bl_device;
10903 +static int __init kb9202bl_init(void)
10907 + ret = platform_driver_register(&kb9202bl_driver);
10909 + kb9202bl_device = platform_device_alloc("kb9202-bl", -1);
10910 + if (!kb9202bl_device)
10913 + ret = platform_device_add(kb9202bl_device);
10915 + platform_device_put(kb9202bl_device);
10916 + platform_driver_unregister(&kb9202bl_driver);
10922 +static void __exit kb9202bl_exit(void)
10924 + platform_device_unregister(kb9202bl_device);
10925 + platform_driver_unregister(&kb9202bl_driver);
10928 +module_init(kb9202bl_init);
10929 +module_exit(kb9202bl_exit);
10931 +MODULE_AUTHOR("KwikByte <kb9200_dev@kwikbyte.com>");
10932 +MODULE_DESCRIPTION("KB9202 Backlight Driver");
10933 +MODULE_LICENSE("GPL");
10934 diff -urN -x CVS linux-2.6.25/drivers/video/s1d15605fb.c linux-2.6/drivers/video/s1d15605fb.c
10935 --- linux-2.6.25/drivers/video/s1d15605fb.c 1970-01-01 02:00:00.000000000 +0200
10936 +++ linux-2.6/drivers/video/s1d15605fb.c 2008-05-03 00:36:04.000000000 +0200
10939 + * drivers/video/s1d15605.c
10941 + * Adapted from several sources including:
10942 + * 1) Driver for AT91 LCD Controller
10943 + * Copyright (C) 2006 Atmel
10945 + * 2) Copyright (C) 2005 S. Kevin Hester
10947 + * This file is subject to the terms and conditions of the GNU General Public
10948 + * License. See the file COPYING in the main directory of this archive for
10951 + * This is a basic framebuffer driver for the Optrex F-51320 128x64 mono LCD
10952 + * display. This display uses a clone of the common Epson SED 1531 display
10955 + * I've heavily borrowed code from the vfb.c driver.
10957 + * This program is free software; you can redistribute it and/or modify
10958 + * it under the terms of the GNU General Public License as published by
10959 + * the Free Software Foundation; either version 2 of the License, or
10960 + * (at your option) any later version.
10962 + * This program is distributed in the hope that it will be useful,
10963 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10964 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10965 + * GNU General Public License for more details.
10967 + * You should have received a copy of the GNU General Public License
10968 + * along with this program; if not, write to the Free Software
10969 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
10973 +#define MSG(string, args...) printk("s1d15605fb:" string, ##args)
10975 +#define MSG(string, args...)
10978 +#include <linux/kernel.h>
10979 +#include <linux/platform_device.h>
10980 +#include <linux/dma-mapping.h>
10981 +#include <linux/interrupt.h>
10982 +#include <linux/clk.h>
10983 +#include <linux/fb.h>
10984 +#include <linux/init.h>
10985 +#include <linux/delay.h>
10987 +#include <asm/uaccess.h>
10989 +#include <asm/arch/board.h>
10990 +#include <asm/arch/gpio.h>
10992 +#ifdef CONFIG_PMAC_BACKLIGHT
10993 +#include <asm/backlight.h>
10996 +#define VIDEOWIDTH 128
10997 +#define VIDEOHEIGHT 64
10998 +#define VIDEODEPTH 1 /* bits/pixel */
10999 +#define VIDEOWIDTH_BYTES ((VIDEOWIDTH * VIDEODEPTH) / 8)
11001 +/* The number of bytes that actually go to the device */
11002 +#define ACTUALVIDEOMEMSIZE (VIDEOWIDTH_BYTES * VIDEOHEIGHT)
11003 +#define VIDEOMEMSIZE PAGE_SIZE
11005 +static struct fb_var_screeninfo s1d15605_default __initdata = {
11006 + .xres = VIDEOWIDTH,
11007 + .yres = VIDEOHEIGHT,
11008 + .xres_virtual = VIDEOWIDTH,
11009 + .yres_virtual = VIDEOHEIGHT,
11010 + .bits_per_pixel = VIDEODEPTH,
11011 + .red = { 0, 1, 0 },
11012 + .green = { 0, 1, 0 },
11013 + .blue = { 0, 1, 0 },
11014 + .activate = FB_ACTIVATE_NOW,
11015 + .pixclock = 20000,
11016 + .vmode = FB_VMODE_NONINTERLACED,
11019 +static struct fb_fix_screeninfo s1d15605_fix __initdata = {
11020 + .id = "s1d15605",
11021 + .type = FB_TYPE_PACKED_PIXELS,
11022 + .visual = FB_VISUAL_MONO10,
11026 + .accel = FB_ACCEL_NONE,
11029 +struct s1d15605fb_info {
11030 + struct fb_info *info;
11032 + unsigned long reset_pin;
11033 + struct platform_device *pdev;
11037 + * LCD device interface
11039 +#define RESET_DISPLAY 0xE2
11040 +#define LCD_BIAS_1_9 0xA2
11041 +#define ADC_SELECT_REVERSE 0xA1
11042 +#define COMMON_OUTPUT_NORMAL 0xC0
11043 +#define V5_RESISTOR_RATIO 0x26
11044 +#define ELECTRONIC_VOLUME_SET 0x81
11045 +#define ELECTRONIC_VOLUME_INIT 0x20
11046 +#define POWER_CONTROL_SET 0x28
11047 +#define VOLTAGE_REGULATOR 0x02
11048 +#define VOLTAGE_FOLLOWER 0x01
11049 +#define BOOSTER_CIRCUIT 0x04
11050 +#define DISPLAY_ON 0xAF
11051 +#define START_LINE_SET 0x40
11052 +#define PAGE_ADDRESS_SET 0xB0
11053 +#define COLUMN_ADDRESS_HIGH 0x10
11054 +#define COLUMN_ADDRESS_LOW 0x00
11055 +#define RESISTOR_RATIO_START 0x20
11057 +#define NUM_OF_PAGES 8
11058 +#define NUM_OF_COLUMNS 128
11060 +#define WRITE_COMMAND(x) __raw_writeb((x), (sinfo)->mmio)
11061 +#define READ_COMMAND __raw_readb((sinfo)->mmio)
11062 +#define WRITE_DATA(x) __raw_writeb((x), (sinfo)->mmio + (0x10000))
11063 +#define READ_DATA __raw_readb((sinfo)->mmio + (0x10000))
11067 + * s1d15605fb_resize_framebuffer
11069 + * Free allocated space if different. Allocate on new of changed.
11070 + * Returns -ENOMEM if the new framebuffer can not be allocated,
11071 + * zero on success.
11073 +static int s1d15605fb_resize_framebuffer(struct s1d15605fb_info *sinfo)
11075 + struct fb_info *info = sinfo->info;
11076 + struct fb_fix_screeninfo *fix = &info->fix;
11077 + struct fb_var_screeninfo *var = &info->var;
11078 + unsigned int new_size;
11081 + new_size = ((var->xres_virtual * var->yres_virtual * var->bits_per_pixel) / 8);
11083 + MSG("%s: x (%d) y (%d) bpp (%d): new size 0x%08x\n", __FUNCTION__,
11084 + var->xres_virtual, var->yres_virtual, var->bits_per_pixel, new_size);
11086 + if (new_size == fix->smem_len)
11089 + if (fix->smem_len) {
11090 + kfree(info->screen_base);
11093 + new_vaddr = kmalloc(new_size, GFP_KERNEL);
11095 + if (!new_vaddr) {
11096 + fix->smem_len = 0;
11100 + info->screen_base = new_vaddr;
11101 + fix->smem_start = (unsigned)new_vaddr;
11102 + fix->smem_len = new_size;
11103 + fix->line_length = (var->xres_virtual * var->bits_per_pixel) / 8;
11105 + dev_info(info->device,
11106 + "%luKiB frame buffer at %08lx (mapped at %p)\n",
11107 + (unsigned long)info->fix.smem_len / 1024,
11108 + (unsigned long)info->fix.smem_start,
11109 + info->screen_base);
11116 + * The s1d15605 seems to be divided into eight 128 pixel wide pages (from top to
11117 + * bottom) each page seems to be eight pixels high, where these eight pixels are
11120 +static void s1d15605_update(struct fb_info *info)
11122 + struct s1d15605fb_info *sinfo = info->par;
11123 + int page, i, row, colmask;
11124 + u8 retVal, *rowPtr;
11126 + WRITE_COMMAND(START_LINE_SET);
11127 + for (page = 0; page < NUM_OF_PAGES; ++page) {
11128 + WRITE_COMMAND(PAGE_ADDRESS_SET + page);
11129 + WRITE_COMMAND(COLUMN_ADDRESS_HIGH);
11130 + WRITE_COMMAND(COLUMN_ADDRESS_LOW);
11132 + for (i = 0; i < NUM_OF_COLUMNS; ++i)
11134 + /* point of opportunity: optimization */
11135 + colmask = (1 << (i & 0x7));
11136 + rowPtr = (u8*)(info->screen_base);
11137 + rowPtr += (VIDEOWIDTH_BYTES * 8 * page);
11138 + rowPtr += (i >> 3);
11140 + for (row = 0; row < 8; ++row)
11142 + retVal = (retVal >> 1) | (((*rowPtr) & colmask) ? 0x80 : 0);
11143 + rowPtr += VIDEOWIDTH_BYTES;
11145 + WRITE_DATA(retVal);
11149 + WRITE_COMMAND(DISPLAY_ON);
11154 + * Setting the video mode has been split into two parts.
11155 + * First part, xxxfb_check_var, must not write anything
11156 + * to hardware, it should only verify and adjust var.
11157 + * This means it doesn't alter par but it does use hardware
11158 + * data from it to check this var.
11160 +static int s1d15605_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
11163 + * Some very basic checks
11169 + if (var->xres > var->xres_virtual)
11170 + var->xres_virtual = var->xres;
11171 + if (var->yres > var->yres_virtual)
11172 + var->yres_virtual = var->yres;
11174 + if(var->bits_per_pixel > VIDEODEPTH)
11180 + if (((var->yres_virtual * var->bits_per_pixel * var->yres_virtual) >> 3) >
11181 + ACTUALVIDEOMEMSIZE)
11185 + * Now that we checked it we alter var. The reason being is that the video
11186 + * mode passed in might not work but slight changes to it might make it
11187 + * work. This way we let the user know what is acceptable.
11189 + switch (var->bits_per_pixel) {
11191 + var->red.offset = var->green.offset = var->blue.offset = 0;
11192 + var->red.length = var->green.length = var->blue.length
11193 + = var->bits_per_pixel;
11199 + var->xoffset = var->yoffset = 0;
11200 + var->red.msb_right = var->green.msb_right = var->blue.msb_right =
11201 + var->transp.msb_right = 0;
11208 + * This routine actually sets the video mode. It's in here where we
11209 + * the hardware state info->par and fix which can be affected by the
11210 + * change in par. For this driver it doesn't do much.
11212 +static int s1d15605_set_par(struct fb_info *info)
11216 + MSG("%s:\n", __func__);
11217 + MSG(" * resolution: %ux%u (%ux%u virtual)\n",
11218 + info->var.xres, info->var.yres,
11219 + info->var.xres_virtual, info->var.yres_virtual);
11221 + ret = s1d15605fb_resize_framebuffer(info->par);
11223 + info->fix.visual = FB_VISUAL_MONO10;
11229 + * Set a single color register. The values supplied are already
11230 + * rounded down to the hardware's capabilities (according to the
11231 + * entries in the var structure). Return != 0 for invalid regno.
11233 +static int s1d15605_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
11234 + u_int transp, struct fb_info *info)
11236 + if (regno > 1) /* no. of hw registers - we only do mono now */
11244 + * Currently, the routine will simply shut-off the backlight and prevent
11245 + * updates/refreshes. Modify according to application.
11247 + * 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off
11249 +static int s1d15605_blank(int blank, struct fb_info *info)
11251 +#ifdef CONFIG_PMAC_BACKLIGHT
11253 + pmac_backlight->props.power = FB_BLANK_POWERDOWN;
11255 + pmac_backlight->props.power = FB_BLANK_UNBLANK;
11256 + backlight_update_status(pmac_backlight);
11263 + * Pan or Wrap the Display
11265 + * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
11268 +static int s1d15605_pan_display(struct fb_var_screeninfo *var,
11269 + struct fb_info *info)
11271 + if (var->vmode & FB_VMODE_YWRAP) {
11272 + if (var->yoffset < 0
11273 + || var->yoffset >= info->var.yres_virtual
11277 + if (var->xoffset + var->xres > info->var.xres_virtual ||
11278 + var->yoffset + var->yres > info->var.yres_virtual)
11281 + info->var.xoffset = var->xoffset;
11282 + info->var.yoffset = var->yoffset;
11283 + if (var->vmode & FB_VMODE_YWRAP)
11284 + info->var.vmode |= FB_VMODE_YWRAP;
11286 + info->var.vmode &= ~FB_VMODE_YWRAP;
11292 +static void s1d15605_copyarea(struct fb_info *info, const struct fb_copyarea *region)
11294 + cfb_copyarea(info, region);
11295 + s1d15605_update(info);
11299 +static void s1d15605_fillrect (struct fb_info *info, const struct fb_fillrect *rect)
11301 + cfb_fillrect(info, rect);
11302 + s1d15605_update(info);
11306 +static void s1d15605_imageblit(struct fb_info *p, const struct fb_image *image)
11308 + cfb_imageblit(p, image);
11309 + s1d15605_update(p);
11314 + * Write the users data to our framebuffer, and then trigger a psuedo DMA
11316 +static ssize_t s1d15605_write(struct fb_info *info, const char *buf,
11317 + size_t count, loff_t *ppos)
11319 + unsigned long p = *ppos;
11322 + if (p > info->fix.smem_len)
11324 + if (count >= info->fix.smem_len)
11325 + count = info->fix.smem_len;
11327 + if (count + p > info->fix.smem_len) {
11328 + count = info->fix.smem_len - p;
11334 + base_addr = info->screen_base;
11335 + count -= copy_from_user(base_addr+p, buf, count);
11340 + s1d15605_update(info);
11348 +#ifdef USE_PRIVATE_VMA_FXS
11349 +static void s1d15605_vma_open(struct vm_area_struct *vma)
11351 + // FIXME - store stats in the device data via vm_private_data
11355 +static void s1d15605_vma_close(struct vm_area_struct *vma)
11357 + // FIXME - store stats in the device data via vm_private_data
11361 +static struct page *s1d15605_vma_nopage(struct vm_area_struct *vma,
11362 + unsigned long address, int *type)
11364 + struct page *page;
11365 + struct fb_info *info = vma->vm_private_data;
11367 + page = virt_to_page(info->screen_base);
11370 + // FIXME - now someone has a link to our page, start periodically blitting
11371 + // latest updates to the actual device.
11377 +static struct vm_operations_struct s1d15605_vm_ops = {
11378 + .open = s1d15605_vma_open,
11379 + .close = s1d15605_vma_close,
11380 + .nopage = s1d15605_vma_nopage
11384 +/* We don't do much here - because we have special vm_ops */
11385 +static int s1d15605_mmap(struct fb_info *info, struct vm_area_struct *vma)
11387 + vma->vm_ops = &s1d15605_vm_ops;
11388 + vma->vm_flags |= VM_RESERVED;
11389 + vma->vm_private_data = info;
11390 + s1d15605_vma_open(vma);
11394 +#endif /* USE_PRIVATE_VMA_FXS */
11397 +static struct fb_ops s1d15605fb_ops = {
11398 + .owner = THIS_MODULE,
11399 + .fb_check_var = s1d15605_check_var,
11400 + .fb_set_par = s1d15605_set_par,
11401 + .fb_setcolreg = s1d15605_setcolreg,
11402 + .fb_blank = s1d15605_blank,
11403 +// .fb_pan_display = s1d15605_pan_display,
11404 + .fb_fillrect = s1d15605_fillrect,
11405 + .fb_copyarea = s1d15605_copyarea,
11406 + .fb_imageblit = s1d15605_imageblit,
11407 + .fb_write = s1d15605_write,
11408 +#ifdef USE_PRIVATE_VMA_FXS
11409 + .fb_mmap = s1d15605_mmap,
11414 +static void s1d15605_device_init(struct s1d15605fb_info *sinfo) {
11418 + /* release the reset line by reading the device - proto hardware */
11419 + value = READ_COMMAND;
11420 + value = READ_COMMAND;
11422 +#ifdef CONFIG_MACH_KB9200
11423 + /* new boards have dedicated reset line */
11424 + gpio_set_value(sinfo->reset_pin, 1);
11427 + /* initialize the device within 5ms */
11428 + WRITE_COMMAND(RESET_DISPLAY);
11429 + WRITE_COMMAND(LCD_BIAS_1_9);
11430 + WRITE_COMMAND(ADC_SELECT_REVERSE);
11431 + WRITE_COMMAND(COMMON_OUTPUT_NORMAL);
11432 + WRITE_COMMAND(V5_RESISTOR_RATIO);
11433 + WRITE_COMMAND(ELECTRONIC_VOLUME_SET);
11434 + WRITE_COMMAND(ELECTRONIC_VOLUME_INIT);
11435 + WRITE_COMMAND(POWER_CONTROL_SET | VOLTAGE_REGULATOR | VOLTAGE_FOLLOWER | BOOSTER_CIRCUIT);
11436 + WRITE_COMMAND(DISPLAY_ON);
11438 + WRITE_COMMAND(RESISTOR_RATIO_START + 4);
11439 + WRITE_COMMAND(ELECTRONIC_VOLUME_SET);
11440 + WRITE_COMMAND(0x33);
11444 +static int __init s1d15605fb_probe(struct platform_device *pdev)
11446 + struct device *dev = &pdev->dev;
11447 + struct fb_info *info;
11448 + struct s1d15605fb_info *sinfo;
11451 + MSG("%s\n", __func__);
11453 + if (!(info = framebuffer_alloc(sizeof(struct s1d15605fb_info), dev))) {
11454 + dev_err(dev, "Cannot allocate framebuffer struct\n");
11458 + sinfo = info->par;
11459 + sinfo->info = info;
11460 + sinfo->pdev = pdev;
11462 + if (pdev->num_resources < 2) {
11463 + dev_err(dev, "Resources unusable\n");
11468 + info->fbops = &s1d15605fb_ops;
11469 + strcpy(info->fix.id, pdev->name);
11471 + info->fix.mmio_start = pdev->resource[0].start;
11472 + info->fix.mmio_len = pdev->resource[0].end - pdev->resource[0].start + 1;
11473 + sinfo->reset_pin = pdev->resource[1].start;
11475 + ret = s1d15605fb_resize_framebuffer(sinfo);
11477 + dev_err(dev, "Cannot resize framebuffer: %d\n", ret);
11481 + if (!request_mem_region(info->fix.mmio_start,
11482 + info->fix.mmio_len, pdev->name)) {
11487 + sinfo->mmio = ioremap(info->fix.mmio_start, info->fix.mmio_len);
11488 + if (!sinfo->mmio) {
11489 + dev_err(dev, "Cannot map LCD memory region\n");
11490 + goto release_mem;
11493 + s1d15605_device_init(sinfo);
11495 + ret = fb_find_mode(&info->var, info, NULL, NULL, 0, NULL, 1);
11497 + if (!ret || (ret == 4))
11498 + info->var = s1d15605_default;
11500 + info->fix = s1d15605_fix;
11501 + info->flags = FBINFO_FLAG_DEFAULT |
11502 +/* FBINFO_HWACCEL_YPAN | */
11503 + FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA;
11505 + ret = register_framebuffer(info);
11507 + dev_err(dev, "Failed to register framebuffer device: %d\n", ret);
11511 + dev_set_drvdata(dev, info);
11513 + memset(info->screen_base, 0, info->fix.smem_len);
11514 + info->var.activate |= FB_ACTIVATE_NOW;
11515 + ret = fb_set_var(info, &info->var);
11517 + dev_warn(dev, "Unable to set display parameters\n");
11520 + info->var.activate &= ~(FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW);
11522 + dev_dbg(dev, "%s SUCCESS\n", __func__);
11524 + dev_info(dev, "Driver $Revision: 1.1 $\n");
11529 + iounmap(sinfo->mmio);
11531 + release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
11533 + kfree(info->screen_base);
11536 + framebuffer_release(info);
11538 + dev_dbg(dev, "%s FAILED\n", __func__);
11543 +static int __exit s1d15605fb_remove(struct platform_device *pdev)
11545 + struct device *dev = &pdev->dev;
11546 + struct fb_info *info = dev_get_drvdata(dev);
11547 + struct s1d15605fb_info *sinfo = info->par;
11552 + unregister_framebuffer(info);
11554 + iounmap(sinfo->mmio);
11555 + release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
11557 + kfree(info->screen_base);
11559 + dev_set_drvdata(dev, NULL);
11560 + framebuffer_release(info);
11565 +static struct platform_driver s1d15605fb_driver = {
11566 + .remove = __exit_p(s1d15605fb_remove),
11568 + .name = "s1d15605fb",
11569 + .owner = THIS_MODULE,
11574 +static int __init s1d15605fb_init(void)
11576 + return platform_driver_probe(&s1d15605fb_driver, s1d15605fb_probe);
11580 +static void __exit s1d15605fb_exit(void)
11582 + platform_driver_unregister(&s1d15605fb_driver);
11586 +module_init(s1d15605fb_init);
11587 +module_exit(s1d15605fb_exit);
11590 +MODULE_AUTHOR("KwikByte");
11591 +MODULE_DESCRIPTION("Epson S1D15605 LCD Controller framebuffer driver");
11592 +MODULE_LICENSE("GPL");
11593 diff -urN -x CVS linux-2.6.25/drivers/watchdog/Kconfig linux-2.6/drivers/watchdog/Kconfig
11594 --- linux-2.6.25/drivers/watchdog/Kconfig 2008-05-03 00:15:50.000000000 +0200
11595 +++ linux-2.6/drivers/watchdog/Kconfig 2008-03-09 15:14:55.000000000 +0200
11597 Watchdog timer embedded into AT91RM9200 chips. This will reboot your
11598 system when the timeout is reached.
11600 +config AT91SAM9_WATCHDOG
11601 + tristate "AT91SAM9 watchdog"
11602 + depends on ARCH_AT91 && !ARCH_AT91RM9200
11603 + select WATCHDOG_NOWAYOUT
11605 + Watchdog timer embedded into AT91SAM9 chips. This will reboot your
11606 + system when the timeout is reached.
11608 config 21285_WATCHDOG
11609 tristate "DC21285 watchdog"
11610 depends on FOOTBRIDGE
11611 diff -urN -x CVS linux-2.6.25/drivers/watchdog/Makefile linux-2.6/drivers/watchdog/Makefile
11612 --- linux-2.6.25/drivers/watchdog/Makefile 2008-05-03 00:15:50.000000000 +0200
11613 +++ linux-2.6/drivers/watchdog/Makefile 2008-03-09 15:14:55.000000000 +0200
11617 obj-$(CONFIG_AT91RM9200_WATCHDOG) += at91rm9200_wdt.o
11618 +obj-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
11619 obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o
11620 obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
11621 obj-$(CONFIG_977_WATCHDOG) += wdt977.o
11622 diff -urN -x CVS linux-2.6.25/drivers/watchdog/at91sam9_wdt.c linux-2.6/drivers/watchdog/at91sam9_wdt.c
11623 --- linux-2.6.25/drivers/watchdog/at91sam9_wdt.c 1970-01-01 02:00:00.000000000 +0200
11624 +++ linux-2.6/drivers/watchdog/at91sam9_wdt.c 2008-04-15 21:53:41.000000000 +0200
11627 + * Watchdog driver for Atmel AT91SAM9x processors.
11629 + * Copyright (C) 2007 Renaud CERRATO r.cerrato@til-technologies.fr
11631 + * This program is free software; you can redistribute it and/or
11632 + * modify it under the terms of the GNU General Public License
11633 + * as published by the Free Software Foundation; either version
11634 + * 2 of the License, or (at your option) any later version.
11638 + * The Watchdog Timer Mode Register can be only written to once. If the
11639 + * timeout need to be set from Linux, be sure that the bootstrap or the
11640 + * bootloader doesn't write to this register.
11643 +#include <linux/errno.h>
11644 +#include <linux/fs.h>
11645 +#include <linux/init.h>
11646 +#include <linux/kernel.h>
11647 +#include <linux/miscdevice.h>
11648 +#include <linux/module.h>
11649 +#include <linux/moduleparam.h>
11650 +#include <linux/platform_device.h>
11651 +#include <linux/types.h>
11652 +#include <linux/watchdog.h>
11653 +#include <linux/bitops.h>
11654 +#include <linux/uaccess.h>
11656 +#include <asm/arch/at91_wdt.h>
11659 +#define WDT_MAX_TIME 16 /* seconds */
11661 +static int wdt_timeout = -1; /* invalid */
11663 +module_param(wdt_timeout, int, 0);
11664 +MODULE_PARM_DESC(wdt_timeout, "Watchdog time in seconds. (default = disabled)");
11667 +static unsigned long at91wdt_busy;
11669 +/* ......................................................................... */
11672 + * Reload the watchdog timer. (ie, pat the watchdog)
11674 +static void inline at91_wdt_reload(void)
11676 + at91_sys_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
11679 +/* ......................................................................... */
11682 + * Watchdog device is opened, and watchdog starts running.
11684 +static int at91_wdt_open(struct inode *inode, struct file *file)
11686 + if (test_and_set_bit(0, &at91wdt_busy))
11689 + return nonseekable_open(inode, file);
11693 + * Close the watchdog device.
11695 +static int at91_wdt_close(struct inode *inode, struct file *file)
11697 + clear_bit(0, &at91wdt_busy);
11702 + * Change the watchdog time interval.
11704 +static int at91_wdt_settimeout(int new_time)
11706 + unsigned int reg, mr;
11708 + * All counting occurs at SLOW_CLOCK / 128 = 256 Hz
11710 + * Since WDV is a 12-bit counter, the maximum period is
11711 + * 4096 / 256 = 16 seconds.
11713 + if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
11716 + wdt_timeout = new_time;
11718 + /* Program the Watchdog */
11719 + reg = AT91_WDT_WDRSTEN /* causes watchdog reset */
11720 + | AT91_WDT_WDRPROC /* causes processor reset */
11721 + | AT91_WDT_WDDBGHLT /* disabled in debug mode */
11722 + | AT91_WDT_WDD /* restart at any time */
11723 + | (((wdt_timeout * 256) - 1) & AT91_WDT_WDV); /* timer value */
11724 + at91_sys_write(AT91_WDT_MR, reg);
11726 + /* Check if watchdog could be programmed */
11727 + mr = at91_sys_read(AT91_WDT_MR);
11729 + printk(KERN_ERR "at91sam9_wdt: Watchdog register already programmed.\n");
11733 + at91_wdt_reload();
11735 + printk(KERN_INFO "AT91SAM9 Watchdog enabled (%d seconds, nowayout)\n", wdt_timeout);
11739 +static struct watchdog_info at91_wdt_info = {
11740 + .identity = "at91sam9 watchdog",
11741 + .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
11745 + * Handle commands from user-space.
11747 +static int at91_wdt_ioctl(struct inode *inode, struct file *file,
11748 + unsigned int cmd, unsigned long arg)
11750 + void __user *argp = (void __user *)arg;
11751 + int __user *p = argp;
11752 + int new_value, err;
11755 + case WDIOC_KEEPALIVE:
11756 + at91_wdt_reload(); /* pat the watchdog */
11759 + case WDIOC_GETSUPPORT:
11760 + return copy_to_user(argp, &at91_wdt_info, sizeof(at91_wdt_info)) ? -EFAULT : 0;
11762 + case WDIOC_SETTIMEOUT:
11763 + if (get_user(new_value, p))
11766 + err = at91_wdt_settimeout(new_value);
11770 + return put_user(wdt_timeout, p); /* return current value */
11772 + case WDIOC_GETTIMEOUT:
11773 + return put_user(wdt_timeout, p);
11775 + case WDIOC_GETSTATUS:
11776 + case WDIOC_GETBOOTSTATUS:
11777 + return put_user(0, p);
11783 + * Pat the watchdog whenever device is written to.
11785 +static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
11787 + at91_wdt_reload(); /* pat the watchdog */
11791 +/* ......................................................................... */
11793 +static const struct file_operations at91wdt_fops = {
11794 + .owner = THIS_MODULE,
11795 + .llseek = no_llseek,
11796 + .ioctl = at91_wdt_ioctl,
11797 + .open = at91_wdt_open,
11798 + .release = at91_wdt_close,
11799 + .write = at91_wdt_write,
11802 +static struct miscdevice at91wdt_miscdev = {
11803 + .minor = WATCHDOG_MINOR,
11804 + .name = "watchdog",
11805 + .fops = &at91wdt_fops,
11808 +static int __init at91wdt_probe(struct platform_device *pdev)
11812 + if (at91wdt_miscdev.parent)
11814 + at91wdt_miscdev.parent = &pdev->dev;
11816 + res = misc_register(&at91wdt_miscdev);
11820 + /* Set watchdog */
11821 + if (at91_wdt_settimeout(wdt_timeout) == -EINVAL) {
11822 + pr_info("at91sam9_wdt: invalid timeout (must be between 1 and %d)\n", WDT_MAX_TIME);
11829 +static int __exit at91wdt_remove(struct platform_device *pdev)
11833 + res = misc_deregister(&at91wdt_miscdev);
11835 + at91wdt_miscdev.parent = NULL;
11842 +static int at91wdt_suspend(struct platform_device *pdev, pm_message_t message)
11847 +static int at91wdt_resume(struct platform_device *pdev)
11853 +#define at91wdt_suspend NULL
11854 +#define at91wdt_resume NULL
11857 +static struct platform_driver at91wdt_driver = {
11858 + .remove = __exit_p(at91wdt_remove),
11859 + .suspend = at91wdt_suspend,
11860 + .resume = at91wdt_resume,
11862 + .name = "at91_wdt",
11863 + .owner = THIS_MODULE,
11867 +static int __init at91sam_wdt_init(void)
11869 + return platform_driver_probe(&at91wdt_driver, at91wdt_probe);
11872 +static void __exit at91sam_wdt_exit(void)
11874 + platform_driver_unregister(&at91wdt_driver);
11877 +module_init(at91sam_wdt_init);
11878 +module_exit(at91sam_wdt_exit);
11880 +MODULE_AUTHOR("Renaud CERRATO");
11881 +MODULE_DESCRIPTION("Watchdog driver for Atmel AT91SAM9x processors");
11882 +MODULE_LICENSE("GPL");
11883 +MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
11884 +MODULE_ALIAS("platform:at91_wdt");
11885 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91_ecc.h linux-2.6/include/asm-arm/arch-at91/at91_ecc.h
11886 --- linux-2.6.25/include/asm-arm/arch-at91/at91_ecc.h 2007-10-09 22:31:38.000000000 +0200
11887 +++ linux-2.6/include/asm-arm/arch-at91/at91_ecc.h 2008-05-07 23:49:32.000000000 +0200
11890 * include/asm-arm/arch-at91/at91_ecc.h
11892 + * Copyright (C) 2007 Andrew Victor
11893 + * Copyright (C) 2007 Atmel Corporation.
11895 * Error Corrected Code Controller (ECC) - System peripherals regsters.
11896 * Based on AT91SAM9260 datasheet revision B.
11898 @@ -13,26 +16,26 @@
11902 -#define AT91_ECC_CR (AT91_ECC + 0x00) /* Control register */
11903 +#define AT91_ECC_CR 0x00 /* Control register */
11904 #define AT91_ECC_RST (1 << 0) /* Reset parity */
11906 -#define AT91_ECC_MR (AT91_ECC + 0x04) /* Mode register */
11907 +#define AT91_ECC_MR 0x04 /* Mode register */
11908 #define AT91_ECC_PAGESIZE (3 << 0) /* Page Size */
11909 #define AT91_ECC_PAGESIZE_528 (0)
11910 #define AT91_ECC_PAGESIZE_1056 (1)
11911 #define AT91_ECC_PAGESIZE_2112 (2)
11912 #define AT91_ECC_PAGESIZE_4224 (3)
11914 -#define AT91_ECC_SR (AT91_ECC + 0x08) /* Status register */
11915 +#define AT91_ECC_SR 0x08 /* Status register */
11916 #define AT91_ECC_RECERR (1 << 0) /* Recoverable Error */
11917 #define AT91_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */
11918 #define AT91_ECC_MULERR (1 << 2) /* Multiple Errors */
11920 -#define AT91_ECC_PR (AT91_ECC + 0x0c) /* Parity register */
11921 +#define AT91_ECC_PR 0x0c /* Parity register */
11922 #define AT91_ECC_BITADDR (0xf << 0) /* Bit Error Address */
11923 #define AT91_ECC_WORDADDR (0xfff << 4) /* Word Error Address */
11925 -#define AT91_ECC_NPR (AT91_ECC + 0x10) /* NParity register */
11926 +#define AT91_ECC_NPR 0x10 /* NParity register */
11927 #define AT91_ECC_NPARITY (0xffff << 0) /* NParity */
11930 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91_pit.h linux-2.6/include/asm-arm/arch-at91/at91_pit.h
11931 --- linux-2.6.25/include/asm-arm/arch-at91/at91_pit.h 2007-10-09 22:31:38.000000000 +0200
11932 +++ linux-2.6/include/asm-arm/arch-at91/at91_pit.h 2008-05-07 23:49:57.000000000 +0200
11935 * include/asm-arm/arch-at91/at91_pit.h
11937 + * Copyright (C) 2007 Andrew Victor
11938 + * Copyright (C) 2007 Atmel Corporation.
11940 * Periodic Interval Timer (PIT) - System peripherals regsters.
11941 * Based on AT91SAM9261 datasheet revision D.
11943 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91_pmc.h linux-2.6/include/asm-arm/arch-at91/at91_pmc.h
11944 --- linux-2.6.25/include/asm-arm/arch-at91/at91_pmc.h 2008-05-03 00:15:51.000000000 +0200
11945 +++ linux-2.6/include/asm-arm/arch-at91/at91_pmc.h 2008-05-05 22:01:39.000000000 +0200
11947 #define AT91_PMC_PCK (1 << 0) /* Processor Clock */
11948 #define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */
11949 #define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */
11950 +#define AT91CAP9_PMC_DDR (1 << 2) /* DDR Clock [AT91CAP9 revC only] */
11951 #define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */
11952 #define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */
11953 #define AT91CAP9_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91CAP9 only] */
11954 @@ -39,10 +40,14 @@
11955 #define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */
11957 #define AT91_CKGR_UCKR (AT91_PMC + 0x1C) /* UTMI Clock Register [SAM9RL, CAP9] */
11958 +#define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */
11959 +#define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */
11960 +#define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */
11961 +#define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI PLL Start-up Time */
11963 #define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register [not on SAM9RL] */
11964 #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
11965 -#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass [AT91SAM926x only] */
11966 +#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass [SAM9x, CAP9] */
11967 #define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
11969 #define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */
11971 #define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */
11972 #define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */
11973 #define AT91_PMC_USBDIV (3 << 28) /* USB Divisor (PLLB only) */
11974 +#define AT91CAP9_PMC_USBDIV (0xf << 28) /* USB Divisor (PLLB only) [AT91CAP9 revC only] */
11975 #define AT91_PMC_USBDIV_1 (0 << 28)
11976 #define AT91_PMC_USBDIV_2 (1 << 28)
11977 #define AT91_PMC_USBDIV_4 (2 << 28)
11978 @@ -76,10 +82,13 @@
11979 #define AT91_PMC_PRES_32 (5 << 2)
11980 #define AT91_PMC_PRES_64 (6 << 2)
11981 #define AT91_PMC_MDIV (3 << 8) /* Master Clock Division */
11982 -#define AT91_PMC_MDIV_1 (0 << 8)
11983 -#define AT91_PMC_MDIV_2 (1 << 8)
11984 -#define AT91_PMC_MDIV_3 (2 << 8)
11985 -#define AT91_PMC_MDIV_4 (3 << 8)
11986 +#define AT91RM9200_PMC_MDIV_1 (0 << 8) /* [AT91RM9200 only] */
11987 +#define AT91RM9200_PMC_MDIV_2 (1 << 8)
11988 +#define AT91RM9200_PMC_MDIV_3 (2 << 8)
11989 +#define AT91RM9200_PMC_MDIV_4 (3 << 8)
11990 +#define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9,CAP9 only] */
11991 +#define AT91SAM9_PMC_MDIV_2 (1 << 8)
11992 +#define AT91SAM9_PMC_MDIV_4 (2 << 8)
11994 #define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-3 Registers */
11996 @@ -90,10 +99,17 @@
11997 #define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */
11998 #define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
11999 #define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
12000 +#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [AT91CAP9 only] */
12001 +#define AT91_PMC_OSCSEL (1 << 7) /* Slow Clock Oscillator [AT91CAP9 revC only] */
12002 #define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
12003 #define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
12004 #define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
12005 #define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */
12006 #define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */
12008 +#define AT91_PMC_PROT (AT91_PMC + 0xe4) /* Protect Register [AT91CAP9 revC only] */
12009 +#define AT91_PMC_PROTKEY 0x504d4301 /* Activation Code */
12011 +#define AT91_PMC_VER (AT91_PMC + 0xfc) /* PMC Module Version [AT91CAP9 only] */
12014 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91_rstc.h linux-2.6/include/asm-arm/arch-at91/at91_rstc.h
12015 --- linux-2.6.25/include/asm-arm/arch-at91/at91_rstc.h 2007-10-09 22:31:38.000000000 +0200
12016 +++ linux-2.6/include/asm-arm/arch-at91/at91_rstc.h 2008-05-07 23:50:10.000000000 +0200
12019 * include/asm-arm/arch-at91/at91_rstc.h
12021 + * Copyright (C) 2007 Andrew Victor
12022 + * Copyright (C) 2007 Atmel Corporation.
12024 * Reset Controller (RSTC) - System peripherals regsters.
12025 * Based on AT91SAM9261 datasheet revision D.
12027 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91_rtt.h linux-2.6/include/asm-arm/arch-at91/at91_rtt.h
12028 --- linux-2.6.25/include/asm-arm/arch-at91/at91_rtt.h 2008-05-03 00:15:51.000000000 +0200
12029 +++ linux-2.6/include/asm-arm/arch-at91/at91_rtt.h 2008-05-07 23:51:11.000000000 +0200
12032 * include/asm-arm/arch-at91/at91_rtt.h
12034 + * Copyright (C) 2007 Andrew Victor
12035 + * Copyright (C) 2007 Atmel Corporation.
12037 * Real-time Timer (RTT) - System peripherals regsters.
12038 * Based on AT91SAM9261 datasheet revision D.
12040 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91_shdwc.h linux-2.6/include/asm-arm/arch-at91/at91_shdwc.h
12041 --- linux-2.6.25/include/asm-arm/arch-at91/at91_shdwc.h 2007-10-09 22:31:38.000000000 +0200
12042 +++ linux-2.6/include/asm-arm/arch-at91/at91_shdwc.h 2008-05-07 23:50:23.000000000 +0200
12045 * include/asm-arm/arch-at91/at91_shdwc.h
12047 + * Copyright (C) 2007 Andrew Victor
12048 + * Copyright (C) 2007 Atmel Corporation.
12050 * Shutdown Controller (SHDWC) - System peripherals regsters.
12051 * Based on AT91SAM9261 datasheet revision D.
12053 @@ -24,10 +27,12 @@
12054 #define AT91_SHDW_WKMODE0_LOW 2
12055 #define AT91_SHDW_WKMODE0_ANYLEVEL 3
12056 #define AT91_SHDW_CPTWK0 (0xf << 4) /* Counter On Wake Up 0 */
12057 +#define AT91_SHDW_CPTWK0_(x) ((x) << 4)
12058 #define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */
12060 #define AT91_SHDW_SR (AT91_SHDWC + 0x08) /* Shut Down Status Register */
12061 #define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */
12062 #define AT91_SHDW_RTTWK (1 << 16) /* Real-time Timer Wake-up */
12063 +#define AT91_SHDW_RTCWK (1 << 17) /* Real-time Clock Wake-up [SAM9RL] */
12066 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91_tsc.h linux-2.6/include/asm-arm/arch-at91/at91_tsc.h
12067 --- linux-2.6.25/include/asm-arm/arch-at91/at91_tsc.h 1970-01-01 02:00:00.000000000 +0200
12068 +++ linux-2.6/include/asm-arm/arch-at91/at91_tsc.h 2008-05-07 23:51:32.000000000 +0200
12071 + * include/asm-arm/arch-at91/at91_tsc.h
12073 + * Copyright (C) 2008 Andrew Victor
12075 + * Touch Screen ADC Controller (TSC)
12076 + * Based on AT91SAM9RL64 preliminary draft datasheet.
12078 + * This program is free software; you can redistribute it and/or modify it
12079 + * under the terms of the GNU General Public License as published by the
12080 + * Free Software Foundation; either version 2 of the License, or (at your
12081 + * option) any later version.
12084 +#ifndef AT91_TSC_H
12085 +#define AT91_TSC_H
12087 +#define AT91_TSADCC_CR 0x00 /* Control register */
12088 +#define AT91_TSADCC_SWRST (1 << 0) /* Software Reset*/
12089 +#define AT91_TSADCC_START (1 << 1) /* Start conversion */
12091 +#define AT91_TSADCC_MR 0x04 /* Mode register */
12092 +#define AT91_TSADCC_TSAMOD (3 << 0) /* ADC mode */
12093 +#define AT91_TSADCC_LOWRES (1 << 4) /* Resolution selection */
12094 +#define AT91_TSADCC_SLEEP (1 << 5) /* Sleep mode */
12095 +#define AT91_TSADCC_PENDET (1 << 6) /* Pen Detect selection */
12096 +#define AT91_TSADCC_PRESCAL (0x3f << 8) /* Prescalar Rate Selection */
12097 +#define AT91_TSADCC_STARTUP (0x7f << 16) /* Start Up time */
12098 +#define AT91_TSADCC_SHTIM (0xf << 24) /* Sample & Hold time */
12099 +#define AT91_TSADCC_PENDBC (0xf << 28) /* Pen Detect debouncing time */
12101 +#define AT91_TSADCC_TRGR 0x08 /* Trigger register */
12102 +#define AT91_TSADCC_TRGMOD (7 << 0) /* Trigger mode */
12103 +#define AT91_TSADCC_TRGMOD_NONE (0 << 0)
12104 +#define AT91_TSADCC_TRGMOD_EXT_RISING (1 << 0)
12105 +#define AT91_TSADCC_TRGMOD_EXT_FALLING (2 << 0)
12106 +#define AT91_TSADCC_TRGMOD_EXT_ANY (3 << 0)
12107 +#define AT91_TSADCC_TRGMOD_PENDET (4 << 0)
12108 +#define AT91_TSADCC_TRGMOD_PERIOD (5 << 0)
12109 +#define AT91_TSADCC_TRGMOD_CONTINUOUS (6 << 0)
12110 +#define AT91_TSADCC_TRGPER (0xffff << 16) /* Trigger period */
12112 +#define AT91_TSADCC_TSR 0x0C /* Touch Screen register */
12113 +#define AT91_TSADCC_TSFREQ (0xf << 0) /* TS Frequency in Interleaved mode */
12114 +#define AT91_TSADCC_TSSHTIM (0xf << 24) /* Sample & Hold time */
12116 +#define AT91_TSADCC_CHER 0x10 /* Channel Enable register */
12117 +#define AT91_TSADCC_CHDR 0x14 /* Channel Disable register */
12118 +#define AT91_TSADCC_CHSR 0x18 /* Channel Status register */
12119 +#define AT91_TSADCC_CH(n) (1 << (n)) /* Channel number */
12121 +#define AT91_TSADCC_SR 0x1C /* Status register */
12122 +#define AT91_TSADCC_EOC(n) (1 << ((n)+0)) /* End of conversion for channel N */
12123 +#define AT91_TSADCC_OVRE(n) (1 << ((n)+8)) /* Overrun error for channel N */
12124 +#define AT91_TSADCC_DRDY (1 << 16) /* Data Ready */
12125 +#define AT91_TSADCC_GOVRE (1 << 17) /* General Overrun Error */
12126 +#define AT91_TSADCC_ENDRX (1 << 18) /* End of RX Buffer */
12127 +#define AT91_TSADCC_RXBUFF (1 << 19) /* TX Buffer full */
12128 +#define AT91_TSADCC_PENCNT (1 << 20) /* Pen contact */
12129 +#define AT91_TSADCC_NOCNT (1 << 21) /* No contact */
12131 +#define AT91_TSADCC_LCDR 0x20 /* Last Converted Data register */
12132 +#define AT91_TSADCC_DATA (0x3ff << 0) /* Channel data */
12134 +#define AT91_TSADCC_IER 0x24 /* Interrupt Enable register */
12135 +#define AT91_TSADCC_IDR 0x28 /* Interrupt Disable register */
12136 +#define AT91_TSADCC_IMR 0x2C /* Interrupt Mask register */
12137 +#define AT91_TSADCC_CDR0 0x30 /* Channel Data 0 */
12138 +#define AT91_TSADCC_CDR1 0x34 /* Channel Data 1 */
12139 +#define AT91_TSADCC_CDR2 0x38 /* Channel Data 2 */
12140 +#define AT91_TSADCC_CDR3 0x3C /* Channel Data 3 */
12141 +#define AT91_TSADCC_CDR4 0x40 /* Channel Data 4 */
12142 +#define AT91_TSADCC_CDR5 0x44 /* Channel Data 5 */
12146 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91_wdt.h linux-2.6/include/asm-arm/arch-at91/at91_wdt.h
12147 --- linux-2.6.25/include/asm-arm/arch-at91/at91_wdt.h 2007-10-09 22:31:38.000000000 +0200
12148 +++ linux-2.6/include/asm-arm/arch-at91/at91_wdt.h 2008-05-07 23:51:43.000000000 +0200
12151 * include/asm-arm/arch-at91/at91_wdt.h
12153 + * Copyright (C) 2007 Andrew Victor
12154 + * Copyright (C) 2007 Atmel Corporation.
12156 * Watchdog Timer (WDT) - System peripherals regsters.
12157 * Based on AT91SAM9261 datasheet revision D.
12159 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91cap9.h linux-2.6/include/asm-arm/arch-at91/at91cap9.h
12160 --- linux-2.6.25/include/asm-arm/arch-at91/at91cap9.h 2008-05-03 00:15:51.000000000 +0200
12161 +++ linux-2.6/include/asm-arm/arch-at91/at91cap9.h 2008-05-05 22:01:39.000000000 +0200
12162 @@ -101,7 +101,10 @@
12163 #define AT91_RTT (0xfffffd20 - AT91_BASE_SYS)
12164 #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
12165 #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
12166 -#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
12167 +#define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS)
12168 +#define AT91_GPBR (cpu_is_at91cap9_revB() ? \
12169 + (0xfffffd50 - AT91_BASE_SYS) : \
12170 + (0xfffffd60 - AT91_BASE_SYS))
12172 #define AT91_USART0 AT91CAP9_BASE_US0
12173 #define AT91_USART1 AT91CAP9_BASE_US1
12174 @@ -118,7 +121,7 @@
12175 #define AT91CAP9_ROM_SIZE (32 * SZ_1K) /* Internal ROM size (32Kb) */
12177 #define AT91CAP9_LCDC_BASE 0x00500000 /* LCD Controller */
12178 -#define AT91CAP9_UDPHS_BASE 0x00600000 /* USB High Speed Device Port */
12179 +#define AT91CAP9_UDPHS_FIFO 0x00600000 /* USB High Speed Device Port */
12180 #define AT91CAP9_UHP_BASE 0x00700000 /* USB Host controller */
12182 #define CONFIG_DRAM_BASE AT91_CHIPSELECT_6
12183 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91cap9_ddrsdr.h linux-2.6/include/asm-arm/arch-at91/at91cap9_ddrsdr.h
12184 --- linux-2.6.25/include/asm-arm/arch-at91/at91cap9_ddrsdr.h 1970-01-01 02:00:00.000000000 +0200
12185 +++ linux-2.6/include/asm-arm/arch-at91/at91cap9_ddrsdr.h 2008-05-07 21:33:47.000000000 +0200
12188 + * include/asm-arm/arch-at91/at91cap9_ddrsdr.h
12190 + * (C) 2008 Andrew Victor
12192 + * DDR/SDR Controller (DDRSDRC) - System peripherals registers.
12193 + * Based on AT91CAP9 datasheet revision B.
12195 + * This program is free software; you can redistribute it and/or modify
12196 + * it under the terms of the GNU General Public License as published by
12197 + * the Free Software Foundation; either version 2 of the License, or
12198 + * (at your option) any later version.
12201 +#ifndef AT91CAP9_DDRSDR_H
12202 +#define AT91CAP9_DDRSDR_H
12204 +#define AT91_DDRSDRC_MR (AT91_DDRSDRC + 0x00) /* Mode Register */
12205 +#define AT91_DDRSDRC_MODE (0xf << 0) /* Command Mode */
12206 +#define AT91_DDRSDRC_MODE_NORMAL 0
12207 +#define AT91_DDRSDRC_MODE_NOP 1
12208 +#define AT91_DDRSDRC_MODE_PRECHARGE 2
12209 +#define AT91_DDRSDRC_MODE_LMR 3
12210 +#define AT91_DDRSDRC_MODE_REFRESH 4
12211 +#define AT91_DDRSDRC_MODE_EXT_LMR 5
12212 +#define AT91_DDRSDRC_MODE_DEEP 6
12214 +#define AT91_DDRSDRC_RTR (AT91_DDRSDRC + 0x04) /* Refresh Timer Register */
12215 +#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */
12217 +#define AT91_DDRSDRC_CR (AT91_DDRSDRC + 0x08) /* Configuration Register */
12218 +#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */
12219 +#define AT91_DDRSDRC_NC_SDR8 (0 << 0)
12220 +#define AT91_DDRSDRC_NC_SDR9 (1 << 0)
12221 +#define AT91_DDRSDRC_NC_SDR10 (2 << 0)
12222 +#define AT91_DDRSDRC_NC_SDR11 (3 << 0)
12223 +#define AT91_DDRSDRC_NC_DDR9 (0 << 0)
12224 +#define AT91_DDRSDRC_NC_DDR10 (1 << 0)
12225 +#define AT91_DDRSDRC_NC_DDR11 (2 << 0)
12226 +#define AT91_DDRSDRC_NC_DDR12 (3 << 0)
12227 +#define AT91_DDRSDRC_NR (3 << 2) /* Number of Row Bits */
12228 +#define AT91_DDRSDRC_NR_11 (0 << 2)
12229 +#define AT91_DDRSDRC_NR_12 (1 << 2)
12230 +#define AT91_DDRSDRC_NR_13 (2 << 2)
12231 +#define AT91_DDRSDRC_CAS (7 << 4) /* CAS Latency */
12232 +#define AT91_DDRSDRC_CAS_2 (2 << 4)
12233 +#define AT91_DDRSDRC_CAS_3 (3 << 4)
12234 +#define AT91_DDRSDRC_CAS_25 (6 << 4)
12235 +#define AT91_DDRSDRC_DLL (1 << 7) /* Reset DLL */
12236 +#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */
12238 +#define AT91_DDRSDRC_T0PR (AT91_DDRSDRC + 0x0C) /* Timing 0 Register */
12239 +#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */
12240 +#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */
12241 +#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */
12242 +#define AT91_DDRSDRC_TRC (0xf << 12) /* Row cycle delay */
12243 +#define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */
12244 +#define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */
12245 +#define AT91_DDRSDRC_TWTR (1 << 24) /* Internal Write to Read delay */
12246 +#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */
12248 +#define AT91_DDRSDRC_T1PR (AT91_DDRSDRC + 0x10) /* Timing 1 Register */
12249 +#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */
12250 +#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */
12251 +#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */
12252 +#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */
12254 +#define AT91_DDRSDRC_LPR (AT91_DDRSDRC + 0x18) /* Low Power Register */
12255 +#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */
12256 +#define AT91_DDRSDRC_LPCB_DISABLE 0
12257 +#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1
12258 +#define AT91_DDRSDRC_LPCB_POWER_DOWN 2
12259 +#define AT91_DDRSDRC_LPCB_DEEP_POWER_DOWN 3
12260 +#define AT91_DDRSDRC_CLKFR (1 << 2) /* Clock Frozen */
12261 +#define AT91_DDRSDRC_PASR (7 << 4) /* Partial Array Self Refresh */
12262 +#define AT91_DDRSDRC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
12263 +#define AT91_DDRSDRC_DS (3 << 10) /* Drive Strength */
12264 +#define AT91_DDRSDRC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
12265 +#define AT91_DDRSDRC_TIMEOUT_0_CLK_CYCLES (0 << 12)
12266 +#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12)
12267 +#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12)
12269 +#define AT91_DDRSDRC_MDR (AT91_DDRSDRC + 0x1C) /* Memory Device Register */
12270 +#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */
12271 +#define AT91_DDRSDRC_MD_SDR 0
12272 +#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
12273 +#define AT91_DDRSDRC_MD_DDR 2
12274 +#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
12276 +#define AT91_DDRSDRC_DLLR (AT91_DDRSDRC + 0x20) /* DLL Information Register */
12277 +#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */
12278 +#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */
12279 +#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */
12280 +#define AT91_DDRSDRC_SDCOVF (1 << 3) /* Slave Delay Correction Overflow */
12281 +#define AT91_DDRSDRC_SDCUDF (1 << 4) /* Slave Delay Correction Underflow */
12282 +#define AT91_DDRSDRC_SDERF (1 << 5) /* Slave Delay Correction error */
12283 +#define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */
12284 +#define AT91_DDRSDRC_SDVAL (0xff << 16) /* Slave Delay value */
12285 +#define AT91_DDRSDRC_SDCVAL (0xff << 24) /* Slave Delay Correction value */
12289 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91cap9_matrix.h linux-2.6/include/asm-arm/arch-at91/at91cap9_matrix.h
12290 --- linux-2.6.25/include/asm-arm/arch-at91/at91cap9_matrix.h 2008-05-03 00:15:51.000000000 +0200
12291 +++ linux-2.6/include/asm-arm/arch-at91/at91cap9_matrix.h 2008-04-18 19:20:34.000000000 +0200
12292 @@ -106,6 +106,11 @@
12293 #define AT91_MPBS0_SFR (AT91_MATRIX + 0x114) /* MPBlock Slave 0 Special Function Register */
12294 #define AT91_MPBS1_SFR (AT91_MATRIX + 0x11C) /* MPBlock Slave 1 Special Function Register */
12296 +#define AT91_MATRIX_UDPHS (AT91_MATRIX + 0x118) /* USBHS Special Function Register [AT91CAP9 only] */
12297 +#define AT91_MATRIX_SELECT_UDPHS (0 << 31) /* select High Speed UDP */
12298 +#define AT91_MATRIX_SELECT_UDP (1 << 31) /* select standard UDP */
12299 +#define AT91_MATRIX_UDPHS_BYPASS_LOCK (1 << 30) /* bypass lock bit */
12301 #define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x120) /* EBI Chip Select Assignment Register */
12302 #define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
12303 #define AT91_MATRIX_EBI_CS1A_SMC (0 << 1)
12304 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91sam9260_matrix.h linux-2.6/include/asm-arm/arch-at91/at91sam9260_matrix.h
12305 --- linux-2.6.25/include/asm-arm/arch-at91/at91sam9260_matrix.h 2008-05-03 00:15:51.000000000 +0200
12306 +++ linux-2.6/include/asm-arm/arch-at91/at91sam9260_matrix.h 2008-05-07 12:07:13.000000000 +0200
12309 * include/asm-arm/arch-at91/at91sam9260_matrix.h
12311 + * Copyright (C) 2007 Atmel Corporation.
12313 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
12314 * Based on AT91SAM9260 datasheet revision B.
12316 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91sam9261_matrix.h linux-2.6/include/asm-arm/arch-at91/at91sam9261_matrix.h
12317 --- linux-2.6.25/include/asm-arm/arch-at91/at91sam9261_matrix.h 2007-10-09 22:31:38.000000000 +0200
12318 +++ linux-2.6/include/asm-arm/arch-at91/at91sam9261_matrix.h 2008-05-07 12:07:24.000000000 +0200
12321 * include/asm-arm/arch-at91/at91sam9261_matrix.h
12323 + * Copyright (C) 2007 Atmel Corporation.
12325 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
12326 * Based on AT91SAM9261 datasheet revision D.
12328 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91sam926x_mc.h linux-2.6/include/asm-arm/arch-at91/at91sam926x_mc.h
12329 --- linux-2.6.25/include/asm-arm/arch-at91/at91sam926x_mc.h 2007-10-09 22:31:38.000000000 +0200
12330 +++ linux-2.6/include/asm-arm/arch-at91/at91sam926x_mc.h 1970-01-01 02:00:00.000000000 +0200
12333 - * include/asm-arm/arch-at91/at91sam926x_mc.h
12335 - * Memory Controllers (SMC, SDRAMC) - System peripherals registers.
12336 - * Based on AT91SAM9261 datasheet revision D.
12338 - * This program is free software; you can redistribute it and/or modify
12339 - * it under the terms of the GNU General Public License as published by
12340 - * the Free Software Foundation; either version 2 of the License, or
12341 - * (at your option) any later version.
12344 -#ifndef AT91SAM926x_MC_H
12345 -#define AT91SAM926x_MC_H
12347 -/* SDRAM Controller (SDRAMC) registers */
12348 -#define AT91_SDRAMC_MR (AT91_SDRAMC + 0x00) /* SDRAM Controller Mode Register */
12349 -#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
12350 -#define AT91_SDRAMC_MODE_NORMAL 0
12351 -#define AT91_SDRAMC_MODE_NOP 1
12352 -#define AT91_SDRAMC_MODE_PRECHARGE 2
12353 -#define AT91_SDRAMC_MODE_LMR 3
12354 -#define AT91_SDRAMC_MODE_REFRESH 4
12355 -#define AT91_SDRAMC_MODE_EXT_LMR 5
12356 -#define AT91_SDRAMC_MODE_DEEP 6
12358 -#define AT91_SDRAMC_TR (AT91_SDRAMC + 0x04) /* SDRAM Controller Refresh Timer Register */
12359 -#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */
12361 -#define AT91_SDRAMC_CR (AT91_SDRAMC + 0x08) /* SDRAM Controller Configuration Register */
12362 -#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
12363 -#define AT91_SDRAMC_NC_8 (0 << 0)
12364 -#define AT91_SDRAMC_NC_9 (1 << 0)
12365 -#define AT91_SDRAMC_NC_10 (2 << 0)
12366 -#define AT91_SDRAMC_NC_11 (3 << 0)
12367 -#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
12368 -#define AT91_SDRAMC_NR_11 (0 << 2)
12369 -#define AT91_SDRAMC_NR_12 (1 << 2)
12370 -#define AT91_SDRAMC_NR_13 (2 << 2)
12371 -#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
12372 -#define AT91_SDRAMC_NB_2 (0 << 4)
12373 -#define AT91_SDRAMC_NB_4 (1 << 4)
12374 -#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
12375 -#define AT91_SDRAMC_CAS_1 (1 << 5)
12376 -#define AT91_SDRAMC_CAS_2 (2 << 5)
12377 -#define AT91_SDRAMC_CAS_3 (3 << 5)
12378 -#define AT91_SDRAMC_DBW (1 << 7) /* Data Bus Width */
12379 -#define AT91_SDRAMC_DBW_32 (0 << 7)
12380 -#define AT91_SDRAMC_DBW_16 (1 << 7)
12381 -#define AT91_SDRAMC_TWR (0xf << 8) /* Write Recovery Delay */
12382 -#define AT91_SDRAMC_TRC (0xf << 12) /* Row Cycle Delay */
12383 -#define AT91_SDRAMC_TRP (0xf << 16) /* Row Precharge Delay */
12384 -#define AT91_SDRAMC_TRCD (0xf << 20) /* Row to Column Delay */
12385 -#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */
12386 -#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */
12388 -#define AT91_SDRAMC_LPR (AT91_SDRAMC + 0x10) /* SDRAM Controller Low Power Register */
12389 -#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */
12390 -#define AT91_SDRAMC_LPCB_DISABLE 0
12391 -#define AT91_SDRAMC_LPCB_SELF_REFRESH 1
12392 -#define AT91_SDRAMC_LPCB_POWER_DOWN 2
12393 -#define AT91_SDRAMC_LPCB_DEEP_POWER_DOWN 3
12394 -#define AT91_SDRAMC_PASR (7 << 4) /* Partial Array Self Refresh */
12395 -#define AT91_SDRAMC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
12396 -#define AT91_SDRAMC_DS (3 << 10) /* Drive Strenght */
12397 -#define AT91_SDRAMC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
12398 -#define AT91_SDRAMC_TIMEOUT_0_CLK_CYCLES (0 << 12)
12399 -#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12)
12400 -#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12)
12402 -#define AT91_SDRAMC_IER (AT91_SDRAMC + 0x14) /* SDRAM Controller Interrupt Enable Register */
12403 -#define AT91_SDRAMC_IDR (AT91_SDRAMC + 0x18) /* SDRAM Controller Interrupt Disable Register */
12404 -#define AT91_SDRAMC_IMR (AT91_SDRAMC + 0x1C) /* SDRAM Controller Interrupt Mask Register */
12405 -#define AT91_SDRAMC_ISR (AT91_SDRAMC + 0x20) /* SDRAM Controller Interrupt Status Register */
12406 -#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */
12408 -#define AT91_SDRAMC_MDR (AT91_SDRAMC + 0x24) /* SDRAM Memory Device Register */
12409 -#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */
12410 -#define AT91_SDRAMC_MD_SDRAM 0
12411 -#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1
12414 -/* Static Memory Controller (SMC) registers */
12415 -#define AT91_SMC_SETUP(n) (AT91_SMC + 0x00 + ((n)*0x10)) /* Setup Register for CS n */
12416 -#define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */
12417 -#define AT91_SMC_NWESETUP_(x) ((x) << 0)
12418 -#define AT91_SMC_NCS_WRSETUP (0x3f << 8) /* NCS Setup Length in Write Access */
12419 -#define AT91_SMC_NCS_WRSETUP_(x) ((x) << 8)
12420 -#define AT91_SMC_NRDSETUP (0x3f << 16) /* NRD Setup Length */
12421 -#define AT91_SMC_NRDSETUP_(x) ((x) << 16)
12422 -#define AT91_SMC_NCS_RDSETUP (0x3f << 24) /* NCS Setup Length in Read Access */
12423 -#define AT91_SMC_NCS_RDSETUP_(x) ((x) << 24)
12425 -#define AT91_SMC_PULSE(n) (AT91_SMC + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */
12426 -#define AT91_SMC_NWEPULSE (0x7f << 0) /* NWE Pulse Length */
12427 -#define AT91_SMC_NWEPULSE_(x) ((x) << 0)
12428 -#define AT91_SMC_NCS_WRPULSE (0x7f << 8) /* NCS Pulse Length in Write Access */
12429 -#define AT91_SMC_NCS_WRPULSE_(x)((x) << 8)
12430 -#define AT91_SMC_NRDPULSE (0x7f << 16) /* NRD Pulse Length */
12431 -#define AT91_SMC_NRDPULSE_(x) ((x) << 16)
12432 -#define AT91_SMC_NCS_RDPULSE (0x7f << 24) /* NCS Pulse Length in Read Access */
12433 -#define AT91_SMC_NCS_RDPULSE_(x)((x) << 24)
12435 -#define AT91_SMC_CYCLE(n) (AT91_SMC + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */
12436 -#define AT91_SMC_NWECYCLE (0x1ff << 0 ) /* Total Write Cycle Length */
12437 -#define AT91_SMC_NWECYCLE_(x) ((x) << 0)
12438 -#define AT91_SMC_NRDCYCLE (0x1ff << 16) /* Total Read Cycle Length */
12439 -#define AT91_SMC_NRDCYCLE_(x) ((x) << 16)
12441 -#define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
12442 -#define AT91_SMC_READMODE (1 << 0) /* Read Mode */
12443 -#define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */
12444 -#define AT91_SMC_EXNWMODE (3 << 4) /* NWAIT Mode */
12445 -#define AT91_SMC_EXNWMODE_DISABLE (0 << 4)
12446 -#define AT91_SMC_EXNWMODE_FROZEN (2 << 4)
12447 -#define AT91_SMC_EXNWMODE_READY (3 << 4)
12448 -#define AT91_SMC_BAT (1 << 8) /* Byte Access Type */
12449 -#define AT91_SMC_BAT_SELECT (0 << 8)
12450 -#define AT91_SMC_BAT_WRITE (1 << 8)
12451 -#define AT91_SMC_DBW (3 << 12) /* Data Bus Width */
12452 -#define AT91_SMC_DBW_8 (0 << 12)
12453 -#define AT91_SMC_DBW_16 (1 << 12)
12454 -#define AT91_SMC_DBW_32 (2 << 12)
12455 -#define AT91_SMC_TDF (0xf << 16) /* Data Float Time. */
12456 -#define AT91_SMC_TDF_(x) ((x) << 16)
12457 -#define AT91_SMC_TDFMODE (1 << 20) /* TDF Optimization - Enabled */
12458 -#define AT91_SMC_PMEN (1 << 24) /* Page Mode Enabled */
12459 -#define AT91_SMC_PS (3 << 28) /* Page Size */
12460 -#define AT91_SMC_PS_4 (0 << 28)
12461 -#define AT91_SMC_PS_8 (1 << 28)
12462 -#define AT91_SMC_PS_16 (2 << 28)
12463 -#define AT91_SMC_PS_32 (3 << 28)
12465 -#if defined(AT91_SMC1) /* The AT91SAM9263 has 2 Static Memory contollers */
12466 -#define AT91_SMC1_SETUP(n) (AT91_SMC1 + 0x00 + ((n)*0x10)) /* Setup Register for CS n */
12467 -#define AT91_SMC1_PULSE(n) (AT91_SMC1 + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */
12468 -#define AT91_SMC1_CYCLE(n) (AT91_SMC1 + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */
12469 -#define AT91_SMC1_MODE(n) (AT91_SMC1 + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
12473 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91sam9_sdramc.h linux-2.6/include/asm-arm/arch-at91/at91sam9_sdramc.h
12474 --- linux-2.6.25/include/asm-arm/arch-at91/at91sam9_sdramc.h 1970-01-01 02:00:00.000000000 +0200
12475 +++ linux-2.6/include/asm-arm/arch-at91/at91sam9_sdramc.h 2008-05-07 23:51:59.000000000 +0200
12478 + * include/asm-arm/arch-at91/at91sam9_sdramc.h
12480 + * Copyright (C) 2007 Andrew Victor
12481 + * Copyright (C) 2007 Atmel Corporation.
12483 + * SDRAM Controllers (SDRAMC) - System peripherals registers.
12484 + * Based on AT91SAM9261 datasheet revision D.
12486 + * This program is free software; you can redistribute it and/or modify
12487 + * it under the terms of the GNU General Public License as published by
12488 + * the Free Software Foundation; either version 2 of the License, or
12489 + * (at your option) any later version.
12492 +#ifndef AT91SAM9_SDRAMC_H
12493 +#define AT91SAM9_SDRAMC_H
12495 +/* SDRAM Controller (SDRAMC) registers */
12496 +#define AT91_SDRAMC_MR (AT91_SDRAMC + 0x00) /* SDRAM Controller Mode Register */
12497 +#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
12498 +#define AT91_SDRAMC_MODE_NORMAL 0
12499 +#define AT91_SDRAMC_MODE_NOP 1
12500 +#define AT91_SDRAMC_MODE_PRECHARGE 2
12501 +#define AT91_SDRAMC_MODE_LMR 3
12502 +#define AT91_SDRAMC_MODE_REFRESH 4
12503 +#define AT91_SDRAMC_MODE_EXT_LMR 5
12504 +#define AT91_SDRAMC_MODE_DEEP 6
12506 +#define AT91_SDRAMC_TR (AT91_SDRAMC + 0x04) /* SDRAM Controller Refresh Timer Register */
12507 +#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */
12509 +#define AT91_SDRAMC_CR (AT91_SDRAMC + 0x08) /* SDRAM Controller Configuration Register */
12510 +#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
12511 +#define AT91_SDRAMC_NC_8 (0 << 0)
12512 +#define AT91_SDRAMC_NC_9 (1 << 0)
12513 +#define AT91_SDRAMC_NC_10 (2 << 0)
12514 +#define AT91_SDRAMC_NC_11 (3 << 0)
12515 +#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
12516 +#define AT91_SDRAMC_NR_11 (0 << 2)
12517 +#define AT91_SDRAMC_NR_12 (1 << 2)
12518 +#define AT91_SDRAMC_NR_13 (2 << 2)
12519 +#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
12520 +#define AT91_SDRAMC_NB_2 (0 << 4)
12521 +#define AT91_SDRAMC_NB_4 (1 << 4)
12522 +#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
12523 +#define AT91_SDRAMC_CAS_1 (1 << 5)
12524 +#define AT91_SDRAMC_CAS_2 (2 << 5)
12525 +#define AT91_SDRAMC_CAS_3 (3 << 5)
12526 +#define AT91_SDRAMC_DBW (1 << 7) /* Data Bus Width */
12527 +#define AT91_SDRAMC_DBW_32 (0 << 7)
12528 +#define AT91_SDRAMC_DBW_16 (1 << 7)
12529 +#define AT91_SDRAMC_TWR (0xf << 8) /* Write Recovery Delay */
12530 +#define AT91_SDRAMC_TRC (0xf << 12) /* Row Cycle Delay */
12531 +#define AT91_SDRAMC_TRP (0xf << 16) /* Row Precharge Delay */
12532 +#define AT91_SDRAMC_TRCD (0xf << 20) /* Row to Column Delay */
12533 +#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */
12534 +#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */
12536 +#define AT91_SDRAMC_LPR (AT91_SDRAMC + 0x10) /* SDRAM Controller Low Power Register */
12537 +#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */
12538 +#define AT91_SDRAMC_LPCB_DISABLE 0
12539 +#define AT91_SDRAMC_LPCB_SELF_REFRESH 1
12540 +#define AT91_SDRAMC_LPCB_POWER_DOWN 2
12541 +#define AT91_SDRAMC_LPCB_DEEP_POWER_DOWN 3
12542 +#define AT91_SDRAMC_PASR (7 << 4) /* Partial Array Self Refresh */
12543 +#define AT91_SDRAMC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
12544 +#define AT91_SDRAMC_DS (3 << 10) /* Drive Strength */
12545 +#define AT91_SDRAMC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
12546 +#define AT91_SDRAMC_TIMEOUT_0_CLK_CYCLES (0 << 12)
12547 +#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12)
12548 +#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12)
12550 +#define AT91_SDRAMC_IER (AT91_SDRAMC + 0x14) /* SDRAM Controller Interrupt Enable Register */
12551 +#define AT91_SDRAMC_IDR (AT91_SDRAMC + 0x18) /* SDRAM Controller Interrupt Disable Register */
12552 +#define AT91_SDRAMC_IMR (AT91_SDRAMC + 0x1C) /* SDRAM Controller Interrupt Mask Register */
12553 +#define AT91_SDRAMC_ISR (AT91_SDRAMC + 0x20) /* SDRAM Controller Interrupt Status Register */
12554 +#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */
12556 +#define AT91_SDRAMC_MDR (AT91_SDRAMC + 0x24) /* SDRAM Memory Device Register */
12557 +#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */
12558 +#define AT91_SDRAMC_MD_SDRAM 0
12559 +#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1
12563 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91sam9_smc.h linux-2.6/include/asm-arm/arch-at91/at91sam9_smc.h
12564 --- linux-2.6.25/include/asm-arm/arch-at91/at91sam9_smc.h 1970-01-01 02:00:00.000000000 +0200
12565 +++ linux-2.6/include/asm-arm/arch-at91/at91sam9_smc.h 2008-05-07 23:52:15.000000000 +0200
12568 + * include/asm-arm/arch-at91/at91sam9_smc.h
12570 + * Copyright (C) 2007 Andrew Victor
12571 + * Copyright (C) 2007 Atmel Corporation.
12573 + * Static Memory Controllers (SMC) - System peripherals registers.
12574 + * Based on AT91SAM9261 datasheet revision D.
12576 + * This program is free software; you can redistribute it and/or modify
12577 + * it under the terms of the GNU General Public License as published by
12578 + * the Free Software Foundation; either version 2 of the License, or
12579 + * (at your option) any later version.
12582 +#ifndef AT91SAM9_SMC_H
12583 +#define AT91SAM9_SMC_H
12585 +#define AT91_SMC_SETUP(n) (AT91_SMC + 0x00 + ((n)*0x10)) /* Setup Register for CS n */
12586 +#define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */
12587 +#define AT91_SMC_NWESETUP_(x) ((x) << 0)
12588 +#define AT91_SMC_NCS_WRSETUP (0x3f << 8) /* NCS Setup Length in Write Access */
12589 +#define AT91_SMC_NCS_WRSETUP_(x) ((x) << 8)
12590 +#define AT91_SMC_NRDSETUP (0x3f << 16) /* NRD Setup Length */
12591 +#define AT91_SMC_NRDSETUP_(x) ((x) << 16)
12592 +#define AT91_SMC_NCS_RDSETUP (0x3f << 24) /* NCS Setup Length in Read Access */
12593 +#define AT91_SMC_NCS_RDSETUP_(x) ((x) << 24)
12595 +#define AT91_SMC_PULSE(n) (AT91_SMC + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */
12596 +#define AT91_SMC_NWEPULSE (0x7f << 0) /* NWE Pulse Length */
12597 +#define AT91_SMC_NWEPULSE_(x) ((x) << 0)
12598 +#define AT91_SMC_NCS_WRPULSE (0x7f << 8) /* NCS Pulse Length in Write Access */
12599 +#define AT91_SMC_NCS_WRPULSE_(x)((x) << 8)
12600 +#define AT91_SMC_NRDPULSE (0x7f << 16) /* NRD Pulse Length */
12601 +#define AT91_SMC_NRDPULSE_(x) ((x) << 16)
12602 +#define AT91_SMC_NCS_RDPULSE (0x7f << 24) /* NCS Pulse Length in Read Access */
12603 +#define AT91_SMC_NCS_RDPULSE_(x)((x) << 24)
12605 +#define AT91_SMC_CYCLE(n) (AT91_SMC + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */
12606 +#define AT91_SMC_NWECYCLE (0x1ff << 0 ) /* Total Write Cycle Length */
12607 +#define AT91_SMC_NWECYCLE_(x) ((x) << 0)
12608 +#define AT91_SMC_NRDCYCLE (0x1ff << 16) /* Total Read Cycle Length */
12609 +#define AT91_SMC_NRDCYCLE_(x) ((x) << 16)
12611 +#define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
12612 +#define AT91_SMC_READMODE (1 << 0) /* Read Mode */
12613 +#define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */
12614 +#define AT91_SMC_EXNWMODE (3 << 4) /* NWAIT Mode */
12615 +#define AT91_SMC_EXNWMODE_DISABLE (0 << 4)
12616 +#define AT91_SMC_EXNWMODE_FROZEN (2 << 4)
12617 +#define AT91_SMC_EXNWMODE_READY (3 << 4)
12618 +#define AT91_SMC_BAT (1 << 8) /* Byte Access Type */
12619 +#define AT91_SMC_BAT_SELECT (0 << 8)
12620 +#define AT91_SMC_BAT_WRITE (1 << 8)
12621 +#define AT91_SMC_DBW (3 << 12) /* Data Bus Width */
12622 +#define AT91_SMC_DBW_8 (0 << 12)
12623 +#define AT91_SMC_DBW_16 (1 << 12)
12624 +#define AT91_SMC_DBW_32 (2 << 12)
12625 +#define AT91_SMC_TDF (0xf << 16) /* Data Float Time. */
12626 +#define AT91_SMC_TDF_(x) ((x) << 16)
12627 +#define AT91_SMC_TDFMODE (1 << 20) /* TDF Optimization - Enabled */
12628 +#define AT91_SMC_PMEN (1 << 24) /* Page Mode Enabled */
12629 +#define AT91_SMC_PS (3 << 28) /* Page Size */
12630 +#define AT91_SMC_PS_4 (0 << 28)
12631 +#define AT91_SMC_PS_8 (1 << 28)
12632 +#define AT91_SMC_PS_16 (2 << 28)
12633 +#define AT91_SMC_PS_32 (3 << 28)
12635 +#if defined(AT91_SMC1) /* The AT91SAM9263 has 2 Static Memory contollers */
12636 +#define AT91_SMC1_SETUP(n) (AT91_SMC1 + 0x00 + ((n)*0x10)) /* Setup Register for CS n */
12637 +#define AT91_SMC1_PULSE(n) (AT91_SMC1 + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */
12638 +#define AT91_SMC1_CYCLE(n) (AT91_SMC1 + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */
12639 +#define AT91_SMC1_MODE(n) (AT91_SMC1 + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
12643 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/at91sam9rl.h linux-2.6/include/asm-arm/arch-at91/at91sam9rl.h
12644 --- linux-2.6.25/include/asm-arm/arch-at91/at91sam9rl.h 2008-05-03 00:15:51.000000000 +0200
12645 +++ linux-2.6/include/asm-arm/arch-at91/at91sam9rl.h 2008-04-18 19:22:02.000000000 +0200
12646 @@ -110,6 +110,6 @@
12647 #define AT91SAM9RL_ROM_SIZE (2 * SZ_16K) /* Internal ROM size (32Kb) */
12649 #define AT91SAM9RL_LCDC_BASE 0x00500000 /* LCD Controller */
12650 -#define AT91SAM9RL_UDPHS_BASE 0x00600000 /* USB Device HS controller */
12651 +#define AT91SAM9RL_UDPHS_FIFO 0x00600000 /* USB Device HS controller */
12654 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/board.h linux-2.6/include/asm-arm/arch-at91/board.h
12655 --- linux-2.6.25/include/asm-arm/arch-at91/board.h 2008-05-03 00:15:51.000000000 +0200
12656 +++ linux-2.6/include/asm-arm/arch-at91/board.h 2008-05-02 00:40:32.000000000 +0200
12658 #include <linux/i2c.h>
12659 #include <linux/leds.h>
12660 #include <linux/spi/spi.h>
12661 +#include <linux/usb/atmel_usba_udc.h>
12664 struct at91_udc_data {
12667 extern void __init at91_add_device_udc(struct at91_udc_data *data);
12669 + /* USB High Speed Device */
12670 +extern void __init at91_add_device_usba(struct usba_platform_data *data);
12672 /* Compact Flash */
12673 struct at91_cf_data {
12674 u8 irq_pin; /* I/O IRQ */
12675 @@ -158,6 +162,9 @@
12677 extern void __init at91_add_device_isi(void);
12679 + /* Touchscreen Controller */
12680 +extern void __init at91_add_device_tsadcc(void);
12683 extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);
12684 extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
12685 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/cpu.h linux-2.6/include/asm-arm/arch-at91/cpu.h
12686 --- linux-2.6.25/include/asm-arm/arch-at91/cpu.h 2008-05-03 00:15:51.000000000 +0200
12687 +++ linux-2.6/include/asm-arm/arch-at91/cpu.h 2008-05-05 22:10:58.000000000 +0200
12689 return (at91_sys_read(AT91_DBGU_CIDR) & AT91_CIDR_ARCH);
12692 +#ifdef CONFIG_ARCH_AT91CAP9
12693 +#include <asm/arch/at91_pmc.h>
12695 +#define ARCH_REVISION_CAP9_B 0x399
12696 +#define ARCH_REVISION_CAP9_C 0x601
12698 +static inline unsigned long at91cap9_rev_identify(void)
12700 + return (at91_sys_read(AT91_PMC_VER));
12704 #ifdef CONFIG_ARCH_AT91RM9200
12705 #define cpu_is_at91rm9200() (at91_cpu_identify() == ARCH_ID_AT91RM9200)
12708 #ifdef CONFIG_ARCH_AT91CAP9
12709 #define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9)
12710 +#define cpu_is_at91cap9_revB() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_B)
12711 +#define cpu_is_at91cap9_revC() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_C)
12713 #define cpu_is_at91cap9() (0)
12714 +#define cpu_is_at91cap9_revB() (0)
12715 +#define cpu_is_at91cap9_revC() (0)
12719 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/ics1523.h linux-2.6/include/asm-arm/arch-at91/ics1523.h
12720 --- linux-2.6.25/include/asm-arm/arch-at91/ics1523.h 1970-01-01 02:00:00.000000000 +0200
12721 +++ linux-2.6/include/asm-arm/arch-at91/ics1523.h 2008-01-16 21:24:29.000000000 +0200
12723 +//*----------------------------------------------------------------------------
12724 +//* ATMEL Microcontroller Software Support - ROUSSET -
12725 +//*----------------------------------------------------------------------------
12726 +//* The software is delivered "AS IS" without warranty or condition of any
12727 +//* kind, either express, implied or statutory. This includes without
12728 +//* limitation any warranty or condition with respect to merchantability or
12729 +//* fitness for any particular purpose, or against the infringements of
12730 +//* intellectual property rights of others.
12731 +//*----------------------------------------------------------------------------
12732 +//* File Name : ics1523.h
12733 +//* Object : Clock Generator Prototyping File.
12735 +//* 1.0 08/28/02 ED : Creation
12736 +//* 1.2 13/01/03 FB : Update on lib V3
12737 +//*----------------------------------------------------------------------------
12742 +/*-------------------------------------------*/
12743 +/* ICS1523 TWI Serial Clock Definition */
12744 +/*-------------------------------------------*/
12746 +#define ICS_MIN_CLOCK 100 /* Min Frequency Access Clock KHz */
12747 +#define ICS_MAX_CLOCK 400 /* Max Frequency Access Clock KHz */
12748 +#define ICS_TRANSFER_RATE ICS_MAX_CLOCK /* Transfer speed to apply */
12750 +#define ICS_WRITE_CLK_PNB 30 /* TWCK Clock Periods required to write */
12751 +#define ICS_READ_CLK_PNB 40 /* TWCK Clock Periods required to read */
12753 +/*-------------------------------------------*/
12754 +/* ICS1523 Write Operation Definition */
12755 +/*-------------------------------------------*/
12757 +#define ICS1523_ACCESS_OK 0 /* OK */
12758 +#define ICS1523_ACCESS_ERROR -1 /* NOK */
12760 +/*-------------------------------------------*/
12761 +/* ICS1523 Device Addresses Definition */
12762 +/*-------------------------------------------*/
12764 +#define ICS_ADDR 0x26 /* Device Address */
12766 +/*--------------------------------------------------*/
12767 +/* ICS1523 Registers Internal Addresses Definition */
12768 +/*--------------------------------------------------*/
12770 +#define ICS_ICR 0x0 /* Input Control Register */
12771 +#define ICS_LCR 0x1 /* Loop Control Register */
12772 +#define ICS_FD0 0x2 /* PLL FeedBack Divider LSBs */
12773 +#define ICS_FD1 0x3 /* PLL FeedBack Divider MSBs */
12774 +#define ICS_DPAO 0x4 /* Dynamic Phase Aligner Offset */
12775 +#define ICS_DPAC 0x5 /* Dynamic Phase Aligner Resolution */
12776 +#define ICS_OE 0x6 /* Output Enables Register */
12777 +#define ICS_OD 0x7 /* Osc Divider Register */
12778 +#define ICS_SWRST 0x8 /* DPA & PLL Reset Register */
12779 +#define ICS_VID 0x10 /* Chip Version Register */
12780 +#define ICS_RID 0x11 /* Chip Revision Register */
12781 +#define ICS_SR 0x12 /* Status Register */
12783 +/*------------------------------------------------------*/
12784 +/* ICS1523 Input Control Register Bits Definition */
12785 +/*------------------------------------------------------*/
12787 +#define ICS_PDEN 0x1 /* Phase Detector Enable */
12788 +#define ICS_PDPOL 0x2 /* Phase Detector Enable Polarity */
12789 +#define ICS_REFPOL 0x4 /* External Reference Polarity */
12790 +#define ICS_FBKPOL 0x8 /* External Feedback Polarity */
12791 +#define ICS_FBKSEL 0x10 /* External Feedback Select */
12792 +#define ICS_FUNCSEL 0x20 /* Function Out Select */
12793 +#define ICS_ENPLS 0x40 /* Enable PLL Lock/Ref Status Output */
12794 +#define ICS_ENDLS 0x80 /* Enable DPA Lock/Ref Status Output */
12796 +/*-----------------------------------------------------*/
12797 +/* ICS1523 Loop Control Register Bits Definition */
12798 +/*-----------------------------------------------------*/
12800 +#define ICS_PFD 0x7 /* Phase Detector Gain */
12801 +#define ICS_PSD 0x30 /* Post-Scaler Divider */
12803 +/*----------------------------------------------------*/
12804 +/* ICS1523 PLL FeedBack Divider LSBs Definition */
12805 +/*----------------------------------------------------*/
12807 +#define ICS_FBDL 0xFF /* PLL FeedBack Divider LSBs */
12809 +/*----------------------------------------------------*/
12810 +/* ICS1523 PLL FeedBack Divider MSBs Definition */
12811 +/*----------------------------------------------------*/
12813 +#define ICS_FBDM 0xF /* PLL FeedBack Divider MSBs */
12815 +/*------------------------------------------------------------*/
12816 +/* ICS1523 Dynamic Phase Aligner Offset Bits Definition */
12817 +/*------------------------------------------------------------*/
12819 +#define ICS_DPAOS 0x2F /* Dynamic Phase Aligner Offset */
12820 +#define ICS_FILSEL 0x80 /* Loop Filter Select */
12822 +/*----------------------------------------------------------------*/
12823 +/* ICS1523 Dynamic Phase Aligner Resolution Bits Definition */
12824 +/*----------------------------------------------------------------*/
12826 +#define ICS_DPARES 0x3 /* Dynamic Phase Aligner Resolution */
12827 +#define ICS_MMREV 0xFC /* Metal Mask Revision Number */
12829 +/*-------------------------------------------------------*/
12830 +/* ICS1523 Output Enables Register Bits Definition */
12831 +/*-------------------------------------------------------*/
12833 +#define ICS_OEPCK 0x1 /* Output Enable for PECL PCLK Outputs */
12834 +#define ICS_OETCK 0x2 /* Output Enable for STTL CLK Output */
12835 +#define ICS_OEP2 0x4 /* Output Enable for PECL CLK/2 Outputs */
12836 +#define ICS_OET2 0x8 /* Output Enable for STTL CLK/2 Output */
12837 +#define ICS_OEF 0x10 /* Output Enable for STTL FUNC Output */
12838 +#define ICS_CLK2INV 0x20 /* CLK/2 Invert */
12839 +#define ICS_OSCL 0xC0 /* SSTL Clock Scaler */
12841 +/*----------------------------------------------------*/
12842 +/* ICS1523 Osc Divider Register Bits Definition */
12843 +/*----------------------------------------------------*/
12845 +#define ICS_OSCDIV 0x7F /* Oscillator Divider Modulus */
12846 +#define ICS_INSEL 0x80 /* Input Select */
12848 +/*---------------------------------------------------*/
12849 +/* ICS1523 DPA & PLL Reset Register Definition */
12850 +/*---------------------------------------------------*/
12852 +#define ICS_DPAR 0x0A /* DPA Reset Command */
12853 +#define ICS_PLLR 0x50 /* PLL Reset Command */
12855 +/*------------------------------------------------*/
12856 +/* ICS1523 Chip Version Register Definition */
12857 +/*------------------------------------------------*/
12859 +#define ICS_CHIPV 0xFF /* Chip Version */
12861 +/*-------------------------------------------------*/
12862 +/* ICS1523 Chip Revision Register Definition */
12863 +/*-------------------------------------------------*/
12865 +#define ICS_CHIPR 0xFF /* Chip Revision */
12867 +/*------------------------------------------*/
12868 +/* ICS1523 Status Register Definition */
12869 +/*------------------------------------------*/
12871 +#define ICS_DPALOCK 0x1 /* DPA Lock Status */
12872 +#define ICS_PLLLOCK 0x2 /* PLL Lock Status */
12874 +int at91_ics1523_init(void);
12876 +#endif /* ics1523_h */
12877 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/spi.h linux-2.6/include/asm-arm/arch-at91/spi.h
12878 --- linux-2.6.25/include/asm-arm/arch-at91/spi.h 1970-01-01 02:00:00.000000000 +0200
12879 +++ linux-2.6/include/asm-arm/arch-at91/spi.h 2008-01-16 21:24:29.000000000 +0200
12882 + * Serial Peripheral Interface (SPI) driver for the Atmel AT91RM9200
12884 + * (c) SAN People (Pty) Ltd
12886 + * This program is free software; you can redistribute it and/or
12887 + * modify it under the terms of the GNU General Public License
12888 + * as published by the Free Software Foundation; either version
12889 + * 2 of the License, or (at your option) any later version.
12892 +#ifndef AT91_LEGACY_SPI_H
12893 +#define AT91_LEGACY_SPI_H
12895 +#define SPI_MAJOR 153 /* registered device number */
12897 +#define DEFAULT_SPI_CLK 6000000
12900 +/* Maximum number of buffers in a single SPI transfer.
12901 + * DataFlash uses maximum of 2
12902 + * spidev interface supports up to 8.
12904 +#define MAX_SPI_TRANSFERS 8
12905 +#define NR_SPI_DEVICES 4 /* number of devices on SPI bus */
12908 + * Describes the buffers for a SPI transfer.
12909 + * A transmit & receive buffer must be specified for each transfer
12911 +struct spi_transfer_list {
12912 + void* tx[MAX_SPI_TRANSFERS]; /* transmit */
12913 + int txlen[MAX_SPI_TRANSFERS];
12914 + void* rx[MAX_SPI_TRANSFERS]; /* receive */
12915 + int rxlen[MAX_SPI_TRANSFERS];
12916 + int nr_transfers; /* number of transfers */
12917 + int curr; /* current transfer */
12920 +struct spi_local {
12921 + unsigned int pcs; /* Peripheral Chip Select value */
12923 + struct spi_transfer_list *xfers; /* current transfer list */
12924 + dma_addr_t tx, rx; /* DMA address for current transfer */
12925 + dma_addr_t txnext, rxnext; /* DMA address for next transfer */
12929 +/* Exported functions */
12930 +extern void spi_access_bus(short device);
12931 +extern void spi_release_bus(short device);
12932 +extern int spi_transfer(struct spi_transfer_list* list);
12935 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-at91/timex.h linux-2.6/include/asm-arm/arch-at91/timex.h
12936 --- linux-2.6.25/include/asm-arm/arch-at91/timex.h 2008-05-03 00:15:51.000000000 +0200
12937 +++ linux-2.6/include/asm-arm/arch-at91/timex.h 2008-04-18 18:30:40.000000000 +0200
12938 @@ -27,14 +27,29 @@
12940 #define CLOCK_TICK_RATE (AT91_SLOW_CLOCK)
12942 -#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9261)
12943 +#elif defined(CONFIG_ARCH_AT91SAM9260)
12945 +#if defined(CONFIG_MACH_USB_A9260) || defined(CONFIG_MACH_QIL_A9260)
12946 +#define AT91SAM9_MASTER_CLOCK 90000000
12948 +#define AT91SAM9_MASTER_CLOCK 99300000
12951 +#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
12953 +#elif defined(CONFIG_ARCH_AT91SAM9261)
12955 #define AT91SAM9_MASTER_CLOCK 99300000
12956 #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
12958 #elif defined(CONFIG_ARCH_AT91SAM9263)
12960 +#if defined(CONFIG_MACH_USB_A9263)
12961 +#define AT91SAM9_MASTER_CLOCK 90000000
12963 #define AT91SAM9_MASTER_CLOCK 99959500
12966 #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
12968 #elif defined(CONFIG_ARCH_AT91SAM9RL)
12969 diff -urN -x CVS linux-2.6.25/include/asm-arm/arch-ks8695/devices.h linux-2.6/include/asm-arm/arch-ks8695/devices.h
12970 --- linux-2.6.25/include/asm-arm/arch-ks8695/devices.h 2007-10-09 22:31:38.000000000 +0200
12971 +++ linux-2.6/include/asm-arm/arch-ks8695/devices.h 2007-12-31 10:44:34.000000000 +0200
12973 extern void __init ks8695_add_device_lan(void);
12974 extern void __init ks8695_add_device_hpna(void);
12977 +extern short ks8695_leds_cpu;
12978 +extern short ks8695_leds_timer;
12979 +extern void __init ks8695_init_leds(u8 cpu_led, u8 timer_led);
12982 #define KS8695_MODE_PCI 0
12983 #define KS8695_MODE_MINIPCI 1
12984 diff -urN -x CVS linux-2.6.25/include/linux/clk.h linux-2.6/include/linux/clk.h
12985 --- linux-2.6.25/include/linux/clk.h 2007-10-09 22:31:38.000000000 +0200
12986 +++ linux-2.6/include/linux/clk.h 2007-12-31 10:44:34.000000000 +0200
12987 @@ -121,4 +121,24 @@
12989 struct clk *clk_get_parent(struct clk *clk);
12992 + * clk_must_disable - report whether a clock's users must disable it
12993 + * @clk: one node in the clock tree
12995 + * This routine returns true only if the upcoming system state requires
12996 + * disabling the specified clock.
12998 + * It's common for platform power states to constrain certain clocks (and
12999 + * their descendants) to be unavailable, while other states allow that
13000 + * clock to be active. A platform's power states often include an "all on"
13001 + * mode; system wide sleep states like "standby" or "suspend-to-RAM"; and
13002 + * operating states which sacrifice functionality for lower power usage.
13004 + * The constraint value is commonly tested in device driver suspend(), to
13005 + * leave clocks active if they are needed for features like wakeup events.
13006 + * On platforms that support reduced functionality operating states, the
13007 + * constraint may also need to be tested during resume() and probe() calls.
13009 +int clk_must_disable(struct clk *clk);
13012 diff -urN -x CVS linux-2.6.25/include/linux/i2c-id.h linux-2.6/include/linux/i2c-id.h
13013 --- linux-2.6.25/include/linux/i2c-id.h 2008-05-03 00:15:52.000000000 +0200
13014 +++ linux-2.6/include/linux/i2c-id.h 2008-03-09 15:43:48.000000000 +0200
13015 @@ -131,6 +131,7 @@
13017 /* --- PCA 9564 based algorithms */
13018 #define I2C_HW_A_ISA 0x1a0000 /* generic ISA Bus interface card */
13019 +#define I2C_HW_A_PLAT 0x1a0001 /* generic platform_bus interface */
13021 /* --- PowerPC on-chip adapters */
13022 #define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */
13023 diff -urN -x CVS linux-2.6.25/include/linux/usb/atmel_usba_udc.h linux-2.6/include/linux/usb/atmel_usba_udc.h
13024 --- linux-2.6.25/include/linux/usb/atmel_usba_udc.h 1970-01-01 02:00:00.000000000 +0200
13025 +++ linux-2.6/include/linux/usb/atmel_usba_udc.h 2008-05-03 00:31:09.000000000 +0200
13028 +* Platform data definitions for Atmel USBA gadget driver.
13030 +#ifndef __LINUX_USB_USBA_H
13031 +#define __LINUX_USB_USBA_H
13033 +struct usba_ep_data {
13042 +struct usba_platform_data {
13045 + struct usba_ep_data ep[0];
13048 +#endif /* __LINUX_USB_USBA_H */
13050 diff -urN -x CVS linux-2.6.25/include/video/atmel_lcdc.h linux-2.6/include/video/atmel_lcdc.h
13051 --- linux-2.6.25/include/video/atmel_lcdc.h 2008-05-03 00:15:53.000000000 +0200
13052 +++ linux-2.6/include/video/atmel_lcdc.h 2008-03-09 15:53:40.000000000 +0200
13056 bool lcdcon_is_backlight;
13060 unsigned int default_lcdcon2;
13061 diff -urN -x CVS linux-2.6.25/sound/soc/at91/eti_b1_wm8731.c linux-2.6/sound/soc/at91/eti_b1_wm8731.c
13062 --- linux-2.6.25/sound/soc/at91/eti_b1_wm8731.c 2008-05-03 00:15:56.000000000 +0200
13063 +++ linux-2.6/sound/soc/at91/eti_b1_wm8731.c 2008-03-09 15:15:07.000000000 +0200
13065 #include <sound/soc.h>
13066 #include <sound/soc-dapm.h>
13068 -#include <asm/arch/hardware.h>
13069 -#include <asm/arch/at91_pio.h>
13070 +#include <asm/hardware.h>
13071 #include <asm/arch/gpio.h>
13073 #include "../codecs/wm8731.h"
13078 -#define AT91_PIO_TF1 (1 << (AT91_PIN_PB6 - PIN_BASE) % 32)
13079 -#define AT91_PIO_TK1 (1 << (AT91_PIN_PB7 - PIN_BASE) % 32)
13080 -#define AT91_PIO_TD1 (1 << (AT91_PIN_PB8 - PIN_BASE) % 32)
13081 -#define AT91_PIO_RD1 (1 << (AT91_PIN_PB9 - PIN_BASE) % 32)
13082 -#define AT91_PIO_RK1 (1 << (AT91_PIN_PB10 - PIN_BASE) % 32)
13083 -#define AT91_PIO_RF1 (1 << (AT91_PIN_PB11 - PIN_BASE) % 32)
13085 static struct clk *pck1_clk;
13086 static struct clk *pllb_clk;
13088 @@ -276,7 +268,6 @@
13089 static int __init eti_b1_init(void)
13092 - u32 ssc_pio_lines;
13093 struct at91_ssc_periph *ssc = eti_b1_dai.cpu_dai->private_data;
13095 if (!request_mem_region(AT91RM9200_BASE_SSC1, SZ_16K, "soc-audio")) {
13096 @@ -310,19 +301,12 @@
13097 goto fail_io_unmap;
13100 - ssc_pio_lines = AT91_PIO_TF1 | AT91_PIO_TK1 | AT91_PIO_TD1
13101 - | AT91_PIO_RD1 /* | AT91_PIO_RK1 */ | AT91_PIO_RF1;
13103 - /* Reset all PIO registers and assign lines to peripheral A */
13104 - at91_sys_write(AT91_PIOB + PIO_PDR, ssc_pio_lines);
13105 - at91_sys_write(AT91_PIOB + PIO_ODR, ssc_pio_lines);
13106 - at91_sys_write(AT91_PIOB + PIO_IFDR, ssc_pio_lines);
13107 - at91_sys_write(AT91_PIOB + PIO_CODR, ssc_pio_lines);
13108 - at91_sys_write(AT91_PIOB + PIO_IDR, ssc_pio_lines);
13109 - at91_sys_write(AT91_PIOB + PIO_MDDR, ssc_pio_lines);
13110 - at91_sys_write(AT91_PIOB + PIO_PUDR, ssc_pio_lines);
13111 - at91_sys_write(AT91_PIOB + PIO_ASR, ssc_pio_lines);
13112 - at91_sys_write(AT91_PIOB + PIO_OWDR, ssc_pio_lines);
13113 + at91_set_A_periph(AT91_PIN_PB6, 0); /* TF1 */
13114 + at91_set_A_periph(AT91_PIN_PB7, 0); /* TK1 */
13115 + at91_set_A_periph(AT91_PIN_PB8, 0); /* TD1 */
13116 + at91_set_A_periph(AT91_PIN_PB9, 0); /* RD1 */
13117 +/* at91_set_A_periph(AT91_PIN_PB10, 0);*/ /* RK1 */
13118 + at91_set_A_periph(AT91_PIN_PB11, 0); /* RF1 */
13121 * Set PCK1 parent to PLLB and its rate to 12 Mhz.
13122 diff -urN -x CVS linux-2.6.25/sound/spi/at73c213.c linux-2.6/sound/spi/at73c213.c
13123 --- linux-2.6.25/sound/spi/at73c213.c 2008-05-03 00:15:56.000000000 +0200
13124 +++ linux-2.6/sound/spi/at73c213.c 2008-03-09 15:15:07.000000000 +0200
13125 @@ -114,7 +114,11 @@
13126 static struct snd_pcm_hardware snd_at73c213_playback_hw = {
13127 .info = SNDRV_PCM_INFO_INTERLEAVED |
13128 SNDRV_PCM_INFO_BLOCK_TRANSFER,
13129 +#ifdef __BIG_ENDIAN
13130 .formats = SNDRV_PCM_FMTBIT_S16_BE,
13132 + .formats = SNDRV_PCM_FMTBIT_S16_LE,
13134 .rates = SNDRV_PCM_RATE_CONTINUOUS,
13135 .rate_min = 8000, /* Replaced by chip->bitrate later. */
13136 .rate_max = 50000, /* Replaced by chip->bitrate later. */