1 diff -urN linux-2.6.24.3/arch/avr32/boards/atngw100/Kconfig avr32-2.6/arch/avr32/boards/atngw100/Kconfig
2 --- linux-2.6.24.3/arch/avr32/boards/atngw100/Kconfig 1970-01-01 01:00:00.000000000 +0100
3 +++ avr32-2.6/arch/avr32/boards/atngw100/Kconfig 2008-04-23 19:33:28.000000000 +0200
5 +# NGW100 customization
7 +config BOARD_ATNGW100_I2C_GPIO
8 + bool "Use GPIO for i2c instead of built-in TWI module"
10 + The driver for the built-in TWI module has been plagued by
11 + various problems, while the i2c-gpio driver is based on the
12 + trusty old i2c-algo-bit bitbanging engine, making it work
13 + on pretty much any setup.
15 + Choose 'Y' here if you're having i2c-related problems and
16 + want to rule out the i2c bus driver.
17 diff -urN linux-2.6.24.3/arch/avr32/boards/atngw100/setup.c avr32-2.6/arch/avr32/boards/atngw100/setup.c
18 --- linux-2.6.24.3/arch/avr32/boards/atngw100/setup.c 2008-02-26 01:20:20.000000000 +0100
19 +++ avr32-2.6/arch/avr32/boards/atngw100/setup.c 2008-04-23 20:12:35.000000000 +0200
22 #include <asm/setup.h>
24 -#include <asm/arch/at32ap7000.h>
25 +#include <asm/arch/at32ap700x.h>
26 #include <asm/arch/board.h>
27 #include <asm/arch/init.h>
28 #include <asm/arch/portmux.h>
30 static struct spi_board_info spi0_board_info[] __initdata = {
32 .modalias = "mtd_dataflash",
33 - .max_speed_hz = 10000000,
34 + .max_speed_hz = 8000000,
39 +static struct mci_platform_data __initdata mci0_data = {
40 + .detect_pin = GPIO_PIN_PC(25),
41 + .wp_pin = GPIO_PIN_PE(0),
45 * The next two functions should go away as the boot loader is
46 * supposed to initialize the macb address registers with a valid
51 +#ifdef CONFIG_BOARD_ATNGW100_I2C_GPIO
52 static struct i2c_gpio_platform_data i2c_gpio_data = {
53 .sda_pin = GPIO_PIN_PA(6),
54 .scl_pin = GPIO_PIN_PA(7),
56 .platform_data = &i2c_gpio_data,
61 static int __init atngw100_init(void)
64 set_hw_addr(at32_add_device_eth(1, ð_data[1]));
66 at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
67 + at32_add_device_mci(0, &mci0_data);
68 at32_add_device_usba(0, NULL);
70 for (i = 0; i < ARRAY_SIZE(ngw_leds); i++) {
73 platform_device_register(&ngw_gpio_leds);
75 +#ifdef CONFIG_BOARD_ATNGW100_I2C_GPIO
76 at32_select_gpio(i2c_gpio_data.sda_pin,
77 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
78 at32_select_gpio(i2c_gpio_data.scl_pin,
79 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
80 platform_device_register(&i2c_gpio_device);
82 + at32_add_device_twi(0, NULL, 0);
87 diff -urN linux-2.6.24.3/arch/avr32/boards/atstk1000/atstk1000.h avr32-2.6/arch/avr32/boards/atstk1000/atstk1000.h
88 --- linux-2.6.24.3/arch/avr32/boards/atstk1000/atstk1000.h 2008-02-26 01:20:20.000000000 +0100
89 +++ avr32-2.6/arch/avr32/boards/atstk1000/atstk1000.h 2008-04-23 19:33:28.000000000 +0200
92 extern struct atmel_lcdfb_info atstk1000_lcdc_data;
94 +void atstk1000_setup_j2_leds(void);
96 #endif /* __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H */
97 diff -urN linux-2.6.24.3/arch/avr32/boards/atstk1000/atstk1002.c avr32-2.6/arch/avr32/boards/atstk1000/atstk1002.c
98 --- linux-2.6.24.3/arch/avr32/boards/atstk1000/atstk1002.c 2008-02-26 01:20:20.000000000 +0100
99 +++ avr32-2.6/arch/avr32/boards/atstk1000/atstk1002.c 2008-04-23 20:12:35.000000000 +0200
101 #include <linux/etherdevice.h>
102 #include <linux/init.h>
103 #include <linux/kernel.h>
104 -#include <linux/leds.h>
105 #include <linux/platform_device.h>
106 #include <linux/string.h>
107 #include <linux/types.h>
111 #include <asm/setup.h>
112 -#include <asm/arch/at32ap7000.h>
113 +#include <asm/arch/at32ap700x.h>
114 #include <asm/arch/board.h>
115 #include <asm/arch/init.h>
116 #include <asm/arch/portmux.h>
121 -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
122 -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
123 +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
124 static struct at73c213_board_info at73c213_data = {
126 .shortname = "AVR32 STK1000 external DAC",
131 -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
132 +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM
133 static struct spi_board_info spi0_board_info[] __initdata = {
134 -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
135 +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
138 .modalias = "at73c213",
143 -#ifdef CONFIG_BOARD_ATSTK1002_SPI1
144 +#ifdef CONFIG_BOARD_ATSTK100X_SPI1
145 static struct spi_board_info spi1_board_info[] __initdata = { {
146 /* patch in custom entries here */
150 +static struct cf_platform_data __initdata cf0_data = {
151 +#ifdef CONFIG_BOARD_ATSTK1000_CF_HACKS
152 + .detect_pin = CONFIG_BOARD_ATSTK1000_CF_DETECT_PIN,
153 + .reset_pin = CONFIG_BOARD_ATSTK1000_CF_RESET_PIN,
155 + .detect_pin = GPIO_PIN_NONE,
156 + .reset_pin = GPIO_PIN_NONE,
158 + .vcc_pin = GPIO_PIN_NONE,
159 + .ready_pin = GPIO_PIN_PB(27),
164 * The next two functions should go away as the boot loader is
165 * supposed to initialize the macb address registers with a valid
170 -#ifdef CONFIG_BOARD_ATSTK1002_J2_LED
172 -static struct gpio_led stk_j2_led[] = {
173 -#ifdef CONFIG_BOARD_ATSTK1002_J2_LED8
174 -#define LEDSTRING "J2 jumpered to LED8"
175 - { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), },
176 - { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), },
177 - { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), },
178 - { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), },
179 - { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), },
180 - { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), },
181 - { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), },
182 - { .name = "led7:amber", .gpio = GPIO_PIN_PB(30),
183 - .default_trigger = "heartbeat", },
185 -#define LEDSTRING "J2 jumpered to RGB LEDs"
186 - { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), },
187 - { .name = "g1:green", .gpio = GPIO_PIN_PB(10), },
188 - { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), },
190 - { .name = "r2:red", .gpio = GPIO_PIN_PB( 9),
191 - .default_trigger = "heartbeat", },
192 - { .name = "g2:green", .gpio = GPIO_PIN_PB(13), },
193 - { .name = "b2:blue", .gpio = GPIO_PIN_PB(15),
194 - .default_trigger = "heartbeat", },
195 - /* PB16, PB30 unused */
199 -static struct gpio_led_platform_data stk_j2_led_data = {
200 - .num_leds = ARRAY_SIZE(stk_j2_led),
201 - .leds = stk_j2_led,
204 -static struct platform_device stk_j2_led_dev = {
205 - .name = "leds-gpio",
206 - .id = 2, /* gpio block J2 */
208 - .platform_data = &stk_j2_led_data,
212 -static void setup_j2_leds(void)
216 - for (i = 0; i < ARRAY_SIZE(stk_j2_led); i++)
217 - at32_select_gpio(stk_j2_led[i].gpio, AT32_GPIOF_OUTPUT);
219 - printk("STK1002: " LEDSTRING "\n");
220 - platform_device_register(&stk_j2_led_dev);
224 -static void setup_j2_leds(void)
229 -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
230 -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
231 -static void __init at73c213_set_clk(struct at73c213_board_info *info)
232 +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
233 +static void __init atstk1002_setup_extdac(void)
240 at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
241 - info->dac_clk = gclk;
242 + at73c213_data.dac_clk = gclk;
246 @@ -229,12 +179,16 @@
253 +static void __init atstk1002_setup_extdac(void)
257 +#endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */
259 void __init setup_board(void)
261 -#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
262 +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
263 at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */
265 at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
268 at32_add_system_devices();
270 -#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
271 +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
272 at32_add_device_usart(1);
274 at32_add_device_usart(0);
275 @@ -281,12 +235,16 @@
276 #ifndef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM
277 set_hw_addr(at32_add_device_eth(0, ð_data[0]));
279 -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
280 +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM
281 at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
283 -#ifdef CONFIG_BOARD_ATSTK1002_SPI1
284 +#ifdef CONFIG_BOARD_ATSTK100X_SPI1
285 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
287 + at32_add_device_twi(0, NULL, 0);
288 +#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
289 + at32_add_device_mci(0, NULL);
291 #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM
292 set_hw_addr(at32_add_device_eth(1, ð_data[1]));
294 @@ -294,18 +252,23 @@
295 fbmem_start, fbmem_size);
297 at32_add_device_usba(0, NULL);
298 -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
299 - at32_add_device_ssc(0, ATMEL_SSC_TX);
300 +#ifdef CONFIG_BOARD_ATSTK100X_ENABLE_AC97
301 + at32_add_device_ac97c(0);
303 + at32_add_device_abdac(0);
308 -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
309 -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
310 - at73c213_set_clk(&at73c213_data);
311 +#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
312 + at32_add_device_ssc(0, ATMEL_SSC_TX);
314 + at32_add_device_cf(0, 2, &cf0_data);
315 +#ifdef CONFIG_BOARD_ATSTK100X_ENABLE_PSIF
316 + at32_add_device_psif(0);
317 + at32_add_device_psif(1);
320 + atstk1000_setup_j2_leds();
321 + atstk1002_setup_extdac();
325 postcore_initcall(atstk1002_init);
326 diff -urN linux-2.6.24.3/arch/avr32/boards/atstk1000/atstk1003.c avr32-2.6/arch/avr32/boards/atstk1000/atstk1003.c
327 --- linux-2.6.24.3/arch/avr32/boards/atstk1000/atstk1003.c 1970-01-01 01:00:00.000000000 +0100
328 +++ avr32-2.6/arch/avr32/boards/atstk1000/atstk1003.c 2008-04-23 20:12:35.000000000 +0200
331 + * ATSTK1003 daughterboard-specific init code
333 + * Copyright (C) 2007 Atmel Corporation
335 + * This program is free software; you can redistribute it and/or modify
336 + * it under the terms of the GNU General Public License version 2 as
337 + * published by the Free Software Foundation.
339 +#include <linux/clk.h>
340 +#include <linux/err.h>
341 +#include <linux/init.h>
342 +#include <linux/kernel.h>
343 +#include <linux/platform_device.h>
344 +#include <linux/string.h>
345 +#include <linux/types.h>
347 +#include <linux/spi/at73c213.h>
348 +#include <linux/spi/spi.h>
350 +#include <asm/setup.h>
352 +#include <asm/arch/at32ap700x.h>
353 +#include <asm/arch/board.h>
354 +#include <asm/arch/init.h>
355 +#include <asm/arch/portmux.h>
357 +#include "atstk1000.h"
359 +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
360 +static struct at73c213_board_info at73c213_data = {
362 + .shortname = "AVR32 STK1000 external DAC",
366 +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM
367 +static struct spi_board_info spi0_board_info[] __initdata = {
368 +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
371 + .modalias = "at73c213",
372 + .max_speed_hz = 200000,
374 + .mode = SPI_MODE_1,
375 + .platform_data = &at73c213_data,
379 + * We can control the LTV350QV LCD panel, but it isn't much
380 + * point since we don't have an LCD controller...
385 +#ifdef CONFIG_BOARD_ATSTK100X_SPI1
386 +static struct spi_board_info spi1_board_info[] __initdata = { {
387 + /* patch in custom entries here */
391 +static struct cf_platform_data __initdata cf0_data = {
392 +#ifdef CONFIG_BOARD_ATSTK1000_CF_HACKS
393 + .detect_pin = CONFIG_BOARD_ATSTK1000_CF_DETECT_PIN,
394 + .reset_pin = CONFIG_BOARD_ATSTK1000_CF_RESET_PIN,
396 + .detect_pin = GPIO_PIN_NONE,
397 + .reset_pin = GPIO_PIN_NONE,
399 + .vcc_pin = GPIO_PIN_NONE,
400 + .ready_pin = GPIO_PIN_PB(27),
404 +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
405 +static void __init atstk1003_setup_extdac(void)
410 + gclk = clk_get(NULL, "gclk0");
413 + pll = clk_get(NULL, "pll0");
417 + if (clk_set_parent(gclk, pll)) {
418 + pr_debug("STK1000: failed to set pll0 as parent for DAC clock\n");
422 + at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
423 + at73c213_data.dac_clk = gclk;
433 +static void __init atstk1003_setup_extdac(void)
437 +#endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */
439 +void __init setup_board(void)
441 +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
442 + at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */
444 + at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
446 + /* USART 2/unused: expansion connector */
447 + at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */
449 + at32_setup_serial_console(0);
452 +static int __init atstk1003_init(void)
455 + * ATSTK1000 uses 32-bit SDRAM interface. Reserve the
456 + * SDRAM-specific pins so that nobody messes with them.
458 + at32_reserve_pin(GPIO_PIN_PE(0)); /* DATA[16] */
459 + at32_reserve_pin(GPIO_PIN_PE(1)); /* DATA[17] */
460 + at32_reserve_pin(GPIO_PIN_PE(2)); /* DATA[18] */
461 + at32_reserve_pin(GPIO_PIN_PE(3)); /* DATA[19] */
462 + at32_reserve_pin(GPIO_PIN_PE(4)); /* DATA[20] */
463 + at32_reserve_pin(GPIO_PIN_PE(5)); /* DATA[21] */
464 + at32_reserve_pin(GPIO_PIN_PE(6)); /* DATA[22] */
465 + at32_reserve_pin(GPIO_PIN_PE(7)); /* DATA[23] */
466 + at32_reserve_pin(GPIO_PIN_PE(8)); /* DATA[24] */
467 + at32_reserve_pin(GPIO_PIN_PE(9)); /* DATA[25] */
468 + at32_reserve_pin(GPIO_PIN_PE(10)); /* DATA[26] */
469 + at32_reserve_pin(GPIO_PIN_PE(11)); /* DATA[27] */
470 + at32_reserve_pin(GPIO_PIN_PE(12)); /* DATA[28] */
471 + at32_reserve_pin(GPIO_PIN_PE(13)); /* DATA[29] */
472 + at32_reserve_pin(GPIO_PIN_PE(14)); /* DATA[30] */
473 + at32_reserve_pin(GPIO_PIN_PE(15)); /* DATA[31] */
474 + at32_reserve_pin(GPIO_PIN_PE(26)); /* SDCS */
476 + at32_add_system_devices();
478 +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
479 + at32_add_device_usart(1);
481 + at32_add_device_usart(0);
483 + at32_add_device_usart(2);
485 +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM
486 + at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
488 +#ifdef CONFIG_BOARD_ATSTK100X_SPI1
489 + at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
491 +#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
492 + at32_add_device_mci(0, NULL);
494 + at32_add_device_usba(0, NULL);
495 +#ifdef CONFIG_BOARD_ATSTK100X_ENABLE_AC97
496 + at32_add_device_ac97c(0);
498 + at32_add_device_abdac(0);
500 +#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
501 + at32_add_device_ssc(0, ATMEL_SSC_TX);
503 + at32_add_device_cf(0, 2, &cf0_data);
504 +#ifdef CONFIG_BOARD_ATSTK100X_ENABLE_PSIF
505 + at32_add_device_psif(0);
506 + at32_add_device_psif(1);
509 + atstk1000_setup_j2_leds();
510 + atstk1003_setup_extdac();
514 +postcore_initcall(atstk1003_init);
515 diff -urN linux-2.6.24.3/arch/avr32/boards/atstk1000/atstk1004.c avr32-2.6/arch/avr32/boards/atstk1000/atstk1004.c
516 --- linux-2.6.24.3/arch/avr32/boards/atstk1000/atstk1004.c 1970-01-01 01:00:00.000000000 +0100
517 +++ avr32-2.6/arch/avr32/boards/atstk1000/atstk1004.c 2008-04-23 20:12:35.000000000 +0200
520 + * ATSTK1003 daughterboard-specific init code
522 + * Copyright (C) 2007 Atmel Corporation
524 + * This program is free software; you can redistribute it and/or modify
525 + * it under the terms of the GNU General Public License version 2 as
526 + * published by the Free Software Foundation.
528 +#include <linux/clk.h>
529 +#include <linux/err.h>
530 +#include <linux/init.h>
531 +#include <linux/kernel.h>
532 +#include <linux/platform_device.h>
533 +#include <linux/string.h>
534 +#include <linux/types.h>
536 +#include <linux/spi/at73c213.h>
537 +#include <linux/spi/spi.h>
539 +#include <video/atmel_lcdc.h>
541 +#include <asm/setup.h>
543 +#include <asm/arch/at32ap700x.h>
544 +#include <asm/arch/board.h>
545 +#include <asm/arch/init.h>
546 +#include <asm/arch/portmux.h>
548 +#include "atstk1000.h"
550 +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
551 +static struct at73c213_board_info at73c213_data = {
553 + .shortname = "AVR32 STK1000 external DAC",
557 +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM
558 +static struct spi_board_info spi0_board_info[] __initdata = {
559 +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
562 + .modalias = "at73c213",
563 + .max_speed_hz = 200000,
565 + .mode = SPI_MODE_1,
566 + .platform_data = &at73c213_data,
571 + .modalias = "ltv350qv",
572 + .max_speed_hz = 16000000,
574 + .mode = SPI_MODE_3,
579 +#ifdef CONFIG_BOARD_ATSTK100X_SPI1
580 +static struct spi_board_info spi1_board_info[] __initdata = { {
581 + /* patch in custom entries here */
585 +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
586 +static void __init atstk1004_setup_extdac(void)
591 + gclk = clk_get(NULL, "gclk0");
594 + pll = clk_get(NULL, "pll0");
598 + if (clk_set_parent(gclk, pll)) {
599 + pr_debug("STK1000: failed to set pll0 as parent for DAC clock\n");
603 + at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
604 + at73c213_data.dac_clk = gclk;
614 +static void __init atstk1004_setup_extdac(void)
618 +#endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */
620 +void __init setup_board(void)
622 +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
623 + at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */
625 + at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
627 + /* USART 2/unused: expansion connector */
628 + at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */
630 + at32_setup_serial_console(0);
633 +static int __init atstk1004_init(void)
635 + at32_add_system_devices();
637 +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
638 + at32_add_device_usart(1);
640 + at32_add_device_usart(0);
642 + at32_add_device_usart(2);
644 +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM
645 + at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
647 +#ifdef CONFIG_BOARD_ATSTK100X_SPI1
648 + at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
650 +#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
651 + at32_add_device_mci(0, NULL);
653 + at32_add_device_lcdc(0, &atstk1000_lcdc_data,
654 + fbmem_start, fbmem_size);
655 + at32_add_device_usba(0, NULL);
656 +#ifdef CONFIG_BOARD_ATSTK100X_ENABLE_AC97
657 + at32_add_device_ac97c(0);
659 + at32_add_device_abdac(0);
661 +#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
662 + at32_add_device_ssc(0, ATMEL_SSC_TX);
664 +#ifdef CONFIG_BOARD_ATSTK100X_ENABLE_PSIF
665 + at32_add_device_psif(0);
666 + at32_add_device_psif(1);
669 + atstk1000_setup_j2_leds();
670 + atstk1004_setup_extdac();
674 +postcore_initcall(atstk1004_init);
675 diff -urN linux-2.6.24.3/arch/avr32/boards/atstk1000/Kconfig avr32-2.6/arch/avr32/boards/atstk1000/Kconfig
676 --- linux-2.6.24.3/arch/avr32/boards/atstk1000/Kconfig 2008-02-26 01:20:20.000000000 +0100
677 +++ avr32-2.6/arch/avr32/boards/atstk1000/Kconfig 2008-04-23 20:12:35.000000000 +0200
679 # STK1000 customization
684 -config BOARD_ATSTK1002_CUSTOM
685 - bool "Non-default STK-1002 jumper settings"
687 + prompt "ATSTK1000 CPU daughterboard type"
688 + default BOARD_ATSTK1002
690 +config BOARD_ATSTK1002
692 + select CPU_AT32AP7000
694 +config BOARD_ATSTK1003
696 + select CPU_AT32AP7001
698 +config BOARD_ATSTK1004
700 + select CPU_AT32AP7002
705 +config BOARD_ATSTK100X_CUSTOM
706 + bool "Non-default STK1002/STK1003/STK1004 jumper settings"
708 You will normally leave the jumpers on the CPU card at their
709 default settings. If you need to use certain peripherals,
710 you will need to change some of those jumpers.
712 -if BOARD_ATSTK1002_CUSTOM
713 +if BOARD_ATSTK100X_CUSTOM
715 -config BOARD_ATSTK1002_SW1_CUSTOM
716 +config BOARD_ATSTK100X_SW1_CUSTOM
717 bool "SW1: use SSC1 (not SPI0)"
719 This also prevents using the external DAC as an audio interface,
720 and means you can't initialize the on-board QVGA display.
722 -config BOARD_ATSTK1002_SW2_CUSTOM
723 +config BOARD_ATSTK100X_SW2_CUSTOM
724 bool "SW2: use IRDA or TIMER0 (not UART-A, MMC/SD, and PS2-A)"
726 If you change this you'll want an updated boot loader putting
727 the console on UART-C not UART-A.
729 -config BOARD_ATSTK1002_SW3_CUSTOM
730 +config BOARD_ATSTK100X_SW3_CUSTOM
731 bool "SW3: use TIMER1 (not SSC0 and GCLK)"
733 This also prevents using the external DAC as an audio interface.
735 -config BOARD_ATSTK1002_SW4_CUSTOM
736 +config BOARD_ATSTK100X_SW4_CUSTOM
737 bool "SW4: use ISI/Camera (not GPIOs, SPI1, and PS2-B)"
739 To use the camera interface you'll need a custom card (on the
742 config BOARD_ATSTK1002_SW5_CUSTOM
743 bool "SW5: use MACB1 (not LCDC)"
744 + depends on BOARD_ATSTK1002
746 config BOARD_ATSTK1002_SW6_CUSTOM
747 bool "SW6: more GPIOs (not MACB0)"
748 + depends on BOARD_ATSTK1002
752 -config BOARD_ATSTK1002_SPI1
753 +config BOARD_ATSTK100X_SPI1
754 bool "Configure SPI1 controller"
755 - depends on !BOARD_ATSTK1002_SW4_CUSTOM
756 + depends on !BOARD_ATSTK100X_SW4_CUSTOM
758 All the signals for the second SPI controller are available on
759 GPIO lines and accessed through the J1 jumper block. Say "y"
760 here to configure that SPI controller.
762 -config BOARD_ATSTK1002_J2_LED
763 +config BOARD_ATSTK1000_J2_LED
765 - default BOARD_ATSTK1002_J2_LED8 || BOARD_ATSTK1002_J2_RGB
766 + default BOARD_ATSTK1000_J2_LED8 || BOARD_ATSTK1000_J2_RGB
769 prompt "LEDs connected to J2:"
770 - depends on LEDS_GPIO && !BOARD_ATSTK1002_SW4_CUSTOM
771 + depends on LEDS_GPIO && !BOARD_ATSTK100X_SW4_CUSTOM
774 Select this if you have jumpered the J2 jumper block to the
776 IDC cable. A default "heartbeat" trigger is provided, but
777 you can of course override this.
779 -config BOARD_ATSTK1002_J2_LED8
780 +config BOARD_ATSTK1000_J2_LED8
783 Select this if J2 is jumpered to LED0..LED7 amber leds.
785 -config BOARD_ATSTK1002_J2_RGB
786 +config BOARD_ATSTK1000_J2_RGB
789 Select this if J2 is jumpered to the RGB leds.
794 +config BOARD_ATSTK1000_EXTDAC
796 + depends on !BOARD_ATSTK100X_SW1_CUSTOM && !BOARD_ATSTK100X_SW3_CUSTOM
799 +config BOARD_ATSTK100X_ENABLE_AC97
800 + bool "Use AC97C instead of ABDAC"
802 + Select this if you want to use the built-in AC97 controller
803 + instead of the built-in Audio Bitstream DAC. These share
804 + the same I/O pins on the AP7000, so both can't be enabled
807 + Note that the STK1000 kit doesn't ship with an AC97 codec on
808 + board, so say N unless you've got an expansion board with an
809 + AC97 codec on it that you want to use.
811 +config BOARD_ATSTK1000_CF_HACKS
812 + bool "ATSTK1000 CompactFlash hacks"
813 + depends on !BOARD_ATSTK100X_SW4_CUSTOM
815 + Select this if you have re-routed the CompactFlash RESET and
816 + CD signals to GPIOs on your STK1000. This is necessary for
817 + reset and card detection to work properly, although some CF
818 + cards may be able to cope without reset.
820 +config BOARD_ATSTK1000_CF_RESET_PIN
821 + hex "CompactFlash RESET pin"
823 + depends on BOARD_ATSTK1000_CF_HACKS
825 + Select which GPIO pin to use for the CompactFlash RESET
826 + signal. This is specified as a hexadecimal number and should
827 + be defined as 0x20 * gpio_port + pin.
829 + The default is 0x30, which is pin 16 on PIOB, aka GPIO14.
831 +config BOARD_ATSTK1000_CF_DETECT_PIN
832 + hex "CompactFlash DETECT pin"
834 + depends on BOARD_ATSTK1000_CF_HACKS
836 + Select which GPIO pin to use for the CompactFlash CD
837 + signal. This is specified as a hexadecimal number and should
838 + be defined as 0x20 * gpio_port + pin.
840 + The default is 0x3e, which is pin 30 on PIOB, aka GPIO15.
842 +config BOARD_ATSTK100X_ENABLE_PSIF
843 + bool "Enable PSIF peripheral (PS/2 support)"
846 + Select this if you want to use the PSIF peripheral to hook up PS/2
847 + devices to your STK1000. This will require a hardware modification to
848 + work correctly, since PS/2 devices require 5 volt power and signals,
849 + while the STK1000 only provides 3.3 volt.
851 + Say N if you have not modified the hardware to boost the voltage, say
852 + Y if you have level convertion hardware or a PS/2 device capable of
853 + operating on 3.3 volt.
856 diff -urN linux-2.6.24.3/arch/avr32/boards/atstk1000/Makefile avr32-2.6/arch/avr32/boards/atstk1000/Makefile
857 --- linux-2.6.24.3/arch/avr32/boards/atstk1000/Makefile 2008-02-26 01:20:20.000000000 +0100
858 +++ avr32-2.6/arch/avr32/boards/atstk1000/Makefile 2008-04-23 19:33:28.000000000 +0200
860 obj-y += setup.o flash.o
861 obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o
862 +obj-$(CONFIG_BOARD_ATSTK1003) += atstk1003.o
863 +obj-$(CONFIG_BOARD_ATSTK1004) += atstk1004.o
864 diff -urN linux-2.6.24.3/arch/avr32/boards/atstk1000/setup.c avr32-2.6/arch/avr32/boards/atstk1000/setup.c
865 --- linux-2.6.24.3/arch/avr32/boards/atstk1000/setup.c 2008-02-26 01:20:20.000000000 +0100
866 +++ avr32-2.6/arch/avr32/boards/atstk1000/setup.c 2008-04-23 19:33:28.000000000 +0200
868 #include <linux/bootmem.h>
869 #include <linux/fb.h>
870 #include <linux/init.h>
871 +#include <linux/platform_device.h>
872 #include <linux/types.h>
873 #include <linux/linkage.h>
875 #include <video/atmel_lcdc.h>
877 #include <asm/setup.h>
879 +#include <asm/arch/at32ap700x.h>
880 #include <asm/arch/board.h>
881 +#include <asm/arch/portmux.h>
883 #include "atstk1000.h"
886 .default_monspecs = &atstk1000_default_monspecs,
890 +#ifdef CONFIG_BOARD_ATSTK1000_J2_LED
891 +#include <linux/leds.h>
893 +static struct gpio_led stk1000_j2_led[] = {
894 +#ifdef CONFIG_BOARD_ATSTK1000_J2_LED8
895 +#define LEDSTRING "J2 jumpered to LED8"
896 + { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), },
897 + { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), },
898 + { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), },
899 + { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), },
900 + { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), },
901 + { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), },
902 + { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), },
903 + { .name = "led7:amber", .gpio = GPIO_PIN_PB(30),
904 + .default_trigger = "heartbeat", },
906 +#define LEDSTRING "J2 jumpered to RGB LEDs"
907 + { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), },
908 + { .name = "g1:green", .gpio = GPIO_PIN_PB(10), },
909 + { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), },
911 + { .name = "r2:red", .gpio = GPIO_PIN_PB( 9),
912 + .default_trigger = "heartbeat", },
913 + { .name = "g2:green", .gpio = GPIO_PIN_PB(13), },
914 + { .name = "b2:blue", .gpio = GPIO_PIN_PB(15),
915 + .default_trigger = "heartbeat", },
916 + /* PB16, PB30 unused */
920 +static struct gpio_led_platform_data stk1000_j2_led_data = {
921 + .num_leds = ARRAY_SIZE(stk1000_j2_led),
922 + .leds = stk1000_j2_led,
925 +static struct platform_device stk1000_j2_led_dev = {
926 + .name = "leds-gpio",
927 + .id = 2, /* gpio block J2 */
929 + .platform_data = &stk1000_j2_led_data,
933 +void __init atstk1000_setup_j2_leds(void)
937 + for (i = 0; i < ARRAY_SIZE(stk1000_j2_led); i++)
938 + at32_select_gpio(stk1000_j2_led[i].gpio, AT32_GPIOF_OUTPUT);
940 + printk("STK1000: " LEDSTRING "\n");
941 + platform_device_register(&stk1000_j2_led_dev);
943 +#else /* CONFIG_BOARD_ATSTK1000_J2_LED */
944 +void __init atstk1000_setup_j2_leds(void)
948 +#endif /* CONFIG_BOARD_ATSTK1000_J2_LED */
949 diff -urN linux-2.6.24.3/arch/avr32/configs/atngw100_defconfig avr32-2.6/arch/avr32/configs/atngw100_defconfig
950 --- linux-2.6.24.3/arch/avr32/configs/atngw100_defconfig 2008-02-26 01:20:20.000000000 +0100
951 +++ avr32-2.6/arch/avr32/configs/atngw100_defconfig 2008-04-23 20:12:35.000000000 +0200
954 # Automatically generated make config: don't edit
955 -# Linux kernel version: 2.6.22-rc5
956 -# Sat Jun 23 15:40:05 2007
957 +# Linux kernel version: 2.6.24
958 +# Thu Mar 6 12:49:54 2008
961 CONFIG_GENERIC_GPIO=y
962 CONFIG_GENERIC_HARDIRQS=y
963 +CONFIG_STACKTRACE_SUPPORT=y
964 +CONFIG_LOCKDEP_SUPPORT=y
965 +CONFIG_TRACE_IRQFLAGS_SUPPORT=y
966 CONFIG_HARDIRQS_SW_RESEND=y
967 CONFIG_GENERIC_IRQ_PROBE=y
968 CONFIG_RWSEM_GENERIC_SPINLOCK=y
969 CONFIG_GENERIC_TIME=y
970 +CONFIG_GENERIC_CLOCKEVENTS=y
971 +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
972 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
973 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
974 +CONFIG_ARCH_SUPPORTS_OPROFILE=y
975 CONFIG_GENERIC_HWEIGHT=y
976 CONFIG_GENERIC_CALIBRATE_DELAY=y
978 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
981 -# Code maturity level options
984 CONFIG_EXPERIMENTAL=y
985 CONFIG_BROKEN_ON_SMP=y
986 CONFIG_INIT_ENV_ARG_LIMIT=32
991 CONFIG_LOCALVERSION=""
992 # CONFIG_LOCALVERSION_AUTO is not set
995 -# CONFIG_IPC_NS is not set
996 CONFIG_SYSVIPC_SYSCTL=y
997 CONFIG_POSIX_MQUEUE=y
998 CONFIG_BSD_PROCESS_ACCT=y
999 CONFIG_BSD_PROCESS_ACCT_V3=y
1000 # CONFIG_TASKSTATS is not set
1001 -# CONFIG_UTS_NS is not set
1002 +# CONFIG_USER_NS is not set
1003 +# CONFIG_PID_NS is not set
1004 # CONFIG_AUDIT is not set
1005 # CONFIG_IKCONFIG is not set
1006 CONFIG_LOG_BUF_SHIFT=14
1007 +# CONFIG_CGROUPS is not set
1008 +CONFIG_FAIR_GROUP_SCHED=y
1009 +CONFIG_FAIR_USER_SCHED=y
1010 +# CONFIG_FAIR_CGROUP_SCHED is not set
1011 CONFIG_SYSFS_DEPRECATED=y
1012 # CONFIG_RELAY is not set
1013 CONFIG_BLK_DEV_INITRD=y
1015 CONFIG_ANON_INODES=y
1021 CONFIG_VM_EVENT_COUNTERS=y
1022 -# CONFIG_SLUB_DEBUG is not set
1023 +CONFIG_SLUB_DEBUG=y
1024 # CONFIG_SLAB is not set
1026 # CONFIG_SLOB is not set
1029 # CONFIG_TINY_SHMEM is not set
1033 -# Loadable module support
1036 CONFIG_MODULE_UNLOAD=y
1037 CONFIG_MODULE_FORCE_UNLOAD=y
1038 # CONFIG_MODVERSIONS is not set
1039 # CONFIG_MODULE_SRCVERSION_ALL is not set
1046 # CONFIG_LBD is not set
1047 # CONFIG_BLK_DEV_IO_TRACE is not set
1048 # CONFIG_LSF is not set
1049 +# CONFIG_BLK_DEV_BSG is not set
1053 @@ -107,21 +106,28 @@
1055 # System Type and features
1057 +CONFIG_TICK_ONESHOT=y
1059 +CONFIG_HIGH_RES_TIMERS=y
1060 +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
1061 CONFIG_SUBARCH_AVR32B=y
1063 CONFIG_PERFORMANCE_COUNTERS=y
1064 CONFIG_PLATFORM_AT32AP=y
1065 +CONFIG_CPU_AT32AP700X=y
1066 CONFIG_CPU_AT32AP7000=y
1067 # CONFIG_BOARD_ATSTK1000 is not set
1068 CONFIG_BOARD_ATNGW100=y
1069 +CONFIG_BOARD_ATNGW100_I2C_GPIO=y
1070 CONFIG_LOADER_U_BOOT=y
1073 # Atmel AVR32 AP options
1075 -# CONFIG_AP7000_32_BIT_SMC is not set
1076 -CONFIG_AP7000_16_BIT_SMC=y
1077 -# CONFIG_AP7000_8_BIT_SMC is not set
1078 +# CONFIG_AP700X_32_BIT_SMC is not set
1079 +CONFIG_AP700X_16_BIT_SMC=y
1080 +# CONFIG_AP700X_8_BIT_SMC is not set
1082 CONFIG_LOAD_ADDRESS=0x10000000
1083 CONFIG_ENTRY_ADDRESS=0x90000000
1084 CONFIG_PHYS_OFFSET=0x10000000
1085 @@ -141,10 +147,14 @@
1087 CONFIG_FLAT_NODE_MEM_MAP=y
1088 # CONFIG_SPARSEMEM_STATIC is not set
1089 +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
1090 CONFIG_SPLIT_PTLOCK_CPUS=4
1091 # CONFIG_RESOURCES_64BIT is not set
1092 CONFIG_ZONE_DMA_FLAG=0
1093 +CONFIG_VIRT_TO_BUS=y
1094 # CONFIG_OWNERSHIP_TRACE is not set
1095 +# CONFIG_NMI_DEBUGGING is not set
1097 # CONFIG_HZ_100 is not set
1099 # CONFIG_HZ_300 is not set
1100 @@ -153,13 +163,31 @@
1105 +# Power management options
1107 -# CONFIG_ARCH_SUPPORTS_MSI is not set
1110 -# PCCARD (PCMCIA/CardBus) support
1111 +# CPU Frequency scaling
1114 +CONFIG_CPU_FREQ_TABLE=y
1115 +# CONFIG_CPU_FREQ_DEBUG is not set
1116 +# CONFIG_CPU_FREQ_STAT is not set
1117 +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
1118 +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
1119 +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
1120 +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
1121 +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
1122 +# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
1123 +CONFIG_CPU_FREQ_GOV_USERSPACE=y
1124 +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
1125 +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
1126 +CONFIG_CPU_FREQ_AT32AP=y
1131 +# CONFIG_ARCH_SUPPORTS_MSI is not set
1132 # CONFIG_PCCARD is not set
1136 CONFIG_INET_XFRM_MODE_TRANSPORT=y
1137 CONFIG_INET_XFRM_MODE_TUNNEL=y
1138 CONFIG_INET_XFRM_MODE_BEET=y
1139 +# CONFIG_INET_LRO is not set
1141 CONFIG_INET_TCP_DIAG=y
1142 # CONFIG_TCP_CONG_ADVANCED is not set
1144 # CONFIG_NETWORK_SECMARK is not set
1146 # CONFIG_NETFILTER_DEBUG is not set
1147 +CONFIG_BRIDGE_NETFILTER=y
1150 # Core Netfilter Configuration
1152 # CONFIG_NF_CONNTRACK_EVENTS is not set
1153 CONFIG_NF_CT_PROTO_GRE=m
1154 # CONFIG_NF_CT_PROTO_SCTP is not set
1155 +# CONFIG_NF_CT_PROTO_UDPLITE is not set
1156 CONFIG_NF_CONNTRACK_AMANDA=m
1157 CONFIG_NF_CONNTRACK_FTP=m
1158 CONFIG_NF_CONNTRACK_H323=m
1159 @@ -269,9 +300,11 @@
1160 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
1161 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
1162 # CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
1163 +# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
1164 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
1165 CONFIG_NETFILTER_XT_MATCH_COMMENT=m
1166 CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
1167 +# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set
1168 CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
1169 CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
1170 # CONFIG_NETFILTER_XT_MATCH_DCCP is not set
1172 CONFIG_NETFILTER_XT_MATCH_MARK=m
1173 CONFIG_NETFILTER_XT_MATCH_POLICY=m
1174 CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
1175 +# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set
1176 CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
1177 CONFIG_NETFILTER_XT_MATCH_QUOTA=m
1178 CONFIG_NETFILTER_XT_MATCH_REALM=m
1180 CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
1181 CONFIG_NETFILTER_XT_MATCH_STRING=m
1182 CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
1183 +# CONFIG_NETFILTER_XT_MATCH_TIME is not set
1184 +# CONFIG_NETFILTER_XT_MATCH_U32 is not set
1185 CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
1188 @@ -359,13 +395,19 @@
1189 CONFIG_IP6_NF_MANGLE=m
1190 CONFIG_IP6_NF_TARGET_HL=m
1194 +# Bridge: Netfilter Configuration
1196 +# CONFIG_BRIDGE_NF_EBTABLES is not set
1197 # CONFIG_IP_DCCP is not set
1198 # CONFIG_IP_SCTP is not set
1199 # CONFIG_TIPC is not set
1200 # CONFIG_ATM is not set
1201 -# CONFIG_BRIDGE is not set
1204 # CONFIG_DECNET is not set
1206 # CONFIG_LLC2 is not set
1207 # CONFIG_IPX is not set
1208 # CONFIG_ATALK is not set
1209 @@ -373,10 +415,6 @@
1210 # CONFIG_LAPB is not set
1211 # CONFIG_ECONET is not set
1212 # CONFIG_WAN_ROUTER is not set
1215 -# QoS and/or fair queueing
1217 # CONFIG_NET_SCHED is not set
1218 CONFIG_NET_CLS_ROUTE=y
1223 # CONFIG_NET_PKTGEN is not set
1224 +# CONFIG_NET_TCPPROBE is not set
1225 # CONFIG_HAMRADIO is not set
1226 # CONFIG_IRDA is not set
1227 # CONFIG_BT is not set
1229 # CONFIG_MAC80211 is not set
1230 # CONFIG_IEEE80211 is not set
1231 # CONFIG_RFKILL is not set
1232 +# CONFIG_NET_9P is not set
1236 @@ -405,16 +445,13 @@
1238 # Generic Driver Options
1240 +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
1242 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
1243 # CONFIG_FW_LOADER is not set
1244 # CONFIG_DEBUG_DRIVER is not set
1245 # CONFIG_DEBUG_DEVRES is not set
1246 # CONFIG_SYS_HYPERVISOR is not set
1249 -# Connector - unified userspace <-> kernelspace linker
1251 # CONFIG_CONNECTOR is not set
1253 # CONFIG_MTD_DEBUG is not set
1255 # CONFIG_INFTL is not set
1256 # CONFIG_RFD_FTL is not set
1257 # CONFIG_SSFDC is not set
1258 +# CONFIG_MTD_OOPS is not set
1261 # RAM/ROM/Flash chip drivers
1262 @@ -493,20 +531,8 @@
1263 # UBI - Unsorted block images
1265 # CONFIG_MTD_UBI is not set
1268 -# Parallel port support
1270 # CONFIG_PARPORT is not set
1273 -# Plug and Play support
1275 -# CONFIG_PNPACPI is not set
1281 # CONFIG_BLK_DEV_COW_COMMON is not set
1282 CONFIG_BLK_DEV_LOOP=m
1283 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
1284 @@ -517,11 +543,13 @@
1285 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
1286 # CONFIG_CDROM_PKTCDVD is not set
1287 # CONFIG_ATA_OVER_ETH is not set
1292 -# CONFIG_BLINK is not set
1293 +CONFIG_MISC_DEVICES=y
1294 +# CONFIG_ATMEL_PWM is not set
1295 +CONFIG_ATMEL_TCLIB=y
1296 +CONFIG_ATMEL_TCB_CLKSRC=y
1297 +CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0
1298 +# CONFIG_EEPROM_93CX6 is not set
1299 +# CONFIG_ATMEL_SSC is not set
1300 # CONFIG_IDE is not set
1303 @@ -529,30 +557,42 @@
1305 # CONFIG_RAID_ATTRS is not set
1306 # CONFIG_SCSI is not set
1307 +# CONFIG_SCSI_DMA is not set
1308 # CONFIG_SCSI_NETLINK is not set
1309 # CONFIG_ATA is not set
1312 -# Multi-device support (RAID and LVM)
1314 # CONFIG_MD is not set
1317 -# Network device support
1320 +# CONFIG_NETDEVICES_MULTIQUEUE is not set
1321 # CONFIG_DUMMY is not set
1322 # CONFIG_BONDING is not set
1323 +# CONFIG_MACVLAN is not set
1324 # CONFIG_EQUALIZER is not set
1326 -# CONFIG_PHYLIB is not set
1327 +# CONFIG_VETH is not set
1331 -# Ethernet (10 or 100Mbit)
1332 +# MII PHY device drivers
1334 +# CONFIG_MARVELL_PHY is not set
1335 +# CONFIG_DAVICOM_PHY is not set
1336 +# CONFIG_QSEMI_PHY is not set
1337 +# CONFIG_LXT_PHY is not set
1338 +# CONFIG_CICADA_PHY is not set
1339 +# CONFIG_VITESSE_PHY is not set
1340 +# CONFIG_SMSC_PHY is not set
1341 +# CONFIG_BROADCOM_PHY is not set
1342 +# CONFIG_ICPLUS_PHY is not set
1343 +# CONFIG_FIXED_PHY is not set
1344 +# CONFIG_MDIO_BITBANG is not set
1345 CONFIG_NET_ETHERNET=y
1347 +# CONFIG_MII is not set
1349 +# CONFIG_IBM_NEW_EMAC_ZMII is not set
1350 +# CONFIG_IBM_NEW_EMAC_RGMII is not set
1351 +# CONFIG_IBM_NEW_EMAC_TAH is not set
1352 +# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
1353 +# CONFIG_B44 is not set
1354 # CONFIG_NETDEV_1000 is not set
1355 # CONFIG_NETDEV_10000 is not set
1357 @@ -571,21 +611,14 @@
1358 CONFIG_PPP_BSDCOMP=m
1361 +# CONFIG_PPPOL2TP is not set
1362 # CONFIG_SLIP is not set
1364 # CONFIG_SHAPER is not set
1365 # CONFIG_NETCONSOLE is not set
1366 # CONFIG_NETPOLL is not set
1367 # CONFIG_NET_POLL_CONTROLLER is not set
1372 # CONFIG_ISDN is not set
1375 -# Telephony Support
1377 # CONFIG_PHONE is not set
1380 @@ -615,28 +648,57 @@
1382 CONFIG_SERIAL_ATMEL=y
1383 CONFIG_SERIAL_ATMEL_CONSOLE=y
1384 +CONFIG_SERIAL_ATMEL_PDC=y
1385 # CONFIG_SERIAL_ATMEL_TTYAT is not set
1386 CONFIG_SERIAL_CORE=y
1387 CONFIG_SERIAL_CORE_CONSOLE=y
1388 CONFIG_UNIX98_PTYS=y
1389 # CONFIG_LEGACY_PTYS is not set
1394 # CONFIG_IPMI_HANDLER is not set
1395 -# CONFIG_WATCHDOG is not set
1396 # CONFIG_HW_RANDOM is not set
1397 # CONFIG_RTC is not set
1398 # CONFIG_GEN_RTC is not set
1399 # CONFIG_R3964 is not set
1400 # CONFIG_RAW_DRIVER is not set
1405 # CONFIG_TCG_TPM is not set
1406 -# CONFIG_I2C is not set
1408 +CONFIG_I2C_BOARDINFO=y
1409 +CONFIG_I2C_CHARDEV=m
1414 +CONFIG_I2C_ALGOBIT=m
1415 +# CONFIG_I2C_ALGOPCF is not set
1416 +# CONFIG_I2C_ALGOPCA is not set
1419 +# I2C Hardware Bus support
1421 +CONFIG_I2C_ATMELTWI=m
1423 +# CONFIG_I2C_OCORES is not set
1424 +# CONFIG_I2C_PARPORT_LIGHT is not set
1425 +# CONFIG_I2C_SIMTEC is not set
1426 +# CONFIG_I2C_TAOS_EVM is not set
1427 +# CONFIG_I2C_STUB is not set
1430 +# Miscellaneous I2C Chip support
1432 +# CONFIG_SENSORS_DS1337 is not set
1433 +# CONFIG_SENSORS_DS1374 is not set
1434 +# CONFIG_DS1682 is not set
1435 +# CONFIG_SENSORS_EEPROM is not set
1436 +# CONFIG_SENSORS_PCF8574 is not set
1437 +# CONFIG_SENSORS_PCA9539 is not set
1438 +# CONFIG_SENSORS_PCF8591 is not set
1439 +# CONFIG_SENSORS_MAX6875 is not set
1440 +# CONFIG_SENSORS_TSL2550 is not set
1441 +# CONFIG_I2C_DEBUG_CORE is not set
1442 +# CONFIG_I2C_DEBUG_ALGO is not set
1443 +# CONFIG_I2C_DEBUG_BUS is not set
1444 +# CONFIG_I2C_DEBUG_CHIP is not set
1448 @@ -655,13 +717,25 @@
1449 # SPI Protocol Masters
1451 # CONFIG_SPI_AT25 is not set
1452 -# CONFIG_SPI_SPIDEV is not set
1453 +CONFIG_SPI_SPIDEV=m
1454 +# CONFIG_SPI_TLE62X0 is not set
1455 +# CONFIG_W1 is not set
1456 +# CONFIG_POWER_SUPPLY is not set
1457 +# CONFIG_HWMON is not set
1459 +# CONFIG_WATCHDOG_NOWAYOUT is not set
1462 -# Dallas's 1-wire bus
1463 +# Watchdog Device Drivers
1465 -# CONFIG_W1 is not set
1466 -# CONFIG_HWMON is not set
1467 +# CONFIG_SOFT_WATCHDOG is not set
1468 +CONFIG_AT32AP700X_WDT=y
1471 +# Sonics Silicon Backplane
1473 +CONFIG_SSB_POSSIBLE=y
1474 +# CONFIG_SSB is not set
1477 # Multifunction device drivers
1478 @@ -678,23 +752,21 @@
1482 +# CONFIG_VGASTATE is not set
1483 +# CONFIG_VIDEO_OUTPUT_CONTROL is not set
1484 +# CONFIG_FB is not set
1485 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1488 # Display device support
1490 # CONFIG_DISPLAY_SUPPORT is not set
1491 -# CONFIG_VGASTATE is not set
1492 -# CONFIG_FB is not set
1497 # CONFIG_SOUND is not set
1502 +CONFIG_USB_SUPPORT=y
1503 # CONFIG_USB_ARCH_HAS_HCD is not set
1504 # CONFIG_USB_ARCH_HAS_OHCI is not set
1505 # CONFIG_USB_ARCH_HAS_EHCI is not set
1506 @@ -706,12 +778,48 @@
1508 # USB Gadget Support
1510 -# CONFIG_USB_GADGET is not set
1511 -# CONFIG_MMC is not set
1512 +CONFIG_USB_GADGET=y
1513 +# CONFIG_USB_GADGET_DEBUG is not set
1514 +# CONFIG_USB_GADGET_DEBUG_FILES is not set
1515 +CONFIG_USB_GADGET_SELECTED=y
1516 +# CONFIG_USB_GADGET_AMD5536UDC is not set
1517 +CONFIG_USB_GADGET_ATMEL_USBA=y
1518 +CONFIG_USB_ATMEL_USBA=y
1519 +# CONFIG_USB_GADGET_FSL_USB2 is not set
1520 +# CONFIG_USB_GADGET_NET2280 is not set
1521 +# CONFIG_USB_GADGET_PXA2XX is not set
1522 +# CONFIG_USB_GADGET_M66592 is not set
1523 +# CONFIG_USB_GADGET_GOKU is not set
1524 +# CONFIG_USB_GADGET_LH7A40X is not set
1525 +# CONFIG_USB_GADGET_OMAP is not set
1526 +# CONFIG_USB_GADGET_S3C2410 is not set
1527 +# CONFIG_USB_GADGET_AT91 is not set
1528 +# CONFIG_USB_GADGET_DUMMY_HCD is not set
1529 +CONFIG_USB_GADGET_DUALSPEED=y
1532 +CONFIG_USB_ETH_RNDIS=y
1533 +CONFIG_USB_GADGETFS=m
1534 +CONFIG_USB_FILE_STORAGE=m
1535 +# CONFIG_USB_FILE_STORAGE_TEST is not set
1536 +CONFIG_USB_G_SERIAL=m
1537 +# CONFIG_USB_MIDI_GADGET is not set
1539 +# CONFIG_MMC_DEBUG is not set
1540 +# CONFIG_MMC_UNSAFE_RESUME is not set
1543 +# MMC/SD Card Drivers
1546 +# CONFIG_MMC_BLOCK_BOUNCE is not set
1547 +# CONFIG_SDIO_UART is not set
1551 +# MMC/SD Host Controller Drivers
1553 +CONFIG_MMC_ATMELMCI=y
1558 @@ -726,53 +834,71 @@
1559 CONFIG_LEDS_TRIGGERS=y
1560 CONFIG_LEDS_TRIGGER_TIMER=y
1561 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1565 +CONFIG_RTC_HCTOSYS=y
1566 +CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1567 +# CONFIG_RTC_DEBUG is not set
1578 -# InfiniBand support
1581 +CONFIG_RTC_INTF_SYSFS=y
1582 +CONFIG_RTC_INTF_PROC=y
1583 +CONFIG_RTC_INTF_DEV=y
1584 +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1585 +# CONFIG_RTC_DRV_TEST is not set
1588 -# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1591 +# CONFIG_RTC_DRV_DS1307 is not set
1592 +# CONFIG_RTC_DRV_DS1374 is not set
1593 +# CONFIG_RTC_DRV_DS1672 is not set
1594 +# CONFIG_RTC_DRV_MAX6900 is not set
1595 +# CONFIG_RTC_DRV_RS5C372 is not set
1596 +# CONFIG_RTC_DRV_ISL1208 is not set
1597 +# CONFIG_RTC_DRV_X1205 is not set
1598 +# CONFIG_RTC_DRV_PCF8563 is not set
1599 +# CONFIG_RTC_DRV_PCF8583 is not set
1600 +# CONFIG_RTC_DRV_M41T80 is not set
1606 -# CONFIG_RTC_CLASS is not set
1607 +# CONFIG_RTC_DRV_RS5C348 is not set
1608 +# CONFIG_RTC_DRV_MAX6902 is not set
1611 -# DMA Engine support
1612 +# Platform RTC drivers
1614 -# CONFIG_DMA_ENGINE is not set
1615 +# CONFIG_RTC_DRV_DS1553 is not set
1616 +# CONFIG_RTC_DRV_STK17TA8 is not set
1617 +# CONFIG_RTC_DRV_DS1742 is not set
1618 +# CONFIG_RTC_DRV_M48T86 is not set
1619 +# CONFIG_RTC_DRV_M48T59 is not set
1620 +# CONFIG_RTC_DRV_V3020 is not set
1624 +# on-CPU RTC drivers
1626 +CONFIG_RTC_DRV_AT32AP700X=y
1632 +# CONFIG_UIO is not set
1639 # CONFIG_EXT2_FS_XATTR is not set
1640 # CONFIG_EXT2_FS_XIP is not set
1643 # CONFIG_EXT3_FS_XATTR is not set
1644 # CONFIG_EXT4DEV_FS is not set
1646 -# CONFIG_JBD_DEBUG is not set
1648 # CONFIG_REISERFS_FS is not set
1649 # CONFIG_JFS_FS is not set
1650 # CONFIG_FS_POSIX_ACL is not set
1652 # CONFIG_OCFS2_FS is not set
1653 # CONFIG_MINIX_FS is not set
1654 # CONFIG_ROMFS_FS is not set
1655 -# CONFIG_INOTIFY is not set
1657 +CONFIG_INOTIFY_USER=y
1658 # CONFIG_QUOTA is not set
1659 # CONFIG_DNOTIFY is not set
1660 # CONFIG_AUTOFS_FS is not set
1663 # CONFIG_TMPFS_POSIX_ACL is not set
1664 # CONFIG_HUGETLB_PAGE is not set
1666 CONFIG_CONFIGFS_FS=y
1669 @@ -830,10 +956,12 @@
1671 CONFIG_JFFS2_FS_DEBUG=0
1672 CONFIG_JFFS2_FS_WRITEBUFFER=y
1673 +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1674 # CONFIG_JFFS2_SUMMARY is not set
1675 # CONFIG_JFFS2_FS_XATTR is not set
1676 # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1678 +# CONFIG_JFFS2_LZO is not set
1679 CONFIG_JFFS2_RTIME=y
1680 # CONFIG_JFFS2_RUBIN is not set
1681 # CONFIG_CRAMFS is not set
1682 @@ -842,19 +970,21 @@
1683 # CONFIG_QNX4FS_FS is not set
1684 # CONFIG_SYSV_FS is not set
1685 # CONFIG_UFS_FS is not set
1688 -# Network File Systems
1690 +CONFIG_NETWORK_FILESYSTEMS=y
1693 # CONFIG_NFS_V3_ACL is not set
1694 # CONFIG_NFS_V4 is not set
1695 # CONFIG_NFS_DIRECTIO is not set
1696 -# CONFIG_NFSD is not set
1699 +# CONFIG_NFSD_V3_ACL is not set
1700 +# CONFIG_NFSD_V4 is not set
1708 # CONFIG_SUNRPC_BIND34 is not set
1709 @@ -871,23 +1001,18 @@
1710 # CONFIG_NCP_FS is not set
1711 # CONFIG_CODA_FS is not set
1712 # CONFIG_AFS_FS is not set
1713 -# CONFIG_9P_FS is not set
1718 # CONFIG_PARTITION_ADVANCED is not set
1719 CONFIG_MSDOS_PARTITION=y
1722 -# Native Language Support
1726 CONFIG_NLS_DEFAULT="iso8859-1"
1727 -# CONFIG_NLS_CODEPAGE_437 is not set
1728 +CONFIG_NLS_CODEPAGE_437=m
1729 # CONFIG_NLS_CODEPAGE_737 is not set
1730 # CONFIG_NLS_CODEPAGE_775 is not set
1731 -CONFIG_NLS_CODEPAGE_850=y
1732 +CONFIG_NLS_CODEPAGE_850=m
1733 # CONFIG_NLS_CODEPAGE_852 is not set
1734 # CONFIG_NLS_CODEPAGE_855 is not set
1735 # CONFIG_NLS_CODEPAGE_857 is not set
1736 @@ -908,7 +1033,7 @@
1737 # CONFIG_NLS_CODEPAGE_1250 is not set
1738 # CONFIG_NLS_CODEPAGE_1251 is not set
1739 # CONFIG_NLS_ASCII is not set
1740 -CONFIG_NLS_ISO8859_1=y
1741 +CONFIG_NLS_ISO8859_1=m
1742 # CONFIG_NLS_ISO8859_2 is not set
1743 # CONFIG_NLS_ISO8859_3 is not set
1744 # CONFIG_NLS_ISO8859_4 is not set
1745 @@ -921,18 +1046,19 @@
1746 # CONFIG_NLS_ISO8859_15 is not set
1747 # CONFIG_NLS_KOI8_R is not set
1748 # CONFIG_NLS_KOI8_U is not set
1752 -# Distributed Lock Manager
1755 # CONFIG_DLM is not set
1756 +CONFIG_INSTRUMENTATION=y
1760 +# CONFIG_MARKERS is not set
1765 -CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1766 # CONFIG_PRINTK_TIME is not set
1767 +CONFIG_ENABLE_WARN_DEPRECATED=y
1768 CONFIG_ENABLE_MUST_CHECK=y
1769 CONFIG_MAGIC_SYSRQ=y
1770 # CONFIG_UNUSED_SYMBOLS is not set
1771 @@ -941,12 +1067,17 @@
1772 CONFIG_DEBUG_KERNEL=y
1773 # CONFIG_DEBUG_SHIRQ is not set
1774 CONFIG_DETECT_SOFTLOCKUP=y
1775 +CONFIG_SCHED_DEBUG=y
1776 # CONFIG_SCHEDSTATS is not set
1777 # CONFIG_TIMER_STATS is not set
1778 +# CONFIG_SLUB_DEBUG_ON is not set
1779 # CONFIG_DEBUG_RT_MUTEXES is not set
1780 # CONFIG_RT_MUTEX_TESTER is not set
1781 # CONFIG_DEBUG_SPINLOCK is not set
1782 # CONFIG_DEBUG_MUTEXES is not set
1783 +# CONFIG_DEBUG_LOCK_ALLOC is not set
1784 +# CONFIG_PROVE_LOCKING is not set
1785 +# CONFIG_LOCK_STAT is not set
1786 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1787 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1788 # CONFIG_DEBUG_KOBJECT is not set
1789 @@ -954,21 +1085,21 @@
1790 # CONFIG_DEBUG_INFO is not set
1791 # CONFIG_DEBUG_VM is not set
1792 # CONFIG_DEBUG_LIST is not set
1793 +# CONFIG_DEBUG_SG is not set
1794 CONFIG_FRAME_POINTER=y
1795 # CONFIG_FORCED_INLINING is not set
1796 +# CONFIG_BOOT_PRINTK_DELAY is not set
1797 # CONFIG_RCU_TORTURE_TEST is not set
1798 +# CONFIG_LKDTM is not set
1799 # CONFIG_FAULT_INJECTION is not set
1800 -# CONFIG_KPROBES is not set
1801 +# CONFIG_SAMPLES is not set
1806 # CONFIG_KEYS is not set
1807 # CONFIG_SECURITY is not set
1810 -# Cryptographic options
1812 +# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1814 CONFIG_CRYPTO_ALGAPI=y
1815 CONFIG_CRYPTO_BLKCIPHER=y
1816 @@ -989,6 +1120,7 @@
1818 CONFIG_CRYPTO_PCBC=m
1819 # CONFIG_CRYPTO_LRW is not set
1820 +# CONFIG_CRYPTO_XTS is not set
1821 # CONFIG_CRYPTO_CRYPTD is not set
1823 # CONFIG_CRYPTO_FCRYPT is not set
1824 @@ -1002,15 +1134,14 @@
1825 CONFIG_CRYPTO_ARC4=m
1826 # CONFIG_CRYPTO_KHAZAD is not set
1827 # CONFIG_CRYPTO_ANUBIS is not set
1828 +# CONFIG_CRYPTO_SEED is not set
1829 CONFIG_CRYPTO_DEFLATE=y
1830 # CONFIG_CRYPTO_MICHAEL_MIC is not set
1831 # CONFIG_CRYPTO_CRC32C is not set
1832 # CONFIG_CRYPTO_CAMELLIA is not set
1833 # CONFIG_CRYPTO_TEST is not set
1836 -# Hardware crypto devices
1838 +# CONFIG_CRYPTO_AUTHENC is not set
1843 @@ -1018,8 +1149,9 @@
1846 # CONFIG_CRC16 is not set
1847 -# CONFIG_CRC_ITU_T is not set
1851 # CONFIG_LIBCRC32C is not set
1852 CONFIG_ZLIB_INFLATE=y
1853 CONFIG_ZLIB_DEFLATE=y
1854 diff -urN linux-2.6.24.3/arch/avr32/configs/atstk1002_defconfig avr32-2.6/arch/avr32/configs/atstk1002_defconfig
1855 --- linux-2.6.24.3/arch/avr32/configs/atstk1002_defconfig 2008-02-26 01:20:20.000000000 +0100
1856 +++ avr32-2.6/arch/avr32/configs/atstk1002_defconfig 2008-04-23 20:12:35.000000000 +0200
1859 # Automatically generated make config: don't edit
1860 -# Linux kernel version: 2.6.22-rc5
1861 -# Sat Jun 23 15:32:08 2007
1862 +# Linux kernel version: 2.6.24
1863 +# Thu Mar 6 12:49:17 2008
1866 CONFIG_GENERIC_GPIO=y
1867 CONFIG_GENERIC_HARDIRQS=y
1868 +CONFIG_STACKTRACE_SUPPORT=y
1869 +CONFIG_LOCKDEP_SUPPORT=y
1870 +CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1871 CONFIG_HARDIRQS_SW_RESEND=y
1872 CONFIG_GENERIC_IRQ_PROBE=y
1873 CONFIG_RWSEM_GENERIC_SPINLOCK=y
1874 CONFIG_GENERIC_TIME=y
1875 +CONFIG_GENERIC_CLOCKEVENTS=y
1876 +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
1877 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
1878 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
1879 +CONFIG_ARCH_SUPPORTS_OPROFILE=y
1880 CONFIG_GENERIC_HWEIGHT=y
1881 CONFIG_GENERIC_CALIBRATE_DELAY=y
1882 CONFIG_GENERIC_BUG=y
1883 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
1886 -# Code maturity level options
1889 CONFIG_EXPERIMENTAL=y
1890 CONFIG_BROKEN_ON_SMP=y
1891 CONFIG_INIT_ENV_ARG_LIMIT=32
1896 CONFIG_LOCALVERSION=""
1897 # CONFIG_LOCALVERSION_AUTO is not set
1900 -# CONFIG_IPC_NS is not set
1901 CONFIG_SYSVIPC_SYSCTL=y
1902 CONFIG_POSIX_MQUEUE=y
1903 -CONFIG_BSD_PROCESS_ACCT=y
1904 -CONFIG_BSD_PROCESS_ACCT_V3=y
1906 -CONFIG_TASK_DELAY_ACCT=y
1907 -# CONFIG_TASK_XACCT is not set
1908 -# CONFIG_UTS_NS is not set
1910 +# CONFIG_BSD_PROCESS_ACCT is not set
1911 +# CONFIG_TASKSTATS is not set
1912 +# CONFIG_USER_NS is not set
1913 +# CONFIG_PID_NS is not set
1914 +# CONFIG_AUDIT is not set
1915 # CONFIG_IKCONFIG is not set
1916 CONFIG_LOG_BUF_SHIFT=14
1917 +# CONFIG_CGROUPS is not set
1918 +# CONFIG_FAIR_GROUP_SCHED is not set
1919 CONFIG_SYSFS_DEPRECATED=y
1921 CONFIG_BLK_DEV_INITRD=y
1923 CONFIG_ANON_INODES=y
1929 CONFIG_VM_EVENT_COUNTERS=y
1930 -# CONFIG_SLUB_DEBUG is not set
1931 +CONFIG_SLUB_DEBUG=y
1932 # CONFIG_SLAB is not set
1934 # CONFIG_SLOB is not set
1937 # CONFIG_TINY_SHMEM is not set
1941 -# Loadable module support
1944 CONFIG_MODULE_UNLOAD=y
1945 # CONFIG_MODULE_FORCE_UNLOAD is not set
1946 # CONFIG_MODVERSIONS is not set
1947 # CONFIG_MODULE_SRCVERSION_ALL is not set
1948 # CONFIG_KMOD is not set
1954 # CONFIG_LBD is not set
1955 # CONFIG_BLK_DEV_IO_TRACE is not set
1956 # CONFIG_LSF is not set
1957 +# CONFIG_BLK_DEV_BSG is not set
1962 CONFIG_IOSCHED_NOOP=y
1963 # CONFIG_IOSCHED_AS is not set
1964 # CONFIG_IOSCHED_DEADLINE is not set
1965 -# CONFIG_IOSCHED_CFQ is not set
1966 +CONFIG_IOSCHED_CFQ=y
1967 # CONFIG_DEFAULT_AS is not set
1968 # CONFIG_DEFAULT_DEADLINE is not set
1969 -# CONFIG_DEFAULT_CFQ is not set
1970 -CONFIG_DEFAULT_NOOP=y
1971 -CONFIG_DEFAULT_IOSCHED="noop"
1972 +CONFIG_DEFAULT_CFQ=y
1973 +# CONFIG_DEFAULT_NOOP is not set
1974 +CONFIG_DEFAULT_IOSCHED="cfq"
1977 # System Type and features
1979 +CONFIG_TICK_ONESHOT=y
1981 +CONFIG_HIGH_RES_TIMERS=y
1982 +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
1983 CONFIG_SUBARCH_AVR32B=y
1985 CONFIG_PERFORMANCE_COUNTERS=y
1986 CONFIG_PLATFORM_AT32AP=y
1987 +CONFIG_CPU_AT32AP700X=y
1988 CONFIG_CPU_AT32AP7000=y
1989 -CONFIG_BOARD_ATSTK1002=y
1990 CONFIG_BOARD_ATSTK1000=y
1991 # CONFIG_BOARD_ATNGW100 is not set
1992 +CONFIG_BOARD_ATSTK1002=y
1993 +# CONFIG_BOARD_ATSTK1003 is not set
1994 +# CONFIG_BOARD_ATSTK1004 is not set
1995 +# CONFIG_BOARD_ATSTK100X_CUSTOM is not set
1996 +# CONFIG_BOARD_ATSTK100X_SPI1 is not set
1997 +# CONFIG_BOARD_ATSTK1000_J2_LED is not set
1998 +# CONFIG_BOARD_ATSTK1000_J2_LED8 is not set
1999 +# CONFIG_BOARD_ATSTK1000_J2_RGB is not set
2000 +CONFIG_BOARD_ATSTK1000_EXTDAC=y
2001 +# CONFIG_BOARD_ATSTK100X_ENABLE_AC97 is not set
2002 +# CONFIG_BOARD_ATSTK1000_CF_HACKS is not set
2003 +# CONFIG_BOARD_ATSTK100X_ENABLE_PSIF is not set
2004 CONFIG_LOADER_U_BOOT=y
2007 # Atmel AVR32 AP options
2009 -# CONFIG_AP7000_32_BIT_SMC is not set
2010 -CONFIG_AP7000_16_BIT_SMC=y
2011 -# CONFIG_AP7000_8_BIT_SMC is not set
2012 +# CONFIG_AP700X_32_BIT_SMC is not set
2013 +CONFIG_AP700X_16_BIT_SMC=y
2014 +# CONFIG_AP700X_8_BIT_SMC is not set
2016 CONFIG_LOAD_ADDRESS=0x10000000
2017 CONFIG_ENTRY_ADDRESS=0x90000000
2018 CONFIG_PHYS_OFFSET=0x10000000
2019 @@ -144,10 +155,14 @@
2021 CONFIG_FLAT_NODE_MEM_MAP=y
2022 # CONFIG_SPARSEMEM_STATIC is not set
2023 +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
2024 CONFIG_SPLIT_PTLOCK_CPUS=4
2025 # CONFIG_RESOURCES_64BIT is not set
2026 CONFIG_ZONE_DMA_FLAG=0
2027 +CONFIG_VIRT_TO_BUS=y
2028 # CONFIG_OWNERSHIP_TRACE is not set
2029 +CONFIG_NMI_DEBUGGING=y
2031 # CONFIG_HZ_100 is not set
2033 # CONFIG_HZ_300 is not set
2034 @@ -156,13 +171,31 @@
2039 +# Power management options
2041 -# CONFIG_ARCH_SUPPORTS_MSI is not set
2044 -# PCCARD (PCMCIA/CardBus) support
2045 +# CPU Frequency scaling
2048 +CONFIG_CPU_FREQ_TABLE=y
2049 +# CONFIG_CPU_FREQ_DEBUG is not set
2050 +# CONFIG_CPU_FREQ_STAT is not set
2051 +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
2052 +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
2053 +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
2054 +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
2055 +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
2056 +# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
2057 +CONFIG_CPU_FREQ_GOV_USERSPACE=y
2058 +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
2059 +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
2060 +CONFIG_CPU_FREQ_AT32AP=y
2065 +# CONFIG_ARCH_SUPPORTS_MSI is not set
2066 # CONFIG_PCCARD is not set
2069 @@ -182,7 +215,12 @@
2071 CONFIG_PACKET_MMAP=y
2073 -# CONFIG_NET_KEY is not set
2076 +# CONFIG_XFRM_SUB_POLICY is not set
2077 +# CONFIG_XFRM_MIGRATE is not set
2079 +# CONFIG_NET_KEY_MIGRATE is not set
2081 # CONFIG_IP_MULTICAST is not set
2082 # CONFIG_IP_ADVANCED_ROUTER is not set
2083 @@ -191,36 +229,52 @@
2084 CONFIG_IP_PNP_DHCP=y
2085 # CONFIG_IP_PNP_BOOTP is not set
2086 # CONFIG_IP_PNP_RARP is not set
2087 -# CONFIG_NET_IPIP is not set
2088 -# CONFIG_NET_IPGRE is not set
2091 # CONFIG_ARPD is not set
2092 # CONFIG_SYN_COOKIES is not set
2093 -# CONFIG_INET_AH is not set
2094 -# CONFIG_INET_ESP is not set
2097 # CONFIG_INET_IPCOMP is not set
2098 # CONFIG_INET_XFRM_TUNNEL is not set
2099 -# CONFIG_INET_TUNNEL is not set
2100 -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
2101 -# CONFIG_INET_XFRM_MODE_TUNNEL is not set
2102 -# CONFIG_INET_XFRM_MODE_BEET is not set
2103 +CONFIG_INET_TUNNEL=m
2104 +CONFIG_INET_XFRM_MODE_TRANSPORT=m
2105 +CONFIG_INET_XFRM_MODE_TUNNEL=m
2106 +CONFIG_INET_XFRM_MODE_BEET=m
2107 +# CONFIG_INET_LRO is not set
2109 CONFIG_INET_TCP_DIAG=y
2110 # CONFIG_TCP_CONG_ADVANCED is not set
2111 CONFIG_TCP_CONG_CUBIC=y
2112 CONFIG_DEFAULT_TCP_CONG="cubic"
2113 # CONFIG_TCP_MD5SIG is not set
2114 -# CONFIG_IPV6 is not set
2115 -# CONFIG_INET6_XFRM_TUNNEL is not set
2116 -# CONFIG_INET6_TUNNEL is not set
2118 +# CONFIG_IPV6_PRIVACY is not set
2119 +# CONFIG_IPV6_ROUTER_PREF is not set
2120 +# CONFIG_IPV6_OPTIMISTIC_DAD is not set
2123 +CONFIG_INET6_IPCOMP=m
2124 +# CONFIG_IPV6_MIP6 is not set
2125 +CONFIG_INET6_XFRM_TUNNEL=m
2126 +CONFIG_INET6_TUNNEL=m
2127 +CONFIG_INET6_XFRM_MODE_TRANSPORT=m
2128 +CONFIG_INET6_XFRM_MODE_TUNNEL=m
2129 +CONFIG_INET6_XFRM_MODE_BEET=m
2130 +# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
2132 +CONFIG_IPV6_TUNNEL=m
2133 +# CONFIG_IPV6_MULTIPLE_TABLES is not set
2134 # CONFIG_NETWORK_SECMARK is not set
2135 # CONFIG_NETFILTER is not set
2136 # CONFIG_IP_DCCP is not set
2137 # CONFIG_IP_SCTP is not set
2138 # CONFIG_TIPC is not set
2139 # CONFIG_ATM is not set
2140 -# CONFIG_BRIDGE is not set
2142 # CONFIG_VLAN_8021Q is not set
2143 # CONFIG_DECNET is not set
2145 # CONFIG_LLC2 is not set
2146 # CONFIG_IPX is not set
2147 # CONFIG_ATALK is not set
2148 @@ -228,16 +282,13 @@
2149 # CONFIG_LAPB is not set
2150 # CONFIG_ECONET is not set
2151 # CONFIG_WAN_ROUTER is not set
2154 -# QoS and/or fair queueing
2156 # CONFIG_NET_SCHED is not set
2161 # CONFIG_NET_PKTGEN is not set
2162 +# CONFIG_NET_TCPPROBE is not set
2163 # CONFIG_HAMRADIO is not set
2164 # CONFIG_IRDA is not set
2165 # CONFIG_BT is not set
2167 # CONFIG_MAC80211 is not set
2168 # CONFIG_IEEE80211 is not set
2169 # CONFIG_RFKILL is not set
2170 +# CONFIG_NET_9P is not set
2174 @@ -259,16 +311,13 @@
2176 # Generic Driver Options
2178 +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
2180 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
2181 # CONFIG_FW_LOADER is not set
2182 # CONFIG_DEBUG_DRIVER is not set
2183 # CONFIG_DEBUG_DEVRES is not set
2184 # CONFIG_SYS_HYPERVISOR is not set
2187 -# Connector - unified userspace <-> kernelspace linker
2189 # CONFIG_CONNECTOR is not set
2191 # CONFIG_MTD_DEBUG is not set
2193 # CONFIG_INFTL is not set
2194 # CONFIG_RFD_FTL is not set
2195 # CONFIG_SSFDC is not set
2196 +# CONFIG_MTD_OOPS is not set
2199 # RAM/ROM/Flash chip drivers
2202 # Self-contained MTD device drivers
2204 +CONFIG_MTD_DATAFLASH=m
2205 +CONFIG_MTD_M25P80=m
2206 # CONFIG_MTD_SLRAM is not set
2207 # CONFIG_MTD_PHRAM is not set
2208 # CONFIG_MTD_MTDRAM is not set
2209 @@ -345,20 +397,8 @@
2210 # UBI - Unsorted block images
2212 # CONFIG_MTD_UBI is not set
2215 -# Parallel port support
2217 # CONFIG_PARPORT is not set
2220 -# Plug and Play support
2222 -# CONFIG_PNPACPI is not set
2228 # CONFIG_BLK_DEV_COW_COMMON is not set
2229 CONFIG_BLK_DEV_LOOP=m
2230 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
2231 @@ -369,42 +409,91 @@
2232 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
2233 # CONFIG_CDROM_PKTCDVD is not set
2234 # CONFIG_ATA_OVER_ETH is not set
2239 -# CONFIG_BLINK is not set
2240 +CONFIG_MISC_DEVICES=y
2242 +CONFIG_ATMEL_TCLIB=y
2243 +CONFIG_ATMEL_TCB_CLKSRC=y
2244 +CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0
2245 +# CONFIG_EEPROM_93CX6 is not set
2247 # CONFIG_IDE is not set
2250 # SCSI device support
2252 # CONFIG_RAID_ATTRS is not set
2253 -# CONFIG_SCSI is not set
2256 +# CONFIG_SCSI_TGT is not set
2257 # CONFIG_SCSI_NETLINK is not set
2258 -# CONFIG_ATA is not set
2259 +# CONFIG_SCSI_PROC_FS is not set
2262 -# Multi-device support (RAID and LVM)
2263 +# SCSI support type (disk, tape, CD-ROM)
2265 -# CONFIG_MD is not set
2266 +CONFIG_BLK_DEV_SD=m
2267 +# CONFIG_CHR_DEV_ST is not set
2268 +# CONFIG_CHR_DEV_OSST is not set
2269 +CONFIG_BLK_DEV_SR=m
2270 +# CONFIG_BLK_DEV_SR_VENDOR is not set
2271 +# CONFIG_CHR_DEV_SG is not set
2272 +# CONFIG_CHR_DEV_SCH is not set
2275 +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
2277 +# CONFIG_SCSI_MULTI_LUN is not set
2278 +# CONFIG_SCSI_CONSTANTS is not set
2279 +# CONFIG_SCSI_LOGGING is not set
2280 +# CONFIG_SCSI_SCAN_ASYNC is not set
2281 +CONFIG_SCSI_WAIT_SCAN=m
2284 -# Network device support
2287 +# CONFIG_SCSI_SPI_ATTRS is not set
2288 +# CONFIG_SCSI_FC_ATTRS is not set
2289 +# CONFIG_SCSI_ISCSI_ATTRS is not set
2290 +# CONFIG_SCSI_SAS_LIBSAS is not set
2291 +# CONFIG_SCSI_SRP_ATTRS is not set
2292 +# CONFIG_SCSI_LOWLEVEL is not set
2294 +# CONFIG_ATA_NONSTANDARD is not set
2296 +# CONFIG_PATA_PLATFORM is not set
2297 +# CONFIG_MD is not set
2300 +# CONFIG_NETDEVICES_MULTIQUEUE is not set
2301 +# CONFIG_DUMMY is not set
2302 # CONFIG_BONDING is not set
2303 +# CONFIG_MACVLAN is not set
2304 # CONFIG_EQUALIZER is not set
2306 -# CONFIG_PHYLIB is not set
2307 +# CONFIG_VETH is not set
2311 -# Ethernet (10 or 100Mbit)
2312 +# MII PHY device drivers
2314 +# CONFIG_MARVELL_PHY is not set
2315 +# CONFIG_DAVICOM_PHY is not set
2316 +# CONFIG_QSEMI_PHY is not set
2317 +# CONFIG_LXT_PHY is not set
2318 +# CONFIG_CICADA_PHY is not set
2319 +# CONFIG_VITESSE_PHY is not set
2320 +# CONFIG_SMSC_PHY is not set
2321 +# CONFIG_BROADCOM_PHY is not set
2322 +# CONFIG_ICPLUS_PHY is not set
2323 +# CONFIG_FIXED_PHY is not set
2324 +# CONFIG_MDIO_BITBANG is not set
2325 CONFIG_NET_ETHERNET=y
2327 +# CONFIG_MII is not set
2329 +# CONFIG_IBM_NEW_EMAC_ZMII is not set
2330 +# CONFIG_IBM_NEW_EMAC_RGMII is not set
2331 +# CONFIG_IBM_NEW_EMAC_TAH is not set
2332 +# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
2333 +# CONFIG_B44 is not set
2334 # CONFIG_NETDEV_1000 is not set
2335 # CONFIG_NETDEV_10000 is not set
2337 @@ -423,27 +512,54 @@
2338 CONFIG_PPP_BSDCOMP=m
2339 # CONFIG_PPP_MPPE is not set
2340 # CONFIG_PPPOE is not set
2341 +# CONFIG_PPPOL2TP is not set
2342 # CONFIG_SLIP is not set
2344 # CONFIG_SHAPER is not set
2345 # CONFIG_NETCONSOLE is not set
2346 # CONFIG_NETPOLL is not set
2347 # CONFIG_NET_POLL_CONTROLLER is not set
2352 # CONFIG_ISDN is not set
2355 -# Telephony Support
2357 # CONFIG_PHONE is not set
2360 # Input device support
2362 -# CONFIG_INPUT is not set
2364 +# CONFIG_INPUT_FF_MEMLESS is not set
2365 +CONFIG_INPUT_POLLDEV=m
2368 +# Userland interfaces
2370 +CONFIG_INPUT_MOUSEDEV=m
2371 +CONFIG_INPUT_MOUSEDEV_PSAUX=y
2372 +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
2373 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
2374 +# CONFIG_INPUT_JOYDEV is not set
2375 +CONFIG_INPUT_EVDEV=m
2376 +# CONFIG_INPUT_EVBUG is not set
2379 +# Input Device Drivers
2381 +CONFIG_INPUT_KEYBOARD=y
2382 +# CONFIG_KEYBOARD_ATKBD is not set
2383 +# CONFIG_KEYBOARD_SUNKBD is not set
2384 +# CONFIG_KEYBOARD_LKKBD is not set
2385 +# CONFIG_KEYBOARD_XTKBD is not set
2386 +# CONFIG_KEYBOARD_NEWTON is not set
2387 +# CONFIG_KEYBOARD_STOWAWAY is not set
2388 +CONFIG_KEYBOARD_GPIO=m
2389 +CONFIG_INPUT_MOUSE=y
2390 +# CONFIG_MOUSE_PS2 is not set
2391 +# CONFIG_MOUSE_SERIAL is not set
2392 +# CONFIG_MOUSE_VSXXXAA is not set
2393 +CONFIG_MOUSE_GPIO=m
2394 +# CONFIG_INPUT_JOYSTICK is not set
2395 +# CONFIG_INPUT_TABLET is not set
2396 +# CONFIG_INPUT_TOUCHSCREEN is not set
2397 +# CONFIG_INPUT_MISC is not set
2400 # Hardware I/O ports
2401 @@ -467,40 +583,94 @@
2403 CONFIG_SERIAL_ATMEL=y
2404 CONFIG_SERIAL_ATMEL_CONSOLE=y
2405 +CONFIG_SERIAL_ATMEL_PDC=y
2406 # CONFIG_SERIAL_ATMEL_TTYAT is not set
2407 CONFIG_SERIAL_CORE=y
2408 CONFIG_SERIAL_CORE_CONSOLE=y
2409 CONFIG_UNIX98_PTYS=y
2410 # CONFIG_LEGACY_PTYS is not set
2415 # CONFIG_IPMI_HANDLER is not set
2416 -# CONFIG_WATCHDOG is not set
2417 # CONFIG_HW_RANDOM is not set
2418 # CONFIG_RTC is not set
2419 # CONFIG_GEN_RTC is not set
2420 # CONFIG_R3964 is not set
2421 # CONFIG_RAW_DRIVER is not set
2422 +# CONFIG_TCG_TPM is not set
2424 +CONFIG_I2C_BOARDINFO=y
2425 +CONFIG_I2C_CHARDEV=m
2430 +CONFIG_I2C_ALGOBIT=m
2431 +# CONFIG_I2C_ALGOPCF is not set
2432 +# CONFIG_I2C_ALGOPCA is not set
2435 +# I2C Hardware Bus support
2437 +CONFIG_I2C_ATMELTWI=m
2439 +# CONFIG_I2C_OCORES is not set
2440 +# CONFIG_I2C_PARPORT_LIGHT is not set
2441 +# CONFIG_I2C_SIMTEC is not set
2442 +# CONFIG_I2C_TAOS_EVM is not set
2443 +# CONFIG_I2C_STUB is not set
2446 +# Miscellaneous I2C Chip support
2448 +# CONFIG_SENSORS_DS1337 is not set
2449 +# CONFIG_SENSORS_DS1374 is not set
2450 +# CONFIG_DS1682 is not set
2451 +# CONFIG_SENSORS_EEPROM is not set
2452 +# CONFIG_SENSORS_PCF8574 is not set
2453 +# CONFIG_SENSORS_PCA9539 is not set
2454 +# CONFIG_SENSORS_PCF8591 is not set
2455 +# CONFIG_SENSORS_MAX6875 is not set
2456 +# CONFIG_SENSORS_TSL2550 is not set
2457 +# CONFIG_I2C_DEBUG_CORE is not set
2458 +# CONFIG_I2C_DEBUG_ALGO is not set
2459 +# CONFIG_I2C_DEBUG_BUS is not set
2460 +# CONFIG_I2C_DEBUG_CHIP is not set
2466 -# CONFIG_TCG_TPM is not set
2467 -# CONFIG_I2C is not set
2469 +# CONFIG_SPI_DEBUG is not set
2470 +CONFIG_SPI_MASTER=y
2474 +# SPI Master Controller Drivers
2476 -# CONFIG_SPI is not set
2477 -# CONFIG_SPI_MASTER is not set
2479 +# CONFIG_SPI_BITBANG is not set
2482 -# Dallas's 1-wire bus
2483 +# SPI Protocol Masters
2485 +# CONFIG_SPI_AT25 is not set
2486 +CONFIG_SPI_SPIDEV=m
2487 +# CONFIG_SPI_TLE62X0 is not set
2488 # CONFIG_W1 is not set
2489 +# CONFIG_POWER_SUPPLY is not set
2490 # CONFIG_HWMON is not set
2492 +# CONFIG_WATCHDOG_NOWAYOUT is not set
2495 +# Watchdog Device Drivers
2497 +# CONFIG_SOFT_WATCHDOG is not set
2498 +CONFIG_AT32AP700X_WDT=y
2501 +# Sonics Silicon Backplane
2503 +CONFIG_SSB_POSSIBLE=y
2504 +# CONFIG_SSB is not set
2507 # Multifunction device drivers
2508 @@ -517,23 +687,104 @@
2512 -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
2513 +# CONFIG_VGASTATE is not set
2514 +# CONFIG_VIDEO_OUTPUT_CONTROL is not set
2516 +# CONFIG_FIRMWARE_EDID is not set
2517 +# CONFIG_FB_DDC is not set
2518 +CONFIG_FB_CFB_FILLRECT=y
2519 +CONFIG_FB_CFB_COPYAREA=y
2520 +CONFIG_FB_CFB_IMAGEBLIT=y
2521 +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
2522 +# CONFIG_FB_SYS_FILLRECT is not set
2523 +# CONFIG_FB_SYS_COPYAREA is not set
2524 +# CONFIG_FB_SYS_IMAGEBLIT is not set
2525 +# CONFIG_FB_SYS_FOPS is not set
2526 +CONFIG_FB_DEFERRED_IO=y
2527 +# CONFIG_FB_SVGALIB is not set
2528 +# CONFIG_FB_MACMODES is not set
2529 +# CONFIG_FB_BACKLIGHT is not set
2530 +# CONFIG_FB_MODE_HELPERS is not set
2531 +# CONFIG_FB_TILEBLITTING is not set
2534 +# Frame buffer hardware drivers
2536 +# CONFIG_FB_S1D13XXX is not set
2538 +# CONFIG_FB_VIRTUAL is not set
2539 +CONFIG_BACKLIGHT_LCD_SUPPORT=y
2540 +CONFIG_LCD_CLASS_DEVICE=y
2541 +CONFIG_LCD_LTV350QV=y
2542 +# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
2545 # Display device support
2547 # CONFIG_DISPLAY_SUPPORT is not set
2548 -# CONFIG_VGASTATE is not set
2549 -# CONFIG_FB is not set
2550 +# CONFIG_LOGO is not set
2555 -# CONFIG_SOUND is not set
2559 +# Advanced Linux Sound Architecture
2564 +# CONFIG_SND_SEQUENCER is not set
2565 +CONFIG_SND_OSSEMUL=y
2566 +CONFIG_SND_MIXER_OSS=m
2567 +CONFIG_SND_PCM_OSS=m
2568 +CONFIG_SND_PCM_OSS_PLUGINS=y
2569 +# CONFIG_SND_DYNAMIC_MINORS is not set
2570 +# CONFIG_SND_SUPPORT_OLD_API is not set
2571 +# CONFIG_SND_VERBOSE_PROCFS is not set
2572 +# CONFIG_SND_VERBOSE_PRINTK is not set
2573 +# CONFIG_SND_DEBUG is not set
2578 +CONFIG_SND_AC97_CODEC=m
2579 +# CONFIG_SND_DUMMY is not set
2580 +# CONFIG_SND_MTPAV is not set
2581 +# CONFIG_SND_SERIAL_U16550 is not set
2582 +# CONFIG_SND_MPU401 is not set
2587 +CONFIG_SND_ATMEL_AC97=m
2593 +CONFIG_SND_AT73C213=m
2594 +CONFIG_SND_AT73C213_TARGET_BITRATE=48000
2597 +# System on Chip audio support
2599 +# CONFIG_SND_SOC is not set
2602 +# SoC Audio support for SuperH
2606 +# Open Sound System
2608 +CONFIG_SOUND_PRIME=m
2609 +# CONFIG_SOUND_MSNDCLAS is not set
2610 +# CONFIG_SOUND_MSNDPIN is not set
2611 +CONFIG_SOUND_AT32_ABDAC=m
2613 +# CONFIG_HID_SUPPORT is not set
2614 +CONFIG_USB_SUPPORT=y
2615 # CONFIG_USB_ARCH_HAS_HCD is not set
2616 # CONFIG_USB_ARCH_HAS_OHCI is not set
2617 # CONFIG_USB_ARCH_HAS_EHCI is not set
2618 @@ -545,63 +796,137 @@
2620 # USB Gadget Support
2622 -# CONFIG_USB_GADGET is not set
2623 -# CONFIG_MMC is not set
2628 -# CONFIG_NEW_LEDS is not set
2629 +CONFIG_USB_GADGET=y
2630 +# CONFIG_USB_GADGET_DEBUG is not set
2631 +# CONFIG_USB_GADGET_DEBUG_FILES is not set
2632 +# CONFIG_USB_GADGET_DEBUG_FS is not set
2633 +CONFIG_USB_GADGET_SELECTED=y
2634 +# CONFIG_USB_GADGET_AMD5536UDC is not set
2635 +CONFIG_USB_GADGET_ATMEL_USBA=y
2636 +CONFIG_USB_ATMEL_USBA=y
2637 +# CONFIG_USB_GADGET_FSL_USB2 is not set
2638 +# CONFIG_USB_GADGET_NET2280 is not set
2639 +# CONFIG_USB_GADGET_PXA2XX is not set
2640 +# CONFIG_USB_GADGET_M66592 is not set
2641 +# CONFIG_USB_GADGET_GOKU is not set
2642 +# CONFIG_USB_GADGET_LH7A40X is not set
2643 +# CONFIG_USB_GADGET_OMAP is not set
2644 +# CONFIG_USB_GADGET_S3C2410 is not set
2645 +# CONFIG_USB_GADGET_AT91 is not set
2646 +# CONFIG_USB_GADGET_DUMMY_HCD is not set
2647 +CONFIG_USB_GADGET_DUALSPEED=y
2650 +CONFIG_USB_ETH_RNDIS=y
2651 +CONFIG_USB_GADGETFS=m
2652 +CONFIG_USB_FILE_STORAGE=m
2653 +# CONFIG_USB_FILE_STORAGE_TEST is not set
2654 +CONFIG_USB_G_SERIAL=m
2655 +# CONFIG_USB_MIDI_GADGET is not set
2657 +# CONFIG_MMC_DEBUG is not set
2658 +# CONFIG_MMC_UNSAFE_RESUME is not set
2661 +# MMC/SD Card Drivers
2664 +# CONFIG_MMC_BLOCK_BOUNCE is not set
2665 +# CONFIG_SDIO_UART is not set
2668 +# MMC/SD Host Controller Drivers
2670 +CONFIG_MMC_ATMELMCI=y
2673 +CONFIG_LEDS_CLASS=m
2678 +CONFIG_LEDS_ATMEL_PWM=m
2684 +CONFIG_LEDS_TRIGGERS=y
2685 +CONFIG_LEDS_TRIGGER_TIMER=m
2686 +CONFIG_LEDS_TRIGGER_HEARTBEAT=m
2689 +CONFIG_RTC_HCTOSYS=y
2690 +CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
2691 +# CONFIG_RTC_DEBUG is not set
2694 -# InfiniBand support
2697 +CONFIG_RTC_INTF_SYSFS=y
2698 +CONFIG_RTC_INTF_PROC=y
2699 +CONFIG_RTC_INTF_DEV=y
2700 +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
2701 +# CONFIG_RTC_DRV_TEST is not set
2704 -# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
2707 +# CONFIG_RTC_DRV_DS1307 is not set
2708 +# CONFIG_RTC_DRV_DS1374 is not set
2709 +# CONFIG_RTC_DRV_DS1672 is not set
2710 +# CONFIG_RTC_DRV_MAX6900 is not set
2711 +# CONFIG_RTC_DRV_RS5C372 is not set
2712 +# CONFIG_RTC_DRV_ISL1208 is not set
2713 +# CONFIG_RTC_DRV_X1205 is not set
2714 +# CONFIG_RTC_DRV_PCF8563 is not set
2715 +# CONFIG_RTC_DRV_PCF8583 is not set
2716 +# CONFIG_RTC_DRV_M41T80 is not set
2722 -# CONFIG_RTC_CLASS is not set
2723 +# CONFIG_RTC_DRV_RS5C348 is not set
2724 +# CONFIG_RTC_DRV_MAX6902 is not set
2727 -# DMA Engine support
2728 +# Platform RTC drivers
2730 -# CONFIG_DMA_ENGINE is not set
2731 +# CONFIG_RTC_DRV_DS1553 is not set
2732 +# CONFIG_RTC_DRV_STK17TA8 is not set
2733 +# CONFIG_RTC_DRV_DS1742 is not set
2734 +# CONFIG_RTC_DRV_M48T86 is not set
2735 +# CONFIG_RTC_DRV_M48T59 is not set
2736 +# CONFIG_RTC_DRV_V3020 is not set
2740 +# on-CPU RTC drivers
2742 +CONFIG_RTC_DRV_AT32AP700X=y
2748 +# CONFIG_UIO is not set
2755 # CONFIG_EXT2_FS_XATTR is not set
2756 # CONFIG_EXT2_FS_XIP is not set
2757 -# CONFIG_EXT3_FS is not set
2759 +# CONFIG_EXT3_FS_XATTR is not set
2760 # CONFIG_EXT4DEV_FS is not set
2762 +# CONFIG_JBD_DEBUG is not set
2763 # CONFIG_REISERFS_FS is not set
2764 # CONFIG_JFS_FS is not set
2765 # CONFIG_FS_POSIX_ACL is not set
2766 # CONFIG_XFS_FS is not set
2767 # CONFIG_GFS2_FS is not set
2768 # CONFIG_OCFS2_FS is not set
2770 +# CONFIG_MINIX_FS is not set
2771 # CONFIG_ROMFS_FS is not set
2773 CONFIG_INOTIFY_USER=y
2775 # CONFIG_DNOTIFY is not set
2776 # CONFIG_AUTOFS_FS is not set
2777 # CONFIG_AUTOFS4_FS is not set
2778 -# CONFIG_FUSE_FS is not set
2782 # CD-ROM/DVD Filesystems
2785 # CONFIG_TMPFS_POSIX_ACL is not set
2786 # CONFIG_HUGETLB_PAGE is not set
2788 -CONFIG_CONFIGFS_FS=m
2789 +CONFIG_CONFIGFS_FS=y
2792 # Miscellaneous filesystems
2793 @@ -652,11 +976,12 @@
2794 # CONFIG_EFS_FS is not set
2796 CONFIG_JFFS2_FS_DEBUG=0
2797 -CONFIG_JFFS2_FS_WRITEBUFFER=y
2798 +# CONFIG_JFFS2_FS_WRITEBUFFER is not set
2799 # CONFIG_JFFS2_SUMMARY is not set
2800 # CONFIG_JFFS2_FS_XATTR is not set
2801 # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
2803 +# CONFIG_JFFS2_LZO is not set
2804 CONFIG_JFFS2_RTIME=y
2805 # CONFIG_JFFS2_RUBIN is not set
2806 # CONFIG_CRAMFS is not set
2807 @@ -665,10 +990,7 @@
2808 # CONFIG_QNX4FS_FS is not set
2809 # CONFIG_SYSV_FS is not set
2810 # CONFIG_UFS_FS is not set
2813 -# Network File Systems
2815 +CONFIG_NETWORK_FILESYSTEMS=y
2818 # CONFIG_NFS_V3_ACL is not set
2819 @@ -688,17 +1010,12 @@
2820 # CONFIG_NCP_FS is not set
2821 # CONFIG_CODA_FS is not set
2822 # CONFIG_AFS_FS is not set
2823 -# CONFIG_9P_FS is not set
2828 # CONFIG_PARTITION_ADVANCED is not set
2829 CONFIG_MSDOS_PARTITION=y
2832 -# Native Language Support
2835 CONFIG_NLS_DEFAULT="iso8859-1"
2836 CONFIG_NLS_CODEPAGE_437=m
2837 @@ -739,17 +1056,18 @@
2838 # CONFIG_NLS_KOI8_R is not set
2839 # CONFIG_NLS_KOI8_U is not set
2843 -# Distributed Lock Manager
2845 # CONFIG_DLM is not set
2846 +CONFIG_INSTRUMENTATION=y
2850 +# CONFIG_MARKERS is not set
2855 -CONFIG_TRACE_IRQFLAGS_SUPPORT=y
2856 # CONFIG_PRINTK_TIME is not set
2857 +CONFIG_ENABLE_WARN_DEPRECATED=y
2858 CONFIG_ENABLE_MUST_CHECK=y
2859 CONFIG_MAGIC_SYSRQ=y
2860 # CONFIG_UNUSED_SYMBOLS is not set
2861 @@ -758,12 +1076,17 @@
2862 CONFIG_DEBUG_KERNEL=y
2863 # CONFIG_DEBUG_SHIRQ is not set
2864 CONFIG_DETECT_SOFTLOCKUP=y
2865 +CONFIG_SCHED_DEBUG=y
2866 # CONFIG_SCHEDSTATS is not set
2867 # CONFIG_TIMER_STATS is not set
2868 +# CONFIG_SLUB_DEBUG_ON is not set
2869 # CONFIG_DEBUG_RT_MUTEXES is not set
2870 # CONFIG_RT_MUTEX_TESTER is not set
2871 # CONFIG_DEBUG_SPINLOCK is not set
2872 # CONFIG_DEBUG_MUTEXES is not set
2873 +# CONFIG_DEBUG_LOCK_ALLOC is not set
2874 +# CONFIG_PROVE_LOCKING is not set
2875 +# CONFIG_LOCK_STAT is not set
2876 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
2877 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
2878 # CONFIG_DEBUG_KOBJECT is not set
2879 @@ -771,22 +1094,63 @@
2880 # CONFIG_DEBUG_INFO is not set
2881 # CONFIG_DEBUG_VM is not set
2882 # CONFIG_DEBUG_LIST is not set
2883 +# CONFIG_DEBUG_SG is not set
2884 CONFIG_FRAME_POINTER=y
2885 CONFIG_FORCED_INLINING=y
2886 +# CONFIG_BOOT_PRINTK_DELAY is not set
2887 # CONFIG_RCU_TORTURE_TEST is not set
2888 +# CONFIG_LKDTM is not set
2889 # CONFIG_FAULT_INJECTION is not set
2890 -# CONFIG_KPROBES is not set
2891 +# CONFIG_SAMPLES is not set
2896 # CONFIG_KEYS is not set
2897 # CONFIG_SECURITY is not set
2900 -# Cryptographic options
2902 -# CONFIG_CRYPTO is not set
2903 +# CONFIG_SECURITY_FILE_CAPABILITIES is not set
2905 +CONFIG_CRYPTO_ALGAPI=m
2906 +CONFIG_CRYPTO_BLKCIPHER=m
2907 +CONFIG_CRYPTO_HASH=m
2908 +CONFIG_CRYPTO_MANAGER=m
2909 +CONFIG_CRYPTO_HMAC=m
2910 +# CONFIG_CRYPTO_XCBC is not set
2911 +# CONFIG_CRYPTO_NULL is not set
2912 +# CONFIG_CRYPTO_MD4 is not set
2913 +CONFIG_CRYPTO_MD5=m
2914 +CONFIG_CRYPTO_SHA1=m
2915 +# CONFIG_CRYPTO_SHA256 is not set
2916 +# CONFIG_CRYPTO_SHA512 is not set
2917 +# CONFIG_CRYPTO_WP512 is not set
2918 +# CONFIG_CRYPTO_TGR192 is not set
2919 +# CONFIG_CRYPTO_GF128MUL is not set
2920 +# CONFIG_CRYPTO_ECB is not set
2921 +CONFIG_CRYPTO_CBC=m
2922 +# CONFIG_CRYPTO_PCBC is not set
2923 +# CONFIG_CRYPTO_LRW is not set
2924 +# CONFIG_CRYPTO_XTS is not set
2925 +# CONFIG_CRYPTO_CRYPTD is not set
2926 +CONFIG_CRYPTO_DES=m
2927 +# CONFIG_CRYPTO_FCRYPT is not set
2928 +# CONFIG_CRYPTO_BLOWFISH is not set
2929 +# CONFIG_CRYPTO_TWOFISH is not set
2930 +# CONFIG_CRYPTO_SERPENT is not set
2931 +# CONFIG_CRYPTO_AES is not set
2932 +# CONFIG_CRYPTO_CAST5 is not set
2933 +# CONFIG_CRYPTO_CAST6 is not set
2934 +# CONFIG_CRYPTO_TEA is not set
2935 +# CONFIG_CRYPTO_ARC4 is not set
2936 +# CONFIG_CRYPTO_KHAZAD is not set
2937 +# CONFIG_CRYPTO_ANUBIS is not set
2938 +# CONFIG_CRYPTO_SEED is not set
2939 +CONFIG_CRYPTO_DEFLATE=m
2940 +# CONFIG_CRYPTO_MICHAEL_MIC is not set
2941 +# CONFIG_CRYPTO_CRC32C is not set
2942 +# CONFIG_CRYPTO_CAMELLIA is not set
2943 +# CONFIG_CRYPTO_TEST is not set
2944 +# CONFIG_CRYPTO_AUTHENC is not set
2945 +# CONFIG_CRYPTO_HW is not set
2949 @@ -794,10 +1158,10 @@
2952 # CONFIG_CRC16 is not set
2953 -# CONFIG_CRC_ITU_T is not set
2957 # CONFIG_LIBCRC32C is not set
2958 -CONFIG_AUDIT_GENERIC=y
2959 CONFIG_ZLIB_INFLATE=y
2960 CONFIG_ZLIB_DEFLATE=y
2962 diff -urN linux-2.6.24.3/arch/avr32/configs/atstk1003_defconfig avr32-2.6/arch/avr32/configs/atstk1003_defconfig
2963 --- linux-2.6.24.3/arch/avr32/configs/atstk1003_defconfig 1970-01-01 01:00:00.000000000 +0100
2964 +++ avr32-2.6/arch/avr32/configs/atstk1003_defconfig 2008-04-23 20:12:35.000000000 +0200
2967 +# Automatically generated make config: don't edit
2968 +# Linux kernel version: 2.6.24
2969 +# Thu Mar 6 12:50:27 2008
2972 +CONFIG_GENERIC_GPIO=y
2973 +CONFIG_GENERIC_HARDIRQS=y
2974 +CONFIG_STACKTRACE_SUPPORT=y
2975 +CONFIG_LOCKDEP_SUPPORT=y
2976 +CONFIG_TRACE_IRQFLAGS_SUPPORT=y
2977 +CONFIG_HARDIRQS_SW_RESEND=y
2978 +CONFIG_GENERIC_IRQ_PROBE=y
2979 +CONFIG_RWSEM_GENERIC_SPINLOCK=y
2980 +CONFIG_GENERIC_TIME=y
2981 +CONFIG_GENERIC_CLOCKEVENTS=y
2982 +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
2983 +# CONFIG_ARCH_HAS_ILOG2_U32 is not set
2984 +# CONFIG_ARCH_HAS_ILOG2_U64 is not set
2985 +CONFIG_ARCH_SUPPORTS_OPROFILE=y
2986 +CONFIG_GENERIC_HWEIGHT=y
2987 +CONFIG_GENERIC_CALIBRATE_DELAY=y
2988 +CONFIG_GENERIC_BUG=y
2989 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
2994 +CONFIG_EXPERIMENTAL=y
2995 +CONFIG_BROKEN_ON_SMP=y
2996 +CONFIG_INIT_ENV_ARG_LIMIT=32
2997 +CONFIG_LOCALVERSION=""
2998 +# CONFIG_LOCALVERSION_AUTO is not set
3001 +CONFIG_SYSVIPC_SYSCTL=y
3002 +CONFIG_POSIX_MQUEUE=y
3003 +CONFIG_BSD_PROCESS_ACCT=y
3004 +CONFIG_BSD_PROCESS_ACCT_V3=y
3006 +CONFIG_TASK_DELAY_ACCT=y
3007 +# CONFIG_TASK_XACCT is not set
3008 +# CONFIG_USER_NS is not set
3009 +# CONFIG_PID_NS is not set
3011 +# CONFIG_IKCONFIG is not set
3012 +CONFIG_LOG_BUF_SHIFT=14
3013 +# CONFIG_CGROUPS is not set
3014 +CONFIG_FAIR_GROUP_SCHED=y
3015 +CONFIG_FAIR_USER_SCHED=y
3016 +# CONFIG_FAIR_CGROUP_SCHED is not set
3017 +CONFIG_SYSFS_DEPRECATED=y
3019 +CONFIG_BLK_DEV_INITRD=y
3020 +CONFIG_INITRAMFS_SOURCE=""
3021 +CONFIG_CC_OPTIMIZE_FOR_SIZE=y
3024 +# CONFIG_SYSCTL_SYSCALL is not set
3026 +# CONFIG_KALLSYMS_ALL is not set
3027 +# CONFIG_KALLSYMS_EXTRA_PASS is not set
3032 +# CONFIG_BASE_FULL is not set
3034 +CONFIG_ANON_INODES=y
3039 +CONFIG_VM_EVENT_COUNTERS=y
3040 +# CONFIG_SLUB_DEBUG is not set
3041 +# CONFIG_SLAB is not set
3043 +# CONFIG_SLOB is not set
3045 +CONFIG_RT_MUTEXES=y
3046 +# CONFIG_TINY_SHMEM is not set
3047 +CONFIG_BASE_SMALL=1
3049 +CONFIG_MODULE_UNLOAD=y
3050 +# CONFIG_MODULE_FORCE_UNLOAD is not set
3051 +# CONFIG_MODVERSIONS is not set
3052 +# CONFIG_MODULE_SRCVERSION_ALL is not set
3053 +# CONFIG_KMOD is not set
3055 +# CONFIG_LBD is not set
3056 +# CONFIG_BLK_DEV_IO_TRACE is not set
3057 +# CONFIG_LSF is not set
3058 +# CONFIG_BLK_DEV_BSG is not set
3063 +CONFIG_IOSCHED_NOOP=y
3064 +# CONFIG_IOSCHED_AS is not set
3065 +# CONFIG_IOSCHED_DEADLINE is not set
3066 +CONFIG_IOSCHED_CFQ=y
3067 +# CONFIG_DEFAULT_AS is not set
3068 +# CONFIG_DEFAULT_DEADLINE is not set
3069 +CONFIG_DEFAULT_CFQ=y
3070 +# CONFIG_DEFAULT_NOOP is not set
3071 +CONFIG_DEFAULT_IOSCHED="cfq"
3074 +# System Type and features
3076 +CONFIG_TICK_ONESHOT=y
3078 +CONFIG_HIGH_RES_TIMERS=y
3079 +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
3080 +CONFIG_SUBARCH_AVR32B=y
3082 +CONFIG_PERFORMANCE_COUNTERS=y
3083 +CONFIG_PLATFORM_AT32AP=y
3084 +CONFIG_CPU_AT32AP700X=y
3085 +CONFIG_CPU_AT32AP7001=y
3086 +CONFIG_BOARD_ATSTK1000=y
3087 +# CONFIG_BOARD_ATNGW100 is not set
3088 +# CONFIG_BOARD_ATSTK1002 is not set
3089 +CONFIG_BOARD_ATSTK1003=y
3090 +# CONFIG_BOARD_ATSTK1004 is not set
3091 +# CONFIG_BOARD_ATSTK100X_CUSTOM is not set
3092 +# CONFIG_BOARD_ATSTK100X_SPI1 is not set
3093 +# CONFIG_BOARD_ATSTK1000_J2_LED is not set
3094 +# CONFIG_BOARD_ATSTK1000_J2_LED8 is not set
3095 +# CONFIG_BOARD_ATSTK1000_J2_RGB is not set
3096 +CONFIG_BOARD_ATSTK1000_EXTDAC=y
3097 +# CONFIG_BOARD_ATSTK100X_ENABLE_AC97 is not set
3098 +# CONFIG_BOARD_ATSTK1000_CF_HACKS is not set
3099 +# CONFIG_BOARD_ATSTK100X_ENABLE_PSIF is not set
3100 +CONFIG_LOADER_U_BOOT=y
3103 +# Atmel AVR32 AP options
3105 +# CONFIG_AP700X_32_BIT_SMC is not set
3106 +CONFIG_AP700X_16_BIT_SMC=y
3107 +# CONFIG_AP700X_8_BIT_SMC is not set
3109 +CONFIG_LOAD_ADDRESS=0x10000000
3110 +CONFIG_ENTRY_ADDRESS=0x90000000
3111 +CONFIG_PHYS_OFFSET=0x10000000
3112 +CONFIG_PREEMPT_NONE=y
3113 +# CONFIG_PREEMPT_VOLUNTARY is not set
3114 +# CONFIG_PREEMPT is not set
3115 +# CONFIG_HAVE_ARCH_BOOTMEM_NODE is not set
3116 +# CONFIG_ARCH_HAVE_MEMORY_PRESENT is not set
3117 +# CONFIG_NEED_NODE_MEMMAP_SIZE is not set
3118 +CONFIG_ARCH_FLATMEM_ENABLE=y
3119 +# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
3120 +# CONFIG_ARCH_SPARSEMEM_ENABLE is not set
3121 +CONFIG_SELECT_MEMORY_MODEL=y
3122 +CONFIG_FLATMEM_MANUAL=y
3123 +# CONFIG_DISCONTIGMEM_MANUAL is not set
3124 +# CONFIG_SPARSEMEM_MANUAL is not set
3126 +CONFIG_FLAT_NODE_MEM_MAP=y
3127 +# CONFIG_SPARSEMEM_STATIC is not set
3128 +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
3129 +CONFIG_SPLIT_PTLOCK_CPUS=4
3130 +# CONFIG_RESOURCES_64BIT is not set
3131 +CONFIG_ZONE_DMA_FLAG=0
3132 +CONFIG_VIRT_TO_BUS=y
3133 +# CONFIG_OWNERSHIP_TRACE is not set
3134 +CONFIG_NMI_DEBUGGING=y
3136 +# CONFIG_HZ_100 is not set
3138 +# CONFIG_HZ_300 is not set
3139 +# CONFIG_HZ_1000 is not set
3144 +# Power management options
3148 +# CPU Frequency scaling
3151 +CONFIG_CPU_FREQ_TABLE=y
3152 +# CONFIG_CPU_FREQ_DEBUG is not set
3153 +# CONFIG_CPU_FREQ_STAT is not set
3154 +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
3155 +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
3156 +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
3157 +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
3158 +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
3159 +# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
3160 +CONFIG_CPU_FREQ_GOV_USERSPACE=y
3161 +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
3162 +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
3163 +CONFIG_CPU_FREQ_AT32AP=y
3168 +# CONFIG_ARCH_SUPPORTS_MSI is not set
3169 +# CONFIG_PCCARD is not set
3172 +# Executable file formats
3174 +CONFIG_BINFMT_ELF=y
3175 +# CONFIG_BINFMT_MISC is not set
3183 +# Networking options
3186 +CONFIG_PACKET_MMAP=y
3188 +# CONFIG_NET_KEY is not set
3190 +# CONFIG_IP_MULTICAST is not set
3191 +# CONFIG_IP_ADVANCED_ROUTER is not set
3192 +CONFIG_IP_FIB_HASH=y
3193 +# CONFIG_IP_PNP is not set
3194 +# CONFIG_NET_IPIP is not set
3195 +# CONFIG_NET_IPGRE is not set
3196 +# CONFIG_ARPD is not set
3197 +# CONFIG_SYN_COOKIES is not set
3198 +# CONFIG_INET_AH is not set
3199 +# CONFIG_INET_ESP is not set
3200 +# CONFIG_INET_IPCOMP is not set
3201 +# CONFIG_INET_XFRM_TUNNEL is not set
3202 +# CONFIG_INET_TUNNEL is not set
3203 +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
3204 +# CONFIG_INET_XFRM_MODE_TUNNEL is not set
3205 +# CONFIG_INET_XFRM_MODE_BEET is not set
3206 +# CONFIG_INET_LRO is not set
3207 +# CONFIG_INET_DIAG is not set
3208 +# CONFIG_TCP_CONG_ADVANCED is not set
3209 +CONFIG_TCP_CONG_CUBIC=y
3210 +CONFIG_DEFAULT_TCP_CONG="cubic"
3211 +# CONFIG_TCP_MD5SIG is not set
3212 +# CONFIG_IPV6 is not set
3213 +# CONFIG_INET6_XFRM_TUNNEL is not set
3214 +# CONFIG_INET6_TUNNEL is not set
3215 +# CONFIG_NETWORK_SECMARK is not set
3216 +# CONFIG_NETFILTER is not set
3217 +# CONFIG_IP_DCCP is not set
3218 +# CONFIG_IP_SCTP is not set
3219 +# CONFIG_TIPC is not set
3220 +# CONFIG_ATM is not set
3221 +# CONFIG_BRIDGE is not set
3222 +# CONFIG_VLAN_8021Q is not set
3223 +# CONFIG_DECNET is not set
3224 +# CONFIG_LLC2 is not set
3225 +# CONFIG_IPX is not set
3226 +# CONFIG_ATALK is not set
3227 +# CONFIG_X25 is not set
3228 +# CONFIG_LAPB is not set
3229 +# CONFIG_ECONET is not set
3230 +# CONFIG_WAN_ROUTER is not set
3231 +# CONFIG_NET_SCHED is not set
3236 +# CONFIG_NET_PKTGEN is not set
3237 +# CONFIG_NET_TCPPROBE is not set
3238 +# CONFIG_HAMRADIO is not set
3239 +# CONFIG_IRDA is not set
3240 +# CONFIG_BT is not set
3241 +# CONFIG_AF_RXRPC is not set
3246 +# CONFIG_CFG80211 is not set
3247 +# CONFIG_WIRELESS_EXT is not set
3248 +# CONFIG_MAC80211 is not set
3249 +# CONFIG_IEEE80211 is not set
3250 +# CONFIG_RFKILL is not set
3251 +# CONFIG_NET_9P is not set
3258 +# Generic Driver Options
3260 +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
3261 +CONFIG_STANDALONE=y
3262 +# CONFIG_PREVENT_FIRMWARE_BUILD is not set
3263 +# CONFIG_FW_LOADER is not set
3264 +# CONFIG_DEBUG_DRIVER is not set
3265 +# CONFIG_DEBUG_DEVRES is not set
3266 +# CONFIG_SYS_HYPERVISOR is not set
3267 +# CONFIG_CONNECTOR is not set
3269 +# CONFIG_MTD_DEBUG is not set
3270 +# CONFIG_MTD_CONCAT is not set
3271 +CONFIG_MTD_PARTITIONS=y
3272 +# CONFIG_MTD_REDBOOT_PARTS is not set
3273 +CONFIG_MTD_CMDLINE_PARTS=y
3276 +# User Modules And Translation Layers
3279 +CONFIG_MTD_BLKDEVS=y
3281 +# CONFIG_FTL is not set
3282 +# CONFIG_NFTL is not set
3283 +# CONFIG_INFTL is not set
3284 +# CONFIG_RFD_FTL is not set
3285 +# CONFIG_SSFDC is not set
3286 +# CONFIG_MTD_OOPS is not set
3289 +# RAM/ROM/Flash chip drivers
3292 +# CONFIG_MTD_JEDECPROBE is not set
3293 +CONFIG_MTD_GEN_PROBE=y
3294 +# CONFIG_MTD_CFI_ADV_OPTIONS is not set
3295 +CONFIG_MTD_MAP_BANK_WIDTH_1=y
3296 +CONFIG_MTD_MAP_BANK_WIDTH_2=y
3297 +CONFIG_MTD_MAP_BANK_WIDTH_4=y
3298 +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
3299 +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
3300 +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
3301 +CONFIG_MTD_CFI_I1=y
3302 +CONFIG_MTD_CFI_I2=y
3303 +# CONFIG_MTD_CFI_I4 is not set
3304 +# CONFIG_MTD_CFI_I8 is not set
3305 +# CONFIG_MTD_CFI_INTELEXT is not set
3306 +CONFIG_MTD_CFI_AMDSTD=y
3307 +# CONFIG_MTD_CFI_STAA is not set
3308 +CONFIG_MTD_CFI_UTIL=y
3309 +# CONFIG_MTD_RAM is not set
3310 +# CONFIG_MTD_ROM is not set
3311 +# CONFIG_MTD_ABSENT is not set
3314 +# Mapping drivers for chip access
3316 +# CONFIG_MTD_COMPLEX_MAPPINGS is not set
3317 +CONFIG_MTD_PHYSMAP=y
3318 +CONFIG_MTD_PHYSMAP_START=0x8000000
3319 +CONFIG_MTD_PHYSMAP_LEN=0x0
3320 +CONFIG_MTD_PHYSMAP_BANKWIDTH=2
3321 +# CONFIG_MTD_PLATRAM is not set
3324 +# Self-contained MTD device drivers
3326 +CONFIG_MTD_DATAFLASH=m
3327 +CONFIG_MTD_M25P80=m
3328 +# CONFIG_MTD_SLRAM is not set
3329 +# CONFIG_MTD_PHRAM is not set
3330 +# CONFIG_MTD_MTDRAM is not set
3331 +# CONFIG_MTD_BLOCK2MTD is not set
3334 +# Disk-On-Chip Device Drivers
3336 +# CONFIG_MTD_DOC2000 is not set
3337 +# CONFIG_MTD_DOC2001 is not set
3338 +# CONFIG_MTD_DOC2001PLUS is not set
3339 +# CONFIG_MTD_NAND is not set
3340 +# CONFIG_MTD_ONENAND is not set
3343 +# UBI - Unsorted block images
3345 +# CONFIG_MTD_UBI is not set
3346 +# CONFIG_PARPORT is not set
3348 +# CONFIG_BLK_DEV_COW_COMMON is not set
3349 +CONFIG_BLK_DEV_LOOP=m
3350 +# CONFIG_BLK_DEV_CRYPTOLOOP is not set
3351 +CONFIG_BLK_DEV_NBD=m
3352 +CONFIG_BLK_DEV_RAM=m
3353 +CONFIG_BLK_DEV_RAM_COUNT=16
3354 +CONFIG_BLK_DEV_RAM_SIZE=4096
3355 +CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
3356 +# CONFIG_CDROM_PKTCDVD is not set
3357 +# CONFIG_ATA_OVER_ETH is not set
3358 +CONFIG_MISC_DEVICES=y
3360 +CONFIG_ATMEL_TCLIB=y
3361 +CONFIG_ATMEL_TCB_CLKSRC=y
3362 +CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0
3363 +# CONFIG_EEPROM_93CX6 is not set
3365 +# CONFIG_IDE is not set
3368 +# SCSI device support
3370 +# CONFIG_RAID_ATTRS is not set
3373 +# CONFIG_SCSI_TGT is not set
3374 +# CONFIG_SCSI_NETLINK is not set
3375 +# CONFIG_SCSI_PROC_FS is not set
3378 +# SCSI support type (disk, tape, CD-ROM)
3380 +CONFIG_BLK_DEV_SD=m
3381 +# CONFIG_CHR_DEV_ST is not set
3382 +# CONFIG_CHR_DEV_OSST is not set
3383 +CONFIG_BLK_DEV_SR=m
3384 +# CONFIG_BLK_DEV_SR_VENDOR is not set
3385 +# CONFIG_CHR_DEV_SG is not set
3386 +# CONFIG_CHR_DEV_SCH is not set
3389 +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
3391 +# CONFIG_SCSI_MULTI_LUN is not set
3392 +# CONFIG_SCSI_CONSTANTS is not set
3393 +# CONFIG_SCSI_LOGGING is not set
3394 +# CONFIG_SCSI_SCAN_ASYNC is not set
3395 +CONFIG_SCSI_WAIT_SCAN=m
3400 +# CONFIG_SCSI_SPI_ATTRS is not set
3401 +# CONFIG_SCSI_FC_ATTRS is not set
3402 +# CONFIG_SCSI_ISCSI_ATTRS is not set
3403 +# CONFIG_SCSI_SAS_LIBSAS is not set
3404 +# CONFIG_SCSI_SRP_ATTRS is not set
3405 +CONFIG_SCSI_LOWLEVEL=y
3406 +# CONFIG_ISCSI_TCP is not set
3407 +# CONFIG_SCSI_DEBUG is not set
3409 +# CONFIG_ATA_NONSTANDARD is not set
3411 +# CONFIG_PATA_PLATFORM is not set
3412 +# CONFIG_MD is not set
3413 +CONFIG_NETDEVICES=y
3414 +# CONFIG_NETDEVICES_MULTIQUEUE is not set
3415 +# CONFIG_DUMMY is not set
3416 +# CONFIG_BONDING is not set
3417 +# CONFIG_MACVLAN is not set
3418 +# CONFIG_EQUALIZER is not set
3419 +# CONFIG_TUN is not set
3420 +# CONFIG_VETH is not set
3421 +# CONFIG_NET_ETHERNET is not set
3422 +# CONFIG_NETDEV_1000 is not set
3423 +# CONFIG_NETDEV_10000 is not set
3428 +# CONFIG_WLAN_PRE80211 is not set
3429 +# CONFIG_WLAN_80211 is not set
3430 +# CONFIG_WAN is not set
3432 +# CONFIG_PPP_MULTILINK is not set
3433 +# CONFIG_PPP_FILTER is not set
3435 +# CONFIG_PPP_SYNC_TTY is not set
3436 +CONFIG_PPP_DEFLATE=m
3437 +CONFIG_PPP_BSDCOMP=m
3438 +# CONFIG_PPP_MPPE is not set
3439 +# CONFIG_PPPOE is not set
3440 +# CONFIG_PPPOL2TP is not set
3441 +# CONFIG_SLIP is not set
3443 +# CONFIG_SHAPER is not set
3444 +# CONFIG_NETCONSOLE is not set
3445 +# CONFIG_NETPOLL is not set
3446 +# CONFIG_NET_POLL_CONTROLLER is not set
3447 +# CONFIG_ISDN is not set
3448 +# CONFIG_PHONE is not set
3451 +# Input device support
3454 +# CONFIG_INPUT_FF_MEMLESS is not set
3455 +CONFIG_INPUT_POLLDEV=m
3458 +# Userland interfaces
3460 +CONFIG_INPUT_MOUSEDEV=m
3461 +CONFIG_INPUT_MOUSEDEV_PSAUX=y
3462 +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
3463 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
3464 +# CONFIG_INPUT_JOYDEV is not set
3465 +# CONFIG_INPUT_EVDEV is not set
3466 +# CONFIG_INPUT_EVBUG is not set
3469 +# Input Device Drivers
3471 +CONFIG_INPUT_KEYBOARD=y
3472 +# CONFIG_KEYBOARD_ATKBD is not set
3473 +# CONFIG_KEYBOARD_SUNKBD is not set
3474 +# CONFIG_KEYBOARD_LKKBD is not set
3475 +# CONFIG_KEYBOARD_XTKBD is not set
3476 +# CONFIG_KEYBOARD_NEWTON is not set
3477 +# CONFIG_KEYBOARD_STOWAWAY is not set
3478 +CONFIG_KEYBOARD_GPIO=m
3479 +CONFIG_INPUT_MOUSE=y
3480 +# CONFIG_MOUSE_PS2 is not set
3481 +# CONFIG_MOUSE_SERIAL is not set
3482 +# CONFIG_MOUSE_VSXXXAA is not set
3483 +CONFIG_MOUSE_GPIO=m
3484 +# CONFIG_INPUT_JOYSTICK is not set
3485 +# CONFIG_INPUT_TABLET is not set
3486 +# CONFIG_INPUT_TOUCHSCREEN is not set
3487 +# CONFIG_INPUT_MISC is not set
3490 +# Hardware I/O ports
3492 +# CONFIG_SERIO is not set
3493 +# CONFIG_GAMEPORT is not set
3496 +# Character devices
3498 +# CONFIG_VT is not set
3499 +# CONFIG_SERIAL_NONSTANDARD is not set
3504 +# CONFIG_SERIAL_8250 is not set
3507 +# Non-8250 serial port support
3509 +CONFIG_SERIAL_ATMEL=y
3510 +CONFIG_SERIAL_ATMEL_CONSOLE=y
3511 +CONFIG_SERIAL_ATMEL_PDC=y
3512 +# CONFIG_SERIAL_ATMEL_TTYAT is not set
3513 +CONFIG_SERIAL_CORE=y
3514 +CONFIG_SERIAL_CORE_CONSOLE=y
3515 +CONFIG_UNIX98_PTYS=y
3516 +# CONFIG_LEGACY_PTYS is not set
3517 +# CONFIG_IPMI_HANDLER is not set
3518 +# CONFIG_HW_RANDOM is not set
3519 +# CONFIG_RTC is not set
3520 +# CONFIG_GEN_RTC is not set
3521 +# CONFIG_R3964 is not set
3522 +# CONFIG_RAW_DRIVER is not set
3523 +# CONFIG_TCG_TPM is not set
3525 +CONFIG_I2C_BOARDINFO=y
3526 +CONFIG_I2C_CHARDEV=m
3531 +CONFIG_I2C_ALGOBIT=m
3532 +# CONFIG_I2C_ALGOPCF is not set
3533 +# CONFIG_I2C_ALGOPCA is not set
3536 +# I2C Hardware Bus support
3538 +CONFIG_I2C_ATMELTWI=m
3540 +# CONFIG_I2C_OCORES is not set
3541 +# CONFIG_I2C_PARPORT_LIGHT is not set
3542 +# CONFIG_I2C_SIMTEC is not set
3543 +# CONFIG_I2C_TAOS_EVM is not set
3544 +# CONFIG_I2C_STUB is not set
3547 +# Miscellaneous I2C Chip support
3549 +# CONFIG_SENSORS_DS1337 is not set
3550 +# CONFIG_SENSORS_DS1374 is not set
3551 +# CONFIG_DS1682 is not set
3552 +# CONFIG_SENSORS_EEPROM is not set
3553 +# CONFIG_SENSORS_PCF8574 is not set
3554 +# CONFIG_SENSORS_PCA9539 is not set
3555 +# CONFIG_SENSORS_PCF8591 is not set
3556 +# CONFIG_SENSORS_MAX6875 is not set
3557 +# CONFIG_SENSORS_TSL2550 is not set
3558 +# CONFIG_I2C_DEBUG_CORE is not set
3559 +# CONFIG_I2C_DEBUG_ALGO is not set
3560 +# CONFIG_I2C_DEBUG_BUS is not set
3561 +# CONFIG_I2C_DEBUG_CHIP is not set
3567 +# CONFIG_SPI_DEBUG is not set
3568 +CONFIG_SPI_MASTER=y
3571 +# SPI Master Controller Drivers
3574 +# CONFIG_SPI_BITBANG is not set
3577 +# SPI Protocol Masters
3579 +# CONFIG_SPI_AT25 is not set
3580 +CONFIG_SPI_SPIDEV=m
3581 +# CONFIG_SPI_TLE62X0 is not set
3582 +# CONFIG_W1 is not set
3583 +# CONFIG_POWER_SUPPLY is not set
3584 +# CONFIG_HWMON is not set
3586 +# CONFIG_WATCHDOG_NOWAYOUT is not set
3589 +# Watchdog Device Drivers
3591 +# CONFIG_SOFT_WATCHDOG is not set
3592 +CONFIG_AT32AP700X_WDT=y
3595 +# Sonics Silicon Backplane
3597 +CONFIG_SSB_POSSIBLE=y
3598 +# CONFIG_SSB is not set
3601 +# Multifunction device drivers
3603 +# CONFIG_MFD_SM501 is not set
3606 +# Multimedia devices
3608 +# CONFIG_VIDEO_DEV is not set
3609 +# CONFIG_DVB_CORE is not set
3610 +# CONFIG_DAB is not set
3615 +# CONFIG_VGASTATE is not set
3616 +# CONFIG_VIDEO_OUTPUT_CONTROL is not set
3617 +# CONFIG_FB is not set
3618 +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
3621 +# Display device support
3623 +# CONFIG_DISPLAY_SUPPORT is not set
3631 +# Advanced Linux Sound Architecture
3636 +# CONFIG_SND_SEQUENCER is not set
3637 +CONFIG_SND_OSSEMUL=y
3638 +CONFIG_SND_MIXER_OSS=m
3639 +CONFIG_SND_PCM_OSS=m
3640 +CONFIG_SND_PCM_OSS_PLUGINS=y
3641 +# CONFIG_SND_DYNAMIC_MINORS is not set
3642 +CONFIG_SND_SUPPORT_OLD_API=y
3643 +CONFIG_SND_VERBOSE_PROCFS=y
3644 +# CONFIG_SND_VERBOSE_PRINTK is not set
3645 +# CONFIG_SND_DEBUG is not set
3650 +CONFIG_SND_AC97_CODEC=m
3651 +# CONFIG_SND_DUMMY is not set
3652 +# CONFIG_SND_MTPAV is not set
3653 +# CONFIG_SND_SERIAL_U16550 is not set
3654 +# CONFIG_SND_MPU401 is not set
3659 +CONFIG_SND_ATMEL_AC97=m
3664 +CONFIG_SND_AT73C213=m
3665 +CONFIG_SND_AT73C213_TARGET_BITRATE=48000
3668 +# System on Chip audio support
3670 +# CONFIG_SND_SOC is not set
3673 +# SoC Audio support for SuperH
3677 +# Open Sound System
3679 +# CONFIG_SOUND_PRIME is not set
3681 +# CONFIG_HID_SUPPORT is not set
3682 +CONFIG_USB_SUPPORT=y
3683 +# CONFIG_USB_ARCH_HAS_HCD is not set
3684 +# CONFIG_USB_ARCH_HAS_OHCI is not set
3685 +# CONFIG_USB_ARCH_HAS_EHCI is not set
3688 +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
3692 +# USB Gadget Support
3694 +CONFIG_USB_GADGET=y
3695 +# CONFIG_USB_GADGET_DEBUG is not set
3696 +# CONFIG_USB_GADGET_DEBUG_FILES is not set
3697 +CONFIG_USB_GADGET_DEBUG_FS=y
3698 +CONFIG_USB_GADGET_SELECTED=y
3699 +# CONFIG_USB_GADGET_AMD5536UDC is not set
3700 +CONFIG_USB_GADGET_ATMEL_USBA=y
3701 +CONFIG_USB_ATMEL_USBA=y
3702 +# CONFIG_USB_GADGET_FSL_USB2 is not set
3703 +# CONFIG_USB_GADGET_NET2280 is not set
3704 +# CONFIG_USB_GADGET_PXA2XX is not set
3705 +# CONFIG_USB_GADGET_M66592 is not set
3706 +# CONFIG_USB_GADGET_GOKU is not set
3707 +# CONFIG_USB_GADGET_LH7A40X is not set
3708 +# CONFIG_USB_GADGET_OMAP is not set
3709 +# CONFIG_USB_GADGET_S3C2410 is not set
3710 +# CONFIG_USB_GADGET_AT91 is not set
3711 +# CONFIG_USB_GADGET_DUMMY_HCD is not set
3712 +CONFIG_USB_GADGET_DUALSPEED=y
3715 +CONFIG_USB_ETH_RNDIS=y
3716 +CONFIG_USB_GADGETFS=m
3717 +CONFIG_USB_FILE_STORAGE=m
3718 +# CONFIG_USB_FILE_STORAGE_TEST is not set
3719 +CONFIG_USB_G_SERIAL=m
3720 +# CONFIG_USB_MIDI_GADGET is not set
3722 +# CONFIG_MMC_DEBUG is not set
3723 +# CONFIG_MMC_UNSAFE_RESUME is not set
3726 +# MMC/SD Card Drivers
3729 +# CONFIG_MMC_BLOCK_BOUNCE is not set
3730 +# CONFIG_SDIO_UART is not set
3733 +# MMC/SD Host Controller Drivers
3735 +CONFIG_MMC_ATMELMCI=y
3738 +CONFIG_LEDS_CLASS=y
3743 +CONFIG_LEDS_ATMEL_PWM=m
3749 +CONFIG_LEDS_TRIGGERS=y
3750 +CONFIG_LEDS_TRIGGER_TIMER=y
3751 +CONFIG_LEDS_TRIGGER_HEARTBEAT=y
3754 +CONFIG_RTC_HCTOSYS=y
3755 +CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
3756 +# CONFIG_RTC_DEBUG is not set
3761 +CONFIG_RTC_INTF_SYSFS=y
3762 +CONFIG_RTC_INTF_PROC=y
3763 +CONFIG_RTC_INTF_DEV=y
3764 +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
3765 +# CONFIG_RTC_DRV_TEST is not set
3770 +# CONFIG_RTC_DRV_DS1307 is not set
3771 +# CONFIG_RTC_DRV_DS1374 is not set
3772 +# CONFIG_RTC_DRV_DS1672 is not set
3773 +# CONFIG_RTC_DRV_MAX6900 is not set
3774 +# CONFIG_RTC_DRV_RS5C372 is not set
3775 +# CONFIG_RTC_DRV_ISL1208 is not set
3776 +# CONFIG_RTC_DRV_X1205 is not set
3777 +# CONFIG_RTC_DRV_PCF8563 is not set
3778 +# CONFIG_RTC_DRV_PCF8583 is not set
3779 +# CONFIG_RTC_DRV_M41T80 is not set
3784 +# CONFIG_RTC_DRV_RS5C348 is not set
3785 +# CONFIG_RTC_DRV_MAX6902 is not set
3788 +# Platform RTC drivers
3790 +# CONFIG_RTC_DRV_DS1553 is not set
3791 +# CONFIG_RTC_DRV_STK17TA8 is not set
3792 +# CONFIG_RTC_DRV_DS1742 is not set
3793 +# CONFIG_RTC_DRV_M48T86 is not set
3794 +# CONFIG_RTC_DRV_M48T59 is not set
3795 +# CONFIG_RTC_DRV_V3020 is not set
3798 +# on-CPU RTC drivers
3800 +CONFIG_RTC_DRV_AT32AP700X=y
3811 +# CONFIG_EXT2_FS_XATTR is not set
3812 +# CONFIG_EXT2_FS_XIP is not set
3814 +# CONFIG_EXT3_FS_XATTR is not set
3815 +# CONFIG_EXT4DEV_FS is not set
3817 +# CONFIG_JBD_DEBUG is not set
3818 +# CONFIG_REISERFS_FS is not set
3819 +# CONFIG_JFS_FS is not set
3820 +# CONFIG_FS_POSIX_ACL is not set
3821 +# CONFIG_XFS_FS is not set
3822 +# CONFIG_GFS2_FS is not set
3823 +# CONFIG_OCFS2_FS is not set
3824 +# CONFIG_MINIX_FS is not set
3825 +# CONFIG_ROMFS_FS is not set
3827 +CONFIG_INOTIFY_USER=y
3828 +# CONFIG_QUOTA is not set
3829 +# CONFIG_DNOTIFY is not set
3830 +# CONFIG_AUTOFS_FS is not set
3831 +# CONFIG_AUTOFS4_FS is not set
3835 +# CD-ROM/DVD Filesystems
3837 +# CONFIG_ISO9660_FS is not set
3838 +# CONFIG_UDF_FS is not set
3841 +# DOS/FAT/NT Filesystems
3846 +CONFIG_FAT_DEFAULT_CODEPAGE=437
3847 +CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
3848 +# CONFIG_NTFS_FS is not set
3851 +# Pseudo filesystems
3854 +CONFIG_PROC_KCORE=y
3855 +CONFIG_PROC_SYSCTL=y
3858 +# CONFIG_TMPFS_POSIX_ACL is not set
3859 +# CONFIG_HUGETLB_PAGE is not set
3860 +CONFIG_CONFIGFS_FS=y
3863 +# Miscellaneous filesystems
3865 +# CONFIG_ADFS_FS is not set
3866 +# CONFIG_AFFS_FS is not set
3867 +# CONFIG_HFS_FS is not set
3868 +# CONFIG_HFSPLUS_FS is not set
3869 +# CONFIG_BEFS_FS is not set
3870 +# CONFIG_BFS_FS is not set
3871 +# CONFIG_EFS_FS is not set
3873 +CONFIG_JFFS2_FS_DEBUG=0
3874 +CONFIG_JFFS2_FS_WRITEBUFFER=y
3875 +# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
3876 +# CONFIG_JFFS2_SUMMARY is not set
3877 +# CONFIG_JFFS2_FS_XATTR is not set
3878 +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
3879 +CONFIG_JFFS2_ZLIB=y
3880 +# CONFIG_JFFS2_LZO is not set
3881 +CONFIG_JFFS2_RTIME=y
3882 +# CONFIG_JFFS2_RUBIN is not set
3883 +# CONFIG_CRAMFS is not set
3884 +# CONFIG_VXFS_FS is not set
3885 +# CONFIG_HPFS_FS is not set
3886 +# CONFIG_QNX4FS_FS is not set
3887 +# CONFIG_SYSV_FS is not set
3888 +# CONFIG_UFS_FS is not set
3889 +# CONFIG_NETWORK_FILESYSTEMS is not set
3894 +# CONFIG_PARTITION_ADVANCED is not set
3895 +CONFIG_MSDOS_PARTITION=y
3897 +CONFIG_NLS_DEFAULT="iso8859-1"
3898 +CONFIG_NLS_CODEPAGE_437=m
3899 +# CONFIG_NLS_CODEPAGE_737 is not set
3900 +# CONFIG_NLS_CODEPAGE_775 is not set
3901 +# CONFIG_NLS_CODEPAGE_850 is not set
3902 +# CONFIG_NLS_CODEPAGE_852 is not set
3903 +# CONFIG_NLS_CODEPAGE_855 is not set
3904 +# CONFIG_NLS_CODEPAGE_857 is not set
3905 +# CONFIG_NLS_CODEPAGE_860 is not set
3906 +# CONFIG_NLS_CODEPAGE_861 is not set
3907 +# CONFIG_NLS_CODEPAGE_862 is not set
3908 +# CONFIG_NLS_CODEPAGE_863 is not set
3909 +# CONFIG_NLS_CODEPAGE_864 is not set
3910 +# CONFIG_NLS_CODEPAGE_865 is not set
3911 +# CONFIG_NLS_CODEPAGE_866 is not set
3912 +# CONFIG_NLS_CODEPAGE_869 is not set
3913 +# CONFIG_NLS_CODEPAGE_936 is not set
3914 +# CONFIG_NLS_CODEPAGE_950 is not set
3915 +# CONFIG_NLS_CODEPAGE_932 is not set
3916 +# CONFIG_NLS_CODEPAGE_949 is not set
3917 +# CONFIG_NLS_CODEPAGE_874 is not set
3918 +# CONFIG_NLS_ISO8859_8 is not set
3919 +# CONFIG_NLS_CODEPAGE_1250 is not set
3920 +# CONFIG_NLS_CODEPAGE_1251 is not set
3921 +# CONFIG_NLS_ASCII is not set
3922 +CONFIG_NLS_ISO8859_1=m
3923 +# CONFIG_NLS_ISO8859_2 is not set
3924 +# CONFIG_NLS_ISO8859_3 is not set
3925 +# CONFIG_NLS_ISO8859_4 is not set
3926 +# CONFIG_NLS_ISO8859_5 is not set
3927 +# CONFIG_NLS_ISO8859_6 is not set
3928 +# CONFIG_NLS_ISO8859_7 is not set
3929 +# CONFIG_NLS_ISO8859_9 is not set
3930 +# CONFIG_NLS_ISO8859_13 is not set
3931 +# CONFIG_NLS_ISO8859_14 is not set
3932 +# CONFIG_NLS_ISO8859_15 is not set
3933 +# CONFIG_NLS_KOI8_R is not set
3934 +# CONFIG_NLS_KOI8_U is not set
3936 +# CONFIG_DLM is not set
3937 +CONFIG_INSTRUMENTATION=y
3941 +# CONFIG_MARKERS is not set
3946 +# CONFIG_PRINTK_TIME is not set
3947 +CONFIG_ENABLE_WARN_DEPRECATED=y
3948 +CONFIG_ENABLE_MUST_CHECK=y
3949 +CONFIG_MAGIC_SYSRQ=y
3950 +# CONFIG_UNUSED_SYMBOLS is not set
3952 +# CONFIG_HEADERS_CHECK is not set
3953 +CONFIG_DEBUG_KERNEL=y
3954 +# CONFIG_DEBUG_SHIRQ is not set
3955 +CONFIG_DETECT_SOFTLOCKUP=y
3956 +CONFIG_SCHED_DEBUG=y
3957 +# CONFIG_SCHEDSTATS is not set
3958 +# CONFIG_TIMER_STATS is not set
3959 +# CONFIG_DEBUG_RT_MUTEXES is not set
3960 +# CONFIG_RT_MUTEX_TESTER is not set
3961 +# CONFIG_DEBUG_SPINLOCK is not set
3962 +# CONFIG_DEBUG_MUTEXES is not set
3963 +# CONFIG_DEBUG_LOCK_ALLOC is not set
3964 +# CONFIG_PROVE_LOCKING is not set
3965 +# CONFIG_LOCK_STAT is not set
3966 +# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
3967 +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
3968 +# CONFIG_DEBUG_KOBJECT is not set
3969 +CONFIG_DEBUG_BUGVERBOSE=y
3970 +# CONFIG_DEBUG_INFO is not set
3971 +# CONFIG_DEBUG_VM is not set
3972 +# CONFIG_DEBUG_LIST is not set
3973 +# CONFIG_DEBUG_SG is not set
3974 +CONFIG_FRAME_POINTER=y
3975 +CONFIG_FORCED_INLINING=y
3976 +# CONFIG_BOOT_PRINTK_DELAY is not set
3977 +# CONFIG_RCU_TORTURE_TEST is not set
3978 +# CONFIG_LKDTM is not set
3979 +# CONFIG_FAULT_INJECTION is not set
3980 +# CONFIG_SAMPLES is not set
3985 +# CONFIG_KEYS is not set
3986 +# CONFIG_SECURITY is not set
3987 +# CONFIG_SECURITY_FILE_CAPABILITIES is not set
3988 +# CONFIG_CRYPTO is not set
3993 +CONFIG_BITREVERSE=y
3995 +# CONFIG_CRC16 is not set
3999 +# CONFIG_LIBCRC32C is not set
4000 +CONFIG_AUDIT_GENERIC=y
4001 +CONFIG_ZLIB_INFLATE=y
4002 +CONFIG_ZLIB_DEFLATE=y
4005 +CONFIG_HAS_IOPORT=y
4007 diff -urN linux-2.6.24.3/arch/avr32/configs/atstk1004_defconfig avr32-2.6/arch/avr32/configs/atstk1004_defconfig
4008 --- linux-2.6.24.3/arch/avr32/configs/atstk1004_defconfig 1970-01-01 01:00:00.000000000 +0100
4009 +++ avr32-2.6/arch/avr32/configs/atstk1004_defconfig 2008-04-23 20:12:35.000000000 +0200
4012 +# Automatically generated make config: don't edit
4013 +# Linux kernel version: 2.6.24
4014 +# Thu Mar 6 12:51:05 2008
4017 +CONFIG_GENERIC_GPIO=y
4018 +CONFIG_GENERIC_HARDIRQS=y
4019 +CONFIG_STACKTRACE_SUPPORT=y
4020 +CONFIG_LOCKDEP_SUPPORT=y
4021 +CONFIG_TRACE_IRQFLAGS_SUPPORT=y
4022 +CONFIG_HARDIRQS_SW_RESEND=y
4023 +CONFIG_GENERIC_IRQ_PROBE=y
4024 +CONFIG_RWSEM_GENERIC_SPINLOCK=y
4025 +CONFIG_GENERIC_TIME=y
4026 +CONFIG_GENERIC_CLOCKEVENTS=y
4027 +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
4028 +# CONFIG_ARCH_HAS_ILOG2_U32 is not set
4029 +# CONFIG_ARCH_HAS_ILOG2_U64 is not set
4030 +CONFIG_ARCH_SUPPORTS_OPROFILE=y
4031 +CONFIG_GENERIC_HWEIGHT=y
4032 +CONFIG_GENERIC_CALIBRATE_DELAY=y
4033 +CONFIG_GENERIC_BUG=y
4034 +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
4039 +CONFIG_EXPERIMENTAL=y
4040 +CONFIG_BROKEN_ON_SMP=y
4041 +CONFIG_INIT_ENV_ARG_LIMIT=32
4042 +CONFIG_LOCALVERSION=""
4043 +# CONFIG_LOCALVERSION_AUTO is not set
4044 +# CONFIG_SYSVIPC is not set
4045 +# CONFIG_POSIX_MQUEUE is not set
4046 +# CONFIG_BSD_PROCESS_ACCT is not set
4047 +# CONFIG_TASKSTATS is not set
4048 +# CONFIG_USER_NS is not set
4049 +# CONFIG_PID_NS is not set
4050 +# CONFIG_AUDIT is not set
4051 +# CONFIG_IKCONFIG is not set
4052 +CONFIG_LOG_BUF_SHIFT=14
4053 +# CONFIG_CGROUPS is not set
4054 +# CONFIG_FAIR_GROUP_SCHED is not set
4055 +CONFIG_SYSFS_DEPRECATED=y
4056 +# CONFIG_RELAY is not set
4057 +# CONFIG_BLK_DEV_INITRD is not set
4058 +CONFIG_CC_OPTIMIZE_FOR_SIZE=y
4061 +# CONFIG_SYSCTL_SYSCALL is not set
4063 +# CONFIG_KALLSYMS_EXTRA_PASS is not set
4068 +# CONFIG_BASE_FULL is not set
4069 +# CONFIG_FUTEX is not set
4070 +# CONFIG_EPOLL is not set
4071 +# CONFIG_SIGNALFD is not set
4072 +# CONFIG_EVENTFD is not set
4074 +CONFIG_VM_EVENT_COUNTERS=y
4075 +# CONFIG_SLAB is not set
4076 +# CONFIG_SLUB is not set
4078 +# CONFIG_TINY_SHMEM is not set
4079 +CONFIG_BASE_SMALL=1
4080 +# CONFIG_MODULES is not set
4081 +# CONFIG_BLOCK is not set
4084 +# System Type and features
4086 +CONFIG_TICK_ONESHOT=y
4088 +CONFIG_HIGH_RES_TIMERS=y
4089 +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
4090 +CONFIG_SUBARCH_AVR32B=y
4092 +CONFIG_PERFORMANCE_COUNTERS=y
4093 +CONFIG_PLATFORM_AT32AP=y
4094 +CONFIG_CPU_AT32AP700X=y
4095 +CONFIG_CPU_AT32AP7002=y
4096 +CONFIG_BOARD_ATSTK1000=y
4097 +# CONFIG_BOARD_ATNGW100 is not set
4098 +# CONFIG_BOARD_ATSTK1002 is not set
4099 +# CONFIG_BOARD_ATSTK1003 is not set
4100 +CONFIG_BOARD_ATSTK1004=y
4101 +# CONFIG_BOARD_ATSTK100X_CUSTOM is not set
4102 +# CONFIG_BOARD_ATSTK100X_SPI1 is not set
4103 +# CONFIG_BOARD_ATSTK1000_J2_LED is not set
4104 +CONFIG_BOARD_ATSTK1000_EXTDAC=y
4105 +# CONFIG_BOARD_ATSTK100X_ENABLE_AC97 is not set
4106 +# CONFIG_BOARD_ATSTK1000_CF_HACKS is not set
4107 +# CONFIG_BOARD_ATSTK100X_ENABLE_PSIF is not set
4108 +CONFIG_LOADER_U_BOOT=y
4111 +# Atmel AVR32 AP options
4113 +# CONFIG_AP700X_32_BIT_SMC is not set
4114 +CONFIG_AP700X_16_BIT_SMC=y
4115 +# CONFIG_AP700X_8_BIT_SMC is not set
4116 +# CONFIG_GPIO_DEV is not set
4117 +CONFIG_LOAD_ADDRESS=0x10000000
4118 +CONFIG_ENTRY_ADDRESS=0x90000000
4119 +CONFIG_PHYS_OFFSET=0x10000000
4120 +CONFIG_PREEMPT_NONE=y
4121 +# CONFIG_PREEMPT_VOLUNTARY is not set
4122 +# CONFIG_PREEMPT is not set
4123 +# CONFIG_HAVE_ARCH_BOOTMEM_NODE is not set
4124 +# CONFIG_ARCH_HAVE_MEMORY_PRESENT is not set
4125 +# CONFIG_NEED_NODE_MEMMAP_SIZE is not set
4126 +CONFIG_ARCH_FLATMEM_ENABLE=y
4127 +# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
4128 +# CONFIG_ARCH_SPARSEMEM_ENABLE is not set
4129 +CONFIG_SELECT_MEMORY_MODEL=y
4130 +CONFIG_FLATMEM_MANUAL=y
4131 +# CONFIG_DISCONTIGMEM_MANUAL is not set
4132 +# CONFIG_SPARSEMEM_MANUAL is not set
4134 +CONFIG_FLAT_NODE_MEM_MAP=y
4135 +# CONFIG_SPARSEMEM_STATIC is not set
4136 +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
4137 +CONFIG_SPLIT_PTLOCK_CPUS=4
4138 +# CONFIG_RESOURCES_64BIT is not set
4139 +CONFIG_ZONE_DMA_FLAG=0
4140 +CONFIG_VIRT_TO_BUS=y
4141 +# CONFIG_OWNERSHIP_TRACE is not set
4142 +# CONFIG_NMI_DEBUGGING is not set
4143 +# CONFIG_DW_DMAC is not set
4144 +# CONFIG_HZ_100 is not set
4146 +# CONFIG_HZ_300 is not set
4147 +# CONFIG_HZ_1000 is not set
4152 +# Power management options
4156 +# CPU Frequency scaling
4159 +CONFIG_CPU_FREQ_TABLE=y
4160 +# CONFIG_CPU_FREQ_DEBUG is not set
4161 +# CONFIG_CPU_FREQ_STAT is not set
4162 +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
4163 +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
4164 +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
4165 +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
4166 +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
4167 +# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
4168 +CONFIG_CPU_FREQ_GOV_USERSPACE=y
4169 +CONFIG_CPU_FREQ_GOV_ONDEMAND=y
4170 +# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
4171 +CONFIG_CPU_FREQ_AT32AP=y
4176 +# CONFIG_ARCH_SUPPORTS_MSI is not set
4177 +# CONFIG_PCCARD is not set
4180 +# Executable file formats
4182 +CONFIG_BINFMT_ELF=y
4183 +# CONFIG_BINFMT_MISC is not set
4191 +# Networking options
4194 +CONFIG_PACKET_MMAP=y
4196 +# CONFIG_NET_KEY is not set
4198 +# CONFIG_IP_MULTICAST is not set
4199 +# CONFIG_IP_ADVANCED_ROUTER is not set
4200 +CONFIG_IP_FIB_HASH=y
4201 +# CONFIG_IP_PNP is not set
4202 +# CONFIG_NET_IPIP is not set
4203 +# CONFIG_NET_IPGRE is not set
4204 +# CONFIG_ARPD is not set
4205 +# CONFIG_SYN_COOKIES is not set
4206 +# CONFIG_INET_AH is not set
4207 +# CONFIG_INET_ESP is not set
4208 +# CONFIG_INET_IPCOMP is not set
4209 +# CONFIG_INET_XFRM_TUNNEL is not set
4210 +# CONFIG_INET_TUNNEL is not set
4211 +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
4212 +# CONFIG_INET_XFRM_MODE_TUNNEL is not set
4213 +# CONFIG_INET_XFRM_MODE_BEET is not set
4214 +# CONFIG_INET_LRO is not set
4215 +# CONFIG_INET_DIAG is not set
4216 +# CONFIG_TCP_CONG_ADVANCED is not set
4217 +CONFIG_TCP_CONG_CUBIC=y
4218 +CONFIG_DEFAULT_TCP_CONG="cubic"
4219 +# CONFIG_TCP_MD5SIG is not set
4220 +# CONFIG_IPV6 is not set
4221 +# CONFIG_INET6_XFRM_TUNNEL is not set
4222 +# CONFIG_INET6_TUNNEL is not set
4223 +# CONFIG_NETWORK_SECMARK is not set
4224 +# CONFIG_NETFILTER is not set
4225 +# CONFIG_IP_DCCP is not set
4226 +# CONFIG_IP_SCTP is not set
4227 +# CONFIG_TIPC is not set
4228 +# CONFIG_ATM is not set
4229 +# CONFIG_BRIDGE is not set
4230 +# CONFIG_VLAN_8021Q is not set
4231 +# CONFIG_DECNET is not set
4232 +# CONFIG_LLC2 is not set
4233 +# CONFIG_IPX is not set
4234 +# CONFIG_ATALK is not set
4235 +# CONFIG_X25 is not set
4236 +# CONFIG_LAPB is not set
4237 +# CONFIG_ECONET is not set
4238 +# CONFIG_WAN_ROUTER is not set
4239 +# CONFIG_NET_SCHED is not set
4244 +# CONFIG_NET_PKTGEN is not set
4245 +# CONFIG_HAMRADIO is not set
4246 +# CONFIG_IRDA is not set
4247 +# CONFIG_BT is not set
4248 +# CONFIG_AF_RXRPC is not set
4253 +# CONFIG_CFG80211 is not set
4254 +# CONFIG_WIRELESS_EXT is not set
4255 +# CONFIG_MAC80211 is not set
4256 +# CONFIG_IEEE80211 is not set
4257 +# CONFIG_RFKILL is not set
4258 +# CONFIG_NET_9P is not set
4265 +# Generic Driver Options
4267 +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
4268 +CONFIG_STANDALONE=y
4269 +# CONFIG_PREVENT_FIRMWARE_BUILD is not set
4270 +# CONFIG_FW_LOADER is not set
4271 +# CONFIG_SYS_HYPERVISOR is not set
4272 +# CONFIG_CONNECTOR is not set
4274 +# CONFIG_MTD_DEBUG is not set
4275 +# CONFIG_MTD_CONCAT is not set
4276 +CONFIG_MTD_PARTITIONS=y
4277 +# CONFIG_MTD_REDBOOT_PARTS is not set
4278 +CONFIG_MTD_CMDLINE_PARTS=y
4281 +# User Modules And Translation Layers
4284 +# CONFIG_MTD_OOPS is not set
4287 +# RAM/ROM/Flash chip drivers
4290 +# CONFIG_MTD_JEDECPROBE is not set
4291 +CONFIG_MTD_GEN_PROBE=y
4292 +# CONFIG_MTD_CFI_ADV_OPTIONS is not set
4293 +CONFIG_MTD_MAP_BANK_WIDTH_1=y
4294 +CONFIG_MTD_MAP_BANK_WIDTH_2=y
4295 +CONFIG_MTD_MAP_BANK_WIDTH_4=y
4296 +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
4297 +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
4298 +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
4299 +CONFIG_MTD_CFI_I1=y
4300 +CONFIG_MTD_CFI_I2=y
4301 +# CONFIG_MTD_CFI_I4 is not set
4302 +# CONFIG_MTD_CFI_I8 is not set
4303 +# CONFIG_MTD_CFI_INTELEXT is not set
4304 +CONFIG_MTD_CFI_AMDSTD=y
4305 +# CONFIG_MTD_CFI_STAA is not set
4306 +CONFIG_MTD_CFI_UTIL=y
4307 +# CONFIG_MTD_RAM is not set
4308 +# CONFIG_MTD_ROM is not set
4309 +# CONFIG_MTD_ABSENT is not set
4312 +# Mapping drivers for chip access
4314 +# CONFIG_MTD_COMPLEX_MAPPINGS is not set
4315 +CONFIG_MTD_PHYSMAP=y
4316 +CONFIG_MTD_PHYSMAP_START=0x8000000
4317 +CONFIG_MTD_PHYSMAP_LEN=0x0
4318 +CONFIG_MTD_PHYSMAP_BANKWIDTH=2
4319 +# CONFIG_MTD_PLATRAM is not set
4322 +# Self-contained MTD device drivers
4324 +# CONFIG_MTD_DATAFLASH is not set
4325 +# CONFIG_MTD_M25P80 is not set
4326 +# CONFIG_MTD_SLRAM is not set
4327 +# CONFIG_MTD_PHRAM is not set
4328 +# CONFIG_MTD_MTDRAM is not set
4331 +# Disk-On-Chip Device Drivers
4333 +# CONFIG_MTD_DOC2000 is not set
4334 +# CONFIG_MTD_DOC2001 is not set
4335 +# CONFIG_MTD_DOC2001PLUS is not set
4336 +# CONFIG_MTD_NAND is not set
4337 +# CONFIG_MTD_ONENAND is not set
4340 +# UBI - Unsorted block images
4342 +# CONFIG_MTD_UBI is not set
4343 +# CONFIG_PARPORT is not set
4344 +CONFIG_MISC_DEVICES=y
4345 +# CONFIG_ATMEL_PWM is not set
4346 +CONFIG_ATMEL_TCLIB=y
4347 +CONFIG_ATMEL_TCB_CLKSRC=y
4348 +CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0
4349 +# CONFIG_EEPROM_93CX6 is not set
4350 +# CONFIG_ATMEL_SSC is not set
4353 +# SCSI device support
4355 +# CONFIG_SCSI_DMA is not set
4356 +# CONFIG_SCSI_NETLINK is not set
4357 +# CONFIG_NETDEVICES is not set
4358 +# CONFIG_ISDN is not set
4359 +# CONFIG_PHONE is not set
4362 +# Input device support
4364 +# CONFIG_INPUT is not set
4367 +# Hardware I/O ports
4369 +# CONFIG_SERIO is not set
4370 +# CONFIG_GAMEPORT is not set
4373 +# Character devices
4375 +# CONFIG_VT is not set
4376 +# CONFIG_SERIAL_NONSTANDARD is not set
4381 +# CONFIG_SERIAL_8250 is not set
4384 +# Non-8250 serial port support
4386 +CONFIG_SERIAL_ATMEL=y
4387 +CONFIG_SERIAL_ATMEL_CONSOLE=y
4388 +# CONFIG_SERIAL_ATMEL_PDC is not set
4389 +# CONFIG_SERIAL_ATMEL_TTYAT is not set
4390 +CONFIG_SERIAL_CORE=y
4391 +CONFIG_SERIAL_CORE_CONSOLE=y
4392 +CONFIG_UNIX98_PTYS=y
4393 +# CONFIG_LEGACY_PTYS is not set
4394 +# CONFIG_IPMI_HANDLER is not set
4395 +# CONFIG_HW_RANDOM is not set
4396 +# CONFIG_RTC is not set
4397 +# CONFIG_GEN_RTC is not set
4398 +# CONFIG_R3964 is not set
4399 +# CONFIG_TCG_TPM is not set
4400 +# CONFIG_I2C is not set
4406 +CONFIG_SPI_MASTER=y
4409 +# SPI Master Controller Drivers
4412 +# CONFIG_SPI_BITBANG is not set
4415 +# SPI Protocol Masters
4417 +# CONFIG_SPI_AT25 is not set
4418 +# CONFIG_SPI_SPIDEV is not set
4419 +# CONFIG_SPI_TLE62X0 is not set
4420 +# CONFIG_W1 is not set
4421 +# CONFIG_POWER_SUPPLY is not set
4422 +# CONFIG_HWMON is not set
4424 +# CONFIG_WATCHDOG_NOWAYOUT is not set
4427 +# Watchdog Device Drivers
4429 +# CONFIG_SOFT_WATCHDOG is not set
4430 +CONFIG_AT32AP700X_WDT=y
4433 +# Sonics Silicon Backplane
4435 +CONFIG_SSB_POSSIBLE=y
4436 +# CONFIG_SSB is not set
4439 +# Multifunction device drivers
4441 +# CONFIG_MFD_SM501 is not set
4444 +# Multimedia devices
4446 +# CONFIG_VIDEO_DEV is not set
4447 +# CONFIG_DVB_CORE is not set
4448 +# CONFIG_DAB is not set
4453 +# CONFIG_VGASTATE is not set
4454 +# CONFIG_VIDEO_OUTPUT_CONTROL is not set
4456 +# CONFIG_FIRMWARE_EDID is not set
4457 +# CONFIG_FB_DDC is not set
4458 +CONFIG_FB_CFB_FILLRECT=y
4459 +CONFIG_FB_CFB_COPYAREA=y
4460 +CONFIG_FB_CFB_IMAGEBLIT=y
4461 +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
4462 +# CONFIG_FB_SYS_FILLRECT is not set
4463 +# CONFIG_FB_SYS_COPYAREA is not set
4464 +# CONFIG_FB_SYS_IMAGEBLIT is not set
4465 +# CONFIG_FB_SYS_FOPS is not set
4466 +CONFIG_FB_DEFERRED_IO=y
4467 +# CONFIG_FB_SVGALIB is not set
4468 +# CONFIG_FB_MACMODES is not set
4469 +# CONFIG_FB_BACKLIGHT is not set
4470 +# CONFIG_FB_MODE_HELPERS is not set
4471 +# CONFIG_FB_TILEBLITTING is not set
4474 +# Frame buffer hardware drivers
4476 +# CONFIG_FB_S1D13XXX is not set
4478 +# CONFIG_FB_VIRTUAL is not set
4479 +CONFIG_BACKLIGHT_LCD_SUPPORT=y
4480 +CONFIG_LCD_CLASS_DEVICE=y
4481 +CONFIG_LCD_LTV350QV=y
4482 +# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
4485 +# Display device support
4487 +# CONFIG_DISPLAY_SUPPORT is not set
4488 +# CONFIG_LOGO is not set
4493 +# CONFIG_SOUND is not set
4494 +CONFIG_USB_SUPPORT=y
4495 +# CONFIG_USB_ARCH_HAS_HCD is not set
4496 +# CONFIG_USB_ARCH_HAS_OHCI is not set
4497 +# CONFIG_USB_ARCH_HAS_EHCI is not set
4500 +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
4504 +# USB Gadget Support
4506 +CONFIG_USB_GADGET=y
4507 +# CONFIG_USB_GADGET_DEBUG_FILES is not set
4508 +CONFIG_USB_GADGET_SELECTED=y
4509 +# CONFIG_USB_GADGET_AMD5536UDC is not set
4510 +CONFIG_USB_GADGET_ATMEL_USBA=y
4511 +CONFIG_USB_ATMEL_USBA=y
4512 +# CONFIG_USB_GADGET_FSL_USB2 is not set
4513 +# CONFIG_USB_GADGET_NET2280 is not set
4514 +# CONFIG_USB_GADGET_PXA2XX is not set
4515 +# CONFIG_USB_GADGET_M66592 is not set
4516 +# CONFIG_USB_GADGET_GOKU is not set
4517 +# CONFIG_USB_GADGET_LH7A40X is not set
4518 +# CONFIG_USB_GADGET_OMAP is not set
4519 +# CONFIG_USB_GADGET_S3C2410 is not set
4520 +# CONFIG_USB_GADGET_AT91 is not set
4521 +# CONFIG_USB_GADGET_DUMMY_HCD is not set
4522 +CONFIG_USB_GADGET_DUALSPEED=y
4523 +# CONFIG_USB_ZERO is not set
4525 +# CONFIG_USB_ETH_RNDIS is not set
4526 +# CONFIG_USB_GADGETFS is not set
4527 +# CONFIG_USB_FILE_STORAGE is not set
4528 +# CONFIG_USB_G_SERIAL is not set
4529 +# CONFIG_USB_MIDI_GADGET is not set
4530 +# CONFIG_MMC is not set
4531 +# CONFIG_NEW_LEDS is not set
4534 +CONFIG_RTC_HCTOSYS=y
4535 +CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
4536 +# CONFIG_RTC_DEBUG is not set
4541 +CONFIG_RTC_INTF_SYSFS=y
4542 +# CONFIG_RTC_INTF_PROC is not set
4543 +CONFIG_RTC_INTF_DEV=y
4544 +# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
4545 +# CONFIG_RTC_DRV_TEST is not set
4550 +# CONFIG_RTC_DRV_RS5C348 is not set
4551 +# CONFIG_RTC_DRV_MAX6902 is not set
4554 +# Platform RTC drivers
4556 +# CONFIG_RTC_DRV_DS1553 is not set
4557 +# CONFIG_RTC_DRV_STK17TA8 is not set
4558 +# CONFIG_RTC_DRV_DS1742 is not set
4559 +# CONFIG_RTC_DRV_M48T86 is not set
4560 +# CONFIG_RTC_DRV_M48T59 is not set
4561 +# CONFIG_RTC_DRV_V3020 is not set
4564 +# on-CPU RTC drivers
4566 +CONFIG_RTC_DRV_AT32AP700X=y
4571 +# CONFIG_UIO is not set
4576 +# CONFIG_INOTIFY is not set
4577 +# CONFIG_QUOTA is not set
4578 +# CONFIG_DNOTIFY is not set
4579 +# CONFIG_AUTOFS_FS is not set
4580 +# CONFIG_AUTOFS4_FS is not set
4581 +# CONFIG_FUSE_FS is not set
4584 +# Pseudo filesystems
4587 +CONFIG_PROC_KCORE=y
4588 +CONFIG_PROC_SYSCTL=y
4591 +# CONFIG_TMPFS_POSIX_ACL is not set
4592 +# CONFIG_HUGETLB_PAGE is not set
4593 +# CONFIG_CONFIGFS_FS is not set
4596 +# Miscellaneous filesystems
4599 +CONFIG_JFFS2_FS_DEBUG=0
4600 +# CONFIG_JFFS2_FS_WRITEBUFFER is not set
4601 +# CONFIG_JFFS2_SUMMARY is not set
4602 +# CONFIG_JFFS2_FS_XATTR is not set
4603 +# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
4604 +CONFIG_JFFS2_ZLIB=y
4605 +# CONFIG_JFFS2_LZO is not set
4606 +CONFIG_JFFS2_RTIME=y
4607 +# CONFIG_JFFS2_RUBIN is not set
4608 +# CONFIG_NETWORK_FILESYSTEMS is not set
4609 +# CONFIG_NLS is not set
4610 +# CONFIG_DLM is not set
4611 +# CONFIG_INSTRUMENTATION is not set
4616 +# CONFIG_PRINTK_TIME is not set
4617 +CONFIG_ENABLE_WARN_DEPRECATED=y
4618 +CONFIG_ENABLE_MUST_CHECK=y
4619 +CONFIG_MAGIC_SYSRQ=y
4620 +# CONFIG_UNUSED_SYMBOLS is not set
4621 +# CONFIG_DEBUG_FS is not set
4622 +# CONFIG_HEADERS_CHECK is not set
4623 +# CONFIG_DEBUG_KERNEL is not set
4624 +# CONFIG_DEBUG_BUGVERBOSE is not set
4625 +# CONFIG_SAMPLES is not set
4630 +# CONFIG_KEYS is not set
4631 +# CONFIG_SECURITY is not set
4632 +# CONFIG_SECURITY_FILE_CAPABILITIES is not set
4633 +# CONFIG_CRYPTO is not set
4638 +CONFIG_BITREVERSE=y
4639 +# CONFIG_CRC_CCITT is not set
4640 +# CONFIG_CRC16 is not set
4641 +# CONFIG_CRC_ITU_T is not set
4643 +# CONFIG_CRC7 is not set
4644 +# CONFIG_LIBCRC32C is not set
4645 +CONFIG_ZLIB_INFLATE=y
4646 +CONFIG_ZLIB_DEFLATE=y
4648 +CONFIG_HAS_IOPORT=y
4650 diff -urN linux-2.6.24.3/arch/avr32/drivers/dw-dmac.c avr32-2.6/arch/avr32/drivers/dw-dmac.c
4651 --- linux-2.6.24.3/arch/avr32/drivers/dw-dmac.c 1970-01-01 01:00:00.000000000 +0100
4652 +++ avr32-2.6/arch/avr32/drivers/dw-dmac.c 2008-04-23 19:33:28.000000000 +0200
4655 + * Driver for the Synopsys DesignWare DMA Controller
4657 + * Copyright (C) 2005-2006 Atmel Corporation
4659 + * This program is free software; you can redistribute it and/or modify
4660 + * it under the terms of the GNU General Public License version 2 as
4661 + * published by the Free Software Foundation.
4663 +#include <linux/clk.h>
4664 +#include <linux/device.h>
4665 +#include <linux/dma-mapping.h>
4666 +#include <linux/dmapool.h>
4667 +#include <linux/init.h>
4668 +#include <linux/interrupt.h>
4669 +#include <linux/module.h>
4670 +#include <linux/platform_device.h>
4672 +#include <asm/dma-controller.h>
4673 +#include <asm/io.h>
4675 +#include "dw-dmac.h"
4677 +#define DMAC_NR_CHANNELS 3
4678 +#define DMAC_MAX_BLOCKSIZE 4095
4681 + CH_STATE_FREE = 0,
4682 + CH_STATE_ALLOCATED,
4686 +struct dw_dma_lli {
4696 +struct dw_dma_block {
4697 + struct dw_dma_lli *lli_vaddr;
4698 + dma_addr_t lli_dma_addr;
4701 +struct dw_dma_channel {
4702 + unsigned int state;
4704 + struct dma_request_sg *req_sg;
4705 + struct dma_request_cyclic *req_cyclic;
4706 + unsigned int nr_blocks;
4708 + struct dw_dma_block *block;
4711 +struct dw_dma_controller {
4713 + void * __iomem regs;
4714 + struct dma_pool *lli_pool;
4716 + struct dma_controller dma;
4717 + struct dw_dma_channel channel[DMAC_NR_CHANNELS];
4719 +#define to_dw_dmac(dmac) container_of(dmac, struct dw_dma_controller, dma)
4721 +#define dmac_writel_hi(dmac, reg, value) \
4722 + __raw_writel((value), (dmac)->regs + DW_DMAC_##reg + 4)
4723 +#define dmac_readl_hi(dmac, reg) \
4724 + __raw_readl((dmac)->regs + DW_DMAC_##reg + 4)
4725 +#define dmac_writel_lo(dmac, reg, value) \
4726 + __raw_writel((value), (dmac)->regs + DW_DMAC_##reg)
4727 +#define dmac_readl_lo(dmac, reg) \
4728 + __raw_readl((dmac)->regs + DW_DMAC_##reg)
4729 +#define dmac_chan_writel_hi(dmac, chan, reg, value) \
4730 + __raw_writel((value), ((dmac)->regs + 0x58 * (chan) \
4731 + + DW_DMAC_CHAN_##reg + 4))
4732 +#define dmac_chan_readl_hi(dmac, chan, reg) \
4733 + __raw_readl((dmac)->regs + 0x58 * (chan) + DW_DMAC_CHAN_##reg + 4)
4734 +#define dmac_chan_writel_lo(dmac, chan, reg, value) \
4735 + __raw_writel((value), (dmac)->regs + 0x58 * (chan) + DW_DMAC_CHAN_##reg)
4736 +#define dmac_chan_readl_lo(dmac, chan, reg) \
4737 + __raw_readl((dmac)->regs + 0x58 * (chan) + DW_DMAC_CHAN_##reg)
4738 +#define set_channel_bit(dmac, reg, chan) \
4739 + dmac_writel_lo(dmac, reg, (1 << (chan)) | (1 << ((chan) + 8)))
4740 +#define clear_channel_bit(dmac, reg, chan) \
4741 + dmac_writel_lo(dmac, reg, (0 << (chan)) | (1 << ((chan) + 8)))
4743 +static int dmac_alloc_channel(struct dma_controller *_dmac)
4745 + struct dw_dma_controller *dmac = to_dw_dmac(_dmac);
4746 + struct dw_dma_channel *chan;
4747 + unsigned long flags;
4750 + spin_lock_irqsave(&dmac->lock, flags);
4751 + for (i = 0; i < DMAC_NR_CHANNELS; i++)
4752 + if (dmac->channel[i].state == CH_STATE_FREE)
4755 + if (i < DMAC_NR_CHANNELS) {
4756 + chan = &dmac->channel[i];
4757 + chan->state = CH_STATE_ALLOCATED;
4762 + spin_unlock_irqrestore(&dmac->lock, flags);
4767 +static void dmac_release_channel(struct dma_controller *_dmac, int channel)
4769 + struct dw_dma_controller *dmac = to_dw_dmac(_dmac);
4771 + BUG_ON(channel >= DMAC_NR_CHANNELS
4772 + || dmac->channel[channel].state != CH_STATE_ALLOCATED);
4774 + dmac->channel[channel].state = CH_STATE_FREE;
4777 +static struct dw_dma_block *allocate_blocks(struct dw_dma_controller *dmac,
4778 + unsigned int nr_blocks)
4780 + struct dw_dma_block *block;
4784 + block = kmalloc(nr_blocks * sizeof(*block),
4786 + if (unlikely(!block))
4789 + for (i = 0; i < nr_blocks; i++) {
4790 + p = dma_pool_alloc(dmac->lli_pool, GFP_KERNEL,
4791 + &block[i].lli_dma_addr);
4792 + block[i].lli_vaddr = p;
4800 + for (i = 0; i < nr_blocks; i++) {
4801 + if (!block[i].lli_vaddr)
4803 + dma_pool_free(dmac->lli_pool, block[i].lli_vaddr,
4804 + block[i].lli_dma_addr);
4810 +static void cleanup_channel(struct dw_dma_controller *dmac,
4811 + struct dw_dma_channel *chan)
4815 + if (chan->nr_blocks > 1) {
4816 + for (i = 0; i < chan->nr_blocks; i++)
4817 + dma_pool_free(dmac->lli_pool, chan->block[i].lli_vaddr,
4818 + chan->block[i].lli_dma_addr);
4819 + kfree(chan->block);
4822 + chan->state = CH_STATE_ALLOCATED;
4825 +static int dmac_prepare_request_sg(struct dma_controller *_dmac,
4826 + struct dma_request_sg *req)
4828 + struct dw_dma_controller *dmac = to_dw_dmac(_dmac);
4829 + struct dw_dma_channel *chan;
4830 + unsigned long ctlhi, ctllo, cfghi, cfglo;
4831 + unsigned long block_size;
4832 + unsigned int nr_blocks;
4833 + int ret, i, direction;
4834 + unsigned long flags;
4836 + spin_lock_irqsave(&dmac->lock, flags);
4839 + if (req->req.channel >= DMAC_NR_CHANNELS
4840 + || dmac->channel[req->req.channel].state != CH_STATE_ALLOCATED
4841 + || req->block_size > DMAC_MAX_BLOCKSIZE) {
4842 + spin_unlock_irqrestore(&dmac->lock, flags);
4846 + chan = &dmac->channel[req->req.channel];
4847 + chan->state = CH_STATE_BUSY;
4848 + chan->req_sg = req;
4849 + chan->is_cyclic = 0;
4852 + * We have marked the channel as busy, so no need to keep the
4853 + * lock as long as we only touch the channel-specific
4856 + spin_unlock_irqrestore(&dmac->lock, flags);
4859 + * There may be limitations in the driver and/or the DMA
4860 + * controller that prevents us from sending a whole
4861 + * scatterlist item in one go. Taking this into account,
4862 + * calculate the number of block transfers we need to set up.
4864 + * FIXME: Let the peripheral driver know about the maximum
4865 + * block size we support. We really don't want to use a
4866 + * different block size than what was suggested by the
4869 + * Each block will get its own Linked List Item (LLI) below.
4871 + block_size = req->block_size;
4872 + nr_blocks = req->nr_blocks;
4873 + pr_debug("block_size %lu, nr_blocks %u nr_sg = %u\n",
4874 + block_size, nr_blocks, req->nr_sg);
4876 + BUG_ON(nr_blocks == 0);
4877 + chan->nr_blocks = nr_blocks;
4880 + cfglo = cfghi = 0;
4881 + switch (req->direction) {
4882 + case DMA_DIR_MEM_TO_PERIPH:
4883 + direction = DMA_TO_DEVICE;
4884 + cfghi = req->periph_id << (43 - 32);
4887 + case DMA_DIR_PERIPH_TO_MEM:
4888 + direction = DMA_FROM_DEVICE;
4889 + cfghi = req->periph_id << (39 - 32);
4892 + goto out_unclaim_channel;
4895 + chan->direction = direction;
4897 + dmac_chan_writel_hi(dmac, req->req.channel, CFG, cfghi);
4898 + dmac_chan_writel_lo(dmac, req->req.channel, CFG, cfglo);
4900 + ctlhi = block_size >> req->width;
4901 + ctllo = ((req->direction << 20)
4902 + // | (1 << 14) | (1 << 11) // source/dest burst trans len
4903 + | (req->width << 4) | (req->width << 1)
4904 + | (1 << 0)); // interrupt enable
4906 + if (nr_blocks == 1) {
4907 + /* Only one block: No need to use block chaining */
4908 + if (direction == DMA_TO_DEVICE) {
4909 + dmac_chan_writel_lo(dmac, req->req.channel, SAR,
4910 + req->sg->dma_address);
4911 + dmac_chan_writel_lo(dmac, req->req.channel, DAR,
4913 + ctllo |= 2 << 7; // no dst increment
4915 + dmac_chan_writel_lo(dmac, req->req.channel, SAR,
4917 + dmac_chan_writel_lo(dmac, req->req.channel, DAR,
4918 + req->sg->dma_address);
4919 + ctllo |= 2 << 9; // no src increment
4921 + dmac_chan_writel_lo(dmac, req->req.channel, CTL, ctllo);
4922 + dmac_chan_writel_hi(dmac, req->req.channel, CTL, ctlhi);
4923 + pr_debug("ctl hi:lo 0x%lx:%lx\n", ctlhi, ctllo);
4925 + struct dw_dma_lli *lli, *lli_prev = NULL;
4926 + int j = 0, offset = 0;
4929 + chan->block = allocate_blocks(dmac, nr_blocks);
4931 + goto out_unclaim_channel;
4933 + if (direction == DMA_TO_DEVICE)
4934 + ctllo |= 1 << 28 | 1 << 27 | 2 << 7;
4936 + ctllo |= 1 << 28 | 1 << 27 | 2 << 9;
4939 + * Map scatterlist items to blocks. One scatterlist
4940 + * item may need more than one block for the reasons
4941 + * mentioned above.
4943 + for (i = 0; i < nr_blocks; i++) {
4944 + lli = chan->block[i].lli_vaddr;
4946 + lli_prev->llp = chan->block[i].lli_dma_addr;
4947 + pr_debug("lli[%d] (0x%p/0x%x): 0x%x 0x%x 0x%x 0x%x 0x%x\n",
4948 + i - 1, chan->block[i - 1].lli_vaddr,
4949 + chan->block[i - 1].lli_dma_addr,
4950 + lli_prev->sar, lli_prev->dar, lli_prev->llp,
4951 + lli_prev->ctllo, lli_prev->ctlhi);
4954 + lli->ctllo = ctllo;
4955 + lli->ctlhi = ctlhi;
4956 + if (direction == DMA_TO_DEVICE) {
4957 + lli->sar = req->sg[j].dma_address + offset;
4958 + lli->dar = req->data_reg;
4960 + lli->sar = req->data_reg;
4961 + lli->dar = req->sg[j].dma_address + offset;
4965 + offset += block_size;
4966 + if (offset > req->sg[j].length) {
4972 + pr_debug("lli[%d] (0x%p/0x%x): 0x%x 0x%x 0x%x 0x%x 0x%x\n",
4973 + i - 1, chan->block[i - 1].lli_vaddr,
4974 + chan->block[i - 1].lli_dma_addr, lli_prev->sar,
4975 + lli_prev->dar, lli_prev->llp,
4976 + lli_prev->ctllo, lli_prev->ctlhi);
4979 + * SAR, DAR and CTL are initialized from the LLI. We
4980 + * only have to enable the LLI bits in CTL.
4982 + dmac_chan_writel_hi(dmac, req->req.channel, CTL, 0);
4983 + dmac_chan_writel_lo(dmac, req->req.channel, LLP,
4984 + chan->block[0].lli_dma_addr);
4985 + dmac_chan_writel_lo(dmac, req->req.channel, CTL, 1 << 28 | 1 << 27);
4988 + set_channel_bit(dmac, MASK_XFER, req->req.channel);
4989 + set_channel_bit(dmac, MASK_ERROR, req->req.channel);
4990 + if (req->req.block_complete)
4991 + set_channel_bit(dmac, MASK_BLOCK, req->req.channel);
4993 + clear_channel_bit(dmac, MASK_BLOCK, req->req.channel);
4997 +out_unclaim_channel:
4998 + chan->state = CH_STATE_ALLOCATED;
5002 +static int dmac_prepare_request_cyclic(struct dma_controller *_dmac,
5003 + struct dma_request_cyclic *req)
5005 + struct dw_dma_controller *dmac = to_dw_dmac(_dmac);
5006 + struct dw_dma_channel *chan;
5007 + unsigned long ctlhi, ctllo, cfghi, cfglo;
5008 + unsigned long block_size;
5009 + int ret, i, direction;
5010 + unsigned long flags;
5012 + spin_lock_irqsave(&dmac->lock, flags);
5014 + block_size = (req->buffer_size/req->periods) >> req->width;
5017 + if (req->req.channel >= DMAC_NR_CHANNELS
5018 + || dmac->channel[req->req.channel].state != CH_STATE_ALLOCATED
5019 + || (req->periods == 0)
5020 + || block_size > DMAC_MAX_BLOCKSIZE) {
5021 + spin_unlock_irqrestore(&dmac->lock, flags);
5025 + chan = &dmac->channel[req->req.channel];
5026 + chan->state = CH_STATE_BUSY;
5027 + chan->is_cyclic = 1;
5028 + chan->req_cyclic = req;
5031 + * We have marked the channel as busy, so no need to keep the
5032 + * lock as long as we only touch the channel-specific
5035 + spin_unlock_irqrestore(&dmac->lock, flags);
5040 + BUG_ON(req->buffer_size % req->periods);
5041 + /* printk(KERN_INFO "block_size = %lu, periods = %u\n", block_size, req->periods); */
5043 + chan->nr_blocks = req->periods;
5046 + cfglo = cfghi = 0;
5047 + switch (req->direction) {
5048 + case DMA_DIR_MEM_TO_PERIPH:
5049 + direction = DMA_TO_DEVICE;
5050 + cfghi = req->periph_id << (43 - 32);
5053 + case DMA_DIR_PERIPH_TO_MEM:
5054 + direction = DMA_FROM_DEVICE;
5055 + cfghi = req->periph_id << (39 - 32);
5058 + goto out_unclaim_channel;
5061 + chan->direction = direction;
5063 + dmac_chan_writel_hi(dmac, req->req.channel, CFG, cfghi);
5064 + dmac_chan_writel_lo(dmac, req->req.channel, CFG, cfglo);
5066 + ctlhi = block_size;
5067 + ctllo = ((req->direction << 20)
5068 + | (req->width << 4) | (req->width << 1)
5069 + | (1 << 0)); // interrupt enable
5072 + struct dw_dma_lli *lli = NULL, *lli_prev = NULL;
5075 + chan->block = allocate_blocks(dmac, req->periods);
5077 + goto out_unclaim_channel;
5079 + if (direction == DMA_TO_DEVICE)
5080 + ctllo |= 1 << 28 | 1 << 27 | 2 << 7;
5082 + ctllo |= 1 << 28 | 1 << 27 | 2 << 9;
5085 + * Set up a linked list items where each period gets
5086 + * an item. The linked list item for the last period
5087 + * points back to the star of the buffer making a
5090 + for (i = 0; i < req->periods; i++) {
5091 + lli = chan->block[i].lli_vaddr;
5093 + lli_prev->llp = chan->block[i].lli_dma_addr;
5094 + /* printk(KERN_INFO "lli[%d] (0x%p/0x%x): 0x%x 0x%x 0x%x 0x%x 0x%x\n",
5095 + i - 1, chan->block[i - 1].lli_vaddr,
5096 + chan->block[i - 1].lli_dma_addr,
5097 + lli_prev->sar, lli_prev->dar, lli_prev->llp,
5098 + lli_prev->ctllo, lli_prev->ctlhi);*/
5101 + lli->ctllo = ctllo;
5102 + lli->ctlhi = ctlhi;
5103 + if (direction == DMA_TO_DEVICE) {
5104 + lli->sar = req->buffer_start + i*(block_size << req->width);
5105 + lli->dar = req->data_reg;
5107 + lli->sar = req->data_reg;
5108 + lli->dar = req->buffer_start + i*(block_size << req->width);
5112 + lli->llp = chan->block[0].lli_dma_addr;
5114 + /*printk(KERN_INFO "lli[%d] (0x%p/0x%x): 0x%x 0x%x 0x%x 0x%x 0x%x\n",
5115 + i - 1, chan->block[i - 1].lli_vaddr,
5116 + chan->block[i - 1].lli_dma_addr, lli_prev->sar,
5117 + lli_prev->dar, lli_prev->llp,
5118 + lli_prev->ctllo, lli_prev->ctlhi); */
5121 + * SAR, DAR and CTL are initialized from the LLI. We
5122 + * only have to enable the LLI bits in CTL.
5124 + dmac_chan_writel_lo(dmac, req->req.channel, LLP,
5125 + chan->block[0].lli_dma_addr);
5126 + dmac_chan_writel_lo(dmac, req->req.channel, CTL, 1 << 28 | 1 << 27);
5129 + clear_channel_bit(dmac, MASK_XFER, req->req.channel);
5130 + set_channel_bit(dmac, MASK_ERROR, req->req.channel);
5131 + if (req->req.block_complete)
5132 + set_channel_bit(dmac, MASK_BLOCK, req->req.channel);
5134 + clear_channel_bit(dmac, MASK_BLOCK, req->req.channel);
5138 +out_unclaim_channel:
5139 + chan->state = CH_STATE_ALLOCATED;
5143 +static int dmac_start_request(struct dma_controller *_dmac,
5144 + unsigned int channel)
5146 + struct dw_dma_controller *dmac = to_dw_dmac(_dmac);
5148 + BUG_ON(channel >= DMAC_NR_CHANNELS);
5150 + set_channel_bit(dmac, CH_EN, channel);
5155 +static dma_addr_t dmac_get_current_pos(struct dma_controller *_dmac,
5156 + unsigned int channel)
5158 + struct dw_dma_controller *dmac = to_dw_dmac(_dmac);
5159 + struct dw_dma_channel *chan;
5160 + dma_addr_t current_pos;
5162 + BUG_ON(channel >= DMAC_NR_CHANNELS);
5164 + chan = &dmac->channel[channel];
5166 + switch (chan->direction) {
5167 + case DMA_TO_DEVICE:
5168 + current_pos = dmac_chan_readl_lo(dmac, channel, SAR);
5170 + case DMA_FROM_DEVICE:
5171 + current_pos = dmac_chan_readl_lo(dmac, channel, DAR);
5178 + if (!current_pos) {
5179 + if (chan->is_cyclic) {
5180 + current_pos = chan->req_cyclic->buffer_start;
5182 + current_pos = chan->req_sg->sg->dma_address;
5186 + return current_pos;
5190 +static int dmac_stop_request(struct dma_controller *_dmac,
5191 + unsigned int channel)
5193 + struct dw_dma_controller *dmac = to_dw_dmac(_dmac);
5194 + struct dw_dma_channel *chan;
5196 + BUG_ON(channel >= DMAC_NR_CHANNELS);
5198 + chan = &dmac->channel[channel];
5199 + pr_debug("stop: st%u s%08x d%08x l%08x ctl0x%08x:0x%08x\n",
5200 + chan->state, dmac_chan_readl_lo(dmac, channel, SAR),
5201 + dmac_chan_readl_lo(dmac, channel, DAR),
5202 + dmac_chan_readl_lo(dmac, channel, LLP),
5203 + dmac_chan_readl_hi(dmac, channel, CTL),
5204 + dmac_chan_readl_lo(dmac, channel, CTL));
5206 + if (chan->state == CH_STATE_BUSY) {
5207 + clear_channel_bit(dmac, CH_EN, channel);
5208 + cleanup_channel(dmac, &dmac->channel[channel]);
5215 +static void dmac_block_complete(struct dw_dma_controller *dmac)
5217 + struct dw_dma_channel *chan;
5218 + unsigned long status, chanid;
5220 + status = dmac_readl_lo(dmac, STATUS_BLOCK);
5223 + struct dma_request *req;
5224 + chanid = __ffs(status);
5225 + chan = &dmac->channel[chanid];
5227 + if (chan->is_cyclic) {
5228 + BUG_ON(!chan->req_cyclic
5229 + || !chan->req_cyclic->req.block_complete);
5230 + req = &chan->req_cyclic->req;
5232 + BUG_ON(!chan->req_sg || !chan->req_sg->req.block_complete);
5233 + req = &chan->req_sg->req;
5235 + dmac_writel_lo(dmac, CLEAR_BLOCK, 1 << chanid);
5236 + req->block_complete(req);
5237 + status = dmac_readl_lo(dmac, STATUS_BLOCK);
5241 +static void dmac_xfer_complete(struct dw_dma_controller *dmac)
5243 + struct dw_dma_channel *chan;
5244 + struct dma_request *req;
5245 + unsigned long status, chanid;
5247 + status = dmac_readl_lo(dmac, STATUS_XFER);
5250 + chanid = __ffs(status);
5251 + chan = &dmac->channel[chanid];
5253 + dmac_writel_lo(dmac, CLEAR_XFER, 1 << chanid);
5255 + req = &chan->req_sg->req;
5257 + cleanup_channel(dmac, chan);
5258 + if (req->xfer_complete)
5259 + req->xfer_complete(req);
5261 + status = dmac_readl_lo(dmac, STATUS_XFER);
5265 +static void dmac_error(struct dw_dma_controller *dmac)
5267 + struct dw_dma_channel *chan;
5268 + unsigned long status, chanid;
5270 + status = dmac_readl_lo(dmac, STATUS_ERROR);
5273 + struct dma_request *req;
5275 + chanid = __ffs(status);
5276 + chan = &dmac->channel[chanid];
5278 + dmac_writel_lo(dmac, CLEAR_ERROR, 1 << chanid);
5279 + clear_channel_bit(dmac, CH_EN, chanid);
5281 + if (chan->is_cyclic) {
5282 + BUG_ON(!chan->req_cyclic);
5283 + req = &chan->req_cyclic->req;
5285 + BUG_ON(!chan->req_sg);
5286 + req = &chan->req_sg->req;
5289 + cleanup_channel(dmac, chan);
5293 + status = dmac_readl_lo(dmac, STATUS_XFER);
5297 +static irqreturn_t dmac_interrupt(int irq, void *dev_id)
5299 + struct dw_dma_controller *dmac = dev_id;
5300 + unsigned long status;
5301 + int ret = IRQ_NONE;
5303 + spin_lock(&dmac->lock);
5305 + status = dmac_readl_lo(dmac, STATUS_INT);
5308 + ret = IRQ_HANDLED;
5309 + if (status & 0x10)
5311 + if (status & 0x02)
5312 + dmac_block_complete(dmac);
5313 + if (status & 0x01)
5314 + dmac_xfer_complete(dmac);
5316 + status = dmac_readl_lo(dmac, STATUS_INT);
5319 + spin_unlock(&dmac->lock);
5323 +static int __devinit dmac_probe(struct platform_device *pdev)
5325 + struct dw_dma_controller *dmac;
5326 + struct resource *regs;
5329 + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
5333 + dmac = kmalloc(sizeof(*dmac), GFP_KERNEL);
5336 + memset(dmac, 0, sizeof(*dmac));
5338 + dmac->hclk = clk_get(&pdev->dev, "hclk");
5339 + if (IS_ERR(dmac->hclk)) {
5340 + ret = PTR_ERR(dmac->hclk);
5341 + goto out_free_dmac;
5343 + clk_enable(dmac->hclk);
5346 + dmac->lli_pool = dma_pool_create("dmac", &pdev->dev,
5347 + sizeof(struct dw_dma_lli), 4, 0);
5348 + if (!dmac->lli_pool)
5349 + goto out_disable_clk;
5351 + spin_lock_init(&dmac->lock);
5352 + dmac->dma.dev = &pdev->dev;
5353 + dmac->dma.alloc_channel = dmac_alloc_channel;
5354 + dmac->dma.release_channel = dmac_release_channel;
5355 + dmac->dma.prepare_request_sg = dmac_prepare_request_sg;
5356 + dmac->dma.prepare_request_cyclic = dmac_prepare_request_cyclic;
5357 + dmac->dma.start_request = dmac_start_request;
5358 + dmac->dma.stop_request = dmac_stop_request;
5359 + dmac->dma.get_current_pos = dmac_get_current_pos;
5361 + dmac->regs = ioremap(regs->start, regs->end - regs->start + 1);
5363 + goto out_free_pool;
5365 + ret = request_irq(platform_get_irq(pdev, 0), dmac_interrupt,
5366 + IRQF_SAMPLE_RANDOM, pdev->name, dmac);
5368 + goto out_unmap_regs;
5370 + /* Enable the DMA controller */
5371 + dmac_writel_lo(dmac, CFG, 1);
5373 + register_dma_controller(&dmac->dma);
5376 + "dmac%d: DesignWare DMA controller at 0x%p irq %d\n",
5377 + dmac->dma.id, dmac->regs, platform_get_irq(pdev, 0));
5382 + iounmap(dmac->regs);
5384 + dma_pool_destroy(dmac->lli_pool);
5386 + clk_disable(dmac->hclk);
5387 + clk_put(dmac->hclk);
5393 +static struct platform_driver dmac_driver = {
5394 + .probe = dmac_probe,
5400 +static int __init dmac_init(void)
5402 + return platform_driver_register(&dmac_driver);
5404 +subsys_initcall(dmac_init);
5406 +static void __exit dmac_exit(void)
5408 + platform_driver_unregister(&dmac_driver);
5410 +module_exit(dmac_exit);
5412 +MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller driver");
5413 +MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
5414 +MODULE_LICENSE("GPL");
5415 diff -urN linux-2.6.24.3/arch/avr32/drivers/dw-dmac.h avr32-2.6/arch/avr32/drivers/dw-dmac.h
5416 --- linux-2.6.24.3/arch/avr32/drivers/dw-dmac.h 1970-01-01 01:00:00.000000000 +0100
5417 +++ avr32-2.6/arch/avr32/drivers/dw-dmac.h 2008-04-23 19:33:28.000000000 +0200
5420 + * Driver for the Synopsys DesignWare DMA Controller
5422 + * Copyright (C) 2005-2006 Atmel Corporation
5424 + * This program is free software; you can redistribute it and/or modify
5425 + * it under the terms of the GNU General Public License version 2 as
5426 + * published by the Free Software Foundation.
5428 +#ifndef __AVR32_DW_DMAC_H__
5429 +#define __AVR32_DW_DMAC_H__
5431 +#define DW_DMAC_CFG 0x398
5432 +#define DW_DMAC_CH_EN 0x3a0
5434 +#define DW_DMAC_STATUS_XFER 0x2e8
5435 +#define DW_DMAC_STATUS_BLOCK 0x2f0
5436 +#define DW_DMAC_STATUS_ERROR 0x308
5438 +#define DW_DMAC_MASK_XFER 0x310
5439 +#define DW_DMAC_MASK_BLOCK 0x318
5440 +#define DW_DMAC_MASK_ERROR 0x330
5442 +#define DW_DMAC_CLEAR_XFER 0x338
5443 +#define DW_DMAC_CLEAR_BLOCK 0x340
5444 +#define DW_DMAC_CLEAR_ERROR 0x358
5446 +#define DW_DMAC_STATUS_INT 0x360
5448 +#define DW_DMAC_CHAN_SAR 0x000
5449 +#define DW_DMAC_CHAN_DAR 0x008
5450 +#define DW_DMAC_CHAN_LLP 0x010
5451 +#define DW_DMAC_CHAN_CTL 0x018
5452 +#define DW_DMAC_CHAN_SSTAT 0x020
5453 +#define DW_DMAC_CHAN_DSTAT 0x028
5454 +#define DW_DMAC_CHAN_SSTATAR 0x030
5455 +#define DW_DMAC_CHAN_DSTATAR 0x038
5456 +#define DW_DMAC_CHAN_CFG 0x040
5457 +#define DW_DMAC_CHAN_SGR 0x048
5458 +#define DW_DMAC_CHAN_DSR 0x050
5460 +#endif /* __AVR32_DW_DMAC_H__ */
5461 diff -urN linux-2.6.24.3/arch/avr32/drivers/Makefile avr32-2.6/arch/avr32/drivers/Makefile
5462 --- linux-2.6.24.3/arch/avr32/drivers/Makefile 1970-01-01 01:00:00.000000000 +0100
5463 +++ avr32-2.6/arch/avr32/drivers/Makefile 2008-04-23 19:33:28.000000000 +0200
5465 +obj-$(CONFIG_DW_DMAC) += dw-dmac.o
5466 diff -urN linux-2.6.24.3/arch/avr32/Kconfig avr32-2.6/arch/avr32/Kconfig
5467 --- linux-2.6.24.3/arch/avr32/Kconfig 2008-02-26 01:20:20.000000000 +0100
5468 +++ avr32-2.6/arch/avr32/Kconfig 2008-04-23 20:12:35.000000000 +0200
5473 +config GENERIC_CLOCKEVENTS
5476 config RWSEM_XCHGADD_ALGORITHM
5480 config ARCH_HAS_ILOG2_U64
5483 +config ARCH_SUPPORTS_OPROFILE
5486 config GENERIC_HWEIGHT
5491 menu "System Type and features"
5493 +source "kernel/time/Kconfig"
5495 config SUBARCH_AVR32B
5500 select PERFORMANCE_COUNTERS
5503 - prompt "AVR32 CPU type"
5504 - default CPU_AT32AP7000
5509 -config CPU_AT32AP7000
5511 +# AP7000 derivatives
5512 +config CPU_AT32AP700X
5514 select PLATFORM_AT32AP
5518 -# CPU Daughterboards for ATSTK1000
5519 -config BOARD_ATSTK1002
5520 +config CPU_AT32AP7000
5522 + select CPU_AT32AP700X
5523 +config CPU_AT32AP7001
5525 + select CPU_AT32AP700X
5526 +config CPU_AT32AP7002
5528 + select CPU_AT32AP700X
5531 prompt "AVR32 board type"
5532 @@ -101,15 +113,18 @@
5534 config BOARD_ATSTK1000
5535 bool "ATSTK1000 evaluation board"
5536 - select BOARD_ATSTK1002 if CPU_AT32AP7000
5538 config BOARD_ATNGW100
5539 bool "ATNGW100 Network Gateway"
5540 + select CPU_AT32AP7000
5544 source "arch/avr32/boards/atstk1000/Kconfig"
5547 +source "arch/avr32/boards/atngw100/Kconfig"
5551 prompt "Boot loader type"
5552 @@ -123,15 +138,15 @@
5556 - default 0x10000000 if LOADER_U_BOOT=y && CPU_AT32AP7000=y
5557 + default 0x10000000 if LOADER_U_BOOT=y && CPU_AT32AP700X=y
5559 config ENTRY_ADDRESS
5561 - default 0x90000000 if LOADER_U_BOOT=y && CPU_AT32AP7000=y
5562 + default 0x90000000 if LOADER_U_BOOT=y && CPU_AT32AP700X=y
5566 - default 0x10000000 if CPU_AT32AP7000=y
5567 + default 0x10000000 if CPU_AT32AP700X=y
5569 source "kernel/Kconfig.preempt"
5571 @@ -163,6 +178,20 @@
5572 enabling Nexus-compliant debuggers to keep track of the PID of the
5573 currently executing task.
5575 +config NMI_DEBUGGING
5576 + bool "NMI Debugging"
5579 + Say Y here and pass the nmi_debug command-line parameter to
5580 + the kernel to turn on NMI debugging. Depending on the value
5581 + of the nmi_debug option, various pieces of information will
5582 + be dumped to the console when a Non-Maskable Interrupt
5586 + tristate "Synopsys DesignWare DMA Controller support"
5587 + default y if CPU_AT32AP7000
5589 # FPU emulation goes here
5591 source "kernel/Kconfig.hz"
5596 +source "kernel/Kconfig.instrumentation"
5598 source "arch/avr32/Kconfig.debug"
5600 source "security/Kconfig"
5601 diff -urN linux-2.6.24.3/arch/avr32/Kconfig.debug avr32-2.6/arch/avr32/Kconfig.debug
5602 --- linux-2.6.24.3/arch/avr32/Kconfig.debug 2008-02-26 01:20:20.000000000 +0100
5603 +++ avr32-2.6/arch/avr32/Kconfig.debug 2008-04-23 19:33:28.000000000 +0200
5606 source "lib/Kconfig.debug"
5610 - depends on DEBUG_KERNEL
5612 - Kprobes allows you to trap at almost any kernel address and
5613 - execute a callback function. register_kprobe() establishes
5614 - a probepoint and specifies the callback. Kprobes is useful
5615 - for kernel debugging, non-intrusive instrumentation and testing.
5616 - If in doubt, say "N".
5619 diff -urN linux-2.6.24.3/arch/avr32/kernel/cpu.c avr32-2.6/arch/avr32/kernel/cpu.c
5620 --- linux-2.6.24.3/arch/avr32/kernel/cpu.c 2008-02-26 01:20:20.000000000 +0100
5621 +++ avr32-2.6/arch/avr32/kernel/cpu.c 2008-04-23 19:33:28.000000000 +0200
5623 #include <linux/percpu.h>
5624 #include <linux/param.h>
5625 #include <linux/errno.h>
5626 +#include <linux/clk.h>
5628 #include <asm/setup.h>
5629 #include <asm/sysreg.h>
5630 @@ -187,9 +188,20 @@
5632 subsys_initcall(topology_init);
5634 +struct chip_id_map {
5640 +static const struct chip_id_map chip_names[] = {
5641 + { .mid = 0x1f, .pn = 0x1e82, .name = "AT32AP700x" },
5643 +#define NR_CHIP_NAMES ARRAY_SIZE(chip_names)
5645 static const char *cpu_names[] = {
5650 #define NR_CPU_NAMES ARRAY_SIZE(cpu_names)
5652 @@ -206,12 +218,32 @@
5656 +static const char *cpu_feature_flags[] = {
5657 + "rmw", "dsp", "simd", "ocd", "perfctr", "java", "fpu",
5660 +static const char *get_chip_name(struct avr32_cpuinfo *cpu)
5663 + unsigned int mid = avr32_get_manufacturer_id(cpu);
5664 + unsigned int pn = avr32_get_product_number(cpu);
5666 + for (i = 0; i < NR_CHIP_NAMES; i++) {
5667 + if (chip_names[i].mid == mid && chip_names[i].pn == pn)
5668 + return chip_names[i].name;
5671 + return "(unknown)";
5674 void __init setup_processor(void)
5676 unsigned long config0, config1;
5677 unsigned long features;
5678 unsigned cpu_id, cpu_rev, arch_id, arch_rev, mmu_type;
5679 + unsigned device_id;
5683 config0 = sysreg_read(CONFIG0);
5684 config1 = sysreg_read(CONFIG1);
5685 @@ -221,11 +253,14 @@
5686 arch_rev = SYSREG_BFEXT(AR, config0);
5687 mmu_type = SYSREG_BFEXT(MMUT, config0);
5689 + device_id = ocd_read(DID);
5691 boot_cpu_data.arch_type = arch_id;
5692 boot_cpu_data.cpu_type = cpu_id;
5693 boot_cpu_data.arch_revision = arch_rev;
5694 boot_cpu_data.cpu_revision = cpu_rev;
5695 boot_cpu_data.tlb_config = mmu_type;
5696 + boot_cpu_data.device_id = device_id;
5698 tmp = SYSREG_BFEXT(ILSZ, config1);
5700 @@ -247,41 +282,34 @@
5704 - printk ("CPU: %s [%02x] revision %d (%s revision %d)\n",
5705 + printk ("CPU: %s chip revision %c\n", get_chip_name(&boot_cpu_data),
5706 + avr32_get_chip_revision(&boot_cpu_data) + 'A');
5707 + printk ("CPU: %s [%02x] core revision %d (%s arch revision %d)\n",
5708 cpu_names[cpu_id], cpu_id, cpu_rev,
5709 arch_names[arch_id], arch_rev);
5710 printk ("CPU: MMU configuration: %s\n", mmu_types[mmu_type]);
5712 printk ("CPU: features:");
5714 - if (config0 & SYSREG_BIT(CONFIG0_R)) {
5715 + if (config0 & SYSREG_BIT(CONFIG0_R))
5716 features |= AVR32_FEATURE_RMW;
5719 - if (config0 & SYSREG_BIT(CONFIG0_D)) {
5720 + if (config0 & SYSREG_BIT(CONFIG0_D))
5721 features |= AVR32_FEATURE_DSP;
5724 - if (config0 & SYSREG_BIT(CONFIG0_S)) {
5725 + if (config0 & SYSREG_BIT(CONFIG0_S))
5726 features |= AVR32_FEATURE_SIMD;
5729 - if (config0 & SYSREG_BIT(CONFIG0_O)) {
5730 + if (config0 & SYSREG_BIT(CONFIG0_O))
5731 features |= AVR32_FEATURE_OCD;
5734 - if (config0 & SYSREG_BIT(CONFIG0_P)) {
5735 + if (config0 & SYSREG_BIT(CONFIG0_P))
5736 features |= AVR32_FEATURE_PCTR;
5737 - printk(" perfctr");
5739 - if (config0 & SYSREG_BIT(CONFIG0_J)) {
5740 + if (config0 & SYSREG_BIT(CONFIG0_J))
5741 features |= AVR32_FEATURE_JAVA;
5744 - if (config0 & SYSREG_BIT(CONFIG0_F)) {
5745 + if (config0 & SYSREG_BIT(CONFIG0_F))
5746 features |= AVR32_FEATURE_FPU;
5750 + for (i = 0; i < ARRAY_SIZE(cpu_feature_flags); i++)
5751 + if (features & (1 << i))
5752 + printk(" %s", cpu_feature_flags[i]);
5755 boot_cpu_data.features = features;
5759 unsigned int icache_size, dcache_size;
5760 unsigned int cpu = smp_processor_id();
5761 + unsigned int freq;
5764 icache_size = boot_cpu_data.icache.ways *
5765 boot_cpu_data.icache.sets *
5766 @@ -301,15 +331,21 @@
5768 seq_printf(m, "processor\t: %d\n", cpu);
5770 + seq_printf(m, "chip type\t: %s revision %c\n",
5771 + get_chip_name(&boot_cpu_data),
5772 + avr32_get_chip_revision(&boot_cpu_data) + 'A');
5773 if (boot_cpu_data.arch_type < NR_ARCH_NAMES)
5774 - seq_printf(m, "cpu family\t: %s revision %d\n",
5775 + seq_printf(m, "cpu arch\t: %s revision %d\n",
5776 arch_names[boot_cpu_data.arch_type],
5777 boot_cpu_data.arch_revision);
5778 if (boot_cpu_data.cpu_type < NR_CPU_NAMES)
5779 - seq_printf(m, "cpu type\t: %s revision %d\n",
5780 + seq_printf(m, "cpu core\t: %s revision %d\n",
5781 cpu_names[boot_cpu_data.cpu_type],
5782 boot_cpu_data.cpu_revision);
5784 + freq = (clk_get_rate(boot_cpu_data.clk) + 500) / 1000;
5785 + seq_printf(m, "cpu MHz\t\t: %u.%03u\n", freq / 1000, freq % 1000);
5787 seq_printf(m, "i-cache\t\t: %dK (%u ways x %u sets x %u)\n",
5789 boot_cpu_data.icache.ways,
5790 @@ -320,7 +356,13 @@
5791 boot_cpu_data.dcache.ways,
5792 boot_cpu_data.dcache.sets,
5793 boot_cpu_data.dcache.linesz);
5794 - seq_printf(m, "bogomips\t: %lu.%02lu\n",
5796 + seq_printf(m, "features\t:");
5797 + for (i = 0; i < ARRAY_SIZE(cpu_feature_flags); i++)
5798 + if (boot_cpu_data.features & (1 << i))
5799 + seq_printf(m, " %s", cpu_feature_flags[i]);
5801 + seq_printf(m, "\nbogomips\t: %lu.%02lu\n",
5802 boot_cpu_data.loops_per_jiffy / (500000/HZ),
5803 (boot_cpu_data.loops_per_jiffy / (5000/HZ)) % 100);
5809 -struct seq_operations cpuinfo_op = {
5810 +const struct seq_operations cpuinfo_op = {
5814 diff -urN linux-2.6.24.3/arch/avr32/kernel/dma-controller.c avr32-2.6/arch/avr32/kernel/dma-controller.c
5815 --- linux-2.6.24.3/arch/avr32/kernel/dma-controller.c 1970-01-01 01:00:00.000000000 +0100
5816 +++ avr32-2.6/arch/avr32/kernel/dma-controller.c 2008-04-23 19:33:28.000000000 +0200
5819 + * Preliminary DMA controller framework for AVR32
5821 + * Copyright (C) 2005-2006 Atmel Corporation
5823 + * This program is free software; you can redistribute it and/or modify
5824 + * it under the terms of the GNU General Public License version 2 as
5825 + * published by the Free Software Foundation.
5827 +#include <asm/dma-controller.h>
5829 +static LIST_HEAD(controllers);
5831 +int register_dma_controller(struct dma_controller *dmac)
5833 + static int next_id;
5835 + dmac->id = next_id++;
5836 + list_add_tail(&dmac->list, &controllers);
5840 +EXPORT_SYMBOL(register_dma_controller);
5842 +struct dma_controller *find_dma_controller(int id)
5844 + struct dma_controller *dmac;
5846 + list_for_each_entry(dmac, &controllers, list)
5847 + if (dmac->id == id)
5851 +EXPORT_SYMBOL(find_dma_controller);
5852 diff -urN linux-2.6.24.3/arch/avr32/kernel/entry-avr32b.S avr32-2.6/arch/avr32/kernel/entry-avr32b.S
5853 --- linux-2.6.24.3/arch/avr32/kernel/entry-avr32b.S 2008-02-26 01:20:20.000000000 +0100
5854 +++ avr32-2.6/arch/avr32/kernel/entry-avr32b.S 2008-04-23 20:12:35.000000000 +0200
5855 @@ -741,26 +741,6 @@
5857 .section .irq.text,"ax",@progbits
5859 -.global cpu_idle_sleep
5862 - get_thread_info r8
5863 - ld.w r9, r8[TI_flags]
5864 - bld r9, TIF_NEED_RESCHED
5865 - brcs cpu_idle_enable_int_and_exit
5866 - sbr r9, TIF_CPU_GOING_TO_SLEEP
5867 - st.w r8[TI_flags], r9
5870 -cpu_idle_skip_sleep:
5872 - ld.w r9, r8[TI_flags]
5873 - cbr r9, TIF_CPU_GOING_TO_SLEEP
5874 - st.w r8[TI_flags], r9
5875 -cpu_idle_enable_int_and_exit:
5882 diff -urN linux-2.6.24.3/arch/avr32/kernel/irq.c avr32-2.6/arch/avr32/kernel/irq.c
5883 --- linux-2.6.24.3/arch/avr32/kernel/irq.c 2008-02-26 01:20:20.000000000 +0100
5884 +++ avr32-2.6/arch/avr32/kernel/irq.c 2008-04-23 19:33:28.000000000 +0200
5886 printk("unexpected IRQ %u\n", irq);
5889 +/* May be overridden by platform code */
5890 +int __weak nmi_enable(void)
5895 +void __weak nmi_disable(void)
5900 #ifdef CONFIG_PROC_FS
5901 int show_interrupts(struct seq_file *p, void *v)
5903 diff -urN linux-2.6.24.3/arch/avr32/kernel/kprobes.c avr32-2.6/arch/avr32/kernel/kprobes.c
5904 --- linux-2.6.24.3/arch/avr32/kernel/kprobes.c 2008-02-26 01:20:20.000000000 +0100
5905 +++ avr32-2.6/arch/avr32/kernel/kprobes.c 2008-04-23 19:33:28.000000000 +0200
5907 void __kprobes arch_arm_kprobe(struct kprobe *p)
5909 pr_debug("arming kprobe at %p\n", p->addr);
5911 *p->addr = BREAKPOINT_INSTRUCTION;
5912 flush_icache_range((unsigned long)p->addr,
5913 (unsigned long)p->addr + sizeof(kprobe_opcode_t));
5915 void __kprobes arch_disarm_kprobe(struct kprobe *p)
5917 pr_debug("disarming kprobe at %p\n", p->addr);
5918 + ocd_disable(NULL);
5919 *p->addr = p->opcode;
5920 flush_icache_range((unsigned long)p->addr,
5921 (unsigned long)p->addr + sizeof(kprobe_opcode_t));
5924 int __init arch_init_kprobes(void)
5926 - printk("KPROBES: Enabling monitor mode (MM|DBE)...\n");
5927 - ocd_write(DC, (1 << OCD_DC_MM_BIT) | (1 << OCD_DC_DBE_BIT));
5929 /* TODO: Register kretprobe trampoline */
5932 diff -urN linux-2.6.24.3/arch/avr32/kernel/Makefile avr32-2.6/arch/avr32/kernel/Makefile
5933 --- linux-2.6.24.3/arch/avr32/kernel/Makefile 2008-02-26 01:20:20.000000000 +0100
5934 +++ avr32-2.6/arch/avr32/kernel/Makefile 2008-04-23 19:33:28.000000000 +0200
5937 obj-$(CONFIG_SUBARCH_AVR32B) += entry-avr32b.o
5938 obj-y += syscall_table.o syscall-stubs.o irq.o
5939 -obj-y += setup.o traps.o semaphore.o ptrace.o
5940 +obj-y += setup.o traps.o semaphore.o ocd.o ptrace.o
5941 obj-y += signal.o sys_avr32.o process.o time.o
5942 obj-y += init_task.o switch_to.o cpu.o
5943 +obj-y += dma-controller.o
5944 obj-$(CONFIG_MODULES) += module.o avr32_ksyms.o
5945 obj-$(CONFIG_KPROBES) += kprobes.o
5946 obj-$(CONFIG_STACKTRACE) += stacktrace.o
5947 +obj-$(CONFIG_NMI_DEBUGGING) += nmi_debug.o
5948 diff -urN linux-2.6.24.3/arch/avr32/kernel/nmi_debug.c avr32-2.6/arch/avr32/kernel/nmi_debug.c
5949 --- linux-2.6.24.3/arch/avr32/kernel/nmi_debug.c 1970-01-01 01:00:00.000000000 +0100
5950 +++ avr32-2.6/arch/avr32/kernel/nmi_debug.c 2008-04-23 19:33:28.000000000 +0200
5953 + * Copyright (C) 2007 Atmel Corporation
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.
5959 +#include <linux/delay.h>
5960 +#include <linux/kdebug.h>
5961 +#include <linux/notifier.h>
5962 +#include <linux/sched.h>
5964 +#include <asm/irq.h>
5967 + NMI_SHOW_STATE = 1 << 0,
5968 + NMI_SHOW_REGS = 1 << 1,
5970 + NMI_DEBOUNCE = 1 << 3,
5973 +static unsigned long nmi_actions;
5975 +static int nmi_debug_notify(struct notifier_block *self,
5976 + unsigned long val, void *data)
5978 + struct die_args *args = data;
5980 + if (likely(val != DIE_NMI))
5981 + return NOTIFY_DONE;
5983 + if (nmi_actions & NMI_SHOW_STATE)
5985 + if (nmi_actions & NMI_SHOW_REGS)
5986 + show_regs(args->regs);
5987 + if (nmi_actions & NMI_DEBOUNCE)
5989 + if (nmi_actions & NMI_DIE)
5990 + return NOTIFY_BAD;
5995 +static struct notifier_block nmi_debug_nb = {
5996 + .notifier_call = nmi_debug_notify,
5999 +static int __init nmi_debug_setup(char *str)
6003 + register_die_notifier(&nmi_debug_nb);
6004 + if (nmi_enable()) {
6005 + printk(KERN_WARNING "Unable to enable NMI.\n");
6012 + for (p = str + 1; *p; p = sep + 1) {
6013 + sep = strchr(p, ',');
6016 + if (strcmp(p, "state") == 0)
6017 + nmi_actions |= NMI_SHOW_STATE;
6018 + else if (strcmp(p, "regs") == 0)
6019 + nmi_actions |= NMI_SHOW_REGS;
6020 + else if (strcmp(p, "debounce") == 0)
6021 + nmi_actions |= NMI_DEBOUNCE;
6022 + else if (strcmp(p, "die") == 0)
6023 + nmi_actions |= NMI_DIE;
6025 + printk(KERN_WARNING "NMI: Unrecognized action `%s'\n",
6033 +__setup("nmi_debug", nmi_debug_setup);
6034 diff -urN linux-2.6.24.3/arch/avr32/kernel/ocd.c avr32-2.6/arch/avr32/kernel/ocd.c
6035 --- linux-2.6.24.3/arch/avr32/kernel/ocd.c 1970-01-01 01:00:00.000000000 +0100
6036 +++ avr32-2.6/arch/avr32/kernel/ocd.c 2008-04-23 19:33:28.000000000 +0200
6039 + * Copyright (C) 2007 Atmel Corporation
6041 + * This program is free software; you can redistribute it and/or modify
6042 + * it under the terms of the GNU General Public License version 2 as
6043 + * published by the Free Software Foundation.
6045 +#include <linux/init.h>
6046 +#include <linux/sched.h>
6047 +#include <linux/spinlock.h>
6049 +#include <asm/ocd.h>
6051 +static long ocd_count;
6052 +static spinlock_t ocd_lock;
6055 + * ocd_enable - enable on-chip debugging
6056 + * @child: task to be debugged
6058 + * If @child is non-NULL, ocd_enable() first checks if debugging has
6059 + * already been enabled for @child, and if it has, does nothing.
6061 + * If @child is NULL (e.g. when debugging the kernel), or debugging
6062 + * has not already been enabled for it, ocd_enable() increments the
6063 + * reference count and enables the debugging hardware.
6065 +void ocd_enable(struct task_struct *child)
6070 + pr_debug("ocd_enable: child=%s [%u]\n",
6071 + child->comm, child->pid);
6073 + pr_debug("ocd_enable (no child)\n");
6075 + if (!child || !test_and_set_tsk_thread_flag(child, TIF_DEBUG)) {
6076 + spin_lock(&ocd_lock);
6078 + dc = ocd_read(DC);
6079 + dc |= (1 << OCD_DC_MM_BIT) | (1 << OCD_DC_DBE_BIT);
6080 + ocd_write(DC, dc);
6081 + spin_unlock(&ocd_lock);
6086 + * ocd_disable - disable on-chip debugging
6087 + * @child: task that was being debugged, but isn't anymore
6089 + * If @child is non-NULL, ocd_disable() checks if debugging is enabled
6090 + * for @child, and if it isn't, does nothing.
6092 + * If @child is NULL (e.g. when debugging the kernel), or debugging is
6093 + * enabled, ocd_disable() decrements the reference count, and if it
6094 + * reaches zero, disables the debugging hardware.
6096 +void ocd_disable(struct task_struct *child)
6101 + pr_debug("ocd_disable (no child)\n");
6102 + else if (test_tsk_thread_flag(child, TIF_DEBUG))
6103 + pr_debug("ocd_disable: child=%s [%u]\n",
6104 + child->comm, child->pid);
6106 + if (!child || test_and_clear_tsk_thread_flag(child, TIF_DEBUG)) {
6107 + spin_lock(&ocd_lock);
6110 + WARN_ON(ocd_count < 0);
6112 + if (ocd_count <= 0) {
6113 + dc = ocd_read(DC);
6114 + dc &= ~((1 << OCD_DC_MM_BIT) | (1 << OCD_DC_DBE_BIT));
6115 + ocd_write(DC, dc);
6117 + spin_unlock(&ocd_lock);
6121 +#ifdef CONFIG_DEBUG_FS
6122 +#include <linux/debugfs.h>
6123 +#include <linux/module.h>
6125 +static struct dentry *ocd_debugfs_root;
6126 +static struct dentry *ocd_debugfs_DC;
6127 +static struct dentry *ocd_debugfs_DS;
6128 +static struct dentry *ocd_debugfs_count;
6130 +static u64 ocd_DC_get(void *data)
6132 + return ocd_read(DC);
6134 +static void ocd_DC_set(void *data, u64 val)
6136 + ocd_write(DC, val);
6138 +DEFINE_SIMPLE_ATTRIBUTE(fops_DC, ocd_DC_get, ocd_DC_set, "0x%08llx\n");
6140 +static u64 ocd_DS_get(void *data)
6142 + return ocd_read(DS);
6144 +DEFINE_SIMPLE_ATTRIBUTE(fops_DS, ocd_DS_get, NULL, "0x%08llx\n");
6146 +static u64 ocd_count_get(void *data)
6150 +DEFINE_SIMPLE_ATTRIBUTE(fops_count, ocd_count_get, NULL, "%lld\n");
6152 +static void ocd_debugfs_init(void)
6154 + struct dentry *root;
6156 + root = debugfs_create_dir("ocd", NULL);
6157 + if (IS_ERR(root) || !root)
6159 + ocd_debugfs_root = root;
6161 + ocd_debugfs_DC = debugfs_create_file("DC", S_IRUSR | S_IWUSR,
6162 + root, NULL, &fops_DC);
6163 + if (!ocd_debugfs_DC)
6166 + ocd_debugfs_DS = debugfs_create_file("DS", S_IRUSR, root,
6168 + if (!ocd_debugfs_DS)
6171 + ocd_debugfs_count = debugfs_create_file("count", S_IRUSR, root,
6172 + NULL, &fops_count);
6173 + if (!ocd_debugfs_count)
6179 + debugfs_remove(ocd_debugfs_DS);
6181 + debugfs_remove(ocd_debugfs_DC);
6183 + debugfs_remove(ocd_debugfs_root);
6185 + printk(KERN_WARNING "OCD: Failed to create debugfs entries\n");
6188 +static inline void ocd_debugfs_init(void)
6194 +static int __init ocd_init(void)
6196 + spin_lock_init(&ocd_lock);
6197 + ocd_debugfs_init();
6200 +arch_initcall(ocd_init);
6201 diff -urN linux-2.6.24.3/arch/avr32/kernel/process.c avr32-2.6/arch/avr32/kernel/process.c
6202 --- linux-2.6.24.3/arch/avr32/kernel/process.c 2008-02-26 01:20:20.000000000 +0100
6203 +++ avr32-2.6/arch/avr32/kernel/process.c 2008-04-23 20:12:35.000000000 +0200
6205 #include <linux/fs.h>
6206 #include <linux/ptrace.h>
6207 #include <linux/reboot.h>
6208 +#include <linux/tick.h>
6209 #include <linux/uaccess.h>
6210 #include <linux/unistd.h>
6212 #include <asm/sysreg.h>
6213 #include <asm/ocd.h>
6215 +#include <asm/arch/pm.h>
6217 void (*pm_power_off)(void) = NULL;
6218 EXPORT_SYMBOL(pm_power_off);
6220 -extern void cpu_idle_sleep(void);
6223 * This file handles the architecture-dependent parts of process handling..
6227 /* endless idle loop with no priority at all */
6229 + tick_nohz_stop_sched_tick();
6230 while (!need_resched())
6232 + tick_nohz_restart_sched_tick();
6233 preempt_enable_no_resched();
6238 void exit_thread(void)
6240 - /* nothing to do */
6241 + ocd_disable(current);
6244 void flush_thread(void)
6245 @@ -345,6 +348,10 @@
6246 p->thread.cpu_context.ksp = (unsigned long)childregs;
6247 p->thread.cpu_context.pc = (unsigned long)ret_from_fork;
6249 + clear_tsk_thread_flag(p, TIF_DEBUG);
6250 + if ((clone_flags & CLONE_PTRACE) && test_thread_flag(TIF_DEBUG))
6256 diff -urN linux-2.6.24.3/arch/avr32/kernel/ptrace.c avr32-2.6/arch/avr32/kernel/ptrace.c
6257 --- linux-2.6.24.3/arch/avr32/kernel/ptrace.c 2008-02-26 01:20:20.000000000 +0100
6258 +++ avr32-2.6/arch/avr32/kernel/ptrace.c 2008-04-23 19:33:28.000000000 +0200
6261 clear_tsk_thread_flag(child, TIF_SINGLE_STEP);
6262 clear_tsk_thread_flag(child, TIF_BREAKPOINT);
6263 + ocd_disable(child);
6267 @@ -144,10 +145,6 @@
6271 - pr_debug("ptrace: Enabling monitor mode...\n");
6272 - ocd_write(DC, ocd_read(DC) | (1 << OCD_DC_MM_BIT)
6273 - | (1 << OCD_DC_DBE_BIT));
6276 /* Read the word at location addr in the child process */
6277 case PTRACE_PEEKTEXT:
6278 diff -urN linux-2.6.24.3/arch/avr32/kernel/setup.c avr32-2.6/arch/avr32/kernel/setup.c
6279 --- linux-2.6.24.3/arch/avr32/kernel/setup.c 2008-02-26 01:20:20.000000000 +0100
6280 +++ avr32-2.6/arch/avr32/kernel/setup.c 2008-04-23 20:12:35.000000000 +0200
6283 "Failed to allocate framebuffer memory\n");
6286 + memset(__va(fbmem_start), 0, fbmem_size);
6290 diff -urN linux-2.6.24.3/arch/avr32/kernel/signal.c avr32-2.6/arch/avr32/kernel/signal.c
6291 --- linux-2.6.24.3/arch/avr32/kernel/signal.c 2008-02-26 01:20:20.000000000 +0100
6292 +++ avr32-2.6/arch/avr32/kernel/signal.c 2008-04-23 19:33:28.000000000 +0200
6293 @@ -270,19 +270,12 @@
6294 if (!user_mode(regs))
6297 - if (try_to_freeze()) {
6299 - if (!signal_pending(current))
6303 if (test_thread_flag(TIF_RESTORE_SIGMASK))
6304 oldset = ¤t->saved_sigmask;
6306 oldset = ¤t->blocked;
6308 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
6311 switch (regs->r12) {
6312 case -ERESTART_RESTARTBLOCK:
6313 diff -urN linux-2.6.24.3/arch/avr32/kernel/time.c avr32-2.6/arch/avr32/kernel/time.c
6314 --- linux-2.6.24.3/arch/avr32/kernel/time.c 2008-02-26 01:20:20.000000000 +0100
6315 +++ avr32-2.6/arch/avr32/kernel/time.c 2008-04-23 20:12:35.000000000 +0200
6318 * Copyright (C) 2004-2007 Atmel Corporation
6320 - * Based on MIPS implementation arch/mips/kernel/time.c
6321 - * Copyright 2001 MontaVista Software Inc.
6323 * This program is free software; you can redistribute it and/or modify
6324 * it under the terms of the GNU General Public License version 2 as
6325 * published by the Free Software Foundation.
6328 #include <linux/clk.h>
6329 -#include <linux/clocksource.h>
6330 +#include <linux/clockchips.h>
6331 #include <linux/time.h>
6332 #include <linux/module.h>
6333 #include <linux/interrupt.h>
6334 @@ -27,207 +23,133 @@
6336 #include <asm/sections.h>
6338 -/* how many counter cycles in a jiffy? */
6339 -static u32 cycles_per_jiffy;
6340 +#include <asm/arch/pm.h>
6342 -/* the count value for the next timer interrupt */
6343 -static u32 expirelo;
6345 -cycle_t __weak read_cycle_count(void)
6346 +static cycle_t read_cycle_count(void)
6348 return (cycle_t)sysreg_read(COUNT);
6351 -struct clocksource __weak clocksource_avr32 = {
6355 + * The architectural cycle count registers are a fine clocksource unless
6356 + * the system idle loop use sleep states like "idle": the CPU cycles
6357 + * measured by COUNT (and COMPARE) don't happen during sleep states.
6358 + * Their duration also changes if cpufreq changes the CPU clock rate.
6359 + * So we rate the clocksource using COUNT as very low quality.
6361 +static struct clocksource counter = {
6362 + .name = "avr32_counter",
6364 .read = read_cycle_count,
6365 .mask = CLOCKSOURCE_MASK(32),
6367 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
6370 -irqreturn_t __weak timer_interrupt(int irq, void *dev_id);
6372 -struct irqaction timer_irqaction = {
6373 - .handler = timer_interrupt,
6374 - .flags = IRQF_DISABLED,
6379 - * By default we provide the null RTC ops
6381 -static unsigned long null_rtc_get_time(void)
6382 +static irqreturn_t timer_interrupt(int irq, void *dev_id)
6384 - return mktime(2007, 1, 1, 0, 0, 0);
6387 -static int null_rtc_set_time(unsigned long sec)
6391 + struct clock_event_device *evdev = dev_id;
6393 -static unsigned long (*rtc_get_time)(void) = null_rtc_get_time;
6394 -static int (*rtc_set_time)(unsigned long) = null_rtc_set_time;
6396 -static void avr32_timer_ack(void)
6400 - /* Ack this timer interrupt and set the next one */
6401 - expirelo += cycles_per_jiffy;
6402 - /* setting COMPARE to 0 stops the COUNT-COMPARE */
6403 - if (expirelo == 0) {
6404 - sysreg_write(COMPARE, expirelo + 1);
6406 - sysreg_write(COMPARE, expirelo);
6409 + * Disable the interrupt until the clockevent subsystem
6412 + sysreg_write(COMPARE, 0);
6414 - /* Check to see if we have missed any timer interrupts */
6415 - count = sysreg_read(COUNT);
6416 - if ((count - expirelo) < 0x7fffffff) {
6417 - expirelo = count + cycles_per_jiffy;
6418 - sysreg_write(COMPARE, expirelo);
6420 + evdev->event_handler(evdev);
6421 + return IRQ_HANDLED;
6424 -int __weak avr32_hpt_init(void)
6427 - unsigned long mult, shift, count_hz;
6429 - count_hz = clk_get_rate(boot_cpu_data.clk);
6430 - shift = clocksource_avr32.shift;
6431 - mult = clocksource_hz2mult(count_hz, shift);
6432 - clocksource_avr32.mult = mult;
6440 - do_div(tmp, mult);
6442 - cycles_per_jiffy = tmp;
6444 +static struct irqaction timer_irqaction = {
6445 + .handler = timer_interrupt,
6446 + .flags = IRQF_TIMER | IRQF_DISABLED,
6447 + .name = "avr32_comparator",
6450 - ret = setup_irq(0, &timer_irqaction);
6452 - pr_debug("timer: could not request IRQ 0: %d\n", ret);
6455 +static int comparator_next_event(unsigned long delta,
6456 + struct clock_event_device *evdev)
6458 + unsigned long flags;
6460 - printk(KERN_INFO "timer: AT32AP COUNT-COMPARE at irq 0, "
6461 - "%lu.%03lu MHz\n",
6462 - ((count_hz + 500) / 1000) / 1000,
6463 - ((count_hz + 500) / 1000) % 1000);
6464 + raw_local_irq_save(flags);
6468 + /* The time to read COUNT then update COMPARE must be less
6469 + * than the min_delta_ns value for this clockevent source.
6471 + sysreg_write(COMPARE, (sysreg_read(COUNT) + delta) ? : 1);
6474 - * Taken from MIPS c0_hpt_timer_init().
6476 - * The reason COUNT is written twice is probably to make sure we don't get any
6477 - * timer interrupts while we are messing with the counter.
6479 -int __weak avr32_hpt_start(void)
6481 - u32 count = sysreg_read(COUNT);
6482 - expirelo = (count / cycles_per_jiffy + 1) * cycles_per_jiffy;
6483 - sysreg_write(COUNT, expirelo - cycles_per_jiffy);
6484 - sysreg_write(COMPARE, expirelo);
6485 - sysreg_write(COUNT, count);
6486 + raw_local_irq_restore(flags);
6492 - * local_timer_interrupt() does profiling and process accounting on a
6495 - * In UP mode, it is invoked from the (global) timer_interrupt.
6497 -void local_timer_interrupt(int irq, void *dev_id)
6498 +static void comparator_mode(enum clock_event_mode mode,
6499 + struct clock_event_device *evdev)
6502 - profile_tick(CPU_PROFILING);
6503 - update_process_times(user_mode(get_irq_regs()));
6505 + case CLOCK_EVT_MODE_ONESHOT:
6506 + pr_debug("%s: start\n", evdev->name);
6508 + case CLOCK_EVT_MODE_RESUME:
6509 + cpu_disable_idle_sleep();
6511 + case CLOCK_EVT_MODE_UNUSED:
6512 + case CLOCK_EVT_MODE_SHUTDOWN:
6513 + sysreg_write(COMPARE, 0);
6514 + pr_debug("%s: stop\n", evdev->name);
6515 + cpu_enable_idle_sleep();
6522 -irqreturn_t __weak timer_interrupt(int irq, void *dev_id)
6524 - /* ack timer interrupt and try to set next interrupt */
6525 - avr32_timer_ack();
6528 - * Call the generic timer interrupt handler
6530 - write_seqlock(&xtime_lock);
6532 - write_sequnlock(&xtime_lock);
6535 - * In UP mode, we call local_timer_interrupt() to do profiling
6536 - * and process accounting.
6538 - * SMP is not supported yet.
6540 - local_timer_interrupt(irq, dev_id);
6542 - return IRQ_HANDLED;
6544 +static struct clock_event_device comparator = {
6545 + .name = "avr32_comparator",
6546 + .features = CLOCK_EVT_FEAT_ONESHOT,
6549 + .cpumask = CPU_MASK_CPU0,
6550 + .set_next_event = comparator_next_event,
6551 + .set_mode = comparator_mode,
6554 void __init time_init(void)
6556 + unsigned long counter_hz;
6560 - * Make sure we don't get any COMPARE interrupts before we can
6563 - sysreg_write(COMPARE, 0);
6565 - xtime.tv_sec = rtc_get_time();
6566 + xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0);
6569 set_normalized_timespec(&wall_to_monotonic,
6570 -xtime.tv_sec, -xtime.tv_nsec);
6572 - ret = avr32_hpt_init();
6574 - pr_debug("timer: failed setup: %d\n", ret);
6577 + /* figure rate for counter */
6578 + counter_hz = clk_get_rate(boot_cpu_data.clk);
6579 + counter.mult = clocksource_hz2mult(counter_hz, counter.shift);
6581 - ret = clocksource_register(&clocksource_avr32);
6582 + ret = clocksource_register(&counter);
6584 pr_debug("timer: could not register clocksource: %d\n", ret);
6586 - ret = avr32_hpt_start();
6588 - pr_debug("timer: failed starting: %d\n", ret);
6592 + /* setup COMPARE clockevent */
6593 + comparator.mult = div_sc(counter_hz, NSEC_PER_SEC, comparator.shift);
6594 + comparator.max_delta_ns = clockevent_delta2ns((u32)~0, &comparator);
6595 + comparator.min_delta_ns = clockevent_delta2ns(50, &comparator) + 1;
6597 -static struct sysdev_class timer_class = {
6598 - set_kset_name("timer"),
6600 + sysreg_write(COMPARE, 0);
6601 + timer_irqaction.dev_id = &comparator;
6603 -static struct sys_device timer_device = {
6605 - .cls = &timer_class,
6607 + ret = setup_irq(0, &timer_irqaction);
6609 + pr_debug("timer: could not request IRQ 0: %d\n", ret);
6611 + clockevents_register_device(&comparator);
6613 -static int __init init_timer_sysfs(void)
6615 - int err = sysdev_class_register(&timer_class);
6617 - err = sysdev_register(&timer_device);
6619 + pr_info("%s: irq 0, %lu.%03lu MHz\n", comparator.name,
6620 + ((counter_hz + 500) / 1000) / 1000,
6621 + ((counter_hz + 500) / 1000) % 1000);
6625 -device_initcall(init_timer_sysfs);
6626 diff -urN linux-2.6.24.3/arch/avr32/kernel/traps.c avr32-2.6/arch/avr32/kernel/traps.c
6627 --- linux-2.6.24.3/arch/avr32/kernel/traps.c 2008-02-26 01:20:20.000000000 +0100
6628 +++ avr32-2.6/arch/avr32/kernel/traps.c 2008-04-23 19:33:28.000000000 +0200
6630 #include <linux/bug.h>
6631 #include <linux/init.h>
6632 #include <linux/kallsyms.h>
6633 +#include <linux/kdebug.h>
6634 #include <linux/module.h>
6635 #include <linux/notifier.h>
6636 #include <linux/sched.h>
6637 @@ -107,9 +108,23 @@
6639 asmlinkage void do_nmi(unsigned long ecr, struct pt_regs *regs)
6641 - printk(KERN_ALERT "Got Non-Maskable Interrupt, dumping regs\n");
6642 - show_regs_log_lvl(regs, KERN_ALERT);
6643 - show_stack_log_lvl(current, regs->sp, regs, KERN_ALERT);
6648 + ret = notify_die(DIE_NMI, "NMI", regs, 0, ecr, SIGINT);
6654 + die("Fatal Non-Maskable Interrupt", regs, SIGINT);
6659 + printk(KERN_ALERT "Got NMI, but nobody cared. Disabling...\n");
6663 asmlinkage void do_critical_exception(unsigned long ecr, struct pt_regs *regs)
6664 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/at32ap7000.c avr32-2.6/arch/avr32/mach-at32ap/at32ap7000.c
6665 --- linux-2.6.24.3/arch/avr32/mach-at32ap/at32ap7000.c 2008-02-26 01:20:20.000000000 +0100
6666 +++ avr32-2.6/arch/avr32/mach-at32ap/at32ap7000.c 1970-01-01 01:00:00.000000000 +0100
6669 - * Copyright (C) 2005-2006 Atmel Corporation
6671 - * This program is free software; you can redistribute it and/or modify
6672 - * it under the terms of the GNU General Public License version 2 as
6673 - * published by the Free Software Foundation.
6675 -#include <linux/clk.h>
6676 -#include <linux/fb.h>
6677 -#include <linux/init.h>
6678 -#include <linux/platform_device.h>
6679 -#include <linux/dma-mapping.h>
6680 -#include <linux/spi/spi.h>
6682 -#include <asm/io.h>
6684 -#include <asm/arch/at32ap7000.h>
6685 -#include <asm/arch/board.h>
6686 -#include <asm/arch/portmux.h>
6688 -#include <video/atmel_lcdc.h>
6691 -#include "hmatrix.h"
6696 -#define PBMEM(base) \
6699 - .end = base + 0x3ff, \
6700 - .flags = IORESOURCE_MEM, \
6706 - .flags = IORESOURCE_IRQ, \
6708 -#define NAMED_IRQ(num, _name) \
6713 - .flags = IORESOURCE_IRQ, \
6716 -/* REVISIT these assume *every* device supports DMA, but several
6717 - * don't ... tc, smc, pio, rtc, watchdog, pwm, ps2, and more.
6719 -#define DEFINE_DEV(_name, _id) \
6720 -static u64 _name##_id##_dma_mask = DMA_32BIT_MASK; \
6721 -static struct platform_device _name##_id##_device = { \
6725 - .dma_mask = &_name##_id##_dma_mask, \
6726 - .coherent_dma_mask = DMA_32BIT_MASK, \
6728 - .resource = _name##_id##_resource, \
6729 - .num_resources = ARRAY_SIZE(_name##_id##_resource), \
6731 -#define DEFINE_DEV_DATA(_name, _id) \
6732 -static u64 _name##_id##_dma_mask = DMA_32BIT_MASK; \
6733 -static struct platform_device _name##_id##_device = { \
6737 - .dma_mask = &_name##_id##_dma_mask, \
6738 - .platform_data = &_name##_id##_data, \
6739 - .coherent_dma_mask = DMA_32BIT_MASK, \
6741 - .resource = _name##_id##_resource, \
6742 - .num_resources = ARRAY_SIZE(_name##_id##_resource), \
6745 -#define select_peripheral(pin, periph, flags) \
6746 - at32_select_periph(GPIO_PIN_##pin, GPIO_##periph, flags)
6748 -#define DEV_CLK(_name, devname, bus, _index) \
6749 -static struct clk devname##_##_name = { \
6751 - .dev = &devname##_device.dev, \
6752 - .parent = &bus##_clk, \
6753 - .mode = bus##_clk_mode, \
6754 - .get_rate = bus##_clk_get_rate, \
6755 - .index = _index, \
6758 -static DEFINE_SPINLOCK(pm_lock);
6760 -unsigned long at32ap7000_osc_rates[3] = {
6762 - /* FIXME: these are ATSTK1002-specific */
6767 -static unsigned long osc_get_rate(struct clk *clk)
6769 - return at32ap7000_osc_rates[clk->index];
6772 -static unsigned long pll_get_rate(struct clk *clk, unsigned long control)
6774 - unsigned long div, mul, rate;
6776 - if (!(control & PM_BIT(PLLEN)))
6779 - div = PM_BFEXT(PLLDIV, control) + 1;
6780 - mul = PM_BFEXT(PLLMUL, control) + 1;
6782 - rate = clk->parent->get_rate(clk->parent);
6783 - rate = (rate + div / 2) / div;
6789 -static unsigned long pll0_get_rate(struct clk *clk)
6793 - control = pm_readl(PLL0);
6795 - return pll_get_rate(clk, control);
6798 -static unsigned long pll1_get_rate(struct clk *clk)
6802 - control = pm_readl(PLL1);
6804 - return pll_get_rate(clk, control);
6808 - * The AT32AP7000 has five primary clock sources: One 32kHz
6809 - * oscillator, two crystal oscillators and two PLLs.
6811 -static struct clk osc32k = {
6813 - .get_rate = osc_get_rate,
6817 -static struct clk osc0 = {
6819 - .get_rate = osc_get_rate,
6823 -static struct clk osc1 = {
6825 - .get_rate = osc_get_rate,
6828 -static struct clk pll0 = {
6830 - .get_rate = pll0_get_rate,
6833 -static struct clk pll1 = {
6835 - .get_rate = pll1_get_rate,
6840 - * The main clock can be either osc0 or pll0. The boot loader may
6841 - * have chosen one for us, so we don't really know which one until we
6842 - * have a look at the SM.
6844 -static struct clk *main_clock;
6847 - * Synchronous clocks are generated from the main clock. The clocks
6848 - * must satisfy the constraint
6849 - * fCPU >= fHSB >= fPB
6850 - * i.e. each clock must not be faster than its parent.
6852 -static unsigned long bus_clk_get_rate(struct clk *clk, unsigned int shift)
6854 - return main_clock->get_rate(main_clock) >> shift;
6857 -static void cpu_clk_mode(struct clk *clk, int enabled)
6859 - unsigned long flags;
6862 - spin_lock_irqsave(&pm_lock, flags);
6863 - mask = pm_readl(CPU_MASK);
6865 - mask |= 1 << clk->index;
6867 - mask &= ~(1 << clk->index);
6868 - pm_writel(CPU_MASK, mask);
6869 - spin_unlock_irqrestore(&pm_lock, flags);
6872 -static unsigned long cpu_clk_get_rate(struct clk *clk)
6874 - unsigned long cksel, shift = 0;
6876 - cksel = pm_readl(CKSEL);
6877 - if (cksel & PM_BIT(CPUDIV))
6878 - shift = PM_BFEXT(CPUSEL, cksel) + 1;
6880 - return bus_clk_get_rate(clk, shift);
6883 -static long cpu_clk_set_rate(struct clk *clk, unsigned long rate, int apply)
6886 - unsigned long parent_rate, child_div, actual_rate, div;
6888 - parent_rate = clk->parent->get_rate(clk->parent);
6889 - control = pm_readl(CKSEL);
6891 - if (control & PM_BIT(HSBDIV))
6892 - child_div = 1 << (PM_BFEXT(HSBSEL, control) + 1);
6896 - if (rate > 3 * (parent_rate / 4) || child_div == 1) {
6897 - actual_rate = parent_rate;
6898 - control &= ~PM_BIT(CPUDIV);
6900 - unsigned int cpusel;
6901 - div = (parent_rate + rate / 2) / rate;
6902 - if (div > child_div)
6904 - cpusel = (div > 1) ? (fls(div) - 2) : 0;
6905 - control = PM_BIT(CPUDIV) | PM_BFINS(CPUSEL, cpusel, control);
6906 - actual_rate = parent_rate / (1 << (cpusel + 1));
6909 - pr_debug("clk %s: new rate %lu (actual rate %lu)\n",
6910 - clk->name, rate, actual_rate);
6913 - pm_writel(CKSEL, control);
6915 - return actual_rate;
6918 -static void hsb_clk_mode(struct clk *clk, int enabled)
6920 - unsigned long flags;
6923 - spin_lock_irqsave(&pm_lock, flags);
6924 - mask = pm_readl(HSB_MASK);
6926 - mask |= 1 << clk->index;
6928 - mask &= ~(1 << clk->index);
6929 - pm_writel(HSB_MASK, mask);
6930 - spin_unlock_irqrestore(&pm_lock, flags);
6933 -static unsigned long hsb_clk_get_rate(struct clk *clk)
6935 - unsigned long cksel, shift = 0;
6937 - cksel = pm_readl(CKSEL);
6938 - if (cksel & PM_BIT(HSBDIV))
6939 - shift = PM_BFEXT(HSBSEL, cksel) + 1;
6941 - return bus_clk_get_rate(clk, shift);
6944 -static void pba_clk_mode(struct clk *clk, int enabled)
6946 - unsigned long flags;
6949 - spin_lock_irqsave(&pm_lock, flags);
6950 - mask = pm_readl(PBA_MASK);
6952 - mask |= 1 << clk->index;
6954 - mask &= ~(1 << clk->index);
6955 - pm_writel(PBA_MASK, mask);
6956 - spin_unlock_irqrestore(&pm_lock, flags);
6959 -static unsigned long pba_clk_get_rate(struct clk *clk)
6961 - unsigned long cksel, shift = 0;
6963 - cksel = pm_readl(CKSEL);
6964 - if (cksel & PM_BIT(PBADIV))
6965 - shift = PM_BFEXT(PBASEL, cksel) + 1;
6967 - return bus_clk_get_rate(clk, shift);
6970 -static void pbb_clk_mode(struct clk *clk, int enabled)
6972 - unsigned long flags;
6975 - spin_lock_irqsave(&pm_lock, flags);
6976 - mask = pm_readl(PBB_MASK);
6978 - mask |= 1 << clk->index;
6980 - mask &= ~(1 << clk->index);
6981 - pm_writel(PBB_MASK, mask);
6982 - spin_unlock_irqrestore(&pm_lock, flags);
6985 -static unsigned long pbb_clk_get_rate(struct clk *clk)
6987 - unsigned long cksel, shift = 0;
6989 - cksel = pm_readl(CKSEL);
6990 - if (cksel & PM_BIT(PBBDIV))
6991 - shift = PM_BFEXT(PBBSEL, cksel) + 1;
6993 - return bus_clk_get_rate(clk, shift);
6996 -static struct clk cpu_clk = {
6998 - .get_rate = cpu_clk_get_rate,
6999 - .set_rate = cpu_clk_set_rate,
7002 -static struct clk hsb_clk = {
7004 - .parent = &cpu_clk,
7005 - .get_rate = hsb_clk_get_rate,
7007 -static struct clk pba_clk = {
7009 - .parent = &hsb_clk,
7010 - .mode = hsb_clk_mode,
7011 - .get_rate = pba_clk_get_rate,
7014 -static struct clk pbb_clk = {
7016 - .parent = &hsb_clk,
7017 - .mode = hsb_clk_mode,
7018 - .get_rate = pbb_clk_get_rate,
7023 -/* --------------------------------------------------------------------
7024 - * Generic Clock operations
7025 - * -------------------------------------------------------------------- */
7027 -static void genclk_mode(struct clk *clk, int enabled)
7031 - control = pm_readl(GCCTRL(clk->index));
7033 - control |= PM_BIT(CEN);
7035 - control &= ~PM_BIT(CEN);
7036 - pm_writel(GCCTRL(clk->index), control);
7039 -static unsigned long genclk_get_rate(struct clk *clk)
7042 - unsigned long div = 1;
7044 - control = pm_readl(GCCTRL(clk->index));
7045 - if (control & PM_BIT(DIVEN))
7046 - div = 2 * (PM_BFEXT(DIV, control) + 1);
7048 - return clk->parent->get_rate(clk->parent) / div;
7051 -static long genclk_set_rate(struct clk *clk, unsigned long rate, int apply)
7054 - unsigned long parent_rate, actual_rate, div;
7056 - parent_rate = clk->parent->get_rate(clk->parent);
7057 - control = pm_readl(GCCTRL(clk->index));
7059 - if (rate > 3 * parent_rate / 4) {
7060 - actual_rate = parent_rate;
7061 - control &= ~PM_BIT(DIVEN);
7063 - div = (parent_rate + rate) / (2 * rate) - 1;
7064 - control = PM_BFINS(DIV, div, control) | PM_BIT(DIVEN);
7065 - actual_rate = parent_rate / (2 * (div + 1));
7068 - dev_dbg(clk->dev, "clk %s: new rate %lu (actual rate %lu)\n",
7069 - clk->name, rate, actual_rate);
7072 - pm_writel(GCCTRL(clk->index), control);
7074 - return actual_rate;
7077 -int genclk_set_parent(struct clk *clk, struct clk *parent)
7081 - dev_dbg(clk->dev, "clk %s: new parent %s (was %s)\n",
7082 - clk->name, parent->name, clk->parent->name);
7084 - control = pm_readl(GCCTRL(clk->index));
7086 - if (parent == &osc1 || parent == &pll1)
7087 - control |= PM_BIT(OSCSEL);
7088 - else if (parent == &osc0 || parent == &pll0)
7089 - control &= ~PM_BIT(OSCSEL);
7093 - if (parent == &pll0 || parent == &pll1)
7094 - control |= PM_BIT(PLLSEL);
7096 - control &= ~PM_BIT(PLLSEL);
7098 - pm_writel(GCCTRL(clk->index), control);
7099 - clk->parent = parent;
7104 -static void __init genclk_init_parent(struct clk *clk)
7107 - struct clk *parent;
7109 - BUG_ON(clk->index > 7);
7111 - control = pm_readl(GCCTRL(clk->index));
7112 - if (control & PM_BIT(OSCSEL))
7113 - parent = (control & PM_BIT(PLLSEL)) ? &pll1 : &osc1;
7115 - parent = (control & PM_BIT(PLLSEL)) ? &pll0 : &osc0;
7117 - clk->parent = parent;
7120 -/* --------------------------------------------------------------------
7121 - * System peripherals
7122 - * -------------------------------------------------------------------- */
7123 -static struct resource at32_pm0_resource[] = {
7125 - .start = 0xfff00000,
7126 - .end = 0xfff0007f,
7127 - .flags = IORESOURCE_MEM,
7132 -static struct resource at32ap700x_rtc0_resource[] = {
7134 - .start = 0xfff00080,
7135 - .end = 0xfff000af,
7136 - .flags = IORESOURCE_MEM,
7141 -static struct resource at32_wdt0_resource[] = {
7143 - .start = 0xfff000b0,
7144 - .end = 0xfff000cf,
7145 - .flags = IORESOURCE_MEM,
7149 -static struct resource at32_eic0_resource[] = {
7151 - .start = 0xfff00100,
7152 - .end = 0xfff0013f,
7153 - .flags = IORESOURCE_MEM,
7158 -DEFINE_DEV(at32_pm, 0);
7159 -DEFINE_DEV(at32ap700x_rtc, 0);
7160 -DEFINE_DEV(at32_wdt, 0);
7161 -DEFINE_DEV(at32_eic, 0);
7164 - * Peripheral clock for PM, RTC, WDT and EIC. PM will ensure that this
7165 - * is always running.
7167 -static struct clk at32_pm_pclk = {
7169 - .dev = &at32_pm0_device.dev,
7170 - .parent = &pbb_clk,
7171 - .mode = pbb_clk_mode,
7172 - .get_rate = pbb_clk_get_rate,
7177 -static struct resource intc0_resource[] = {
7178 - PBMEM(0xfff00400),
7180 -struct platform_device at32_intc0_device = {
7183 - .resource = intc0_resource,
7184 - .num_resources = ARRAY_SIZE(intc0_resource),
7186 -DEV_CLK(pclk, at32_intc0, pbb, 1);
7188 -static struct clk ebi_clk = {
7190 - .parent = &hsb_clk,
7191 - .mode = hsb_clk_mode,
7192 - .get_rate = hsb_clk_get_rate,
7195 -static struct clk hramc_clk = {
7197 - .parent = &hsb_clk,
7198 - .mode = hsb_clk_mode,
7199 - .get_rate = hsb_clk_get_rate,
7204 -static struct resource smc0_resource[] = {
7205 - PBMEM(0xfff03400),
7207 -DEFINE_DEV(smc, 0);
7208 -DEV_CLK(pclk, smc0, pbb, 13);
7209 -DEV_CLK(mck, smc0, hsb, 0);
7211 -static struct platform_device pdc_device = {
7215 -DEV_CLK(hclk, pdc, hsb, 4);
7216 -DEV_CLK(pclk, pdc, pba, 16);
7218 -static struct clk pico_clk = {
7220 - .parent = &cpu_clk,
7221 - .mode = cpu_clk_mode,
7222 - .get_rate = cpu_clk_get_rate,
7226 -static struct resource dmaca0_resource[] = {
7228 - .start = 0xff200000,
7229 - .end = 0xff20ffff,
7230 - .flags = IORESOURCE_MEM,
7234 -DEFINE_DEV(dmaca, 0);
7235 -DEV_CLK(hclk, dmaca0, hsb, 10);
7237 -/* --------------------------------------------------------------------
7239 - * -------------------------------------------------------------------- */
7241 -static struct clk hmatrix_clk = {
7242 - .name = "hmatrix_clk",
7243 - .parent = &pbb_clk,
7244 - .mode = pbb_clk_mode,
7245 - .get_rate = pbb_clk_get_rate,
7249 -#define HMATRIX_BASE ((void __iomem *)0xfff00800)
7251 -#define hmatrix_readl(reg) \
7252 - __raw_readl((HMATRIX_BASE) + HMATRIX_##reg)
7253 -#define hmatrix_writel(reg,value) \
7254 - __raw_writel((value), (HMATRIX_BASE) + HMATRIX_##reg)
7257 - * Set bits in the HMATRIX Special Function Register (SFR) used by the
7258 - * External Bus Interface (EBI). This can be used to enable special
7259 - * features like CompactFlash support, NAND Flash support, etc. on
7260 - * certain chipselects.
7262 -static inline void set_ebi_sfr_bits(u32 mask)
7266 - clk_enable(&hmatrix_clk);
7267 - sfr = hmatrix_readl(SFR4);
7269 - hmatrix_writel(SFR4, sfr);
7270 - clk_disable(&hmatrix_clk);
7273 -/* --------------------------------------------------------------------
7274 - * System Timer/Counter (TC)
7275 - * -------------------------------------------------------------------- */
7276 -static struct resource at32_systc0_resource[] = {
7277 - PBMEM(0xfff00c00),
7280 -struct platform_device at32_systc0_device = {
7283 - .resource = at32_systc0_resource,
7284 - .num_resources = ARRAY_SIZE(at32_systc0_resource),
7286 -DEV_CLK(pclk, at32_systc0, pbb, 3);
7288 -/* --------------------------------------------------------------------
7290 - * -------------------------------------------------------------------- */
7292 -static struct resource pio0_resource[] = {
7293 - PBMEM(0xffe02800),
7296 -DEFINE_DEV(pio, 0);
7297 -DEV_CLK(mck, pio0, pba, 10);
7299 -static struct resource pio1_resource[] = {
7300 - PBMEM(0xffe02c00),
7303 -DEFINE_DEV(pio, 1);
7304 -DEV_CLK(mck, pio1, pba, 11);
7306 -static struct resource pio2_resource[] = {
7307 - PBMEM(0xffe03000),
7310 -DEFINE_DEV(pio, 2);
7311 -DEV_CLK(mck, pio2, pba, 12);
7313 -static struct resource pio3_resource[] = {
7314 - PBMEM(0xffe03400),
7317 -DEFINE_DEV(pio, 3);
7318 -DEV_CLK(mck, pio3, pba, 13);
7320 -static struct resource pio4_resource[] = {
7321 - PBMEM(0xffe03800),
7324 -DEFINE_DEV(pio, 4);
7325 -DEV_CLK(mck, pio4, pba, 14);
7327 -void __init at32_add_system_devices(void)
7329 - platform_device_register(&at32_pm0_device);
7330 - platform_device_register(&at32_intc0_device);
7331 - platform_device_register(&at32ap700x_rtc0_device);
7332 - platform_device_register(&at32_wdt0_device);
7333 - platform_device_register(&at32_eic0_device);
7334 - platform_device_register(&smc0_device);
7335 - platform_device_register(&pdc_device);
7336 - platform_device_register(&dmaca0_device);
7338 - platform_device_register(&at32_systc0_device);
7340 - platform_device_register(&pio0_device);
7341 - platform_device_register(&pio1_device);
7342 - platform_device_register(&pio2_device);
7343 - platform_device_register(&pio3_device);
7344 - platform_device_register(&pio4_device);
7347 -/* --------------------------------------------------------------------
7349 - * -------------------------------------------------------------------- */
7351 -static struct atmel_uart_data atmel_usart0_data = {
7355 -static struct resource atmel_usart0_resource[] = {
7356 - PBMEM(0xffe00c00),
7359 -DEFINE_DEV_DATA(atmel_usart, 0);
7360 -DEV_CLK(usart, atmel_usart0, pba, 3);
7362 -static struct atmel_uart_data atmel_usart1_data = {
7366 -static struct resource atmel_usart1_resource[] = {
7367 - PBMEM(0xffe01000),
7370 -DEFINE_DEV_DATA(atmel_usart, 1);
7371 -DEV_CLK(usart, atmel_usart1, pba, 4);
7373 -static struct atmel_uart_data atmel_usart2_data = {
7377 -static struct resource atmel_usart2_resource[] = {
7378 - PBMEM(0xffe01400),
7381 -DEFINE_DEV_DATA(atmel_usart, 2);
7382 -DEV_CLK(usart, atmel_usart2, pba, 5);
7384 -static struct atmel_uart_data atmel_usart3_data = {
7388 -static struct resource atmel_usart3_resource[] = {
7389 - PBMEM(0xffe01800),
7392 -DEFINE_DEV_DATA(atmel_usart, 3);
7393 -DEV_CLK(usart, atmel_usart3, pba, 6);
7395 -static inline void configure_usart0_pins(void)
7397 - select_peripheral(PA(8), PERIPH_B, 0); /* RXD */
7398 - select_peripheral(PA(9), PERIPH_B, 0); /* TXD */
7401 -static inline void configure_usart1_pins(void)
7403 - select_peripheral(PA(17), PERIPH_A, 0); /* RXD */
7404 - select_peripheral(PA(18), PERIPH_A, 0); /* TXD */
7407 -static inline void configure_usart2_pins(void)
7409 - select_peripheral(PB(26), PERIPH_B, 0); /* RXD */
7410 - select_peripheral(PB(27), PERIPH_B, 0); /* TXD */
7413 -static inline void configure_usart3_pins(void)
7415 - select_peripheral(PB(18), PERIPH_B, 0); /* RXD */
7416 - select_peripheral(PB(17), PERIPH_B, 0); /* TXD */
7419 -static struct platform_device *__initdata at32_usarts[4];
7421 -void __init at32_map_usart(unsigned int hw_id, unsigned int line)
7423 - struct platform_device *pdev;
7427 - pdev = &atmel_usart0_device;
7428 - configure_usart0_pins();
7431 - pdev = &atmel_usart1_device;
7432 - configure_usart1_pins();
7435 - pdev = &atmel_usart2_device;
7436 - configure_usart2_pins();
7439 - pdev = &atmel_usart3_device;
7440 - configure_usart3_pins();
7446 - if (PXSEG(pdev->resource[0].start) == P4SEG) {
7447 - /* Addresses in the P4 segment are permanently mapped 1:1 */
7448 - struct atmel_uart_data *data = pdev->dev.platform_data;
7449 - data->regs = (void __iomem *)pdev->resource[0].start;
7453 - at32_usarts[line] = pdev;
7456 -struct platform_device *__init at32_add_device_usart(unsigned int id)
7458 - platform_device_register(at32_usarts[id]);
7459 - return at32_usarts[id];
7462 -struct platform_device *atmel_default_console_device;
7464 -void __init at32_setup_serial_console(unsigned int usart_id)
7466 - atmel_default_console_device = at32_usarts[usart_id];
7469 -/* --------------------------------------------------------------------
7471 - * -------------------------------------------------------------------- */
7473 -static struct eth_platform_data macb0_data;
7474 -static struct resource macb0_resource[] = {
7475 - PBMEM(0xfff01800),
7478 -DEFINE_DEV_DATA(macb, 0);
7479 -DEV_CLK(hclk, macb0, hsb, 8);
7480 -DEV_CLK(pclk, macb0, pbb, 6);
7482 -static struct eth_platform_data macb1_data;
7483 -static struct resource macb1_resource[] = {
7484 - PBMEM(0xfff01c00),
7487 -DEFINE_DEV_DATA(macb, 1);
7488 -DEV_CLK(hclk, macb1, hsb, 9);
7489 -DEV_CLK(pclk, macb1, pbb, 7);
7491 -struct platform_device *__init
7492 -at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
7494 - struct platform_device *pdev;
7498 - pdev = &macb0_device;
7500 - select_peripheral(PC(3), PERIPH_A, 0); /* TXD0 */
7501 - select_peripheral(PC(4), PERIPH_A, 0); /* TXD1 */
7502 - select_peripheral(PC(7), PERIPH_A, 0); /* TXEN */
7503 - select_peripheral(PC(8), PERIPH_A, 0); /* TXCK */
7504 - select_peripheral(PC(9), PERIPH_A, 0); /* RXD0 */
7505 - select_peripheral(PC(10), PERIPH_A, 0); /* RXD1 */
7506 - select_peripheral(PC(13), PERIPH_A, 0); /* RXER */
7507 - select_peripheral(PC(15), PERIPH_A, 0); /* RXDV */
7508 - select_peripheral(PC(16), PERIPH_A, 0); /* MDC */
7509 - select_peripheral(PC(17), PERIPH_A, 0); /* MDIO */
7511 - if (!data->is_rmii) {
7512 - select_peripheral(PC(0), PERIPH_A, 0); /* COL */
7513 - select_peripheral(PC(1), PERIPH_A, 0); /* CRS */
7514 - select_peripheral(PC(2), PERIPH_A, 0); /* TXER */
7515 - select_peripheral(PC(5), PERIPH_A, 0); /* TXD2 */
7516 - select_peripheral(PC(6), PERIPH_A, 0); /* TXD3 */
7517 - select_peripheral(PC(11), PERIPH_A, 0); /* RXD2 */
7518 - select_peripheral(PC(12), PERIPH_A, 0); /* RXD3 */
7519 - select_peripheral(PC(14), PERIPH_A, 0); /* RXCK */
7520 - select_peripheral(PC(18), PERIPH_A, 0); /* SPD */
7525 - pdev = &macb1_device;
7527 - select_peripheral(PD(13), PERIPH_B, 0); /* TXD0 */
7528 - select_peripheral(PD(14), PERIPH_B, 0); /* TXD1 */
7529 - select_peripheral(PD(11), PERIPH_B, 0); /* TXEN */
7530 - select_peripheral(PD(12), PERIPH_B, 0); /* TXCK */
7531 - select_peripheral(PD(10), PERIPH_B, 0); /* RXD0 */
7532 - select_peripheral(PD(6), PERIPH_B, 0); /* RXD1 */
7533 - select_peripheral(PD(5), PERIPH_B, 0); /* RXER */
7534 - select_peripheral(PD(4), PERIPH_B, 0); /* RXDV */
7535 - select_peripheral(PD(3), PERIPH_B, 0); /* MDC */
7536 - select_peripheral(PD(2), PERIPH_B, 0); /* MDIO */
7538 - if (!data->is_rmii) {
7539 - select_peripheral(PC(19), PERIPH_B, 0); /* COL */
7540 - select_peripheral(PC(23), PERIPH_B, 0); /* CRS */
7541 - select_peripheral(PC(26), PERIPH_B, 0); /* TXER */
7542 - select_peripheral(PC(27), PERIPH_B, 0); /* TXD2 */
7543 - select_peripheral(PC(28), PERIPH_B, 0); /* TXD3 */
7544 - select_peripheral(PC(29), PERIPH_B, 0); /* RXD2 */
7545 - select_peripheral(PC(30), PERIPH_B, 0); /* RXD3 */
7546 - select_peripheral(PC(24), PERIPH_B, 0); /* RXCK */
7547 - select_peripheral(PD(15), PERIPH_B, 0); /* SPD */
7555 - memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data));
7556 - platform_device_register(pdev);
7561 -/* --------------------------------------------------------------------
7563 - * -------------------------------------------------------------------- */
7564 -static struct resource atmel_spi0_resource[] = {
7565 - PBMEM(0xffe00000),
7568 -DEFINE_DEV(atmel_spi, 0);
7569 -DEV_CLK(spi_clk, atmel_spi0, pba, 0);
7571 -static struct resource atmel_spi1_resource[] = {
7572 - PBMEM(0xffe00400),
7575 -DEFINE_DEV(atmel_spi, 1);
7576 -DEV_CLK(spi_clk, atmel_spi1, pba, 1);
7579 -at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b,
7580 - unsigned int n, const u8 *pins)
7582 - unsigned int pin, mode;
7584 - for (; n; n--, b++) {
7585 - b->bus_num = bus_num;
7586 - if (b->chip_select >= 4)
7588 - pin = (unsigned)b->controller_data;
7590 - pin = pins[b->chip_select];
7591 - b->controller_data = (void *)pin;
7593 - mode = AT32_GPIOF_OUTPUT;
7594 - if (!(b->mode & SPI_CS_HIGH))
7595 - mode |= AT32_GPIOF_HIGH;
7596 - at32_select_gpio(pin, mode);
7600 -struct platform_device *__init
7601 -at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n)
7604 - * Manage the chipselects as GPIOs, normally using the same pins
7605 - * the SPI controller expects; but boards can use other pins.
7607 - static u8 __initdata spi0_pins[] =
7608 - { GPIO_PIN_PA(3), GPIO_PIN_PA(4),
7609 - GPIO_PIN_PA(5), GPIO_PIN_PA(20), };
7610 - static u8 __initdata spi1_pins[] =
7611 - { GPIO_PIN_PB(2), GPIO_PIN_PB(3),
7612 - GPIO_PIN_PB(4), GPIO_PIN_PA(27), };
7613 - struct platform_device *pdev;
7617 - pdev = &atmel_spi0_device;
7618 - select_peripheral(PA(0), PERIPH_A, 0); /* MISO */
7619 - select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */
7620 - select_peripheral(PA(2), PERIPH_A, 0); /* SCK */
7621 - at32_spi_setup_slaves(0, b, n, spi0_pins);
7625 - pdev = &atmel_spi1_device;
7626 - select_peripheral(PB(0), PERIPH_B, 0); /* MISO */
7627 - select_peripheral(PB(1), PERIPH_B, 0); /* MOSI */
7628 - select_peripheral(PB(5), PERIPH_B, 0); /* SCK */
7629 - at32_spi_setup_slaves(1, b, n, spi1_pins);
7636 - spi_register_board_info(b, n);
7637 - platform_device_register(pdev);
7641 -/* --------------------------------------------------------------------
7643 - * -------------------------------------------------------------------- */
7644 -static struct resource atmel_twi0_resource[] __initdata = {
7645 - PBMEM(0xffe00800),
7648 -static struct clk atmel_twi0_pclk = {
7649 - .name = "twi_pclk",
7650 - .parent = &pba_clk,
7651 - .mode = pba_clk_mode,
7652 - .get_rate = pba_clk_get_rate,
7656 -struct platform_device *__init at32_add_device_twi(unsigned int id)
7658 - struct platform_device *pdev;
7663 - pdev = platform_device_alloc("atmel_twi", id);
7667 - if (platform_device_add_resources(pdev, atmel_twi0_resource,
7668 - ARRAY_SIZE(atmel_twi0_resource)))
7669 - goto err_add_resources;
7671 - select_peripheral(PA(6), PERIPH_A, 0); /* SDA */
7672 - select_peripheral(PA(7), PERIPH_A, 0); /* SDL */
7674 - atmel_twi0_pclk.dev = &pdev->dev;
7676 - platform_device_add(pdev);
7680 - platform_device_put(pdev);
7684 -/* --------------------------------------------------------------------
7686 - * -------------------------------------------------------------------- */
7687 -static struct resource atmel_mci0_resource[] __initdata = {
7688 - PBMEM(0xfff02400),
7691 -static struct clk atmel_mci0_pclk = {
7692 - .name = "mci_clk",
7693 - .parent = &pbb_clk,
7694 - .mode = pbb_clk_mode,
7695 - .get_rate = pbb_clk_get_rate,
7699 -struct platform_device *__init at32_add_device_mci(unsigned int id)
7701 - struct platform_device *pdev;
7706 - pdev = platform_device_alloc("atmel_mci", id);
7710 - if (platform_device_add_resources(pdev, atmel_mci0_resource,
7711 - ARRAY_SIZE(atmel_mci0_resource)))
7712 - goto err_add_resources;
7714 - select_peripheral(PA(10), PERIPH_A, 0); /* CLK */
7715 - select_peripheral(PA(11), PERIPH_A, 0); /* CMD */
7716 - select_peripheral(PA(12), PERIPH_A, 0); /* DATA0 */
7717 - select_peripheral(PA(13), PERIPH_A, 0); /* DATA1 */
7718 - select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */
7719 - select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */
7721 - atmel_mci0_pclk.dev = &pdev->dev;
7723 - platform_device_add(pdev);
7727 - platform_device_put(pdev);
7731 -/* --------------------------------------------------------------------
7733 - * -------------------------------------------------------------------- */
7734 -static struct atmel_lcdfb_info atmel_lcdfb0_data;
7735 -static struct resource atmel_lcdfb0_resource[] = {
7737 - .start = 0xff000000,
7738 - .end = 0xff000fff,
7739 - .flags = IORESOURCE_MEM,
7743 - /* Placeholder for pre-allocated fb memory */
7744 - .start = 0x00000000,
7745 - .end = 0x00000000,
7749 -DEFINE_DEV_DATA(atmel_lcdfb, 0);
7750 -DEV_CLK(hck1, atmel_lcdfb0, hsb, 7);
7751 -static struct clk atmel_lcdfb0_pixclk = {
7752 - .name = "lcdc_clk",
7753 - .dev = &atmel_lcdfb0_device.dev,
7754 - .mode = genclk_mode,
7755 - .get_rate = genclk_get_rate,
7756 - .set_rate = genclk_set_rate,
7757 - .set_parent = genclk_set_parent,
7761 -struct platform_device *__init
7762 -at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
7763 - unsigned long fbmem_start, unsigned long fbmem_len)
7765 - struct platform_device *pdev;
7766 - struct atmel_lcdfb_info *info;
7767 - struct fb_monspecs *monspecs;
7768 - struct fb_videomode *modedb;
7769 - unsigned int modedb_size;
7772 - * Do a deep copy of the fb data, monspecs and modedb. Make
7773 - * sure all allocations are done before setting up the
7776 - monspecs = kmemdup(data->default_monspecs,
7777 - sizeof(struct fb_monspecs), GFP_KERNEL);
7781 - modedb_size = sizeof(struct fb_videomode) * monspecs->modedb_len;
7782 - modedb = kmemdup(monspecs->modedb, modedb_size, GFP_KERNEL);
7784 - goto err_dup_modedb;
7785 - monspecs->modedb = modedb;
7789 - pdev = &atmel_lcdfb0_device;
7790 - select_peripheral(PC(19), PERIPH_A, 0); /* CC */
7791 - select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */
7792 - select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */
7793 - select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */
7794 - select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */
7795 - select_peripheral(PC(24), PERIPH_A, 0); /* MODE */
7796 - select_peripheral(PC(25), PERIPH_A, 0); /* PWR */
7797 - select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */
7798 - select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */
7799 - select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */
7800 - select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */
7801 - select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */
7802 - select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */
7803 - select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */
7804 - select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */
7805 - select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */
7806 - select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */
7807 - select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */
7808 - select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */
7809 - select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */
7810 - select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */
7811 - select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */
7812 - select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */
7813 - select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */
7814 - select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */
7815 - select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */
7816 - select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */
7817 - select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */
7818 - select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */
7819 - select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */
7820 - select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */
7822 - clk_set_parent(&atmel_lcdfb0_pixclk, &pll0);
7823 - clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0));
7827 - goto err_invalid_id;
7831 - pdev->resource[2].start = fbmem_start;
7832 - pdev->resource[2].end = fbmem_start + fbmem_len - 1;
7833 - pdev->resource[2].flags = IORESOURCE_MEM;
7836 - info = pdev->dev.platform_data;
7837 - memcpy(info, data, sizeof(struct atmel_lcdfb_info));
7838 - info->default_monspecs = monspecs;
7840 - platform_device_register(pdev);
7850 -/* --------------------------------------------------------------------
7852 - * -------------------------------------------------------------------- */
7853 -static struct resource ssc0_resource[] = {
7854 - PBMEM(0xffe01c00),
7857 -DEFINE_DEV(ssc, 0);
7858 -DEV_CLK(pclk, ssc0, pba, 7);
7860 -static struct resource ssc1_resource[] = {
7861 - PBMEM(0xffe02000),
7864 -DEFINE_DEV(ssc, 1);
7865 -DEV_CLK(pclk, ssc1, pba, 8);
7867 -static struct resource ssc2_resource[] = {
7868 - PBMEM(0xffe02400),
7871 -DEFINE_DEV(ssc, 2);
7872 -DEV_CLK(pclk, ssc2, pba, 9);
7874 -struct platform_device *__init
7875 -at32_add_device_ssc(unsigned int id, unsigned int flags)
7877 - struct platform_device *pdev;
7881 - pdev = &ssc0_device;
7882 - if (flags & ATMEL_SSC_RF)
7883 - select_peripheral(PA(21), PERIPH_A, 0); /* RF */
7884 - if (flags & ATMEL_SSC_RK)
7885 - select_peripheral(PA(22), PERIPH_A, 0); /* RK */
7886 - if (flags & ATMEL_SSC_TK)
7887 - select_peripheral(PA(23), PERIPH_A, 0); /* TK */
7888 - if (flags & ATMEL_SSC_TF)
7889 - select_peripheral(PA(24), PERIPH_A, 0); /* TF */
7890 - if (flags & ATMEL_SSC_TD)
7891 - select_peripheral(PA(25), PERIPH_A, 0); /* TD */
7892 - if (flags & ATMEL_SSC_RD)
7893 - select_peripheral(PA(26), PERIPH_A, 0); /* RD */
7896 - pdev = &ssc1_device;
7897 - if (flags & ATMEL_SSC_RF)
7898 - select_peripheral(PA(0), PERIPH_B, 0); /* RF */
7899 - if (flags & ATMEL_SSC_RK)
7900 - select_peripheral(PA(1), PERIPH_B, 0); /* RK */
7901 - if (flags & ATMEL_SSC_TK)
7902 - select_peripheral(PA(2), PERIPH_B, 0); /* TK */
7903 - if (flags & ATMEL_SSC_TF)
7904 - select_peripheral(PA(3), PERIPH_B, 0); /* TF */
7905 - if (flags & ATMEL_SSC_TD)
7906 - select_peripheral(PA(4), PERIPH_B, 0); /* TD */
7907 - if (flags & ATMEL_SSC_RD)
7908 - select_peripheral(PA(5), PERIPH_B, 0); /* RD */
7911 - pdev = &ssc2_device;
7912 - if (flags & ATMEL_SSC_TD)
7913 - select_peripheral(PB(13), PERIPH_A, 0); /* TD */
7914 - if (flags & ATMEL_SSC_RD)
7915 - select_peripheral(PB(14), PERIPH_A, 0); /* RD */
7916 - if (flags & ATMEL_SSC_TK)
7917 - select_peripheral(PB(15), PERIPH_A, 0); /* TK */
7918 - if (flags & ATMEL_SSC_TF)
7919 - select_peripheral(PB(16), PERIPH_A, 0); /* TF */
7920 - if (flags & ATMEL_SSC_RF)
7921 - select_peripheral(PB(17), PERIPH_A, 0); /* RF */
7922 - if (flags & ATMEL_SSC_RK)
7923 - select_peripheral(PB(18), PERIPH_A, 0); /* RK */
7929 - platform_device_register(pdev);
7933 -/* --------------------------------------------------------------------
7934 - * USB Device Controller
7935 - * -------------------------------------------------------------------- */
7936 -static struct resource usba0_resource[] __initdata = {
7938 - .start = 0xff300000,
7939 - .end = 0xff3fffff,
7940 - .flags = IORESOURCE_MEM,
7942 - .start = 0xfff03000,
7943 - .end = 0xfff033ff,
7944 - .flags = IORESOURCE_MEM,
7948 -static struct clk usba0_pclk = {
7950 - .parent = &pbb_clk,
7951 - .mode = pbb_clk_mode,
7952 - .get_rate = pbb_clk_get_rate,
7955 -static struct clk usba0_hclk = {
7957 - .parent = &hsb_clk,
7958 - .mode = hsb_clk_mode,
7959 - .get_rate = hsb_clk_get_rate,
7963 -struct platform_device *__init
7964 -at32_add_device_usba(unsigned int id, struct usba_platform_data *data)
7966 - struct platform_device *pdev;
7971 - pdev = platform_device_alloc("atmel_usba_udc", 0);
7975 - if (platform_device_add_resources(pdev, usba0_resource,
7976 - ARRAY_SIZE(usba0_resource)))
7977 - goto out_free_pdev;
7980 - if (platform_device_add_data(pdev, data, sizeof(*data)))
7981 - goto out_free_pdev;
7983 - if (data->vbus_pin != GPIO_PIN_NONE)
7984 - at32_select_gpio(data->vbus_pin, 0);
7987 - usba0_pclk.dev = &pdev->dev;
7988 - usba0_hclk.dev = &pdev->dev;
7990 - platform_device_add(pdev);
7995 - platform_device_put(pdev);
7999 -/* --------------------------------------------------------------------
8000 - * IDE / CompactFlash
8001 - * -------------------------------------------------------------------- */
8002 -static struct resource at32_smc_cs4_resource[] __initdata = {
8004 - .start = 0x04000000,
8005 - .end = 0x07ffffff,
8006 - .flags = IORESOURCE_MEM,
8008 - IRQ(~0UL), /* Magic IRQ will be overridden */
8010 -static struct resource at32_smc_cs5_resource[] __initdata = {
8012 - .start = 0x20000000,
8013 - .end = 0x23ffffff,
8014 - .flags = IORESOURCE_MEM,
8016 - IRQ(~0UL), /* Magic IRQ will be overridden */
8019 -static int __init at32_init_ide_or_cf(struct platform_device *pdev,
8020 - unsigned int cs, unsigned int extint)
8022 - static unsigned int extint_pin_map[4] __initdata = {
8028 - static bool common_pins_initialized __initdata = false;
8029 - unsigned int extint_pin;
8032 - if (extint >= ARRAY_SIZE(extint_pin_map))
8034 - extint_pin = extint_pin_map[extint];
8038 - ret = platform_device_add_resources(pdev,
8039 - at32_smc_cs4_resource,
8040 - ARRAY_SIZE(at32_smc_cs4_resource));
8044 - select_peripheral(PE(21), PERIPH_A, 0); /* NCS4 -> OE_N */
8045 - set_ebi_sfr_bits(HMATRIX_BIT(CS4A));
8048 - ret = platform_device_add_resources(pdev,
8049 - at32_smc_cs5_resource,
8050 - ARRAY_SIZE(at32_smc_cs5_resource));
8054 - select_peripheral(PE(22), PERIPH_A, 0); /* NCS5 -> OE_N */
8055 - set_ebi_sfr_bits(HMATRIX_BIT(CS5A));
8061 - if (!common_pins_initialized) {
8062 - select_peripheral(PE(19), PERIPH_A, 0); /* CFCE1 -> CS0_N */
8063 - select_peripheral(PE(20), PERIPH_A, 0); /* CFCE2 -> CS1_N */
8064 - select_peripheral(PE(23), PERIPH_A, 0); /* CFRNW -> DIR */
8065 - select_peripheral(PE(24), PERIPH_A, 0); /* NWAIT <- IORDY */
8066 - common_pins_initialized = true;
8069 - at32_select_periph(extint_pin, GPIO_PERIPH_A, AT32_GPIOF_DEGLITCH);
8071 - pdev->resource[1].start = EIM_IRQ_BASE + extint;
8072 - pdev->resource[1].end = pdev->resource[1].start;
8077 -struct platform_device *__init
8078 -at32_add_device_ide(unsigned int id, unsigned int extint,
8079 - struct ide_platform_data *data)
8081 - struct platform_device *pdev;
8083 - pdev = platform_device_alloc("at32_ide", id);
8087 - if (platform_device_add_data(pdev, data,
8088 - sizeof(struct ide_platform_data)))
8091 - if (at32_init_ide_or_cf(pdev, data->cs, extint))
8094 - platform_device_add(pdev);
8098 - platform_device_put(pdev);
8102 -struct platform_device *__init
8103 -at32_add_device_cf(unsigned int id, unsigned int extint,
8104 - struct cf_platform_data *data)
8106 - struct platform_device *pdev;
8108 - pdev = platform_device_alloc("at32_cf", id);
8112 - if (platform_device_add_data(pdev, data,
8113 - sizeof(struct cf_platform_data)))
8116 - if (at32_init_ide_or_cf(pdev, data->cs, extint))
8119 - if (data->detect_pin != GPIO_PIN_NONE)
8120 - at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH);
8121 - if (data->reset_pin != GPIO_PIN_NONE)
8122 - at32_select_gpio(data->reset_pin, 0);
8123 - if (data->vcc_pin != GPIO_PIN_NONE)
8124 - at32_select_gpio(data->vcc_pin, 0);
8125 - /* READY is used as extint, so we can't select it as gpio */
8127 - platform_device_add(pdev);
8131 - platform_device_put(pdev);
8135 -/* --------------------------------------------------------------------
8137 - * -------------------------------------------------------------------- */
8138 -static struct resource atmel_ac97c0_resource[] __initdata = {
8139 - PBMEM(0xfff02800),
8142 -static struct clk atmel_ac97c0_pclk = {
8144 - .parent = &pbb_clk,
8145 - .mode = pbb_clk_mode,
8146 - .get_rate = pbb_clk_get_rate,
8150 -struct platform_device *__init at32_add_device_ac97c(unsigned int id)
8152 - struct platform_device *pdev;
8157 - pdev = platform_device_alloc("atmel_ac97c", id);
8161 - if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
8162 - ARRAY_SIZE(atmel_ac97c0_resource)))
8163 - goto err_add_resources;
8165 - select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */
8166 - select_peripheral(PB(21), PERIPH_B, 0); /* SDO */
8167 - select_peripheral(PB(22), PERIPH_B, 0); /* SDI */
8168 - select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */
8170 - atmel_ac97c0_pclk.dev = &pdev->dev;
8172 - platform_device_add(pdev);
8176 - platform_device_put(pdev);
8180 -/* --------------------------------------------------------------------
8182 - * -------------------------------------------------------------------- */
8183 -static struct resource abdac0_resource[] __initdata = {
8184 - PBMEM(0xfff02000),
8187 -static struct clk abdac0_pclk = {
8189 - .parent = &pbb_clk,
8190 - .mode = pbb_clk_mode,
8191 - .get_rate = pbb_clk_get_rate,
8194 -static struct clk abdac0_sample_clk = {
8195 - .name = "sample_clk",
8196 - .mode = genclk_mode,
8197 - .get_rate = genclk_get_rate,
8198 - .set_rate = genclk_set_rate,
8199 - .set_parent = genclk_set_parent,
8203 -struct platform_device *__init at32_add_device_abdac(unsigned int id)
8205 - struct platform_device *pdev;
8210 - pdev = platform_device_alloc("abdac", id);
8214 - if (platform_device_add_resources(pdev, abdac0_resource,
8215 - ARRAY_SIZE(abdac0_resource)))
8216 - goto err_add_resources;
8218 - select_peripheral(PB(20), PERIPH_A, 0); /* DATA1 */
8219 - select_peripheral(PB(21), PERIPH_A, 0); /* DATA0 */
8220 - select_peripheral(PB(22), PERIPH_A, 0); /* DATAN1 */
8221 - select_peripheral(PB(23), PERIPH_A, 0); /* DATAN0 */
8223 - abdac0_pclk.dev = &pdev->dev;
8224 - abdac0_sample_clk.dev = &pdev->dev;
8226 - platform_device_add(pdev);
8230 - platform_device_put(pdev);
8234 -/* --------------------------------------------------------------------
8236 - * -------------------------------------------------------------------- */
8237 -static struct clk gclk0 = {
8239 - .mode = genclk_mode,
8240 - .get_rate = genclk_get_rate,
8241 - .set_rate = genclk_set_rate,
8242 - .set_parent = genclk_set_parent,
8245 -static struct clk gclk1 = {
8247 - .mode = genclk_mode,
8248 - .get_rate = genclk_get_rate,
8249 - .set_rate = genclk_set_rate,
8250 - .set_parent = genclk_set_parent,
8253 -static struct clk gclk2 = {
8255 - .mode = genclk_mode,
8256 - .get_rate = genclk_get_rate,
8257 - .set_rate = genclk_set_rate,
8258 - .set_parent = genclk_set_parent,
8261 -static struct clk gclk3 = {
8263 - .mode = genclk_mode,
8264 - .get_rate = genclk_get_rate,
8265 - .set_rate = genclk_set_rate,
8266 - .set_parent = genclk_set_parent,
8269 -static struct clk gclk4 = {
8271 - .mode = genclk_mode,
8272 - .get_rate = genclk_get_rate,
8273 - .set_rate = genclk_set_rate,
8274 - .set_parent = genclk_set_parent,
8278 -struct clk *at32_clock_list[] = {
8304 - &at32_systc0_pclk,
8305 - &atmel_usart0_usart,
8306 - &atmel_usart1_usart,
8307 - &atmel_usart2_usart,
8308 - &atmel_usart3_usart,
8313 - &atmel_spi0_spi_clk,
8314 - &atmel_spi1_spi_clk,
8317 - &atmel_lcdfb0_hck1,
8318 - &atmel_lcdfb0_pixclk,
8324 - &atmel_ac97c0_pclk,
8326 - &abdac0_sample_clk,
8333 -unsigned int at32_nr_clocks = ARRAY_SIZE(at32_clock_list);
8335 -void __init at32_portmux_init(void)
8337 - at32_init_pio(&pio0_device);
8338 - at32_init_pio(&pio1_device);
8339 - at32_init_pio(&pio2_device);
8340 - at32_init_pio(&pio3_device);
8341 - at32_init_pio(&pio4_device);
8344 -void __init at32_clock_init(void)
8346 - u32 cpu_mask = 0, hsb_mask = 0, pba_mask = 0, pbb_mask = 0;
8349 - if (pm_readl(MCCTRL) & PM_BIT(PLLSEL)) {
8350 - main_clock = &pll0;
8351 - cpu_clk.parent = &pll0;
8353 - main_clock = &osc0;
8354 - cpu_clk.parent = &osc0;
8357 - if (pm_readl(PLL0) & PM_BIT(PLLOSC))
8358 - pll0.parent = &osc1;
8359 - if (pm_readl(PLL1) & PM_BIT(PLLOSC))
8360 - pll1.parent = &osc1;
8362 - genclk_init_parent(&gclk0);
8363 - genclk_init_parent(&gclk1);
8364 - genclk_init_parent(&gclk2);
8365 - genclk_init_parent(&gclk3);
8366 - genclk_init_parent(&gclk4);
8367 - genclk_init_parent(&atmel_lcdfb0_pixclk);
8368 - genclk_init_parent(&abdac0_sample_clk);
8371 - * Turn on all clocks that have at least one user already, and
8372 - * turn off everything else. We only do this for module
8373 - * clocks, and even though it isn't particularly pretty to
8374 - * check the address of the mode function, it should do the
8377 - for (i = 0; i < ARRAY_SIZE(at32_clock_list); i++) {
8378 - struct clk *clk = at32_clock_list[i];
8380 - if (clk->users == 0)
8383 - if (clk->mode == &cpu_clk_mode)
8384 - cpu_mask |= 1 << clk->index;
8385 - else if (clk->mode == &hsb_clk_mode)
8386 - hsb_mask |= 1 << clk->index;
8387 - else if (clk->mode == &pba_clk_mode)
8388 - pba_mask |= 1 << clk->index;
8389 - else if (clk->mode == &pbb_clk_mode)
8390 - pbb_mask |= 1 << clk->index;
8393 - pm_writel(CPU_MASK, cpu_mask);
8394 - pm_writel(HSB_MASK, hsb_mask);
8395 - pm_writel(PBA_MASK, pba_mask);
8396 - pm_writel(PBB_MASK, pbb_mask);
8398 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/at32ap700x.c avr32-2.6/arch/avr32/mach-at32ap/at32ap700x.c
8399 --- linux-2.6.24.3/arch/avr32/mach-at32ap/at32ap700x.c 1970-01-01 01:00:00.000000000 +0100
8400 +++ avr32-2.6/arch/avr32/mach-at32ap/at32ap700x.c 2008-04-23 20:12:35.000000000 +0200
8403 + * Copyright (C) 2005-2006 Atmel Corporation
8405 + * This program is free software; you can redistribute it and/or modify
8406 + * it under the terms of the GNU General Public License version 2 as
8407 + * published by the Free Software Foundation.
8409 +#include <linux/clk.h>
8410 +#include <linux/fb.h>
8411 +#include <linux/init.h>
8412 +#include <linux/platform_device.h>
8413 +#include <linux/dma-mapping.h>
8414 +#include <linux/spi/spi.h>
8415 +#include <linux/usb/atmel_usba_udc.h>
8417 +#include <asm/io.h>
8418 +#include <asm/irq.h>
8420 +#include <asm/arch/at32ap700x.h>
8421 +#include <asm/arch/board.h>
8422 +#include <asm/arch/portmux.h>
8424 +#include <video/atmel_lcdc.h>
8427 +#include "hmatrix.h"
8432 +#define PBMEM(base) \
8435 + .end = base + 0x3ff, \
8436 + .flags = IORESOURCE_MEM, \
8442 + .flags = IORESOURCE_IRQ, \
8444 +#define NAMED_IRQ(num, _name) \
8449 + .flags = IORESOURCE_IRQ, \
8452 +/* REVISIT these assume *every* device supports DMA, but several
8453 + * don't ... tc, smc, pio, rtc, watchdog, pwm, ps2, and more.
8455 +#define DEFINE_DEV(_name, _id) \
8456 +static u64 _name##_id##_dma_mask = DMA_32BIT_MASK; \
8457 +static struct platform_device _name##_id##_device = { \
8461 + .dma_mask = &_name##_id##_dma_mask, \
8462 + .coherent_dma_mask = DMA_32BIT_MASK, \
8464 + .resource = _name##_id##_resource, \
8465 + .num_resources = ARRAY_SIZE(_name##_id##_resource), \
8467 +#define DEFINE_DEV_DATA(_name, _id) \
8468 +static u64 _name##_id##_dma_mask = DMA_32BIT_MASK; \
8469 +static struct platform_device _name##_id##_device = { \
8473 + .dma_mask = &_name##_id##_dma_mask, \
8474 + .platform_data = &_name##_id##_data, \
8475 + .coherent_dma_mask = DMA_32BIT_MASK, \
8477 + .resource = _name##_id##_resource, \
8478 + .num_resources = ARRAY_SIZE(_name##_id##_resource), \
8481 +#define select_peripheral(pin, periph, flags) \
8482 + at32_select_periph(GPIO_PIN_##pin, GPIO_##periph, flags)
8484 +#define DEV_CLK(_name, devname, bus, _index) \
8485 +static struct clk devname##_##_name = { \
8487 + .dev = &devname##_device.dev, \
8488 + .parent = &bus##_clk, \
8489 + .mode = bus##_clk_mode, \
8490 + .get_rate = bus##_clk_get_rate, \
8491 + .index = _index, \
8494 +static DEFINE_SPINLOCK(pm_lock);
8496 +unsigned long at32ap7000_osc_rates[3] = {
8498 + /* FIXME: these are ATSTK1002-specific */
8503 +static unsigned long osc_get_rate(struct clk *clk)
8505 + return at32ap7000_osc_rates[clk->index];
8508 +static unsigned long pll_get_rate(struct clk *clk, unsigned long control)
8510 + unsigned long div, mul, rate;
8512 + if (!(control & PM_BIT(PLLEN)))
8515 + div = PM_BFEXT(PLLDIV, control) + 1;
8516 + mul = PM_BFEXT(PLLMUL, control) + 1;
8518 + rate = clk->parent->get_rate(clk->parent);
8519 + rate = (rate + div / 2) / div;
8525 +static unsigned long pll0_get_rate(struct clk *clk)
8529 + control = pm_readl(PLL0);
8531 + return pll_get_rate(clk, control);
8534 +static unsigned long pll1_get_rate(struct clk *clk)
8538 + control = pm_readl(PLL1);
8540 + return pll_get_rate(clk, control);
8544 + * The AT32AP7000 has five primary clock sources: One 32kHz
8545 + * oscillator, two crystal oscillators and two PLLs.
8547 +static struct clk osc32k = {
8549 + .get_rate = osc_get_rate,
8553 +static struct clk osc0 = {
8555 + .get_rate = osc_get_rate,
8559 +static struct clk osc1 = {
8561 + .get_rate = osc_get_rate,
8564 +static struct clk pll0 = {
8566 + .get_rate = pll0_get_rate,
8569 +static struct clk pll1 = {
8571 + .get_rate = pll1_get_rate,
8576 + * The main clock can be either osc0 or pll0. The boot loader may
8577 + * have chosen one for us, so we don't really know which one until we
8578 + * have a look at the SM.
8580 +static struct clk *main_clock;
8583 + * Synchronous clocks are generated from the main clock. The clocks
8584 + * must satisfy the constraint
8585 + * fCPU >= fHSB >= fPB
8586 + * i.e. each clock must not be faster than its parent.
8588 +static unsigned long bus_clk_get_rate(struct clk *clk, unsigned int shift)
8590 + return main_clock->get_rate(main_clock) >> shift;
8593 +static void cpu_clk_mode(struct clk *clk, int enabled)
8595 + unsigned long flags;
8598 + spin_lock_irqsave(&pm_lock, flags);
8599 + mask = pm_readl(CPU_MASK);
8601 + mask |= 1 << clk->index;
8603 + mask &= ~(1 << clk->index);
8604 + pm_writel(CPU_MASK, mask);
8605 + spin_unlock_irqrestore(&pm_lock, flags);
8608 +static unsigned long cpu_clk_get_rate(struct clk *clk)
8610 + unsigned long cksel, shift = 0;
8612 + cksel = pm_readl(CKSEL);
8613 + if (cksel & PM_BIT(CPUDIV))
8614 + shift = PM_BFEXT(CPUSEL, cksel) + 1;
8616 + return bus_clk_get_rate(clk, shift);
8619 +static long cpu_clk_set_rate(struct clk *clk, unsigned long rate, int apply)
8622 + unsigned long parent_rate, child_div, actual_rate, div;
8624 + parent_rate = clk->parent->get_rate(clk->parent);
8625 + control = pm_readl(CKSEL);
8627 + if (control & PM_BIT(HSBDIV))
8628 + child_div = 1 << (PM_BFEXT(HSBSEL, control) + 1);
8632 + if (rate > 3 * (parent_rate / 4) || child_div == 1) {
8633 + actual_rate = parent_rate;
8634 + control &= ~PM_BIT(CPUDIV);
8636 + unsigned int cpusel;
8637 + div = (parent_rate + rate / 2) / rate;
8638 + if (div > child_div)
8640 + cpusel = (div > 1) ? (fls(div) - 2) : 0;
8641 + control = PM_BIT(CPUDIV) | PM_BFINS(CPUSEL, cpusel, control);
8642 + actual_rate = parent_rate / (1 << (cpusel + 1));
8645 + pr_debug("clk %s: new rate %lu (actual rate %lu)\n",
8646 + clk->name, rate, actual_rate);
8649 + pm_writel(CKSEL, control);
8651 + return actual_rate;
8654 +static void hsb_clk_mode(struct clk *clk, int enabled)
8656 + unsigned long flags;
8659 + spin_lock_irqsave(&pm_lock, flags);
8660 + mask = pm_readl(HSB_MASK);
8662 + mask |= 1 << clk->index;
8664 + mask &= ~(1 << clk->index);
8665 + pm_writel(HSB_MASK, mask);
8666 + spin_unlock_irqrestore(&pm_lock, flags);
8669 +static unsigned long hsb_clk_get_rate(struct clk *clk)
8671 + unsigned long cksel, shift = 0;
8673 + cksel = pm_readl(CKSEL);
8674 + if (cksel & PM_BIT(HSBDIV))
8675 + shift = PM_BFEXT(HSBSEL, cksel) + 1;
8677 + return bus_clk_get_rate(clk, shift);
8680 +static void pba_clk_mode(struct clk *clk, int enabled)
8682 + unsigned long flags;
8685 + spin_lock_irqsave(&pm_lock, flags);
8686 + mask = pm_readl(PBA_MASK);
8688 + mask |= 1 << clk->index;
8690 + mask &= ~(1 << clk->index);
8691 + pm_writel(PBA_MASK, mask);
8692 + spin_unlock_irqrestore(&pm_lock, flags);
8695 +static unsigned long pba_clk_get_rate(struct clk *clk)
8697 + unsigned long cksel, shift = 0;
8699 + cksel = pm_readl(CKSEL);
8700 + if (cksel & PM_BIT(PBADIV))
8701 + shift = PM_BFEXT(PBASEL, cksel) + 1;
8703 + return bus_clk_get_rate(clk, shift);
8706 +static void pbb_clk_mode(struct clk *clk, int enabled)
8708 + unsigned long flags;
8711 + spin_lock_irqsave(&pm_lock, flags);
8712 + mask = pm_readl(PBB_MASK);
8714 + mask |= 1 << clk->index;
8716 + mask &= ~(1 << clk->index);
8717 + pm_writel(PBB_MASK, mask);
8718 + spin_unlock_irqrestore(&pm_lock, flags);
8721 +static unsigned long pbb_clk_get_rate(struct clk *clk)
8723 + unsigned long cksel, shift = 0;
8725 + cksel = pm_readl(CKSEL);
8726 + if (cksel & PM_BIT(PBBDIV))
8727 + shift = PM_BFEXT(PBBSEL, cksel) + 1;
8729 + return bus_clk_get_rate(clk, shift);
8732 +static struct clk cpu_clk = {
8734 + .get_rate = cpu_clk_get_rate,
8735 + .set_rate = cpu_clk_set_rate,
8738 +static struct clk hsb_clk = {
8740 + .parent = &cpu_clk,
8741 + .get_rate = hsb_clk_get_rate,
8743 +static struct clk pba_clk = {
8745 + .parent = &hsb_clk,
8746 + .mode = hsb_clk_mode,
8747 + .get_rate = pba_clk_get_rate,
8750 +static struct clk pbb_clk = {
8752 + .parent = &hsb_clk,
8753 + .mode = hsb_clk_mode,
8754 + .get_rate = pbb_clk_get_rate,
8759 +/* --------------------------------------------------------------------
8760 + * Generic Clock operations
8761 + * -------------------------------------------------------------------- */
8763 +static void genclk_mode(struct clk *clk, int enabled)
8767 + control = pm_readl(GCCTRL(clk->index));
8769 + control |= PM_BIT(CEN);
8771 + control &= ~PM_BIT(CEN);
8772 + pm_writel(GCCTRL(clk->index), control);
8775 +static unsigned long genclk_get_rate(struct clk *clk)
8778 + unsigned long div = 1;
8780 + control = pm_readl(GCCTRL(clk->index));
8781 + if (control & PM_BIT(DIVEN))
8782 + div = 2 * (PM_BFEXT(DIV, control) + 1);
8784 + return clk->parent->get_rate(clk->parent) / div;
8787 +static long genclk_set_rate(struct clk *clk, unsigned long rate, int apply)
8790 + unsigned long parent_rate, actual_rate, div;
8792 + parent_rate = clk->parent->get_rate(clk->parent);
8793 + control = pm_readl(GCCTRL(clk->index));
8795 + if (rate > 3 * parent_rate / 4) {
8796 + actual_rate = parent_rate;
8797 + control &= ~PM_BIT(DIVEN);
8799 + div = (parent_rate + rate) / (2 * rate) - 1;
8800 + control = PM_BFINS(DIV, div, control) | PM_BIT(DIVEN);
8801 + actual_rate = parent_rate / (2 * (div + 1));
8804 + dev_dbg(clk->dev, "clk %s: new rate %lu (actual rate %lu)\n",
8805 + clk->name, rate, actual_rate);
8808 + pm_writel(GCCTRL(clk->index), control);
8810 + return actual_rate;
8813 +int genclk_set_parent(struct clk *clk, struct clk *parent)
8817 + dev_dbg(clk->dev, "clk %s: new parent %s (was %s)\n",
8818 + clk->name, parent->name, clk->parent->name);
8820 + control = pm_readl(GCCTRL(clk->index));
8822 + if (parent == &osc1 || parent == &pll1)
8823 + control |= PM_BIT(OSCSEL);
8824 + else if (parent == &osc0 || parent == &pll0)
8825 + control &= ~PM_BIT(OSCSEL);
8829 + if (parent == &pll0 || parent == &pll1)
8830 + control |= PM_BIT(PLLSEL);
8832 + control &= ~PM_BIT(PLLSEL);
8834 + pm_writel(GCCTRL(clk->index), control);
8835 + clk->parent = parent;
8840 +static void __init genclk_init_parent(struct clk *clk)
8843 + struct clk *parent;
8845 + BUG_ON(clk->index > 7);
8847 + control = pm_readl(GCCTRL(clk->index));
8848 + if (control & PM_BIT(OSCSEL))
8849 + parent = (control & PM_BIT(PLLSEL)) ? &pll1 : &osc1;
8851 + parent = (control & PM_BIT(PLLSEL)) ? &pll0 : &osc0;
8853 + clk->parent = parent;
8856 +/* --------------------------------------------------------------------
8857 + * System peripherals
8858 + * -------------------------------------------------------------------- */
8859 +static struct resource at32_pm0_resource[] = {
8861 + .start = 0xfff00000,
8862 + .end = 0xfff0007f,
8863 + .flags = IORESOURCE_MEM,
8868 +static struct resource at32ap700x_rtc0_resource[] = {
8870 + .start = 0xfff00080,
8871 + .end = 0xfff000af,
8872 + .flags = IORESOURCE_MEM,
8877 +static struct resource at32_wdt0_resource[] = {
8879 + .start = 0xfff000b0,
8880 + .end = 0xfff000cf,
8881 + .flags = IORESOURCE_MEM,
8885 +static struct resource at32_eic0_resource[] = {
8887 + .start = 0xfff00100,
8888 + .end = 0xfff0013f,
8889 + .flags = IORESOURCE_MEM,
8894 +DEFINE_DEV(at32_pm, 0);
8895 +DEFINE_DEV(at32ap700x_rtc, 0);
8896 +DEFINE_DEV(at32_wdt, 0);
8897 +DEFINE_DEV(at32_eic, 0);
8900 + * Peripheral clock for PM, RTC, WDT and EIC. PM will ensure that this
8901 + * is always running.
8903 +static struct clk at32_pm_pclk = {
8905 + .dev = &at32_pm0_device.dev,
8906 + .parent = &pbb_clk,
8907 + .mode = pbb_clk_mode,
8908 + .get_rate = pbb_clk_get_rate,
8913 +static struct resource intc0_resource[] = {
8914 + PBMEM(0xfff00400),
8916 +struct platform_device at32_intc0_device = {
8919 + .resource = intc0_resource,
8920 + .num_resources = ARRAY_SIZE(intc0_resource),
8922 +DEV_CLK(pclk, at32_intc0, pbb, 1);
8924 +static struct clk ebi_clk = {
8926 + .parent = &hsb_clk,
8927 + .mode = hsb_clk_mode,
8928 + .get_rate = hsb_clk_get_rate,
8931 +static struct clk hramc_clk = {
8933 + .parent = &hsb_clk,
8934 + .mode = hsb_clk_mode,
8935 + .get_rate = hsb_clk_get_rate,
8940 +static struct resource smc0_resource[] = {
8941 + PBMEM(0xfff03400),
8943 +DEFINE_DEV(smc, 0);
8944 +DEV_CLK(pclk, smc0, pbb, 13);
8945 +DEV_CLK(mck, smc0, hsb, 0);
8947 +static struct platform_device pdc_device = {
8951 +DEV_CLK(hclk, pdc, hsb, 4);
8952 +DEV_CLK(pclk, pdc, pba, 16);
8954 +static struct clk pico_clk = {
8956 + .parent = &cpu_clk,
8957 + .mode = cpu_clk_mode,
8958 + .get_rate = cpu_clk_get_rate,
8962 +static struct resource dmaca0_resource[] = {
8964 + .start = 0xff200000,
8965 + .end = 0xff20ffff,
8966 + .flags = IORESOURCE_MEM,
8970 +DEFINE_DEV(dmaca, 0);
8971 +DEV_CLK(hclk, dmaca0, hsb, 10);
8973 +/* --------------------------------------------------------------------
8975 + * -------------------------------------------------------------------- */
8977 +static struct clk hmatrix_clk = {
8978 + .name = "hmatrix_clk",
8979 + .parent = &pbb_clk,
8980 + .mode = pbb_clk_mode,
8981 + .get_rate = pbb_clk_get_rate,
8985 +#define HMATRIX_BASE ((void __iomem *)0xfff00800)
8987 +#define hmatrix_readl(reg) \
8988 + __raw_readl((HMATRIX_BASE) + HMATRIX_##reg)
8989 +#define hmatrix_writel(reg,value) \
8990 + __raw_writel((value), (HMATRIX_BASE) + HMATRIX_##reg)
8993 + * Set bits in the HMATRIX Special Function Register (SFR) used by the
8994 + * External Bus Interface (EBI). This can be used to enable special
8995 + * features like CompactFlash support, NAND Flash support, etc. on
8996 + * certain chipselects.
8998 +static inline void set_ebi_sfr_bits(u32 mask)
9002 + clk_enable(&hmatrix_clk);
9003 + sfr = hmatrix_readl(SFR4);
9005 + hmatrix_writel(SFR4, sfr);
9006 + clk_disable(&hmatrix_clk);
9009 +/* --------------------------------------------------------------------
9010 + * Timer/Counter (TC)
9011 + * -------------------------------------------------------------------- */
9013 +static struct resource at32_tcb0_resource[] = {
9014 + PBMEM(0xfff00c00),
9017 +static struct platform_device at32_tcb0_device = {
9018 + .name = "atmel_tcb",
9020 + .resource = at32_tcb0_resource,
9021 + .num_resources = ARRAY_SIZE(at32_tcb0_resource),
9023 +DEV_CLK(t0_clk, at32_tcb0, pbb, 3);
9025 +static struct resource at32_tcb1_resource[] = {
9026 + PBMEM(0xfff01000),
9029 +static struct platform_device at32_tcb1_device = {
9030 + .name = "atmel_tcb",
9032 + .resource = at32_tcb1_resource,
9033 + .num_resources = ARRAY_SIZE(at32_tcb1_resource),
9035 +DEV_CLK(t0_clk, at32_tcb1, pbb, 4);
9037 +/* --------------------------------------------------------------------
9039 + * -------------------------------------------------------------------- */
9041 +static struct resource pio0_resource[] = {
9042 + PBMEM(0xffe02800),
9045 +DEFINE_DEV(pio, 0);
9046 +DEV_CLK(mck, pio0, pba, 10);
9048 +static struct resource pio1_resource[] = {
9049 + PBMEM(0xffe02c00),
9052 +DEFINE_DEV(pio, 1);
9053 +DEV_CLK(mck, pio1, pba, 11);
9055 +static struct resource pio2_resource[] = {
9056 + PBMEM(0xffe03000),
9059 +DEFINE_DEV(pio, 2);
9060 +DEV_CLK(mck, pio2, pba, 12);
9062 +static struct resource pio3_resource[] = {
9063 + PBMEM(0xffe03400),
9066 +DEFINE_DEV(pio, 3);
9067 +DEV_CLK(mck, pio3, pba, 13);
9069 +static struct resource pio4_resource[] = {
9070 + PBMEM(0xffe03800),
9073 +DEFINE_DEV(pio, 4);
9074 +DEV_CLK(mck, pio4, pba, 14);
9076 +void __init at32_add_system_devices(void)
9078 + platform_device_register(&at32_pm0_device);
9079 + platform_device_register(&at32_intc0_device);
9080 + platform_device_register(&at32ap700x_rtc0_device);
9081 + platform_device_register(&at32_wdt0_device);
9082 + platform_device_register(&at32_eic0_device);
9083 + platform_device_register(&smc0_device);
9084 + platform_device_register(&pdc_device);
9085 + platform_device_register(&dmaca0_device);
9087 + platform_device_register(&at32_tcb0_device);
9088 + platform_device_register(&at32_tcb1_device);
9090 + platform_device_register(&pio0_device);
9091 + platform_device_register(&pio1_device);
9092 + platform_device_register(&pio2_device);
9093 + platform_device_register(&pio3_device);
9094 + platform_device_register(&pio4_device);
9097 +/* --------------------------------------------------------------------
9099 + * -------------------------------------------------------------------- */
9100 +static struct resource atmel_psif0_resource[] __initdata = {
9102 + .start = 0xffe03c00,
9103 + .end = 0xffe03cff,
9104 + .flags = IORESOURCE_MEM,
9108 +static struct clk atmel_psif0_pclk = {
9110 + .parent = &pba_clk,
9111 + .mode = pba_clk_mode,
9112 + .get_rate = pba_clk_get_rate,
9116 +static struct resource atmel_psif1_resource[] __initdata = {
9118 + .start = 0xffe03d00,
9119 + .end = 0xffe03dff,
9120 + .flags = IORESOURCE_MEM,
9124 +static struct clk atmel_psif1_pclk = {
9126 + .parent = &pba_clk,
9127 + .mode = pba_clk_mode,
9128 + .get_rate = pba_clk_get_rate,
9132 +struct platform_device *__init at32_add_device_psif(unsigned int id)
9134 + struct platform_device *pdev;
9136 + if (!(id == 0 || id == 1))
9139 + pdev = platform_device_alloc("atmel_psif", id);
9145 + if (platform_device_add_resources(pdev, atmel_psif0_resource,
9146 + ARRAY_SIZE(atmel_psif0_resource)))
9147 + goto err_add_resources;
9148 + atmel_psif0_pclk.dev = &pdev->dev;
9149 + select_peripheral(PA(8), PERIPH_A, 0); /* CLOCK */
9150 + select_peripheral(PA(9), PERIPH_A, 0); /* DATA */
9153 + if (platform_device_add_resources(pdev, atmel_psif1_resource,
9154 + ARRAY_SIZE(atmel_psif1_resource)))
9155 + goto err_add_resources;
9156 + atmel_psif1_pclk.dev = &pdev->dev;
9157 + select_peripheral(PB(11), PERIPH_A, 0); /* CLOCK */
9158 + select_peripheral(PB(12), PERIPH_A, 0); /* DATA */
9164 + platform_device_add(pdev);
9168 + platform_device_put(pdev);
9172 +/* --------------------------------------------------------------------
9174 + * -------------------------------------------------------------------- */
9176 +static struct atmel_uart_data atmel_usart0_data = {
9180 +static struct resource atmel_usart0_resource[] = {
9181 + PBMEM(0xffe00c00),
9184 +DEFINE_DEV_DATA(atmel_usart, 0);
9185 +DEV_CLK(usart, atmel_usart0, pba, 3);
9187 +static struct atmel_uart_data atmel_usart1_data = {
9191 +static struct resource atmel_usart1_resource[] = {
9192 + PBMEM(0xffe01000),
9195 +DEFINE_DEV_DATA(atmel_usart, 1);
9196 +DEV_CLK(usart, atmel_usart1, pba, 4);
9198 +static struct atmel_uart_data atmel_usart2_data = {
9202 +static struct resource atmel_usart2_resource[] = {
9203 + PBMEM(0xffe01400),
9206 +DEFINE_DEV_DATA(atmel_usart, 2);
9207 +DEV_CLK(usart, atmel_usart2, pba, 5);
9209 +static struct atmel_uart_data atmel_usart3_data = {
9213 +static struct resource atmel_usart3_resource[] = {
9214 + PBMEM(0xffe01800),
9217 +DEFINE_DEV_DATA(atmel_usart, 3);
9218 +DEV_CLK(usart, atmel_usart3, pba, 6);
9220 +static inline void configure_usart0_pins(void)
9222 + select_peripheral(PA(8), PERIPH_B, 0); /* RXD */
9223 + select_peripheral(PA(9), PERIPH_B, 0); /* TXD */
9226 +static inline void configure_usart1_pins(void)
9228 + select_peripheral(PA(17), PERIPH_A, 0); /* RXD */
9229 + select_peripheral(PA(18), PERIPH_A, 0); /* TXD */
9232 +static inline void configure_usart2_pins(void)
9234 + select_peripheral(PB(26), PERIPH_B, 0); /* RXD */
9235 + select_peripheral(PB(27), PERIPH_B, 0); /* TXD */
9238 +static inline void configure_usart3_pins(void)
9240 + select_peripheral(PB(18), PERIPH_B, 0); /* RXD */
9241 + select_peripheral(PB(17), PERIPH_B, 0); /* TXD */
9244 +static struct platform_device *__initdata at32_usarts[4];
9246 +void __init at32_map_usart(unsigned int hw_id, unsigned int line)
9248 + struct platform_device *pdev;
9252 + pdev = &atmel_usart0_device;
9253 + configure_usart0_pins();
9256 + pdev = &atmel_usart1_device;
9257 + configure_usart1_pins();
9260 + pdev = &atmel_usart2_device;
9261 + configure_usart2_pins();
9264 + pdev = &atmel_usart3_device;
9265 + configure_usart3_pins();
9271 + if (PXSEG(pdev->resource[0].start) == P4SEG) {
9272 + /* Addresses in the P4 segment are permanently mapped 1:1 */
9273 + struct atmel_uart_data *data = pdev->dev.platform_data;
9274 + data->regs = (void __iomem *)pdev->resource[0].start;
9278 + at32_usarts[line] = pdev;
9281 +struct platform_device *__init at32_add_device_usart(unsigned int id)
9283 + platform_device_register(at32_usarts[id]);
9284 + return at32_usarts[id];
9287 +struct platform_device *atmel_default_console_device;
9289 +void __init at32_setup_serial_console(unsigned int usart_id)
9291 + atmel_default_console_device = at32_usarts[usart_id];
9294 +/* --------------------------------------------------------------------
9296 + * -------------------------------------------------------------------- */
9298 +#ifdef CONFIG_CPU_AT32AP7000
9299 +static struct eth_platform_data macb0_data;
9300 +static struct resource macb0_resource[] = {
9301 + PBMEM(0xfff01800),
9304 +DEFINE_DEV_DATA(macb, 0);
9305 +DEV_CLK(hclk, macb0, hsb, 8);
9306 +DEV_CLK(pclk, macb0, pbb, 6);
9308 +static struct eth_platform_data macb1_data;
9309 +static struct resource macb1_resource[] = {
9310 + PBMEM(0xfff01c00),
9313 +DEFINE_DEV_DATA(macb, 1);
9314 +DEV_CLK(hclk, macb1, hsb, 9);
9315 +DEV_CLK(pclk, macb1, pbb, 7);
9317 +struct platform_device *__init
9318 +at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
9320 + struct platform_device *pdev;
9324 + pdev = &macb0_device;
9326 + select_peripheral(PC(3), PERIPH_A, 0); /* TXD0 */
9327 + select_peripheral(PC(4), PERIPH_A, 0); /* TXD1 */
9328 + select_peripheral(PC(7), PERIPH_A, 0); /* TXEN */
9329 + select_peripheral(PC(8), PERIPH_A, 0); /* TXCK */
9330 + select_peripheral(PC(9), PERIPH_A, 0); /* RXD0 */
9331 + select_peripheral(PC(10), PERIPH_A, 0); /* RXD1 */
9332 + select_peripheral(PC(13), PERIPH_A, 0); /* RXER */
9333 + select_peripheral(PC(15), PERIPH_A, 0); /* RXDV */
9334 + select_peripheral(PC(16), PERIPH_A, 0); /* MDC */
9335 + select_peripheral(PC(17), PERIPH_A, 0); /* MDIO */
9337 + if (!data->is_rmii) {
9338 + select_peripheral(PC(0), PERIPH_A, 0); /* COL */
9339 + select_peripheral(PC(1), PERIPH_A, 0); /* CRS */
9340 + select_peripheral(PC(2), PERIPH_A, 0); /* TXER */
9341 + select_peripheral(PC(5), PERIPH_A, 0); /* TXD2 */
9342 + select_peripheral(PC(6), PERIPH_A, 0); /* TXD3 */
9343 + select_peripheral(PC(11), PERIPH_A, 0); /* RXD2 */
9344 + select_peripheral(PC(12), PERIPH_A, 0); /* RXD3 */
9345 + select_peripheral(PC(14), PERIPH_A, 0); /* RXCK */
9346 + select_peripheral(PC(18), PERIPH_A, 0); /* SPD */
9351 + pdev = &macb1_device;
9353 + select_peripheral(PD(13), PERIPH_B, 0); /* TXD0 */
9354 + select_peripheral(PD(14), PERIPH_B, 0); /* TXD1 */
9355 + select_peripheral(PD(11), PERIPH_B, 0); /* TXEN */
9356 + select_peripheral(PD(12), PERIPH_B, 0); /* TXCK */
9357 + select_peripheral(PD(10), PERIPH_B, 0); /* RXD0 */
9358 + select_peripheral(PD(6), PERIPH_B, 0); /* RXD1 */
9359 + select_peripheral(PD(5), PERIPH_B, 0); /* RXER */
9360 + select_peripheral(PD(4), PERIPH_B, 0); /* RXDV */
9361 + select_peripheral(PD(3), PERIPH_B, 0); /* MDC */
9362 + select_peripheral(PD(2), PERIPH_B, 0); /* MDIO */
9364 + if (!data->is_rmii) {
9365 + select_peripheral(PC(19), PERIPH_B, 0); /* COL */
9366 + select_peripheral(PC(23), PERIPH_B, 0); /* CRS */
9367 + select_peripheral(PC(26), PERIPH_B, 0); /* TXER */
9368 + select_peripheral(PC(27), PERIPH_B, 0); /* TXD2 */
9369 + select_peripheral(PC(28), PERIPH_B, 0); /* TXD3 */
9370 + select_peripheral(PC(29), PERIPH_B, 0); /* RXD2 */
9371 + select_peripheral(PC(30), PERIPH_B, 0); /* RXD3 */
9372 + select_peripheral(PC(24), PERIPH_B, 0); /* RXCK */
9373 + select_peripheral(PD(15), PERIPH_B, 0); /* SPD */
9381 + memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data));
9382 + platform_device_register(pdev);
9388 +/* --------------------------------------------------------------------
9390 + * -------------------------------------------------------------------- */
9391 +static struct resource atmel_spi0_resource[] = {
9392 + PBMEM(0xffe00000),
9395 +DEFINE_DEV(atmel_spi, 0);
9396 +DEV_CLK(spi_clk, atmel_spi0, pba, 0);
9398 +static struct resource atmel_spi1_resource[] = {
9399 + PBMEM(0xffe00400),
9402 +DEFINE_DEV(atmel_spi, 1);
9403 +DEV_CLK(spi_clk, atmel_spi1, pba, 1);
9406 +at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b,
9407 + unsigned int n, const u8 *pins)
9409 + unsigned int pin, mode;
9411 + for (; n; n--, b++) {
9412 + b->bus_num = bus_num;
9413 + if (b->chip_select >= 4)
9415 + pin = (unsigned)b->controller_data;
9417 + pin = pins[b->chip_select];
9418 + b->controller_data = (void *)pin;
9420 + mode = AT32_GPIOF_OUTPUT;
9421 + if (!(b->mode & SPI_CS_HIGH))
9422 + mode |= AT32_GPIOF_HIGH;
9423 + at32_select_gpio(pin, mode);
9427 +struct platform_device *__init
9428 +at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n)
9431 + * Manage the chipselects as GPIOs, normally using the same pins
9432 + * the SPI controller expects; but boards can use other pins.
9434 + static u8 __initdata spi0_pins[] =
9435 + { GPIO_PIN_PA(3), GPIO_PIN_PA(4),
9436 + GPIO_PIN_PA(5), GPIO_PIN_PA(20), };
9437 + static u8 __initdata spi1_pins[] =
9438 + { GPIO_PIN_PB(2), GPIO_PIN_PB(3),
9439 + GPIO_PIN_PB(4), GPIO_PIN_PA(27), };
9440 + struct platform_device *pdev;
9444 + pdev = &atmel_spi0_device;
9445 + select_peripheral(PA(0), PERIPH_A, 0); /* MISO */
9446 + select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */
9447 + select_peripheral(PA(2), PERIPH_A, 0); /* SCK */
9448 + at32_spi_setup_slaves(0, b, n, spi0_pins);
9452 + pdev = &atmel_spi1_device;
9453 + select_peripheral(PB(0), PERIPH_B, 0); /* MISO */
9454 + select_peripheral(PB(1), PERIPH_B, 0); /* MOSI */
9455 + select_peripheral(PB(5), PERIPH_B, 0); /* SCK */
9456 + at32_spi_setup_slaves(1, b, n, spi1_pins);
9463 + spi_register_board_info(b, n);
9464 + platform_device_register(pdev);
9468 +/* --------------------------------------------------------------------
9470 + * -------------------------------------------------------------------- */
9471 +static struct resource atmel_twi0_resource[] __initdata = {
9472 + PBMEM(0xffe00800),
9475 +static struct clk atmel_twi0_pclk = {
9476 + .name = "twi_pclk",
9477 + .parent = &pba_clk,
9478 + .mode = pba_clk_mode,
9479 + .get_rate = pba_clk_get_rate,
9483 +struct platform_device *__init at32_add_device_twi(unsigned int id,
9484 + struct i2c_board_info *b,
9487 + struct platform_device *pdev;
9492 + pdev = platform_device_alloc("atmel_twi", id);
9496 + if (platform_device_add_resources(pdev, atmel_twi0_resource,
9497 + ARRAY_SIZE(atmel_twi0_resource)))
9498 + goto err_add_resources;
9500 + select_peripheral(PA(6), PERIPH_A, 0); /* SDA */
9501 + select_peripheral(PA(7), PERIPH_A, 0); /* SDL */
9503 + atmel_twi0_pclk.dev = &pdev->dev;
9506 + i2c_register_board_info(id, b, n);
9508 + platform_device_add(pdev);
9512 + platform_device_put(pdev);
9516 +/* --------------------------------------------------------------------
9518 + * -------------------------------------------------------------------- */
9519 +static struct resource atmel_mci0_resource[] __initdata = {
9520 + PBMEM(0xfff02400),
9523 +static struct clk atmel_mci0_pclk = {
9524 + .name = "mci_clk",
9525 + .parent = &pbb_clk,
9526 + .mode = pbb_clk_mode,
9527 + .get_rate = pbb_clk_get_rate,
9531 +struct platform_device *__init
9532 +at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
9534 + struct platform_device *pdev;
9539 + pdev = platform_device_alloc("atmel_mci", id);
9543 + if (platform_device_add_resources(pdev, atmel_mci0_resource,
9544 + ARRAY_SIZE(atmel_mci0_resource)))
9547 + if (data && platform_device_add_data(pdev, data,
9548 + sizeof(struct mci_platform_data)))
9551 + select_peripheral(PA(10), PERIPH_A, 0); /* CLK */
9552 + select_peripheral(PA(11), PERIPH_A, 0); /* CMD */
9553 + select_peripheral(PA(12), PERIPH_A, 0); /* DATA0 */
9554 + select_peripheral(PA(13), PERIPH_A, 0); /* DATA1 */
9555 + select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */
9556 + select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */
9559 + if (data->detect_pin != GPIO_PIN_NONE)
9560 + at32_select_gpio(data->detect_pin, 0);
9561 + if (data->wp_pin != GPIO_PIN_NONE)
9562 + at32_select_gpio(data->wp_pin, 0);
9565 + atmel_mci0_pclk.dev = &pdev->dev;
9567 + platform_device_add(pdev);
9571 + platform_device_put(pdev);
9575 +/* --------------------------------------------------------------------
9577 + * -------------------------------------------------------------------- */
9578 +#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
9579 +static struct atmel_lcdfb_info atmel_lcdfb0_data;
9580 +static struct resource atmel_lcdfb0_resource[] = {
9582 + .start = 0xff000000,
9583 + .end = 0xff000fff,
9584 + .flags = IORESOURCE_MEM,
9588 + /* Placeholder for pre-allocated fb memory */
9589 + .start = 0x00000000,
9590 + .end = 0x00000000,
9594 +DEFINE_DEV_DATA(atmel_lcdfb, 0);
9595 +DEV_CLK(hck1, atmel_lcdfb0, hsb, 7);
9596 +static struct clk atmel_lcdfb0_pixclk = {
9597 + .name = "lcdc_clk",
9598 + .dev = &atmel_lcdfb0_device.dev,
9599 + .mode = genclk_mode,
9600 + .get_rate = genclk_get_rate,
9601 + .set_rate = genclk_set_rate,
9602 + .set_parent = genclk_set_parent,
9606 +struct platform_device *__init
9607 +at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
9608 + unsigned long fbmem_start, unsigned long fbmem_len)
9610 + struct platform_device *pdev;
9611 + struct atmel_lcdfb_info *info;
9612 + struct fb_monspecs *monspecs;
9613 + struct fb_videomode *modedb;
9614 + unsigned int modedb_size;
9617 + * Do a deep copy of the fb data, monspecs and modedb. Make
9618 + * sure all allocations are done before setting up the
9621 + monspecs = kmemdup(data->default_monspecs,
9622 + sizeof(struct fb_monspecs), GFP_KERNEL);
9626 + modedb_size = sizeof(struct fb_videomode) * monspecs->modedb_len;
9627 + modedb = kmemdup(monspecs->modedb, modedb_size, GFP_KERNEL);
9629 + goto err_dup_modedb;
9630 + monspecs->modedb = modedb;
9634 + pdev = &atmel_lcdfb0_device;
9635 + select_peripheral(PC(19), PERIPH_A, 0); /* CC */
9636 + select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */
9637 + select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */
9638 + select_peripheral(PC(22), PERIPH_A, 0); /* VSYNC */
9639 + select_peripheral(PC(23), PERIPH_A, 0); /* DVAL */
9640 + select_peripheral(PC(24), PERIPH_A, 0); /* MODE */
9641 + select_peripheral(PC(25), PERIPH_A, 0); /* PWR */
9642 + select_peripheral(PC(26), PERIPH_A, 0); /* DATA0 */
9643 + select_peripheral(PC(27), PERIPH_A, 0); /* DATA1 */
9644 + select_peripheral(PC(28), PERIPH_A, 0); /* DATA2 */
9645 + select_peripheral(PC(29), PERIPH_A, 0); /* DATA3 */
9646 + select_peripheral(PC(30), PERIPH_A, 0); /* DATA4 */
9647 + select_peripheral(PC(31), PERIPH_A, 0); /* DATA5 */
9648 + select_peripheral(PD(0), PERIPH_A, 0); /* DATA6 */
9649 + select_peripheral(PD(1), PERIPH_A, 0); /* DATA7 */
9650 + select_peripheral(PD(2), PERIPH_A, 0); /* DATA8 */
9651 + select_peripheral(PD(3), PERIPH_A, 0); /* DATA9 */
9652 + select_peripheral(PD(4), PERIPH_A, 0); /* DATA10 */
9653 + select_peripheral(PD(5), PERIPH_A, 0); /* DATA11 */
9654 + select_peripheral(PD(6), PERIPH_A, 0); /* DATA12 */
9655 + select_peripheral(PD(7), PERIPH_A, 0); /* DATA13 */
9656 + select_peripheral(PD(8), PERIPH_A, 0); /* DATA14 */
9657 + select_peripheral(PD(9), PERIPH_A, 0); /* DATA15 */
9658 + select_peripheral(PD(10), PERIPH_A, 0); /* DATA16 */
9659 + select_peripheral(PD(11), PERIPH_A, 0); /* DATA17 */
9660 + select_peripheral(PD(12), PERIPH_A, 0); /* DATA18 */
9661 + select_peripheral(PD(13), PERIPH_A, 0); /* DATA19 */
9662 + select_peripheral(PD(14), PERIPH_A, 0); /* DATA20 */
9663 + select_peripheral(PD(15), PERIPH_A, 0); /* DATA21 */
9664 + select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */
9665 + select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */
9667 + clk_set_parent(&atmel_lcdfb0_pixclk, &pll0);
9668 + clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0));
9672 + goto err_invalid_id;
9676 + pdev->resource[2].start = fbmem_start;
9677 + pdev->resource[2].end = fbmem_start + fbmem_len - 1;
9678 + pdev->resource[2].flags = IORESOURCE_MEM;
9681 + info = pdev->dev.platform_data;
9682 + memcpy(info, data, sizeof(struct atmel_lcdfb_info));
9683 + info->default_monspecs = monspecs;
9685 + platform_device_register(pdev);
9696 +/* --------------------------------------------------------------------
9698 + * -------------------------------------------------------------------- */
9699 +static struct resource atmel_pwm0_resource[] __initdata = {
9700 + PBMEM(0xfff01400),
9703 +static struct clk atmel_pwm0_mck = {
9705 + .parent = &pbb_clk,
9706 + .mode = pbb_clk_mode,
9707 + .get_rate = pbb_clk_get_rate,
9711 +struct platform_device *__init at32_add_device_pwm(u32 mask)
9713 + struct platform_device *pdev;
9718 + pdev = platform_device_alloc("atmel_pwm", 0);
9722 + if (platform_device_add_resources(pdev, atmel_pwm0_resource,
9723 + ARRAY_SIZE(atmel_pwm0_resource)))
9724 + goto out_free_pdev;
9726 + if (platform_device_add_data(pdev, &mask, sizeof(mask)))
9727 + goto out_free_pdev;
9729 + if (mask & (1 << 0))
9730 + select_peripheral(PA(28), PERIPH_A, 0);
9731 + if (mask & (1 << 1))
9732 + select_peripheral(PA(29), PERIPH_A, 0);
9733 + if (mask & (1 << 2))
9734 + select_peripheral(PA(21), PERIPH_B, 0);
9735 + if (mask & (1 << 3))
9736 + select_peripheral(PA(22), PERIPH_B, 0);
9738 + atmel_pwm0_mck.dev = &pdev->dev;
9740 + platform_device_add(pdev);
9745 + platform_device_put(pdev);
9749 +/* --------------------------------------------------------------------
9751 + * -------------------------------------------------------------------- */
9752 +static struct resource ssc0_resource[] = {
9753 + PBMEM(0xffe01c00),
9756 +DEFINE_DEV(ssc, 0);
9757 +DEV_CLK(pclk, ssc0, pba, 7);
9759 +static struct resource ssc1_resource[] = {
9760 + PBMEM(0xffe02000),
9763 +DEFINE_DEV(ssc, 1);
9764 +DEV_CLK(pclk, ssc1, pba, 8);
9766 +static struct resource ssc2_resource[] = {
9767 + PBMEM(0xffe02400),
9770 +DEFINE_DEV(ssc, 2);
9771 +DEV_CLK(pclk, ssc2, pba, 9);
9773 +struct platform_device *__init
9774 +at32_add_device_ssc(unsigned int id, unsigned int flags)
9776 + struct platform_device *pdev;
9780 + pdev = &ssc0_device;
9781 + if (flags & ATMEL_SSC_RF)
9782 + select_peripheral(PA(21), PERIPH_A, 0); /* RF */
9783 + if (flags & ATMEL_SSC_RK)
9784 + select_peripheral(PA(22), PERIPH_A, 0); /* RK */
9785 + if (flags & ATMEL_SSC_TK)
9786 + select_peripheral(PA(23), PERIPH_A, 0); /* TK */
9787 + if (flags & ATMEL_SSC_TF)
9788 + select_peripheral(PA(24), PERIPH_A, 0); /* TF */
9789 + if (flags & ATMEL_SSC_TD)
9790 + select_peripheral(PA(25), PERIPH_A, 0); /* TD */
9791 + if (flags & ATMEL_SSC_RD)
9792 + select_peripheral(PA(26), PERIPH_A, 0); /* RD */
9795 + pdev = &ssc1_device;
9796 + if (flags & ATMEL_SSC_RF)
9797 + select_peripheral(PA(0), PERIPH_B, 0); /* RF */
9798 + if (flags & ATMEL_SSC_RK)
9799 + select_peripheral(PA(1), PERIPH_B, 0); /* RK */
9800 + if (flags & ATMEL_SSC_TK)
9801 + select_peripheral(PA(2), PERIPH_B, 0); /* TK */
9802 + if (flags & ATMEL_SSC_TF)
9803 + select_peripheral(PA(3), PERIPH_B, 0); /* TF */
9804 + if (flags & ATMEL_SSC_TD)
9805 + select_peripheral(PA(4), PERIPH_B, 0); /* TD */
9806 + if (flags & ATMEL_SSC_RD)
9807 + select_peripheral(PA(5), PERIPH_B, 0); /* RD */
9810 + pdev = &ssc2_device;
9811 + if (flags & ATMEL_SSC_TD)
9812 + select_peripheral(PB(13), PERIPH_A, 0); /* TD */
9813 + if (flags & ATMEL_SSC_RD)
9814 + select_peripheral(PB(14), PERIPH_A, 0); /* RD */
9815 + if (flags & ATMEL_SSC_TK)
9816 + select_peripheral(PB(15), PERIPH_A, 0); /* TK */
9817 + if (flags & ATMEL_SSC_TF)
9818 + select_peripheral(PB(16), PERIPH_A, 0); /* TF */
9819 + if (flags & ATMEL_SSC_RF)
9820 + select_peripheral(PB(17), PERIPH_A, 0); /* RF */
9821 + if (flags & ATMEL_SSC_RK)
9822 + select_peripheral(PB(18), PERIPH_A, 0); /* RK */
9828 + platform_device_register(pdev);
9832 +/* --------------------------------------------------------------------
9833 + * USB Device Controller
9834 + * -------------------------------------------------------------------- */
9835 +static struct resource usba0_resource[] __initdata = {
9837 + .start = 0xff300000,
9838 + .end = 0xff3fffff,
9839 + .flags = IORESOURCE_MEM,
9841 + .start = 0xfff03000,
9842 + .end = 0xfff033ff,
9843 + .flags = IORESOURCE_MEM,
9847 +static struct clk usba0_pclk = {
9849 + .parent = &pbb_clk,
9850 + .mode = pbb_clk_mode,
9851 + .get_rate = pbb_clk_get_rate,
9854 +static struct clk usba0_hclk = {
9856 + .parent = &hsb_clk,
9857 + .mode = hsb_clk_mode,
9858 + .get_rate = hsb_clk_get_rate,
9862 +#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
9866 + .fifo_size = maxpkt, \
9867 + .nr_banks = maxbk, \
9869 + .can_isoc = isoc, \
9872 +static struct usba_ep_data at32_usba_ep[] __initdata = {
9873 + EP("ep0", 0, 64, 1, 0, 0),
9874 + EP("ep1", 1, 512, 2, 1, 1),
9875 + EP("ep2", 2, 512, 2, 1, 1),
9876 + EP("ep3-int", 3, 64, 3, 1, 0),
9877 + EP("ep4-int", 4, 64, 3, 1, 0),
9878 + EP("ep5", 5, 1024, 3, 1, 1),
9879 + EP("ep6", 6, 1024, 3, 1, 1),
9884 +struct platform_device *__init
9885 +at32_add_device_usba(unsigned int id, struct usba_platform_data *data)
9888 + * pdata doesn't have room for any endpoints, so we need to
9889 + * append room for the ones we need right after it.
9892 + struct usba_platform_data pdata;
9893 + struct usba_ep_data ep[7];
9895 + struct platform_device *pdev;
9900 + pdev = platform_device_alloc("atmel_usba_udc", 0);
9904 + if (platform_device_add_resources(pdev, usba0_resource,
9905 + ARRAY_SIZE(usba0_resource)))
9906 + goto out_free_pdev;
9909 + usba_data.pdata.vbus_pin = data->vbus_pin;
9911 + usba_data.pdata.vbus_pin = -EINVAL;
9913 + data = &usba_data.pdata;
9914 + data->num_ep = ARRAY_SIZE(at32_usba_ep);
9915 + memcpy(data->ep, at32_usba_ep, sizeof(at32_usba_ep));
9917 + if (platform_device_add_data(pdev, data, sizeof(usba_data)))
9918 + goto out_free_pdev;
9920 + if (data->vbus_pin >= 0)
9921 + at32_select_gpio(data->vbus_pin, 0);
9923 + usba0_pclk.dev = &pdev->dev;
9924 + usba0_hclk.dev = &pdev->dev;
9926 + platform_device_add(pdev);
9931 + platform_device_put(pdev);
9935 +/* --------------------------------------------------------------------
9936 + * IDE / CompactFlash
9937 + * -------------------------------------------------------------------- */
9938 +#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7001)
9939 +static struct resource at32_smc_cs4_resource[] __initdata = {
9941 + .start = 0x04000000,
9942 + .end = 0x07ffffff,
9943 + .flags = IORESOURCE_MEM,
9945 + IRQ(~0UL), /* Magic IRQ will be overridden */
9947 +static struct resource at32_smc_cs5_resource[] __initdata = {
9949 + .start = 0x20000000,
9950 + .end = 0x23ffffff,
9951 + .flags = IORESOURCE_MEM,
9953 + IRQ(~0UL), /* Magic IRQ will be overridden */
9956 +static int __init at32_init_ide_or_cf(struct platform_device *pdev,
9957 + unsigned int cs, unsigned int extint)
9959 + static unsigned int extint_pin_map[4] __initdata = {
9965 + static bool common_pins_initialized __initdata = false;
9966 + unsigned int extint_pin;
9969 + if (extint >= ARRAY_SIZE(extint_pin_map))
9971 + extint_pin = extint_pin_map[extint];
9975 + ret = platform_device_add_resources(pdev,
9976 + at32_smc_cs4_resource,
9977 + ARRAY_SIZE(at32_smc_cs4_resource));
9981 + select_peripheral(PE(21), PERIPH_A, 0); /* NCS4 -> OE_N */
9982 + set_ebi_sfr_bits(HMATRIX_BIT(CS4A));
9985 + ret = platform_device_add_resources(pdev,
9986 + at32_smc_cs5_resource,
9987 + ARRAY_SIZE(at32_smc_cs5_resource));
9991 + select_peripheral(PE(22), PERIPH_A, 0); /* NCS5 -> OE_N */
9992 + set_ebi_sfr_bits(HMATRIX_BIT(CS5A));
9998 + if (!common_pins_initialized) {
9999 + select_peripheral(PE(19), PERIPH_A, 0); /* CFCE1 -> CS0_N */
10000 + select_peripheral(PE(20), PERIPH_A, 0); /* CFCE2 -> CS1_N */
10001 + select_peripheral(PE(23), PERIPH_A, 0); /* CFRNW -> DIR */
10002 + select_peripheral(PE(24), PERIPH_A, 0); /* NWAIT <- IORDY */
10003 + common_pins_initialized = true;
10006 + at32_select_periph(extint_pin, GPIO_PERIPH_A, AT32_GPIOF_DEGLITCH);
10008 + pdev->resource[1].start = EIM_IRQ_BASE + extint;
10009 + pdev->resource[1].end = pdev->resource[1].start;
10014 +struct platform_device *__init
10015 +at32_add_device_ide(unsigned int id, unsigned int extint,
10016 + struct ide_platform_data *data)
10018 + struct platform_device *pdev;
10020 + pdev = platform_device_alloc("at32_ide", id);
10024 + if (platform_device_add_data(pdev, data,
10025 + sizeof(struct ide_platform_data)))
10028 + if (at32_init_ide_or_cf(pdev, data->cs, extint))
10031 + platform_device_add(pdev);
10035 + platform_device_put(pdev);
10039 +struct platform_device *__init
10040 +at32_add_device_cf(unsigned int id, unsigned int extint,
10041 + struct cf_platform_data *data)
10043 + struct platform_device *pdev;
10045 + pdev = platform_device_alloc("at32_cf", id);
10049 + if (platform_device_add_data(pdev, data,
10050 + sizeof(struct cf_platform_data)))
10053 + if (at32_init_ide_or_cf(pdev, data->cs, extint))
10056 + if (data->detect_pin != GPIO_PIN_NONE)
10057 + at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH);
10058 + if (data->reset_pin != GPIO_PIN_NONE)
10059 + at32_select_gpio(data->reset_pin, 0);
10060 + if (data->vcc_pin != GPIO_PIN_NONE)
10061 + at32_select_gpio(data->vcc_pin, 0);
10062 + /* READY is used as extint, so we can't select it as gpio */
10064 + platform_device_add(pdev);
10068 + platform_device_put(pdev);
10073 +/* --------------------------------------------------------------------
10075 + * -------------------------------------------------------------------- */
10076 +static struct resource atmel_ac97c0_resource[] __initdata = {
10077 + PBMEM(0xfff02800),
10080 +static struct clk atmel_ac97c0_pclk = {
10082 + .parent = &pbb_clk,
10083 + .mode = pbb_clk_mode,
10084 + .get_rate = pbb_clk_get_rate,
10088 +struct platform_device *__init at32_add_device_ac97c(unsigned int id)
10090 + struct platform_device *pdev;
10095 + pdev = platform_device_alloc("atmel_ac97c", id);
10099 + if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
10100 + ARRAY_SIZE(atmel_ac97c0_resource)))
10101 + goto err_add_resources;
10103 + select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */
10104 + select_peripheral(PB(21), PERIPH_B, 0); /* SDO */
10105 + select_peripheral(PB(22), PERIPH_B, 0); /* SDI */
10106 + select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */
10108 + atmel_ac97c0_pclk.dev = &pdev->dev;
10110 + platform_device_add(pdev);
10113 +err_add_resources:
10114 + platform_device_put(pdev);
10118 +/* --------------------------------------------------------------------
10120 + * -------------------------------------------------------------------- */
10121 +static struct resource abdac0_resource[] __initdata = {
10122 + PBMEM(0xfff02000),
10125 +static struct clk abdac0_pclk = {
10127 + .parent = &pbb_clk,
10128 + .mode = pbb_clk_mode,
10129 + .get_rate = pbb_clk_get_rate,
10132 +static struct clk abdac0_sample_clk = {
10133 + .name = "sample_clk",
10134 + .mode = genclk_mode,
10135 + .get_rate = genclk_get_rate,
10136 + .set_rate = genclk_set_rate,
10137 + .set_parent = genclk_set_parent,
10141 +struct platform_device *__init at32_add_device_abdac(unsigned int id)
10143 + struct platform_device *pdev;
10148 + pdev = platform_device_alloc("abdac", id);
10152 + if (platform_device_add_resources(pdev, abdac0_resource,
10153 + ARRAY_SIZE(abdac0_resource)))
10154 + goto err_add_resources;
10156 + select_peripheral(PB(20), PERIPH_A, 0); /* DATA1 */
10157 + select_peripheral(PB(21), PERIPH_A, 0); /* DATA0 */
10158 + select_peripheral(PB(22), PERIPH_A, 0); /* DATAN1 */
10159 + select_peripheral(PB(23), PERIPH_A, 0); /* DATAN0 */
10161 + abdac0_pclk.dev = &pdev->dev;
10162 + abdac0_sample_clk.dev = &pdev->dev;
10164 + platform_device_add(pdev);
10167 +err_add_resources:
10168 + platform_device_put(pdev);
10172 +/* --------------------------------------------------------------------
10174 + * -------------------------------------------------------------------- */
10175 +static struct clk gclk0 = {
10177 + .mode = genclk_mode,
10178 + .get_rate = genclk_get_rate,
10179 + .set_rate = genclk_set_rate,
10180 + .set_parent = genclk_set_parent,
10183 +static struct clk gclk1 = {
10185 + .mode = genclk_mode,
10186 + .get_rate = genclk_get_rate,
10187 + .set_rate = genclk_set_rate,
10188 + .set_parent = genclk_set_parent,
10191 +static struct clk gclk2 = {
10193 + .mode = genclk_mode,
10194 + .get_rate = genclk_get_rate,
10195 + .set_rate = genclk_set_rate,
10196 + .set_parent = genclk_set_parent,
10199 +static struct clk gclk3 = {
10201 + .mode = genclk_mode,
10202 + .get_rate = genclk_get_rate,
10203 + .set_rate = genclk_set_rate,
10204 + .set_parent = genclk_set_parent,
10207 +static struct clk gclk4 = {
10209 + .mode = genclk_mode,
10210 + .get_rate = genclk_get_rate,
10211 + .set_rate = genclk_set_rate,
10212 + .set_parent = genclk_set_parent,
10216 +struct clk *at32_clock_list[] = {
10227 + &at32_intc0_pclk,
10242 + &at32_tcb0_t0_clk,
10243 + &at32_tcb1_t0_clk,
10244 + &atmel_psif0_pclk,
10245 + &atmel_psif1_pclk,
10246 + &atmel_usart0_usart,
10247 + &atmel_usart1_usart,
10248 + &atmel_usart2_usart,
10249 + &atmel_usart3_usart,
10251 +#if defined(CONFIG_CPU_AT32AP7000)
10257 + &atmel_spi0_spi_clk,
10258 + &atmel_spi1_spi_clk,
10259 + &atmel_twi0_pclk,
10260 + &atmel_mci0_pclk,
10261 +#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
10262 + &atmel_lcdfb0_hck1,
10263 + &atmel_lcdfb0_pixclk,
10270 + &atmel_ac97c0_pclk,
10272 + &abdac0_sample_clk,
10279 +unsigned int at32_nr_clocks = ARRAY_SIZE(at32_clock_list);
10281 +void __init at32_portmux_init(void)
10283 + at32_init_pio(&pio0_device);
10284 + at32_init_pio(&pio1_device);
10285 + at32_init_pio(&pio2_device);
10286 + at32_init_pio(&pio3_device);
10287 + at32_init_pio(&pio4_device);
10290 +void __init at32_clock_init(void)
10292 + u32 cpu_mask = 0, hsb_mask = 0, pba_mask = 0, pbb_mask = 0;
10295 + if (pm_readl(MCCTRL) & PM_BIT(PLLSEL)) {
10296 + main_clock = &pll0;
10297 + cpu_clk.parent = &pll0;
10299 + main_clock = &osc0;
10300 + cpu_clk.parent = &osc0;
10303 + if (pm_readl(PLL0) & PM_BIT(PLLOSC))
10304 + pll0.parent = &osc1;
10305 + if (pm_readl(PLL1) & PM_BIT(PLLOSC))
10306 + pll1.parent = &osc1;
10308 + genclk_init_parent(&gclk0);
10309 + genclk_init_parent(&gclk1);
10310 + genclk_init_parent(&gclk2);
10311 + genclk_init_parent(&gclk3);
10312 + genclk_init_parent(&gclk4);
10313 +#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
10314 + genclk_init_parent(&atmel_lcdfb0_pixclk);
10316 + genclk_init_parent(&abdac0_sample_clk);
10319 + * Turn on all clocks that have at least one user already, and
10320 + * turn off everything else. We only do this for module
10321 + * clocks, and even though it isn't particularly pretty to
10322 + * check the address of the mode function, it should do the
10325 + for (i = 0; i < ARRAY_SIZE(at32_clock_list); i++) {
10326 + struct clk *clk = at32_clock_list[i];
10328 + if (clk->users == 0)
10331 + if (clk->mode == &cpu_clk_mode)
10332 + cpu_mask |= 1 << clk->index;
10333 + else if (clk->mode == &hsb_clk_mode)
10334 + hsb_mask |= 1 << clk->index;
10335 + else if (clk->mode == &pba_clk_mode)
10336 + pba_mask |= 1 << clk->index;
10337 + else if (clk->mode == &pbb_clk_mode)
10338 + pbb_mask |= 1 << clk->index;
10341 + pm_writel(CPU_MASK, cpu_mask);
10342 + pm_writel(HSB_MASK, hsb_mask);
10343 + pm_writel(PBA_MASK, pba_mask);
10344 + pm_writel(PBB_MASK, pbb_mask);
10346 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/extint.c avr32-2.6/arch/avr32/mach-at32ap/extint.c
10347 --- linux-2.6.24.3/arch/avr32/mach-at32ap/extint.c 2008-02-26 01:20:20.000000000 +0100
10348 +++ avr32-2.6/arch/avr32/mach-at32ap/extint.c 2008-04-23 19:33:29.000000000 +0200
10349 @@ -26,16 +26,10 @@
10350 #define EIC_MODE 0x0014
10351 #define EIC_EDGE 0x0018
10352 #define EIC_LEVEL 0x001c
10353 -#define EIC_TEST 0x0020
10354 #define EIC_NMIC 0x0024
10356 -/* Bitfields in TEST */
10357 -#define EIC_TESTEN_OFFSET 31
10358 -#define EIC_TESTEN_SIZE 1
10360 /* Bitfields in NMIC */
10361 -#define EIC_EN_OFFSET 0
10362 -#define EIC_EN_SIZE 1
10363 +#define EIC_NMIC_ENABLE (1 << 0)
10365 /* Bit manipulation macros */
10366 #define EIC_BIT(name) \
10368 unsigned int first_irq;
10371 +static struct eic *nmi_eic;
10372 +static bool nmi_enabled;
10374 static void eic_ack_irq(unsigned int irq)
10376 struct eic *eic = get_irq_chip_data(irq);
10377 @@ -133,8 +130,11 @@
10378 eic_writel(eic, EDGE, edge);
10379 eic_writel(eic, LEVEL, level);
10381 - if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
10382 + if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) {
10383 flow_type |= IRQ_LEVEL;
10384 + __set_irq_handler_unlocked(irq, handle_level_irq);
10386 + __set_irq_handler_unlocked(irq, handle_edge_irq);
10387 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
10388 desc->status |= flow_type;
10390 @@ -154,9 +154,8 @@
10391 static void demux_eic_irq(unsigned int irq, struct irq_desc *desc)
10393 struct eic *eic = desc->handler_data;
10394 - struct irq_desc *ext_desc;
10395 unsigned long status, pending;
10396 - unsigned int i, ext_irq;
10399 status = eic_readl(eic, ISR);
10400 pending = status & eic_readl(eic, IMR);
10401 @@ -165,15 +164,28 @@
10402 i = fls(pending) - 1;
10403 pending &= ~(1 << i);
10405 - ext_irq = i + eic->first_irq;
10406 - ext_desc = irq_desc + ext_irq;
10407 - if (ext_desc->status & IRQ_LEVEL)
10408 - handle_level_irq(ext_irq, ext_desc);
10410 - handle_edge_irq(ext_irq, ext_desc);
10411 + generic_handle_irq(i + eic->first_irq);
10415 +int nmi_enable(void)
10417 + nmi_enabled = true;
10420 + eic_writel(nmi_eic, NMIC, EIC_NMIC_ENABLE);
10425 +void nmi_disable(void)
10428 + eic_writel(nmi_eic, NMIC, 0);
10430 + nmi_enabled = false;
10433 static int __init eic_probe(struct platform_device *pdev)
10436 @@ -214,14 +226,13 @@
10437 pattern = eic_readl(eic, MODE);
10438 nr_irqs = fls(pattern);
10440 - /* Trigger on falling edge unless overridden by driver */
10441 - eic_writel(eic, MODE, 0UL);
10442 + /* Trigger on low level unless overridden by driver */
10443 eic_writel(eic, EDGE, 0UL);
10444 + eic_writel(eic, LEVEL, 0UL);
10446 eic->chip = &eic_chip;
10448 for (i = 0; i < nr_irqs; i++) {
10449 - /* NOTE the handler we set here is ignored by the demux */
10450 set_irq_chip_and_handler(eic->first_irq + i, &eic_chip,
10452 set_irq_chip_data(eic->first_irq + i, eic);
10453 @@ -230,6 +241,16 @@
10454 set_irq_chained_handler(int_irq, demux_eic_irq);
10455 set_irq_data(int_irq, eic);
10457 + if (pdev->id == 0) {
10461 + * Someone tried to enable NMI before we were
10462 + * ready. Do it now.
10467 dev_info(&pdev->dev,
10468 "External Interrupt Controller at 0x%p, IRQ %u\n",
10469 eic->regs, int_irq);
10470 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/gpio-dev.c avr32-2.6/arch/avr32/mach-at32ap/gpio-dev.c
10471 --- linux-2.6.24.3/arch/avr32/mach-at32ap/gpio-dev.c 1970-01-01 01:00:00.000000000 +0100
10472 +++ avr32-2.6/arch/avr32/mach-at32ap/gpio-dev.c 2008-04-23 19:33:29.000000000 +0200
10475 + * GPIO /dev and configfs interface
10477 + * Copyright (C) 2006-2007 Atmel Corporation
10479 + * This program is free software; you can redistribute it and/or modify
10480 + * it under the terms of the GNU General Public License version 2 as
10481 + * published by the Free Software Foundation.
10483 +#include <linux/kernel.h>
10484 +#include <linux/configfs.h>
10485 +#include <linux/cdev.h>
10486 +#include <linux/device.h>
10487 +#include <linux/fs.h>
10488 +#include <linux/interrupt.h>
10489 +#include <linux/module.h>
10490 +#include <linux/poll.h>
10491 +#include <linux/uaccess.h>
10492 +#include <linux/wait.h>
10494 +#include <asm/gpio.h>
10495 +#include <asm/arch/portmux.h>
10497 +#define GPIO_DEV_MAX 8
10499 +static struct class *gpio_dev_class;
10500 +static dev_t gpio_devt;
10502 +struct gpio_item {
10511 + /* Pin state last time we read it (for blocking reads) */
10515 + wait_queue_head_t change_wq;
10516 + struct fasync_struct *async_queue;
10519 + struct class_device *gpio_dev;
10520 + struct cdev char_dev;
10521 + struct config_item item;
10524 +struct gpio_attribute {
10525 + struct configfs_attribute attr;
10526 + ssize_t (*show)(struct gpio_item *, char *);
10527 + ssize_t (*store)(struct gpio_item *, const char *, size_t);
10530 +static irqreturn_t gpio_dev_interrupt(int irq, void *dev_id)
10532 + struct gpio_item *gpio = dev_id;
10533 + u32 old_state, new_state;
10535 + old_state = gpio->pin_state;
10536 + new_state = at32_gpio_get_value_multiple(gpio->port, gpio->pin_mask);
10537 + gpio->pin_state = new_state;
10539 + if (new_state != old_state) {
10540 + gpio->changed = 1;
10541 + wake_up_interruptible(&gpio->change_wq);
10543 + if (gpio->async_queue)
10544 + kill_fasync(&gpio->async_queue, SIGIO, POLL_IN);
10547 + return IRQ_HANDLED;
10550 +static int gpio_dev_open(struct inode *inode, struct file *file)
10552 + struct gpio_item *gpio = container_of(inode->i_cdev,
10553 + struct gpio_item,
10555 + unsigned int irq;
10559 + nonseekable_open(inode, file);
10560 + config_item_get(&gpio->item);
10561 + file->private_data = gpio;
10563 + gpio->pin_state = at32_gpio_get_value_multiple(gpio->port,
10565 + gpio->changed = 1;
10567 + for (i = 0; i < 32; i++) {
10568 + if (gpio->pin_mask & (1 << i)) {
10569 + irq = gpio_to_irq(32 * gpio->port + i);
10570 + ret = request_irq(irq, gpio_dev_interrupt, 0,
10571 + "gpio-dev", gpio);
10581 + if (gpio->pin_mask & (1 << i)) {
10582 + irq = gpio_to_irq(32 * gpio->port + i);
10583 + free_irq(irq, gpio);
10587 + config_item_put(&gpio->item);
10592 +static int gpio_dev_fasync(int fd, struct file *file, int mode)
10594 + struct gpio_item *gpio = file->private_data;
10596 + return fasync_helper(fd, file, mode, &gpio->async_queue);
10599 +static int gpio_dev_release(struct inode *inode, struct file *file)
10601 + struct gpio_item *gpio = file->private_data;
10602 + unsigned int irq;
10605 + gpio_dev_fasync(-1, file, 0);
10607 + for (i = 0; i < 32; i++) {
10608 + if (gpio->pin_mask & (1 << i)) {
10609 + irq = gpio_to_irq(32 * gpio->port + i);
10610 + free_irq(irq, gpio);
10614 + config_item_put(&gpio->item);
10619 +static unsigned int gpio_dev_poll(struct file *file, poll_table *wait)
10621 + struct gpio_item *gpio = file->private_data;
10622 + unsigned int mask = 0;
10624 + poll_wait(file, &gpio->change_wq, wait);
10625 + if (gpio->changed)
10626 + mask |= POLLIN | POLLRDNORM;
10631 +static ssize_t gpio_dev_read(struct file *file, char __user *buf,
10632 + size_t count, loff_t *offset)
10634 + struct gpio_item *gpio = file->private_data;
10637 + spin_lock_irq(&gpio->lock);
10638 + while (!gpio->changed) {
10639 + spin_unlock_irq(&gpio->lock);
10641 + if (file->f_flags & O_NONBLOCK)
10644 + if (wait_event_interruptible(gpio->change_wq, gpio->changed))
10645 + return -ERESTARTSYS;
10647 + spin_lock_irq(&gpio->lock);
10650 + gpio->changed = 0;
10651 + value = at32_gpio_get_value_multiple(gpio->port, gpio->pin_mask);
10653 + spin_unlock_irq(&gpio->lock);
10655 + count = min(count, (size_t)4);
10656 + if (copy_to_user(buf, &value, count))
10662 +static ssize_t gpio_dev_write(struct file *file, const char __user *buf,
10663 + size_t count, loff_t *offset)
10665 + struct gpio_item *gpio = file->private_data;
10669 + count = min(count, (size_t)4);
10670 + if (copy_from_user(&value, buf, count))
10673 + /* Assuming big endian */
10674 + mask <<= (4 - count) * 8;
10675 + mask &= gpio->pin_mask;
10677 + at32_gpio_set_value_multiple(gpio->port, value, mask);
10682 +static struct file_operations gpio_dev_fops = {
10683 + .owner = THIS_MODULE,
10684 + .llseek = no_llseek,
10685 + .open = gpio_dev_open,
10686 + .release = gpio_dev_release,
10687 + .fasync = gpio_dev_fasync,
10688 + .poll = gpio_dev_poll,
10689 + .read = gpio_dev_read,
10690 + .write = gpio_dev_write,
10693 +static struct gpio_item *to_gpio_item(struct config_item *item)
10695 + return item ? container_of(item, struct gpio_item, item) : NULL;
10698 +static ssize_t gpio_show_gpio_id(struct gpio_item *gpio, char *page)
10700 + return sprintf(page, "%d\n", gpio->port);
10703 +static ssize_t gpio_store_gpio_id(struct gpio_item *gpio,
10704 + const char *page, size_t count)
10706 + unsigned long id;
10707 + char *p = (char *)page;
10708 + ssize_t ret = -EINVAL;
10710 + id = simple_strtoul(p, &p, 0);
10711 + if (!p || (*p && (*p != '\n')))
10714 + /* Switching PIO is not allowed when live... */
10715 + spin_lock(&gpio->lock);
10716 + if (!gpio->enabled) {
10718 + if (at32_gpio_port_is_valid(id)) {
10723 + spin_unlock(&gpio->lock);
10728 +static ssize_t gpio_show_pin_mask(struct gpio_item *gpio, char *page)
10730 + return sprintf(page, "0x%08x\n", gpio->pin_mask);
10733 +static ssize_t gpio_store_pin_mask(struct gpio_item *gpio,
10734 + const char *page, size_t count)
10737 + char *p = (char *)page;
10738 + ssize_t ret = -EINVAL;
10740 + new_mask = simple_strtoul(p, &p, 0);
10741 + if (!p || (*p && (*p != '\n')))
10744 + /* Can't update the pin mask while live. */
10745 + spin_lock(&gpio->lock);
10746 + if (!gpio->enabled) {
10747 + gpio->oe_mask &= new_mask;
10748 + gpio->pin_mask = new_mask;
10751 + spin_unlock(&gpio->lock);
10756 +static ssize_t gpio_show_oe_mask(struct gpio_item *gpio, char *page)
10758 + return sprintf(page, "0x%08x\n", gpio->oe_mask);
10761 +static ssize_t gpio_store_oe_mask(struct gpio_item *gpio,
10762 + const char *page, size_t count)
10765 + char *p = (char *)page;
10766 + ssize_t ret = -EINVAL;
10768 + mask = simple_strtoul(p, &p, 0);
10769 + if (!p || (*p && (*p != '\n')))
10772 + spin_lock(&gpio->lock);
10773 + if (!gpio->enabled) {
10774 + gpio->oe_mask = mask & gpio->pin_mask;
10777 + spin_unlock(&gpio->lock);
10782 +static ssize_t gpio_show_enabled(struct gpio_item *gpio, char *page)
10784 + return sprintf(page, "%d\n", gpio->enabled);
10787 +static ssize_t gpio_store_enabled(struct gpio_item *gpio,
10788 + const char *page, size_t count)
10790 + char *p = (char *)page;
10794 + enabled = simple_strtoul(p, &p, 0);
10795 + if (!p || (*p && (*p != '\n')))
10798 + /* make it a boolean value */
10799 + enabled = !!enabled;
10801 + if (gpio->enabled == enabled)
10802 + /* No change; do nothing. */
10805 + BUG_ON(gpio->id >= GPIO_DEV_MAX);
10808 + class_device_unregister(gpio->gpio_dev);
10809 + cdev_del(&gpio->char_dev);
10810 + at32_deselect_pins(gpio->port, gpio->pin_mask);
10811 + gpio->initialized = 0;
10813 + if (gpio->port < 0 || !gpio->pin_mask)
10817 + /* Disallow any updates to gpio_id or pin_mask */
10818 + spin_lock(&gpio->lock);
10819 + gpio->enabled = enabled;
10820 + spin_unlock(&gpio->lock);
10825 + /* Now, try to allocate the pins */
10826 + ret = at32_select_gpio_pins(gpio->port, gpio->pin_mask, gpio->oe_mask);
10828 + goto err_alloc_pins;
10830 + gpio->initialized = 1;
10832 + cdev_init(&gpio->char_dev, &gpio_dev_fops);
10833 + gpio->char_dev.owner = THIS_MODULE;
10834 + ret = cdev_add(&gpio->char_dev, MKDEV(MAJOR(gpio_devt), gpio->id), 1);
10836 + goto err_cdev_add;
10837 + gpio->gpio_dev = class_device_create(gpio_dev_class, NULL,
10838 + MKDEV(MAJOR(gpio_devt), gpio->id),
10840 + "gpio%d", gpio->id);
10841 + if (IS_ERR(gpio->gpio_dev)) {
10842 + printk(KERN_ERR "failed to create gpio%d\n", gpio->id);
10843 + ret = PTR_ERR(gpio->gpio_dev);
10844 + goto err_class_dev;
10847 + printk(KERN_INFO "created gpio%d (port%d/0x%08x) as (%d:%d)\n",
10848 + gpio->id, gpio->port, gpio->pin_mask,
10849 + MAJOR(gpio->gpio_dev->devt), MINOR(gpio->gpio_dev->devt));
10854 + cdev_del(&gpio->char_dev);
10856 + at32_deselect_pins(gpio->port, gpio->pin_mask);
10857 + gpio->initialized = 0;
10859 + spin_lock(&gpio->lock);
10860 + gpio->enabled = 0;
10861 + spin_unlock(&gpio->lock);
10866 +static struct gpio_attribute gpio_item_attr_gpio_id = {
10868 + .ca_owner = THIS_MODULE,
10869 + .ca_name = "gpio_id",
10870 + .ca_mode = S_IRUGO | S_IWUSR,
10872 + .show = gpio_show_gpio_id,
10873 + .store = gpio_store_gpio_id,
10875 +static struct gpio_attribute gpio_item_attr_pin_mask = {
10877 + .ca_owner = THIS_MODULE,
10878 + .ca_name = "pin_mask",
10879 + .ca_mode = S_IRUGO | S_IWUSR,
10881 + .show = gpio_show_pin_mask,
10882 + .store = gpio_store_pin_mask,
10884 +static struct gpio_attribute gpio_item_attr_oe_mask = {
10886 + .ca_owner = THIS_MODULE,
10887 + .ca_name = "oe_mask",
10888 + .ca_mode = S_IRUGO | S_IWUSR,
10890 + .show = gpio_show_oe_mask,
10891 + .store = gpio_store_oe_mask,
10893 +static struct gpio_attribute gpio_item_attr_enabled = {
10895 + .ca_owner = THIS_MODULE,
10896 + .ca_name = "enabled",
10897 + .ca_mode = S_IRUGO | S_IWUSR,
10899 + .show = gpio_show_enabled,
10900 + .store = gpio_store_enabled,
10903 +static struct configfs_attribute *gpio_item_attrs[] = {
10904 + &gpio_item_attr_gpio_id.attr,
10905 + &gpio_item_attr_pin_mask.attr,
10906 + &gpio_item_attr_oe_mask.attr,
10907 + &gpio_item_attr_enabled.attr,
10911 +static ssize_t gpio_show_attr(struct config_item *item,
10912 + struct configfs_attribute *attr,
10915 + struct gpio_item *gpio_item = to_gpio_item(item);
10916 + struct gpio_attribute *gpio_attr
10917 + = container_of(attr, struct gpio_attribute, attr);
10920 + if (gpio_attr->show)
10921 + ret = gpio_attr->show(gpio_item, page);
10925 +static ssize_t gpio_store_attr(struct config_item *item,
10926 + struct configfs_attribute *attr,
10927 + const char *page, size_t count)
10929 + struct gpio_item *gpio_item = to_gpio_item(item);
10930 + struct gpio_attribute *gpio_attr
10931 + = container_of(attr, struct gpio_attribute, attr);
10932 + ssize_t ret = -EINVAL;
10934 + if (gpio_attr->store)
10935 + ret = gpio_attr->store(gpio_item, page, count);
10939 +static void gpio_release(struct config_item *item)
10941 + kfree(to_gpio_item(item));
10944 +static struct configfs_item_operations gpio_item_ops = {
10945 + .release = gpio_release,
10946 + .show_attribute = gpio_show_attr,
10947 + .store_attribute = gpio_store_attr,
10950 +static struct config_item_type gpio_item_type = {
10951 + .ct_item_ops = &gpio_item_ops,
10952 + .ct_attrs = gpio_item_attrs,
10953 + .ct_owner = THIS_MODULE,
10956 +static struct config_item *gpio_make_item(struct config_group *group,
10957 + const char *name)
10959 + static int next_id;
10960 + struct gpio_item *gpio;
10962 + if (next_id >= GPIO_DEV_MAX)
10965 + gpio = kzalloc(sizeof(struct gpio_item), GFP_KERNEL);
10969 + gpio->id = next_id++;
10970 + config_item_init_type_name(&gpio->item, name, &gpio_item_type);
10971 + spin_lock_init(&gpio->lock);
10972 + init_waitqueue_head(&gpio->change_wq);
10974 + return &gpio->item;
10977 +static void gpio_drop_item(struct config_group *group,
10978 + struct config_item *item)
10980 + struct gpio_item *gpio = to_gpio_item(item);
10982 + spin_lock(&gpio->lock);
10983 + if (gpio->enabled) {
10984 + class_device_unregister(gpio->gpio_dev);
10985 + cdev_del(&gpio->char_dev);
10988 + if (gpio->initialized) {
10989 + at32_deselect_pins(gpio->port, gpio->pin_mask);
10990 + gpio->initialized = 0;
10991 + gpio->enabled = 0;
10993 + spin_unlock(&gpio->lock);
10996 +static struct configfs_group_operations gpio_group_ops = {
10997 + .make_item = gpio_make_item,
10998 + .drop_item = gpio_drop_item,
11001 +static struct config_item_type gpio_group_type = {
11002 + .ct_group_ops = &gpio_group_ops,
11003 + .ct_owner = THIS_MODULE,
11006 +static struct configfs_subsystem gpio_subsys = {
11009 + .ci_namebuf = "gpio",
11010 + .ci_type = &gpio_group_type,
11015 +static int __init gpio_dev_init(void)
11019 + gpio_dev_class = class_create(THIS_MODULE, "gpio-dev");
11020 + if (IS_ERR(gpio_dev_class)) {
11021 + err = PTR_ERR(gpio_dev_class);
11022 + goto err_class_create;
11025 + err = alloc_chrdev_region(&gpio_devt, 0, GPIO_DEV_MAX, "gpio");
11027 + goto err_alloc_chrdev;
11029 + /* Configfs initialization */
11030 + config_group_init(&gpio_subsys.su_group);
11031 + mutex_init(&gpio_subsys.su_mutex);
11032 + err = configfs_register_subsystem(&gpio_subsys);
11034 + goto err_register_subsys;
11038 +err_register_subsys:
11039 + unregister_chrdev_region(gpio_devt, GPIO_DEV_MAX);
11041 + class_destroy(gpio_dev_class);
11043 + printk(KERN_WARNING "Failed to initialize gpio /dev interface\n");
11046 +late_initcall(gpio_dev_init);
11047 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/intc.c avr32-2.6/arch/avr32/mach-at32ap/intc.c
11048 --- linux-2.6.24.3/arch/avr32/mach-at32ap/intc.c 2008-02-26 01:20:20.000000000 +0100
11049 +++ avr32-2.6/arch/avr32/mach-at32ap/intc.c 2008-04-23 20:12:35.000000000 +0200
11051 #include <linux/irq.h>
11052 #include <linux/platform_device.h>
11054 -#include <asm/intc.h>
11055 #include <asm/io.h>
11058 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/Kconfig avr32-2.6/arch/avr32/mach-at32ap/Kconfig
11059 --- linux-2.6.24.3/arch/avr32/mach-at32ap/Kconfig 2008-02-26 01:20:20.000000000 +0100
11060 +++ avr32-2.6/arch/avr32/mach-at32ap/Kconfig 2008-04-23 19:33:29.000000000 +0200
11062 menu "Atmel AVR32 AP options"
11065 - prompt "AT32AP7000 static memory bus width"
11066 - depends on CPU_AT32AP7000
11067 - default AP7000_16_BIT_SMC
11068 + prompt "AT32AP700x static memory bus width"
11069 + depends on CPU_AT32AP700X
11070 + default AP700X_16_BIT_SMC
11072 Define the width of the AP7000 external static memory interface.
11073 This is used to determine how to mangle the address and/or data
11074 @@ -15,17 +15,24 @@
11075 width for all chip selects, excluding the flash (which is using
11076 raw access and is thus not affected by any of this.)
11078 -config AP7000_32_BIT_SMC
11079 +config AP700X_32_BIT_SMC
11082 -config AP7000_16_BIT_SMC
11083 +config AP700X_16_BIT_SMC
11086 -config AP7000_8_BIT_SMC
11087 +config AP700X_8_BIT_SMC
11093 + bool "GPIO /dev interface"
11094 + select CONFIGFS_FS
11097 + Say `Y' to enable a /dev interface to the GPIO pins.
11101 endif # PLATFORM_AT32AP
11102 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/Makefile avr32-2.6/arch/avr32/mach-at32ap/Makefile
11103 --- linux-2.6.24.3/arch/avr32/mach-at32ap/Makefile 2008-02-26 01:20:20.000000000 +0100
11104 +++ avr32-2.6/arch/avr32/mach-at32ap/Makefile 2008-04-23 20:12:35.000000000 +0200
11106 obj-y += at32ap.o clock.o intc.o extint.o pio.o hsmc.o
11107 -obj-$(CONFIG_CPU_AT32AP7000) += at32ap7000.o
11108 -obj-$(CONFIG_CPU_AT32AP7000) += time-tc.o
11109 +obj-$(CONFIG_CPU_AT32AP700X) += at32ap700x.o pm-at32ap700x.o
11110 obj-$(CONFIG_CPU_FREQ_AT32AP) += cpufreq.o
11111 +obj-$(CONFIG_GPIO_DEV) += gpio-dev.o
11112 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/pio.c avr32-2.6/arch/avr32/mach-at32ap/pio.c
11113 --- linux-2.6.24.3/arch/avr32/mach-at32ap/pio.c 2008-02-26 01:20:20.000000000 +0100
11114 +++ avr32-2.6/arch/avr32/mach-at32ap/pio.c 2008-04-23 20:12:35.000000000 +0200
11115 @@ -162,6 +162,82 @@
11119 +#ifdef CONFIG_GPIO_DEV
11121 +/* Gang allocators and accessors; used by the GPIO /dev driver */
11122 +int at32_gpio_port_is_valid(unsigned int port)
11124 + return port < MAX_NR_PIO_DEVICES && pio_dev[port].regs != NULL;
11127 +int at32_select_gpio_pins(unsigned int port, u32 pins, u32 oe_mask)
11129 + struct pio_device *pio;
11132 + pio = &pio_dev[port];
11133 + BUG_ON(port > ARRAY_SIZE(pio_dev) || !pio->regs || (oe_mask & ~pins));
11135 + /* Try to allocate the pins */
11137 + old = pio->pinmux_mask;
11141 + new = old | pins;
11142 + } while (cmpxchg(&pio->pinmux_mask, old, new) != old);
11144 + /* That went well, now configure the port */
11145 + pio_writel(pio, OER, oe_mask);
11146 + pio_writel(pio, PER, pins);
11151 +void at32_deselect_pins(unsigned int port, u32 pins)
11153 + struct pio_device *pio;
11156 + pio = &pio_dev[port];
11157 + BUG_ON(port > ARRAY_SIZE(pio_dev) || !pio->regs);
11159 + /* Return to a "safe" mux configuration */
11160 + pio_writel(pio, PUER, pins);
11161 + pio_writel(pio, ODR, pins);
11163 + /* Deallocate the pins */
11165 + old = pio->pinmux_mask;
11166 + new = old & ~pins;
11167 + } while (cmpxchg(&pio->pinmux_mask, old, new) != old);
11170 +u32 at32_gpio_get_value_multiple(unsigned int port, u32 pins)
11172 + struct pio_device *pio;
11174 + pio = &pio_dev[port];
11175 + BUG_ON(port > ARRAY_SIZE(pio_dev) || !pio->regs);
11177 + return pio_readl(pio, PDSR) & pins;
11180 +void at32_gpio_set_value_multiple(unsigned int port, u32 value, u32 mask)
11182 + struct pio_device *pio;
11184 + pio = &pio_dev[port];
11185 + BUG_ON(port > ARRAY_SIZE(pio_dev) || !pio->regs);
11187 + /* No atomic updates for now... */
11188 + pio_writel(pio, CODR, ~value & mask);
11189 + pio_writel(pio, SODR, value & mask);
11192 +#endif /* CONFIG_GPIO_DEV */
11195 /*--------------------------------------------------------------------------*/
11198 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/pm-at32ap700x.S avr32-2.6/arch/avr32/mach-at32ap/pm-at32ap700x.S
11199 --- linux-2.6.24.3/arch/avr32/mach-at32ap/pm-at32ap700x.S 1970-01-01 01:00:00.000000000 +0100
11200 +++ avr32-2.6/arch/avr32/mach-at32ap/pm-at32ap700x.S 2008-04-23 20:12:35.000000000 +0200
11203 + * Low-level Power Management code.
11205 + * Copyright (C) 2008 Atmel Corporation
11207 + * This program is free software; you can redistribute it and/or modify
11208 + * it under the terms of the GNU General Public License version 2 as
11209 + * published by the Free Software Foundation.
11211 +#include <asm/asm.h>
11212 +#include <asm/asm-offsets.h>
11213 +#include <asm/thread_info.h>
11214 +#include <asm/arch/pm.h>
11216 + .section .bss, "wa", @nobits
11217 + .global disable_idle_sleep
11218 + .type disable_idle_sleep, @object
11219 +disable_idle_sleep:
11221 + .size disable_idle_sleep, . - disable_idle_sleep
11223 + /* Keep this close to the irq handlers */
11224 + .section .irq.text, "ax", @progbits
11227 + * void cpu_enter_idle(void)
11229 + * Put the CPU into "idle" mode, in which it will consume
11230 + * significantly less power.
11232 + * If an interrupt comes along in the window between
11233 + * unmask_interrupts and the sleep instruction below, the
11234 + * interrupt code will adjust the return address so that we
11235 + * never execute the sleep instruction. This is required
11236 + * because the AP7000 doesn't unmask interrupts when entering
11237 + * sleep modes; later CPUs may not need this workaround.
11239 + .global cpu_enter_idle
11240 + .type cpu_enter_idle, @function
11243 + get_thread_info r8
11244 + ld.w r9, r8[TI_flags]
11245 + bld r9, TIF_NEED_RESCHED
11246 + brcs .Lret_from_sleep
11247 + sbr r9, TIF_CPU_GOING_TO_SLEEP
11248 + st.w r8[TI_flags], r9
11249 + unmask_interrupts
11250 + sleep CPU_SLEEP_IDLE
11251 + .size cpu_idle_sleep, . - cpu_idle_sleep
11254 + * Common return path for PM functions that don't run from
11257 + .global cpu_idle_skip_sleep
11258 + .type cpu_idle_skip_sleep, @function
11259 +cpu_idle_skip_sleep:
11261 + ld.w r9, r8[TI_flags]
11262 + cbr r9, TIF_CPU_GOING_TO_SLEEP
11263 + st.w r8[TI_flags], r9
11265 + unmask_interrupts
11267 + .size cpu_idle_skip_sleep, . - cpu_idle_skip_sleep
11268 diff -urN linux-2.6.24.3/arch/avr32/mach-at32ap/time-tc.c avr32-2.6/arch/avr32/mach-at32ap/time-tc.c
11269 --- linux-2.6.24.3/arch/avr32/mach-at32ap/time-tc.c 2008-02-26 01:20:20.000000000 +0100
11270 +++ avr32-2.6/arch/avr32/mach-at32ap/time-tc.c 1970-01-01 01:00:00.000000000 +0100
11273 - * Copyright (C) 2004-2007 Atmel Corporation
11275 - * Based on MIPS implementation arch/mips/kernel/time.c
11276 - * Copyright 2001 MontaVista Software Inc.
11278 - * This program is free software; you can redistribute it and/or modify
11279 - * it under the terms of the GNU General Public License version 2 as
11280 - * published by the Free Software Foundation.
11283 -#include <linux/clk.h>
11284 -#include <linux/clocksource.h>
11285 -#include <linux/time.h>
11286 -#include <linux/module.h>
11287 -#include <linux/interrupt.h>
11288 -#include <linux/irq.h>
11289 -#include <linux/kernel_stat.h>
11290 -#include <linux/errno.h>
11291 -#include <linux/init.h>
11292 -#include <linux/profile.h>
11293 -#include <linux/sysdev.h>
11294 -#include <linux/err.h>
11296 -#include <asm/div64.h>
11297 -#include <asm/sysreg.h>
11298 -#include <asm/io.h>
11299 -#include <asm/sections.h>
11301 -#include <asm/arch/time.h>
11303 -/* how many counter cycles in a jiffy? */
11304 -static u32 cycles_per_jiffy;
11306 -/* the count value for the next timer interrupt */
11307 -static u32 expirelo;
11309 -/* the I/O registers of the TC module */
11310 -static void __iomem *ioregs;
11312 -cycle_t read_cycle_count(void)
11314 - return (cycle_t)timer_read(ioregs, 0, CV);
11317 -struct clocksource clocksource_avr32 = {
11320 - .read = read_cycle_count,
11321 - .mask = CLOCKSOURCE_MASK(16),
11323 - .flags = CLOCK_SOURCE_IS_CONTINUOUS,
11326 -static void avr32_timer_ack(void)
11328 - u16 count = expirelo;
11330 - /* Ack this timer interrupt and set the next one, use a u16
11331 - * variable so it will wrap around correctly */
11332 - count += cycles_per_jiffy;
11333 - expirelo = count;
11334 - timer_write(ioregs, 0, RC, expirelo);
11336 - /* Check to see if we have missed any timer interrupts */
11337 - count = timer_read(ioregs, 0, CV);
11338 - if ((count - expirelo) < 0x7fff) {
11339 - expirelo = count + cycles_per_jiffy;
11340 - timer_write(ioregs, 0, RC, expirelo);
11344 -u32 avr32_hpt_read(void)
11346 - return timer_read(ioregs, 0, CV);
11349 -static int avr32_timer_calc_div_and_set_jiffies(struct clk *pclk)
11351 - unsigned int cycles_max = (clocksource_avr32.mask + 1) / 2;
11352 - unsigned int divs[] = { 4, 8, 16, 32 };
11353 - int divs_size = ARRAY_SIZE(divs);
11355 - unsigned long count_hz;
11356 - unsigned long shift;
11357 - unsigned long mult;
11358 - int clock_div = -1;
11361 - shift = clocksource_avr32.shift;
11364 - count_hz = clk_get_rate(pclk) / divs[i];
11365 - mult = clocksource_hz2mult(count_hz, shift);
11366 - clocksource_avr32.mult = mult;
11371 - do_div(tmp, mult);
11373 - cycles_per_jiffy = tmp;
11374 - } while (cycles_per_jiffy > cycles_max && ++i < divs_size);
11376 - clock_div = i + 1;
11378 - if (clock_div > divs_size) {
11379 - pr_debug("timer: could not calculate clock divider\n");
11383 - /* Set the clock divider */
11384 - timer_write(ioregs, 0, CMR, TIMER_BF(CMR_TCCLKS, clock_div));
11389 -int avr32_hpt_init(unsigned int count)
11391 - struct resource *regs;
11392 - struct clk *pclk;
11398 - irq = platform_get_irq(&at32_systc0_device, 0);
11400 - pr_debug("timer: could not get irq\n");
11404 - pclk = clk_get(&at32_systc0_device.dev, "pclk");
11405 - if (IS_ERR(pclk)) {
11406 - pr_debug("timer: could not get clk: %ld\n", PTR_ERR(pclk));
11409 - clk_enable(pclk);
11411 - regs = platform_get_resource(&at32_systc0_device, IORESOURCE_MEM, 0);
11413 - pr_debug("timer: could not get resource\n");
11414 - goto out_error_clk;
11417 - ioregs = ioremap(regs->start, regs->end - regs->start + 1);
11419 - pr_debug("timer: could not get ioregs\n");
11420 - goto out_error_clk;
11423 - ret = avr32_timer_calc_div_and_set_jiffies(pclk);
11425 - goto out_error_io;
11427 - ret = setup_irq(irq, &timer_irqaction);
11429 - pr_debug("timer: could not request irq %d: %d\n",
11431 - goto out_error_io;
11434 - expirelo = (timer_read(ioregs, 0, CV) / cycles_per_jiffy + 1)
11435 - * cycles_per_jiffy;
11437 - /* Enable clock and interrupts on RC compare */
11438 - timer_write(ioregs, 0, CCR, TIMER_BIT(CCR_CLKEN));
11439 - timer_write(ioregs, 0, IER, TIMER_BIT(IER_CPCS));
11440 - /* Set cycles to first interrupt */
11441 - timer_write(ioregs, 0, RC, expirelo);
11443 - printk(KERN_INFO "timer: AT32AP system timer/counter at 0x%p irq %d\n",
11456 -int avr32_hpt_start(void)
11458 - timer_write(ioregs, 0, CCR, TIMER_BIT(CCR_SWTRG));
11462 -irqreturn_t timer_interrupt(int irq, void *dev_id)
11464 - unsigned int sr = timer_read(ioregs, 0, SR);
11466 - if (sr & TIMER_BIT(SR_CPCS)) {
11467 - /* ack timer interrupt and try to set next interrupt */
11468 - avr32_timer_ack();
11471 - * Call the generic timer interrupt handler
11473 - write_seqlock(&xtime_lock);
11475 - write_sequnlock(&xtime_lock);
11478 - * In UP mode, we call local_timer_interrupt() to do profiling
11479 - * and process accounting.
11481 - * SMP is not supported yet.
11483 - local_timer_interrupt(irq, dev_id);
11485 - return IRQ_HANDLED;
11490 diff -urN linux-2.6.24.3/arch/avr32/Makefile avr32-2.6/arch/avr32/Makefile
11491 --- linux-2.6.24.3/arch/avr32/Makefile 2008-02-26 01:20:20.000000000 +0100
11492 +++ avr32-2.6/arch/avr32/Makefile 2008-04-23 19:33:28.000000000 +0200
11494 CFLAGS_MODULE += -mno-relax
11495 LDFLAGS_vmlinux += --relax
11497 -cpuflags-$(CONFIG_CPU_AT32AP7000) += -mcpu=ap7000
11498 +cpuflags-$(CONFIG_PLATFORM_AT32AP) += -march=ap
11500 KBUILD_CFLAGS += $(cpuflags-y)
11501 KBUILD_AFLAGS += $(cpuflags-y)
11503 core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/
11504 core-y += arch/avr32/kernel/
11505 core-y += arch/avr32/mm/
11506 +drivers-$(CONFIG_OPROFILE) += arch/avr32/oprofile/
11507 +drivers-y += arch/avr32/drivers/
11508 libs-y += arch/avr32/lib/
11510 archincdir-$(CONFIG_PLATFORM_AT32AP) := arch-at32ap
11511 diff -urN linux-2.6.24.3/arch/avr32/mm/dma-coherent.c avr32-2.6/arch/avr32/mm/dma-coherent.c
11512 --- linux-2.6.24.3/arch/avr32/mm/dma-coherent.c 2008-02-26 01:20:20.000000000 +0100
11513 +++ avr32-2.6/arch/avr32/mm/dma-coherent.c 2008-04-23 19:33:29.000000000 +0200
11515 struct page *page, *free, *end;
11518 + /* Following is a work-around (a.k.a. hack) to prevent pages
11519 + * with __GFP_COMP being passed to split_page() which cannot
11520 + * handle them. The real problem is that this flag probably
11521 + * should be 0 on AVR32 as it is not supported on this
11522 + * platform--see CONFIG_HUGETLB_PAGE. */
11523 + gfp &= ~(__GFP_COMP);
11525 size = PAGE_ALIGN(size);
11526 order = get_order(size);
11528 diff -urN linux-2.6.24.3/arch/avr32/mm/fault.c avr32-2.6/arch/avr32/mm/fault.c
11529 --- linux-2.6.24.3/arch/avr32/mm/fault.c 2008-02-26 01:20:20.000000000 +0100
11530 +++ avr32-2.6/arch/avr32/mm/fault.c 2008-04-23 20:12:35.000000000 +0200
11531 @@ -189,6 +189,8 @@
11533 page = sysreg_read(PTBR);
11534 printk(KERN_ALERT "ptbr = %08lx", page);
11535 + if (address >= TASK_SIZE)
11536 + page = (unsigned long)swapper_pg_dir;
11538 page = ((unsigned long *)page)[address >> 22];
11539 printk(" pgd = %08lx", page);
11540 diff -urN linux-2.6.24.3/arch/avr32/mm/tlb.c avr32-2.6/arch/avr32/mm/tlb.c
11541 --- linux-2.6.24.3/arch/avr32/mm/tlb.c 2008-02-26 01:20:20.000000000 +0100
11542 +++ avr32-2.6/arch/avr32/mm/tlb.c 2008-04-23 19:33:29.000000000 +0200
11543 @@ -348,7 +348,7 @@
11547 -static struct seq_operations tlb_ops = {
11548 +static const struct seq_operations tlb_ops = {
11549 .start = tlb_start,
11552 diff -urN linux-2.6.24.3/arch/avr32/oprofile/Makefile avr32-2.6/arch/avr32/oprofile/Makefile
11553 --- linux-2.6.24.3/arch/avr32/oprofile/Makefile 1970-01-01 01:00:00.000000000 +0100
11554 +++ avr32-2.6/arch/avr32/oprofile/Makefile 2008-04-23 19:33:29.000000000 +0200
11556 +obj-$(CONFIG_OPROFILE) += oprofile.o
11558 +oprofile-y := $(addprefix ../../../drivers/oprofile/, \
11559 + oprof.o cpu_buffer.o buffer_sync.o \
11560 + event_buffer.o oprofile_files.o \
11561 + oprofilefs.o oprofile_stats.o \
11563 +oprofile-y += op_model_avr32.o
11564 diff -urN linux-2.6.24.3/arch/avr32/oprofile/op_model_avr32.c avr32-2.6/arch/avr32/oprofile/op_model_avr32.c
11565 --- linux-2.6.24.3/arch/avr32/oprofile/op_model_avr32.c 1970-01-01 01:00:00.000000000 +0100
11566 +++ avr32-2.6/arch/avr32/oprofile/op_model_avr32.c 2008-04-23 20:12:35.000000000 +0200
11569 + * AVR32 Performance Counter Driver
11571 + * Copyright (C) 2005-2007 Atmel Corporation
11573 + * This program is free software; you can redistribute it and/or modify
11574 + * it under the terms of the GNU General Public License version 2 as
11575 + * published by the Free Software Foundation.
11577 + * Author: Ronny Pedersen
11579 +#include <linux/errno.h>
11580 +#include <linux/interrupt.h>
11581 +#include <linux/irq.h>
11582 +#include <linux/oprofile.h>
11583 +#include <linux/sched.h>
11584 +#include <linux/types.h>
11586 +#include <asm/sysreg.h>
11587 +#include <asm/system.h>
11589 +#define AVR32_PERFCTR_IRQ_GROUP 0
11590 +#define AVR32_PERFCTR_IRQ_LINE 1
11592 +enum { PCCNT, PCNT0, PCNT1, NR_counter };
11594 +struct avr32_perf_counter {
11595 + unsigned long enabled;
11596 + unsigned long event;
11597 + unsigned long count;
11598 + unsigned long unit_mask;
11599 + unsigned long kernel;
11600 + unsigned long user;
11606 +static struct avr32_perf_counter counter[NR_counter] = {
11608 + .ie_mask = SYSREG_BIT(IEC),
11609 + .flag_mask = SYSREG_BIT(FC),
11611 + .ie_mask = SYSREG_BIT(IE0),
11612 + .flag_mask = SYSREG_BIT(F0),
11614 + .ie_mask = SYSREG_BIT(IE1),
11615 + .flag_mask = SYSREG_BIT(F1),
11619 +static void avr32_perf_counter_reset(void)
11621 + /* Reset all counter and disable/clear all interrupts */
11622 + sysreg_write(PCCR, (SYSREG_BIT(PCCR_R)
11623 + | SYSREG_BIT(PCCR_C)
11626 + | SYSREG_BIT(F1)));
11629 +static irqreturn_t avr32_perf_counter_interrupt(int irq, void *dev_id)
11631 + struct avr32_perf_counter *ctr = dev_id;
11632 + struct pt_regs *regs;
11635 + if (likely(!(intc_get_pending(AVR32_PERFCTR_IRQ_GROUP)
11636 + & (1 << AVR32_PERFCTR_IRQ_LINE))))
11639 + regs = get_irq_regs();
11640 + pccr = sysreg_read(PCCR);
11642 + /* Clear the interrupt flags we're about to handle */
11643 + sysreg_write(PCCR, pccr);
11646 + if (ctr->enabled && (pccr & ctr->flag_mask)) {
11647 + sysreg_write(PCCNT, -ctr->count);
11648 + oprofile_add_sample(regs, PCCNT);
11652 + if (ctr->enabled && (pccr & ctr->flag_mask)) {
11653 + sysreg_write(PCNT0, -ctr->count);
11654 + oprofile_add_sample(regs, PCNT0);
11658 + if (ctr->enabled && (pccr & ctr->flag_mask)) {
11659 + sysreg_write(PCNT1, -ctr->count);
11660 + oprofile_add_sample(regs, PCNT1);
11663 + return IRQ_HANDLED;
11666 +static int avr32_perf_counter_create_files(struct super_block *sb,
11667 + struct dentry *root)
11669 + struct dentry *dir;
11671 + char filename[4];
11673 + for (i = 0; i < NR_counter; i++) {
11674 + snprintf(filename, sizeof(filename), "%u", i);
11675 + dir = oprofilefs_mkdir(sb, root, filename);
11677 + oprofilefs_create_ulong(sb, dir, "enabled",
11678 + &counter[i].enabled);
11679 + oprofilefs_create_ulong(sb, dir, "event",
11680 + &counter[i].event);
11681 + oprofilefs_create_ulong(sb, dir, "count",
11682 + &counter[i].count);
11684 + /* Dummy entries */
11685 + oprofilefs_create_ulong(sb, dir, "kernel",
11686 + &counter[i].kernel);
11687 + oprofilefs_create_ulong(sb, dir, "user",
11688 + &counter[i].user);
11689 + oprofilefs_create_ulong(sb, dir, "unit_mask",
11690 + &counter[i].unit_mask);
11696 +static int avr32_perf_counter_setup(void)
11698 + struct avr32_perf_counter *ctr;
11703 + pr_debug("avr32_perf_counter_setup\n");
11705 + if (sysreg_read(PCCR) & SYSREG_BIT(PCCR_E)) {
11707 + "oprofile: setup: perf counter already enabled\n");
11711 + ret = request_irq(AVR32_PERFCTR_IRQ_GROUP,
11712 + avr32_perf_counter_interrupt, IRQF_SHARED,
11713 + "oprofile", counter);
11717 + avr32_perf_counter_reset();
11720 + for (i = PCCNT; i < NR_counter; i++) {
11721 + ctr = &counter[i];
11722 + if (!ctr->enabled)
11725 + pr_debug("enabling counter %d...\n", i);
11727 + pccr |= ctr->ie_mask;
11731 + /* PCCNT always counts cycles, so no events */
11732 + sysreg_write(PCCNT, -ctr->count);
11735 + pccr |= SYSREG_BF(CONF0, ctr->event);
11736 + sysreg_write(PCNT0, -ctr->count);
11739 + pccr |= SYSREG_BF(CONF1, ctr->event);
11740 + sysreg_write(PCNT1, -ctr->count);
11745 + pr_debug("oprofile: writing 0x%x to PCCR...\n", pccr);
11747 + sysreg_write(PCCR, pccr);
11752 +static void avr32_perf_counter_shutdown(void)
11754 + pr_debug("avr32_perf_counter_shutdown\n");
11756 + avr32_perf_counter_reset();
11757 + free_irq(AVR32_PERFCTR_IRQ_GROUP, counter);
11760 +static int avr32_perf_counter_start(void)
11762 + pr_debug("avr32_perf_counter_start\n");
11764 + sysreg_write(PCCR, sysreg_read(PCCR) | SYSREG_BIT(PCCR_E));
11769 +static void avr32_perf_counter_stop(void)
11771 + pr_debug("avr32_perf_counter_stop\n");
11773 + sysreg_write(PCCR, sysreg_read(PCCR) & ~SYSREG_BIT(PCCR_E));
11776 +static struct oprofile_operations avr32_perf_counter_ops __initdata = {
11777 + .create_files = avr32_perf_counter_create_files,
11778 + .setup = avr32_perf_counter_setup,
11779 + .shutdown = avr32_perf_counter_shutdown,
11780 + .start = avr32_perf_counter_start,
11781 + .stop = avr32_perf_counter_stop,
11782 + .cpu_type = "avr32",
11785 +int __init oprofile_arch_init(struct oprofile_operations *ops)
11787 + if (!(current_cpu_data.features & AVR32_FEATURE_PCTR))
11790 + memcpy(ops, &avr32_perf_counter_ops,
11791 + sizeof(struct oprofile_operations));
11793 + printk(KERN_INFO "oprofile: using AVR32 performance monitoring.\n");
11798 +void oprofile_arch_exit(void)
11802 diff -urN linux-2.6.24.3/Documentation/kernel-parameters.txt avr32-2.6/Documentation/kernel-parameters.txt
11803 --- linux-2.6.24.3/Documentation/kernel-parameters.txt 2008-02-26 01:20:20.000000000 +0100
11804 +++ avr32-2.6/Documentation/kernel-parameters.txt 2008-04-23 20:12:35.000000000 +0200
11806 ALSA ALSA sound support is enabled.
11807 APIC APIC support is enabled.
11808 APM Advanced Power Management support is enabled.
11809 + AVR32 AVR32 architecture is enabled.
11810 AX25 Appropriate AX.25 support is enabled.
11811 BLACKFIN Blackfin architecture is enabled.
11812 DRM Direct Rendering Management support is enabled.
11813 @@ -1123,6 +1124,10 @@
11814 of returning the full 64-bit number.
11815 The default is to return 64-bit inode numbers.
11817 + nmi_debug= [KNL,AVR32] Specify one or more actions to take
11818 + when a NMI is triggered.
11819 + Format: [state][,regs][,debounce][,die]
11821 nmi_watchdog= [KNL,BUGS=X86-32] Debugging features for SMP kernels
11823 no387 [BUGS=X86-32] Tells the kernel to use the 387 maths
11824 diff -urN linux-2.6.24.3/drivers/clocksource/Makefile avr32-2.6/drivers/clocksource/Makefile
11825 --- linux-2.6.24.3/drivers/clocksource/Makefile 2008-02-26 01:20:20.000000000 +0100
11826 +++ avr32-2.6/drivers/clocksource/Makefile 2008-04-23 20:12:39.000000000 +0200
11828 +obj-$(CONFIG_ATMEL_TCB_CLKSRC) += tcb_clksrc.o
11829 obj-$(CONFIG_X86_CYCLONE_TIMER) += cyclone.o
11830 obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o
11831 obj-$(CONFIG_SCx200HR_TIMER) += scx200_hrt.o
11832 diff -urN linux-2.6.24.3/drivers/clocksource/tcb_clksrc.c avr32-2.6/drivers/clocksource/tcb_clksrc.c
11833 --- linux-2.6.24.3/drivers/clocksource/tcb_clksrc.c 1970-01-01 01:00:00.000000000 +0100
11834 +++ avr32-2.6/drivers/clocksource/tcb_clksrc.c 2008-04-23 20:12:39.000000000 +0200
11836 +#include <linux/init.h>
11837 +#include <linux/clocksource.h>
11838 +#include <linux/clockchips.h>
11839 +#include <linux/interrupt.h>
11840 +#include <linux/irq.h>
11842 +#include <linux/clk.h>
11843 +#include <linux/err.h>
11844 +#include <linux/ioport.h>
11845 +#include <linux/io.h>
11846 +#include <linux/platform_device.h>
11847 +#include <linux/atmel_tc.h>
11851 + * We're configured to use a specific TC block, one that's not hooked
11852 + * up to external hardware, to provide a time solution:
11854 + * - Two channels combine to create a free-running 32 bit counter
11855 + * with a base rate of 5+ MHz, packaged as a clocksource (with
11856 + * resolution better than 200 nsec).
11858 + * - The third channel may be used to provide a 16-bit clockevent
11859 + * source, used in either periodic or oneshot mode. This runs
11860 + * at 32 KiHZ, and can handle delays of up to two seconds.
11862 + * A boot clocksource and clockevent source are also currently needed,
11863 + * unless the relevant platforms (ARM/AT91, AVR32/AT32) are changed so
11864 + * this code can be used when init_timers() is called, well before most
11865 + * devices are set up. (Some low end AT91 parts, which can run uClinux,
11866 + * have only the timers in one TC block... they currently don't support
11867 + * the tclib code, because of that initialization issue.)
11869 + * REVISIT behavior during system suspend states... we should disable
11870 + * all clocks and save the power. Easily done for clockevent devices,
11871 + * but clocksources won't necessarily get the needed notifications.
11872 + * For deeper system sleep states, this will be mandatory...
11875 +static void __iomem *tcaddr;
11877 +static cycle_t tc_get_cycles(void)
11879 + unsigned long flags;
11880 + u32 lower, upper;
11882 + raw_local_irq_save(flags);
11884 + upper = __raw_readl(tcaddr + ATMEL_TC_REG(1, CV));
11885 + lower = __raw_readl(tcaddr + ATMEL_TC_REG(0, CV));
11886 + } while (upper != __raw_readl(tcaddr + ATMEL_TC_REG(1, CV)));
11888 + raw_local_irq_restore(flags);
11889 + return (upper << 16) | lower;
11892 +static struct clocksource clksrc = {
11893 + .name = "tcb_clksrc",
11895 + .read = tc_get_cycles,
11896 + .mask = CLOCKSOURCE_MASK(32),
11898 + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
11901 +#ifdef CONFIG_GENERIC_CLOCKEVENTS
11903 +struct tc_clkevt_device {
11904 + struct clock_event_device clkevt;
11906 + void __iomem *regs;
11909 +static struct tc_clkevt_device *to_tc_clkevt(struct clock_event_device *clkevt)
11911 + return container_of(clkevt, struct tc_clkevt_device, clkevt);
11914 +/* For now, we always use the 32K clock ... this optimizes for NO_HZ,
11915 + * because using one of the divided clocks would usually mean the
11916 + * tick rate can never be less than several dozen Hz (vs 0.5 Hz).
11918 + * A divided clock could be good for high resolution timers, since
11919 + * 30.5 usec resolution can seem "low".
11921 +static u32 timer_clock;
11923 +static void tc_mode(enum clock_event_mode m, struct clock_event_device *d)
11925 + struct tc_clkevt_device *tcd = to_tc_clkevt(d);
11926 + void __iomem *regs = tcd->regs;
11928 + if (tcd->clkevt.mode == CLOCK_EVT_MODE_PERIODIC
11929 + || tcd->clkevt.mode == CLOCK_EVT_MODE_ONESHOT) {
11930 + __raw_writel(0xff, regs + ATMEL_TC_REG(2, IDR));
11931 + __raw_writel(ATMEL_TC_CLKDIS, regs + ATMEL_TC_REG(2, CCR));
11932 + clk_disable(tcd->clk);
11937 + /* By not making the gentime core emulate periodic mode on top
11938 + * of oneshot, we get lower overhead and improved accuracy.
11940 + case CLOCK_EVT_MODE_PERIODIC:
11941 + clk_enable(tcd->clk);
11943 + /* slow clock, count up to RC, then irq and restart */
11944 + __raw_writel(timer_clock
11945 + | ATMEL_TC_WAVE | ATMEL_TC_WAVESEL_UP_AUTO,
11946 + regs + ATMEL_TC_REG(2, CMR));
11947 + __raw_writel((32768 + HZ/2) / HZ, tcaddr + ATMEL_TC_REG(2, RC));
11949 + /* Enable clock and interrupts on RC compare */
11950 + __raw_writel(ATMEL_TC_CPCS, regs + ATMEL_TC_REG(2, IER));
11952 + /* go go gadget! */
11953 + __raw_writel(ATMEL_TC_CLKEN | ATMEL_TC_SWTRG,
11954 + regs + ATMEL_TC_REG(2, CCR));
11957 + case CLOCK_EVT_MODE_ONESHOT:
11958 + clk_enable(tcd->clk);
11960 + /* slow clock, count up to RC, then irq and stop */
11961 + __raw_writel(timer_clock | ATMEL_TC_CPCSTOP
11962 + | ATMEL_TC_WAVE | ATMEL_TC_WAVESEL_UP_AUTO,
11963 + regs + ATMEL_TC_REG(2, CMR));
11964 + __raw_writel(ATMEL_TC_CPCS, regs + ATMEL_TC_REG(2, IER));
11966 + /* set_next_event() configures and starts the timer */
11974 +static int tc_next_event(unsigned long delta, struct clock_event_device *d)
11976 + __raw_writel(delta, tcaddr + ATMEL_TC_REG(2, RC));
11978 + /* go go gadget! */
11979 + __raw_writel(ATMEL_TC_CLKEN | ATMEL_TC_SWTRG,
11980 + tcaddr + ATMEL_TC_REG(2, CCR));
11984 +static struct tc_clkevt_device clkevt = {
11986 + .name = "tc_clkevt",
11987 + .features = CLOCK_EVT_FEAT_PERIODIC
11988 + | CLOCK_EVT_FEAT_ONESHOT,
11990 + /* Should be lower than at91rm9200's system timer */
11992 + .cpumask = CPU_MASK_CPU0,
11993 + .set_next_event = tc_next_event,
11994 + .set_mode = tc_mode,
11998 +static irqreturn_t ch2_irq(int irq, void *handle)
12000 + struct tc_clkevt_device *dev = handle;
12003 + sr = __raw_readl(dev->regs + ATMEL_TC_REG(2, SR));
12004 + if (sr & ATMEL_TC_CPCS) {
12005 + dev->clkevt.event_handler(&dev->clkevt);
12006 + return IRQ_HANDLED;
12012 +static struct irqaction tc_irqaction = {
12013 + .name = "tc_clkevt",
12014 + .flags = IRQF_TIMER | IRQF_DISABLED,
12015 + .handler = ch2_irq,
12018 +static void __init setup_clkevents(struct atmel_tc *tc,
12019 + struct clk *t0_clk, int clk32k_divisor_idx)
12021 + struct platform_device *pdev = tc->pdev;
12022 + struct clk *t2_clk = tc->clk[2];
12023 + int irq = tc->irq[2];
12025 + clkevt.regs = tc->regs;
12026 + clkevt.clk = t2_clk;
12027 + tc_irqaction.dev_id = &clkevt;
12029 + timer_clock = clk32k_divisor_idx;
12031 + clkevt.clkevt.mult = div_sc(32768, NSEC_PER_SEC, clkevt.clkevt.shift);
12032 + clkevt.clkevt.max_delta_ns
12033 + = clockevent_delta2ns(0xffff, &clkevt.clkevt);
12034 + clkevt.clkevt.min_delta_ns = clockevent_delta2ns(1, &clkevt.clkevt) + 1;
12036 + setup_irq(irq, &tc_irqaction);
12038 + clockevents_register_device(&clkevt.clkevt);
12041 +#else /* !CONFIG_GENERIC_CLOCKEVENTS */
12043 +static void __init setup_clkevents(struct atmel_tc *tc,
12044 + struct clk *t0_clk, int clk32k_divisor_idx)
12051 +static int __init tcb_clksrc_init(void)
12053 + static char bootinfo[] __initdata
12054 + = KERN_DEBUG "%s: tc%d at %d.%03d MHz\n";
12056 + struct platform_device *pdev;
12057 + struct atmel_tc *tc;
12058 + struct clk *t0_clk, *t1_clk;
12059 + u32 rate, divided_rate = 0;
12060 + int best_divisor_idx = -1;
12061 + int clk32k_divisor_idx = -1;
12064 + tc = atmel_tc_alloc(CONFIG_ATMEL_TCB_CLKSRC_BLOCK, clksrc.name);
12066 + pr_debug("can't alloc TC for clocksource\n");
12069 + tcaddr = tc->regs;
12072 + t0_clk = tc->clk[0];
12073 + clk_enable(t0_clk);
12075 + /* How fast will we be counting? Pick something over 5 MHz. */
12076 + rate = (u32) clk_get_rate(t0_clk);
12077 + for (i = 0; i < 5; i++) {
12078 + unsigned divisor = atmel_tc_divisors[i];
12081 + /* remember 32 KiHz clock for later */
12083 + clk32k_divisor_idx = i;
12087 + tmp = rate / divisor;
12088 + pr_debug("TC: %u / %-3u [%d] --> %u\n", rate, divisor, i, tmp);
12089 + if (best_divisor_idx > 0) {
12090 + if (tmp < 5 * 1000 * 1000)
12093 + divided_rate = tmp;
12094 + best_divisor_idx = i;
12097 + clksrc.mult = clocksource_hz2mult(divided_rate, clksrc.shift);
12099 + printk(bootinfo, clksrc.name, CONFIG_ATMEL_TCB_CLKSRC_BLOCK,
12100 + divided_rate / 1000000,
12101 + ((divided_rate + 500000) % 1000000) / 1000);
12103 + /* tclib will give us three clocks no matter what the
12104 + * underlying platform supports.
12106 + clk_enable(tc->clk[1]);
12108 + /* channel 0: waveform mode, input mclk/8, clock TIOA0 on overflow */
12109 + __raw_writel(best_divisor_idx /* likely divide-by-8 */
12111 + | ATMEL_TC_WAVESEL_UP /* free-run */
12112 + | ATMEL_TC_ACPA_SET /* TIOA0 rises at 0 */
12113 + | ATMEL_TC_ACPC_CLEAR, /* (duty cycle 50%) */
12114 + tcaddr + ATMEL_TC_REG(0, CMR));
12115 + __raw_writel(0x0000, tcaddr + ATMEL_TC_REG(0, RA));
12116 + __raw_writel(0x8000, tcaddr + ATMEL_TC_REG(0, RC));
12117 + __raw_writel(0xff, tcaddr + ATMEL_TC_REG(0, IDR)); /* no irqs */
12118 + __raw_writel(ATMEL_TC_CLKEN, tcaddr + ATMEL_TC_REG(0, CCR));
12120 + /* channel 1: waveform mode, input TIOA0 */
12121 + __raw_writel(ATMEL_TC_XC1 /* input: TIOA0 */
12123 + | ATMEL_TC_WAVESEL_UP, /* free-run */
12124 + tcaddr + ATMEL_TC_REG(1, CMR));
12125 + __raw_writel(0xff, tcaddr + ATMEL_TC_REG(1, IDR)); /* no irqs */
12126 + __raw_writel(ATMEL_TC_CLKEN, tcaddr + ATMEL_TC_REG(1, CCR));
12128 + /* chain channel 0 to channel 1, then reset all the timers */
12129 + __raw_writel(ATMEL_TC_TC1XC1S_TIOA0, tcaddr + ATMEL_TC_BMR);
12130 + __raw_writel(ATMEL_TC_SYNC, tcaddr + ATMEL_TC_BCR);
12132 + /* and away we go! */
12133 + clocksource_register(&clksrc);
12135 + /* channel 2: periodic and oneshot timer support */
12136 + setup_clkevents(tc, t0_clk, clk32k_divisor_idx);
12140 +arch_initcall(tcb_clksrc_init);
12141 diff -urN linux-2.6.24.3/drivers/i2c/busses/i2c-atmeltwi.c avr32-2.6/drivers/i2c/busses/i2c-atmeltwi.c
12142 --- linux-2.6.24.3/drivers/i2c/busses/i2c-atmeltwi.c 1970-01-01 01:00:00.000000000 +0100
12143 +++ avr32-2.6/drivers/i2c/busses/i2c-atmeltwi.c 2008-04-23 19:33:37.000000000 +0200
12146 + * i2c Support for Atmel's Two-Wire Interface (TWI)
12148 + * Based on the work of Copyright (C) 2004 Rick Bronson
12149 + * Converted to 2.6 by Andrew Victor <andrew at sanpeople.com>
12150 + * Ported to AVR32 and heavily modified by Espen Krangnes
12151 + * <ekrangnes at atmel.com>
12153 + * Copyright (C) 2006 Atmel Corporation
12155 + * Borrowed heavily from the original work by:
12156 + * Copyright (C) 2000 Philip Edelbrock <phil at stimpy.netroedge.com>
12158 + * Partialy rewriten by Karel Hojdar <cmkaho at seznam.cz>
12159 + * bugs removed, interrupt routine markedly rewritten
12161 + * This program is free software; you can redistribute it and/or modify
12162 + * it under the terms of the GNU General Public License as published by
12163 + * the Free Software Foundation; either version 2 of the License, or
12164 + * (at your option) any later version.
12166 +#undef VERBOSE_DEBUG
12168 +#include <linux/module.h>
12169 +#include <linux/slab.h>
12170 +#include <linux/i2c.h>
12171 +#include <linux/init.h>
12172 +#include <linux/clk.h>
12173 +#include <linux/err.h>
12174 +#include <linux/interrupt.h>
12175 +#include <linux/platform_device.h>
12176 +#include <linux/completion.h>
12177 +#include <linux/io.h>
12179 +#include "i2c-atmeltwi.h"
12181 +static unsigned int baudrate = 100 * 1000;
12182 +module_param(baudrate, uint, S_IRUGO);
12183 +MODULE_PARM_DESC(baudrate, "The TWI baudrate");
12186 +struct atmel_twi {
12187 + void __iomem *regs;
12188 + struct i2c_adapter adapter;
12189 + struct clk *pclk;
12190 + struct completion comp;
12196 + unsigned int irq;
12199 +#define to_atmel_twi(adap) container_of(adap, struct atmel_twi, adapter)
12202 + * (Re)Initialize the TWI hardware registers.
12204 +static int twi_hwinit(struct atmel_twi *twi)
12206 + unsigned long cdiv, ckdiv = 0;
12208 + /* REVISIT: wait till SCL is high before resetting; otherwise,
12209 + * some versions will wedge forever.
12212 + twi_writel(twi, IDR, ~0UL);
12213 + twi_writel(twi, CR, TWI_BIT(SWRST)); /*Reset peripheral*/
12214 + twi_readl(twi, SR);
12216 + cdiv = (clk_get_rate(twi->pclk) / (2 * baudrate)) - 4;
12218 + while (cdiv > 255) {
12220 + cdiv = cdiv >> 1;
12223 + /* REVISIT: there are various errata to consider re CDIV and CHDIV
12224 + * here, at least on at91 parts.
12230 + twi_writel(twi, CWGR, TWI_BF(CKDIV, ckdiv)
12231 + | TWI_BF(CHDIV, cdiv)
12232 + | TWI_BF(CLDIV, cdiv));
12237 + * Waits for the i2c status register to set the specified bitmask
12238 + * Returns 0 if timed out ... ~100ms is much longer than the SMBus
12239 + * limit, but I2C has no limit at all.
12241 +static int twi_complete(struct atmel_twi *twi, u32 mask)
12243 + int timeout = msecs_to_jiffies(100);
12245 + mask |= TWI_BIT(TXCOMP);
12246 + twi->mask = mask | TWI_BIT(NACK) | TWI_BIT(OVRE);
12247 + init_completion(&twi->comp);
12249 + twi_writel(twi, IER, mask);
12251 + if (!wait_for_completion_timeout(&twi->comp, timeout)) {
12252 + /* RESET TWI interface */
12253 + twi_writel(twi, CR, TWI_BIT(SWRST));
12255 + /* Reinitialize TWI */
12258 + return -ETIMEDOUT;
12264 + * Generic i2c master transfer entrypoint.
12266 +static int twi_xfer(struct i2c_adapter *adap, struct i2c_msg *pmsg, int num)
12268 + struct atmel_twi *twi = to_atmel_twi(adap);
12271 + dev_dbg(&adap->dev, "twi_xfer: processing %d messages:\n", num);
12274 + for (i = 0; i < num; i++, pmsg++) {
12275 + twi->len = pmsg->len;
12276 + twi->buf = pmsg->buf;
12277 + twi->acks_left = pmsg->len;
12278 + twi_writel(twi, MMR, TWI_BF(DADR, pmsg->addr) |
12279 + (pmsg->flags & I2C_M_RD ? TWI_BIT(MREAD) : 0));
12280 + twi_writel(twi, IADR, TWI_BF(IADR, pmsg->addr));
12282 + dev_dbg(&adap->dev,
12283 + "#%d: %s %d byte%s %s dev 0x%02x\n",
12285 + pmsg->flags & I2C_M_RD ? "reading" : "writing",
12287 + pmsg->len > 1 ? "s" : "",
12288 + pmsg->flags & I2C_M_RD ? "from" : "to", pmsg->addr);
12291 + twi_writel(twi, CR, TWI_BIT(MSEN));
12293 + if (pmsg->flags & I2C_M_RD) {
12294 + /* cleanup after previous RX overruns */
12295 + while (twi_readl(twi, SR) & TWI_BIT(RXRDY))
12296 + twi_readl(twi, RHR);
12298 + if (twi->len == 1)
12299 + twi_writel(twi, CR,
12300 + TWI_BIT(START) | TWI_BIT(STOP));
12302 + twi_writel(twi, CR, TWI_BIT(START));
12304 + if (twi_complete(twi, TWI_BIT(RXRDY)) == -ETIMEDOUT) {
12305 + dev_dbg(&adap->dev, "RX[%d] timeout. "
12306 + "Stopped with %d bytes left\n",
12307 + i, twi->acks_left);
12308 + return -ETIMEDOUT;
12311 + twi_writel(twi, THR, twi->buf[0]);
12312 + twi->acks_left--;
12313 + /* REVISIT: some chips don't start automagically:
12314 + * twi_writel(twi, CR, TWI_BIT(START));
12316 + if (twi_complete(twi, TWI_BIT(TXRDY)) == -ETIMEDOUT) {
12317 + dev_dbg(&adap->dev, "TX[%d] timeout. "
12318 + "Stopped with %d bytes left\n",
12319 + i, twi->acks_left);
12320 + return -ETIMEDOUT;
12322 + /* REVISIT: an erratum workaround may be needed here;
12323 + * see sam9261 "STOP not generated" (START either).
12327 + /* Disable TWI interface */
12328 + twi_writel(twi, CR, TWI_BIT(MSDIS));
12331 + return twi->status;
12333 + /* WARNING: This driver lies about properly supporting
12334 + * repeated start, or it would *ALWAYS* return here. It
12335 + * has issued a STOP. Continuing is a false claim -- that
12336 + * a second (or third, etc.) message is part of the same
12337 + * "combined" (no STOPs between parts) message.
12340 + } /* end cur msg */
12346 +static irqreturn_t twi_interrupt(int irq, void *dev_id)
12348 + struct atmel_twi *twi = dev_id;
12349 + int status = twi_readl(twi, SR);
12351 + /* Save state for later debug prints */
12352 + int old_status = status;
12354 + if (twi->mask & status) {
12356 + status &= twi->mask;
12358 + if (status & TWI_BIT(RXRDY)) {
12359 + if ((status & TWI_BIT(OVRE)) && twi->acks_left) {
12360 + /* Note weakness in fault reporting model:
12361 + * we can't say "the first N of these data
12362 + * bytes are valid".
12364 + dev_err(&twi->adapter.dev,
12365 + "OVERRUN RX! %04x, lost %d\n",
12366 + old_status, twi->acks_left);
12367 + twi->acks_left = 0;
12368 + twi_writel(twi, CR, TWI_BIT(STOP));
12369 + twi->status = -EOVERFLOW;
12370 + } else if (twi->acks_left > 0) {
12371 + twi->buf[twi->len - twi->acks_left] =
12372 + twi_readl(twi, RHR);
12373 + twi->acks_left--;
12375 + if (status & TWI_BIT(TXCOMP))
12377 + if (twi->acks_left == 1)
12378 + twi_writel(twi, CR, TWI_BIT(STOP));
12380 + } else if (status & (TWI_BIT(NACK) | TWI_BIT(TXCOMP))) {
12383 + } else if (status & TWI_BIT(TXRDY)) {
12384 + if (twi->acks_left > 0) {
12385 + twi_writel(twi, THR,
12386 + twi->buf[twi->len - twi->acks_left]);
12387 + twi->acks_left--;
12389 + twi_writel(twi, CR, TWI_BIT(STOP));
12392 + if (twi->acks_left == 0)
12393 + twi_writel(twi, IDR, ~TWI_BIT(TXCOMP));
12396 + /* enabling this message helps trigger overruns/underruns ... */
12397 + dev_vdbg(&twi->adapter.dev,
12398 + "ISR: SR 0x%04X, mask 0x%04X, acks %i\n",
12400 + twi->acks_left ? twi->mask : TWI_BIT(TXCOMP),
12403 + return IRQ_HANDLED;
12406 + /* Note weak fault reporting model: we can't report how many
12407 + * bytes we sent before the NAK, or let upper layers choose
12408 + * whether to continue. The I2C stack doesn't allow that...
12410 + if (status & TWI_BIT(NACK)) {
12411 + dev_dbg(&twi->adapter.dev, "NACK received! %d to go\n",
12413 + twi->status = -EPIPE;
12415 + /* TX underrun morphs automagically into a premature STOP;
12416 + * we'll probably observe UVRE even when it's not documented.
12418 + } else if (twi->acks_left && (twi->mask & TWI_BIT(TXRDY))) {
12419 + dev_err(&twi->adapter.dev, "UNDERRUN TX! %04x, %d to go\n",
12420 + old_status, twi->acks_left);
12421 + twi->status = -ENOSR;
12424 + twi_writel(twi, IDR, ~0UL);
12425 + complete(&twi->comp);
12427 + dev_dbg(&twi->adapter.dev, "ISR: SR 0x%04X, acks %i --> %d\n",
12428 + old_status, twi->acks_left, twi->status);
12430 + return IRQ_HANDLED;
12435 + * Return list of supported functionality.
12437 + * NOTE: see warning above about repeated starts; this driver is falsely
12438 + * claiming to support "combined" transfers. The mid-message STOPs mean
12439 + * some slaves will never work with this driver. (Use i2c-gpio...)
12441 +static u32 twi_func(struct i2c_adapter *adapter)
12443 + return (I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL)
12444 + & ~I2C_FUNC_SMBUS_QUICK;
12447 +static struct i2c_algorithm twi_algorithm = {
12448 + .master_xfer = twi_xfer,
12449 + .functionality = twi_func,
12453 + * Main initialization routine.
12455 +static int __init twi_probe(struct platform_device *pdev)
12457 + struct atmel_twi *twi;
12458 + struct resource *regs;
12459 + struct clk *pclk;
12460 + struct i2c_adapter *adapter;
12463 + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
12467 + pclk = clk_get(&pdev->dev, "twi_pclk");
12468 + if (IS_ERR(pclk))
12469 + return PTR_ERR(pclk);
12470 + clk_enable(pclk);
12473 + twi = kzalloc(sizeof(struct atmel_twi), GFP_KERNEL);
12475 + dev_dbg(&pdev->dev, "can't allocate interface!\n");
12476 + goto err_alloc_twi;
12479 + twi->pclk = pclk;
12480 + twi->regs = ioremap(regs->start, regs->end - regs->start + 1);
12482 + goto err_ioremap;
12484 + irq = platform_get_irq(pdev, 0);
12485 + rc = request_irq(irq, twi_interrupt, 0, "twi", twi);
12487 + dev_dbg(&pdev->dev, "can't bind irq!\n");
12492 + rc = twi_hwinit(twi);
12494 + dev_err(&pdev->dev, "Unable to set baudrate\n");
12495 + goto err_hw_init;
12498 + adapter = &twi->adapter;
12499 + sprintf(adapter->name, "TWI");
12500 + adapter->algo = &twi_algorithm;
12501 + adapter->class = I2C_CLASS_ALL;
12502 + adapter->nr = pdev->id;
12503 + adapter->dev.parent = &pdev->dev;
12505 + platform_set_drvdata(pdev, twi);
12507 + rc = i2c_add_numbered_adapter(adapter);
12509 + dev_dbg(&pdev->dev, "Adapter %s registration failed\n",
12511 + goto err_register;
12514 + dev_info(&pdev->dev,
12515 + "Atmel TWI/I2C adapter (baudrate %dk) at 0x%08lx.\n",
12516 + baudrate/1000, (unsigned long)regs->start);
12522 + platform_set_drvdata(pdev, NULL);
12525 + free_irq(irq, twi);
12528 + iounmap(twi->regs);
12534 + clk_disable(pclk);
12540 +static int __exit twi_remove(struct platform_device *pdev)
12542 + struct atmel_twi *twi = platform_get_drvdata(pdev);
12545 + platform_set_drvdata(pdev, NULL);
12546 + res = i2c_del_adapter(&twi->adapter);
12547 + twi_writel(twi, CR, TWI_BIT(MSDIS));
12548 + iounmap(twi->regs);
12549 + clk_disable(twi->pclk);
12550 + clk_put(twi->pclk);
12551 + free_irq(twi->irq, twi);
12557 +static struct platform_driver twi_driver = {
12558 + .remove = __exit_p(twi_remove),
12560 + .name = "atmel_twi",
12561 + .owner = THIS_MODULE,
12565 +static int __init atmel_twi_init(void)
12567 + return platform_driver_probe(&twi_driver, twi_probe);
12570 +static void __exit atmel_twi_exit(void)
12572 + platform_driver_unregister(&twi_driver);
12575 +module_init(atmel_twi_init);
12576 +module_exit(atmel_twi_exit);
12578 +MODULE_AUTHOR("Espen Krangnes");
12579 +MODULE_DESCRIPTION("I2C driver for Atmel TWI");
12580 +MODULE_LICENSE("GPL");
12581 diff -urN linux-2.6.24.3/drivers/i2c/busses/i2c-atmeltwi.h avr32-2.6/drivers/i2c/busses/i2c-atmeltwi.h
12582 --- linux-2.6.24.3/drivers/i2c/busses/i2c-atmeltwi.h 1970-01-01 01:00:00.000000000 +0100
12583 +++ avr32-2.6/drivers/i2c/busses/i2c-atmeltwi.h 2008-04-23 19:33:37.000000000 +0200
12586 + * Register definitions for the Atmel Two-Wire Interface
12589 +#ifndef __ATMELTWI_H__
12590 +#define __ATMELTWI_H__
12592 +/* TWI register offsets */
12593 +#define TWI_CR 0x0000
12594 +#define TWI_MMR 0x0004
12595 +#define TWI_SMR 0x0008
12596 +#define TWI_IADR 0x000c
12597 +#define TWI_CWGR 0x0010
12598 +#define TWI_SR 0x0020
12599 +#define TWI_IER 0x0024
12600 +#define TWI_IDR 0x0028
12601 +#define TWI_IMR 0x002c
12602 +#define TWI_RHR 0x0030
12603 +#define TWI_THR 0x0034
12605 +/* Bitfields in CR */
12606 +#define TWI_START_OFFSET 0
12607 +#define TWI_START_SIZE 1
12608 +#define TWI_STOP_OFFSET 1
12609 +#define TWI_STOP_SIZE 1
12610 +#define TWI_MSEN_OFFSET 2
12611 +#define TWI_MSEN_SIZE 1
12612 +#define TWI_MSDIS_OFFSET 3
12613 +#define TWI_MSDIS_SIZE 1
12614 +#define TWI_SVEN_OFFSET 4
12615 +#define TWI_SVEN_SIZE 1
12616 +#define TWI_SVDIS_OFFSET 5
12617 +#define TWI_SVDIS_SIZE 1
12618 +#define TWI_SWRST_OFFSET 7
12619 +#define TWI_SWRST_SIZE 1
12621 +/* Bitfields in MMR */
12622 +#define TWI_IADRSZ_OFFSET 8
12623 +#define TWI_IADRSZ_SIZE 2
12624 +#define TWI_MREAD_OFFSET 12
12625 +#define TWI_MREAD_SIZE 1
12626 +#define TWI_DADR_OFFSET 16
12627 +#define TWI_DADR_SIZE 7
12629 +/* Bitfields in SMR */
12630 +#define TWI_SADR_OFFSET 16
12631 +#define TWI_SADR_SIZE 7
12633 +/* Bitfields in IADR */
12634 +#define TWI_IADR_OFFSET 0
12635 +#define TWI_IADR_SIZE 24
12637 +/* Bitfields in CWGR */
12638 +#define TWI_CLDIV_OFFSET 0
12639 +#define TWI_CLDIV_SIZE 8
12640 +#define TWI_CHDIV_OFFSET 8
12641 +#define TWI_CHDIV_SIZE 8
12642 +#define TWI_CKDIV_OFFSET 16
12643 +#define TWI_CKDIV_SIZE 3
12645 +/* Bitfields in SR */
12646 +#define TWI_TXCOMP_OFFSET 0
12647 +#define TWI_TXCOMP_SIZE 1
12648 +#define TWI_RXRDY_OFFSET 1
12649 +#define TWI_RXRDY_SIZE 1
12650 +#define TWI_TXRDY_OFFSET 2
12651 +#define TWI_TXRDY_SIZE 1
12652 +#define TWI_SVDIR_OFFSET 3
12653 +#define TWI_SVDIR_SIZE 1
12654 +#define TWI_SVACC_OFFSET 4
12655 +#define TWI_SVACC_SIZE 1
12656 +#define TWI_GCACC_OFFSET 5
12657 +#define TWI_GCACC_SIZE 1
12658 +#define TWI_OVRE_OFFSET 6
12659 +#define TWI_OVRE_SIZE 1
12660 +#define TWI_UNRE_OFFSET 7
12661 +#define TWI_UNRE_SIZE 1
12662 +#define TWI_NACK_OFFSET 8
12663 +#define TWI_NACK_SIZE 1
12664 +#define TWI_ARBLST_OFFSET 9
12665 +#define TWI_ARBLST_SIZE 1
12667 +/* Bitfields in RHR */
12668 +#define TWI_RXDATA_OFFSET 0
12669 +#define TWI_RXDATA_SIZE 8
12671 +/* Bitfields in THR */
12672 +#define TWI_TXDATA_OFFSET 0
12673 +#define TWI_TXDATA_SIZE 8
12675 +/* Constants for IADRSZ */
12676 +#define TWI_IADRSZ_NO_ADDR 0
12677 +#define TWI_IADRSZ_ONE_BYTE 1
12678 +#define TWI_IADRSZ_TWO_BYTES 2
12679 +#define TWI_IADRSZ_THREE_BYTES 3
12681 +/* Bit manipulation macros */
12682 +#define TWI_BIT(name) \
12683 + (1 << TWI_##name##_OFFSET)
12684 +#define TWI_BF(name, value) \
12685 + (((value) & ((1 << TWI_##name##_SIZE) - 1)) \
12686 + << TWI_##name##_OFFSET)
12687 +#define TWI_BFEXT(name, value) \
12688 + (((value) >> TWI_##name##_OFFSET) \
12689 + & ((1 << TWI_##name##_SIZE) - 1))
12690 +#define TWI_BFINS(name, value, old) \
12691 + (((old) & ~(((1 << TWI_##name##_SIZE) - 1) \
12692 + << TWI_##name##_OFFSET)) \
12693 + | TWI_BF(name, (value)))
12695 +/* Register access macros */
12696 +#define twi_readl(port, reg) \
12697 + __raw_readl((port)->regs + TWI_##reg)
12698 +#define twi_writel(port, reg, value) \
12699 + __raw_writel((value), (port)->regs + TWI_##reg)
12701 +#endif /* __ATMELTWI_H__ */
12702 diff -urN linux-2.6.24.3/drivers/i2c/busses/Kconfig avr32-2.6/drivers/i2c/busses/Kconfig
12703 --- linux-2.6.24.3/drivers/i2c/busses/Kconfig 2008-02-26 01:20:20.000000000 +0100
12704 +++ avr32-2.6/drivers/i2c/busses/Kconfig 2008-04-23 20:12:40.000000000 +0200
12706 to support combined I2C messages. Use the i2c-gpio driver
12707 unless your system can cope with those limitations.
12709 +config I2C_ATMELTWI
12710 + tristate "Atmel Two-Wire Interface (TWI)"
12711 + depends on I2C && (ARCH_AT91 || PLATFORM_AT32AP)
12713 + Atmel on-chip TWI controller. Say Y if you have an AT32 or
12714 + AT91-based device and want to use its built-in TWI
12718 tristate "Au1550/Au1200 SMBus interface"
12719 depends on SOC_AU1550 || SOC_AU1200
12720 diff -urN linux-2.6.24.3/drivers/i2c/busses/Makefile avr32-2.6/drivers/i2c/busses/Makefile
12721 --- linux-2.6.24.3/drivers/i2c/busses/Makefile 2008-02-26 01:20:20.000000000 +0100
12722 +++ avr32-2.6/drivers/i2c/busses/Makefile 2008-04-23 20:12:40.000000000 +0200
12724 obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o
12725 obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
12726 obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o
12727 +obj-$(CONFIG_I2C_ATMELTWI) += i2c-atmeltwi.o
12729 ifeq ($(CONFIG_I2C_DEBUG_BUS),y)
12730 EXTRA_CFLAGS += -DDEBUG
12731 diff -urN linux-2.6.24.3/drivers/input/serio/at32psif.c avr32-2.6/drivers/input/serio/at32psif.c
12732 --- linux-2.6.24.3/drivers/input/serio/at32psif.c 1970-01-01 01:00:00.000000000 +0100
12733 +++ avr32-2.6/drivers/input/serio/at32psif.c 2008-04-23 20:12:40.000000000 +0200
12736 + * Copyright (C) 2007 Atmel Corporation
12738 + * Driver for the AT32AP700X PS/2 controller (PSIF).
12740 + * This program is free software; you can redistribute it and/or modify it
12741 + * under the terms of the GNU General Public License version 2 as published
12742 + * by the Free Software Foundation.
12744 +#include <linux/kernel.h>
12745 +#include <linux/module.h>
12746 +#include <linux/device.h>
12747 +#include <linux/init.h>
12748 +#include <linux/serio.h>
12749 +#include <linux/timer.h>
12750 +#include <linux/interrupt.h>
12751 +#include <linux/err.h>
12752 +#include <linux/io.h>
12753 +#include <linux/clk.h>
12754 +#include <linux/platform_device.h>
12756 +#include "at32psif.h"
12758 +#define PSIF_BUF_SIZE 16
12760 +#define ring_is_empty(_psif) (_psif->head == _psif->tail)
12761 +#define ring_next_head(_psif) ((_psif->head + 1) & (PSIF_BUF_SIZE - 1))
12762 +#define ring_next_tail(_psif) ((_psif->tail + 1) & (PSIF_BUF_SIZE - 1))
12765 + struct platform_device *pdev;
12766 + struct clk *pclk;
12767 + struct serio *io;
12768 + struct timer_list tx_timer;
12769 + void __iomem *regs;
12770 + unsigned int irq;
12771 + unsigned int open;
12772 + /* Prevent concurrent writes to circular buffer. */
12774 + unsigned int head;
12775 + unsigned int tail;
12776 + unsigned char buffer[PSIF_BUF_SIZE];
12779 +static irqreturn_t psif_interrupt(int irq, void *_ptr)
12781 + struct psif *psif = _ptr;
12782 + int retval = IRQ_NONE;
12783 + unsigned int io_flags = 0;
12784 + unsigned long status;
12786 + status = psif_readl(psif, SR);
12788 + if (status & PSIF_BIT(RXRDY)) {
12789 + unsigned char val = (unsigned char) psif_readl(psif, RHR);
12791 + if (status & PSIF_BIT(PARITY))
12792 + io_flags |= SERIO_PARITY;
12793 + if (status & PSIF_BIT(OVRUN))
12794 + dev_err(&psif->pdev->dev, "overrun read error\n");
12796 + serio_interrupt(psif->io, val, io_flags);
12798 + retval = IRQ_HANDLED;
12801 + spin_lock(&psif->lock);
12803 + if (status & PSIF_BIT(TXEMPTY)) {
12804 + if (status & PSIF_BIT(NACK))
12805 + dev_err(&psif->pdev->dev, "NACK error\n");
12807 + psif_writel(psif, IDR, PSIF_BIT(TXEMPTY));
12809 + if (!ring_is_empty(psif))
12810 + mod_timer(&psif->tx_timer,
12811 + jiffies + msecs_to_jiffies(1));
12813 + retval = IRQ_HANDLED;
12816 + spin_unlock(&psif->lock);
12821 +static void psif_transmit_data(unsigned long data)
12823 + struct psif *psif = (struct psif *)data;
12824 + unsigned long flags;
12826 + spin_lock_irqsave(&psif->lock, flags);
12828 + psif_writel(psif, THR, psif->buffer[psif->tail]);
12829 + psif->tail = ring_next_tail(psif);
12831 + if (!ring_is_empty(psif))
12832 + psif_writel(psif, IER, PSIF_BIT(TXEMPTY));
12834 + spin_unlock_irqrestore(&psif->lock, flags);
12837 +static int psif_write(struct serio *io, unsigned char val)
12839 + struct psif *psif = io->port_data;
12840 + unsigned long flags;
12841 + unsigned int head;
12843 + spin_lock_irqsave(&psif->lock, flags);
12845 + head = ring_next_head(psif);
12847 + if (head != psif->tail) {
12848 + psif->buffer[psif->head] = val;
12849 + psif->head = head;
12851 + dev_err(&psif->pdev->dev, "underrun write error\n");
12854 + spin_unlock_irqrestore(&psif->lock, flags);
12856 + /* Make sure TXEMPTY interrupt is enabled. */
12857 + psif_writel(psif, IER, PSIF_BIT(TXEMPTY));
12862 +static int psif_open(struct serio *io)
12864 + struct psif *psif = io->port_data;
12867 + retval = clk_enable(psif->pclk);
12871 + psif_writel(psif, CR, PSIF_BIT(CR_TXEN) | PSIF_BIT(CR_RXEN));
12872 + psif_writel(psif, IER, PSIF_BIT(RXRDY));
12879 +static void psif_close(struct serio *io)
12881 + struct psif *psif = io->port_data;
12885 + psif_writel(psif, IDR, ~0UL);
12886 + psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS));
12888 + clk_disable(psif->pclk);
12891 +static void psif_set_prescaler(struct psif *psif)
12893 + unsigned long prscv;
12894 + unsigned long rate = clk_get_rate(psif->pclk);
12896 + /* PRSCV = Pulse length (100 us) * PSIF module frequency. */
12897 + prscv = 100 * (rate / 1000000UL);
12899 + if (prscv > ((1<<PSIF_PSR_PRSCV_SIZE) - 1)) {
12900 + prscv = (1<<PSIF_PSR_PRSCV_SIZE) - 1;
12901 + dev_dbg(&psif->pdev->dev, "pclk too fast, "
12902 + "prescaler set to max\n");
12905 + clk_enable(psif->pclk);
12906 + psif_writel(psif, PSR, prscv);
12907 + clk_disable(psif->pclk);
12910 +static int __init psif_probe(struct platform_device *pdev)
12912 + struct resource *regs;
12913 + struct psif *psif;
12914 + struct serio *io;
12915 + struct clk *pclk;
12919 + psif = kzalloc(sizeof(struct psif), GFP_KERNEL);
12921 + dev_dbg(&pdev->dev, "out of memory\n");
12925 + psif->pdev = pdev;
12927 + io = kzalloc(sizeof(struct serio), GFP_KERNEL);
12929 + dev_dbg(&pdev->dev, "out of memory\n");
12931 + goto out_free_psif;
12935 + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
12937 + dev_dbg(&pdev->dev, "no mmio resources defined\n");
12939 + goto out_free_io;
12942 + psif->regs = ioremap(regs->start, regs->end - regs->start + 1);
12943 + if (!psif->regs) {
12945 + dev_dbg(&pdev->dev, "could not map I/O memory\n");
12946 + goto out_free_io;
12949 + pclk = clk_get(&pdev->dev, "pclk");
12950 + if (IS_ERR(pclk)) {
12951 + dev_dbg(&pdev->dev, "could not get peripheral clock\n");
12952 + ret = PTR_ERR(pclk);
12953 + goto out_iounmap;
12955 + psif->pclk = pclk;
12957 + /* Reset the PSIF to enter at a known state. */
12958 + ret = clk_enable(pclk);
12960 + dev_dbg(&pdev->dev, "could not enable pclk\n");
12961 + goto out_put_clk;
12963 + psif_writel(psif, CR, PSIF_BIT(CR_SWRST));
12964 + clk_disable(pclk);
12966 + setup_timer(&psif->tx_timer, psif_transmit_data, (unsigned long)psif);
12968 + irq = platform_get_irq(pdev, 0);
12970 + dev_dbg(&pdev->dev, "could not get irq\n");
12972 + goto out_put_clk;
12974 + ret = request_irq(irq, psif_interrupt, IRQF_SHARED, "at32psif", psif);
12976 + dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
12977 + goto out_put_clk;
12981 + io->id.type = SERIO_8042;
12982 + io->write = psif_write;
12983 + io->open = psif_open;
12984 + io->close = psif_close;
12985 + strlcpy(io->name, pdev->dev.bus_id, sizeof(io->name));
12986 + strlcpy(io->phys, pdev->dev.bus_id, sizeof(io->phys));
12987 + io->port_data = psif;
12988 + io->dev.parent = &pdev->dev;
12990 + psif_set_prescaler(psif);
12992 + spin_lock_init(&psif->lock);
12993 + serio_register_port(psif->io);
12994 + platform_set_drvdata(pdev, psif);
12996 + dev_info(&pdev->dev, "Atmel AVR32 PSIF PS/2 driver on 0x%08x irq %d\n",
12997 + (int)psif->regs, psif->irq);
13002 + clk_put(psif->pclk);
13004 + iounmap(psif->regs);
13013 +static int __exit psif_remove(struct platform_device *pdev)
13015 + struct psif *psif = platform_get_drvdata(pdev);
13017 + psif_writel(psif, IDR, ~0UL);
13018 + psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS));
13020 + serio_unregister_port(psif->io);
13021 + iounmap(psif->regs);
13022 + free_irq(psif->irq, psif);
13023 + clk_put(psif->pclk);
13026 + platform_set_drvdata(pdev, NULL);
13032 +static int psif_suspend(struct platform_device *pdev, pm_message_t state)
13034 + struct psif *psif = platform_get_drvdata(pdev);
13036 + if (psif->open) {
13037 + psif_writel(psif, CR, PSIF_BIT(CR_RXDIS) | PSIF_BIT(CR_TXDIS));
13038 + clk_disable(psif->pclk);
13044 +static int psif_resume(struct platform_device *pdev)
13046 + struct psif *psif = platform_get_drvdata(pdev);
13048 + if (psif->open) {
13049 + clk_enable(psif->pclk);
13050 + psif_set_prescaler(psif);
13051 + psif_writel(psif, CR, PSIF_BIT(CR_RXEN) | PSIF_BIT(CR_TXEN));
13057 +#define psif_suspend NULL
13058 +#define psif_resume NULL
13061 +static struct platform_driver psif_driver = {
13062 + .remove = __exit_p(psif_remove),
13064 + .name = "atmel_psif",
13066 + .suspend = psif_suspend,
13067 + .resume = psif_resume,
13070 +static int __init psif_init(void)
13072 + return platform_driver_probe(&psif_driver, psif_probe);
13075 +static void __exit psif_exit(void)
13077 + platform_driver_unregister(&psif_driver);
13080 +module_init(psif_init);
13081 +module_exit(psif_exit);
13083 +MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>");
13084 +MODULE_DESCRIPTION("Atmel AVR32 PSIF PS/2 driver");
13085 +MODULE_LICENSE("GPL");
13086 diff -urN linux-2.6.24.3/drivers/input/serio/at32psif.h avr32-2.6/drivers/input/serio/at32psif.h
13087 --- linux-2.6.24.3/drivers/input/serio/at32psif.h 1970-01-01 01:00:00.000000000 +0100
13088 +++ avr32-2.6/drivers/input/serio/at32psif.h 2008-04-23 20:12:40.000000000 +0200
13091 + * Copyright (C) 2007 Atmel Corporation
13093 + * Driver for the AT32AP700X PS/2 controller (PSIF).
13095 + * This program is free software; you can redistribute it and/or modify it
13096 + * under the terms of the GNU General Public License version 2 as published
13097 + * by the Free Software Foundation.
13100 +#ifndef _AT32PSIF_H
13101 +#define _AT32PSIF_H
13103 +/* PSIF register offsets */
13104 +#define PSIF_CR 0x00
13105 +#define PSIF_RHR 0x04
13106 +#define PSIF_THR 0x08
13107 +#define PSIF_SR 0x10
13108 +#define PSIF_IER 0x14
13109 +#define PSIF_IDR 0x18
13110 +#define PSIF_IMR 0x1c
13111 +#define PSIF_PSR 0x24
13113 +/* Bitfields in control register. */
13114 +#define PSIF_CR_RXDIS_OFFSET 1
13115 +#define PSIF_CR_RXDIS_SIZE 1
13116 +#define PSIF_CR_RXEN_OFFSET 0
13117 +#define PSIF_CR_RXEN_SIZE 1
13118 +#define PSIF_CR_SWRST_OFFSET 15
13119 +#define PSIF_CR_SWRST_SIZE 1
13120 +#define PSIF_CR_TXDIS_OFFSET 9
13121 +#define PSIF_CR_TXDIS_SIZE 1
13122 +#define PSIF_CR_TXEN_OFFSET 8
13123 +#define PSIF_CR_TXEN_SIZE 1
13125 +/* Bitfields in interrupt disable, enable, mask and status register. */
13126 +#define PSIF_NACK_OFFSET 8
13127 +#define PSIF_NACK_SIZE 1
13128 +#define PSIF_OVRUN_OFFSET 5
13129 +#define PSIF_OVRUN_SIZE 1
13130 +#define PSIF_PARITY_OFFSET 9
13131 +#define PSIF_PARITY_SIZE 1
13132 +#define PSIF_RXRDY_OFFSET 4
13133 +#define PSIF_RXRDY_SIZE 1
13134 +#define PSIF_TXEMPTY_OFFSET 1
13135 +#define PSIF_TXEMPTY_SIZE 1
13136 +#define PSIF_TXRDY_OFFSET 0
13137 +#define PSIF_TXRDY_SIZE 1
13139 +/* Bitfields in prescale register. */
13140 +#define PSIF_PSR_PRSCV_OFFSET 0
13141 +#define PSIF_PSR_PRSCV_SIZE 12
13143 +/* Bitfields in receive hold register. */
13144 +#define PSIF_RHR_RXDATA_OFFSET 0
13145 +#define PSIF_RHR_RXDATA_SIZE 8
13147 +/* Bitfields in transmit hold register. */
13148 +#define PSIF_THR_TXDATA_OFFSET 0
13149 +#define PSIF_THR_TXDATA_SIZE 8
13151 +/* Bit manipulation macros */
13152 +#define PSIF_BIT(name) \
13153 + (1 << PSIF_##name##_OFFSET)
13154 +#define PSIF_BF(name, value) \
13155 + (((value) & ((1 << PSIF_##name##_SIZE) - 1)) \
13156 + << PSIF_##name##_OFFSET)
13157 +#define PSIF_BFEXT(name, value)\
13158 + (((value) >> PSIF_##name##_OFFSET) \
13159 + & ((1 << PSIF_##name##_SIZE) - 1))
13160 +#define PSIF_BFINS(name, value, old) \
13161 + (((old) & ~(((1 << PSIF_##name##_SIZE) - 1) \
13162 + << PSIF_##name##_OFFSET)) \
13163 + | PSIF_BF(name, value))
13165 +/* Register access macros */
13166 +#define psif_readl(port, reg) \
13167 + __raw_readl((port)->regs + PSIF_##reg)
13168 +#define psif_writel(port, reg, value) \
13169 + __raw_writel((value), (port)->regs + PSIF_##reg)
13171 +#endif /* _AT32PSIF_H */
13172 diff -urN linux-2.6.24.3/drivers/input/serio/Kconfig avr32-2.6/drivers/input/serio/Kconfig
13173 --- linux-2.6.24.3/drivers/input/serio/Kconfig 2008-02-26 01:20:20.000000000 +0100
13174 +++ avr32-2.6/drivers/input/serio/Kconfig 2008-04-23 20:12:40.000000000 +0200
13176 To compile this driver as a module, choose M here: the
13177 module will be called rpckbd.
13179 +config SERIO_AT32PSIF
13180 + tristate "AVR32 PSIF PS/2 keyboard and mouse controller"
13184 + Say Y here if you want to use the PSIF peripheral on AVR32 devices
13185 + and connect a PS/2 keyboard and/or mouse to it.
13187 + To compile this driver as a module, choose M here: the module will
13188 + be called at32psif.
13190 config SERIO_AMBAKMI
13191 tristate "AMBA KMI keyboard controller"
13192 depends on ARM_AMBA
13193 diff -urN linux-2.6.24.3/drivers/input/serio/Makefile avr32-2.6/drivers/input/serio/Makefile
13194 --- linux-2.6.24.3/drivers/input/serio/Makefile 2008-02-26 01:20:20.000000000 +0100
13195 +++ avr32-2.6/drivers/input/serio/Makefile 2008-04-23 20:12:40.000000000 +0200
13197 obj-$(CONFIG_SERIO_RPCKBD) += rpckbd.o
13198 obj-$(CONFIG_SERIO_SA1111) += sa1111ps2.o
13199 obj-$(CONFIG_SERIO_AMBAKMI) += ambakmi.o
13200 +obj-$(CONFIG_SERIO_AT32PSIF) += at32psif.o
13201 obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o
13202 obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o
13203 obj-$(CONFIG_HP_SDC) += hp_sdc.o
13204 diff -urN linux-2.6.24.3/drivers/leds/Kconfig avr32-2.6/drivers/leds/Kconfig
13205 --- linux-2.6.24.3/drivers/leds/Kconfig 2008-02-26 01:20:20.000000000 +0100
13206 +++ avr32-2.6/drivers/leds/Kconfig 2008-04-23 20:12:41.000000000 +0200
13209 comment "LED drivers"
13211 +config LEDS_ATMEL_PWM
13212 + tristate "LED Support using Atmel PWM outputs"
13213 + depends on LEDS_CLASS && ATMEL_PWM
13215 + This option enables support for LEDs driven using outputs
13216 + of the dedicated PWM controller found on newer Atmel SOCs.
13219 tristate "LED Support for the Sharp SL-C7x0 series"
13220 depends on LEDS_CLASS && PXA_SHARP_C7xx
13221 diff -urN linux-2.6.24.3/drivers/leds/leds-atmel-pwm.c avr32-2.6/drivers/leds/leds-atmel-pwm.c
13222 --- linux-2.6.24.3/drivers/leds/leds-atmel-pwm.c 1970-01-01 01:00:00.000000000 +0100
13223 +++ avr32-2.6/drivers/leds/leds-atmel-pwm.c 2008-04-23 19:33:39.000000000 +0200
13225 +#include <linux/kernel.h>
13226 +#include <linux/platform_device.h>
13227 +#include <linux/leds.h>
13228 +#include <linux/io.h>
13229 +#include <linux/atmel_pwm.h>
13233 + struct led_classdev cdev;
13234 + struct pwm_channel pwmc;
13235 + struct gpio_led *desc;
13242 + * For simplicity, we use "brightness" as if it were a linear function
13243 + * of PWM duty cycle. However, a logarithmic function of duty cycle is
13244 + * probably a better match for perceived brightness: two is half as bright
13245 + * as four, four is half as bright as eight, etc
13247 +static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b)
13249 + struct pwmled *led;
13251 + /* update the duty cycle for the *next* period */
13252 + led = container_of(cdev, struct pwmled, cdev);
13253 + pwm_channel_writel(&led->pwmc, PWM_CUPD, led->mult * (unsigned) b);
13257 + * NOTE: we reuse the platform_data structure of GPIO leds,
13258 + * but repurpose its "gpio" number as a PWM channel number.
13260 +static int __init pwmled_probe(struct platform_device *pdev)
13262 + const struct gpio_led_platform_data *pdata;
13263 + struct pwmled *leds;
13267 + pdata = pdev->dev.platform_data;
13268 + if (!pdata || pdata->num_leds < 1)
13271 + leds = kcalloc(pdata->num_leds, sizeof(*leds), GFP_KERNEL);
13275 + for (i = 0; i < pdata->num_leds; i++) {
13276 + struct pwmled *led = leds + i;
13277 + const struct gpio_led *dat = pdata->leds + i;
13280 + led->cdev.name = dat->name;
13281 + led->cdev.brightness = LED_OFF;
13282 + led->cdev.brightness_set = pwmled_brightness;
13283 + led->cdev.default_trigger = dat->default_trigger;
13285 + led->active_low = dat->active_low;
13287 + status = pwm_channel_alloc(dat->gpio, &led->pwmc);
13292 + * Prescale clock by 2^x, so PWM counts in low MHz.
13293 + * Start each cycle with the LED active, so increasing
13294 + * the duty cycle gives us more time on (== brighter).
13297 + if (!led->active_low)
13298 + tmp |= PWM_CPR_CPOL;
13299 + pwm_channel_writel(&led->pwmc, PWM_CMR, tmp);
13302 + * Pick a period so PWM cycles at 100+ Hz; and a multiplier
13303 + * for scaling duty cycle: brightness * mult.
13305 + tmp = (led->pwmc.mck / (1 << 5)) / 100;
13308 + pwm_channel_writel(&led->pwmc, PWM_CDTY,
13309 + led->cdev.brightness * 255);
13310 + pwm_channel_writel(&led->pwmc, PWM_CPRD,
13313 + pwm_channel_enable(&led->pwmc);
13315 + /* Hand it over to the LED framework */
13316 + status = led_classdev_register(&pdev->dev, &led->cdev);
13317 + if (status < 0) {
13318 + pwm_channel_free(&led->pwmc);
13323 + platform_set_drvdata(pdev, leds);
13327 + while (i-- > 0) {
13328 + led_classdev_unregister(&leds[i].cdev);
13329 + pwm_channel_free(&leds[i].pwmc);
13336 +static int __exit pwmled_remove(struct platform_device *pdev)
13338 + const struct gpio_led_platform_data *pdata;
13339 + struct pwmled *leds;
13342 + pdata = pdev->dev.platform_data;
13343 + leds = platform_get_drvdata(pdev);
13345 + for (i = 0; i < pdata->num_leds; i++) {
13346 + struct pwmled *led = leds + i;
13348 + led_classdev_unregister(&led->cdev);
13349 + pwm_channel_free(&led->pwmc);
13353 + platform_set_drvdata(pdev, NULL);
13357 +static struct platform_driver pwmled_driver = {
13359 + .name = "leds-atmel-pwm",
13360 + .owner = THIS_MODULE,
13362 + /* REVISIT add suspend() and resume() methods */
13363 + .remove = __exit_p(pwmled_remove),
13366 +static int __init modinit(void)
13368 + return platform_driver_probe(&pwmled_driver, pwmled_probe);
13370 +module_init(modinit);
13372 +static void __exit modexit(void)
13374 + platform_driver_unregister(&pwmled_driver);
13376 +module_exit(modexit);
13378 +MODULE_DESCRIPTION("Driver for LEDs with PWM-controlled brightness");
13379 +MODULE_LICENSE("GPL");
13380 diff -urN linux-2.6.24.3/drivers/leds/Makefile avr32-2.6/drivers/leds/Makefile
13381 --- linux-2.6.24.3/drivers/leds/Makefile 2008-02-26 01:20:20.000000000 +0100
13382 +++ avr32-2.6/drivers/leds/Makefile 2008-04-23 20:12:41.000000000 +0200
13384 obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
13386 # LED Platform Drivers
13387 +obj-$(CONFIG_LEDS_ATMEL_PWM) += leds-atmel-pwm.o
13388 obj-$(CONFIG_LEDS_CORGI) += leds-corgi.o
13389 obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o
13390 obj-$(CONFIG_LEDS_SPITZ) += leds-spitz.o
13391 diff -urN linux-2.6.24.3/drivers/misc/atmel_pwm.c avr32-2.6/drivers/misc/atmel_pwm.c
13392 --- linux-2.6.24.3/drivers/misc/atmel_pwm.c 1970-01-01 01:00:00.000000000 +0100
13393 +++ avr32-2.6/drivers/misc/atmel_pwm.c 2008-04-23 19:33:40.000000000 +0200
13395 +#include <linux/module.h>
13396 +#include <linux/clk.h>
13397 +#include <linux/err.h>
13398 +#include <linux/io.h>
13399 +#include <linux/interrupt.h>
13400 +#include <linux/platform_device.h>
13401 +#include <linux/atmel_pwm.h>
13405 + * This is a simple driver for the PWM controller found in various newer
13406 + * Atmel SOCs, including the AVR32 series and the AT91sam9263.
13408 + * Chips with current Linux ports have only 4 PWM channels, out of max 32.
13409 + * AT32UC3A and AT32UC3B chips have 7 channels (but currently no Linux).
13410 + * Docs are inconsistent about the width of the channel counter registers;
13411 + * it's at least 16 bits, but several places say 20 bits.
13413 +#define PWM_NCHAN 4 /* max 32 */
13417 + struct platform_device *pdev;
13420 + void __iomem *base;
13422 + struct pwm_channel *channel[PWM_NCHAN];
13423 + void (*handler[PWM_NCHAN])(struct pwm_channel *);
13427 +/* global PWM controller registers */
13428 +#define PWM_MR 0x00
13429 +#define PWM_ENA 0x04
13430 +#define PWM_DIS 0x08
13431 +#define PWM_SR 0x0c
13432 +#define PWM_IER 0x10
13433 +#define PWM_IDR 0x14
13434 +#define PWM_IMR 0x18
13435 +#define PWM_ISR 0x1c
13437 +static inline void pwm_writel(const struct pwm *p, unsigned offset, u32 val)
13439 + __raw_writel(val, p->base + offset);
13442 +static inline u32 pwm_readl(const struct pwm *p, unsigned offset)
13444 + return __raw_readl(p->base + offset);
13447 +static inline void __iomem *pwmc_regs(const struct pwm *p, int index)
13449 + return p->base + 0x200 + index * 0x20;
13452 +static struct pwm *pwm;
13454 +static void pwm_dumpregs(struct pwm_channel *ch, char *tag)
13456 + struct device *dev = &pwm->pdev->dev;
13458 + dev_dbg(dev, "%s: mr %08x, sr %08x, imr %08x\n",
13460 + pwm_readl(pwm, PWM_MR),
13461 + pwm_readl(pwm, PWM_SR),
13462 + pwm_readl(pwm, PWM_IMR));
13464 + "pwm ch%d - mr %08x, dty %u, prd %u, cnt %u\n",
13466 + pwm_channel_readl(ch, PWM_CMR),
13467 + pwm_channel_readl(ch, PWM_CDTY),
13468 + pwm_channel_readl(ch, PWM_CPRD),
13469 + pwm_channel_readl(ch, PWM_CCNT));
13474 + * pwm_channel_alloc - allocate an unused PWM channel
13475 + * @index: identifies the channel
13476 + * @ch: structure to be initialized
13478 + * Drivers allocate PWM channels according to the board's wiring, and
13479 + * matching board-specific setup code. Returns zero or negative errno.
13481 +int pwm_channel_alloc(int index, struct pwm_channel *ch)
13483 + unsigned long flags;
13486 + /* insist on PWM init, with this signal pinned out */
13487 + if (!pwm || !(pwm->mask & 1 << index))
13490 + if (index < 0 || index >= PWM_NCHAN || !ch)
13492 + memset(ch, 0, sizeof *ch);
13494 + spin_lock_irqsave(&pwm->lock, flags);
13495 + if (pwm->channel[index])
13498 + clk_enable(pwm->clk);
13500 + ch->regs = pwmc_regs(pwm, index);
13501 + ch->index = index;
13503 + /* REVISIT: ap7000 seems to go 2x as fast as we expect!! */
13504 + ch->mck = clk_get_rate(pwm->clk);
13506 + pwm->channel[index] = ch;
13507 + pwm->handler[index] = NULL;
13509 + /* channel and irq are always disabled when we return */
13510 + pwm_writel(pwm, PWM_DIS, 1 << index);
13511 + pwm_writel(pwm, PWM_IDR, 1 << index);
13513 + spin_unlock_irqrestore(&pwm->lock, flags);
13516 +EXPORT_SYMBOL(pwm_channel_alloc);
13518 +static int pwmcheck(struct pwm_channel *ch)
13526 + index = ch->index;
13527 + if (index < 0 || index >= PWM_NCHAN || pwm->channel[index] != ch)
13534 + * pwm_channel_free - release a previously allocated channel
13535 + * @ch: the channel being released
13537 + * The channel is completely shut down (counter and IRQ disabled),
13538 + * and made available for re-use. Returns zero, or negative errno.
13540 +int pwm_channel_free(struct pwm_channel *ch)
13542 + unsigned long flags;
13545 + spin_lock_irqsave(&pwm->lock, flags);
13546 + t = pwmcheck(ch);
13548 + pwm->channel[t] = NULL;
13549 + pwm->handler[t] = NULL;
13551 + /* channel and irq are always disabled when we return */
13552 + pwm_writel(pwm, PWM_DIS, 1 << t);
13553 + pwm_writel(pwm, PWM_IDR, 1 << t);
13555 + clk_disable(pwm->clk);
13558 + spin_unlock_irqrestore(&pwm->lock, flags);
13561 +EXPORT_SYMBOL(pwm_channel_free);
13563 +int __pwm_channel_onoff(struct pwm_channel *ch, int enabled)
13565 + unsigned long flags;
13568 + /* OMITTED FUNCTIONALITY: starting several channels in synch */
13570 + spin_lock_irqsave(&pwm->lock, flags);
13571 + t = pwmcheck(ch);
13573 + pwm_writel(pwm, enabled ? PWM_ENA : PWM_DIS, 1 << t);
13575 + pwm_dumpregs(ch, enabled ? "enable" : "disable");
13577 + spin_unlock_irqrestore(&pwm->lock, flags);
13581 +EXPORT_SYMBOL(__pwm_channel_onoff);
13584 + * pwm_clk_alloc - allocate and configure CLKA or CLKB
13585 + * @prescale: from 0..10, the power of two used to divide MCK
13586 + * @div: from 1..255, the linear divisor to use
13588 + * Returns PWM_CPR_CLKA, PWM_CPR_CLKB, or negative errno. The allocated
13589 + * clock will run with a period of (2^prescale * div) / MCK, or twice as
13590 + * long if center aligned PWM output is used. The clock must later be
13591 + * deconfigured using pwm_clk_free().
13593 +int pwm_clk_alloc(unsigned prescale, unsigned div)
13595 + unsigned long flags;
13597 + u32 val = (prescale << 8) | div;
13598 + int ret = -EBUSY;
13600 + if (prescale >= 10 || div == 0 || div > 255)
13603 + spin_lock_irqsave(&pwm->lock, flags);
13604 + mr = pwm_readl(pwm, PWM_MR);
13605 + if ((mr & 0xffff) == 0) {
13607 + ret = PWM_CPR_CLKA;
13609 + if ((mr & (0xffff << 16)) == 0) {
13611 + ret = PWM_CPR_CLKB;
13614 + pwm_writel(pwm, PWM_MR, mr);
13615 + spin_unlock_irqrestore(&pwm->lock, flags);
13618 +EXPORT_SYMBOL(pwm_clk_alloc);
13621 + * pwm_clk_free - deconfigure and release CLKA or CLKB
13623 + * Reverses the effect of pwm_clk_alloc().
13625 +void pwm_clk_free(unsigned clk)
13627 + unsigned long flags;
13630 + spin_lock_irqsave(&pwm->lock, flags);
13631 + mr = pwm_readl(pwm, PWM_MR);
13632 + if (clk == PWM_CPR_CLKA)
13633 + pwm_writel(pwm, PWM_MR, mr & ~(0xffff << 0));
13634 + if (clk == PWM_CPR_CLKB)
13635 + pwm_writel(pwm, PWM_MR, mr & ~(0xffff << 16));
13636 + spin_unlock_irqrestore(&pwm->lock, flags);
13638 +EXPORT_SYMBOL(pwm_clk_free);
13641 + * pwm_channel_handler - manage channel's IRQ handler
13642 + * @ch: the channel
13643 + * @handler: the handler to use, possibly NULL
13645 + * If the handler is non-null, the handler will be called after every
13646 + * period of this PWM channel. If the handler is null, this channel
13647 + * won't generate an IRQ.
13649 +int pwm_channel_handler(struct pwm_channel *ch,
13650 + void (*handler)(struct pwm_channel *ch))
13652 + unsigned long flags;
13655 + spin_lock_irqsave(&pwm->lock, flags);
13656 + t = pwmcheck(ch);
13658 + pwm->handler[t] = handler;
13659 + pwm_writel(pwm, handler ? PWM_IER : PWM_IDR, 1 << t);
13662 + spin_unlock_irqrestore(&pwm->lock, flags);
13666 +EXPORT_SYMBOL(pwm_channel_handler);
13668 +static irqreturn_t pwm_irq(int id, void *_pwm)
13670 + struct pwm *p = _pwm;
13671 + irqreturn_t handled = IRQ_NONE;
13675 + spin_lock(&p->lock);
13677 + /* ack irqs, then handle them */
13678 + irqstat = pwm_readl(pwm, PWM_ISR);
13680 + while (irqstat) {
13681 + struct pwm_channel *ch;
13682 + void (*handler)(struct pwm_channel *ch);
13684 + index = ffs(irqstat) - 1;
13685 + irqstat &= ~(1 << index);
13686 + ch = pwm->channel[index];
13687 + handler = pwm->handler[index];
13688 + if (handler && ch) {
13689 + spin_unlock(&p->lock);
13691 + spin_lock(&p->lock);
13692 + handled = IRQ_HANDLED;
13696 + spin_unlock(&p->lock);
13700 +static int __init pwm_probe(struct platform_device *pdev)
13702 + struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
13703 + int irq = platform_get_irq(pdev, 0);
13704 + u32 *mp = pdev->dev.platform_data;
13706 + int status = -EIO;
13710 + if (!r || irq < 0 || !mp || !*mp)
13712 + if (*mp & ~((1<<PWM_NCHAN)-1)) {
13713 + dev_warn(&pdev->dev, "mask 0x%x ... more than %d channels\n",
13718 + p = kzalloc(sizeof(*p), GFP_KERNEL);
13722 + spin_lock_init(&p->lock);
13726 + p->base = ioremap(r->start, r->end - r->start + 1);
13729 + p->clk = clk_get(&pdev->dev, "mck");
13730 + if (IS_ERR(p->clk)) {
13731 + status = PTR_ERR(p->clk);
13736 + status = request_irq(irq, pwm_irq, 0, pdev->name, p);
13741 + platform_set_drvdata(pdev, p);
13749 + iounmap(p->base);
13755 +static int __exit pwm_remove(struct platform_device *pdev)
13757 + struct pwm *p = platform_get_drvdata(pdev);
13762 + clk_enable(pwm->clk);
13763 + pwm_writel(pwm, PWM_DIS, (1 << PWM_NCHAN) - 1);
13764 + pwm_writel(pwm, PWM_IDR, (1 << PWM_NCHAN) - 1);
13765 + clk_disable(pwm->clk);
13769 + free_irq(p->irq, p);
13771 + iounmap(p->base);
13777 +static struct platform_driver atmel_pwm_driver = {
13779 + .name = "atmel_pwm",
13780 + .owner = THIS_MODULE,
13782 + .remove = __exit_p(pwm_remove),
13784 + /* NOTE: PWM can keep running in AVR32 "idle" and "frozen" states;
13785 + * and all AT91sam9263 states, albeit at reduced clock rate if
13786 + * MCK becomes the slow clock (i.e. what Linux labels STR).
13790 +static int __init pwm_init(void)
13792 + return platform_driver_probe(&atmel_pwm_driver, pwm_probe);
13794 +module_init(pwm_init);
13796 +static void __exit pwm_exit(void)
13798 + platform_driver_unregister(&atmel_pwm_driver);
13800 +module_exit(pwm_exit);
13802 +MODULE_DESCRIPTION("Driver for AT32/AT91 PWM module");
13803 +MODULE_LICENSE("GPL");
13804 diff -urN linux-2.6.24.3/drivers/misc/atmel_tclib.c avr32-2.6/drivers/misc/atmel_tclib.c
13805 --- linux-2.6.24.3/drivers/misc/atmel_tclib.c 1970-01-01 01:00:00.000000000 +0100
13806 +++ avr32-2.6/drivers/misc/atmel_tclib.c 2008-04-23 20:12:41.000000000 +0200
13808 +#include <linux/atmel_tc.h>
13809 +#include <linux/clk.h>
13810 +#include <linux/err.h>
13811 +#include <linux/init.h>
13812 +#include <linux/io.h>
13813 +#include <linux/ioport.h>
13814 +#include <linux/kernel.h>
13815 +#include <linux/platform_device.h>
13817 +/* Number of bytes to reserve for the iomem resource */
13818 +#define ATMEL_TC_IOMEM_SIZE 256
13822 + * This is a thin library to solve the problem of how to portably allocate
13823 + * one of the TC blocks. For simplicity, it doesn't currently expect to
13824 + * share individual timers between different drivers.
13827 +#if defined(CONFIG_AVR32)
13828 +/* AVR32 has these divide PBB */
13829 +const u8 atmel_tc_divisors[5] = { 0, 4, 8, 16, 32, };
13830 +EXPORT_SYMBOL(atmel_tc_divisors);
13832 +#elif defined(CONFIG_ARCH_AT91)
13833 +/* AT91 has these divide MCK */
13834 +const u8 atmel_tc_divisors[5] = { 2, 8, 32, 128, 0, };
13835 +EXPORT_SYMBOL(atmel_tc_divisors);
13839 +static DEFINE_SPINLOCK(tc_list_lock);
13840 +static LIST_HEAD(tc_list);
13843 + * atmel_tc_alloc - allocate a specified TC block
13844 + * @block: which block to allocate
13845 + * @name: name to be associated with the iomem resource
13847 + * Caller allocates a block. If it is available, a pointer to a
13848 + * pre-initialized struct atmel_tc is returned. The caller can access
13849 + * the registers directly through the "regs" field.
13851 +struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name)
13853 + struct atmel_tc *tc;
13854 + struct platform_device *pdev = NULL;
13855 + struct resource *r;
13857 + spin_lock(&tc_list_lock);
13858 + list_for_each_entry(tc, &tc_list, node) {
13859 + if (tc->pdev->id == block) {
13865 + if (!pdev || tc->iomem)
13868 + r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
13869 + r = request_mem_region(r->start, ATMEL_TC_IOMEM_SIZE, name);
13873 + tc->regs = ioremap(r->start, ATMEL_TC_IOMEM_SIZE);
13875 + goto fail_ioremap;
13880 + spin_unlock(&tc_list_lock);
13884 + release_resource(r);
13889 +EXPORT_SYMBOL_GPL(atmel_tc_alloc);
13892 + * atmel_tc_free - release a specified TC block
13893 + * @tc: Timer/counter block that was returned by atmel_tc_alloc()
13895 + * This reverses the effect of atmel_tc_alloc(), unmapping the I/O
13896 + * registers, invalidating the resource returned by that routine and
13897 + * making the TC available to other drivers.
13899 +void atmel_tc_free(struct atmel_tc *tc)
13901 + spin_lock(&tc_list_lock);
13903 + iounmap(tc->regs);
13904 + release_resource(tc->iomem);
13906 + tc->iomem = NULL;
13908 + spin_unlock(&tc_list_lock);
13910 +EXPORT_SYMBOL_GPL(atmel_tc_free);
13912 +static int __init tc_probe(struct platform_device *pdev)
13914 + struct atmel_tc *tc;
13918 + if (!platform_get_resource(pdev, IORESOURCE_MEM, 0))
13921 + irq = platform_get_irq(pdev, 0);
13925 + tc = kzalloc(sizeof(struct atmel_tc), GFP_KERNEL);
13931 + clk = clk_get(&pdev->dev, "t0_clk");
13932 + if (IS_ERR(clk)) {
13937 + tc->clk[0] = clk;
13938 + tc->clk[1] = clk_get(&pdev->dev, "t1_clk");
13939 + if (IS_ERR(tc->clk[1]))
13940 + tc->clk[1] = clk;
13941 + tc->clk[2] = clk_get(&pdev->dev, "t2_clk");
13942 + if (IS_ERR(tc->clk[2]))
13943 + tc->clk[2] = clk;
13945 + tc->irq[0] = irq;
13946 + tc->irq[1] = platform_get_irq(pdev, 1);
13947 + if (tc->irq[1] < 0)
13948 + tc->irq[1] = irq;
13949 + tc->irq[2] = platform_get_irq(pdev, 2);
13950 + if (tc->irq[2] < 0)
13951 + tc->irq[2] = irq;
13953 + spin_lock(&tc_list_lock);
13954 + list_add_tail(&tc->node, &tc_list);
13955 + spin_unlock(&tc_list_lock);
13960 +static struct platform_driver tc_driver = {
13961 + .driver.name = "atmel_tcb",
13964 +static int __init tc_init(void)
13966 + return platform_driver_probe(&tc_driver, tc_probe);
13968 +arch_initcall(tc_init);
13969 diff -urN linux-2.6.24.3/drivers/misc/Kconfig avr32-2.6/drivers/misc/Kconfig
13970 --- linux-2.6.24.3/drivers/misc/Kconfig 2008-02-26 01:20:20.000000000 +0100
13971 +++ avr32-2.6/drivers/misc/Kconfig 2008-04-23 20:12:41.000000000 +0200
13977 + tristate "Atmel AT32/AT91 PWM support"
13978 + depends on AVR32 || ARCH_AT91
13980 + This option enables device driver support for the PWM channels
13981 + on certain Atmel prcoessors. Pulse Width Modulation is used for
13982 + purposes including software controlled power-efficent backlights
13983 + on LCD displays, motor control, and waveform generation.
13985 +config ATMEL_TCLIB
13986 + bool "Atmel AT32/AT91 Timer/Counter Library"
13987 + depends on (AVR32 || ARCH_AT91)
13989 + Select this if you want a library to allocate the Timer/Counter
13990 + blocks found on many Atmel processors. This facilitates using
13991 + these blocks by different drivers despite processor differences.
13993 +config ATMEL_TCB_CLKSRC
13994 + bool "TC Block Clocksource"
13995 + depends on ATMEL_TCLIB && GENERIC_TIME
13998 + Select this to get a high precision clocksource based on a
13999 + TC block with a 5+ MHz base clock rate. Two timer channels
14000 + are combined to make a single 32-bit timer.
14002 + When GENERIC_CLOCKEVENTS is defined, the third timer channel
14003 + may be used as a clock event device supporting oneshot mode
14004 + (delays of up to two seconds) based on the 32 KiHz clock.
14006 +config ATMEL_TCB_CLKSRC_BLOCK
14008 + depends on ATMEL_TCB_CLKSRC
14009 + prompt "TC Block" if ARCH_AT91RM9200 || ARCH_AT91SAM9260 || CPU_AT32AP700X
14013 + Some chips provide more than one TC block, so you have the
14014 + choice of which one to use for the clock framework. The other
14015 + TC can be used for other purposes, such as PWM generation and
14019 tristate "Device driver for IBM RSA service processor"
14020 depends on X86 && PCI && INPUT && EXPERIMENTAL
14021 diff -urN linux-2.6.24.3/drivers/misc/Makefile avr32-2.6/drivers/misc/Makefile
14022 --- linux-2.6.24.3/drivers/misc/Makefile 2008-02-26 01:20:20.000000000 +0100
14023 +++ avr32-2.6/drivers/misc/Makefile 2008-04-23 20:12:41.000000000 +0200
14025 obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/
14026 obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
14027 obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
14028 +obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
14029 obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
14030 +obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
14031 obj-$(CONFIG_LKDTM) += lkdtm.o
14032 obj-$(CONFIG_TIFM_CORE) += tifm_core.o
14033 obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
14034 diff -urN linux-2.6.24.3/drivers/mmc/host/atmel-mci.c avr32-2.6/drivers/mmc/host/atmel-mci.c
14035 --- linux-2.6.24.3/drivers/mmc/host/atmel-mci.c 1970-01-01 01:00:00.000000000 +0100
14036 +++ avr32-2.6/drivers/mmc/host/atmel-mci.c 2008-04-23 20:12:41.000000000 +0200
14039 + * Atmel MultiMedia Card Interface driver
14041 + * Copyright (C) 2004-2006 Atmel Corporation
14043 + * This program is free software; you can redistribute it and/or modify
14044 + * it under the terms of the GNU General Public License version 2 as
14045 + * published by the Free Software Foundation.
14047 +#include <linux/blkdev.h>
14048 +#include <linux/clk.h>
14049 +#include <linux/device.h>
14050 +#include <linux/dma-mapping.h>
14051 +#include <linux/init.h>
14052 +#include <linux/interrupt.h>
14053 +#include <linux/ioport.h>
14054 +#include <linux/module.h>
14055 +#include <linux/platform_device.h>
14057 +#include <linux/mmc/host.h>
14059 +#include <asm/dma-controller.h>
14060 +#include <asm/io.h>
14061 +#include <asm/arch/board.h>
14062 +#include <asm/arch/gpio.h>
14064 +#include "atmel-mci.h"
14066 +#define DRIVER_NAME "atmel_mci"
14068 +#define MCI_DATA_ERROR_FLAGS (MCI_BIT(DCRCE) | MCI_BIT(DTOE) | \
14069 + MCI_BIT(OVRE) | MCI_BIT(UNRE))
14072 + EVENT_CMD_COMPLETE = 0,
14073 + EVENT_DATA_COMPLETE,
14074 + EVENT_DATA_ERROR,
14076 + EVENT_STOP_COMPLETE,
14077 + EVENT_DMA_COMPLETE,
14081 +struct atmel_mci_dma {
14082 + struct dma_request_sg req;
14083 + unsigned short rx_periph_id;
14084 + unsigned short tx_periph_id;
14087 +struct atmel_mci {
14088 + struct mmc_host *mmc;
14089 + void __iomem *regs;
14090 + struct atmel_mci_dma dma;
14092 + struct mmc_request *mrq;
14093 + struct mmc_command *cmd;
14094 + struct mmc_data *data;
14101 + struct tasklet_struct tasklet;
14102 + unsigned long pending_events;
14103 + unsigned long completed_events;
14109 + /* For detect pin debouncing */
14110 + struct timer_list detect_timer;
14112 + unsigned long bus_hz;
14113 + unsigned long mapbase;
14115 + struct platform_device *pdev;
14117 +#ifdef CONFIG_DEBUG_FS
14118 + struct dentry *debugfs_root;
14119 + struct dentry *debugfs_regs;
14120 + struct dentry *debugfs_req;
14121 + struct dentry *debugfs_pending_events;
14122 + struct dentry *debugfs_completed_events;
14126 +/* Those printks take an awful lot of time... */
14128 +static unsigned int fmax = 15000000U;
14130 +static unsigned int fmax = 1000000U;
14132 +module_param(fmax, uint, 0444);
14133 +MODULE_PARM_DESC(fmax, "Max frequency in Hz of the MMC bus clock");
14135 +/* Test bit macros for completed events */
14136 +#define mci_cmd_is_complete(host) \
14137 + test_bit(EVENT_CMD_COMPLETE, &host->completed_events)
14138 +#define mci_data_is_complete(host) \
14139 + test_bit(EVENT_DATA_COMPLETE, &host->completed_events)
14140 +#define mci_data_error_is_complete(host) \
14141 + test_bit(EVENT_DATA_ERROR, &host->completed_events)
14142 +#define mci_stop_sent_is_complete(host) \
14143 + test_bit(EVENT_STOP_SENT, &host->completed_events)
14144 +#define mci_stop_is_complete(host) \
14145 + test_bit(EVENT_STOP_COMPLETE, &host->completed_events)
14146 +#define mci_dma_is_complete(host) \
14147 + test_bit(EVENT_DMA_COMPLETE, &host->completed_events)
14148 +#define mci_dma_error_is_complete(host) \
14149 + test_bit(EVENT_DMA_ERROR, &host->completed_events)
14151 +/* Test and clear bit macros for pending events */
14152 +#define mci_clear_cmd_is_pending(host) \
14153 + test_and_clear_bit(EVENT_CMD_COMPLETE, &host->pending_events)
14154 +#define mci_clear_data_is_pending(host) \
14155 + test_and_clear_bit(EVENT_DATA_COMPLETE, &host->pending_events)
14156 +#define mci_clear_data_error_is_pending(host) \
14157 + test_and_clear_bit(EVENT_DATA_ERROR, &host->pending_events)
14158 +#define mci_clear_stop_sent_is_pending(host) \
14159 + test_and_clear_bit(EVENT_STOP_SENT, &host->pending_events)
14160 +#define mci_clear_stop_is_pending(host) \
14161 + test_and_clear_bit(EVENT_STOP_COMPLETE, &host->pending_events)
14162 +#define mci_clear_dma_error_is_pending(host) \
14163 + test_and_clear_bit(EVENT_DMA_ERROR, &host->pending_events)
14165 +/* Test and set bit macros for completed events */
14166 +#define mci_set_cmd_is_completed(host) \
14167 + test_and_set_bit(EVENT_CMD_COMPLETE, &host->completed_events)
14168 +#define mci_set_data_is_completed(host) \
14169 + test_and_set_bit(EVENT_DATA_COMPLETE, &host->completed_events)
14170 +#define mci_set_data_error_is_completed(host) \
14171 + test_and_set_bit(EVENT_DATA_ERROR, &host->completed_events)
14172 +#define mci_set_stop_sent_is_completed(host) \
14173 + test_and_set_bit(EVENT_STOP_SENT, &host->completed_events)
14174 +#define mci_set_stop_is_completed(host) \
14175 + test_and_set_bit(EVENT_STOP_COMPLETE, &host->completed_events)
14176 +#define mci_set_dma_error_is_completed(host) \
14177 + test_and_set_bit(EVENT_DMA_ERROR, &host->completed_events)
14179 +/* Set bit macros for completed events */
14180 +#define mci_set_cmd_complete(host) \
14181 + set_bit(EVENT_CMD_COMPLETE, &host->completed_events)
14182 +#define mci_set_data_complete(host) \
14183 + set_bit(EVENT_DATA_COMPLETE, &host->completed_events)
14184 +#define mci_set_data_error_complete(host) \
14185 + set_bit(EVENT_DATA_ERROR, &host->completed_events)
14186 +#define mci_set_stop_sent_complete(host) \
14187 + set_bit(EVENT_STOP_SENT, &host->completed_events)
14188 +#define mci_set_stop_complete(host) \
14189 + set_bit(EVENT_STOP_COMPLETE, &host->completed_events)
14190 +#define mci_set_dma_complete(host) \
14191 + set_bit(EVENT_DMA_COMPLETE, &host->completed_events)
14192 +#define mci_set_dma_error_complete(host) \
14193 + set_bit(EVENT_DMA_ERROR, &host->completed_events)
14195 +/* Set bit macros for pending events */
14196 +#define mci_set_cmd_pending(host) \
14197 + set_bit(EVENT_CMD_COMPLETE, &host->pending_events)
14198 +#define mci_set_data_pending(host) \
14199 + set_bit(EVENT_DATA_COMPLETE, &host->pending_events)
14200 +#define mci_set_data_error_pending(host) \
14201 + set_bit(EVENT_DATA_ERROR, &host->pending_events)
14202 +#define mci_set_stop_sent_pending(host) \
14203 + set_bit(EVENT_STOP_SENT, &host->pending_events)
14204 +#define mci_set_stop_pending(host) \
14205 + set_bit(EVENT_STOP_COMPLETE, &host->pending_events)
14206 +#define mci_set_dma_error_pending(host) \
14207 + set_bit(EVENT_DMA_ERROR, &host->pending_events)
14209 +/* Clear bit macros for pending events */
14210 +#define mci_clear_cmd_pending(host) \
14211 + clear_bit(EVENT_CMD_COMPLETE, &host->pending_events)
14212 +#define mci_clear_data_pending(host) \
14213 + clear_bit(EVENT_DATA_COMPLETE, &host->pending_events)
14214 +#define mci_clear_data_error_pending(host) \
14215 + clear_bit(EVENT_DATA_ERROR, &host->pending_events)
14216 +#define mci_clear_stop_sent_pending(host) \
14217 + clear_bit(EVENT_STOP_SENT, &host->pending_events)
14218 +#define mci_clear_stop_pending(host) \
14219 + clear_bit(EVENT_STOP_COMPLETE, &host->pending_events)
14220 +#define mci_clear_dma_error_pending(host) \
14221 + clear_bit(EVENT_DMA_ERROR, &host->pending_events)
14224 +#ifdef CONFIG_DEBUG_FS
14225 +#include <linux/debugfs.h>
14227 +#define DBG_REQ_BUF_SIZE (4096 - sizeof(unsigned int))
14229 +struct req_dbg_data {
14230 + unsigned int nbytes;
14231 + char str[DBG_REQ_BUF_SIZE];
14234 +static int req_dbg_open(struct inode *inode, struct file *file)
14236 + struct atmel_mci *host;
14237 + struct mmc_request *mrq;
14238 + struct mmc_command *cmd, *stop;
14239 + struct mmc_data *data;
14240 + struct req_dbg_data *priv;
14242 + unsigned long n = 0;
14244 + priv = kzalloc(DBG_REQ_BUF_SIZE, GFP_KERNEL);
14249 + mutex_lock(&inode->i_mutex);
14250 + host = inode->i_private;
14252 + spin_lock_irq(&host->mmc->lock);
14256 + data = mrq->data;
14257 + stop = mrq->stop;
14258 + n = snprintf(str, DBG_REQ_BUF_SIZE,
14259 + "CMD%u(0x%x) %x %x %x %x %x (err %u)\n",
14260 + cmd->opcode, cmd->arg, cmd->flags,
14261 + cmd->resp[0], cmd->resp[1], cmd->resp[2],
14262 + cmd->resp[3], cmd->error);
14263 + if (n < DBG_REQ_BUF_SIZE && data)
14264 + n += snprintf(str + n, DBG_REQ_BUF_SIZE - n,
14265 + "DATA %u * %u (%u) %x (err %u)\n",
14266 + data->blocks, data->blksz,
14267 + data->bytes_xfered, data->flags,
14269 + if (n < DBG_REQ_BUF_SIZE && stop)
14270 + n += snprintf(str + n, DBG_REQ_BUF_SIZE - n,
14271 + "CMD%u(0x%x) %x %x %x %x %x (err %u)\n",
14272 + stop->opcode, stop->arg, stop->flags,
14273 + stop->resp[0], stop->resp[1],
14274 + stop->resp[2], stop->resp[3],
14277 + spin_unlock_irq(&host->mmc->lock);
14278 + mutex_unlock(&inode->i_mutex);
14280 + priv->nbytes = min(n, DBG_REQ_BUF_SIZE);
14281 + file->private_data = priv;
14286 +static ssize_t req_dbg_read(struct file *file, char __user *buf,
14287 + size_t nbytes, loff_t *ppos)
14289 + struct req_dbg_data *priv = file->private_data;
14291 + return simple_read_from_buffer(buf, nbytes, ppos,
14292 + priv->str, priv->nbytes);
14295 +static int req_dbg_release(struct inode *inode, struct file *file)
14297 + kfree(file->private_data);
14301 +static const struct file_operations req_dbg_fops = {
14302 + .owner = THIS_MODULE,
14303 + .open = req_dbg_open,
14304 + .llseek = no_llseek,
14305 + .read = req_dbg_read,
14306 + .release = req_dbg_release,
14309 +static int regs_dbg_open(struct inode *inode, struct file *file)
14311 + struct atmel_mci *host;
14314 + int ret = -ENOMEM;
14316 + mutex_lock(&inode->i_mutex);
14317 + host = inode->i_private;
14318 + data = kmalloc(inode->i_size, GFP_KERNEL);
14322 + spin_lock_irq(&host->mmc->lock);
14323 + for (i = 0; i < inode->i_size / 4; i++)
14324 + data[i] = __raw_readl(host->regs + i * 4);
14325 + spin_unlock_irq(&host->mmc->lock);
14327 + file->private_data = data;
14331 + mutex_unlock(&inode->i_mutex);
14336 +static ssize_t regs_dbg_read(struct file *file, char __user *buf,
14337 + size_t nbytes, loff_t *ppos)
14339 + struct inode *inode = file->f_dentry->d_inode;
14342 + mutex_lock(&inode->i_mutex);
14343 + ret = simple_read_from_buffer(buf, nbytes, ppos,
14344 + file->private_data,
14345 + file->f_dentry->d_inode->i_size);
14346 + mutex_unlock(&inode->i_mutex);
14351 +static int regs_dbg_release(struct inode *inode, struct file *file)
14353 + kfree(file->private_data);
14357 +static const struct file_operations regs_dbg_fops = {
14358 + .owner = THIS_MODULE,
14359 + .open = regs_dbg_open,
14360 + .llseek = generic_file_llseek,
14361 + .read = regs_dbg_read,
14362 + .release = regs_dbg_release,
14365 +static void atmci_init_debugfs(struct atmel_mci *host)
14367 + struct mmc_host *mmc;
14368 + struct dentry *root, *regs;
14369 + struct resource *res;
14372 + root = debugfs_create_dir(mmc_hostname(mmc), NULL);
14373 + if (IS_ERR(root) || !root)
14375 + host->debugfs_root = root;
14377 + regs = debugfs_create_file("regs", 0400, root, host, ®s_dbg_fops);
14381 + res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
14382 + regs->d_inode->i_size = res->end - res->start + 1;
14383 + host->debugfs_regs = regs;
14385 + host->debugfs_req = debugfs_create_file("req", 0400, root,
14386 + host, &req_dbg_fops);
14387 + if (!host->debugfs_req)
14390 + host->debugfs_pending_events
14391 + = debugfs_create_u32("pending_events", 0400, root,
14392 + (u32 *)&host->pending_events);
14393 + if (!host->debugfs_pending_events)
14394 + goto err_pending_events;
14396 + host->debugfs_completed_events
14397 + = debugfs_create_u32("completed_events", 0400, root,
14398 + (u32 *)&host->completed_events);
14399 + if (!host->debugfs_completed_events)
14400 + goto err_completed_events;
14404 +err_completed_events:
14405 + debugfs_remove(host->debugfs_pending_events);
14406 +err_pending_events:
14407 + debugfs_remove(host->debugfs_req);
14409 + debugfs_remove(host->debugfs_regs);
14411 + debugfs_remove(host->debugfs_root);
14413 + host->debugfs_root = NULL;
14414 + dev_err(&host->pdev->dev,
14415 + "failed to initialize debugfs for %s\n",
14416 + mmc_hostname(mmc));
14419 +static void atmci_cleanup_debugfs(struct atmel_mci *host)
14421 + if (host->debugfs_root) {
14422 + debugfs_remove(host->debugfs_completed_events);
14423 + debugfs_remove(host->debugfs_pending_events);
14424 + debugfs_remove(host->debugfs_req);
14425 + debugfs_remove(host->debugfs_regs);
14426 + debugfs_remove(host->debugfs_root);
14427 + host->debugfs_root = NULL;
14431 +static inline void atmci_init_debugfs(struct atmel_mci *host)
14436 +static inline void atmci_cleanup_debugfs(struct atmel_mci *host)
14440 +#endif /* CONFIG_DEBUG_FS */
14442 +static inline unsigned int ns_to_clocks(struct atmel_mci *host,
14445 + return (ns * (host->bus_hz / 1000000) + 999) / 1000;
14448 +static void atmci_set_timeout(struct atmel_mci *host,
14449 + struct mmc_data *data)
14451 + static unsigned dtomul_to_shift[] = {
14452 + 0, 4, 7, 8, 10, 12, 16, 20
14454 + unsigned timeout;
14455 + unsigned dtocyc, dtomul;
14457 + timeout = ns_to_clocks(host, data->timeout_ns) + data->timeout_clks;
14459 + for (dtomul = 0; dtomul < 8; dtomul++) {
14460 + unsigned shift = dtomul_to_shift[dtomul];
14461 + dtocyc = (timeout + (1 << shift) - 1) >> shift;
14466 + if (dtomul >= 8) {
14471 + dev_dbg(&host->mmc->class_dev, "setting timeout to %u cycles\n",
14472 + dtocyc << dtomul_to_shift[dtomul]);
14473 + mci_writel(host, DTOR, (MCI_BF(DTOMUL, dtomul)
14474 + | MCI_BF(DTOCYC, dtocyc)));
14478 + * Return mask with command flags to be enabled for this command.
14480 +static u32 atmci_prepare_command(struct mmc_host *mmc,
14481 + struct mmc_command *cmd)
14487 + cmdr = MCI_BF(CMDNB, cmd->opcode);
14489 + if (cmd->flags & MMC_RSP_PRESENT) {
14490 + if (cmd->flags & MMC_RSP_136)
14491 + cmdr |= MCI_BF(RSPTYP, MCI_RSPTYP_136_BIT);
14493 + cmdr |= MCI_BF(RSPTYP, MCI_RSPTYP_48_BIT);
14497 + * This should really be MAXLAT_5 for CMD2 and ACMD41, but
14498 + * it's too difficult to determine whether this is an ACMD or
14499 + * not. Better make it 64.
14501 + cmdr |= MCI_BIT(MAXLAT);
14503 + if (mmc->ios.bus_mode == MMC_BUSMODE_OPENDRAIN)
14504 + cmdr |= MCI_BIT(OPDCMD);
14506 + dev_dbg(&mmc->class_dev,
14507 + "cmd: op %02x arg %08x flags %08x, cmdflags %08lx\n",
14508 + cmd->opcode, cmd->arg, cmd->flags, (unsigned long)cmdr);
14513 +static void atmci_start_command(struct atmel_mci *host,
14514 + struct mmc_command *cmd,
14517 + WARN_ON(host->cmd);
14520 + mci_writel(host, ARGR, cmd->arg);
14521 + mci_writel(host, CMDR, cmd_flags);
14524 + dma_start_request(host->dma.req.req.dmac,
14525 + host->dma.req.req.channel);
14529 + * Returns a mask of flags to be set in the command register when the
14530 + * command to start the transfer is to be sent.
14532 +static u32 atmci_prepare_data(struct mmc_host *mmc, struct mmc_data *data)
14534 + struct atmel_mci *host = mmc_priv(mmc);
14537 + WARN_ON(host->data);
14538 + host->data = data;
14540 + atmci_set_timeout(host, data);
14541 + mci_writel(host, BLKR, (MCI_BF(BCNT, data->blocks)
14542 + | MCI_BF(BLKLEN, data->blksz)));
14543 + host->dma.req.block_size = data->blksz;
14544 + host->dma.req.nr_blocks = data->blocks;
14546 + cmd_flags = MCI_BF(TRCMD, MCI_TRCMD_START_TRANS);
14547 + if (data->flags & MMC_DATA_STREAM)
14548 + cmd_flags |= MCI_BF(TRTYP, MCI_TRTYP_STREAM);
14549 + else if (data->blocks > 1)
14550 + cmd_flags |= MCI_BF(TRTYP, MCI_TRTYP_MULTI_BLOCK);
14552 + cmd_flags |= MCI_BF(TRTYP, MCI_TRTYP_BLOCK);
14554 + if (data->flags & MMC_DATA_READ) {
14555 + cmd_flags |= MCI_BIT(TRDIR);
14556 + host->dma.req.nr_sg
14557 + = dma_map_sg(&host->pdev->dev, data->sg,
14558 + data->sg_len, DMA_FROM_DEVICE);
14559 + host->dma.req.periph_id = host->dma.rx_periph_id;
14560 + host->dma.req.direction = DMA_DIR_PERIPH_TO_MEM;
14561 + host->dma.req.data_reg = host->mapbase + MCI_RDR;
14563 + host->dma.req.nr_sg
14564 + = dma_map_sg(&host->pdev->dev, data->sg,
14565 + data->sg_len, DMA_TO_DEVICE);
14566 + host->dma.req.periph_id = host->dma.tx_periph_id;
14567 + host->dma.req.direction = DMA_DIR_MEM_TO_PERIPH;
14568 + host->dma.req.data_reg = host->mapbase + MCI_TDR;
14570 + host->dma.req.sg = data->sg;
14572 + dma_prepare_request_sg(host->dma.req.req.dmac, &host->dma.req);
14574 + return cmd_flags;
14577 +static void atmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
14579 + struct atmel_mci *host = mmc_priv(mmc);
14580 + struct mmc_data *data = mrq->data;
14582 + u32 cmdflags = 0;
14584 + iflags = mci_readl(host, IMR);
14586 + dev_warn(&mmc->class_dev, "WARNING: IMR=0x%08x\n",
14587 + mci_readl(host, IMR));
14589 + WARN_ON(host->mrq != NULL);
14592 + * We may "know" the card is gone even though there's still an
14593 + * electrical connection. If so, we really need to communicate
14594 + * this to the MMC core since there won't be any more
14595 + * interrupts as the card is completely removed. Otherwise,
14596 + * the MMC core might believe the card is still there even
14597 + * though the card was just removed very slowly.
14599 + if (!host->present) {
14600 + mrq->cmd->error = -ENOMEDIUM;
14601 + mmc_request_done(mmc, mrq);
14606 + host->pending_events = 0;
14607 + host->completed_events = 0;
14609 + iflags = MCI_BIT(CMDRDY);
14610 + cmdflags = atmci_prepare_command(mmc, mrq->cmd);
14615 + host->stop_cmdr = atmci_prepare_command(mmc, mrq->stop);
14616 + host->stop_cmdr |= MCI_BF(TRCMD, MCI_TRCMD_STOP_TRANS);
14617 + if (!(data->flags & MMC_DATA_WRITE))
14618 + host->stop_cmdr |= MCI_BIT(TRDIR);
14619 + if (data->flags & MMC_DATA_STREAM)
14620 + host->stop_cmdr |= MCI_BF(TRTYP, MCI_TRTYP_STREAM);
14622 + host->stop_cmdr |= MCI_BF(TRTYP, MCI_TRTYP_MULTI_BLOCK);
14625 + cmdflags |= atmci_prepare_data(mmc, data);
14626 + iflags |= MCI_DATA_ERROR_FLAGS;
14629 + atmci_start_command(host, mrq->cmd, cmdflags);
14630 + mci_writel(host, IER, iflags);
14633 +static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
14635 + struct atmel_mci *host = mmc_priv(mmc);
14638 + if (ios->clock) {
14641 + /* Set clock rate */
14642 + clkdiv = DIV_ROUND_UP(host->bus_hz, 2 * ios->clock) - 1;
14643 + if (clkdiv > 255) {
14644 + dev_warn(&mmc->class_dev,
14645 + "clock %u too slow; using %lu\n",
14646 + ios->clock, host->bus_hz / (2 * 256));
14650 + mr = mci_readl(host, MR);
14651 + mr = MCI_BFINS(CLKDIV, clkdiv, mr)
14652 + | MCI_BIT(WRPROOF) | MCI_BIT(RDPROOF);
14653 + mci_writel(host, MR, mr);
14655 + /* Enable the MCI controller */
14656 + mci_writel(host, CR, MCI_BIT(MCIEN));
14658 + /* Disable the MCI controller */
14659 + mci_writel(host, CR, MCI_BIT(MCIDIS));
14662 + switch (ios->bus_width) {
14663 + case MMC_BUS_WIDTH_1:
14664 + mci_writel(host, SDCR, 0);
14666 + case MMC_BUS_WIDTH_4:
14667 + mci_writel(host, SDCR, MCI_BIT(SDCBUS));
14671 + switch (ios->power_mode) {
14672 + case MMC_POWER_ON:
14673 + /* Send init sequence (74 clock cycles) */
14674 + mci_writel(host, IDR, ~0UL);
14675 + mci_writel(host, CMDR, MCI_BF(SPCMD, MCI_SPCMD_INIT_CMD));
14676 + while (!(mci_readl(host, SR) & MCI_BIT(CMDRDY)))
14681 + * TODO: None of the currently available AVR32-based
14682 + * boards allow MMC power to be turned off. Implement
14683 + * power control when this can be tested properly.
14689 +static int atmci_get_ro(struct mmc_host *mmc)
14691 + int read_only = 0;
14692 + struct atmel_mci *host = mmc_priv(mmc);
14694 + if (host->wp_pin >= 0) {
14695 + read_only = gpio_get_value(host->wp_pin);
14696 + dev_dbg(&mmc->class_dev, "card is %s\n",
14697 + read_only ? "read-only" : "read-write");
14699 + dev_dbg(&mmc->class_dev,
14700 + "no pin for checking read-only switch."
14701 + " Assuming write-enable.\n");
14704 + return read_only;
14707 +static struct mmc_host_ops atmci_ops = {
14708 + .request = atmci_request,
14709 + .set_ios = atmci_set_ios,
14710 + .get_ro = atmci_get_ro,
14713 +static void atmci_request_end(struct mmc_host *mmc, struct mmc_request *mrq)
14715 + struct atmel_mci *host = mmc_priv(mmc);
14717 + WARN_ON(host->cmd || host->data);
14718 + host->mrq = NULL;
14720 + mmc_request_done(mmc, mrq);
14723 +static void send_stop_cmd(struct mmc_host *mmc, struct mmc_data *data,
14726 + struct atmel_mci *host = mmc_priv(mmc);
14728 + atmci_start_command(host, data->stop, host->stop_cmdr | flags);
14729 + mci_writel(host, IER, MCI_BIT(CMDRDY));
14732 +static void atmci_data_complete(struct atmel_mci *host, struct mmc_data *data)
14734 + host->data = NULL;
14735 + dma_unmap_sg(&host->pdev->dev, data->sg, host->dma.req.nr_sg,
14736 + ((data->flags & MMC_DATA_WRITE)
14737 + ? DMA_TO_DEVICE : DMA_FROM_DEVICE));
14740 + * Data might complete before command for very short transfers
14741 + * (like READ_SCR)
14743 + if (mci_cmd_is_complete(host)
14744 + && (!data->stop || mci_stop_is_complete(host)))
14745 + atmci_request_end(host->mmc, data->mrq);
14748 +static void atmci_command_complete(struct atmel_mci *host,
14749 + struct mmc_command *cmd, u32 status)
14751 + if (status & MCI_BIT(RTOE))
14752 + cmd->error = -ETIMEDOUT;
14753 + else if ((cmd->flags & MMC_RSP_CRC)
14754 + && (status & MCI_BIT(RCRCE)))
14755 + cmd->error = -EILSEQ;
14756 + else if (status & (MCI_BIT(RINDE) | MCI_BIT(RDIRE) | MCI_BIT(RENDE)))
14757 + cmd->error = -EIO;
14759 + if (cmd->error) {
14760 + dev_dbg(&host->mmc->class_dev,
14761 + "command error: op=0x%x status=0x%08x\n",
14762 + cmd->opcode, status);
14765 + dma_stop_request(host->dma.req.req.dmac,
14766 + host->dma.req.req.channel);
14767 + mci_writel(host, IDR, MCI_BIT(NOTBUSY)
14768 + | MCI_DATA_ERROR_FLAGS);
14769 + host->data = NULL;
14774 +static void atmci_detect_change(unsigned long data)
14776 + struct atmel_mci *host = (struct atmel_mci *)data;
14777 + struct mmc_request *mrq = host->mrq;
14781 + * atmci_remove() sets detect_pin to -1 before freeing the
14782 + * interrupt. We must not re-enable the interrupt if it has
14786 + if (host->detect_pin < 0)
14789 + enable_irq(gpio_to_irq(host->detect_pin));
14790 + present = !gpio_get_value(host->detect_pin);
14792 + dev_vdbg(&host->pdev->dev, "detect change: %d (was %d)\n",
14793 + present, host->present);
14795 + if (present != host->present) {
14796 + dev_dbg(&host->mmc->class_dev, "card %s\n",
14797 + present ? "inserted" : "removed");
14798 + host->present = present;
14800 + /* Reset controller if card is gone */
14802 + mci_writel(host, CR, MCI_BIT(SWRST));
14803 + mci_writel(host, IDR, ~0UL);
14804 + mci_writel(host, CR, MCI_BIT(MCIEN));
14807 + /* Clean up queue if present */
14809 + if (!mci_cmd_is_complete(host))
14810 + mrq->cmd->error = -ENOMEDIUM;
14811 + if (mrq->data && !mci_data_is_complete(host)
14812 + && !mci_data_error_is_complete(host)) {
14813 + dma_stop_request(host->dma.req.req.dmac,
14814 + host->dma.req.req.channel);
14815 + host->data->error = -ENOMEDIUM;
14816 + atmci_data_complete(host, host->data);
14818 + if (mrq->stop && !mci_stop_is_complete(host))
14819 + mrq->stop->error = -ENOMEDIUM;
14821 + host->cmd = NULL;
14822 + atmci_request_end(host->mmc, mrq);
14825 + mmc_detect_change(host->mmc, 0);
14829 +static void atmci_tasklet_func(unsigned long priv)
14831 + struct mmc_host *mmc = (struct mmc_host *)priv;
14832 + struct atmel_mci *host = mmc_priv(mmc);
14833 + struct mmc_request *mrq = host->mrq;
14834 + struct mmc_data *data = host->data;
14836 + dev_vdbg(&mmc->class_dev,
14837 + "tasklet: pending/completed/mask %lx/%lx/%x\n",
14838 + host->pending_events, host->completed_events,
14839 + mci_readl(host, IMR));
14841 + if (mci_clear_cmd_is_pending(host)) {
14842 + mci_set_cmd_complete(host);
14843 + atmci_command_complete(host, mrq->cmd, host->cmd_status);
14844 + if (!host->data || mci_data_is_complete(host)
14845 + || mci_data_error_is_complete(host))
14846 + atmci_request_end(mmc, mrq);
14848 + if (mci_clear_stop_is_pending(host)) {
14849 + mci_set_stop_complete(host);
14850 + atmci_command_complete(host, mrq->stop, host->stop_status);
14851 + if (mci_data_is_complete(host)
14852 + || mci_data_error_is_complete(host))
14853 + atmci_request_end(mmc, mrq);
14855 + if (mci_clear_dma_error_is_pending(host)) {
14856 + mci_set_dma_error_complete(host);
14857 + mci_clear_data_pending(host);
14859 + /* DMA controller got bus error => invalid address */
14860 + data->error = -EIO;
14862 + dev_dbg(&mmc->class_dev, "dma error after %u bytes xfered\n",
14863 + host->data->bytes_xfered);
14866 + && !mci_set_stop_sent_is_completed(host))
14867 + /* TODO: Check if card is still present */
14868 + send_stop_cmd(host->mmc, data, 0);
14870 + atmci_data_complete(host, data);
14872 + if (mci_clear_data_error_is_pending(host)) {
14873 + u32 status = host->data_status;
14875 + mci_set_data_error_complete(host);
14876 + mci_clear_data_pending(host);
14878 + dma_stop_request(host->dma.req.req.dmac,
14879 + host->dma.req.req.channel);
14881 + if (status & MCI_BIT(DCRCE)) {
14882 + dev_dbg(&mmc->class_dev, "data CRC error\n");
14883 + data->error = -EILSEQ;
14884 + } else if (status & MCI_BIT(DTOE)) {
14885 + dev_dbg(&mmc->class_dev, "data timeout error\n");
14886 + data->error = -ETIMEDOUT;
14888 + dev_dbg(&mmc->class_dev, "data FIFO error\n");
14889 + data->error = -EIO;
14891 + dev_dbg(&mmc->class_dev, "bytes xfered: %u\n",
14892 + data->bytes_xfered);
14895 + && !mci_set_stop_sent_is_completed(host))
14896 + /* TODO: Check if card is still present */
14897 + send_stop_cmd(host->mmc, data, 0);
14899 + atmci_data_complete(host, data);
14901 + if (mci_clear_data_is_pending(host)) {
14902 + mci_set_data_complete(host);
14903 + data->bytes_xfered = data->blocks * data->blksz;
14904 + atmci_data_complete(host, data);
14908 +static void atmci_cmd_interrupt(struct mmc_host *mmc, u32 status)
14910 + struct atmel_mci *host = mmc_priv(mmc);
14911 + struct mmc_command *cmd = host->cmd;
14914 + * Read the response now so that we're free to send a new
14915 + * command immediately.
14917 + cmd->resp[0] = mci_readl(host, RSPR);
14918 + cmd->resp[1] = mci_readl(host, RSPR);
14919 + cmd->resp[2] = mci_readl(host, RSPR);
14920 + cmd->resp[3] = mci_readl(host, RSPR);
14922 + mci_writel(host, IDR, MCI_BIT(CMDRDY));
14923 + host->cmd = NULL;
14925 + if (mci_stop_sent_is_complete(host)) {
14926 + host->stop_status = status;
14927 + mci_set_stop_pending(host);
14929 + struct mmc_request *mrq = host->mrq;
14931 + if (mrq->stop && mci_dma_is_complete(host)
14932 + && !mci_set_stop_sent_is_completed(host))
14933 + send_stop_cmd(host->mmc, mrq->data, 0);
14934 + host->cmd_status = status;
14935 + mci_set_cmd_pending(host);
14938 + tasklet_schedule(&host->tasklet);
14941 +static void atmci_xfer_complete(struct dma_request *_req)
14943 + struct dma_request_sg *req = to_dma_request_sg(_req);
14944 + struct atmel_mci_dma *dma;
14945 + struct atmel_mci *host;
14946 + struct mmc_data *data;
14948 + dma = container_of(req, struct atmel_mci_dma, req);
14949 + host = container_of(dma, struct atmel_mci, dma);
14950 + data = host->data;
14953 + * This callback may be called before we see the CMDRDY
14954 + * interrupt under heavy irq load (possibly caused by other
14955 + * drivers) or when interrupts are disabled for a long time.
14957 + mci_set_dma_complete(host);
14958 + if (data->stop && mci_cmd_is_complete(host)
14959 + && !mci_set_stop_sent_is_completed(host))
14960 + send_stop_cmd(host->mmc, data, 0);
14963 + * Regardless of what the documentation says, we have to wait
14964 + * for NOTBUSY even after block read operations.
14966 + * When the DMA transfer is complete, the controller may still
14967 + * be reading the CRC from the card, i.e. the data transfer is
14968 + * still in progress and we haven't seen all the potential
14969 + * error bits yet.
14971 + mci_writel(host, IER, MCI_BIT(NOTBUSY));
14974 +static void atmci_dma_error(struct dma_request *_req)
14976 + struct dma_request_sg *req = to_dma_request_sg(_req);
14977 + struct atmel_mci_dma *dma;
14978 + struct atmel_mci *host;
14980 + dma = container_of(req, struct atmel_mci_dma, req);
14981 + host = container_of(dma, struct atmel_mci, dma);
14983 + mci_writel(host, IDR, (MCI_BIT(NOTBUSY)
14984 + | MCI_DATA_ERROR_FLAGS));
14986 + mci_set_dma_error_pending(host);
14987 + tasklet_schedule(&host->tasklet);
14990 +static irqreturn_t atmci_interrupt(int irq, void *dev_id)
14992 + struct mmc_host *mmc = dev_id;
14993 + struct atmel_mci *host = mmc_priv(mmc);
14994 + u32 status, mask, pending;
14996 + spin_lock(&mmc->lock);
14998 + status = mci_readl(host, SR);
14999 + mask = mci_readl(host, IMR);
15000 + pending = status & mask;
15003 + if (pending & MCI_DATA_ERROR_FLAGS) {
15004 + mci_writel(host, IDR, (MCI_BIT(NOTBUSY)
15005 + | MCI_DATA_ERROR_FLAGS));
15006 + host->data_status = status;
15007 + mci_set_data_error_pending(host);
15008 + tasklet_schedule(&host->tasklet);
15011 + if (pending & MCI_BIT(CMDRDY))
15012 + atmci_cmd_interrupt(mmc, status);
15013 + if (pending & MCI_BIT(NOTBUSY)) {
15014 + mci_writel(host, IDR, (MCI_BIT(NOTBUSY)
15015 + | MCI_DATA_ERROR_FLAGS));
15016 + mci_set_data_pending(host);
15017 + tasklet_schedule(&host->tasklet);
15020 + status = mci_readl(host, SR);
15021 + mask = mci_readl(host, IMR);
15022 + pending = status & mask;
15023 + } while (pending);
15025 + spin_unlock(&mmc->lock);
15027 + return IRQ_HANDLED;
15030 +static irqreturn_t atmci_detect_interrupt(int irq, void *dev_id)
15032 + struct mmc_host *mmc = dev_id;
15033 + struct atmel_mci *host = mmc_priv(mmc);
15036 + * Disable interrupts until the pin has stabilized and check
15037 + * the state then. Use mod_timer() since we may be in the
15038 + * middle of the timer routine when this interrupt triggers.
15040 + disable_irq_nosync(irq);
15041 + mod_timer(&host->detect_timer, jiffies + msecs_to_jiffies(20));
15043 + return IRQ_HANDLED;
15046 +static int __devinit atmci_probe(struct platform_device *pdev)
15048 + struct mci_platform_data *board;
15049 + struct atmel_mci *host;
15050 + struct mmc_host *mmc;
15051 + struct resource *regs;
15055 + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
15058 + irq = platform_get_irq(pdev, 0);
15062 + board = pdev->dev.platform_data;
15064 + mmc = mmc_alloc_host(sizeof(struct atmel_mci), &pdev->dev);
15068 + host = mmc_priv(mmc);
15069 + host->pdev = pdev;
15072 + host->detect_pin = board->detect_pin;
15073 + host->wp_pin = board->wp_pin;
15075 + host->detect_pin = -1;
15076 + host->wp_pin = -1;
15079 + host->mck = clk_get(&pdev->dev, "mci_clk");
15080 + if (IS_ERR(host->mck)) {
15081 + ret = PTR_ERR(host->mck);
15082 + goto out_free_host;
15084 + clk_enable(host->mck);
15087 + host->regs = ioremap(regs->start, regs->end - regs->start + 1);
15089 + goto out_disable_clk;
15091 + host->bus_hz = clk_get_rate(host->mck);
15092 + host->mapbase = regs->start;
15094 + mmc->ops = &atmci_ops;
15095 + mmc->f_min = (host->bus_hz + 511) / 512;
15096 + mmc->f_max = min((unsigned int)(host->bus_hz / 2), fmax);
15097 + mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
15098 + mmc->caps |= MMC_CAP_4_BIT_DATA;
15100 + tasklet_init(&host->tasklet, atmci_tasklet_func, (unsigned long)mmc);
15102 + ret = request_irq(irq, atmci_interrupt, 0, "mmci", mmc);
15106 + /* Assume card is present if we don't have a detect pin */
15107 + host->present = 1;
15108 + if (host->detect_pin >= 0) {
15109 + if (gpio_request(host->detect_pin, "mmc_detect")) {
15110 + dev_dbg(&mmc->class_dev, "no detect pin available\n");
15111 + host->detect_pin = -1;
15113 + host->present = !gpio_get_value(host->detect_pin);
15116 + if (host->wp_pin >= 0) {
15117 + if (gpio_request(host->wp_pin, "mmc_wp")) {
15118 + dev_dbg(&mmc->class_dev, "no WP pin available\n");
15119 + host->wp_pin = -1;
15123 + /* TODO: Get this information from platform data */
15125 + host->dma.req.req.dmac = find_dma_controller(0);
15126 + if (!host->dma.req.req.dmac) {
15127 + dev_dbg(&mmc->class_dev, "no DMA controller available\n");
15128 + goto out_free_irq;
15130 + ret = dma_alloc_channel(host->dma.req.req.dmac);
15132 + dev_dbg(&mmc->class_dev, "unable to allocate DMA channel\n");
15133 + goto out_free_irq;
15135 + host->dma.req.req.channel = ret;
15136 + host->dma.req.width = DMA_WIDTH_32BIT;
15137 + host->dma.req.req.xfer_complete = atmci_xfer_complete;
15138 + host->dma.req.req.block_complete = NULL; // atmci_block_complete;
15139 + host->dma.req.req.error = atmci_dma_error;
15140 + host->dma.rx_periph_id = 0;
15141 + host->dma.tx_periph_id = 1;
15143 + mci_writel(host, CR, MCI_BIT(SWRST));
15144 + mci_writel(host, IDR, ~0UL);
15146 + platform_set_drvdata(pdev, host);
15148 + mmc_add_host(mmc);
15150 + if (host->detect_pin >= 0) {
15151 + setup_timer(&host->detect_timer, atmci_detect_change,
15152 + (unsigned long)host);
15154 + ret = request_irq(gpio_to_irq(host->detect_pin),
15155 + atmci_detect_interrupt,
15156 + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
15157 + DRIVER_NAME, mmc);
15159 + dev_dbg(&mmc->class_dev,
15160 + "could not request IRQ %d for detect pin\n",
15161 + gpio_to_irq(host->detect_pin));
15162 + gpio_free(host->detect_pin);
15163 + host->detect_pin = -1;
15167 + dev_info(&mmc->class_dev, "Atmel MCI controller at 0x%08lx irq %d\n",
15168 + host->mapbase, irq);
15170 + atmci_init_debugfs(host);
15175 + if (host->detect_pin >= 0)
15176 + gpio_free(host->detect_pin);
15177 + if (host->wp_pin >= 0)
15178 + gpio_free(host->wp_pin);
15179 + free_irq(irq, mmc);
15181 + iounmap(host->regs);
15183 + clk_disable(host->mck);
15184 + clk_put(host->mck);
15186 + mmc_free_host(mmc);
15190 +static int __devexit atmci_remove(struct platform_device *pdev)
15192 + struct atmel_mci *host = platform_get_drvdata(pdev);
15194 + platform_set_drvdata(pdev, NULL);
15197 + atmci_cleanup_debugfs(host);
15199 + if (host->detect_pin >= 0) {
15200 + int pin = host->detect_pin;
15202 + /* Make sure our timer doesn't enable the interrupt */
15203 + host->detect_pin = -1;
15206 + free_irq(gpio_to_irq(pin), host->mmc);
15207 + del_timer_sync(&host->detect_timer);
15208 + cancel_delayed_work(&host->mmc->detect);
15212 + mmc_remove_host(host->mmc);
15214 + mci_writel(host, IDR, ~0UL);
15215 + mci_writel(host, CR, MCI_BIT(MCIDIS));
15216 + mci_readl(host, SR);
15218 + dma_release_channel(host->dma.req.req.dmac,
15219 + host->dma.req.req.channel);
15221 + if (host->wp_pin >= 0)
15222 + gpio_free(host->wp_pin);
15224 + free_irq(platform_get_irq(pdev, 0), host->mmc);
15225 + iounmap(host->regs);
15227 + clk_disable(host->mck);
15228 + clk_put(host->mck);
15230 + mmc_free_host(host->mmc);
15235 +static struct platform_driver atmci_driver = {
15236 + .probe = atmci_probe,
15237 + .remove = __devexit_p(atmci_remove),
15239 + .name = DRIVER_NAME,
15243 +static int __init atmci_init(void)
15245 + return platform_driver_register(&atmci_driver);
15248 +static void __exit atmci_exit(void)
15250 + platform_driver_unregister(&atmci_driver);
15253 +module_init(atmci_init);
15254 +module_exit(atmci_exit);
15256 +MODULE_DESCRIPTION("Atmel Multimedia Card Interface driver");
15257 +MODULE_LICENSE("GPL");
15258 diff -urN linux-2.6.24.3/drivers/mmc/host/atmel-mci.h avr32-2.6/drivers/mmc/host/atmel-mci.h
15259 --- linux-2.6.24.3/drivers/mmc/host/atmel-mci.h 1970-01-01 01:00:00.000000000 +0100
15260 +++ avr32-2.6/drivers/mmc/host/atmel-mci.h 2008-04-23 19:33:40.000000000 +0200
15263 + * Atmel MultiMedia Card Interface driver
15265 + * Copyright (C) 2004-2006 Atmel Corporation
15267 + * This program is free software; you can redistribute it and/or modify
15268 + * it under the terms of the GNU General Public License version 2 as
15269 + * published by the Free Software Foundation.
15271 +#ifndef __DRIVERS_MMC_ATMEL_MCI_H__
15272 +#define __DRIVERS_MMC_ATMEL_MCI_H__
15274 +/* MCI register offsets */
15275 +#define MCI_CR 0x0000
15276 +#define MCI_MR 0x0004
15277 +#define MCI_DTOR 0x0008
15278 +#define MCI_SDCR 0x000c
15279 +#define MCI_ARGR 0x0010
15280 +#define MCI_CMDR 0x0014
15281 +#define MCI_BLKR 0x0018
15282 +#define MCI_RSPR 0x0020
15283 +#define MCI_RSPR1 0x0024
15284 +#define MCI_RSPR2 0x0028
15285 +#define MCI_RSPR3 0x002c
15286 +#define MCI_RDR 0x0030
15287 +#define MCI_TDR 0x0034
15288 +#define MCI_SR 0x0040
15289 +#define MCI_IER 0x0044
15290 +#define MCI_IDR 0x0048
15291 +#define MCI_IMR 0x004c
15293 +/* Bitfields in CR */
15294 +#define MCI_MCIEN_OFFSET 0
15295 +#define MCI_MCIEN_SIZE 1
15296 +#define MCI_MCIDIS_OFFSET 1
15297 +#define MCI_MCIDIS_SIZE 1
15298 +#define MCI_PWSEN_OFFSET 2
15299 +#define MCI_PWSEN_SIZE 1
15300 +#define MCI_PWSDIS_OFFSET 3
15301 +#define MCI_PWSDIS_SIZE 1
15302 +#define MCI_SWRST_OFFSET 7
15303 +#define MCI_SWRST_SIZE 1
15305 +/* Bitfields in MR */
15306 +#define MCI_CLKDIV_OFFSET 0
15307 +#define MCI_CLKDIV_SIZE 8
15308 +#define MCI_PWSDIV_OFFSET 8
15309 +#define MCI_PWSDIV_SIZE 3
15310 +#define MCI_RDPROOF_OFFSET 11
15311 +#define MCI_RDPROOF_SIZE 1
15312 +#define MCI_WRPROOF_OFFSET 12
15313 +#define MCI_WRPROOF_SIZE 1
15314 +#define MCI_DMAPADV_OFFSET 14
15315 +#define MCI_DMAPADV_SIZE 1
15316 +#define MCI_BLKLEN_OFFSET 16
15317 +#define MCI_BLKLEN_SIZE 16
15319 +/* Bitfields in DTOR */
15320 +#define MCI_DTOCYC_OFFSET 0
15321 +#define MCI_DTOCYC_SIZE 4
15322 +#define MCI_DTOMUL_OFFSET 4
15323 +#define MCI_DTOMUL_SIZE 3
15325 +/* Bitfields in SDCR */
15326 +#define MCI_SDCSEL_OFFSET 0
15327 +#define MCI_SDCSEL_SIZE 4
15328 +#define MCI_SDCBUS_OFFSET 7
15329 +#define MCI_SDCBUS_SIZE 1
15331 +/* Bitfields in ARGR */
15332 +#define MCI_ARG_OFFSET 0
15333 +#define MCI_ARG_SIZE 32
15335 +/* Bitfields in CMDR */
15336 +#define MCI_CMDNB_OFFSET 0
15337 +#define MCI_CMDNB_SIZE 6
15338 +#define MCI_RSPTYP_OFFSET 6
15339 +#define MCI_RSPTYP_SIZE 2
15340 +#define MCI_SPCMD_OFFSET 8
15341 +#define MCI_SPCMD_SIZE 3
15342 +#define MCI_OPDCMD_OFFSET 11
15343 +#define MCI_OPDCMD_SIZE 1
15344 +#define MCI_MAXLAT_OFFSET 12
15345 +#define MCI_MAXLAT_SIZE 1
15346 +#define MCI_TRCMD_OFFSET 16
15347 +#define MCI_TRCMD_SIZE 2
15348 +#define MCI_TRDIR_OFFSET 18
15349 +#define MCI_TRDIR_SIZE 1
15350 +#define MCI_TRTYP_OFFSET 19
15351 +#define MCI_TRTYP_SIZE 2
15353 +/* Bitfields in BLKR */
15354 +#define MCI_BCNT_OFFSET 0
15355 +#define MCI_BCNT_SIZE 16
15357 +/* Bitfields in RSPRn */
15358 +#define MCI_RSP_OFFSET 0
15359 +#define MCI_RSP_SIZE 32
15361 +/* Bitfields in SR/IER/IDR/IMR */
15362 +#define MCI_CMDRDY_OFFSET 0
15363 +#define MCI_CMDRDY_SIZE 1
15364 +#define MCI_RXRDY_OFFSET 1
15365 +#define MCI_RXRDY_SIZE 1
15366 +#define MCI_TXRDY_OFFSET 2
15367 +#define MCI_TXRDY_SIZE 1
15368 +#define MCI_BLKE_OFFSET 3
15369 +#define MCI_BLKE_SIZE 1
15370 +#define MCI_DTIP_OFFSET 4
15371 +#define MCI_DTIP_SIZE 1
15372 +#define MCI_NOTBUSY_OFFSET 5
15373 +#define MCI_NOTBUSY_SIZE 1
15374 +#define MCI_ENDRX_OFFSET 6
15375 +#define MCI_ENDRX_SIZE 1
15376 +#define MCI_ENDTX_OFFSET 7
15377 +#define MCI_ENDTX_SIZE 1
15378 +#define MCI_RXBUFF_OFFSET 14
15379 +#define MCI_RXBUFF_SIZE 1
15380 +#define MCI_TXBUFE_OFFSET 15
15381 +#define MCI_TXBUFE_SIZE 1
15382 +#define MCI_RINDE_OFFSET 16
15383 +#define MCI_RINDE_SIZE 1
15384 +#define MCI_RDIRE_OFFSET 17
15385 +#define MCI_RDIRE_SIZE 1
15386 +#define MCI_RCRCE_OFFSET 18
15387 +#define MCI_RCRCE_SIZE 1
15388 +#define MCI_RENDE_OFFSET 19
15389 +#define MCI_RENDE_SIZE 1
15390 +#define MCI_RTOE_OFFSET 20
15391 +#define MCI_RTOE_SIZE 1
15392 +#define MCI_DCRCE_OFFSET 21
15393 +#define MCI_DCRCE_SIZE 1
15394 +#define MCI_DTOE_OFFSET 22
15395 +#define MCI_DTOE_SIZE 1
15396 +#define MCI_OVRE_OFFSET 30
15397 +#define MCI_OVRE_SIZE 1
15398 +#define MCI_UNRE_OFFSET 31
15399 +#define MCI_UNRE_SIZE 1
15401 +/* Constants for DTOMUL */
15402 +#define MCI_DTOMUL_1_CYCLE 0
15403 +#define MCI_DTOMUL_16_CYCLES 1
15404 +#define MCI_DTOMUL_128_CYCLES 2
15405 +#define MCI_DTOMUL_256_CYCLES 3
15406 +#define MCI_DTOMUL_1024_CYCLES 4
15407 +#define MCI_DTOMUL_4096_CYCLES 5
15408 +#define MCI_DTOMUL_65536_CYCLES 6
15409 +#define MCI_DTOMUL_1048576_CYCLES 7
15411 +/* Constants for RSPTYP */
15412 +#define MCI_RSPTYP_NO_RESP 0
15413 +#define MCI_RSPTYP_48_BIT 1
15414 +#define MCI_RSPTYP_136_BIT 2
15416 +/* Constants for SPCMD */
15417 +#define MCI_SPCMD_NO_SPEC_CMD 0
15418 +#define MCI_SPCMD_INIT_CMD 1
15419 +#define MCI_SPCMD_SYNC_CMD 2
15420 +#define MCI_SPCMD_INT_CMD 4
15421 +#define MCI_SPCMD_INT_RESP 5
15423 +/* Constants for TRCMD */
15424 +#define MCI_TRCMD_NO_TRANS 0
15425 +#define MCI_TRCMD_START_TRANS 1
15426 +#define MCI_TRCMD_STOP_TRANS 2
15428 +/* Constants for TRTYP */
15429 +#define MCI_TRTYP_BLOCK 0
15430 +#define MCI_TRTYP_MULTI_BLOCK 1
15431 +#define MCI_TRTYP_STREAM 2
15433 +/* Bit manipulation macros */
15434 +#define MCI_BIT(name) \
15435 + (1 << MCI_##name##_OFFSET)
15436 +#define MCI_BF(name,value) \
15437 + (((value) & ((1 << MCI_##name##_SIZE) - 1)) \
15438 + << MCI_##name##_OFFSET)
15439 +#define MCI_BFEXT(name,value) \
15440 + (((value) >> MCI_##name##_OFFSET) \
15441 + & ((1 << MCI_##name##_SIZE) - 1))
15442 +#define MCI_BFINS(name,value,old) \
15443 + (((old) & ~(((1 << MCI_##name##_SIZE) - 1) \
15444 + << MCI_##name##_OFFSET)) \
15445 + | MCI_BF(name,value))
15447 +/* Register access macros */
15448 +#define mci_readl(port,reg) \
15449 + __raw_readl((port)->regs + MCI_##reg)
15450 +#define mci_writel(port,reg,value) \
15451 + __raw_writel((value), (port)->regs + MCI_##reg)
15453 +#endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */
15454 diff -urN linux-2.6.24.3/drivers/mmc/host/Kconfig avr32-2.6/drivers/mmc/host/Kconfig
15455 --- linux-2.6.24.3/drivers/mmc/host/Kconfig 2008-02-26 01:20:20.000000000 +0100
15456 +++ avr32-2.6/drivers/mmc/host/Kconfig 2008-04-23 19:33:40.000000000 +0200
15461 +config MMC_ATMELMCI
15462 + tristate "Atmel Multimedia Card Interface support"
15463 + depends on AVR32 && MMC
15465 + This selects the Atmel Multimedia Card Interface. If you have
15466 + a AT91 (ARM) or AT32 (AVR32) platform with a Multimedia Card
15467 + slot, say Y or M here.
15469 + If unsure, say N.
15472 tristate "Motorola i.MX Multimedia Card Interface support"
15473 depends on ARCH_IMX
15474 diff -urN linux-2.6.24.3/drivers/mmc/host/Makefile avr32-2.6/drivers/mmc/host/Makefile
15475 --- linux-2.6.24.3/drivers/mmc/host/Makefile 2008-02-26 01:20:20.000000000 +0100
15476 +++ avr32-2.6/drivers/mmc/host/Makefile 2008-04-23 19:33:40.000000000 +0200
15478 obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
15479 obj-$(CONFIG_MMC_OMAP) += omap.o
15480 obj-$(CONFIG_MMC_AT91) += at91_mci.o
15481 +obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o
15482 obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o
15483 obj-$(CONFIG_MMC_SPI) += mmc_spi.o
15485 diff -urN linux-2.6.24.3/drivers/mtd/chips/cfi_cmdset_0001.c avr32-2.6/drivers/mtd/chips/cfi_cmdset_0001.c
15486 --- linux-2.6.24.3/drivers/mtd/chips/cfi_cmdset_0001.c 2008-02-26 01:20:20.000000000 +0100
15487 +++ avr32-2.6/drivers/mtd/chips/cfi_cmdset_0001.c 2008-04-23 20:12:41.000000000 +0200
15489 #define I82802AC 0x00ac
15490 #define MANUFACTURER_ST 0x0020
15491 #define M50LPW080 0x002F
15492 +#define AT49BV640D 0x02de
15494 static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
15495 static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
15496 @@ -157,6 +158,47 @@
15500 +/* Atmel chips don't use the same PRI format as Intel chips */
15501 +static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
15503 + struct map_info *map = mtd->priv;
15504 + struct cfi_private *cfi = map->fldrv_priv;
15505 + struct cfi_pri_intelext *extp = cfi->cmdset_priv;
15506 + struct cfi_pri_atmel atmel_pri;
15507 + uint32_t features = 0;
15509 + /* Reverse byteswapping */
15510 + extp->FeatureSupport = cpu_to_le32(extp->FeatureSupport);
15511 + extp->BlkStatusRegMask = cpu_to_le16(extp->BlkStatusRegMask);
15512 + extp->ProtRegAddr = cpu_to_le16(extp->ProtRegAddr);
15514 + memcpy(&atmel_pri, extp, sizeof(atmel_pri));
15515 + memset((char *)extp + 5, 0, sizeof(*extp) - 5);
15517 + printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
15519 + if (atmel_pri.Features & 0x01) /* chip erase supported */
15520 + features |= (1<<0);
15521 + if (atmel_pri.Features & 0x02) /* erase suspend supported */
15522 + features |= (1<<1);
15523 + if (atmel_pri.Features & 0x04) /* program suspend supported */
15524 + features |= (1<<2);
15525 + if (atmel_pri.Features & 0x08) /* simultaneous operations supported */
15526 + features |= (1<<9);
15527 + if (atmel_pri.Features & 0x20) /* page mode read supported */
15528 + features |= (1<<7);
15529 + if (atmel_pri.Features & 0x40) /* queued erase supported */
15530 + features |= (1<<4);
15531 + if (atmel_pri.Features & 0x80) /* Protection bits supported */
15532 + features |= (1<<6);
15534 + extp->FeatureSupport = features;
15536 + /* burst write mode not supported */
15537 + cfi->cfiq->BufWriteTimeoutTyp = 0;
15538 + cfi->cfiq->BufWriteTimeoutMax = 0;
15541 #ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
15542 /* Some Intel Strata Flash prior to FPO revision C has bugs in this area */
15543 static void fixup_intel_strataflash(struct mtd_info *mtd, void* param)
15544 @@ -234,6 +276,7 @@
15547 static struct cfi_fixup cfi_fixup_table[] = {
15548 + { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
15549 #ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
15550 { CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL },
15552 diff -urN linux-2.6.24.3/drivers/mtd/chips/cfi_cmdset_0002.c avr32-2.6/drivers/mtd/chips/cfi_cmdset_0002.c
15553 --- linux-2.6.24.3/drivers/mtd/chips/cfi_cmdset_0002.c 2008-02-26 01:20:20.000000000 +0100
15554 +++ avr32-2.6/drivers/mtd/chips/cfi_cmdset_0002.c 2008-04-23 20:12:41.000000000 +0200
15555 @@ -185,6 +185,10 @@
15556 extp->TopBottom = 2;
15558 extp->TopBottom = 3;
15560 + /* burst write mode not supported */
15561 + cfi->cfiq->BufWriteTimeoutTyp = 0;
15562 + cfi->cfiq->BufWriteTimeoutMax = 0;
15565 static void fixup_use_secsi(struct mtd_info *mtd, void *param)
15566 @@ -217,6 +221,7 @@
15569 static struct cfi_fixup cfi_fixup_table[] = {
15570 + { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
15571 #ifdef AMD_BOOTLOC_BUG
15572 { CFI_MFR_AMD, CFI_ID_ANY, fixup_amd_bootblock, NULL },
15574 @@ -229,7 +234,6 @@
15575 #if !FORCE_WORD_WRITE
15576 { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, },
15578 - { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
15579 { 0, 0, NULL, NULL }
15581 static struct cfi_fixup jedec_fixup_table[] = {
15582 diff -urN linux-2.6.24.3/drivers/pcmcia/at32_cf.c avr32-2.6/drivers/pcmcia/at32_cf.c
15583 --- linux-2.6.24.3/drivers/pcmcia/at32_cf.c 1970-01-01 01:00:00.000000000 +0100
15584 +++ avr32-2.6/drivers/pcmcia/at32_cf.c 2008-04-23 19:33:42.000000000 +0200
15587 + * Driver for AVR32 Static Memory Controller: CompactFlash support
15589 + * Copyright (C) 2006 Atmel Norway
15591 + * This program is free software; you can redistribute it and/or
15592 + * modify it under the terms of the GNU General Public License as
15593 + * published by the Free Software Foundation; either version 2 of the
15594 + * License, or (at your option) any later version.
15596 + * This program is distributed in the hope that it will be useful, but
15597 + * WITHOUT ANY WARRANTY; without even the implied warranty of
15598 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15599 + * General Public License for more details.
15601 + * You should have received a copy of the GNU General Public License
15602 + * along with this program; if not, write to the Free Software
15603 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
15604 + * 02111-1307, USA.
15606 + * The full GNU General Public License is included in this
15607 + * distribution in the file called COPYING.
15609 +#include <linux/module.h>
15610 +#include <linux/kernel.h>
15611 +#include <linux/platform_device.h>
15612 +#include <linux/init.h>
15613 +#include <linux/device.h>
15614 +#include <linux/delay.h>
15615 +#include <linux/interrupt.h>
15616 +#include <linux/err.h>
15617 +#include <linux/clk.h>
15618 +#include <linux/dma-mapping.h>
15620 +#include <pcmcia/ss.h>
15622 +#include <asm/gpio.h>
15623 +#include <asm/io.h>
15624 +#include <asm/arch/board.h>
15626 +#include <asm/arch/smc.h>
15628 +struct at32_cf_socket {
15629 + struct pcmcia_socket socket;
15634 + struct resource res_attr;
15635 + struct resource res_mem;
15636 + struct resource res_io;
15637 + struct smc_config smc;
15638 + unsigned int irq;
15639 + unsigned int cf_cs;
15640 + socket_state_t state;
15641 + unsigned present:1;
15643 +#define to_at32_cf(sock) container_of(sock, struct at32_cf_socket, socket)
15646 + * We have the following memory layout relative to the base address:
15648 + * Alt IDE Mode: 00e0 0000 -> 00ff ffff
15649 + * True IDE Mode: 00c0 0000 -> 00df ffff
15650 + * I/O memory: 0080 0000 -> 00bf ffff
15651 + * Common memory: 0040 0000 -> 007f ffff
15652 + * Attribute memory: 0000 0000 -> 003f ffff
15654 +#define CF_ATTR_OFFSET 0x00000000
15655 +#define CF_MEM_OFFSET 0x00400000
15656 +#define CF_IO_OFFSET 0x00800000
15657 +#define CF_RES_SIZE 4096
15661 +static int pc_debug;
15662 +module_param(pc_debug, int, 0644);
15664 +static void at32_cf_debug(struct at32_cf_socket *cf, const char *func,
15665 + int level, const char *fmt, ...)
15669 + if (pc_debug > level) {
15670 + printk(KERN_DEBUG "at32_cf/%u: %s: ", cf->cf_cs, func);
15671 + va_start(args, fmt);
15672 + vprintk(fmt, args);
15677 +#define debug(cf, lvl, fmt, arg...) \
15678 + at32_cf_debug(cf, __func__, lvl, fmt, ##arg)
15681 +#define debug(cf, lvl, fmt, arg...) do { } while (0)
15684 +static inline int at32_cf_present(struct at32_cf_socket *cf)
15688 + /* If we don't have a detect pin, assume the card is present */
15689 + if (cf->detect_pin >= 0)
15690 + present = !gpio_get_value(cf->detect_pin);
15695 +static irqreturn_t at32_cf_irq(int irq, void *dev_id)
15697 + struct at32_cf_socket *cf = dev_id;
15698 + unsigned int present;
15700 + present = at32_cf_present(cf);
15701 + if (present != cf->present) {
15702 + cf->present = present;
15703 + debug(cf, 3, "card %s\n", present ? "present" : "gone");
15704 + pcmcia_parse_events(&cf->socket, SS_DETECT);
15707 + return IRQ_HANDLED;
15710 +static int at32_cf_get_status(struct pcmcia_socket *sock, u_int *value)
15712 + struct at32_cf_socket *cf;
15713 + u_int status = 0;
15715 + cf = container_of(sock, struct at32_cf_socket, socket);
15717 + if (at32_cf_present(cf)) {
15718 + /* NOTE: gpio on AP7xxx is 3.3V */
15719 + status = SS_DETECT | SS_3VCARD;
15720 + if (cf->ready_pin < 0 || gpio_get_value(cf->ready_pin))
15721 + status |= SS_READY;
15722 + if (cf->vcc_pin < 0 || gpio_get_value(cf->vcc_pin))
15723 + status |= SS_POWERON;
15730 +static int at32_cf_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
15732 + struct at32_cf_socket *cf = container_of(sock, struct at32_cf_socket, socket);
15734 + debug(cf, 2, "mask: %s%s%s%s%s%sflags: %s%s%s%s%s%sVcc %d Vpp %d irq %d\n",
15735 + (state->csc_mask==0)?"<NONE> ":"",
15736 + (state->csc_mask&SS_DETECT)?"DETECT ":"",
15737 + (state->csc_mask&SS_READY)?"READY ":"",
15738 + (state->csc_mask&SS_BATDEAD)?"BATDEAD ":"",
15739 + (state->csc_mask&SS_BATWARN)?"BATWARN ":"",
15740 + (state->csc_mask&SS_STSCHG)?"STSCHG ":"",
15741 + (state->flags==0)?"<NONE> ":"",
15742 + (state->flags&SS_PWR_AUTO)?"PWR_AUTO ":"",
15743 + (state->flags&SS_IOCARD)?"IOCARD ":"",
15744 + (state->flags&SS_RESET)?"RESET ":"",
15745 + (state->flags&SS_SPKR_ENA)?"SPKR_ENA ":"",
15746 + (state->flags&SS_OUTPUT_ENA)?"OUTPUT_ENA ":"",
15747 + state->Vcc, state->Vpp, state->io_irq);
15750 + * TODO: Allow boards to override this in case they have level
15753 + switch (state->Vcc) {
15755 + if (cf->vcc_pin >= 0)
15756 + gpio_set_value(cf->vcc_pin, 0);
15759 + if (cf->vcc_pin >= 0)
15760 + gpio_set_value(cf->vcc_pin, 1);
15766 + if (cf->reset_pin >= 0)
15767 + gpio_set_value(cf->reset_pin, state->flags & SS_RESET);
15769 + cf->state = *state;
15774 +static int at32_cf_socket_init(struct pcmcia_socket *sock)
15776 + debug(to_at32_cf(sock), 2, "called\n");
15781 +static int at32_cf_suspend(struct pcmcia_socket *sock)
15783 + debug(to_at32_cf(sock), 2, "called\n");
15785 + at32_cf_set_socket(sock, &dead_socket);
15790 +static int at32_cf_set_io_map(struct pcmcia_socket *sock,
15791 + struct pccard_io_map *map)
15793 + struct at32_cf_socket *cf = container_of(sock, struct at32_cf_socket, socket);
15796 + debug(cf, 2, "map %u speed %u start 0x%08x stop 0x%08x\n",
15797 + map->map, map->speed, map->start, map->stop);
15798 + debug(cf, 2, "flags: %s%s%s%s%s%s%s%s\n",
15799 + (map->flags == 0) ? "<NONE>":"",
15800 + (map->flags & MAP_ACTIVE) ? "ACTIVE " : "",
15801 + (map->flags & MAP_16BIT) ? "16BIT " : "",
15802 + (map->flags & MAP_AUTOSZ) ? "AUTOSZ " : "",
15803 + (map->flags & MAP_0WS) ? "0WS " : "",
15804 + (map->flags & MAP_WRPROT) ? "WRPROT " : "",
15805 + (map->flags & MAP_USE_WAIT) ? "USE_WAIT " : "",
15806 + (map->flags & MAP_PREFETCH) ? "PREFETCH " : "");
15808 + map->flags &= MAP_ACTIVE | MAP_16BIT | MAP_USE_WAIT;
15810 + if (map->flags & MAP_16BIT)
15811 + cf->smc.bus_width = 2;
15813 + cf->smc.bus_width = 1;
15815 + if (map->flags & MAP_USE_WAIT)
15816 + cf->smc.nwait_mode = 3;
15818 + cf->smc.nwait_mode = 0;
15820 + retval = smc_set_configuration(cf->cf_cs, &cf->smc);
15822 + printk(KERN_ERR "at32_cf: could not set up SMC for I/O\n");
15826 + map->start = cf->socket.io_offset;
15827 + map->stop = map->start + CF_RES_SIZE - 1;
15833 +at32_cf_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map)
15835 + struct at32_cf_socket *cf;
15836 + struct resource *res;
15839 + cf = container_of(sock, struct at32_cf_socket, socket);
15841 + debug(cf, 2, "map %u speed %u card_start %08x\n",
15842 + map->map, map->speed, map->card_start);
15843 + debug(cf, 2, "flags: %s%s%s%s%s%s%s%s\n",
15844 + (map->flags==0)?"<NONE>":"",
15845 + (map->flags&MAP_ACTIVE)?"ACTIVE ":"",
15846 + (map->flags&MAP_16BIT)?"16BIT ":"",
15847 + (map->flags&MAP_AUTOSZ)?"AUTOSZ ":"",
15848 + (map->flags&MAP_0WS)?"0WS ":"",
15849 + (map->flags&MAP_WRPROT)?"WRPROT ":"",
15850 + (map->flags&MAP_ATTRIB)?"ATTRIB ":"",
15851 + (map->flags&MAP_USE_WAIT)?"USE_WAIT ":"");
15853 + if (map->card_start)
15856 + map->flags &= MAP_ACTIVE | MAP_ATTRIB | MAP_16BIT | MAP_USE_WAIT;
15858 + if (map->flags & MAP_ATTRIB) {
15859 + res = &cf->res_attr;
15861 + /* Linksys WCF12 seems to use WAIT when reading CIS */
15862 + map->flags |= MAP_USE_WAIT;
15864 + res = &cf->res_mem;
15867 + if (map->flags & MAP_USE_WAIT)
15868 + cf->smc.nwait_mode = 3;
15870 + cf->smc.nwait_mode = 0;
15872 + retval = smc_set_configuration(cf->cf_cs, &cf->smc);
15874 + printk(KERN_ERR "at32_cf: could not set up SMC for mem\n");
15878 + map->static_start = res->start;
15883 +static struct pccard_operations at32_cf_ops = {
15884 + .init = at32_cf_socket_init,
15885 + .suspend = at32_cf_suspend,
15886 + .get_status = at32_cf_get_status,
15887 + .set_socket = at32_cf_set_socket,
15888 + .set_io_map = at32_cf_set_io_map,
15889 + .set_mem_map = at32_cf_set_mem_map,
15892 +static int __init request_pin(struct platform_device *pdev,
15893 + unsigned int pin, const char *name)
15895 + if (gpio_request(pin, name)) {
15896 + dev_warn(&pdev->dev, "failed to request %s pin\n", name);
15903 +static struct smc_timing at32_cf_timing __initdata = {
15904 + .ncs_read_setup = 30,
15905 + .nrd_setup = 100,
15906 + .ncs_write_setup = 30,
15907 + .nwe_setup = 100,
15909 + .ncs_read_pulse = 360,
15910 + .nrd_pulse = 290,
15911 + .ncs_write_pulse = 360,
15912 + .nwe_pulse = 290,
15914 + .read_cycle = 420,
15915 + .write_cycle = 420,
15918 +static int __init at32_cf_probe(struct platform_device *pdev)
15920 + struct at32_cf_socket *cf;
15921 + struct cf_platform_data *board = pdev->dev.platform_data;
15922 + struct resource *res_skt;
15926 + dev_dbg(&pdev->dev, "probe");
15931 + res_skt = platform_get_resource(pdev, IORESOURCE_MEM, 0);
15935 + irq = platform_get_irq(pdev, 0);
15939 + cf = kzalloc(sizeof(struct at32_cf_socket), GFP_KERNEL);
15943 + cf->detect_pin = -1;
15944 + cf->reset_pin = -1;
15945 + cf->vcc_pin = -1;
15946 + cf->ready_pin = -1;
15947 + cf->cf_cs = board->cs;
15949 + if (board->detect_pin != GPIO_PIN_NONE)
15950 + cf->detect_pin = request_pin(pdev, board->detect_pin,
15952 + if (board->reset_pin != GPIO_PIN_NONE)
15953 + cf->reset_pin = request_pin(pdev, board->reset_pin,
15955 + if (board->vcc_pin != GPIO_PIN_NONE)
15956 + cf->vcc_pin = request_pin(pdev, board->vcc_pin,
15958 + if (board->ready_pin != GPIO_PIN_NONE)
15959 + /* READY is also used for irq through EIM */
15960 + cf->ready_pin = board->ready_pin;
15962 + debug(cf, 2, "pins: detect=%d reset=%d vcc=%d\n",
15963 + cf->detect_pin, cf->reset_pin, cf->vcc_pin);
15965 + cf->socket.pci_irq = irq;
15966 + cf->socket.ops = &at32_cf_ops;
15967 + cf->socket.resource_ops = &pccard_static_ops;
15968 + cf->socket.dev.parent = &pdev->dev;
15969 + cf->socket.owner = THIS_MODULE;
15970 + cf->socket.features =
15971 + SS_CAP_MEM_ALIGN | SS_CAP_STATIC_MAP | SS_CAP_PCCARD;
15972 + cf->socket.map_size = CF_RES_SIZE;
15974 + cf->res_attr.start = res_skt->start + CF_ATTR_OFFSET;
15975 + cf->res_attr.end = cf->res_attr.start + CF_RES_SIZE - 1;
15976 + cf->res_attr.name = "attribute";
15977 + cf->res_attr.flags = IORESOURCE_MEM;
15978 + ret = request_resource(res_skt, &cf->res_attr);
15980 + goto err_request_res_attr;
15982 + cf->res_mem.start = res_skt->start + CF_MEM_OFFSET;
15983 + cf->res_mem.end = cf->res_mem.start + CF_RES_SIZE - 1;
15984 + cf->res_mem.name = "memory";
15985 + cf->res_mem.flags = IORESOURCE_MEM;
15986 + ret = request_resource(res_skt, &cf->res_mem);
15988 + goto err_request_res_mem;
15990 + cf->res_io.start = res_skt->start + CF_IO_OFFSET;
15991 + cf->res_io.end = cf->res_io.start + CF_RES_SIZE - 1;
15992 + cf->res_io.name = "io";
15993 + cf->res_io.flags = IORESOURCE_MEM;
15994 + ret = request_resource(res_skt, &cf->res_io);
15996 + goto err_request_res_io;
15998 + cf->socket.io_offset = cf->res_io.start;
16000 + if (cf->detect_pin >= 0) {
16001 + ret = request_irq(gpio_to_irq(cf->detect_pin), at32_cf_irq,
16002 + IRQF_SHARED, "cf_detect", cf);
16005 + "failed to request cf_detect interrupt\n");
16006 + goto err_detect_irq;
16010 + cf->present = at32_cf_present(cf);
16012 + /* Setup SMC timings */
16013 + smc_set_timing(&cf->smc, &at32_cf_timing);
16015 + cf->smc.bus_width = 2;
16016 + cf->smc.nrd_controlled = 1;
16017 + cf->smc.nwe_controlled = 1;
16018 + cf->smc.nwait_mode = 0;
16019 + cf->smc.byte_write = 0;
16020 + cf->smc.tdf_cycles = 8;
16021 + cf->smc.tdf_mode = 0;
16023 + ret = smc_set_configuration(cf->cf_cs, &cf->smc);
16025 + debug(cf, 1, "failed to configure SMC\n", ret);
16029 + ret = pcmcia_register_socket(&cf->socket);
16031 + debug(cf, 1, "failed to register socket: %d\n", ret);
16032 + goto err_register_socket;
16035 + if (cf->reset_pin >= 0)
16036 + gpio_direction_output(cf->reset_pin, 0);
16038 + platform_set_drvdata(pdev, cf);
16040 + dev_info(&pdev->dev, "Atmel SMC CF interface at 0x%08lx\n",
16041 + (unsigned long)res_skt->start);
16045 +err_register_socket:
16047 + if (cf->detect_pin >= 0)
16048 + free_irq(gpio_to_irq(cf->detect_pin), cf);
16050 + release_resource(&cf->res_io);
16051 +err_request_res_io:
16052 + release_resource(&cf->res_mem);
16053 +err_request_res_mem:
16054 + release_resource(&cf->res_attr);
16055 +err_request_res_attr:
16056 + if (cf->vcc_pin >= 0)
16057 + gpio_free(cf->vcc_pin);
16058 + if (cf->reset_pin >= 0)
16059 + gpio_free(cf->reset_pin);
16060 + if (cf->detect_pin >= 0)
16061 + gpio_free(cf->detect_pin);
16067 +static int __exit at32_cf_remove(struct platform_device *pdev)
16069 + struct at32_cf_socket *cf = platform_get_drvdata(pdev);
16071 + pcmcia_unregister_socket(&cf->socket);
16072 + if (cf->detect_pin >= 0) {
16073 + free_irq(gpio_to_irq(cf->detect_pin), cf);
16074 + gpio_free(cf->detect_pin);
16076 + if (cf->vcc_pin >= 0)
16077 + gpio_free(cf->vcc_pin);
16078 + if (cf->reset_pin >= 0)
16079 + gpio_free(cf->reset_pin);
16081 + release_resource(&cf->res_io);
16082 + release_resource(&cf->res_mem);
16083 + release_resource(&cf->res_attr);
16085 + platform_set_drvdata(pdev, NULL);
16090 +static struct platform_driver at32_cf_driver = {
16091 + .remove = __exit_p(at32_cf_remove),
16093 + .name = "at32_cf",
16094 + .owner = THIS_MODULE,
16098 +static int __init at32_cf_init(void)
16102 + ret = platform_driver_probe(&at32_cf_driver, at32_cf_probe);
16104 + printk(KERN_ERR "at32_cf: probe failed: %d\n", ret);
16108 +static void __exit at32_cf_exit(void)
16110 + platform_driver_unregister(&at32_cf_driver);
16113 +module_init(at32_cf_init);
16114 +module_exit(at32_cf_exit);
16116 +MODULE_LICENSE("GPL");
16117 +MODULE_DESCRIPTION("Driver for SMC PCMCIA interface");
16118 +MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>");
16119 diff -urN linux-2.6.24.3/drivers/pcmcia/Kconfig avr32-2.6/drivers/pcmcia/Kconfig
16120 --- linux-2.6.24.3/drivers/pcmcia/Kconfig 2008-02-26 01:20:20.000000000 +0100
16121 +++ avr32-2.6/drivers/pcmcia/Kconfig 2008-04-23 19:33:42.000000000 +0200
16122 @@ -276,6 +276,13 @@
16123 Say Y here to support the CompactFlash controller on the
16124 PA Semi Electra eval board.
16127 + tristate "AT32AP CompactFlash Controller"
16128 + depends on PCMCIA && AVR32 && PLATFORM_AT32AP
16130 + Say Y here to support the CompactFlash controller on AT32 chips.
16131 + Or choose M to compile the driver as a module named "at32_cf".
16133 config PCCARD_NONSTATIC
16136 diff -urN linux-2.6.24.3/drivers/pcmcia/Makefile avr32-2.6/drivers/pcmcia/Makefile
16137 --- linux-2.6.24.3/drivers/pcmcia/Makefile 2008-02-26 01:20:20.000000000 +0100
16138 +++ avr32-2.6/drivers/pcmcia/Makefile 2008-04-23 19:33:42.000000000 +0200
16140 obj-$(CONFIG_OMAP_CF) += omap_cf.o
16141 obj-$(CONFIG_AT91_CF) += at91_cf.o
16142 obj-$(CONFIG_ELECTRA_CF) += electra_cf.o
16143 +obj-$(CONFIG_AT32_CF) += at32_cf.o
16145 sa11xx_core-y += soc_common.o sa11xx_base.o
16146 pxa2xx_core-y += soc_common.o pxa2xx_base.o
16147 diff -urN linux-2.6.24.3/drivers/serial/atmel_serial.c avr32-2.6/drivers/serial/atmel_serial.c
16148 --- linux-2.6.24.3/drivers/serial/atmel_serial.c 2008-02-26 01:20:20.000000000 +0100
16149 +++ avr32-2.6/drivers/serial/atmel_serial.c 2008-04-23 20:12:44.000000000 +0200
16151 * Based on drivers/char/serial_sa1100.c, by Deep Blue Solutions Ltd.
16152 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
16154 + * DMA support added by Chip Coldwell.
16156 * This program is free software; you can redistribute it and/or modify
16157 * it under the terms of the GNU General Public License as published by
16158 * the Free Software Foundation; either version 2 of the License, or
16160 #include <linux/sysrq.h>
16161 #include <linux/tty_flip.h>
16162 #include <linux/platform_device.h>
16163 +#include <linux/dma-mapping.h>
16164 #include <linux/atmel_pdc.h>
16165 +#include <linux/atmel_serial.h>
16167 #include <asm/io.h>
16170 #include <asm/arch/gpio.h>
16173 -#include "atmel_serial.h"
16174 +#define PDC_BUFFER_SIZE 512
16175 +/* Revisit: We should calculate this based on the actual port settings */
16176 +#define PDC_RX_TIMEOUT (3 * 10) /* 3 bytes */
16178 #if defined(CONFIG_SERIAL_ATMEL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
16179 #define SUPPORT_SYSRQ
16182 #define ATMEL_ISR_PASS_LIMIT 256
16184 +/* UART registers. CR is write-only, hence no GET macro */
16185 #define UART_PUT_CR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_CR)
16186 #define UART_GET_MR(port) __raw_readl((port)->membase + ATMEL_US_MR)
16187 #define UART_PUT_MR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_MR)
16189 #define UART_PUT_BRGR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_BRGR)
16190 #define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR)
16192 -// #define UART_GET_CR(port) __raw_readl((port)->membase + ATMEL_US_CR) // is write-only
16194 /* PDC registers */
16195 #define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR)
16196 #define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR)
16197 @@ -101,12 +106,24 @@
16199 #define UART_PUT_TPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TPR)
16200 #define UART_PUT_TCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TCR)
16201 -//#define UART_PUT_TNPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TNPR)
16202 -//#define UART_PUT_TNCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_TNCR)
16204 static int (*atmel_open_hook)(struct uart_port *);
16205 static void (*atmel_close_hook)(struct uart_port *);
16207 +struct atmel_dma_buffer {
16208 + unsigned char *buf;
16209 + dma_addr_t dma_addr;
16210 + unsigned int dma_size;
16211 + unsigned int ofs;
16214 +struct atmel_uart_char {
16219 +#define ATMEL_SERIAL_RINGSIZE 1024
16222 * We wrap our port structure around the generic uart_port.
16224 @@ -115,6 +132,19 @@
16225 struct clk *clk; /* uart clock */
16226 unsigned short suspended; /* is port suspended? */
16227 int break_active; /* break being received */
16229 + short use_dma_rx; /* enable PDC receiver */
16230 + short pdc_rx_idx; /* current PDC RX buffer */
16231 + struct atmel_dma_buffer pdc_rx[2]; /* PDC receier */
16233 + short use_dma_tx; /* enable PDC transmitter */
16234 + struct atmel_dma_buffer pdc_tx; /* PDC transmitter */
16236 + struct tasklet_struct tasklet;
16237 + unsigned int irq_status;
16238 + unsigned int irq_status_prev;
16240 + struct circ_buf rx_ring;
16243 static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART];
16244 @@ -123,6 +153,38 @@
16245 static struct console atmel_console;
16248 +static inline struct atmel_uart_port *
16249 +to_atmel_uart_port(struct uart_port *uart)
16251 + return container_of(uart, struct atmel_uart_port, uart);
16254 +#ifdef CONFIG_SERIAL_ATMEL_PDC
16255 +static bool atmel_use_dma_rx(struct uart_port *port)
16257 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16259 + return atmel_port->use_dma_rx;
16262 +static bool atmel_use_dma_tx(struct uart_port *port)
16264 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16266 + return atmel_port->use_dma_tx;
16269 +static bool atmel_use_dma_rx(struct uart_port *port)
16274 +static bool atmel_use_dma_tx(struct uart_port *port)
16281 * Return TIOCSER_TEMT when transmitter FIFO and Shift register is empty.
16283 @@ -142,8 +204,8 @@
16284 #ifdef CONFIG_ARCH_AT91RM9200
16285 if (cpu_is_at91rm9200()) {
16287 - * AT91RM9200 Errata #39: RTS0 is not internally connected to PA21.
16288 - * We need to drive the pin manually.
16289 + * AT91RM9200 Errata #39: RTS0 is not internally connected
16290 + * to PA21. We need to drive the pin manually.
16292 if (port->mapbase == AT91RM9200_BASE_US0) {
16293 if (mctrl & TIOCM_RTS)
16294 @@ -204,7 +266,12 @@
16296 static void atmel_stop_tx(struct uart_port *port)
16298 - UART_PUT_IDR(port, ATMEL_US_TXRDY);
16299 + if (atmel_use_dma_tx(port)) {
16300 + /* disable PDC transmit */
16301 + UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
16302 + UART_PUT_IDR(port, ATMEL_US_ENDTX | ATMEL_US_TXBUFE);
16304 + UART_PUT_IDR(port, ATMEL_US_TXRDY);
16308 @@ -212,7 +279,17 @@
16310 static void atmel_start_tx(struct uart_port *port)
16312 - UART_PUT_IER(port, ATMEL_US_TXRDY);
16313 + if (atmel_use_dma_tx(port)) {
16314 + if (UART_GET_PTSR(port) & ATMEL_PDC_TXTEN)
16315 + /* The transmitter is already running. Yes, we
16316 + really need this.*/
16319 + UART_PUT_IER(port, ATMEL_US_ENDTX | ATMEL_US_TXBUFE);
16320 + /* re-enable PDC transmit */
16321 + UART_PUT_PTCR(port, ATMEL_PDC_TXTEN);
16323 + UART_PUT_IER(port, ATMEL_US_TXRDY);
16327 @@ -220,7 +297,12 @@
16329 static void atmel_stop_rx(struct uart_port *port)
16331 - UART_PUT_IDR(port, ATMEL_US_RXRDY);
16332 + if (atmel_use_dma_rx(port)) {
16333 + /* disable PDC receive */
16334 + UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS);
16335 + UART_PUT_IDR(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT);
16337 + UART_PUT_IDR(port, ATMEL_US_RXRDY);
16341 @@ -228,7 +310,8 @@
16343 static void atmel_enable_ms(struct uart_port *port)
16345 - UART_PUT_IER(port, ATMEL_US_RIIC | ATMEL_US_DSRIC | ATMEL_US_DCDIC | ATMEL_US_CTSIC);
16346 + UART_PUT_IER(port, ATMEL_US_RIIC | ATMEL_US_DSRIC
16347 + | ATMEL_US_DCDIC | ATMEL_US_CTSIC);
16351 @@ -243,22 +326,63 @@
16355 + * Stores the incoming character in the ring buffer
16358 +atmel_buffer_rx_char(struct uart_port *port, unsigned int status,
16361 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16362 + struct circ_buf *ring = &atmel_port->rx_ring;
16363 + struct atmel_uart_char *c;
16365 + if (!CIRC_SPACE(ring->head, ring->tail, ATMEL_SERIAL_RINGSIZE))
16366 + /* Buffer overflow, ignore char */
16369 + c = &((struct atmel_uart_char *)ring->buf)[ring->head];
16370 + c->status = status;
16373 + /* Make sure the character is stored before we update head. */
16376 + ring->head = (ring->head + 1) & (ATMEL_SERIAL_RINGSIZE - 1);
16380 + * Deal with parity, framing and overrun errors.
16382 +static void atmel_pdc_rxerr(struct uart_port *port, unsigned int status)
16384 + /* clear error */
16385 + UART_PUT_CR(port, ATMEL_US_RSTSTA);
16387 + if (status & ATMEL_US_RXBRK) {
16388 + /* ignore side-effect */
16389 + status &= ~(ATMEL_US_PARE | ATMEL_US_FRAME);
16390 + port->icount.brk++;
16392 + if (status & ATMEL_US_PARE)
16393 + port->icount.parity++;
16394 + if (status & ATMEL_US_FRAME)
16395 + port->icount.frame++;
16396 + if (status & ATMEL_US_OVRE)
16397 + port->icount.overrun++;
16401 * Characters received (called from interrupt handler)
16403 static void atmel_rx_chars(struct uart_port *port)
16405 - struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
16406 - struct tty_struct *tty = port->info->tty;
16407 - unsigned int status, ch, flg;
16408 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16409 + unsigned int status, ch;
16411 status = UART_GET_CSR(port);
16412 while (status & ATMEL_US_RXRDY) {
16413 ch = UART_GET_CHAR(port);
16415 - port->icount.rx++;
16417 - flg = TTY_NORMAL;
16420 * note that the error handling code is
16421 * out of the main execution path
16422 @@ -266,15 +390,14 @@
16423 if (unlikely(status & (ATMEL_US_PARE | ATMEL_US_FRAME
16424 | ATMEL_US_OVRE | ATMEL_US_RXBRK)
16425 || atmel_port->break_active)) {
16426 - UART_PUT_CR(port, ATMEL_US_RSTSTA); /* clear error */
16428 + /* clear error */
16429 + UART_PUT_CR(port, ATMEL_US_RSTSTA);
16431 if (status & ATMEL_US_RXBRK
16432 && !atmel_port->break_active) {
16433 - status &= ~(ATMEL_US_PARE | ATMEL_US_FRAME); /* ignore side-effect */
16434 - port->icount.brk++;
16435 atmel_port->break_active = 1;
16436 UART_PUT_IER(port, ATMEL_US_RXBRK);
16437 - if (uart_handle_break(port))
16438 - goto ignore_char;
16441 * This is either the end-of-break
16442 @@ -287,52 +410,30 @@
16443 status &= ~ATMEL_US_RXBRK;
16444 atmel_port->break_active = 0;
16446 - if (status & ATMEL_US_PARE)
16447 - port->icount.parity++;
16448 - if (status & ATMEL_US_FRAME)
16449 - port->icount.frame++;
16450 - if (status & ATMEL_US_OVRE)
16451 - port->icount.overrun++;
16453 - status &= port->read_status_mask;
16455 - if (status & ATMEL_US_RXBRK)
16457 - else if (status & ATMEL_US_PARE)
16458 - flg = TTY_PARITY;
16459 - else if (status & ATMEL_US_FRAME)
16463 - if (uart_handle_sysrq_char(port, ch))
16464 - goto ignore_char;
16466 - uart_insert_char(port, status, ATMEL_US_OVRE, ch, flg);
16469 + atmel_buffer_rx_char(port, status, ch);
16470 status = UART_GET_CSR(port);
16473 - tty_flip_buffer_push(tty);
16474 + tasklet_schedule(&atmel_port->tasklet);
16478 - * Transmit characters (called from interrupt handler)
16479 + * Transmit characters (called from tasklet with TXRDY interrupt
16482 static void atmel_tx_chars(struct uart_port *port)
16484 struct circ_buf *xmit = &port->info->xmit;
16486 - if (port->x_char) {
16487 + if (port->x_char && UART_GET_CSR(port) & ATMEL_US_TXRDY) {
16488 UART_PUT_CHAR(port, port->x_char);
16493 - if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
16494 - atmel_stop_tx(port);
16495 + if (uart_circ_empty(xmit) || uart_tx_stopped(port))
16499 while (UART_GET_CSR(port) & ATMEL_US_TXRDY) {
16500 UART_PUT_CHAR(port, xmit->buf[xmit->tail]);
16501 @@ -345,8 +446,88 @@
16502 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
16503 uart_write_wakeup(port);
16505 - if (uart_circ_empty(xmit))
16506 - atmel_stop_tx(port);
16507 + if (!uart_circ_empty(xmit))
16508 + UART_PUT_IER(port, ATMEL_US_TXRDY);
16512 + * receive interrupt handler.
16515 +atmel_handle_receive(struct uart_port *port, unsigned int pending)
16517 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16519 + if (atmel_use_dma_rx(port)) {
16521 + * PDC receive. Just schedule the tasklet and let it
16522 + * figure out the details.
16524 + * TODO: We're not handling error flags correctly at
16527 + if (pending & (ATMEL_US_ENDRX | ATMEL_US_TIMEOUT)) {
16528 + UART_PUT_IDR(port, (ATMEL_US_ENDRX
16529 + | ATMEL_US_TIMEOUT));
16530 + tasklet_schedule(&atmel_port->tasklet);
16533 + if (pending & (ATMEL_US_RXBRK | ATMEL_US_OVRE |
16534 + ATMEL_US_FRAME | ATMEL_US_PARE))
16535 + atmel_pdc_rxerr(port, pending);
16538 + /* Interrupt receive */
16539 + if (pending & ATMEL_US_RXRDY)
16540 + atmel_rx_chars(port);
16541 + else if (pending & ATMEL_US_RXBRK) {
16543 + * End of break detected. If it came along with a
16544 + * character, atmel_rx_chars will handle it.
16546 + UART_PUT_CR(port, ATMEL_US_RSTSTA);
16547 + UART_PUT_IDR(port, ATMEL_US_RXBRK);
16548 + atmel_port->break_active = 0;
16553 + * transmit interrupt handler. (Transmit is IRQF_NODELAY safe)
16556 +atmel_handle_transmit(struct uart_port *port, unsigned int pending)
16558 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16560 + if (atmel_use_dma_tx(port)) {
16561 + /* PDC transmit */
16562 + if (pending & (ATMEL_US_ENDTX | ATMEL_US_TXBUFE)) {
16563 + UART_PUT_IDR(port, ATMEL_US_ENDTX | ATMEL_US_TXBUFE);
16564 + tasklet_schedule(&atmel_port->tasklet);
16567 + /* Interrupt transmit */
16568 + if (pending & ATMEL_US_TXRDY) {
16569 + UART_PUT_IDR(port, ATMEL_US_TXRDY);
16570 + tasklet_schedule(&atmel_port->tasklet);
16576 + * status flags interrupt handler.
16579 +atmel_handle_status(struct uart_port *port, unsigned int pending,
16580 + unsigned int status)
16582 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16584 + if (pending & (ATMEL_US_RIIC | ATMEL_US_DSRIC | ATMEL_US_DCDIC
16585 + | ATMEL_US_CTSIC)) {
16586 + atmel_port->irq_status = status;
16587 + tasklet_schedule(&atmel_port->tasklet);
16592 @@ -355,47 +536,255 @@
16593 static irqreturn_t atmel_interrupt(int irq, void *dev_id)
16595 struct uart_port *port = dev_id;
16596 - struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
16597 unsigned int status, pending, pass_counter = 0;
16599 - status = UART_GET_CSR(port);
16600 - pending = status & UART_GET_IMR(port);
16601 - while (pending) {
16602 - /* Interrupt receive */
16603 - if (pending & ATMEL_US_RXRDY)
16604 - atmel_rx_chars(port);
16605 - else if (pending & ATMEL_US_RXBRK) {
16607 + status = UART_GET_CSR(port);
16608 + pending = status & UART_GET_IMR(port);
16612 + atmel_handle_receive(port, pending);
16613 + atmel_handle_status(port, pending, status);
16614 + atmel_handle_transmit(port, pending);
16615 + } while (pass_counter++ < ATMEL_ISR_PASS_LIMIT);
16617 + return IRQ_HANDLED;
16621 + * Called from tasklet with ENDTX and TXBUFE interrupts disabled.
16623 +static void atmel_tx_dma(struct uart_port *port)
16625 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16626 + struct circ_buf *xmit = &port->info->xmit;
16627 + struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
16630 + xmit->tail += pdc->ofs;
16631 + xmit->tail &= UART_XMIT_SIZE - 1;
16633 + port->icount.tx += pdc->ofs;
16636 + if (!uart_circ_empty(xmit)) {
16637 + /* more to transmit - setup next transfer */
16639 + /* disable PDC transmit */
16640 + UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
16641 + dma_sync_single_for_device(port->dev,
16646 + count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
16647 + pdc->ofs = count;
16649 + UART_PUT_TPR(port, pdc->dma_addr + xmit->tail);
16650 + UART_PUT_TCR(port, count);
16651 + /* re-enable PDC transmit and interrupts */
16652 + UART_PUT_PTCR(port, ATMEL_PDC_TXTEN);
16653 + UART_PUT_IER(port, ATMEL_US_ENDTX | ATMEL_US_TXBUFE);
16655 + /* nothing left to transmit - disable the transmitter */
16657 + /* disable PDC transmit */
16658 + UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
16661 + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
16662 + uart_write_wakeup(port);
16665 +static void atmel_rx_from_ring(struct uart_port *port)
16667 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16668 + struct circ_buf *ring = &atmel_port->rx_ring;
16669 + unsigned int flg;
16670 + unsigned int status;
16672 + while (ring->head != ring->tail) {
16673 + struct atmel_uart_char c;
16675 + /* Make sure c is loaded after head. */
16678 + c = ((struct atmel_uart_char *)ring->buf)[ring->tail];
16680 + ring->tail = (ring->tail + 1) & (ATMEL_SERIAL_RINGSIZE - 1);
16682 + port->icount.rx++;
16683 + status = c.status;
16684 + flg = TTY_NORMAL;
16687 + * note that the error handling code is
16688 + * out of the main execution path
16690 + if (unlikely(status & (ATMEL_US_PARE | ATMEL_US_FRAME
16691 + | ATMEL_US_OVRE | ATMEL_US_RXBRK))) {
16692 + if (status & ATMEL_US_RXBRK) {
16693 + /* ignore side-effect */
16694 + status &= ~(ATMEL_US_PARE | ATMEL_US_FRAME);
16696 + port->icount.brk++;
16697 + if (uart_handle_break(port))
16700 + if (status & ATMEL_US_PARE)
16701 + port->icount.parity++;
16702 + if (status & ATMEL_US_FRAME)
16703 + port->icount.frame++;
16704 + if (status & ATMEL_US_OVRE)
16705 + port->icount.overrun++;
16707 + status &= port->read_status_mask;
16709 + if (status & ATMEL_US_RXBRK)
16711 + else if (status & ATMEL_US_PARE)
16712 + flg = TTY_PARITY;
16713 + else if (status & ATMEL_US_FRAME)
16718 + if (uart_handle_sysrq_char(port, c.ch))
16721 + uart_insert_char(port, status, ATMEL_US_OVRE, c.ch, flg);
16725 + * Drop the lock here since it might end up calling
16726 + * uart_start(), which takes the lock.
16728 + spin_unlock(&port->lock);
16729 + tty_flip_buffer_push(port->info->tty);
16730 + spin_lock(&port->lock);
16733 +static void atmel_rx_from_dma(struct uart_port *port)
16735 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16736 + struct tty_struct *tty = port->info->tty;
16737 + struct atmel_dma_buffer *pdc;
16738 + int rx_idx = atmel_port->pdc_rx_idx;
16739 + unsigned int head;
16740 + unsigned int tail;
16741 + unsigned int count;
16744 + /* Reset the UART timeout early so that we don't miss one */
16745 + UART_PUT_CR(port, ATMEL_US_STTTO);
16747 + pdc = &atmel_port->pdc_rx[rx_idx];
16748 + head = UART_GET_RPR(port) - pdc->dma_addr;
16751 + /* If the PDC has switched buffers, RPR won't contain
16752 + * any address within the current buffer. Since head
16753 + * is unsigned, we just need a one-way comparison to
16756 + * In this case, we just need to consume the entire
16757 + * buffer and resubmit it for DMA. This will clear the
16758 + * ENDRX bit as well, so that we can safely re-enable
16759 + * all interrupts below.
16761 + head = min(head, pdc->dma_size);
16763 + if (likely(head != tail)) {
16764 + dma_sync_single_for_cpu(port->dev, pdc->dma_addr,
16765 + pdc->dma_size, DMA_FROM_DEVICE);
16768 - * End of break detected. If it came along
16769 - * with a character, atmel_rx_chars will
16771 + * head will only wrap around when we recycle
16772 + * the DMA buffer, and when that happens, we
16773 + * explicitly set tail to 0. So head will
16774 + * always be greater than tail.
16776 - UART_PUT_CR(port, ATMEL_US_RSTSTA);
16777 - UART_PUT_IDR(port, ATMEL_US_RXBRK);
16778 - atmel_port->break_active = 0;
16779 + count = head - tail;
16781 + tty_insert_flip_string(tty, pdc->buf + pdc->ofs, count);
16783 + dma_sync_single_for_device(port->dev, pdc->dma_addr,
16784 + pdc->dma_size, DMA_FROM_DEVICE);
16786 + port->icount.rx += count;
16791 + * If the current buffer is full, we need to check if
16792 + * the next one contains any additional data.
16794 + if (head >= pdc->dma_size) {
16796 + UART_PUT_RNPR(port, pdc->dma_addr);
16797 + UART_PUT_RNCR(port, pdc->dma_size);
16799 + rx_idx = !rx_idx;
16800 + atmel_port->pdc_rx_idx = rx_idx;
16802 + } while (head >= pdc->dma_size);
16805 + * Drop the lock here since it might end up calling
16806 + * uart_start(), which takes the lock.
16808 + spin_unlock(&port->lock);
16809 + tty_flip_buffer_push(tty);
16810 + spin_lock(&port->lock);
16812 + UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT);
16815 - // TODO: All reads to CSR will clear these interrupts!
16816 - if (pending & ATMEL_US_RIIC) port->icount.rng++;
16817 - if (pending & ATMEL_US_DSRIC) port->icount.dsr++;
16818 - if (pending & ATMEL_US_DCDIC)
16820 + * tasklet handling tty stuff outside the interrupt handler.
16822 +static void atmel_tasklet_func(unsigned long data)
16824 + struct uart_port *port = (struct uart_port *)data;
16825 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16826 + unsigned int status;
16827 + unsigned int status_change;
16829 + /* The interrupt handler does not take the lock */
16830 + spin_lock(&port->lock);
16832 + if (atmel_use_dma_tx(port))
16833 + atmel_tx_dma(port);
16835 + atmel_tx_chars(port);
16837 + status = atmel_port->irq_status;
16838 + status_change = status ^ atmel_port->irq_status_prev;
16840 + if (status_change & (ATMEL_US_RI | ATMEL_US_DSR
16841 + | ATMEL_US_DCD | ATMEL_US_CTS)) {
16842 + /* TODO: All reads to CSR will clear these interrupts! */
16843 + if (status_change & ATMEL_US_RI)
16844 + port->icount.rng++;
16845 + if (status_change & ATMEL_US_DSR)
16846 + port->icount.dsr++;
16847 + if (status_change & ATMEL_US_DCD)
16848 uart_handle_dcd_change(port, !(status & ATMEL_US_DCD));
16849 - if (pending & ATMEL_US_CTSIC)
16850 + if (status_change & ATMEL_US_CTS)
16851 uart_handle_cts_change(port, !(status & ATMEL_US_CTS));
16852 - if (pending & (ATMEL_US_RIIC | ATMEL_US_DSRIC | ATMEL_US_DCDIC | ATMEL_US_CTSIC))
16853 - wake_up_interruptible(&port->info->delta_msr_wait);
16855 - /* Interrupt transmit */
16856 - if (pending & ATMEL_US_TXRDY)
16857 - atmel_tx_chars(port);
16859 - if (pass_counter++ > ATMEL_ISR_PASS_LIMIT)
16861 + wake_up_interruptible(&port->info->delta_msr_wait);
16863 - status = UART_GET_CSR(port);
16864 - pending = status & UART_GET_IMR(port);
16865 + atmel_port->irq_status_prev = status;
16867 - return IRQ_HANDLED;
16869 + if (atmel_use_dma_rx(port))
16870 + atmel_rx_from_dma(port);
16872 + atmel_rx_from_ring(port);
16874 + spin_unlock(&port->lock);
16878 @@ -403,6 +792,8 @@
16880 static int atmel_startup(struct uart_port *port)
16882 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16883 + struct tty_struct *tty = port->info->tty;
16887 @@ -415,13 +806,64 @@
16891 - retval = request_irq(port->irq, atmel_interrupt, IRQF_SHARED, "atmel_serial", port);
16892 + retval = request_irq(port->irq, atmel_interrupt, IRQF_SHARED,
16893 + tty ? tty->name : "atmel_serial", port);
16895 printk("atmel_serial: atmel_startup - Can't get irq\n");
16900 + * Initialize DMA (if necessary)
16902 + if (atmel_use_dma_rx(port)) {
16905 + for (i = 0; i < 2; i++) {
16906 + struct atmel_dma_buffer *pdc = &atmel_port->pdc_rx[i];
16908 + pdc->buf = kmalloc(PDC_BUFFER_SIZE, GFP_KERNEL);
16909 + if (pdc->buf == NULL) {
16911 + dma_unmap_single(port->dev,
16912 + atmel_port->pdc_rx[0].dma_addr,
16914 + DMA_FROM_DEVICE);
16915 + kfree(atmel_port->pdc_rx[0].buf);
16917 + free_irq(port->irq, port);
16920 + pdc->dma_addr = dma_map_single(port->dev,
16923 + DMA_FROM_DEVICE);
16924 + pdc->dma_size = PDC_BUFFER_SIZE;
16928 + atmel_port->pdc_rx_idx = 0;
16930 + UART_PUT_RPR(port, atmel_port->pdc_rx[0].dma_addr);
16931 + UART_PUT_RCR(port, PDC_BUFFER_SIZE);
16933 + UART_PUT_RNPR(port, atmel_port->pdc_rx[1].dma_addr);
16934 + UART_PUT_RNCR(port, PDC_BUFFER_SIZE);
16936 + if (atmel_use_dma_tx(port)) {
16937 + struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
16938 + struct circ_buf *xmit = &port->info->xmit;
16940 + pdc->buf = xmit->buf;
16941 + pdc->dma_addr = dma_map_single(port->dev,
16945 + pdc->dma_size = UART_XMIT_SIZE;
16950 * If there is a specific "open" function (to register
16951 * control line interrupts)
16953 @@ -437,9 +879,21 @@
16954 * Finally, enable the serial port
16956 UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
16957 - UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); /* enable xmit & rcvr */
16958 + /* enable xmit & rcvr */
16959 + UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN);
16961 - UART_PUT_IER(port, ATMEL_US_RXRDY); /* enable receive only */
16962 + if (atmel_use_dma_rx(port)) {
16963 + /* set UART timeout */
16964 + UART_PUT_RTOR(port, PDC_RX_TIMEOUT);
16965 + UART_PUT_CR(port, ATMEL_US_STTTO);
16967 + UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT);
16968 + /* enable PDC controller */
16969 + UART_PUT_PTCR(port, ATMEL_PDC_RXTEN);
16971 + /* enable receive only */
16972 + UART_PUT_IER(port, ATMEL_US_RXRDY);
16977 @@ -449,6 +903,38 @@
16979 static void atmel_shutdown(struct uart_port *port)
16981 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
16983 + * Ensure everything is stopped.
16985 + atmel_stop_rx(port);
16986 + atmel_stop_tx(port);
16989 + * Shut-down the DMA.
16991 + if (atmel_use_dma_rx(port)) {
16994 + for (i = 0; i < 2; i++) {
16995 + struct atmel_dma_buffer *pdc = &atmel_port->pdc_rx[i];
16997 + dma_unmap_single(port->dev,
17000 + DMA_FROM_DEVICE);
17004 + if (atmel_use_dma_tx(port)) {
17005 + struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
17007 + dma_unmap_single(port->dev,
17014 * Disable all interrupts, port and break condition.
17016 @@ -471,45 +957,48 @@
17018 * Power / Clock management.
17020 -static void atmel_serial_pm(struct uart_port *port, unsigned int state, unsigned int oldstate)
17021 +static void atmel_serial_pm(struct uart_port *port, unsigned int state,
17022 + unsigned int oldstate)
17024 - struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
17025 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
17030 - * Enable the peripheral clock for this serial port.
17031 - * This is called on uart_open() or a resume event.
17033 - clk_enable(atmel_port->clk);
17037 - * Disable the peripheral clock for this serial port.
17038 - * This is called on uart_close() or a suspend event.
17040 - clk_disable(atmel_port->clk);
17043 - printk(KERN_ERR "atmel_serial: unknown pm %d\n", state);
17046 + * Enable the peripheral clock for this serial port.
17047 + * This is called on uart_open() or a resume event.
17049 + clk_enable(atmel_port->clk);
17053 + * Disable the peripheral clock for this serial port.
17054 + * This is called on uart_close() or a suspend event.
17056 + clk_disable(atmel_port->clk);
17059 + printk(KERN_ERR "atmel_serial: unknown pm %d\n", state);
17064 * Change the port parameters
17066 -static void atmel_set_termios(struct uart_port *port, struct ktermios * termios, struct ktermios * old)
17067 +static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
17068 + struct ktermios *old)
17070 unsigned long flags;
17071 unsigned int mode, imr, quot, baud;
17073 /* Get current mode register */
17074 - mode = UART_GET_MR(port) & ~(ATMEL_US_USCLKS | ATMEL_US_CHRL | ATMEL_US_NBSTOP | ATMEL_US_PAR);
17075 + mode = UART_GET_MR(port) & ~(ATMEL_US_USCLKS | ATMEL_US_CHRL
17076 + | ATMEL_US_NBSTOP | ATMEL_US_PAR);
17078 - baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
17079 + baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
17080 quot = uart_get_divisor(port, baud);
17082 - if (quot > 65535) { /* BRGR is 16-bit, so switch to slower clock */
17083 + if (quot > 65535) { /* BRGR is 16-bit, so switch to slower clock */
17085 mode |= ATMEL_US_USCLKS_MCK_DIV8;
17087 @@ -536,18 +1025,17 @@
17090 if (termios->c_cflag & PARENB) {
17091 - if (termios->c_cflag & CMSPAR) { /* Mark or Space parity */
17092 + /* Mark or Space parity */
17093 + if (termios->c_cflag & CMSPAR) {
17094 if (termios->c_cflag & PARODD)
17095 mode |= ATMEL_US_PAR_MARK;
17097 mode |= ATMEL_US_PAR_SPACE;
17099 - else if (termios->c_cflag & PARODD)
17100 + } else if (termios->c_cflag & PARODD)
17101 mode |= ATMEL_US_PAR_ODD;
17103 mode |= ATMEL_US_PAR_EVEN;
17107 mode |= ATMEL_US_PAR_NONE;
17109 spin_lock_irqsave(&port->lock, flags);
17110 @@ -558,6 +1046,10 @@
17111 if (termios->c_iflag & (BRKINT | PARMRK))
17112 port->read_status_mask |= ATMEL_US_RXBRK;
17114 + if (atmel_use_dma_rx(port))
17115 + /* need to enable error interrupts */
17116 + UART_PUT_IER(port, port->read_status_mask);
17119 * Characters to ignore
17121 @@ -573,16 +1065,16 @@
17122 if (termios->c_iflag & IGNPAR)
17123 port->ignore_status_mask |= ATMEL_US_OVRE;
17126 - // TODO: Ignore all characters if CREAD is set.
17127 + /* TODO: Ignore all characters if CREAD is set.*/
17129 /* update the per-port timeout */
17130 uart_update_timeout(port, termios->c_cflag, baud);
17132 - /* disable interrupts and drain transmitter */
17133 - imr = UART_GET_IMR(port); /* get interrupt mask */
17134 - UART_PUT_IDR(port, -1); /* disable all interrupts */
17135 - while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY)) { barrier(); }
17136 + /* save/disable interrupts and drain transmitter */
17137 + imr = UART_GET_IMR(port);
17138 + UART_PUT_IDR(port, -1);
17139 + while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY))
17142 /* disable receiver and transmitter */
17143 UART_PUT_CR(port, ATMEL_US_TXDIS | ATMEL_US_RXDIS);
17144 @@ -708,7 +1200,8 @@
17146 * Configure the port from the platform device resource info.
17148 -static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port, struct platform_device *pdev)
17149 +static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port,
17150 + struct platform_device *pdev)
17152 struct uart_port *port = &atmel_port->uart;
17153 struct atmel_uart_data *data = pdev->dev.platform_data;
17154 @@ -723,6 +1216,11 @@
17155 port->mapbase = pdev->resource[0].start;
17156 port->irq = pdev->resource[1].start;
17158 + tasklet_init(&atmel_port->tasklet, atmel_tasklet_func,
17159 + (unsigned long)port);
17161 + memset(&atmel_port->rx_ring, 0, sizeof(atmel_port->rx_ring));
17164 /* Already mapped by setup code */
17165 port->membase = data->regs;
17166 @@ -731,11 +1229,17 @@
17167 port->membase = NULL;
17170 - if (!atmel_port->clk) { /* for console, the clock could already be configured */
17171 + /* for console, the clock could already be configured */
17172 + if (!atmel_port->clk) {
17173 atmel_port->clk = clk_get(&pdev->dev, "usart");
17174 clk_enable(atmel_port->clk);
17175 port->uartclk = clk_get_rate(atmel_port->clk);
17178 + atmel_port->use_dma_rx = data->use_dma_rx;
17179 + atmel_port->use_dma_tx = data->use_dma_tx;
17180 + if (atmel_use_dma_tx(port))
17181 + port->fifosize = PDC_BUFFER_SIZE;
17185 @@ -755,12 +1259,11 @@
17186 atmel_pops.set_wake = fns->set_wake;
17190 #ifdef CONFIG_SERIAL_ATMEL_CONSOLE
17191 static void atmel_console_putchar(struct uart_port *port, int ch)
17193 while (!(UART_GET_CSR(port) & ATMEL_US_TXRDY))
17196 UART_PUT_CHAR(port, ch);
17199 @@ -773,38 +1276,40 @@
17200 unsigned int status, imr;
17203 - * First, save IMR and then disable interrupts
17204 + * First, save IMR and then disable interrupts
17206 - imr = UART_GET_IMR(port); /* get interrupt mask */
17207 + imr = UART_GET_IMR(port);
17208 UART_PUT_IDR(port, ATMEL_US_RXRDY | ATMEL_US_TXRDY);
17210 uart_console_write(port, s, count, atmel_console_putchar);
17213 - * Finally, wait for transmitter to become empty
17214 - * and restore IMR
17215 + * Finally, wait for transmitter to become empty
17216 + * and restore IMR
17219 status = UART_GET_CSR(port);
17220 } while (!(status & ATMEL_US_TXRDY));
17221 - UART_PUT_IER(port, imr); /* set interrupts back the way they were */
17222 + /* set interrupts back the way they were */
17223 + UART_PUT_IER(port, imr);
17227 - * If the port was already initialised (eg, by a boot loader), try to determine
17228 - * the current setup.
17229 + * If the port was already initialised (eg, by a boot loader),
17230 + * try to determine the current setup.
17232 -static void __init atmel_console_get_options(struct uart_port *port, int *baud, int *parity, int *bits)
17233 +static void __init atmel_console_get_options(struct uart_port *port, int *baud,
17234 + int *parity, int *bits)
17236 unsigned int mr, quot;
17238 -// TODO: CR is a write-only register
17239 -// unsigned int cr;
17241 -// cr = UART_GET_CR(port) & (ATMEL_US_RXEN | ATMEL_US_TXEN);
17242 -// if (cr == (ATMEL_US_RXEN | ATMEL_US_TXEN)) {
17243 -// /* ok, the port was enabled */
17246 + * If the baud rate generator isn't running, the port wasn't
17247 + * initialized by the boot loader.
17249 + quot = UART_GET_BRGR(port);
17253 mr = UART_GET_MR(port) & ATMEL_US_CHRL;
17254 if (mr == ATMEL_US_CHRL_8)
17255 @@ -824,7 +1329,6 @@
17256 * lower than one of those, as it would make us fall through
17257 * to a much lower baud rate than we really want.
17259 - quot = UART_GET_BRGR(port);
17260 *baud = port->uartclk / (16 * (quot - 1));
17263 @@ -836,10 +1340,12 @@
17267 - if (port->membase == 0) /* Port not initialized yet - delay setup */
17268 + if (port->membase == NULL) {
17269 + /* Port not initialized yet - delay setup */
17273 - UART_PUT_IDR(port, -1); /* disable interrupts */
17274 + UART_PUT_IDR(port, -1);
17275 UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
17276 UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN);
17278 @@ -871,13 +1377,16 @@
17279 static int __init atmel_console_init(void)
17281 if (atmel_default_console_device) {
17282 - add_preferred_console(ATMEL_DEVICENAME, atmel_default_console_device->id, NULL);
17283 - atmel_init_port(&(atmel_ports[atmel_default_console_device->id]), atmel_default_console_device);
17284 + add_preferred_console(ATMEL_DEVICENAME,
17285 + atmel_default_console_device->id, NULL);
17286 + atmel_init_port(&atmel_ports[atmel_default_console_device->id],
17287 + atmel_default_console_device);
17288 register_console(&atmel_console);
17294 console_initcall(atmel_console_init);
17297 @@ -885,34 +1394,48 @@
17299 static int __init atmel_late_console_init(void)
17301 - if (atmel_default_console_device && !(atmel_console.flags & CON_ENABLED))
17302 + if (atmel_default_console_device
17303 + && !(atmel_console.flags & CON_ENABLED))
17304 register_console(&atmel_console);
17309 core_initcall(atmel_late_console_init);
17311 +static inline bool atmel_is_console_port(struct uart_port *port)
17313 + return port->cons && port->cons->index == port->line;
17317 #define ATMEL_CONSOLE_DEVICE NULL
17319 +static inline bool atmel_is_console_port(struct uart_port *port)
17325 static struct uart_driver atmel_uart = {
17326 - .owner = THIS_MODULE,
17327 - .driver_name = "atmel_serial",
17328 - .dev_name = ATMEL_DEVICENAME,
17329 - .major = SERIAL_ATMEL_MAJOR,
17330 - .minor = MINOR_START,
17331 - .nr = ATMEL_MAX_UART,
17332 - .cons = ATMEL_CONSOLE_DEVICE,
17333 + .owner = THIS_MODULE,
17334 + .driver_name = "atmel_serial",
17335 + .dev_name = ATMEL_DEVICENAME,
17336 + .major = SERIAL_ATMEL_MAJOR,
17337 + .minor = MINOR_START,
17338 + .nr = ATMEL_MAX_UART,
17339 + .cons = ATMEL_CONSOLE_DEVICE,
17343 -static int atmel_serial_suspend(struct platform_device *pdev, pm_message_t state)
17344 +static int atmel_serial_suspend(struct platform_device *pdev,
17345 + pm_message_t state)
17347 struct uart_port *port = platform_get_drvdata(pdev);
17348 - struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
17349 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
17351 - if (device_may_wakeup(&pdev->dev) && !at91_suspend_entering_slow_clock())
17352 + if (device_may_wakeup(&pdev->dev)
17353 + && !at91_suspend_entering_slow_clock())
17354 enable_irq_wake(port->irq);
17356 uart_suspend_port(&atmel_uart, port);
17357 @@ -925,13 +1448,12 @@
17358 static int atmel_serial_resume(struct platform_device *pdev)
17360 struct uart_port *port = platform_get_drvdata(pdev);
17361 - struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
17362 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
17364 if (atmel_port->suspended) {
17365 uart_resume_port(&atmel_uart, port);
17366 atmel_port->suspended = 0;
17370 disable_irq_wake(port->irq);
17373 @@ -944,15 +1466,40 @@
17374 static int __devinit atmel_serial_probe(struct platform_device *pdev)
17376 struct atmel_uart_port *port;
17380 + BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE));
17382 port = &atmel_ports[pdev->id];
17383 atmel_init_port(port, pdev);
17385 + if (!atmel_use_dma_rx(&port->uart)) {
17387 + data = kmalloc(sizeof(struct atmel_uart_char)
17388 + * ATMEL_SERIAL_RINGSIZE, GFP_KERNEL);
17390 + goto err_alloc_ring;
17391 + port->rx_ring.buf = data;
17394 ret = uart_add_one_port(&atmel_uart, &port->uart);
17396 - device_init_wakeup(&pdev->dev, 1);
17397 - platform_set_drvdata(pdev, port);
17399 + goto err_add_port;
17401 + device_init_wakeup(&pdev->dev, 1);
17402 + platform_set_drvdata(pdev, port);
17407 + kfree(port->rx_ring.buf);
17408 + port->rx_ring.buf = NULL;
17410 + if (!atmel_is_console_port(&port->uart)) {
17411 + clk_disable(port->clk);
17412 + clk_put(port->clk);
17413 + port->clk = NULL;
17417 @@ -961,19 +1508,21 @@
17418 static int __devexit atmel_serial_remove(struct platform_device *pdev)
17420 struct uart_port *port = platform_get_drvdata(pdev);
17421 - struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
17422 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
17425 - clk_disable(atmel_port->clk);
17426 - clk_put(atmel_port->clk);
17428 device_init_wakeup(&pdev->dev, 0);
17429 platform_set_drvdata(pdev, NULL);
17432 - ret = uart_remove_one_port(&atmel_uart, port);
17435 + ret = uart_remove_one_port(&atmel_uart, port);
17437 + tasklet_kill(&atmel_port->tasklet);
17438 + kfree(atmel_port->rx_ring.buf);
17440 + /* "port" is allocated statically, so we shouldn't free it */
17442 + clk_disable(atmel_port->clk);
17443 + clk_put(atmel_port->clk);
17447 diff -urN linux-2.6.24.3/drivers/serial/atmel_serial.h avr32-2.6/drivers/serial/atmel_serial.h
17448 --- linux-2.6.24.3/drivers/serial/atmel_serial.h 2008-02-26 01:20:20.000000000 +0100
17449 +++ avr32-2.6/drivers/serial/atmel_serial.h 1970-01-01 01:00:00.000000000 +0100
17452 - * drivers/serial/atmel_serial.h
17454 - * Copyright (C) 2005 Ivan Kokshaysky
17455 - * Copyright (C) SAN People
17457 - * USART registers.
17458 - * Based on AT91RM9200 datasheet revision E.
17460 - * This program is free software; you can redistribute it and/or modify
17461 - * it under the terms of the GNU General Public License as published by
17462 - * the Free Software Foundation; either version 2 of the License, or
17463 - * (at your option) any later version.
17466 -#ifndef ATMEL_SERIAL_H
17467 -#define ATMEL_SERIAL_H
17469 -#define ATMEL_US_CR 0x00 /* Control Register */
17470 -#define ATMEL_US_RSTRX (1 << 2) /* Reset Receiver */
17471 -#define ATMEL_US_RSTTX (1 << 3) /* Reset Transmitter */
17472 -#define ATMEL_US_RXEN (1 << 4) /* Receiver Enable */
17473 -#define ATMEL_US_RXDIS (1 << 5) /* Receiver Disable */
17474 -#define ATMEL_US_TXEN (1 << 6) /* Transmitter Enable */
17475 -#define ATMEL_US_TXDIS (1 << 7) /* Transmitter Disable */
17476 -#define ATMEL_US_RSTSTA (1 << 8) /* Reset Status Bits */
17477 -#define ATMEL_US_STTBRK (1 << 9) /* Start Break */
17478 -#define ATMEL_US_STPBRK (1 << 10) /* Stop Break */
17479 -#define ATMEL_US_STTTO (1 << 11) /* Start Time-out */
17480 -#define ATMEL_US_SENDA (1 << 12) /* Send Address */
17481 -#define ATMEL_US_RSTIT (1 << 13) /* Reset Iterations */
17482 -#define ATMEL_US_RSTNACK (1 << 14) /* Reset Non Acknowledge */
17483 -#define ATMEL_US_RETTO (1 << 15) /* Rearm Time-out */
17484 -#define ATMEL_US_DTREN (1 << 16) /* Data Terminal Ready Enable [AT91RM9200 only] */
17485 -#define ATMEL_US_DTRDIS (1 << 17) /* Data Terminal Ready Disable [AT91RM9200 only] */
17486 -#define ATMEL_US_RTSEN (1 << 18) /* Request To Send Enable */
17487 -#define ATMEL_US_RTSDIS (1 << 19) /* Request To Send Disable */
17489 -#define ATMEL_US_MR 0x04 /* Mode Register */
17490 -#define ATMEL_US_USMODE (0xf << 0) /* Mode of the USART */
17491 -#define ATMEL_US_USMODE_NORMAL 0
17492 -#define ATMEL_US_USMODE_RS485 1
17493 -#define ATMEL_US_USMODE_HWHS 2
17494 -#define ATMEL_US_USMODE_MODEM 3
17495 -#define ATMEL_US_USMODE_ISO7816_T0 4
17496 -#define ATMEL_US_USMODE_ISO7816_T1 6
17497 -#define ATMEL_US_USMODE_IRDA 8
17498 -#define ATMEL_US_USCLKS (3 << 4) /* Clock Selection */
17499 -#define ATMEL_US_USCLKS_MCK (0 << 4)
17500 -#define ATMEL_US_USCLKS_MCK_DIV8 (1 << 4)
17501 -#define ATMEL_US_USCLKS_SCK (3 << 4)
17502 -#define ATMEL_US_CHRL (3 << 6) /* Character Length */
17503 -#define ATMEL_US_CHRL_5 (0 << 6)
17504 -#define ATMEL_US_CHRL_6 (1 << 6)
17505 -#define ATMEL_US_CHRL_7 (2 << 6)
17506 -#define ATMEL_US_CHRL_8 (3 << 6)
17507 -#define ATMEL_US_SYNC (1 << 8) /* Synchronous Mode Select */
17508 -#define ATMEL_US_PAR (7 << 9) /* Parity Type */
17509 -#define ATMEL_US_PAR_EVEN (0 << 9)
17510 -#define ATMEL_US_PAR_ODD (1 << 9)
17511 -#define ATMEL_US_PAR_SPACE (2 << 9)
17512 -#define ATMEL_US_PAR_MARK (3 << 9)
17513 -#define ATMEL_US_PAR_NONE (4 << 9)
17514 -#define ATMEL_US_PAR_MULTI_DROP (6 << 9)
17515 -#define ATMEL_US_NBSTOP (3 << 12) /* Number of Stop Bits */
17516 -#define ATMEL_US_NBSTOP_1 (0 << 12)
17517 -#define ATMEL_US_NBSTOP_1_5 (1 << 12)
17518 -#define ATMEL_US_NBSTOP_2 (2 << 12)
17519 -#define ATMEL_US_CHMODE (3 << 14) /* Channel Mode */
17520 -#define ATMEL_US_CHMODE_NORMAL (0 << 14)
17521 -#define ATMEL_US_CHMODE_ECHO (1 << 14)
17522 -#define ATMEL_US_CHMODE_LOC_LOOP (2 << 14)
17523 -#define ATMEL_US_CHMODE_REM_LOOP (3 << 14)
17524 -#define ATMEL_US_MSBF (1 << 16) /* Bit Order */
17525 -#define ATMEL_US_MODE9 (1 << 17) /* 9-bit Character Length */
17526 -#define ATMEL_US_CLKO (1 << 18) /* Clock Output Select */
17527 -#define ATMEL_US_OVER (1 << 19) /* Oversampling Mode */
17528 -#define ATMEL_US_INACK (1 << 20) /* Inhibit Non Acknowledge */
17529 -#define ATMEL_US_DSNACK (1 << 21) /* Disable Successive NACK */
17530 -#define ATMEL_US_MAX_ITER (7 << 24) /* Max Iterations */
17531 -#define ATMEL_US_FILTER (1 << 28) /* Infrared Receive Line Filter */
17533 -#define ATMEL_US_IER 0x08 /* Interrupt Enable Register */
17534 -#define ATMEL_US_RXRDY (1 << 0) /* Receiver Ready */
17535 -#define ATMEL_US_TXRDY (1 << 1) /* Transmitter Ready */
17536 -#define ATMEL_US_RXBRK (1 << 2) /* Break Received / End of Break */
17537 -#define ATMEL_US_ENDRX (1 << 3) /* End of Receiver Transfer */
17538 -#define ATMEL_US_ENDTX (1 << 4) /* End of Transmitter Transfer */
17539 -#define ATMEL_US_OVRE (1 << 5) /* Overrun Error */
17540 -#define ATMEL_US_FRAME (1 << 6) /* Framing Error */
17541 -#define ATMEL_US_PARE (1 << 7) /* Parity Error */
17542 -#define ATMEL_US_TIMEOUT (1 << 8) /* Receiver Time-out */
17543 -#define ATMEL_US_TXEMPTY (1 << 9) /* Transmitter Empty */
17544 -#define ATMEL_US_ITERATION (1 << 10) /* Max number of Repetitions Reached */
17545 -#define ATMEL_US_TXBUFE (1 << 11) /* Transmission Buffer Empty */
17546 -#define ATMEL_US_RXBUFF (1 << 12) /* Reception Buffer Full */
17547 -#define ATMEL_US_NACK (1 << 13) /* Non Acknowledge */
17548 -#define ATMEL_US_RIIC (1 << 16) /* Ring Indicator Input Change [AT91RM9200 only] */
17549 -#define ATMEL_US_DSRIC (1 << 17) /* Data Set Ready Input Change [AT91RM9200 only] */
17550 -#define ATMEL_US_DCDIC (1 << 18) /* Data Carrier Detect Input Change [AT91RM9200 only] */
17551 -#define ATMEL_US_CTSIC (1 << 19) /* Clear to Send Input Change */
17552 -#define ATMEL_US_RI (1 << 20) /* RI */
17553 -#define ATMEL_US_DSR (1 << 21) /* DSR */
17554 -#define ATMEL_US_DCD (1 << 22) /* DCD */
17555 -#define ATMEL_US_CTS (1 << 23) /* CTS */
17557 -#define ATMEL_US_IDR 0x0c /* Interrupt Disable Register */
17558 -#define ATMEL_US_IMR 0x10 /* Interrupt Mask Register */
17559 -#define ATMEL_US_CSR 0x14 /* Channel Status Register */
17560 -#define ATMEL_US_RHR 0x18 /* Receiver Holding Register */
17561 -#define ATMEL_US_THR 0x1c /* Transmitter Holding Register */
17562 -#define ATMEL_US_SYNH (1 << 15) /* Transmit/Receive Sync [AT91SAM9261 only] */
17564 -#define ATMEL_US_BRGR 0x20 /* Baud Rate Generator Register */
17565 -#define ATMEL_US_CD (0xffff << 0) /* Clock Divider */
17567 -#define ATMEL_US_RTOR 0x24 /* Receiver Time-out Register */
17568 -#define ATMEL_US_TO (0xffff << 0) /* Time-out Value */
17570 -#define ATMEL_US_TTGR 0x28 /* Transmitter Timeguard Register */
17571 -#define ATMEL_US_TG (0xff << 0) /* Timeguard Value */
17573 -#define ATMEL_US_FIDI 0x40 /* FI DI Ratio Register */
17574 -#define ATMEL_US_NER 0x44 /* Number of Errors Register */
17575 -#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
17578 diff -urN linux-2.6.24.3/drivers/serial/Kconfig avr32-2.6/drivers/serial/Kconfig
17579 --- linux-2.6.24.3/drivers/serial/Kconfig 2008-02-26 01:20:20.000000000 +0100
17580 +++ avr32-2.6/drivers/serial/Kconfig 2008-04-23 20:12:44.000000000 +0200
17581 @@ -380,6 +380,21 @@
17582 console is the device which receives all kernel messages and
17583 warnings and which allows logins in single user mode).
17585 +config SERIAL_ATMEL_PDC
17586 + bool "Support DMA transfers on AT91 / AT32 serial port"
17587 + depends on SERIAL_ATMEL
17590 + Say Y here if you wish to use the PDC to do DMA transfers to
17591 + and from the Atmel AT91 / AT32 serial port. In order to
17592 + actually use DMA transfers, make sure that the use_dma_tx
17593 + and use_dma_rx members in the atmel_uart_data struct is set
17594 + appropriately for each port.
17596 + Note that break and error handling currently doesn't work
17597 + properly when DMA is enabled. Make sure that ports where
17598 + this matters don't use DMA.
17600 config SERIAL_ATMEL_TTYAT
17601 bool "Install as device ttyATn instead of ttySn"
17602 depends on SERIAL_ATMEL=y
17603 diff -urN linux-2.6.24.3/drivers/spi/atmel_spi.c avr32-2.6/drivers/spi/atmel_spi.c
17604 --- linux-2.6.24.3/drivers/spi/atmel_spi.c 2008-02-26 01:20:20.000000000 +0100
17605 +++ avr32-2.6/drivers/spi/atmel_spi.c 2008-04-23 20:12:44.000000000 +0200
17608 struct list_head queue;
17609 struct spi_transfer *current_transfer;
17610 - unsigned long remaining_bytes;
17611 + unsigned long current_remaining_bytes;
17612 + struct spi_transfer *next_transfer;
17613 + unsigned long next_remaining_bytes;
17616 dma_addr_t buffer_dma;
17618 unsigned gpio = (unsigned) spi->controller_data;
17619 unsigned active = spi->mode & SPI_CS_HIGH;
17623 + u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0;
17625 + /* Make sure clock polarity is correct */
17626 + for (i = 0; i < spi->master->num_chipselect; i++) {
17627 + csr = spi_readl(as, CSR0 + 4 * i);
17628 + if ((csr ^ cpol) & SPI_BIT(CPOL))
17629 + spi_writel(as, CSR0 + 4 * i, csr ^ SPI_BIT(CPOL));
17632 mr = spi_readl(as, MR);
17633 mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr);
17634 @@ -121,6 +133,48 @@
17635 gpio_set_value(gpio, !active);
17638 +static inline int atmel_spi_xfer_is_last(struct spi_message *msg,
17639 + struct spi_transfer *xfer)
17641 + return msg->transfers.prev == &xfer->transfer_list;
17644 +static inline int atmel_spi_xfer_can_be_chained(struct spi_transfer *xfer)
17646 + return xfer->delay_usecs == 0 && !xfer->cs_change;
17649 +static void atmel_spi_next_xfer_data(struct spi_master *master,
17650 + struct spi_transfer *xfer,
17651 + dma_addr_t *tx_dma,
17652 + dma_addr_t *rx_dma,
17655 + struct atmel_spi *as = spi_master_get_devdata(master);
17658 + /* use scratch buffer only when rx or tx data is unspecified */
17659 + if (xfer->rx_buf)
17660 + *rx_dma = xfer->rx_dma + xfer->len - len;
17662 + *rx_dma = as->buffer_dma;
17663 + if (len > BUFFER_SIZE)
17664 + len = BUFFER_SIZE;
17666 + if (xfer->tx_buf)
17667 + *tx_dma = xfer->tx_dma + xfer->len - len;
17669 + *tx_dma = as->buffer_dma;
17670 + if (len > BUFFER_SIZE)
17671 + len = BUFFER_SIZE;
17672 + memset(as->buffer, 0, len);
17673 + dma_sync_single_for_device(&as->pdev->dev,
17674 + as->buffer_dma, len, DMA_TO_DEVICE);
17681 * Submit next transfer for DMA.
17682 * lock is held, spi irq is blocked
17683 @@ -130,53 +184,78 @@
17685 struct atmel_spi *as = spi_master_get_devdata(master);
17686 struct spi_transfer *xfer;
17688 + u32 len, remaining, total;
17689 dma_addr_t tx_dma, rx_dma;
17691 - xfer = as->current_transfer;
17692 - if (!xfer || as->remaining_bytes == 0) {
17694 - xfer = list_entry(xfer->transfer_list.next,
17695 - struct spi_transfer, transfer_list);
17697 - xfer = list_entry(msg->transfers.next,
17698 - struct spi_transfer, transfer_list);
17699 - as->remaining_bytes = xfer->len;
17700 - as->current_transfer = xfer;
17701 + if (!as->current_transfer)
17702 + xfer = list_entry(msg->transfers.next,
17703 + struct spi_transfer, transfer_list);
17704 + else if (!as->next_transfer)
17705 + xfer = list_entry(as->current_transfer->transfer_list.next,
17706 + struct spi_transfer, transfer_list);
17712 + atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len);
17713 + remaining = xfer->len - len;
17715 + spi_writel(as, RPR, rx_dma);
17716 + spi_writel(as, TPR, tx_dma);
17718 + if (msg->spi->bits_per_word > 8)
17720 + spi_writel(as, RCR, len);
17721 + spi_writel(as, TCR, len);
17723 + dev_dbg(&msg->spi->dev,
17724 + " start xfer %p: len %u tx %p/%08x rx %p/%08x\n",
17725 + xfer, xfer->len, xfer->tx_buf, xfer->tx_dma,
17726 + xfer->rx_buf, xfer->rx_dma);
17728 + xfer = as->next_transfer;
17729 + remaining = as->next_remaining_bytes;
17732 - len = as->remaining_bytes;
17733 + as->current_transfer = xfer;
17734 + as->current_remaining_bytes = remaining;
17736 - tx_dma = xfer->tx_dma + xfer->len - len;
17737 - rx_dma = xfer->rx_dma + xfer->len - len;
17738 + if (remaining > 0)
17740 + else if (!atmel_spi_xfer_is_last(msg, xfer)
17741 + && atmel_spi_xfer_can_be_chained(xfer)) {
17742 + xfer = list_entry(xfer->transfer_list.next,
17743 + struct spi_transfer, transfer_list);
17748 - /* use scratch buffer only when rx or tx data is unspecified */
17749 - if (!xfer->rx_buf) {
17750 - rx_dma = as->buffer_dma;
17751 - if (len > BUFFER_SIZE)
17752 - len = BUFFER_SIZE;
17754 - if (!xfer->tx_buf) {
17755 - tx_dma = as->buffer_dma;
17756 - if (len > BUFFER_SIZE)
17757 - len = BUFFER_SIZE;
17758 - memset(as->buffer, 0, len);
17759 - dma_sync_single_for_device(&as->pdev->dev,
17760 - as->buffer_dma, len, DMA_TO_DEVICE);
17762 + as->next_transfer = xfer;
17764 - spi_writel(as, RPR, rx_dma);
17765 - spi_writel(as, TPR, tx_dma);
17768 + atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len);
17769 + as->next_remaining_bytes = total - len;
17771 + spi_writel(as, RNPR, rx_dma);
17772 + spi_writel(as, TNPR, tx_dma);
17774 + if (msg->spi->bits_per_word > 8)
17776 + spi_writel(as, RNCR, len);
17777 + spi_writel(as, TNCR, len);
17779 + dev_dbg(&msg->spi->dev,
17780 + " next xfer %p: len %u tx %p/%08x rx %p/%08x\n",
17781 + xfer, xfer->len, xfer->tx_buf, xfer->tx_dma,
17782 + xfer->rx_buf, xfer->rx_dma);
17784 + spi_writel(as, RNCR, 0);
17785 + spi_writel(as, TNCR, 0);
17788 - as->remaining_bytes -= len;
17789 - if (msg->spi->bits_per_word > 8)
17792 - /* REVISIT: when xfer->delay_usecs == 0, the PDC "next transfer"
17793 - * mechanism might help avoid the IRQ latency between transfers
17794 - * (and improve the nCS0 errata handling on at91rm9200 chips)
17796 - * We're also waiting for ENDRX before we start the next
17797 + /* REVISIT: We're waiting for ENDRX before we start the next
17798 * transfer because we need to handle some difficult timing
17799 * issues otherwise. If we wait for ENDTX in one transfer and
17800 * then starts waiting for ENDRX in the next, it's difficult
17801 @@ -186,17 +265,7 @@
17803 * It should be doable, though. Just not now...
17805 - spi_writel(as, TNCR, 0);
17806 - spi_writel(as, RNCR, 0);
17807 spi_writel(as, IER, SPI_BIT(ENDRX) | SPI_BIT(OVRES));
17809 - dev_dbg(&msg->spi->dev,
17810 - " start xfer %p: len %u tx %p/%08x rx %p/%08x imr %03x\n",
17811 - xfer, xfer->len, xfer->tx_buf, xfer->tx_dma,
17812 - xfer->rx_buf, xfer->rx_dma, spi_readl(as, IMR));
17814 - spi_writel(as, RCR, len);
17815 - spi_writel(as, TCR, len);
17816 spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN));
17819 @@ -294,6 +363,7 @@
17820 spin_lock(&as->lock);
17822 as->current_transfer = NULL;
17823 + as->next_transfer = NULL;
17825 /* continue if needed */
17826 if (list_empty(&as->queue) || as->stopping)
17827 @@ -377,7 +447,7 @@
17829 spi_writel(as, IDR, pending);
17831 - if (as->remaining_bytes == 0) {
17832 + if (as->current_remaining_bytes == 0) {
17833 msg->actual_length += xfer->len;
17835 if (!msg->is_dma_mapped)
17836 @@ -387,7 +457,7 @@
17837 if (xfer->delay_usecs)
17838 udelay(xfer->delay_usecs);
17840 - if (msg->transfers.prev == &xfer->transfer_list) {
17841 + if (atmel_spi_xfer_is_last(msg, xfer)) {
17842 /* report completed message */
17843 atmel_spi_msg_done(master, as, msg, 0,
17845 @@ -490,9 +560,14 @@
17846 if (!(spi->mode & SPI_CPHA))
17847 csr |= SPI_BIT(NCPHA);
17849 - /* TODO: DLYBS and DLYBCT */
17850 - csr |= SPI_BF(DLYBS, 10);
17851 - csr |= SPI_BF(DLYBCT, 10);
17852 + /* DLYBS is mostly irrelevant since we manage chipselect using GPIOs.
17854 + * DLYBCT would add delays between words, slowing down transfers.
17855 + * It could potentially be useful to cope with DMA bottlenecks, but
17856 + * in those cases it's probably best to just use a lower bitrate.
17858 + csr |= SPI_BF(DLYBS, 0);
17859 + csr |= SPI_BF(DLYBCT, 0);
17861 /* chipselect must have been muxed as GPIO (e.g. in board setup) */
17862 npcs_pin = (unsigned int)spi->controller_data;
17863 diff -urN linux-2.6.24.3/drivers/usb/gadget/atmel_usba_udc.c avr32-2.6/drivers/usb/gadget/atmel_usba_udc.c
17864 --- linux-2.6.24.3/drivers/usb/gadget/atmel_usba_udc.c 2008-02-26 01:20:20.000000000 +0100
17865 +++ avr32-2.6/drivers/usb/gadget/atmel_usba_udc.c 2008-04-23 20:12:45.000000000 +0200
17867 #include <linux/platform_device.h>
17868 #include <linux/usb/ch9.h>
17869 #include <linux/usb/gadget.h>
17870 +#include <linux/usb/atmel_usba_udc.h>
17871 #include <linux/delay.h>
17873 #include <asm/gpio.h>
17877 static struct usba_udc the_udc;
17878 +static struct usba_ep *usba_ep;
17880 #ifdef CONFIG_USB_GADGET_DEBUG_FS
17881 #include <linux/debugfs.h>
17882 @@ -324,53 +326,6 @@
17886 -static void copy_to_fifo(void __iomem *fifo, const void *buf, int len)
17888 - unsigned long tmp;
17890 - DBG(DBG_FIFO, "copy to FIFO (len %d):\n", len);
17891 - for (; len > 0; len -= 4, buf += 4, fifo += 4) {
17892 - tmp = *(unsigned long *)buf;
17894 - DBG(DBG_FIFO, " -> %08lx\n", tmp);
17895 - __raw_writel(tmp, fifo);
17898 - DBG(DBG_FIFO, " -> %02lx\n", tmp >> 24);
17899 - __raw_writeb(tmp >> 24, fifo);
17908 -static void copy_from_fifo(void *buf, void __iomem *fifo, int len)
17911 - unsigned long *w;
17912 - unsigned char *b;
17914 - unsigned long tmp;
17916 - DBG(DBG_FIFO, "copy from FIFO (len %d):\n", len);
17917 - for (p.w = buf; len > 0; len -= 4, p.w++, fifo += 4) {
17919 - tmp = __raw_readl(fifo);
17921 - DBG(DBG_FIFO, " -> %08lx\n", tmp);
17924 - tmp = __raw_readb(fifo);
17926 - DBG(DBG_FIFO, " -> %02lx\n", tmp);
17933 static void next_fifo_transaction(struct usba_ep *ep, struct usba_request *req)
17935 unsigned int transaction_len;
17936 @@ -387,7 +342,7 @@
17937 ep->ep.name, req, transaction_len,
17938 req->last_transaction ? ", done" : "");
17940 - copy_to_fifo(ep->fifo, req->req.buf + req->req.actual, transaction_len);
17941 + memcpy_toio(ep->fifo, req->req.buf + req->req.actual, transaction_len);
17942 usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY);
17943 req->req.actual += transaction_len;
17945 @@ -476,7 +431,7 @@
17946 bytecount = req->req.length - req->req.actual;
17949 - copy_from_fifo(req->req.buf + req->req.actual,
17950 + memcpy_fromio(req->req.buf + req->req.actual,
17951 ep->fifo, bytecount);
17952 req->req.actual += bytecount;
17954 @@ -1029,33 +984,6 @@
17955 .set_selfpowered = usba_udc_set_selfpowered,
17958 -#define EP(nam, idx, maxpkt, maxbk, dma, isoc) \
17961 - .ops = &usba_ep_ops, \
17963 - .maxpacket = maxpkt, \
17965 - .udc = &the_udc, \
17966 - .queue = LIST_HEAD_INIT(usba_ep[idx].queue), \
17967 - .fifo_size = maxpkt, \
17968 - .nr_banks = maxbk, \
17970 - .can_dma = dma, \
17971 - .can_isoc = isoc, \
17974 -static struct usba_ep usba_ep[] = {
17975 - EP("ep0", 0, 64, 1, 0, 0),
17976 - EP("ep1in-bulk", 1, 512, 2, 1, 1),
17977 - EP("ep2out-bulk", 2, 512, 2, 1, 1),
17978 - EP("ep3in-int", 3, 64, 3, 1, 0),
17979 - EP("ep4out-int", 4, 64, 3, 1, 0),
17980 - EP("ep5in-iso", 5, 1024, 3, 1, 1),
17981 - EP("ep6out-iso", 6, 1024, 3, 1, 1),
17985 static struct usb_endpoint_descriptor usba_ep0_desc = {
17986 .bLength = USB_DT_ENDPOINT_SIZE,
17987 .bDescriptorType = USB_DT_ENDPOINT,
17988 @@ -1074,7 +1002,6 @@
17989 static struct usba_udc the_udc = {
17991 .ops = &usba_udc_ops,
17992 - .ep0 = &usba_ep[0].ep,
17993 .ep_list = LIST_HEAD_INIT(the_udc.gadget.ep_list),
17995 .name = "atmel_usba_udc",
17996 @@ -1231,7 +1158,7 @@
17998 usba_ep_writel(ep, CTL_ENB, USBA_EPT_ENABLE);
17999 usba_writel(udc, TST, USBA_TST_PKT_MODE);
18000 - copy_to_fifo(ep->fifo, test_packet_buffer,
18001 + memcpy_toio(ep->fifo, test_packet_buffer,
18002 sizeof(test_packet_buffer));
18003 usba_ep_writel(ep, SET_STA, USBA_TX_PK_RDY);
18004 dev_info(dev, "Entering Test_Packet mode...\n");
18005 @@ -1539,7 +1466,7 @@
18008 DBG(DBG_FIFO, "Copying ctrl request from 0x%p:\n", ep->fifo);
18009 - copy_from_fifo(crq.data, ep->fifo, sizeof(crq));
18010 + memcpy_fromio(crq.data, ep->fifo, sizeof(crq));
18012 /* Free up one bank in the FIFO so that we can
18013 * generate or receive a reply right away. */
18014 @@ -1911,7 +1838,7 @@
18016 regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID);
18017 fifo = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID);
18018 - if (!regs || !fifo)
18019 + if (!regs || !fifo || !pdata)
18022 irq = platform_get_irq(pdev, 0);
18023 @@ -1959,16 +1886,44 @@
18024 usba_writel(udc, CTRL, 0);
18027 + usba_ep = kmalloc(sizeof(struct usba_ep) * pdata->num_ep,
18030 + goto err_alloc_ep;
18032 + the_udc.gadget.ep0 = &usba_ep[0].ep;
18034 INIT_LIST_HEAD(&usba_ep[0].ep.ep_list);
18035 usba_ep[0].ep_regs = udc->regs + USBA_EPT_BASE(0);
18036 usba_ep[0].dma_regs = udc->regs + USBA_DMA_BASE(0);
18037 usba_ep[0].fifo = udc->fifo + USBA_FIFO_BASE(0);
18038 - for (i = 1; i < ARRAY_SIZE(usba_ep); i++) {
18039 + usba_ep[0].ep.ops = &usba_ep_ops;
18040 + usba_ep[0].ep.name = pdata->ep[0].name;
18041 + usba_ep[0].ep.maxpacket = pdata->ep[0].fifo_size;
18042 + usba_ep[0].udc = &the_udc;
18043 + INIT_LIST_HEAD(&usba_ep[0].queue);
18044 + usba_ep[0].fifo_size = pdata->ep[0].fifo_size;
18045 + usba_ep[0].nr_banks = pdata->ep[0].nr_banks;
18046 + usba_ep[0].index = pdata->ep[0].index;
18047 + usba_ep[0].can_dma = pdata->ep[0].can_dma;
18048 + usba_ep[0].can_isoc = pdata->ep[0].can_isoc;
18050 + for (i = 1; i < pdata->num_ep; i++) {
18051 struct usba_ep *ep = &usba_ep[i];
18053 ep->ep_regs = udc->regs + USBA_EPT_BASE(i);
18054 ep->dma_regs = udc->regs + USBA_DMA_BASE(i);
18055 ep->fifo = udc->fifo + USBA_FIFO_BASE(i);
18056 + ep->ep.ops = &usba_ep_ops;
18057 + ep->ep.name = pdata->ep[i].name;
18058 + ep->ep.maxpacket = pdata->ep[i].fifo_size;
18059 + ep->udc = &the_udc;
18060 + INIT_LIST_HEAD(&ep->queue);
18061 + ep->fifo_size = pdata->ep[i].fifo_size;
18062 + ep->nr_banks = pdata->ep[i].nr_banks;
18063 + ep->index = pdata->ep[i].index;
18064 + ep->can_dma = pdata->ep[i].can_dma;
18065 + ep->can_isoc = pdata->ep[i].can_isoc;
18067 list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
18069 @@ -1987,7 +1942,7 @@
18070 goto err_device_add;
18073 - if (pdata && pdata->vbus_pin != GPIO_PIN_NONE) {
18074 + if (pdata->vbus_pin >= 0) {
18075 if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
18076 udc->vbus_pin = pdata->vbus_pin;
18078 @@ -2007,7 +1962,7 @@
18081 usba_init_debugfs(udc);
18082 - for (i = 1; i < ARRAY_SIZE(usba_ep); i++)
18083 + for (i = 1; i < pdata->num_ep; i++)
18084 usba_ep_init_debugfs(udc, &usba_ep[i]);
18087 @@ -2015,6 +1970,8 @@
18089 free_irq(irq, udc);
18093 iounmap(udc->fifo);
18095 iounmap(udc->regs);
18096 @@ -2032,10 +1989,11 @@
18098 struct usba_udc *udc;
18100 + struct usba_platform_data *pdata = pdev->dev.platform_data;
18102 udc = platform_get_drvdata(pdev);
18104 - for (i = 1; i < ARRAY_SIZE(usba_ep); i++)
18105 + for (i = 1; i < pdata->num_ep; i++)
18106 usba_ep_cleanup_debugfs(&usba_ep[i]);
18107 usba_cleanup_debugfs(udc);
18109 diff -urN linux-2.6.24.3/drivers/video/atmel_lcdfb.c avr32-2.6/drivers/video/atmel_lcdfb.c
18110 --- linux-2.6.24.3/drivers/video/atmel_lcdfb.c 2008-02-26 01:20:20.000000000 +0100
18111 +++ avr32-2.6/drivers/video/atmel_lcdfb.c 2008-04-23 20:12:45.000000000 +0200
18113 #include <linux/fb.h>
18114 #include <linux/init.h>
18115 #include <linux/delay.h>
18116 +#include <linux/backlight.h>
18118 #include <asm/arch/board.h>
18119 #include <asm/arch/cpu.h>
18123 #if defined(CONFIG_ARCH_AT91)
18124 -#define ATMEL_LCDFB_FBINFO_DEFAULT FBINFO_DEFAULT
18125 +#define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \
18126 + | FBINFO_PARTIAL_PAN_OK \
18127 + | FBINFO_HWACCEL_YPAN)
18129 static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
18130 struct fb_var_screeninfo *var)
18131 @@ -69,12 +72,113 @@
18135 +static const u32 contrast_ctr = ATMEL_LCDC_PS_DIV8
18136 + | ATMEL_LCDC_POL_POSITIVE
18137 + | ATMEL_LCDC_ENA_PWMENABLE;
18139 +#ifdef CONFIG_BACKLIGHT_ATMEL_LCDC
18141 +/* some bl->props field just changed */
18142 +static int atmel_bl_update_status(struct backlight_device *bl)
18144 + struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
18145 + int power = sinfo->bl_power;
18146 + int brightness = bl->props.brightness;
18148 + /* REVISIT there may be a meaningful difference between
18149 + * fb_blank and power ... there seem to be some cases
18150 + * this doesn't handle correctly.
18152 + if (bl->props.fb_blank != sinfo->bl_power)
18153 + power = bl->props.fb_blank;
18154 + else if (bl->props.power != sinfo->bl_power)
18155 + power = bl->props.power;
18157 + if (brightness < 0 && power == FB_BLANK_UNBLANK)
18158 + brightness = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
18159 + else if (power != FB_BLANK_UNBLANK)
18162 + lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness);
18163 + lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR,
18164 + brightness ? contrast_ctr : 0);
18166 + bl->props.fb_blank = bl->props.power = sinfo->bl_power = power;
18171 +static int atmel_bl_get_brightness(struct backlight_device *bl)
18173 + struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
18175 + return lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
18178 +static struct backlight_ops atmel_lcdc_bl_ops = {
18179 + .update_status = atmel_bl_update_status,
18180 + .get_brightness = atmel_bl_get_brightness,
18183 +static void init_backlight(struct atmel_lcdfb_info *sinfo)
18185 + struct backlight_device *bl;
18187 + sinfo->bl_power = FB_BLANK_UNBLANK;
18189 + if (sinfo->backlight)
18192 + bl = backlight_device_register("backlight", &sinfo->pdev->dev,
18193 + sinfo, &atmel_lcdc_bl_ops);
18194 + if (IS_ERR(sinfo->backlight)) {
18195 + dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n",
18199 + sinfo->backlight = bl;
18201 + bl->props.power = FB_BLANK_UNBLANK;
18202 + bl->props.fb_blank = FB_BLANK_UNBLANK;
18203 + bl->props.max_brightness = 0xff;
18204 + bl->props.brightness = atmel_bl_get_brightness(bl);
18207 +static void exit_backlight(struct atmel_lcdfb_info *sinfo)
18209 + if (sinfo->backlight)
18210 + backlight_device_unregister(sinfo->backlight);
18215 +static void init_backlight(struct atmel_lcdfb_info *sinfo)
18217 + dev_warn(&sinfo->pdev->dev, "backlight control is not available\n");
18220 +static void exit_backlight(struct atmel_lcdfb_info *sinfo)
18226 +static void init_contrast(struct atmel_lcdfb_info *sinfo)
18228 + /* have some default contrast/backlight settings */
18229 + lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
18230 + lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
18232 + if (sinfo->lcdcon_is_backlight)
18233 + init_backlight(sinfo);
18237 static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = {
18238 .type = FB_TYPE_PACKED_PIXELS,
18239 .visual = FB_VISUAL_TRUECOLOR,
18244 .accel = FB_ACCEL_NONE,
18246 @@ -148,6 +252,8 @@
18250 + memset(info->screen_base, 0, info->fix.smem_len);
18255 @@ -203,6 +309,26 @@
18256 var->transp.offset = var->transp.length = 0;
18257 var->xoffset = var->yoffset = 0;
18259 + /* Saturate vertical and horizontal timings at maximum values */
18260 + var->vsync_len = min_t(u32, var->vsync_len,
18261 + (ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);
18262 + var->upper_margin = min_t(u32, var->upper_margin,
18263 + ATMEL_LCDC_VBP >> ATMEL_LCDC_VBP_OFFSET);
18264 + var->lower_margin = min_t(u32, var->lower_margin,
18266 + var->right_margin = min_t(u32, var->right_margin,
18267 + (ATMEL_LCDC_HFP >> ATMEL_LCDC_HFP_OFFSET) + 1);
18268 + var->hsync_len = min_t(u32, var->hsync_len,
18269 + (ATMEL_LCDC_HPW >> ATMEL_LCDC_HPW_OFFSET) + 1);
18270 + var->left_margin = min_t(u32, var->left_margin,
18271 + ATMEL_LCDC_HBP + 1);
18273 + /* Some parameters can't be zero */
18274 + var->vsync_len = max_t(u32, var->vsync_len, 1);
18275 + var->right_margin = max_t(u32, var->right_margin, 1);
18276 + var->hsync_len = max_t(u32, var->hsync_len, 1);
18277 + var->left_margin = max_t(u32, var->left_margin, 1);
18279 switch (var->bits_per_pixel) {
18282 @@ -370,10 +496,6 @@
18283 /* Disable all interrupts */
18284 lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL);
18286 - /* Set contrast */
18287 - value = ATMEL_LCDC_PS_DIV8 | ATMEL_LCDC_POL_POSITIVE | ATMEL_LCDC_ENA_PWMENABLE;
18288 - lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, value);
18289 - lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
18290 /* ...wait for DMA engine to become idle... */
18291 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
18293 @@ -516,7 +638,6 @@
18294 struct fb_info *info = sinfo->info;
18297 - memset_io(info->screen_base, 0, info->fix.smem_len);
18298 info->var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW;
18300 dev_info(info->device,
18301 @@ -577,6 +698,7 @@
18302 sinfo->default_monspecs = pdata_sinfo->default_monspecs;
18303 sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control;
18304 sinfo->guard_time = pdata_sinfo->guard_time;
18305 + sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight;
18307 dev_err(dev, "cannot get default configuration\n");
18309 @@ -645,6 +767,11 @@
18310 info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
18311 if (!info->screen_base)
18312 goto release_intmem;
18315 + * Don't clear the framebuffer -- someone may have set
18316 + * up a splash image.
18319 /* alocate memory buffer */
18320 ret = atmel_lcdfb_alloc_video_memory(sinfo);
18321 @@ -670,6 +797,9 @@
18325 + /* Initialize PWM for contrast or backlight ("off") */
18326 + init_contrast(sinfo);
18329 ret = request_irq(sinfo->irq_base, atmel_lcdfb_interrupt, 0, pdev->name, info);
18331 @@ -721,6 +851,7 @@
18333 free_irq(sinfo->irq_base, info);
18335 + exit_backlight(sinfo);
18336 iounmap(sinfo->mmio);
18338 release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
18339 @@ -755,6 +886,7 @@
18343 + exit_backlight(sinfo);
18344 if (sinfo->atmel_lcdfb_power_control)
18345 sinfo->atmel_lcdfb_power_control(0);
18346 unregister_framebuffer(info);
18347 @@ -781,6 +913,9 @@
18349 static struct platform_driver atmel_lcdfb_driver = {
18350 .remove = __exit_p(atmel_lcdfb_remove),
18352 +// FIXME need suspend, resume
18355 .name = "atmel_lcdfb",
18356 .owner = THIS_MODULE,
18357 diff -urN linux-2.6.24.3/drivers/video/backlight/Kconfig avr32-2.6/drivers/video/backlight/Kconfig
18358 --- linux-2.6.24.3/drivers/video/backlight/Kconfig 2008-02-26 01:20:20.000000000 +0100
18359 +++ avr32-2.6/drivers/video/backlight/Kconfig 2008-04-23 20:12:45.000000000 +0200
18361 To have support for your specific LCD panel you will have to
18362 select the proper drivers which depend on this option.
18364 +config BACKLIGHT_ATMEL_LCDC
18365 + bool "Atmel LCDC Contrast-as-Backlight control"
18366 + depends on BACKLIGHT_CLASS_DEVICE && FB_ATMEL
18367 + default y if MACH_SAM9261EK || MACH_SAM9263EK
18369 + This provides a backlight control internal to the Atmel LCDC
18370 + driver. If the LCD "contrast control" on your board is wired
18371 + so it controls the backlight brightness, select this option to
18372 + export this as a PWM-based backlight control.
18374 + If in doubt, it's safe to enable this option; it doesn't kick
18375 + in unless the board's description says it's wired that way.
18377 config BACKLIGHT_CORGI
18378 tristate "Generic (aka Sharp Corgi) Backlight Driver"
18379 depends on BACKLIGHT_CLASS_DEVICE
18380 diff -urN linux-2.6.24.3/drivers/video/console/Kconfig avr32-2.6/drivers/video/console/Kconfig
18381 --- linux-2.6.24.3/drivers/video/console/Kconfig 2008-02-26 01:20:20.000000000 +0100
18382 +++ avr32-2.6/drivers/video/console/Kconfig 2008-04-23 19:33:46.000000000 +0200
18386 bool "VGA text console" if EMBEDDED || !X86
18387 - depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BLACKFIN
18388 + depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BLACKFIN && !AVR32
18391 Saying Y here will allow you to use Linux in text mode through a
18392 diff -urN linux-2.6.24.3/drivers/watchdog/Kconfig avr32-2.6/drivers/watchdog/Kconfig
18393 --- linux-2.6.24.3/drivers/watchdog/Kconfig 2008-02-26 01:20:20.000000000 +0100
18394 +++ avr32-2.6/drivers/watchdog/Kconfig 2008-04-23 20:12:45.000000000 +0200
18395 @@ -223,7 +223,7 @@
18397 config AT32AP700X_WDT
18398 tristate "AT32AP700x watchdog"
18399 - depends on CPU_AT32AP7000
18400 + depends on CPU_AT32AP700X
18402 Watchdog timer embedded into AT32AP700x devices. This will reboot
18403 your system when the timeout is reached.
18404 diff -urN linux-2.6.24.3/include/asm-avr32/arch-at32ap/at32ap7000.h avr32-2.6/include/asm-avr32/arch-at32ap/at32ap7000.h
18405 --- linux-2.6.24.3/include/asm-avr32/arch-at32ap/at32ap7000.h 2008-02-26 01:20:20.000000000 +0100
18406 +++ avr32-2.6/include/asm-avr32/arch-at32ap/at32ap7000.h 1970-01-01 01:00:00.000000000 +0100
18409 - * Pin definitions for AT32AP7000.
18411 - * Copyright (C) 2006 Atmel Corporation
18413 - * This program is free software; you can redistribute it and/or modify
18414 - * it under the terms of the GNU General Public License version 2 as
18415 - * published by the Free Software Foundation.
18417 -#ifndef __ASM_ARCH_AT32AP7000_H__
18418 -#define __ASM_ARCH_AT32AP7000_H__
18420 -#define GPIO_PERIPH_A 0
18421 -#define GPIO_PERIPH_B 1
18423 -#define NR_GPIO_CONTROLLERS 4
18426 - * Pin numbers identifying specific GPIO pins on the chip. They can
18427 - * also be converted to IRQ numbers by passing them through
18430 -#define GPIO_PIOA_BASE (0)
18431 -#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32)
18432 -#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32)
18433 -#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32)
18434 -#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32)
18436 -#define GPIO_PIN_PA(N) (GPIO_PIOA_BASE + (N))
18437 -#define GPIO_PIN_PB(N) (GPIO_PIOB_BASE + (N))
18438 -#define GPIO_PIN_PC(N) (GPIO_PIOC_BASE + (N))
18439 -#define GPIO_PIN_PD(N) (GPIO_PIOD_BASE + (N))
18440 -#define GPIO_PIN_PE(N) (GPIO_PIOE_BASE + (N))
18442 -#endif /* __ASM_ARCH_AT32AP7000_H__ */
18443 diff -urN linux-2.6.24.3/include/asm-avr32/arch-at32ap/at32ap700x.h avr32-2.6/include/asm-avr32/arch-at32ap/at32ap700x.h
18444 --- linux-2.6.24.3/include/asm-avr32/arch-at32ap/at32ap700x.h 1970-01-01 01:00:00.000000000 +0100
18445 +++ avr32-2.6/include/asm-avr32/arch-at32ap/at32ap700x.h 2008-04-23 20:12:46.000000000 +0200
18448 + * Pin definitions for AT32AP7000.
18450 + * Copyright (C) 2006 Atmel Corporation
18452 + * This program is free software; you can redistribute it and/or modify
18453 + * it under the terms of the GNU General Public License version 2 as
18454 + * published by the Free Software Foundation.
18456 +#ifndef __ASM_ARCH_AT32AP700X_H__
18457 +#define __ASM_ARCH_AT32AP700X_H__
18459 +#define GPIO_PERIPH_A 0
18460 +#define GPIO_PERIPH_B 1
18462 +#define NR_GPIO_CONTROLLERS 4
18465 + * Pin numbers identifying specific GPIO pins on the chip. They can
18466 + * also be converted to IRQ numbers by passing them through
18469 +#define GPIO_PIOA_BASE (0)
18470 +#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32)
18471 +#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32)
18472 +#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32)
18473 +#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32)
18475 +#define GPIO_PIN_PA(N) (GPIO_PIOA_BASE + (N))
18476 +#define GPIO_PIN_PB(N) (GPIO_PIOB_BASE + (N))
18477 +#define GPIO_PIN_PC(N) (GPIO_PIOC_BASE + (N))
18478 +#define GPIO_PIN_PD(N) (GPIO_PIOD_BASE + (N))
18479 +#define GPIO_PIN_PE(N) (GPIO_PIOE_BASE + (N))
18481 +#endif /* __ASM_ARCH_AT32AP700X_H__ */
18482 diff -urN linux-2.6.24.3/include/asm-avr32/arch-at32ap/board.h avr32-2.6/include/asm-avr32/arch-at32ap/board.h
18483 --- linux-2.6.24.3/include/asm-avr32/arch-at32ap/board.h 2008-02-26 01:20:20.000000000 +0100
18484 +++ avr32-2.6/include/asm-avr32/arch-at32ap/board.h 2008-04-23 20:12:46.000000000 +0200
18486 at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
18487 unsigned long fbmem_start, unsigned long fbmem_len);
18489 -struct usba_platform_data {
18492 +struct usba_platform_data;
18493 struct platform_device *
18494 at32_add_device_usba(unsigned int id, struct usba_platform_data *data);
18497 at32_add_device_ide(unsigned int id, unsigned int extint,
18498 struct ide_platform_data *data);
18500 +/* mask says which PWM channels to mux */
18501 +struct platform_device *at32_add_device_pwm(u32 mask);
18503 /* depending on what's hooked up, not all SSC pins will be used */
18504 #define ATMEL_SSC_TK 0x01
18505 #define ATMEL_SSC_TF 0x02
18507 struct platform_device *
18508 at32_add_device_ssc(unsigned int id, unsigned int flags);
18510 -struct platform_device *at32_add_device_twi(unsigned int id);
18511 -struct platform_device *at32_add_device_mci(unsigned int id);
18512 +struct i2c_board_info;
18513 +struct platform_device *at32_add_device_twi(unsigned int id,
18514 + struct i2c_board_info *b,
18517 +struct mci_platform_data {
18521 +struct platform_device *
18522 +at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
18523 struct platform_device *at32_add_device_ac97c(unsigned int id);
18524 struct platform_device *at32_add_device_abdac(unsigned int id);
18527 at32_add_device_cf(unsigned int id, unsigned int extint,
18528 struct cf_platform_data *data);
18530 +struct platform_device *
18531 +at32_add_device_psif(unsigned int id);
18533 #endif /* __ASM_ARCH_BOARD_H */
18534 diff -urN linux-2.6.24.3/include/asm-avr32/arch-at32ap/cpu.h avr32-2.6/include/asm-avr32/arch-at32ap/cpu.h
18535 --- linux-2.6.24.3/include/asm-avr32/arch-at32ap/cpu.h 2008-02-26 01:20:20.000000000 +0100
18536 +++ avr32-2.6/include/asm-avr32/arch-at32ap/cpu.h 2008-04-23 20:12:46.000000000 +0200
18538 * Only AT32AP7000 is defined for now. We can identify the specific
18539 * chip at runtime, but I'm not sure if it's really worth it.
18541 -#ifdef CONFIG_CPU_AT32AP7000
18542 +#ifdef CONFIG_CPU_AT32AP700X
18543 # define cpu_is_at32ap7000() (1)
18545 # define cpu_is_at32ap7000() (0)
18546 diff -urN linux-2.6.24.3/include/asm-avr32/arch-at32ap/io.h avr32-2.6/include/asm-avr32/arch-at32ap/io.h
18547 --- linux-2.6.24.3/include/asm-avr32/arch-at32ap/io.h 2008-02-26 01:20:20.000000000 +0100
18548 +++ avr32-2.6/include/asm-avr32/arch-at32ap/io.h 2008-04-23 19:33:48.000000000 +0200
18550 /* For "bizarre" halfword swapping */
18551 #include <linux/byteorder/swabb.h>
18553 -#if defined(CONFIG_AP7000_32_BIT_SMC)
18554 +#if defined(CONFIG_AP700X_32_BIT_SMC)
18555 # define __swizzle_addr_b(addr) (addr ^ 3UL)
18556 # define __swizzle_addr_w(addr) (addr ^ 2UL)
18557 # define __swizzle_addr_l(addr) (addr)
18559 # define __mem_ioswabb(a, x) (x)
18560 # define __mem_ioswabw(a, x) swab16(x)
18561 # define __mem_ioswabl(a, x) swab32(x)
18562 -#elif defined(CONFIG_AP7000_16_BIT_SMC)
18563 +#elif defined(CONFIG_AP700X_16_BIT_SMC)
18564 # define __swizzle_addr_b(addr) (addr ^ 1UL)
18565 # define __swizzle_addr_w(addr) (addr)
18566 # define __swizzle_addr_l(addr) (addr)
18567 diff -urN linux-2.6.24.3/include/asm-avr32/arch-at32ap/pm.h avr32-2.6/include/asm-avr32/arch-at32ap/pm.h
18568 --- linux-2.6.24.3/include/asm-avr32/arch-at32ap/pm.h 1970-01-01 01:00:00.000000000 +0100
18569 +++ avr32-2.6/include/asm-avr32/arch-at32ap/pm.h 2008-04-23 20:12:46.000000000 +0200
18572 + * AVR32 AP Power Management.
18574 + * Copyright (C) 2008 Atmel Corporation
18576 + * This program is free software; you can redistribute it and/or modify
18577 + * it under the terms of the GNU General Public License version 2 as
18578 + * published by the Free Software Foundation.
18580 +#ifndef __ASM_AVR32_ARCH_PM_H
18581 +#define __ASM_AVR32_ARCH_PM_H
18583 +/* Possible arguments to the "sleep" instruction */
18584 +#define CPU_SLEEP_IDLE 0
18585 +#define CPU_SLEEP_FROZEN 1
18586 +#define CPU_SLEEP_STANDBY 2
18587 +#define CPU_SLEEP_STOP 3
18588 +#define CPU_SLEEP_STATIC 5
18590 +#ifndef __ASSEMBLY__
18591 +extern void cpu_enter_idle(void);
18593 +extern bool disable_idle_sleep;
18595 +static inline void cpu_disable_idle_sleep(void)
18597 + disable_idle_sleep = true;
18600 +static inline void cpu_enable_idle_sleep(void)
18602 + disable_idle_sleep = false;
18605 +static inline void cpu_idle_sleep(void)
18608 + * If we're using the COUNT and COMPARE registers for
18609 + * timekeeping, we can't use the IDLE state.
18611 + if (disable_idle_sleep)
18614 + cpu_enter_idle();
18618 +#endif /* __ASM_AVR32_ARCH_PM_H */
18619 diff -urN linux-2.6.24.3/include/asm-avr32/arch-at32ap/portmux.h avr32-2.6/include/asm-avr32/arch-at32ap/portmux.h
18620 --- linux-2.6.24.3/include/asm-avr32/arch-at32ap/portmux.h 2008-02-26 01:20:20.000000000 +0100
18621 +++ avr32-2.6/include/asm-avr32/arch-at32ap/portmux.h 2008-04-23 19:33:48.000000000 +0200
18623 void at32_select_gpio(unsigned int pin, unsigned long flags);
18624 void at32_reserve_pin(unsigned int pin);
18626 +#ifdef CONFIG_GPIO_DEV
18628 +/* Gang allocators and accessors; used by the GPIO /dev driver */
18629 +int at32_gpio_port_is_valid(unsigned int port);
18630 +int at32_select_gpio_pins(unsigned int port, u32 pins, u32 oe_mask);
18631 +void at32_deselect_pins(unsigned int port, u32 pins);
18633 +u32 at32_gpio_get_value_multiple(unsigned int port, u32 pins);
18634 +void at32_gpio_set_value_multiple(unsigned int port, u32 value, u32 mask);
18636 +#endif /* CONFIG_GPIO_DEV */
18638 #endif /* __ASM_ARCH_PORTMUX_H__ */
18639 diff -urN linux-2.6.24.3/include/asm-avr32/arch-at32ap/time.h avr32-2.6/include/asm-avr32/arch-at32ap/time.h
18640 --- linux-2.6.24.3/include/asm-avr32/arch-at32ap/time.h 2008-02-26 01:20:20.000000000 +0100
18641 +++ avr32-2.6/include/asm-avr32/arch-at32ap/time.h 1970-01-01 01:00:00.000000000 +0100
18644 - * Copyright (C) 2007 Atmel Corporation
18646 - * This program is free software; you can redistribute it and/or modify
18647 - * it under the terms of the GNU General Public License version 2 as
18648 - * published by the Free Software Foundation.
18651 -#ifndef _ASM_AVR32_ARCH_AT32AP_TIME_H
18652 -#define _ASM_AVR32_ARCH_AT32AP_TIME_H
18654 -#include <linux/platform_device.h>
18656 -extern struct irqaction timer_irqaction;
18657 -extern struct platform_device at32_systc0_device;
18658 -extern void local_timer_interrupt(int irq, void *dev_id);
18660 -#define TIMER_BCR 0x000000c0
18661 -#define TIMER_BCR_SYNC 0
18662 -#define TIMER_BMR 0x000000c4
18663 -#define TIMER_BMR_TC0XC0S 0
18664 -#define TIMER_BMR_TC1XC1S 2
18665 -#define TIMER_BMR_TC2XC2S 4
18666 -#define TIMER_CCR 0x00000000
18667 -#define TIMER_CCR_CLKDIS 1
18668 -#define TIMER_CCR_CLKEN 0
18669 -#define TIMER_CCR_SWTRG 2
18670 -#define TIMER_CMR 0x00000004
18671 -#define TIMER_CMR_ABETRG 10
18672 -#define TIMER_CMR_ACPA 16
18673 -#define TIMER_CMR_ACPC 18
18674 -#define TIMER_CMR_AEEVT 20
18675 -#define TIMER_CMR_ASWTRG 22
18676 -#define TIMER_CMR_BCPB 24
18677 -#define TIMER_CMR_BCPC 26
18678 -#define TIMER_CMR_BEEVT 28
18679 -#define TIMER_CMR_BSWTRG 30
18680 -#define TIMER_CMR_BURST 4
18681 -#define TIMER_CMR_CLKI 3
18682 -#define TIMER_CMR_CPCDIS 7
18683 -#define TIMER_CMR_CPCSTOP 6
18684 -#define TIMER_CMR_CPCTRG 14
18685 -#define TIMER_CMR_EEVT 10
18686 -#define TIMER_CMR_EEVTEDG 8
18687 -#define TIMER_CMR_ENETRG 12
18688 -#define TIMER_CMR_ETRGEDG 8
18689 -#define TIMER_CMR_LDBDIS 7
18690 -#define TIMER_CMR_LDBSTOP 6
18691 -#define TIMER_CMR_LDRA 16
18692 -#define TIMER_CMR_LDRB 18
18693 -#define TIMER_CMR_TCCLKS 0
18694 -#define TIMER_CMR_WAVE 15
18695 -#define TIMER_CMR_WAVSEL 13
18696 -#define TIMER_CV 0x00000010
18697 -#define TIMER_CV_CV 0
18698 -#define TIMER_IDR 0x00000028
18699 -#define TIMER_IDR_COVFS 0
18700 -#define TIMER_IDR_CPAS 2
18701 -#define TIMER_IDR_CPBS 3
18702 -#define TIMER_IDR_CPCS 4
18703 -#define TIMER_IDR_ETRGS 7
18704 -#define TIMER_IDR_LDRAS 5
18705 -#define TIMER_IDR_LDRBS 6
18706 -#define TIMER_IDR_LOVRS 1
18707 -#define TIMER_IER 0x00000024
18708 -#define TIMER_IER_COVFS 0
18709 -#define TIMER_IER_CPAS 2
18710 -#define TIMER_IER_CPBS 3
18711 -#define TIMER_IER_CPCS 4
18712 -#define TIMER_IER_ETRGS 7
18713 -#define TIMER_IER_LDRAS 5
18714 -#define TIMER_IER_LDRBS 6
18715 -#define TIMER_IER_LOVRS 1
18716 -#define TIMER_IMR 0x0000002c
18717 -#define TIMER_IMR_COVFS 0
18718 -#define TIMER_IMR_CPAS 2
18719 -#define TIMER_IMR_CPBS 3
18720 -#define TIMER_IMR_CPCS 4
18721 -#define TIMER_IMR_ETRGS 7
18722 -#define TIMER_IMR_LDRAS 5
18723 -#define TIMER_IMR_LDRBS 6
18724 -#define TIMER_IMR_LOVRS 1
18725 -#define TIMER_RA 0x00000014
18726 -#define TIMER_RA_RA 0
18727 -#define TIMER_RB 0x00000018
18728 -#define TIMER_RB_RB 0
18729 -#define TIMER_RC 0x0000001c
18730 -#define TIMER_RC_RC 0
18731 -#define TIMER_SR 0x00000020
18732 -#define TIMER_SR_CLKSTA 16
18733 -#define TIMER_SR_COVFS 0
18734 -#define TIMER_SR_CPAS 2
18735 -#define TIMER_SR_CPBS 3
18736 -#define TIMER_SR_CPCS 4
18737 -#define TIMER_SR_ETRGS 7
18738 -#define TIMER_SR_LDRAS 5
18739 -#define TIMER_SR_LDRBS 6
18740 -#define TIMER_SR_LOVRS 1
18741 -#define TIMER_SR_MTIOA 17
18742 -#define TIMER_SR_MTIOB 18
18744 -/* Bit manipulation macros */
18745 -#define TIMER_BIT(name) (1 << TIMER_##name)
18746 -#define TIMER_BF(name,value) ((value) << TIMER_##name)
18748 -/* Register access macros */
18749 -#define timer_read(port,instance,reg) \
18750 - __raw_readl(port + (0x40 * instance) + TIMER_##reg)
18751 -#define timer_write(port,instance,reg,value) \
18752 - __raw_writel((value), port + (0x40 * instance) + TIMER_##reg)
18754 -#endif /* _ASM_AVR32_ARCH_AT32AP_TIME_H */
18755 diff -urN linux-2.6.24.3/include/asm-avr32/asm.h avr32-2.6/include/asm-avr32/asm.h
18756 --- linux-2.6.24.3/include/asm-avr32/asm.h 2008-02-26 01:20:20.000000000 +0100
18757 +++ avr32-2.6/include/asm-avr32/asm.h 2008-04-23 20:12:46.000000000 +0200
18758 @@ -12,10 +12,10 @@
18759 #include <asm/asm-offsets.h>
18760 #include <asm/thread_info.h>
18762 -#define mask_interrupts ssrf SR_GM_BIT
18763 -#define mask_exceptions ssrf SR_EM_BIT
18764 -#define unmask_interrupts csrf SR_GM_BIT
18765 -#define unmask_exceptions csrf SR_EM_BIT
18766 +#define mask_interrupts ssrf SYSREG_GM_OFFSET
18767 +#define mask_exceptions ssrf SYSREG_EM_OFFSET
18768 +#define unmask_interrupts csrf SYSREG_GM_OFFSET
18769 +#define unmask_exceptions csrf SYSREG_EM_OFFSET
18771 #ifdef CONFIG_FRAME_POINTER
18773 diff -urN linux-2.6.24.3/include/asm-avr32/byteorder.h avr32-2.6/include/asm-avr32/byteorder.h
18774 --- linux-2.6.24.3/include/asm-avr32/byteorder.h 2008-02-26 01:20:20.000000000 +0100
18775 +++ avr32-2.6/include/asm-avr32/byteorder.h 2008-04-23 20:12:46.000000000 +0200
18777 extern unsigned short __builtin_bswap_16(unsigned short x);
18781 #define __arch__swab32(x) __builtin_bswap_32(x)
18782 #define __arch__swab16(x) __builtin_bswap_16(x)
18785 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
18786 # define __BYTEORDER_HAS_U64__
18787 diff -urN linux-2.6.24.3/include/asm-avr32/dma-controller.h avr32-2.6/include/asm-avr32/dma-controller.h
18788 --- linux-2.6.24.3/include/asm-avr32/dma-controller.h 1970-01-01 01:00:00.000000000 +0100
18789 +++ avr32-2.6/include/asm-avr32/dma-controller.h 2008-04-23 19:33:48.000000000 +0200
18792 + * Copyright (C) 2005-2006 Atmel Corporation
18794 + * This program is free software; you can redistribute it and/or modify
18795 + * it under the terms of the GNU General Public License version 2 as
18796 + * published by the Free Software Foundation.
18798 +#ifndef __ASM_AVR32_DMA_CONTROLLER_H
18799 +#define __ASM_AVR32_DMA_CONTROLLER_H
18801 +#include <linux/device.h>
18803 +#define DMA_DIR_MEM_TO_MEM 0x0000
18804 +#define DMA_DIR_MEM_TO_PERIPH 0x0001
18805 +#define DMA_DIR_PERIPH_TO_MEM 0x0002
18806 +#define DMA_DIR_PERIPH_TO_PERIPH 0x0003
18808 +#define DMA_WIDTH_8BIT 0
18809 +#define DMA_WIDTH_16BIT 1
18810 +#define DMA_WIDTH_32BIT 2
18812 +struct dma_request {
18813 + struct dma_controller *dmac;
18814 + struct list_head list;
18816 + unsigned short channel;
18818 + void (*xfer_complete)(struct dma_request *req);
18819 + void (*block_complete)(struct dma_request *req);
18820 + void (*error)(struct dma_request *req);
18823 +struct dma_request_sg {
18824 + struct dma_request req;
18827 + struct scatterlist *sg;
18828 + unsigned long block_size;
18829 + unsigned int nr_blocks;
18831 + dma_addr_t data_reg;
18832 + unsigned short periph_id;
18834 + unsigned char direction;
18835 + unsigned char width;
18837 +#define to_dma_request_sg(_req) \
18838 + container_of(_req, struct dma_request_sg, req)
18840 +struct dma_request_cyclic {
18841 + struct dma_request req;
18844 + unsigned long buffer_size;
18846 + dma_addr_t buffer_start;
18847 + dma_addr_t data_reg;
18849 + unsigned short periph_id;
18850 + unsigned char direction;
18851 + unsigned char width;
18855 +#define to_dma_request_cyclic(_req) \
18856 + container_of(_req, struct dma_request_cyclic, req)
18858 +struct dma_request_memcpy {
18859 + struct dma_request req;
18861 + dma_addr_t src_addr;
18862 + unsigned int src_width;
18863 + unsigned int src_stride;
18865 + dma_addr_t dst_addr;
18866 + unsigned int dst_width;
18867 + unsigned int dst_stride;
18871 + unsigned short src_reverse:1;
18872 + unsigned short dst_reverse:1;
18874 +#define to_dma_request_memcpy(_req) \
18875 + container_of(_req, struct dma_request_memcpy, req)
18877 +struct dma_controller {
18878 + struct list_head list;
18880 + struct device *dev;
18882 + int (*alloc_channel)(struct dma_controller *dmac);
18883 + void (*release_channel)(struct dma_controller *dmac,
18885 + int (*prepare_request_sg)(struct dma_controller *dmac,
18886 + struct dma_request_sg *req);
18887 + int (*prepare_request_cyclic)(struct dma_controller *dmac,
18888 + struct dma_request_cyclic *req);
18889 + int (*prepare_request_memcpy)(struct dma_controller *dmac,
18890 + struct dma_request_memcpy *req);
18891 + int (*start_request)(struct dma_controller *dmac,
18892 + unsigned int channel);
18893 + int (*stop_request)(struct dma_controller *dmac,
18894 + unsigned int channel);
18895 + dma_addr_t (*get_current_pos)(struct dma_controller *dmac,
18896 + unsigned int channel);
18900 +dma_alloc_channel(struct dma_controller *dmac)
18902 + return dmac->alloc_channel(dmac);
18905 +static inline void
18906 +dma_release_channel(struct dma_controller *dmac, int chan)
18908 + dmac->release_channel(dmac, chan);
18912 +dma_prepare_request_sg(struct dma_controller *dmac,
18913 + struct dma_request_sg *req)
18915 + return dmac->prepare_request_sg(dmac, req);
18919 +dma_prepare_request_cyclic(struct dma_controller *dmac,
18920 + struct dma_request_cyclic *req)
18922 + return dmac->prepare_request_cyclic(dmac, req);
18926 +dma_prepare_request_memcpy(struct dma_controller *dmac,
18927 + struct dma_request_memcpy *req)
18929 + return dmac->prepare_request_memcpy(dmac, req);
18933 +dma_start_request(struct dma_controller *dmac,
18934 + unsigned int channel)
18936 + return dmac->start_request(dmac, channel);
18940 +dma_stop_request(struct dma_controller *dmac,
18941 + unsigned int channel)
18943 + return dmac->stop_request(dmac, channel);
18946 +static inline dma_addr_t
18947 +dma_get_current_pos(struct dma_controller *dmac,
18948 + unsigned int channel)
18950 + return dmac->get_current_pos(dmac, channel);
18953 +extern int register_dma_controller(struct dma_controller *dmac);
18954 +extern struct dma_controller *find_dma_controller(int id);
18956 +#endif /* __ASM_AVR32_DMA_CONTROLLER_H */
18957 diff -urN linux-2.6.24.3/include/asm-avr32/intc.h avr32-2.6/include/asm-avr32/intc.h
18958 --- linux-2.6.24.3/include/asm-avr32/intc.h 2008-02-26 01:20:20.000000000 +0100
18959 +++ avr32-2.6/include/asm-avr32/intc.h 1970-01-01 01:00:00.000000000 +0100
18961 -#ifndef __ASM_AVR32_INTC_H
18962 -#define __ASM_AVR32_INTC_H
18964 -#include <linux/sysdev.h>
18965 -#include <linux/interrupt.h>
18967 -struct irq_controller;
18971 -struct platform_device;
18973 -/* Information about the internal interrupt controller */
18974 -struct intc_device {
18975 - /* ioremapped address of configuration block */
18976 - void __iomem *regs;
18978 - /* the physical device */
18979 - struct platform_device *pdev;
18981 - /* Number of interrupt lines per group. */
18982 - unsigned int irqs_per_group;
18984 - /* The highest group ID + 1 */
18985 - unsigned int nr_groups;
18988 - * Bitfield indicating which groups are actually in use. The
18989 - * size of the array is
18990 - * ceil(group_max / (8 * sizeof(unsigned int))).
18992 - unsigned int group_mask[];
18995 -struct irq_controller_class {
18997 - * A short name identifying this kind of controller.
18999 - const char *typename;
19001 - * Handle the IRQ. Must do any necessary acking and masking.
19003 - irqreturn_t (*handle)(int irq, void *dev_id, struct pt_regs *regs);
19005 - * Register a new IRQ handler.
19007 - int (*setup)(struct irq_controller *ctrl, unsigned int irq,
19008 - struct irqaction *action);
19010 - * Unregister a IRQ handler.
19012 - void (*free)(struct irq_controller *ctrl, unsigned int irq,
19015 - * Mask the IRQ in the interrupt controller.
19017 - void (*mask)(struct irq_controller *ctrl, unsigned int irq);
19019 - * Unmask the IRQ in the interrupt controller.
19021 - void (*unmask)(struct irq_controller *ctrl, unsigned int irq);
19023 - * Set the type of the IRQ. See below for possible types.
19024 - * Return -EINVAL if a given type is not supported
19026 - int (*set_type)(struct irq_controller *ctrl, unsigned int irq,
19027 - unsigned int type);
19029 - * Return the IRQ type currently set
19031 - unsigned int (*get_type)(struct irq_controller *ctrl, unsigned int irq);
19034 -struct irq_controller {
19035 - struct irq_controller_class *class;
19036 - unsigned int irq_group;
19037 - unsigned int first_irq;
19038 - unsigned int nr_irqs;
19039 - struct list_head list;
19042 -struct intc_group_desc {
19043 - struct irq_controller *ctrl;
19044 - irqreturn_t (*handle)(int, void *, struct pt_regs *);
19045 - unsigned long flags;
19047 - const char *devname;
19051 - * The internal interrupt controller. Defined in board/part-specific
19053 - * TODO: Should probably be defined per-cpu.
19055 -extern struct intc_device intc;
19057 -extern int request_internal_irq(unsigned int irq,
19058 - irqreturn_t (*handler)(int, void *, struct pt_regs *),
19059 - unsigned long irqflags,
19060 - const char *devname, void *dev_id);
19061 -extern void free_internal_irq(unsigned int irq);
19063 -/* Only used by time_init() */
19064 -extern int setup_internal_irq(unsigned int irq, struct intc_group_desc *desc);
19067 - * Set interrupt priority for a given group. `group' can be found by
19068 - * using irq_to_group(irq). Priority can be from 0 (lowest) to 3
19069 - * (highest). Higher-priority interrupts will preempt lower-priority
19070 - * interrupts (unless interrupts are masked globally).
19072 - * This function does not check for conflicts within a group.
19074 -extern int intc_set_priority(unsigned int group,
19075 - unsigned int priority);
19078 - * Returns a bitmask of pending interrupts in a group.
19080 -extern unsigned long intc_get_pending(unsigned int group);
19083 - * Register a new external interrupt controller. Returns the first
19084 - * external IRQ number that is assigned to the new controller.
19086 -extern int intc_register_controller(struct irq_controller *ctrl);
19088 -#endif /* __ASM_AVR32_INTC_H */
19089 diff -urN linux-2.6.24.3/include/asm-avr32/irq.h avr32-2.6/include/asm-avr32/irq.h
19090 --- linux-2.6.24.3/include/asm-avr32/irq.h 2008-02-26 01:20:20.000000000 +0100
19091 +++ avr32-2.6/include/asm-avr32/irq.h 2008-04-23 20:12:46.000000000 +0200
19094 #define irq_canonicalize(i) (i)
19096 +#ifndef __ASSEMBLER__
19097 +int nmi_enable(void);
19098 +void nmi_disable(void);
19101 + * Returns a bitmask of pending interrupts in a group.
19103 +extern unsigned long intc_get_pending(unsigned int group);
19106 #endif /* __ASM_AVR32_IOCTLS_H */
19107 diff -urN linux-2.6.24.3/include/asm-avr32/kdebug.h avr32-2.6/include/asm-avr32/kdebug.h
19108 --- linux-2.6.24.3/include/asm-avr32/kdebug.h 2008-02-26 01:20:20.000000000 +0100
19109 +++ avr32-2.6/include/asm-avr32/kdebug.h 2008-04-23 19:33:48.000000000 +0200
19117 #endif /* __ASM_AVR32_KDEBUG_H */
19118 diff -urN linux-2.6.24.3/include/asm-avr32/ocd.h avr32-2.6/include/asm-avr32/ocd.h
19119 --- linux-2.6.24.3/include/asm-avr32/ocd.h 2008-02-26 01:20:20.000000000 +0100
19120 +++ avr32-2.6/include/asm-avr32/ocd.h 2008-04-23 19:33:48.000000000 +0200
19121 @@ -533,6 +533,11 @@
19122 #define ocd_read(reg) __ocd_read(OCD_##reg)
19123 #define ocd_write(reg, value) __ocd_write(OCD_##reg, value)
19125 +struct task_struct;
19127 +void ocd_enable(struct task_struct *child);
19128 +void ocd_disable(struct task_struct *child);
19130 #endif /* !__ASSEMBLER__ */
19132 #endif /* __ASM_AVR32_OCD_H */
19133 diff -urN linux-2.6.24.3/include/asm-avr32/pgtable.h avr32-2.6/include/asm-avr32/pgtable.h
19134 --- linux-2.6.24.3/include/asm-avr32/pgtable.h 2008-02-26 01:20:20.000000000 +0100
19135 +++ avr32-2.6/include/asm-avr32/pgtable.h 2008-04-23 20:12:46.000000000 +0200
19136 @@ -157,6 +157,7 @@
19137 #define _PAGE_S(x) _PAGE_NORMAL(x)
19139 #define PAGE_COPY _PAGE_P(PAGE_WRITE | PAGE_READ)
19140 +#define PAGE_SHARED _PAGE_S(PAGE_WRITE | PAGE_READ)
19142 #ifndef __ASSEMBLY__
19144 diff -urN linux-2.6.24.3/include/asm-avr32/processor.h avr32-2.6/include/asm-avr32/processor.h
19145 --- linux-2.6.24.3/include/asm-avr32/processor.h 2008-02-26 01:20:20.000000000 +0100
19146 +++ avr32-2.6/include/asm-avr32/processor.h 2008-04-23 19:33:48.000000000 +0200
19147 @@ -57,11 +57,25 @@
19148 unsigned short cpu_revision;
19149 enum tlb_config tlb_config;
19150 unsigned long features;
19153 struct cache_info icache;
19154 struct cache_info dcache;
19157 +static inline unsigned int avr32_get_manufacturer_id(struct avr32_cpuinfo *cpu)
19159 + return (cpu->device_id >> 1) & 0x7f;
19161 +static inline unsigned int avr32_get_product_number(struct avr32_cpuinfo *cpu)
19163 + return (cpu->device_id >> 12) & 0xffff;
19165 +static inline unsigned int avr32_get_chip_revision(struct avr32_cpuinfo *cpu)
19167 + return (cpu->device_id >> 28) & 0x0f;
19170 extern struct avr32_cpuinfo boot_cpu_data;
19173 diff -urN linux-2.6.24.3/include/asm-avr32/ptrace.h avr32-2.6/include/asm-avr32/ptrace.h
19174 --- linux-2.6.24.3/include/asm-avr32/ptrace.h 2008-02-26 01:20:20.000000000 +0100
19175 +++ avr32-2.6/include/asm-avr32/ptrace.h 2008-04-23 19:33:48.000000000 +0200
19176 @@ -121,7 +121,15 @@
19180 -# define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER)
19182 +#include <asm/ocd.h>
19184 +#define arch_ptrace_attach(child) ocd_enable(child)
19186 +#define user_mode(regs) (((regs)->sr & MODE_MASK) == MODE_USER)
19187 +#define instruction_pointer(regs) ((regs)->pc)
19188 +#define profile_pc(regs) instruction_pointer(regs)
19190 extern void show_regs (struct pt_regs *);
19192 static __inline__ int valid_user_regs(struct pt_regs *regs)
19193 @@ -141,9 +149,6 @@
19197 -#define instruction_pointer(regs) ((regs)->pc)
19199 -#define profile_pc(regs) instruction_pointer(regs)
19201 #endif /* __KERNEL__ */
19203 diff -urN linux-2.6.24.3/include/asm-avr32/thread_info.h avr32-2.6/include/asm-avr32/thread_info.h
19204 --- linux-2.6.24.3/include/asm-avr32/thread_info.h 2008-02-26 01:20:20.000000000 +0100
19205 +++ avr32-2.6/include/asm-avr32/thread_info.h 2008-04-23 19:33:48.000000000 +0200
19207 #define TIF_MEMDIE 6
19208 #define TIF_RESTORE_SIGMASK 7 /* restore signal mask in do_signal */
19209 #define TIF_CPU_GOING_TO_SLEEP 8 /* CPU is entering sleep 0 mode */
19210 +#define TIF_DEBUG 30 /* debugging enabled */
19211 #define TIF_USERSPACE 31 /* true if FS sets userspace */
19213 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
19214 diff -urN linux-2.6.24.3/include/linux/atmel_pwm.h avr32-2.6/include/linux/atmel_pwm.h
19215 --- linux-2.6.24.3/include/linux/atmel_pwm.h 1970-01-01 01:00:00.000000000 +0100
19216 +++ avr32-2.6/include/linux/atmel_pwm.h 2008-04-23 19:33:51.000000000 +0200
19218 +#ifndef __LINUX_ATMEL_PWM_H
19219 +#define __LINUX_ATMEL_PWM_H
19222 + * struct pwm_channel - driver handle to a PWM channel
19223 + * @regs: base of this channel's registers
19224 + * @index: number of this channel (0..31)
19225 + * @mck: base clock rate, which can be prescaled and maybe subdivided
19227 + * Drivers initialize a pwm_channel structure using pwm_channel_alloc().
19228 + * Then they configure its clock rate (derived from MCK), alignment,
19229 + * polarity, and duty cycle by writing directly to the channel registers,
19230 + * before enabling the channel by calling pwm_channel_enable().
19232 + * After emitting a PWM signal for the desired length of time, drivers
19233 + * may then pwm_channel_disable() or pwm_channel_free(). Both of these
19234 + * disable the channel, but when it's freed the IRQ is deconfigured and
19235 + * the channel must later be re-allocated and reconfigured.
19237 + * Note that if the period or duty cycle need to be changed while the
19238 + * PWM channel is operating, drivers must use the PWM_CUPD double buffer
19239 + * mechanism, either polling until they change or getting implicitly
19240 + * notified through a once-per-period interrupt handler.
19242 +struct pwm_channel {
19243 + void __iomem *regs;
19245 + unsigned long mck;
19248 +extern int pwm_channel_alloc(int index, struct pwm_channel *ch);
19249 +extern int pwm_channel_free(struct pwm_channel *ch);
19251 +extern int pwm_clk_alloc(unsigned prescale, unsigned div);
19252 +extern void pwm_clk_free(unsigned clk);
19254 +extern int __pwm_channel_onoff(struct pwm_channel *ch, int enabled);
19256 +#define pwm_channel_enable(ch) __pwm_channel_onoff((ch), 1)
19257 +#define pwm_channel_disable(ch) __pwm_channel_onoff((ch), 0)
19259 +/* periodic interrupts, mostly for CUPD changes to period or cycle */
19260 +extern int pwm_channel_handler(struct pwm_channel *ch,
19261 + void (*handler)(struct pwm_channel *ch));
19263 +/* per-channel registers (banked at pwm_channel->regs) */
19264 +#define PWM_CMR 0x00 /* mode register */
19265 +#define PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */
19266 +#define PWM_CPR_CPOL (1 << 9) /* set: idle high */
19267 +#define PWM_CPR_CALG (1 << 8) /* set: center align */
19268 +#define PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */
19269 +#define PWM_CPR_CLKA (0xb << 0) /* rate CLKA */
19270 +#define PWM_CPR_CLKB (0xc << 0) /* rate CLKB */
19271 +#define PWM_CDTY 0x04 /* duty cycle (max of CPRD) */
19272 +#define PWM_CPRD 0x08 /* period (count up from zero) */
19273 +#define PWM_CCNT 0x0c /* counter (20 bits?) */
19274 +#define PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */
19276 +static inline void
19277 +pwm_channel_writel(struct pwm_channel *pwmc, unsigned offset, u32 val)
19279 + __raw_writel(val, pwmc->regs + offset);
19282 +static inline u32 pwm_channel_readl(struct pwm_channel *pwmc, unsigned offset)
19284 + return __raw_readl(pwmc->regs + offset);
19287 +#endif /* __LINUX_ATMEL_PWM_H */
19288 diff -urN linux-2.6.24.3/include/linux/atmel_serial.h avr32-2.6/include/linux/atmel_serial.h
19289 --- linux-2.6.24.3/include/linux/atmel_serial.h 1970-01-01 01:00:00.000000000 +0100
19290 +++ avr32-2.6/include/linux/atmel_serial.h 2008-04-23 19:33:51.000000000 +0200
19293 + * include/linux/atmel_serial.h
19295 + * Copyright (C) 2005 Ivan Kokshaysky
19296 + * Copyright (C) SAN People
19298 + * USART registers.
19299 + * Based on AT91RM9200 datasheet revision E.
19301 + * This program is free software; you can redistribute it and/or modify
19302 + * it under the terms of the GNU General Public License as published by
19303 + * the Free Software Foundation; either version 2 of the License, or
19304 + * (at your option) any later version.
19307 +#ifndef ATMEL_SERIAL_H
19308 +#define ATMEL_SERIAL_H
19310 +#define ATMEL_US_CR 0x00 /* Control Register */
19311 +#define ATMEL_US_RSTRX (1 << 2) /* Reset Receiver */
19312 +#define ATMEL_US_RSTTX (1 << 3) /* Reset Transmitter */
19313 +#define ATMEL_US_RXEN (1 << 4) /* Receiver Enable */
19314 +#define ATMEL_US_RXDIS (1 << 5) /* Receiver Disable */
19315 +#define ATMEL_US_TXEN (1 << 6) /* Transmitter Enable */
19316 +#define ATMEL_US_TXDIS (1 << 7) /* Transmitter Disable */
19317 +#define ATMEL_US_RSTSTA (1 << 8) /* Reset Status Bits */
19318 +#define ATMEL_US_STTBRK (1 << 9) /* Start Break */
19319 +#define ATMEL_US_STPBRK (1 << 10) /* Stop Break */
19320 +#define ATMEL_US_STTTO (1 << 11) /* Start Time-out */
19321 +#define ATMEL_US_SENDA (1 << 12) /* Send Address */
19322 +#define ATMEL_US_RSTIT (1 << 13) /* Reset Iterations */
19323 +#define ATMEL_US_RSTNACK (1 << 14) /* Reset Non Acknowledge */
19324 +#define ATMEL_US_RETTO (1 << 15) /* Rearm Time-out */
19325 +#define ATMEL_US_DTREN (1 << 16) /* Data Terminal Ready Enable [AT91RM9200 only] */
19326 +#define ATMEL_US_DTRDIS (1 << 17) /* Data Terminal Ready Disable [AT91RM9200 only] */
19327 +#define ATMEL_US_RTSEN (1 << 18) /* Request To Send Enable */
19328 +#define ATMEL_US_RTSDIS (1 << 19) /* Request To Send Disable */
19330 +#define ATMEL_US_MR 0x04 /* Mode Register */
19331 +#define ATMEL_US_USMODE (0xf << 0) /* Mode of the USART */
19332 +#define ATMEL_US_USMODE_NORMAL 0
19333 +#define ATMEL_US_USMODE_RS485 1
19334 +#define ATMEL_US_USMODE_HWHS 2
19335 +#define ATMEL_US_USMODE_MODEM 3
19336 +#define ATMEL_US_USMODE_ISO7816_T0 4
19337 +#define ATMEL_US_USMODE_ISO7816_T1 6
19338 +#define ATMEL_US_USMODE_IRDA 8
19339 +#define ATMEL_US_USCLKS (3 << 4) /* Clock Selection */
19340 +#define ATMEL_US_USCLKS_MCK (0 << 4)
19341 +#define ATMEL_US_USCLKS_MCK_DIV8 (1 << 4)
19342 +#define ATMEL_US_USCLKS_SCK (3 << 4)
19343 +#define ATMEL_US_CHRL (3 << 6) /* Character Length */
19344 +#define ATMEL_US_CHRL_5 (0 << 6)
19345 +#define ATMEL_US_CHRL_6 (1 << 6)
19346 +#define ATMEL_US_CHRL_7 (2 << 6)
19347 +#define ATMEL_US_CHRL_8 (3 << 6)
19348 +#define ATMEL_US_SYNC (1 << 8) /* Synchronous Mode Select */
19349 +#define ATMEL_US_PAR (7 << 9) /* Parity Type */
19350 +#define ATMEL_US_PAR_EVEN (0 << 9)
19351 +#define ATMEL_US_PAR_ODD (1 << 9)
19352 +#define ATMEL_US_PAR_SPACE (2 << 9)
19353 +#define ATMEL_US_PAR_MARK (3 << 9)
19354 +#define ATMEL_US_PAR_NONE (4 << 9)
19355 +#define ATMEL_US_PAR_MULTI_DROP (6 << 9)
19356 +#define ATMEL_US_NBSTOP (3 << 12) /* Number of Stop Bits */
19357 +#define ATMEL_US_NBSTOP_1 (0 << 12)
19358 +#define ATMEL_US_NBSTOP_1_5 (1 << 12)
19359 +#define ATMEL_US_NBSTOP_2 (2 << 12)
19360 +#define ATMEL_US_CHMODE (3 << 14) /* Channel Mode */
19361 +#define ATMEL_US_CHMODE_NORMAL (0 << 14)
19362 +#define ATMEL_US_CHMODE_ECHO (1 << 14)
19363 +#define ATMEL_US_CHMODE_LOC_LOOP (2 << 14)
19364 +#define ATMEL_US_CHMODE_REM_LOOP (3 << 14)
19365 +#define ATMEL_US_MSBF (1 << 16) /* Bit Order */
19366 +#define ATMEL_US_MODE9 (1 << 17) /* 9-bit Character Length */
19367 +#define ATMEL_US_CLKO (1 << 18) /* Clock Output Select */
19368 +#define ATMEL_US_OVER (1 << 19) /* Oversampling Mode */
19369 +#define ATMEL_US_INACK (1 << 20) /* Inhibit Non Acknowledge */
19370 +#define ATMEL_US_DSNACK (1 << 21) /* Disable Successive NACK */
19371 +#define ATMEL_US_MAX_ITER (7 << 24) /* Max Iterations */
19372 +#define ATMEL_US_FILTER (1 << 28) /* Infrared Receive Line Filter */
19374 +#define ATMEL_US_IER 0x08 /* Interrupt Enable Register */
19375 +#define ATMEL_US_RXRDY (1 << 0) /* Receiver Ready */
19376 +#define ATMEL_US_TXRDY (1 << 1) /* Transmitter Ready */
19377 +#define ATMEL_US_RXBRK (1 << 2) /* Break Received / End of Break */
19378 +#define ATMEL_US_ENDRX (1 << 3) /* End of Receiver Transfer */
19379 +#define ATMEL_US_ENDTX (1 << 4) /* End of Transmitter Transfer */
19380 +#define ATMEL_US_OVRE (1 << 5) /* Overrun Error */
19381 +#define ATMEL_US_FRAME (1 << 6) /* Framing Error */
19382 +#define ATMEL_US_PARE (1 << 7) /* Parity Error */
19383 +#define ATMEL_US_TIMEOUT (1 << 8) /* Receiver Time-out */
19384 +#define ATMEL_US_TXEMPTY (1 << 9) /* Transmitter Empty */
19385 +#define ATMEL_US_ITERATION (1 << 10) /* Max number of Repetitions Reached */
19386 +#define ATMEL_US_TXBUFE (1 << 11) /* Transmission Buffer Empty */
19387 +#define ATMEL_US_RXBUFF (1 << 12) /* Reception Buffer Full */
19388 +#define ATMEL_US_NACK (1 << 13) /* Non Acknowledge */
19389 +#define ATMEL_US_RIIC (1 << 16) /* Ring Indicator Input Change [AT91RM9200 only] */
19390 +#define ATMEL_US_DSRIC (1 << 17) /* Data Set Ready Input Change [AT91RM9200 only] */
19391 +#define ATMEL_US_DCDIC (1 << 18) /* Data Carrier Detect Input Change [AT91RM9200 only] */
19392 +#define ATMEL_US_CTSIC (1 << 19) /* Clear to Send Input Change */
19393 +#define ATMEL_US_RI (1 << 20) /* RI */
19394 +#define ATMEL_US_DSR (1 << 21) /* DSR */
19395 +#define ATMEL_US_DCD (1 << 22) /* DCD */
19396 +#define ATMEL_US_CTS (1 << 23) /* CTS */
19398 +#define ATMEL_US_IDR 0x0c /* Interrupt Disable Register */
19399 +#define ATMEL_US_IMR 0x10 /* Interrupt Mask Register */
19400 +#define ATMEL_US_CSR 0x14 /* Channel Status Register */
19401 +#define ATMEL_US_RHR 0x18 /* Receiver Holding Register */
19402 +#define ATMEL_US_THR 0x1c /* Transmitter Holding Register */
19403 +#define ATMEL_US_SYNH (1 << 15) /* Transmit/Receive Sync [AT91SAM9261 only] */
19405 +#define ATMEL_US_BRGR 0x20 /* Baud Rate Generator Register */
19406 +#define ATMEL_US_CD (0xffff << 0) /* Clock Divider */
19408 +#define ATMEL_US_RTOR 0x24 /* Receiver Time-out Register */
19409 +#define ATMEL_US_TO (0xffff << 0) /* Time-out Value */
19411 +#define ATMEL_US_TTGR 0x28 /* Transmitter Timeguard Register */
19412 +#define ATMEL_US_TG (0xff << 0) /* Timeguard Value */
19414 +#define ATMEL_US_FIDI 0x40 /* FI DI Ratio Register */
19415 +#define ATMEL_US_NER 0x44 /* Number of Errors Register */
19416 +#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
19419 diff -urN linux-2.6.24.3/include/linux/atmel_tc.h avr32-2.6/include/linux/atmel_tc.h
19420 --- linux-2.6.24.3/include/linux/atmel_tc.h 1970-01-01 01:00:00.000000000 +0100
19421 +++ avr32-2.6/include/linux/atmel_tc.h 2008-04-23 20:12:46.000000000 +0200
19424 + * Timer/Counter Unit (TC) registers.
19426 + * This program is free software; you can redistribute it and/or modify
19427 + * it under the terms of the GNU General Public License as published by
19428 + * the Free Software Foundation; either version 2 of the License, or
19429 + * (at your option) any later version.
19432 +#ifndef ATMEL_TC_H
19433 +#define ATMEL_TC_H
19435 +#include <linux/compiler.h>
19436 +#include <linux/list.h>
19439 + * Many 32-bit Atmel SOCs include one or more TC blocks, each of which holds
19440 + * three general-purpose 16-bit timers. These timers share one register bank.
19441 + * Depending on the SOC, each timer may have its own clock and IRQ, or those
19442 + * may be shared by the whole TC block.
19444 + * These TC blocks may have up to nine external pins: TCLK0..2 signals for
19445 + * clocks or clock gates, and per-timer TIOA and TIOB signals used for PWM
19446 + * or triggering. Those pins need to be set up for use with the TC block,
19447 + * else they will be used as GPIOs or for a different controller.
19449 + * Although we expect each TC block to have a platform_device node, those
19450 + * nodes are not what drivers bind to. Instead, they ask for a specific
19451 + * TC block, by number ... which is a common approach on systems with many
19452 + * timers. Then they use clk_get() and platform_get_irq() to get clock and
19459 + * struct atmel_tc - information about a Timer/Counter Block
19460 + * @pdev: physical device
19461 + * @iomem: resource associated with the I/O register
19462 + * @regs: mapping through which the I/O registers can be accessed
19463 + * @irq: irq for each of the three channels
19464 + * @clk: internal clock source for each of the three channels
19465 + * @node: list node, for tclib internal use
19467 + * On some platforms, each TC channel has its own clocks and IRQs,
19468 + * while on others, all TC channels share the same clock and IRQ.
19469 + * Drivers should clk_enable() all the clocks they need even though
19470 + * all the entries in @clk may point to the same physical clock.
19471 + * Likewise, drivers should request irqs independently for each
19472 + * channel, but they must use IRQF_SHARED in case some of the entries
19473 + * in @irq are actually the same IRQ.
19476 + struct platform_device *pdev;
19477 + struct resource *iomem;
19478 + void __iomem *regs;
19480 + struct clk *clk[3];
19481 + struct list_head node;
19484 +extern struct atmel_tc *atmel_tc_alloc(unsigned block, const char *name);
19485 +extern void atmel_tc_free(struct atmel_tc *tc);
19487 +/* platform-specific ATMEL_TC_TIMER_CLOCKx divisors (0 means 32KiHz) */
19488 +extern const u8 atmel_tc_divisors[5];
19492 + * Two registers have block-wide controls. These are: configuring the three
19493 + * "external" clocks (or event sources) used by the timer channels; and
19494 + * synchronizing the timers by resetting them all at once.
19496 + * "External" can mean "external to chip" using the TCLK0, TCLK1, or TCLK2
19497 + * signals. Or, it can mean "external to timer", using the TIOA output from
19498 + * one of the other two timers that's being run in waveform mode.
19501 +#define ATMEL_TC_BCR 0xc0 /* TC Block Control Register */
19502 +#define ATMEL_TC_SYNC (1 << 0) /* synchronize timers */
19504 +#define ATMEL_TC_BMR 0xc4 /* TC Block Mode Register */
19505 +#define ATMEL_TC_TC0XC0S (3 << 0) /* external clock 0 source */
19506 +#define ATMEL_TC_TC0XC0S_TCLK0 (0 << 0)
19507 +#define ATMEL_TC_TC0XC0S_NONE (1 << 0)
19508 +#define ATMEL_TC_TC0XC0S_TIOA1 (2 << 0)
19509 +#define ATMEL_TC_TC0XC0S_TIOA2 (3 << 0)
19510 +#define ATMEL_TC_TC1XC1S (3 << 2) /* external clock 1 source */
19511 +#define ATMEL_TC_TC1XC1S_TCLK1 (0 << 2)
19512 +#define ATMEL_TC_TC1XC1S_NONE (1 << 2)
19513 +#define ATMEL_TC_TC1XC1S_TIOA0 (2 << 2)
19514 +#define ATMEL_TC_TC1XC1S_TIOA2 (3 << 2)
19515 +#define ATMEL_TC_TC2XC2S (3 << 4) /* external clock 2 source */
19516 +#define ATMEL_TC_TC2XC2S_TCLK2 (0 << 4)
19517 +#define ATMEL_TC_TC2XC2S_NONE (1 << 4)
19518 +#define ATMEL_TC_TC2XC2S_TIOA0 (2 << 4)
19519 +#define ATMEL_TC_TC2XC2S_TIOA1 (3 << 4)
19523 + * Each TC block has three "channels", each with one counter and controls.
19525 + * Note that the semantics of ATMEL_TC_TIMER_CLOCKx (input clock selection
19526 + * when it's not "external") is silicon-specific. AT91 platforms use one
19527 + * set of definitions; AVR32 platforms use a different set. Don't hard-wire
19528 + * such knowledge into your code, use the global "atmel_tc_divisors" ...
19529 + * where index N is the divisor for clock N+1, else zero to indicate it uses
19530 + * the 32 KiHz clock.
19532 + * The timers can be chained in various ways, and operated in "waveform"
19533 + * generation mode (including PWM) or "capture" mode (to time events). In
19534 + * both modes, behavior can be configured in many ways.
19536 + * Each timer has two I/O pins, TIOA and TIOB. Waveform mode uses TIOA as a
19537 + * PWM output, and TIOB as either another PWM or as a trigger. Capture mode
19538 + * uses them only as inputs.
19540 +#define ATMEL_TC_CHAN(idx) ((idx)*0x40)
19541 +#define ATMEL_TC_REG(idx, reg) (ATMEL_TC_CHAN(idx) + ATMEL_TC_ ## reg)
19543 +#define ATMEL_TC_CCR 0x00 /* Channel Control Register */
19544 +#define ATMEL_TC_CLKEN (1 << 0) /* clock enable */
19545 +#define ATMEL_TC_CLKDIS (1 << 1) /* clock disable */
19546 +#define ATMEL_TC_SWTRG (1 << 2) /* software trigger */
19548 +#define ATMEL_TC_CMR 0x04 /* Channel Mode Register */
19550 +/* Both modes share some CMR bits */
19551 +#define ATMEL_TC_TCCLKS (7 << 0) /* clock source */
19552 +#define ATMEL_TC_TIMER_CLOCK1 (0 << 0)
19553 +#define ATMEL_TC_TIMER_CLOCK2 (1 << 0)
19554 +#define ATMEL_TC_TIMER_CLOCK3 (2 << 0)
19555 +#define ATMEL_TC_TIMER_CLOCK4 (3 << 0)
19556 +#define ATMEL_TC_TIMER_CLOCK5 (4 << 0)
19557 +#define ATMEL_TC_XC0 (5 << 0)
19558 +#define ATMEL_TC_XC1 (6 << 0)
19559 +#define ATMEL_TC_XC2 (7 << 0)
19560 +#define ATMEL_TC_CLKI (1 << 3) /* clock invert */
19561 +#define ATMEL_TC_BURST (3 << 4) /* clock gating */
19562 +#define ATMEL_TC_GATE_NONE (0 << 4)
19563 +#define ATMEL_TC_GATE_XC0 (1 << 4)
19564 +#define ATMEL_TC_GATE_XC1 (2 << 4)
19565 +#define ATMEL_TC_GATE_XC2 (3 << 4)
19566 +#define ATMEL_TC_WAVE (1 << 15) /* true = Waveform mode */
19568 +/* CAPTURE mode CMR bits */
19569 +#define ATMEL_TC_LDBSTOP (1 << 6) /* counter stops on RB load */
19570 +#define ATMEL_TC_LDBDIS (1 << 7) /* counter disable on RB load */
19571 +#define ATMEL_TC_ETRGEDG (3 << 8) /* external trigger edge */
19572 +#define ATMEL_TC_ETRGEDG_NONE (0 << 8)
19573 +#define ATMEL_TC_ETRGEDG_RISING (1 << 8)
19574 +#define ATMEL_TC_ETRGEDG_FALLING (2 << 8)
19575 +#define ATMEL_TC_ETRGEDG_BOTH (3 << 8)
19576 +#define ATMEL_TC_ABETRG (1 << 10) /* external trigger is TIOA? */
19577 +#define ATMEL_TC_CPCTRG (1 << 14) /* RC compare trigger enable */
19578 +#define ATMEL_TC_LDRA (3 << 16) /* RA loading edge (of TIOA) */
19579 +#define ATMEL_TC_LDRA_NONE (0 << 16)
19580 +#define ATMEL_TC_LDRA_RISING (1 << 16)
19581 +#define ATMEL_TC_LDRA_FALLING (2 << 16)
19582 +#define ATMEL_TC_LDRA_BOTH (3 << 16)
19583 +#define ATMEL_TC_LDRB (3 << 18) /* RB loading edge (of TIOA) */
19584 +#define ATMEL_TC_LDRB_NONE (0 << 18)
19585 +#define ATMEL_TC_LDRB_RISING (1 << 18)
19586 +#define ATMEL_TC_LDRB_FALLING (2 << 18)
19587 +#define ATMEL_TC_LDRB_BOTH (3 << 18)
19589 +/* WAVEFORM mode CMR bits */
19590 +#define ATMEL_TC_CPCSTOP (1 << 6) /* RC compare stops counter */
19591 +#define ATMEL_TC_CPCDIS (1 << 7) /* RC compare disables counter */
19592 +#define ATMEL_TC_EEVTEDG (3 << 8) /* external event edge */
19593 +#define ATMEL_TC_EEVTEDG_NONE (0 << 8)
19594 +#define ATMEL_TC_EEVTEDG_RISING (1 << 8)
19595 +#define ATMEL_TC_EEVTEDG_FALLING (2 << 8)
19596 +#define ATMEL_TC_EEVTEDG_BOTH (3 << 8)
19597 +#define ATMEL_TC_EEVT (3 << 10) /* external event source */
19598 +#define ATMEL_TC_EEVT_TIOB (0 << 10)
19599 +#define ATMEL_TC_EEVT_XC0 (1 << 10)
19600 +#define ATMEL_TC_EEVT_XC1 (2 << 10)
19601 +#define ATMEL_TC_EEVT_XC2 (3 << 10)
19602 +#define ATMEL_TC_ENETRG (1 << 12) /* external event is trigger */
19603 +#define ATMEL_TC_WAVESEL (3 << 13) /* waveform type */
19604 +#define ATMEL_TC_WAVESEL_UP (0 << 13)
19605 +#define ATMEL_TC_WAVESEL_UPDOWN (1 << 13)
19606 +#define ATMEL_TC_WAVESEL_UP_AUTO (2 << 13)
19607 +#define ATMEL_TC_WAVESEL_UPDOWN_AUTO (3 << 13)
19608 +#define ATMEL_TC_ACPA (3 << 16) /* RA compare changes TIOA */
19609 +#define ATMEL_TC_ACPA_NONE (0 << 16)
19610 +#define ATMEL_TC_ACPA_SET (1 << 16)
19611 +#define ATMEL_TC_ACPA_CLEAR (2 << 16)
19612 +#define ATMEL_TC_ACPA_TOGGLE (3 << 16)
19613 +#define ATMEL_TC_ACPC (3 << 18) /* RC compare changes TIOA */
19614 +#define ATMEL_TC_ACPC_NONE (0 << 18)
19615 +#define ATMEL_TC_ACPC_SET (1 << 18)
19616 +#define ATMEL_TC_ACPC_CLEAR (2 << 18)
19617 +#define ATMEL_TC_ACPC_TOGGLE (3 << 18)
19618 +#define ATMEL_TC_AEEVT (3 << 20) /* external event changes TIOA */
19619 +#define ATMEL_TC_AEEVT_NONE (0 << 20)
19620 +#define ATMEL_TC_AEEVT_SET (1 << 20)
19621 +#define ATMEL_TC_AEEVT_CLEAR (2 << 20)
19622 +#define ATMEL_TC_AEEVT_TOGGLE (3 << 20)
19623 +#define ATMEL_TC_ASWTRG (3 << 22) /* software trigger changes TIOA */
19624 +#define ATMEL_TC_ASWTRG_NONE (0 << 22)
19625 +#define ATMEL_TC_ASWTRG_SET (1 << 22)
19626 +#define ATMEL_TC_ASWTRG_CLEAR (2 << 22)
19627 +#define ATMEL_TC_ASWTRG_TOGGLE (3 << 22)
19628 +#define ATMEL_TC_BCPB (3 << 24) /* RB compare changes TIOB */
19629 +#define ATMEL_TC_BCPB_NONE (0 << 24)
19630 +#define ATMEL_TC_BCPB_SET (1 << 24)
19631 +#define ATMEL_TC_BCPB_CLEAR (2 << 24)
19632 +#define ATMEL_TC_BCPB_TOGGLE (3 << 24)
19633 +#define ATMEL_TC_BCPC (3 << 26) /* RC compare changes TIOB */
19634 +#define ATMEL_TC_BCPC_NONE (0 << 26)
19635 +#define ATMEL_TC_BCPC_SET (1 << 26)
19636 +#define ATMEL_TC_BCPC_CLEAR (2 << 26)
19637 +#define ATMEL_TC_BCPC_TOGGLE (3 << 26)
19638 +#define ATMEL_TC_BEEVT (3 << 28) /* external event changes TIOB */
19639 +#define ATMEL_TC_BEEVT_NONE (0 << 28)
19640 +#define ATMEL_TC_BEEVT_SET (1 << 28)
19641 +#define ATMEL_TC_BEEVT_CLEAR (2 << 28)
19642 +#define ATMEL_TC_BEEVT_TOGGLE (3 << 28)
19643 +#define ATMEL_TC_BSWTRG (3 << 30) /* software trigger changes TIOB */
19644 +#define ATMEL_TC_BSWTRG_NONE (0 << 30)
19645 +#define ATMEL_TC_BSWTRG_SET (1 << 30)
19646 +#define ATMEL_TC_BSWTRG_CLEAR (2 << 30)
19647 +#define ATMEL_TC_BSWTRG_TOGGLE (3 << 30)
19649 +#define ATMEL_TC_CV 0x10 /* counter Value */
19650 +#define ATMEL_TC_RA 0x14 /* register A */
19651 +#define ATMEL_TC_RB 0x18 /* register B */
19652 +#define ATMEL_TC_RC 0x1c /* register C */
19654 +#define ATMEL_TC_SR 0x20 /* status (read-only) */
19655 +/* Status-only flags */
19656 +#define ATMEL_TC_CLKSTA (1 << 16) /* clock enabled */
19657 +#define ATMEL_TC_MTIOA (1 << 17) /* TIOA mirror */
19658 +#define ATMEL_TC_MTIOB (1 << 18) /* TIOB mirror */
19660 +#define ATMEL_TC_IER 0x24 /* interrupt enable (write-only) */
19661 +#define ATMEL_TC_IDR 0x28 /* interrupt disable (write-only) */
19662 +#define ATMEL_TC_IMR 0x2c /* interrupt mask (read-only) */
19664 +/* Status and IRQ flags */
19665 +#define ATMEL_TC_COVFS (1 << 0) /* counter overflow */
19666 +#define ATMEL_TC_LOVRS (1 << 1) /* load overrun */
19667 +#define ATMEL_TC_CPAS (1 << 2) /* RA compare */
19668 +#define ATMEL_TC_CPBS (1 << 3) /* RB compare */
19669 +#define ATMEL_TC_CPCS (1 << 4) /* RC compare */
19670 +#define ATMEL_TC_LDRAS (1 << 5) /* RA loading */
19671 +#define ATMEL_TC_LDRBS (1 << 6) /* RB loading */
19672 +#define ATMEL_TC_ETRGS (1 << 7) /* external trigger */
19675 diff -urN linux-2.6.24.3/include/linux/usb/atmel_usba_udc.h avr32-2.6/include/linux/usb/atmel_usba_udc.h
19676 --- linux-2.6.24.3/include/linux/usb/atmel_usba_udc.h 1970-01-01 01:00:00.000000000 +0100
19677 +++ avr32-2.6/include/linux/usb/atmel_usba_udc.h 2008-04-23 20:12:47.000000000 +0200
19680 + * Platform data definitions for Atmel USBA gadget driver.
19682 +#ifndef __LINUX_USB_USBA_H
19683 +#define __LINUX_USB_USBA_H
19685 +struct usba_ep_data {
19694 +struct usba_platform_data {
19697 + struct usba_ep_data ep[0];
19700 +#endif /* __LINUX_USB_USBA_H */
19701 diff -urN linux-2.6.24.3/include/video/atmel_lcdc.h avr32-2.6/include/video/atmel_lcdc.h
19702 --- linux-2.6.24.3/include/video/atmel_lcdc.h 2008-02-26 01:20:20.000000000 +0100
19703 +++ avr32-2.6/include/video/atmel_lcdc.h 2008-04-23 19:33:52.000000000 +0200
19705 #ifndef __ATMEL_LCDC_H__
19706 #define __ATMEL_LCDC_H__
19708 - /* LCD Controller info data structure */
19709 + /* LCD Controller info data structure, stored in device platform_data */
19710 struct atmel_lcdfb_info {
19712 struct fb_info *info;
19714 struct platform_device *pdev;
19715 struct clk *bus_clk;
19716 struct clk *lcdc_clk;
19717 - unsigned int default_bpp;
19719 +#ifdef CONFIG_BACKLIGHT_ATMEL_LCDC
19720 + struct backlight_device *backlight;
19723 + bool lcdcon_is_backlight;
19726 unsigned int default_lcdcon2;
19727 unsigned int default_dmacon;
19728 void (*atmel_lcdfb_power_control)(int on);
19729 @@ -115,20 +122,20 @@
19730 #define ATMEL_LCDC_MEMOR_LITTLE (1 << 31)
19732 #define ATMEL_LCDC_TIM1 0x0808
19733 -#define ATMEL_LCDC_VFP (0xff << 0)
19734 +#define ATMEL_LCDC_VFP (0xffU << 0)
19735 #define ATMEL_LCDC_VBP_OFFSET 8
19736 -#define ATMEL_LCDC_VBP (0xff << ATMEL_LCDC_VBP_OFFSET)
19737 +#define ATMEL_LCDC_VBP (0xffU << ATMEL_LCDC_VBP_OFFSET)
19738 #define ATMEL_LCDC_VPW_OFFSET 16
19739 -#define ATMEL_LCDC_VPW (0x3f << ATMEL_LCDC_VPW_OFFSET)
19740 +#define ATMEL_LCDC_VPW (0x3fU << ATMEL_LCDC_VPW_OFFSET)
19741 #define ATMEL_LCDC_VHDLY_OFFSET 24
19742 -#define ATMEL_LCDC_VHDLY (0xf << ATMEL_LCDC_VHDLY_OFFSET)
19743 +#define ATMEL_LCDC_VHDLY (0xfU << ATMEL_LCDC_VHDLY_OFFSET)
19745 #define ATMEL_LCDC_TIM2 0x080c
19746 -#define ATMEL_LCDC_HBP (0xff << 0)
19747 +#define ATMEL_LCDC_HBP (0xffU << 0)
19748 #define ATMEL_LCDC_HPW_OFFSET 8
19749 -#define ATMEL_LCDC_HPW (0x3f << ATMEL_LCDC_HPW_OFFSET)
19750 +#define ATMEL_LCDC_HPW (0x3fU << ATMEL_LCDC_HPW_OFFSET)
19751 #define ATMEL_LCDC_HFP_OFFSET 21
19752 -#define ATMEL_LCDC_HFP (0x7ff << ATMEL_LCDC_HFP_OFFSET)
19753 +#define ATMEL_LCDC_HFP (0x7ffU << ATMEL_LCDC_HFP_OFFSET)
19755 #define ATMEL_LCDC_LCDFRMCFG 0x0810
19756 #define ATMEL_LCDC_LINEVAL (0x7ff << 0)
19757 diff -urN linux-2.6.24.3/init/do_mounts.c avr32-2.6/init/do_mounts.c
19758 --- linux-2.6.24.3/init/do_mounts.c 2008-02-26 01:20:20.000000000 +0100
19759 +++ avr32-2.6/init/do_mounts.c 2008-04-23 20:12:47.000000000 +0200
19760 @@ -219,8 +219,14 @@
19762 static int __init rootwait_setup(char *str)
19765 + if (*str && *str != '=')
19769 + printk(KERN_WARNING
19770 + "WARNING: \"rootwait=1\" is deprecated, "
19771 + "use \"rootwait\" instead.\n");
19776 diff -urN linux-2.6.24.3/kernel/ptrace.c avr32-2.6/kernel/ptrace.c
19777 --- linux-2.6.24.3/kernel/ptrace.c 2008-02-26 01:20:20.000000000 +0100
19778 +++ avr32-2.6/kernel/ptrace.c 2008-04-23 20:12:47.000000000 +0200
19779 @@ -470,6 +470,8 @@
19781 if (request == PTRACE_TRACEME) {
19782 ret = ptrace_traceme();
19784 + arch_ptrace_attach(current);
19788 diff -urN linux-2.6.24.3/MAINTAINERS avr32-2.6/MAINTAINERS
19789 --- linux-2.6.24.3/MAINTAINERS 2008-02-26 01:20:20.000000000 +0100
19790 +++ avr32-2.6/MAINTAINERS 2008-04-23 20:12:35.000000000 +0200
19791 @@ -671,6 +671,12 @@
19792 W: http://www.at91.com/
19795 +ATMEL AT91 / AT32 SERIAL DRIVER
19796 +P: Haavard Skinnemoen
19797 +M: hskinnemoen@atmel.com
19798 +L: linux-kernel@vger.kernel.org
19803 M: nicolas.ferre@atmel.com
19804 diff -urN linux-2.6.24.3/sound/avr32/ac97c.c avr32-2.6/sound/avr32/ac97c.c
19805 --- linux-2.6.24.3/sound/avr32/ac97c.c 1970-01-01 01:00:00.000000000 +0100
19806 +++ avr32-2.6/sound/avr32/ac97c.c 2008-04-23 19:33:54.000000000 +0200
19809 + * Driver for the Atmel AC97 controller
19811 + * Copyright (C) 2005-2007 Atmel Corporation
19813 + * This program is free software; you can redistribute it and/or modify it
19814 + * under the terms of the GNU General Public License version 2 as published by
19815 + * the Free Software Foundation.
19817 +#include <linux/clk.h>
19818 +#include <linux/delay.h>
19819 +#include <linux/dma-mapping.h>
19820 +#include <linux/init.h>
19821 +#include <linux/interrupt.h>
19822 +#include <linux/module.h>
19823 +#include <linux/platform_device.h>
19824 +#include <linux/mutex.h>
19825 +#include <linux/io.h>
19827 +#include <sound/driver.h>
19828 +#include <sound/core.h>
19829 +#include <sound/initval.h>
19830 +#include <sound/pcm.h>
19831 +#include <sound/pcm_params.h>
19832 +#include <sound/ac97_codec.h>
19833 +#include <sound/memalloc.h>
19835 +#include <asm/dma-controller.h>
19837 +#include "ac97c.h"
19839 +/* Serialize access to opened */
19840 +static DEFINE_MUTEX(opened_mutex);
19842 +struct atmel_ac97_dma_info {
19843 + struct dma_request_cyclic req_tx;
19844 + struct dma_request_cyclic req_rx;
19845 + unsigned short rx_periph_id;
19846 + unsigned short tx_periph_id;
19849 +struct atmel_ac97 {
19850 + /* Serialize access to opened */
19852 + void __iomem *regs;
19853 + struct snd_pcm_substream *playback_substream;
19854 + struct snd_pcm_substream *capture_substream;
19855 + struct snd_card *card;
19856 + struct snd_pcm *pcm;
19857 + struct snd_ac97 *ac97;
19858 + struct snd_ac97_bus *ac97_bus;
19862 + unsigned int cur_rate;
19864 + struct platform_device *pdev;
19865 + struct atmel_ac97_dma_info dma;
19868 +#define get_chip(card) ((struct atmel_ac97 *)(card)->private_data)
19870 +#define ac97c_writel(chip, reg, val) \
19871 + __raw_writel((val), (chip)->regs + AC97C_##reg)
19872 +#define ac97c_readl(chip, reg) \
19873 + __raw_readl((chip)->regs + AC97C_##reg)
19878 +static struct snd_pcm_hardware snd_atmel_ac97_playback_hw = {
19879 + .info = (SNDRV_PCM_INFO_INTERLEAVED
19880 + | SNDRV_PCM_INFO_MMAP
19881 + | SNDRV_PCM_INFO_MMAP_VALID
19882 + | SNDRV_PCM_INFO_BLOCK_TRANSFER
19883 + | SNDRV_PCM_INFO_JOINT_DUPLEX),
19884 + .formats = (SNDRV_PCM_FMTBIT_S16_BE
19885 + | SNDRV_PCM_FMTBIT_S16_LE),
19886 + .rates = (SNDRV_PCM_RATE_CONTINUOUS),
19887 + .rate_min = 4000,
19888 + .rate_max = 48000,
19889 + .channels_min = 1,
19890 + .channels_max = 6,
19891 + .buffer_bytes_max = 64*1024,
19892 + .period_bytes_min = 512,
19893 + .period_bytes_max = 4095,
19894 + .periods_min = 8,
19895 + .periods_max = 1024,
19898 +static struct snd_pcm_hardware snd_atmel_ac97_capture_hw = {
19899 + .info = (SNDRV_PCM_INFO_INTERLEAVED
19900 + | SNDRV_PCM_INFO_MMAP
19901 + | SNDRV_PCM_INFO_MMAP_VALID
19902 + | SNDRV_PCM_INFO_BLOCK_TRANSFER
19903 + | SNDRV_PCM_INFO_JOINT_DUPLEX),
19904 + .formats = (SNDRV_PCM_FMTBIT_S16_BE
19905 + | SNDRV_PCM_FMTBIT_S16_LE),
19906 + .rates = (SNDRV_PCM_RATE_CONTINUOUS),
19907 + .rate_min = 4000,
19908 + .rate_max = 48000,
19909 + .channels_min = 1,
19910 + .channels_max = 2,
19911 + .buffer_bytes_max = 64*1024,
19912 + .period_bytes_min = 512,
19913 + .period_bytes_max = 4095,
19914 + .periods_min = 8,
19915 + .periods_max = 1024,
19922 +snd_atmel_ac97_playback_open(struct snd_pcm_substream *substream)
19924 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
19925 + struct snd_pcm_runtime *runtime = substream->runtime;
19927 + mutex_lock(&opened_mutex);
19929 + runtime->hw = snd_atmel_ac97_playback_hw;
19930 + if (chip->cur_rate) {
19931 + runtime->hw.rate_min = chip->cur_rate;
19932 + runtime->hw.rate_max = chip->cur_rate;
19934 + if (chip->cur_format)
19935 + runtime->hw.formats = (1ULL << chip->cur_format);
19936 + mutex_unlock(&opened_mutex);
19937 + chip->playback_substream = substream;
19938 + chip->period = 0;
19943 +snd_atmel_ac97_capture_open(struct snd_pcm_substream *substream)
19945 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
19946 + struct snd_pcm_runtime *runtime = substream->runtime;
19948 + mutex_lock(&opened_mutex);
19950 + runtime->hw = snd_atmel_ac97_capture_hw;
19951 + if (chip->cur_rate) {
19952 + runtime->hw.rate_min = chip->cur_rate;
19953 + runtime->hw.rate_max = chip->cur_rate;
19955 + if (chip->cur_format)
19956 + runtime->hw.formats = (1ULL << chip->cur_format);
19957 + mutex_unlock(&opened_mutex);
19958 + chip->capture_substream = substream;
19959 + chip->period = 0;
19963 +static int snd_atmel_ac97_playback_close(struct snd_pcm_substream *substream)
19965 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
19966 + mutex_lock(&opened_mutex);
19968 + if (!chip->opened) {
19969 + chip->cur_rate = 0;
19970 + chip->cur_format = 0;
19972 + mutex_unlock(&opened_mutex);
19976 +static int snd_atmel_ac97_capture_close(struct snd_pcm_substream *substream)
19978 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
19979 + mutex_lock(&opened_mutex);
19981 + if (!chip->opened) {
19982 + chip->cur_rate = 0;
19983 + chip->cur_format = 0;
19985 + mutex_unlock(&opened_mutex);
19990 +snd_atmel_ac97_playback_hw_params(struct snd_pcm_substream *substream,
19991 + struct snd_pcm_hw_params *hw_params)
19993 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
19996 + err = snd_pcm_lib_malloc_pages(substream,
19997 + params_buffer_bytes(hw_params));
20001 + /* Set restrictions to params */
20002 + mutex_lock(&opened_mutex);
20003 + chip->cur_rate = params_rate(hw_params);
20004 + chip->cur_format = params_format(hw_params);
20005 + mutex_unlock(&opened_mutex);
20011 +snd_atmel_ac97_capture_hw_params(struct snd_pcm_substream *substream,
20012 + struct snd_pcm_hw_params *hw_params)
20014 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
20017 + err = snd_pcm_lib_malloc_pages(substream,
20018 + params_buffer_bytes(hw_params));
20022 + /* Set restrictions to params */
20023 + mutex_lock(&opened_mutex);
20024 + chip->cur_rate = params_rate(hw_params);
20025 + chip->cur_format = params_format(hw_params);
20026 + mutex_unlock(&opened_mutex);
20031 +static int snd_atmel_ac97_playback_hw_free(struct snd_pcm_substream *substream)
20033 + return snd_pcm_lib_free_pages(substream);
20036 +static int snd_atmel_ac97_capture_hw_free(struct snd_pcm_substream *substream)
20039 + return snd_pcm_lib_free_pages(substream);
20042 +static int snd_atmel_ac97_playback_prepare(struct snd_pcm_substream *substream)
20044 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
20045 + struct platform_device *pdev = chip->pdev;
20046 + struct snd_pcm_runtime *runtime = substream->runtime;
20047 + int block_size = frames_to_bytes(runtime, runtime->period_size);
20048 + unsigned long word = 0;
20049 + unsigned long buffer_size = 0;
20051 + dma_sync_single_for_device(&pdev->dev, runtime->dma_addr,
20052 + block_size * 2, DMA_TO_DEVICE);
20054 + /* Assign slots to channels */
20055 + switch (substream->runtime->channels) {
20057 + word |= AC97C_CH_ASSIGN(PCM_LEFT, A);
20060 + /* Assign Left and Right slot to Channel A */
20061 + word |= AC97C_CH_ASSIGN(PCM_LEFT, A)
20062 + | AC97C_CH_ASSIGN(PCM_RIGHT, A);
20065 + /* TODO: support more than two channels */
20069 + ac97c_writel(chip, OCA, word);
20071 + /* Configure sample format and size */
20072 + word = AC97C_CMR_PDCEN | AC97C_CMR_SIZE_16;
20074 + switch (runtime->format) {
20075 + case SNDRV_PCM_FORMAT_S16_LE:
20076 + word |= AC97C_CMR_CEM_LITTLE;
20078 + case SNDRV_PCM_FORMAT_S16_BE: /* fall through */
20080 + word &= ~AC97C_CMR_CEM_LITTLE;
20084 + ac97c_writel(chip, CAMR, word);
20086 + /* Set variable rate if needed */
20087 + if (runtime->rate != 48000) {
20088 + word = ac97c_readl(chip, MR);
20089 + word |= AC97C_MR_VRA;
20090 + ac97c_writel(chip, MR, word);
20092 + /* Clear Variable Rate Bit */
20093 + word = ac97c_readl(chip, MR);
20094 + word &= ~AC97C_MR_VRA;
20095 + ac97c_writel(chip, MR, word);
20099 + snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, runtime->rate);
20101 + buffer_size = frames_to_bytes(runtime, runtime->period_size) *
20102 + runtime->periods;
20104 + chip->dma.req_tx.buffer_size = buffer_size;
20105 + chip->dma.req_tx.periods = runtime->periods;
20107 + BUG_ON(chip->dma.req_tx.buffer_size !=
20108 + (chip->dma.req_tx.periods *
20109 + frames_to_bytes(runtime, runtime->period_size)));
20111 + chip->dma.req_tx.buffer_start = runtime->dma_addr;
20112 + chip->dma.req_tx.data_reg = (dma_addr_t)(chip->regs + AC97C_CATHR + 2);
20113 + chip->dma.req_tx.periph_id = chip->dma.tx_periph_id;
20114 + chip->dma.req_tx.direction = DMA_DIR_MEM_TO_PERIPH;
20115 + chip->dma.req_tx.width = DMA_WIDTH_16BIT;
20116 + chip->dma.req_tx.dev_id = chip;
20121 +static int snd_atmel_ac97_capture_prepare(struct snd_pcm_substream *substream)
20123 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
20124 + struct platform_device *pdev = chip->pdev;
20125 + struct snd_pcm_runtime *runtime = substream->runtime;
20126 + int block_size = frames_to_bytes(runtime, runtime->period_size);
20127 + unsigned long word = 0;
20128 + unsigned long buffer_size = 0;
20130 + dma_sync_single_for_device(&pdev->dev, runtime->dma_addr,
20131 + block_size * 2, DMA_FROM_DEVICE);
20133 + /* Assign slots to channels */
20134 + switch (substream->runtime->channels) {
20136 + word |= AC97C_CH_ASSIGN(PCM_LEFT, A);
20139 + /* Assign Left and Right slot to Channel A */
20140 + word |= AC97C_CH_ASSIGN(PCM_LEFT, A)
20141 + | AC97C_CH_ASSIGN(PCM_RIGHT, A);
20144 + /* TODO: support more than two channels */
20148 + ac97c_writel(chip, ICA, word);
20150 + /* Configure sample format and size */
20151 + word = AC97C_CMR_PDCEN | AC97C_CMR_SIZE_16;
20153 + switch (runtime->format) {
20154 + case SNDRV_PCM_FORMAT_S16_LE:
20155 + word |= AC97C_CMR_CEM_LITTLE;
20157 + case SNDRV_PCM_FORMAT_S16_BE:
20159 + word &= ~(AC97C_CMR_CEM_LITTLE);
20163 + ac97c_writel(chip, CAMR, word);
20165 + /* Set variable rate if needed */
20166 + if (runtime->rate != 48000) {
20167 + word = ac97c_readl(chip, MR);
20168 + word |= AC97C_MR_VRA;
20169 + ac97c_writel(chip, MR, word);
20171 + /* Clear Variable Rate Bit */
20172 + word = ac97c_readl(chip, MR);
20173 + word &= ~(AC97C_MR_VRA);
20174 + ac97c_writel(chip, MR, word);
20178 + snd_ac97_set_rate(chip->ac97, AC97_PCM_LR_ADC_RATE, runtime->rate);
20180 + buffer_size = frames_to_bytes(runtime, runtime->period_size) *
20181 + runtime->periods;
20183 + chip->dma.req_rx.buffer_size = buffer_size;
20184 + chip->dma.req_rx.periods = runtime->periods;
20186 + BUG_ON(chip->dma.req_rx.buffer_size !=
20187 + (chip->dma.req_rx.periods *
20188 + frames_to_bytes(runtime, runtime->period_size)));
20190 + chip->dma.req_rx.buffer_start = runtime->dma_addr;
20191 + chip->dma.req_rx.data_reg = (dma_addr_t)(chip->regs + AC97C_CARHR + 2);
20192 + chip->dma.req_rx.periph_id = chip->dma.rx_periph_id;
20193 + chip->dma.req_rx.direction = DMA_DIR_PERIPH_TO_MEM;
20194 + chip->dma.req_rx.width = DMA_WIDTH_16BIT;
20195 + chip->dma.req_rx.dev_id = chip;
20201 +snd_atmel_ac97_playback_trigger(struct snd_pcm_substream *substream, int cmd)
20203 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
20204 + unsigned long camr;
20205 + int flags, err = 0;
20207 + spin_lock_irqsave(&chip->lock, flags);
20208 + camr = ac97c_readl(chip, CAMR);
20211 + case SNDRV_PCM_TRIGGER_START:
20212 + err = dma_prepare_request_cyclic(chip->dma.req_tx.req.dmac,
20213 + &chip->dma.req_tx);
20214 + dma_start_request(chip->dma.req_tx.req.dmac,
20215 + chip->dma.req_tx.req.channel);
20216 + camr |= AC97C_CMR_CENA;
20218 + case SNDRV_PCM_TRIGGER_STOP:
20219 + err = dma_stop_request(chip->dma.req_tx.req.dmac,
20220 + chip->dma.req_tx.req.channel);
20221 + if (chip->opened <= 1)
20222 + camr &= ~AC97C_CMR_CENA;
20229 + ac97c_writel(chip, CAMR, camr);
20231 + spin_unlock_irqrestore(&chip->lock, flags);
20236 +snd_atmel_ac97_capture_trigger(struct snd_pcm_substream *substream, int cmd)
20238 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
20239 + unsigned long camr;
20240 + int flags, err = 0;
20242 + spin_lock_irqsave(&chip->lock, flags);
20243 + camr = ac97c_readl(chip, CAMR);
20246 + case SNDRV_PCM_TRIGGER_START:
20247 + err = dma_prepare_request_cyclic(chip->dma.req_rx.req.dmac,
20248 + &chip->dma.req_rx);
20249 + dma_start_request(chip->dma.req_rx.req.dmac,
20250 + chip->dma.req_rx.req.channel);
20251 + camr |= AC97C_CMR_CENA;
20253 + case SNDRV_PCM_TRIGGER_STOP:
20254 + err = dma_stop_request(chip->dma.req_rx.req.dmac,
20255 + chip->dma.req_rx.req.channel);
20256 + mutex_lock(&opened_mutex);
20257 + if (chip->opened <= 1)
20258 + camr &= ~AC97C_CMR_CENA;
20259 + mutex_unlock(&opened_mutex);
20266 + ac97c_writel(chip, CAMR, camr);
20268 + spin_unlock_irqrestore(&chip->lock, flags);
20272 + static snd_pcm_uframes_t
20273 +snd_atmel_ac97_playback_pointer(struct snd_pcm_substream *substream)
20275 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
20276 + struct snd_pcm_runtime *runtime = substream->runtime;
20277 + snd_pcm_uframes_t pos;
20278 + unsigned long bytes;
20280 + bytes = (dma_get_current_pos
20281 + (chip->dma.req_tx.req.dmac,
20282 + chip->dma.req_tx.req.channel) - runtime->dma_addr);
20283 + pos = bytes_to_frames(runtime, bytes);
20284 + if (pos >= runtime->buffer_size)
20285 + pos -= runtime->buffer_size;
20290 + static snd_pcm_uframes_t
20291 +snd_atmel_ac97_capture_pointer(struct snd_pcm_substream *substream)
20293 + struct atmel_ac97 *chip = snd_pcm_substream_chip(substream);
20294 + struct snd_pcm_runtime *runtime = substream->runtime;
20295 + snd_pcm_uframes_t pos;
20296 + unsigned long bytes;
20298 + bytes = (dma_get_current_pos
20299 + (chip->dma.req_rx.req.dmac,
20300 + chip->dma.req_rx.req.channel)
20301 + - runtime->dma_addr);
20302 + pos = bytes_to_frames(runtime, bytes);
20303 + if (pos >= runtime->buffer_size)
20304 + pos -= runtime->buffer_size;
20310 +static struct snd_pcm_ops atmel_ac97_playback_ops = {
20311 + .open = snd_atmel_ac97_playback_open,
20312 + .close = snd_atmel_ac97_playback_close,
20313 + .ioctl = snd_pcm_lib_ioctl,
20314 + .hw_params = snd_atmel_ac97_playback_hw_params,
20315 + .hw_free = snd_atmel_ac97_playback_hw_free,
20316 + .prepare = snd_atmel_ac97_playback_prepare,
20317 + .trigger = snd_atmel_ac97_playback_trigger,
20318 + .pointer = snd_atmel_ac97_playback_pointer,
20321 +static struct snd_pcm_ops atmel_ac97_capture_ops = {
20322 + .open = snd_atmel_ac97_capture_open,
20323 + .close = snd_atmel_ac97_capture_close,
20324 + .ioctl = snd_pcm_lib_ioctl,
20325 + .hw_params = snd_atmel_ac97_capture_hw_params,
20326 + .hw_free = snd_atmel_ac97_capture_hw_free,
20327 + .prepare = snd_atmel_ac97_capture_prepare,
20328 + .trigger = snd_atmel_ac97_capture_trigger,
20329 + .pointer = snd_atmel_ac97_capture_pointer,
20332 +static struct ac97_pcm atmel_ac97_pcm_defs[] __devinitdata = {
20337 + .slots = ((1 << AC97_SLOT_PCM_LEFT)
20338 + | (1 << AC97_SLOT_PCM_RIGHT)
20339 + | (1 << AC97_SLOT_PCM_CENTER)
20340 + | (1 << AC97_SLOT_PCM_SLEFT)
20341 + | (1 << AC97_SLOT_PCM_SRIGHT)
20342 + | (1 << AC97_SLOT_LFE)),
20350 + .slots = ((1 << AC97_SLOT_PCM_LEFT)
20351 + | (1 << AC97_SLOT_PCM_RIGHT)),
20359 + .slots = (1<<AC97_SLOT_MIC),
20364 +static int __devinit snd_atmel_ac97_pcm_new(struct atmel_ac97 *chip)
20366 + struct snd_pcm *pcm;
20369 + err = snd_ac97_pcm_assign(chip->ac97_bus,
20370 + ARRAY_SIZE(atmel_ac97_pcm_defs),
20371 + atmel_ac97_pcm_defs);
20375 + err = snd_pcm_new(chip->card, "Atmel-AC97", 0, 1, 1, &pcm);
20379 + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
20380 + &atmel_ac97_playback_ops);
20382 + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
20383 + &atmel_ac97_capture_ops);
20385 + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
20386 + &chip->pdev->dev,
20387 + 128 * 1024, 128 * 1024);
20389 + pcm->private_data = chip;
20390 + pcm->info_flags = 0;
20391 + strcpy(pcm->name, "Atmel-AC97");
20400 +static int snd_atmel_ac97_mixer_new(struct atmel_ac97 *chip)
20403 + struct snd_ac97_template template;
20405 + memset(&template, 0, sizeof(template));
20406 + template.private_data = chip;
20407 + err = snd_ac97_mixer(chip->ac97_bus, &template, &chip->ac97);
20412 +static void atmel_ac97_error(struct dma_request *_req)
20414 + struct dma_request_cyclic *req = to_dma_request_cyclic(_req);
20415 + struct atmel_ac97 *chip = req->dev_id;
20417 + dev_dbg(&chip->pdev->dev, "DMA Controller error, channel %d\n",
20418 + req->req.channel);
20421 +static void atmel_ac97_block_complete(struct dma_request *_req)
20423 + struct dma_request_cyclic *req = to_dma_request_cyclic(_req);
20424 + struct atmel_ac97 *chip = req->dev_id;
20425 + if (req->periph_id == chip->dma.tx_periph_id)
20426 + snd_pcm_period_elapsed(chip->playback_substream);
20428 + snd_pcm_period_elapsed(chip->capture_substream);
20434 +static void snd_atmel_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
20435 + unsigned short val)
20437 + struct atmel_ac97 *chip = get_chip(ac97);
20438 + unsigned long word;
20439 + int timeout = 40;
20441 + word = (reg & 0x7f) << 16 | val;
20444 + if (ac97c_readl(chip, COSR) & AC97C_CSR_TXRDY) {
20445 + ac97c_writel(chip, COTHR, word);
20449 + } while (--timeout);
20451 + dev_dbg(&chip->pdev->dev, "codec write timeout\n");
20454 +static unsigned short snd_atmel_ac97_read(struct snd_ac97 *ac97,
20455 + unsigned short reg)
20457 + struct atmel_ac97 *chip = get_chip(ac97);
20458 + unsigned long word;
20459 + int timeout = 40;
20462 + word = (0x80 | (reg & 0x7f)) << 16;
20464 + if ((ac97c_readl(chip, COSR) & AC97C_CSR_RXRDY) != 0)
20465 + ac97c_readl(chip, CORHR);
20471 + if ((ac97c_readl(chip, COSR) & AC97C_CSR_TXRDY) != 0) {
20472 + ac97c_writel(chip, COTHR, word);
20476 + } while (--timeout);
20480 + goto retry_write;
20484 + if ((ac97c_readl(chip, COSR) & AC97C_CSR_RXRDY) != 0) {
20485 + unsigned short val = ac97c_readl(chip, CORHR);
20489 + } while (--timeout);
20493 + goto retry_write;
20496 + dev_dbg(&chip->pdev->dev, "codec read timeout\n");
20500 +static void snd_atmel_ac97_reset(struct atmel_ac97 *chip)
20502 + ac97c_writel(chip, MR, AC97C_MR_WRST);
20504 + ac97c_writel(chip, MR, AC97C_MR_ENA);
20507 +static void snd_atmel_ac97_destroy(struct snd_card *card)
20509 + struct atmel_ac97 *chip = get_chip(card);
20512 + iounmap(chip->regs);
20515 + clk_disable(chip->mck);
20516 + clk_put(chip->mck);
20519 + if (chip->dma.req_tx.req.dmac) {
20520 + dma_release_channel(chip->dma.req_tx.req.dmac,
20521 + chip->dma.req_tx.req.channel);
20523 + if (chip->dma.req_rx.req.dmac) {
20524 + dma_release_channel(chip->dma.req_rx.req.dmac,
20525 + chip->dma.req_rx.req.channel);
20529 +static int __devinit snd_atmel_ac97_create(struct snd_card *card,
20530 + struct platform_device *pdev)
20532 + static struct snd_ac97_bus_ops ops = {
20533 + .write = snd_atmel_ac97_write,
20534 + .read = snd_atmel_ac97_read,
20536 + struct atmel_ac97 *chip = get_chip(card);
20537 + struct resource *regs;
20541 + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
20545 + mck = clk_get(&pdev->dev, "pclk");
20547 + return PTR_ERR(mck);
20551 + card->private_free = snd_atmel_ac97_destroy;
20553 + spin_lock_init(&chip->lock);
20554 + chip->card = card;
20555 + chip->pdev = pdev;
20557 + chip->regs = ioremap(regs->start, regs->end - regs->start + 1);
20561 + snd_card_set_dev(card, &pdev->dev);
20563 + err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus);
20568 +static int __devinit snd_atmel_ac97_probe(struct platform_device *pdev)
20571 + struct snd_card *card;
20572 + struct atmel_ac97 *chip;
20576 + mutex_init(&opened_mutex);
20579 + card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
20580 + THIS_MODULE, sizeof(struct atmel_ac97));
20583 + chip = get_chip(card);
20585 + err = snd_atmel_ac97_create(card, pdev);
20587 + goto out_free_card;
20589 + snd_atmel_ac97_reset(chip);
20591 + err = snd_atmel_ac97_mixer_new(chip);
20593 + goto out_free_card;
20595 + err = snd_atmel_ac97_pcm_new(chip);
20597 + goto out_free_card;
20599 + /* TODO: Get this information from the platform device */
20600 + chip->dma.req_tx.req.dmac = find_dma_controller(0);
20601 + if (!chip->dma.req_tx.req.dmac) {
20602 + dev_dbg(&chip->pdev->dev, "DMA controller for TX missing\n");
20604 + goto out_free_card;
20606 + chip->dma.req_rx.req.dmac = find_dma_controller(0);
20607 + if (!chip->dma.req_rx.req.dmac) {
20608 + dev_dbg(&chip->pdev->dev, "DMA controller for RX missing\n");
20610 + goto out_free_card;
20613 + chip->dma.rx_periph_id = 3;
20614 + chip->dma.tx_periph_id = 4;
20616 + ch = dma_alloc_channel(chip->dma.req_tx.req.dmac);
20618 + dev_dbg(&chip->pdev->dev,
20619 + "could not allocate TX DMA channel\n");
20621 + goto out_free_card;
20623 + chip->dma.req_tx.req.channel = ch;
20624 + chip->dma.req_tx.width = DMA_WIDTH_16BIT;
20625 + chip->dma.req_tx.req.block_complete = atmel_ac97_block_complete;
20626 + chip->dma.req_tx.req.error = atmel_ac97_error;
20628 + ch = dma_alloc_channel(chip->dma.req_rx.req.dmac);
20630 + dev_dbg(&chip->pdev->dev,
20631 + "could not allocate RX DMA channel\n");
20633 + goto out_free_card;
20635 + chip->dma.req_rx.req.channel = ch;
20636 + chip->dma.req_rx.width = DMA_WIDTH_16BIT;
20637 + chip->dma.req_rx.req.block_complete = atmel_ac97_block_complete;
20638 + chip->dma.req_rx.req.error = atmel_ac97_error;
20640 + strcpy(card->driver, "atmel_ac97c");
20641 + strcpy(card->shortname, "atmel_ac97c");
20642 + sprintf(card->longname, "Atmel AVR32 AC97 controller");
20644 + err = snd_card_register(card);
20646 + goto out_free_card;
20648 + platform_set_drvdata(pdev, card);
20651 + dev_info(&pdev->dev, "Atmel AVR32 AC97 controller at 0x%p\n",
20657 + snd_card_free(card);
20664 +snd_atmel_ac97_suspend(struct platform_device *pdev, pm_message_t msg)
20666 + struct snd_card *card = platform_get_drvdata(pdev);
20667 + struct atmel_ac97 *chip = card->private_data;
20669 + clk_disable(chip->mck);
20674 +static int snd_atmel_ac97_resume(struct platform_device *pdev)
20676 + struct snd_card *card = dev_get_drvdata(pdev);
20677 + struct atmel_ac97 *chip = card->private_data;
20679 + clk_enable(chip->mck);
20684 +#define snd_atmel_ac97_suspend NULL
20685 +#define snd_atmel_ac97_resume NULL
20688 +static int __devexit snd_atmel_ac97_remove(struct platform_device *pdev)
20690 + struct snd_card *card = platform_get_drvdata(pdev);
20692 + snd_card_free(card);
20693 + platform_set_drvdata(pdev, NULL);
20697 +static struct platform_driver atmel_ac97_driver = {
20698 + .remove = __devexit_p(snd_atmel_ac97_remove),
20700 + .name = "atmel_ac97c",
20702 + .suspend = snd_atmel_ac97_suspend,
20703 + .resume = snd_atmel_ac97_resume,
20706 +static int __init atmel_ac97_init(void)
20708 + return platform_driver_probe(&atmel_ac97_driver,
20709 + snd_atmel_ac97_probe);
20711 +module_init(atmel_ac97_init);
20713 +static void __exit atmel_ac97_exit(void)
20715 + platform_driver_unregister(&atmel_ac97_driver);
20717 +module_exit(atmel_ac97_exit);
20719 +MODULE_LICENSE("GPL");
20720 +MODULE_DESCRIPTION("Driver for Atmel AC97 Controller");
20721 +MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
20722 diff -urN linux-2.6.24.3/sound/avr32/ac97c.h avr32-2.6/sound/avr32/ac97c.h
20723 --- linux-2.6.24.3/sound/avr32/ac97c.h 1970-01-01 01:00:00.000000000 +0100
20724 +++ avr32-2.6/sound/avr32/ac97c.h 2008-04-23 19:33:54.000000000 +0200
20727 + * Register definitions for the Atmel AC97 Controller.
20729 + * Copyright (C) 2005-2006 Atmel Corporation
20731 + * This program is free software; you can redistribute it and/or modify
20732 + * it under the terms of the GNU General Public License version 2 as
20733 + * published by the Free Software Foundation.
20735 +#ifndef __SOUND_AVR32_AC97C_H
20736 +#define __SOUND_AVR32_AC97C_H
20738 +#define AC97C_MR 0x08
20739 +#define AC97C_ICA 0x10
20740 +#define AC97C_OCA 0x14
20741 +#define AC97C_CARHR 0x20
20742 +#define AC97C_CATHR 0x24
20743 +#define AC97C_CASR 0x28
20744 +#define AC97C_CAMR 0x2c
20745 +#define AC97C_CBRHR 0x30
20746 +#define AC97C_CBTHR 0x34
20747 +#define AC97C_CBSR 0x38
20748 +#define AC97C_CBMR 0x3c
20749 +#define AC97C_CORHR 0x40
20750 +#define AC97C_COTHR 0x44
20751 +#define AC97C_COSR 0x48
20752 +#define AC97C_COMR 0x4c
20753 +#define AC97C_SR 0x50
20754 +#define AC97C_IER 0x54
20755 +#define AC97C_IDR 0x58
20756 +#define AC97C_IMR 0x5c
20757 +#define AC97C_VERSION 0xfc
20759 +#define AC97C_CATPR PDC_TPR
20760 +#define AC97C_CATCR PDC_TCR
20761 +#define AC97C_CATNPR PDC_TNPR
20762 +#define AC97C_CATNCR PDC_TNCR
20763 +#define AC97C_CARPR PDC_RPR
20764 +#define AC97C_CARCR PDC_RCR
20765 +#define AC97C_CARNPR PDC_RNPR
20766 +#define AC97C_CARNCR PDC_RNCR
20767 +#define AC97C_PTCR PDC_PTCR
20769 +#define AC97C_MR_ENA (1 << 0)
20770 +#define AC97C_MR_WRST (1 << 1)
20771 +#define AC97C_MR_VRA (1 << 2)
20773 +#define AC97C_CSR_TXRDY (1 << 0)
20774 +#define AC97C_CSR_UNRUN (1 << 2)
20775 +#define AC97C_CSR_RXRDY (1 << 4)
20776 +#define AC97C_CSR_ENDTX (1 << 10)
20777 +#define AC97C_CSR_ENDRX (1 << 14)
20779 +#define AC97C_CMR_SIZE_20 (0 << 16)
20780 +#define AC97C_CMR_SIZE_18 (1 << 16)
20781 +#define AC97C_CMR_SIZE_16 (2 << 16)
20782 +#define AC97C_CMR_SIZE_10 (3 << 16)
20783 +#define AC97C_CMR_CEM_LITTLE (1 << 18)
20784 +#define AC97C_CMR_CEM_BIG (0 << 18)
20785 +#define AC97C_CMR_CENA (1 << 21)
20786 +#define AC97C_CMR_PDCEN (1 << 22)
20788 +#define AC97C_SR_CAEVT (1 << 3)
20790 +#define AC97C_CH_ASSIGN(slot, channel) \
20791 + (AC97C_CHANNEL_##channel << (3 * (AC97_SLOT_##slot - 3)))
20792 +#define AC97C_CHANNEL_NONE 0x0
20793 +#define AC97C_CHANNEL_A 0x1
20794 +#define AC97C_CHANNEL_B 0x2
20796 +#endif /* __SOUND_AVR32_AC97C_H */
20797 diff -urN linux-2.6.24.3/sound/avr32/Kconfig avr32-2.6/sound/avr32/Kconfig
20798 --- linux-2.6.24.3/sound/avr32/Kconfig 1970-01-01 01:00:00.000000000 +0100
20799 +++ avr32-2.6/sound/avr32/Kconfig 2008-04-23 19:33:54.000000000 +0200
20801 +menu "AVR32 devices"
20802 + depends on SND != n && AVR32
20804 +config SND_ATMEL_AC97
20805 + tristate "Atmel AC97 Controller Driver"
20807 + select SND_AC97_CODEC
20809 + ALSA sound driver for the Atmel AC97 controller.
20812 diff -urN linux-2.6.24.3/sound/avr32/Makefile avr32-2.6/sound/avr32/Makefile
20813 --- linux-2.6.24.3/sound/avr32/Makefile 1970-01-01 01:00:00.000000000 +0100
20814 +++ avr32-2.6/sound/avr32/Makefile 2008-04-23 19:33:54.000000000 +0200
20816 +snd-atmel-ac97-objs := ac97c.o
20818 +obj-$(CONFIG_SND_ATMEL_AC97) += snd-atmel-ac97.o
20819 diff -urN linux-2.6.24.3/sound/Kconfig avr32-2.6/sound/Kconfig
20820 --- linux-2.6.24.3/sound/Kconfig 2008-02-26 01:20:20.000000000 +0100
20821 +++ avr32-2.6/sound/Kconfig 2008-04-23 19:33:54.000000000 +0200
20824 source "sound/arm/Kconfig"
20826 +source "sound/avr32/Kconfig"
20829 source "sound/spi/Kconfig"
20831 diff -urN linux-2.6.24.3/sound/Makefile avr32-2.6/sound/Makefile
20832 --- linux-2.6.24.3/sound/Makefile 2008-02-26 01:20:20.000000000 +0100
20833 +++ avr32-2.6/sound/Makefile 2008-04-23 19:33:54.000000000 +0200
20835 obj-$(CONFIG_SOUND_PRIME) += oss/
20836 obj-$(CONFIG_DMASOUND) += oss/
20837 obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
20838 - sparc/ spi/ parisc/ pcmcia/ mips/ soc/
20839 + sparc/ spi/ parisc/ pcmcia/ mips/ soc/ avr32/
20840 obj-$(CONFIG_SND_AOA) += aoa/
20842 # This one must be compilable even if sound is configured out
20843 diff -urN linux-2.6.24.3/sound/oss/at32_abdac.c avr32-2.6/sound/oss/at32_abdac.c
20844 --- linux-2.6.24.3/sound/oss/at32_abdac.c 1970-01-01 01:00:00.000000000 +0100
20845 +++ avr32-2.6/sound/oss/at32_abdac.c 2008-04-23 19:33:54.000000000 +0200
20848 + * OSS Sound Driver for the Atmel AT32 on-chip DAC.
20850 + * Copyright (C) 2006 Atmel Corporation
20852 + * This program is free software; you can redistribute it and/or modify
20853 + * it under the terms of the GNU General Public License version 2 as
20854 + * published by the Free Software Foundation.
20856 +#include <linux/clk.h>
20857 +#include <linux/dma-mapping.h>
20858 +#include <linux/fs.h>
20859 +#include <linux/init.h>
20860 +#include <linux/interrupt.h>
20861 +#include <linux/kernel.h>
20862 +#include <linux/module.h>
20863 +#include <linux/platform_device.h>
20864 +#include <linux/sound.h>
20865 +#include <linux/soundcard.h>
20867 +#include <asm/byteorder.h>
20868 +#include <asm/dma-controller.h>
20869 +#include <asm/io.h>
20870 +#include <asm/uaccess.h>
20872 +/* We want to use the "bizarre" swap-bytes-in-each-halfword macro */
20873 +#include <linux/byteorder/swabb.h>
20875 +#include "at32_abdac.h"
20877 +#define DMA_BUFFER_SIZE 32768
20878 +#define DMA_PERIOD_SHIFT 10
20879 +#define DMA_PERIOD_SIZE (1 << DMA_PERIOD_SHIFT)
20880 +#define DMA_WRITE_THRESHOLD DMA_PERIOD_SIZE
20882 +struct sound_settings {
20883 + unsigned int format;
20884 + unsigned int channels;
20885 + unsigned int sample_rate;
20886 + /* log2(bytes per sample) */
20887 + unsigned int input_order;
20892 + void __iomem *regs;
20894 + /* head and tail refer to number of words */
20901 + struct semaphore sem;
20902 + wait_queue_head_t write_wait;
20905 + * Read at most ucount bytes from ubuf, translate to 2-channel
20906 + * signed 16-bit big endian format and write to the DMA buffer
20907 + * as long as there is room left. Return the number of bytes
20908 + * successfully copied from ubuf, or -EFAULT if the first
20909 + * sample from ubuf couldn't be read. This function is not
20910 + * called unless there is room for at least one sample (4
20911 + * bytes) in the DMA buffer.
20913 + ssize_t (*trans)(struct at32_dac *dac, const char __user *ubuf,
20916 + struct sound_settings dsp_settings;
20917 + struct dma_request_cyclic req;
20920 + struct clk *sample_clk;
20921 + struct platform_device *pdev;
20926 +static struct at32_dac *the_dac;
20928 +static inline unsigned int abdac_get_head(struct at32_dac *dac)
20930 + return dac->dma.head & ((DMA_BUFFER_SIZE / 4) - 1);
20933 +static inline unsigned int abdac_get_tail(struct at32_dac *dac)
20935 + return dac->dma.tail & ((DMA_BUFFER_SIZE / 4) - 1);
20938 +static inline unsigned int abdac_dma_space(struct at32_dac *dac)
20940 + unsigned int space;
20942 + space = ((dac->dma.tail - dac->dma.head - 1)
20943 + & ((DMA_BUFFER_SIZE / 4) - 1));
20947 +static void abdac_update_dma_tail(struct at32_dac *dac)
20949 + dma_addr_t dma_addr;
20950 + unsigned int new_tail;
20952 + if (dac->playing) {
20953 + dma_addr = dma_get_current_pos(dac->req.req.dmac,
20954 + dac->req.req.channel);
20955 + new_tail = (dma_addr - dac->req.buffer_start) / 4;
20956 + if (new_tail >= dac->dma.head
20957 + && (dac->dma.tail < dac->dma.head
20958 + || dac->dma.tail > new_tail))
20959 + dev_notice(&dac->pdev->dev, "DMA underrun detected!\n");
20960 + dac->dma.tail = new_tail;
20961 + dev_dbg(&dac->pdev->dev, "update tail: 0x%x - 0x%x = %u\n",
20962 + dma_addr, dac->req.buffer_start, dac->dma.tail);
20966 +static int abdac_start(struct at32_dac *dac)
20970 + if (dac->playing)
20973 + memset(dac->dma.buf, 0, DMA_BUFFER_SIZE);
20975 + clk_enable(dac->sample_clk);
20977 + ret = dma_prepare_request_cyclic(dac->req.req.dmac, &dac->req);
20979 + goto out_stop_clock;
20981 + dev_dbg(&dac->pdev->dev, "starting DMA...\n");
20982 + ret = dma_start_request(dac->req.req.dmac, dac->req.req.channel);
20984 + goto out_stop_request;
20986 + dac_writel(dac, CTRL, DAC_BIT(EN));
20987 + dac->playing = 1;
20992 + dma_stop_request(dac->req.req.dmac,
20993 + dac->req.req.channel);
20995 + clk_disable(dac->sample_clk);
20999 +static int abdac_stop(struct at32_dac *dac)
21001 + if (dac->playing) {
21002 + dma_stop_request(dac->req.req.dmac, dac->req.req.channel);
21003 + dac_writel(dac, DATA, 0);
21004 + dac_writel(dac, CTRL, 0);
21005 + dac->playing = 0;
21006 + clk_disable(dac->sample_clk);
21012 +static int abdac_dma_prepare(struct at32_dac *dac)
21014 + dac->dma.buf = dma_alloc_coherent(&dac->pdev->dev, DMA_BUFFER_SIZE,
21015 + &dac->req.buffer_start, GFP_KERNEL);
21016 + if (!dac->dma.buf)
21019 + dac->dma.head = dac->dma.tail = 0;
21020 + dac->req.periods = DMA_BUFFER_SIZE / DMA_PERIOD_SIZE;
21021 + dac->req.buffer_size = DMA_BUFFER_SIZE;
21026 +static void abdac_dma_cleanup(struct at32_dac *dac)
21028 + if (dac->dma.buf)
21029 + dma_free_coherent(&dac->pdev->dev, DMA_BUFFER_SIZE,
21030 + dac->dma.buf, dac->req.buffer_start);
21031 + dac->dma.buf = NULL;
21034 +static void abdac_dma_block_complete(struct dma_request *req)
21036 + struct dma_request_cyclic *creq = to_dma_request_cyclic(req);
21037 + struct at32_dac *dac = container_of(creq, struct at32_dac, req);
21039 + wake_up(&dac->write_wait);
21042 +static void abdac_dma_error(struct dma_request *req)
21044 + struct dma_request_cyclic *creq = to_dma_request_cyclic(req);
21045 + struct at32_dac *dac = container_of(creq, struct at32_dac, req);
21047 + dev_err(&dac->pdev->dev, "DMA error\n");
21050 +static irqreturn_t abdac_interrupt(int irq, void *dev_id)
21052 + struct at32_dac *dac = dev_id;
21055 + status = dac_readl(dac, INT_STATUS);
21056 + if (status & DAC_BIT(UNDERRUN)) {
21057 + dev_err(&dac->pdev->dev, "Underrun detected!\n");
21058 + dac_writel(dac, INT_CLR, DAC_BIT(UNDERRUN));
21060 + dev_err(&dac->pdev->dev, "Spurious interrupt (status=0x%x)\n",
21062 + dac_writel(dac, INT_CLR, status);
21065 + return IRQ_HANDLED;
21068 +static ssize_t trans_s16be(struct at32_dac *dac, const char __user *ubuf,
21073 + if (dac->dsp_settings.channels == 2) {
21074 + const u32 __user *up = (const u32 __user *)ubuf;
21077 + for (ret = 0; ret < (ssize_t)(ucount - 3); ret += 4) {
21078 + if (!abdac_dma_space(dac))
21081 + if (unlikely(__get_user(sample, up++))) {
21086 + dac->dma.buf[abdac_get_head(dac)] = sample;
21090 + const u16 __user *up = (const u16 __user *)ubuf;
21093 + for (ret = 0; ret < (ssize_t)(ucount - 1); ret += 2) {
21094 + if (!abdac_dma_space(dac))
21097 + if (unlikely(__get_user(sample, up++))) {
21102 + dac->dma.buf[abdac_get_head(dac)]
21103 + = (sample << 16) | sample;
21111 +static ssize_t trans_s16le(struct at32_dac *dac, const char __user *ubuf,
21116 + if (dac->dsp_settings.channels == 2) {
21117 + const u32 __user *up = (const u32 __user *)ubuf;
21120 + for (ret = 0; ret < (ssize_t)(ucount - 3); ret += 4) {
21121 + if (!abdac_dma_space(dac))
21124 + if (unlikely(__get_user(sample, up++))) {
21129 + /* Swap bytes in each halfword */
21130 + dac->dma.buf[abdac_get_head(dac)] = swahb32(sample);
21134 + const u16 __user *up = (const u16 __user *)ubuf;
21137 + for (ret = 0; ret < (ssize_t)(ucount - 1); ret += 2) {
21138 + if (!abdac_dma_space(dac))
21141 + if (unlikely(__get_user(sample, up++))) {
21146 + sample = swab16(sample);
21147 + dac->dma.buf[abdac_get_head(dac)]
21148 + = (sample << 16) | sample;
21156 +static ssize_t abdac_dma_translate_from_user(struct at32_dac *dac,
21157 + const char __user *buffer,
21160 + /* At least one buffer must be available at this point */
21161 + dev_dbg(&dac->pdev->dev, "copying %zu bytes from user...\n", count);
21163 + return dac->trans(dac, buffer, count);
21166 +static int abdac_set_format(struct at32_dac *dac, int format)
21168 + unsigned int order;
21170 + switch (format) {
21171 + case AFMT_S16_BE:
21173 + dac->trans = trans_s16be;
21175 + case AFMT_S16_LE:
21177 + dac->trans = trans_s16le;
21180 + dev_dbg(&dac->pdev->dev, "unsupported format: %d\n", format);
21184 + if (dac->dsp_settings.channels == 2)
21187 + dac->dsp_settings.input_order = order;
21188 + dac->dsp_settings.format = format;
21192 +static int abdac_set_sample_rate(struct at32_dac *dac, unsigned long rate)
21194 + unsigned long new_rate;
21197 + ret = clk_set_rate(dac->sample_clk, 256 * rate);
21201 + /* TODO: mplayer seems to have a problem with this */
21203 + new_rate = clk_get_rate(dac->sample_clk);
21204 + dac->dsp_settings.sample_rate = new_rate / 256;
21206 + dac->dsp_settings.sample_rate = rate;
21212 +static ssize_t abdac_dsp_write(struct file *file,
21213 + const char __user *buffer,
21214 + size_t count, loff_t *ppos)
21216 + struct at32_dac *dac = file->private_data;
21217 + DECLARE_WAITQUEUE(wait, current);
21218 + unsigned int avail;
21222 + /* Avoid address space checking in the translation functions */
21223 + if (!access_ok(buffer, count, VERIFY_READ))
21228 + if (!dac->dma.buf) {
21229 + ret = abdac_dma_prepare(dac);
21234 + add_wait_queue(&dac->write_wait, &wait);
21236 + while (count > 0) {
21238 + abdac_update_dma_tail(dac);
21239 + avail = abdac_dma_space(dac);
21240 + set_current_state(TASK_INTERRUPTIBLE);
21241 + if (avail >= DMA_WRITE_THRESHOLD)
21244 + if (file->f_flags & O_NONBLOCK) {
21250 + pr_debug("Going to wait (avail = %u, count = %zu)\n",
21255 + if (signal_pending(current)) {
21257 + ret = -ERESTARTSYS;
21263 + copied = abdac_dma_translate_from_user(dac, buffer, count);
21264 + if (copied < 0) {
21270 + abdac_start(dac);
21279 + remove_wait_queue(&dac->write_wait, &wait);
21280 + set_current_state(TASK_RUNNING);
21284 +static int abdac_dsp_ioctl(struct inode *inode, struct file *file,
21285 + unsigned int cmd, unsigned long arg)
21287 + struct at32_dac *dac = file->private_data;
21288 + int __user *up = (int __user *)arg;
21289 + struct audio_buf_info abinfo;
21293 + case OSS_GETVERSION:
21294 + return put_user(SOUND_VERSION, up);
21296 + case SNDCTL_DSP_SPEED:
21297 + if (get_user(val, up))
21301 + ret = abdac_set_sample_rate(dac, val);
21305 + return put_user(dac->dsp_settings.sample_rate, up);
21307 + case SNDCTL_DSP_STEREO:
21308 + if (get_user(val, up))
21311 + if (val && dac->dsp_settings.channels == 1)
21312 + dac->dsp_settings.input_order++;
21313 + else if (!val && dac->dsp_settings.channels != 1)
21314 + dac->dsp_settings.input_order--;
21315 + dac->dsp_settings.channels = val ? 2 : 1;
21318 + case SNDCTL_DSP_CHANNELS:
21319 + if (get_user(val, up))
21323 + if (val < 0 || val > 2)
21327 + dac->dsp_settings.input_order
21328 + += val - dac->dsp_settings.channels;
21329 + dac->dsp_settings.channels = val;
21331 + return put_user(val, (int *)arg);
21333 + case SNDCTL_DSP_GETFMTS:
21334 + return put_user(AFMT_S16_BE | AFMT_S16_BE, up);
21336 + case SNDCTL_DSP_SETFMT:
21337 + if (get_user(val, up))
21340 + if (val == AFMT_QUERY) {
21341 + val = dac->dsp_settings.format;
21343 + ret = abdac_set_format(dac, val);
21347 + return put_user(val, up);
21349 + case SNDCTL_DSP_GETOSPACE:
21350 + abdac_update_dma_tail(dac);
21351 + abinfo.fragsize = ((1 << dac->dsp_settings.input_order)
21352 + * (DMA_PERIOD_SIZE / 4));
21353 + abinfo.bytes = (abdac_dma_space(dac)
21354 + << dac->dsp_settings.input_order);
21355 + abinfo.fragstotal = ((DMA_BUFFER_SIZE * 4)
21356 + >> (DMA_PERIOD_SHIFT
21357 + + dac->dsp_settings.input_order));
21358 + abinfo.fragments = ((abinfo.bytes
21359 + >> dac->dsp_settings.input_order)
21360 + / (DMA_PERIOD_SIZE / 4));
21361 + pr_debug("fragments=%d fragstotal=%d fragsize=%d bytes=%d\n",
21362 + abinfo.fragments, abinfo.fragstotal, abinfo.fragsize,
21364 + return copy_to_user(up, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
21367 + dev_dbg(&dac->pdev->dev, "Unimplemented ioctl cmd: 0x%x\n", cmd);
21372 +static int abdac_dsp_open(struct inode *inode, struct file *file)
21374 + struct at32_dac *dac = the_dac;
21377 + if (file->f_mode & FMODE_READ)
21385 + dac->dma.head = dac->dma.tail = 0;
21387 + /* FIXME: What are the correct defaults? */
21388 + dac->dsp_settings.channels = 2;
21389 + abdac_set_format(dac, AFMT_S16_BE);
21390 + ret = abdac_set_sample_rate(dac, 8000);
21394 + file->private_data = dac;
21404 +static int abdac_dsp_release(struct inode *inode, struct file *file)
21406 + struct at32_dac *dac = file->private_data;
21411 + abdac_dma_cleanup(dac);
21419 +static struct file_operations abdac_dsp_fops = {
21420 + .owner = THIS_MODULE,
21421 + .llseek = no_llseek,
21422 + .write = abdac_dsp_write,
21423 + .ioctl = abdac_dsp_ioctl,
21424 + .open = abdac_dsp_open,
21425 + .release = abdac_dsp_release,
21428 +static int __init abdac_probe(struct platform_device *pdev)
21430 + struct at32_dac *dac;
21431 + struct resource *regs;
21433 + struct clk *sample_clk;
21440 + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
21443 + irq = platform_get_irq(pdev, 0);
21447 + mck = clk_get(&pdev->dev, "pclk");
21449 + return PTR_ERR(mck);
21450 + sample_clk = clk_get(&pdev->dev, "sample_clk");
21451 + if (IS_ERR(sample_clk)) {
21452 + ret = PTR_ERR(sample_clk);
21453 + goto out_put_mck;
21458 + dac = kzalloc(sizeof(struct at32_dac), GFP_KERNEL);
21460 + goto out_disable_clk;
21462 + spin_lock_init(&dac->lock);
21463 + init_MUTEX(&dac->sem);
21464 + init_waitqueue_head(&dac->write_wait);
21465 + dac->pdev = pdev;
21467 + dac->sample_clk = sample_clk;
21469 + dac->regs = ioremap(regs->start, regs->end - regs->start + 1);
21471 + goto out_free_dac;
21473 + ret = request_irq(irq, abdac_interrupt, 0, "dac", dac);
21475 + goto out_unmap_regs;
21478 + dac->req.req.dmac = find_dma_controller(0);
21479 + if (!dac->req.req.dmac)
21480 + goto out_free_irq;
21482 + ret = dma_alloc_channel(dac->req.req.dmac);
21484 + goto out_free_irq;
21486 + dac->req.req.channel = ret;
21487 + dac->req.req.block_complete = abdac_dma_block_complete;
21488 + dac->req.req.error = abdac_dma_error;
21489 + dac->req.data_reg = regs->start + DAC_DATA;
21490 + dac->req.periph_id = 2; /* FIXME */
21491 + dac->req.direction = DMA_DIR_MEM_TO_PERIPH;
21492 + dac->req.width = DMA_WIDTH_32BIT;
21494 + /* Make sure the DAC is silent and disabled */
21495 + dac_writel(dac, DATA, 0);
21496 + dac_writel(dac, CTRL, 0);
21498 + ret = register_sound_dsp(&abdac_dsp_fops, -1);
21500 + goto out_free_dma;
21501 + dac->dev_dsp = ret;
21503 + /* TODO: Register mixer */
21506 + platform_set_drvdata(pdev, dac);
21511 + dma_release_channel(dac->req.req.dmac, dac->req.req.channel);
21513 + free_irq(irq, dac);
21515 + iounmap(dac->regs);
21519 + clk_disable(mck);
21520 + clk_put(sample_clk);
21526 +static int __exit abdac_remove(struct platform_device *pdev)
21528 + struct at32_dac *dac;
21530 + dac = platform_get_drvdata(pdev);
21532 + unregister_sound_dsp(dac->dev_dsp);
21533 + dma_release_channel(dac->req.req.dmac, dac->req.req.channel);
21534 + free_irq(platform_get_irq(pdev, 0), dac);
21535 + iounmap(dac->regs);
21536 + clk_disable(dac->mck);
21537 + clk_put(dac->sample_clk);
21538 + clk_put(dac->mck);
21540 + platform_set_drvdata(pdev, NULL);
21547 +static struct platform_driver abdac_driver = {
21548 + .remove = __exit_p(abdac_remove),
21554 +static int __init abdac_init(void)
21556 + return platform_driver_probe(&abdac_driver, abdac_probe);
21558 +module_init(abdac_init);
21560 +static void __exit abdac_exit(void)
21562 + platform_driver_unregister(&abdac_driver);
21564 +module_exit(abdac_exit);
21566 +MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
21567 +MODULE_DESCRIPTION("Sound Driver for the Atmel AT32 ABDAC");
21568 +MODULE_LICENSE("GPL");
21569 diff -urN linux-2.6.24.3/sound/oss/at32_abdac.h avr32-2.6/sound/oss/at32_abdac.h
21570 --- linux-2.6.24.3/sound/oss/at32_abdac.h 1970-01-01 01:00:00.000000000 +0100
21571 +++ avr32-2.6/sound/oss/at32_abdac.h 2008-04-23 19:33:54.000000000 +0200
21574 + * Register definitions for the Atmel AT32 on-chip DAC.
21576 + * Copyright (C) 2006 Atmel Corporation
21578 + * This program is free software; you can redistribute it and/or modify
21579 + * it under the terms of the GNU General Public License version 2 as
21580 + * published by the Free Software Foundation.
21582 +#ifndef __SOUND_OSS_AT32_ABDAC_H__
21583 +#define __SOUND_OSS_AT32_ABDAC_H__
21585 +/* DAC register offsets */
21586 +#define DAC_DATA 0x0000
21587 +#define DAC_CTRL 0x0008
21588 +#define DAC_INT_MASK 0x000c
21589 +#define DAC_INT_EN 0x0010
21590 +#define DAC_INT_DIS 0x0014
21591 +#define DAC_INT_CLR 0x0018
21592 +#define DAC_INT_STATUS 0x001c
21593 +#define DAC_PDC_DATA 0x0020
21595 +/* Bitfields in CTRL */
21596 +#define DAC_SWAP_OFFSET 30
21597 +#define DAC_SWAP_SIZE 1
21598 +#define DAC_EN_OFFSET 31
21599 +#define DAC_EN_SIZE 1
21601 +/* Bitfields in INT_MASK/INT_EN/INT_DIS/INT_STATUS/INT_CLR */
21602 +#define DAC_UNDERRUN_OFFSET 28
21603 +#define DAC_UNDERRUN_SIZE 1
21604 +#define DAC_TX_READY_OFFSET 29
21605 +#define DAC_TX_READY_SIZE 1
21606 +#define DAC_TX_BUFFER_EMPTY_OFFSET 30
21607 +#define DAC_TX_BUFFER_EMPTY_SIZE 1
21608 +#define DAC_CHANNEL_TX_END_OFFSET 31
21609 +#define DAC_CHANNEL_TX_END_SIZE 1
21611 +/* Bit manipulation macros */
21612 +#define DAC_BIT(name) \
21613 + (1 << DAC_##name##_OFFSET)
21614 +#define DAC_BF(name, value) \
21615 + (((value) & ((1 << DAC_##name##_SIZE) - 1)) \
21616 + << DAC_##name##_OFFSET)
21617 +#define DAC_BFEXT(name, value) \
21618 + (((value) >> DAC_##name##_OFFSET) \
21619 + & ((1 << DAC_##name##_SIZE) - 1))
21620 +#define DAC_BFINS(name, value, old) \
21621 + (((old) & ~(((1 << DAC_##name##_SIZE) - 1) \
21622 + << DAC_##name##_OFFSET)) \
21623 + | DAC_BF(name,value))
21625 +/* Register access macros */
21626 +#define dac_readl(port, reg) \
21627 + __raw_readl((port)->regs + DAC_##reg)
21628 +#define dac_writel(port, reg, value) \
21629 + __raw_writel((value), (port)->regs + DAC_##reg)
21631 +#endif /* __SOUND_OSS_AT32_ABDAC_H__ */
21632 diff -urN linux-2.6.24.3/sound/oss/Kconfig avr32-2.6/sound/oss/Kconfig
21633 --- linux-2.6.24.3/sound/oss/Kconfig 2008-02-26 01:20:20.000000000 +0100
21634 +++ avr32-2.6/sound/oss/Kconfig 2008-04-23 19:33:54.000000000 +0200
21635 @@ -654,3 +654,7 @@
21638 depends on SOUND_SH_DAC_AUDIO
21640 +config SOUND_AT32_ABDAC
21641 + tristate "Atmel AT32 Audio Bitstream DAC (ABDAC) support"
21642 + depends on SOUND_PRIME && AVR32
21643 diff -urN linux-2.6.24.3/sound/oss/Makefile avr32-2.6/sound/oss/Makefile
21644 --- linux-2.6.24.3/sound/oss/Makefile 2008-02-26 01:20:20.000000000 +0100
21645 +++ avr32-2.6/sound/oss/Makefile 2008-04-23 20:12:49.000000000 +0200
21648 # Please leave it as is, cause the link order is significant !
21650 +obj-$(CONFIG_SOUND_AT32_ABDAC) += at32_abdac.o
21651 obj-$(CONFIG_SOUND_SH_DAC_AUDIO) += sh_dac_audio.o
21652 obj-$(CONFIG_SOUND_HAL2) += hal2.o
21653 obj-$(CONFIG_SOUND_AEDSP16) += aedsp16.o
21654 diff -urN linux-2.6.24.3/sound/spi/at73c213.c avr32-2.6/sound/spi/at73c213.c
21655 --- linux-2.6.24.3/sound/spi/at73c213.c 2008-02-26 01:20:20.000000000 +0100
21656 +++ avr32-2.6/sound/spi/at73c213.c 2008-04-23 20:12:51.000000000 +0200
21657 @@ -744,7 +744,7 @@
21661 -static int snd_at73c213_ssc_init(struct snd_at73c213 *chip)
21662 +static int __devinit snd_at73c213_ssc_init(struct snd_at73c213 *chip)
21665 * Continuous clock output.
21666 @@ -774,7 +774,7 @@
21670 -static int snd_at73c213_chip_init(struct snd_at73c213 *chip)
21671 +static int __devinit snd_at73c213_chip_init(struct snd_at73c213 *chip)
21674 unsigned char dac_ctrl = 0;
21675 @@ -939,7 +939,7 @@
21679 -static int snd_at73c213_probe(struct spi_device *spi)
21680 +static int __devinit snd_at73c213_probe(struct spi_device *spi)
21682 struct snd_card *card;
21683 struct snd_at73c213 *chip;