diff -Nrup linux-2.6.24/arch/arm/mach-at91/at91sam9261_devices.c linux-avr32/arch/arm/mach-at91/at91sam9261_devices.c --- linux-2.6.24/arch/arm/mach-at91/at91sam9261_devices.c 2008-01-24 17:58:37.000000000 -0500 +++ linux-avr32/arch/arm/mach-at91/at91sam9261_devices.c 2008-02-01 14:51:35.000000000 -0500 @@ -530,6 +530,20 @@ void __init at91_add_device_lcdc(struct at91_set_B_periph(AT91_PIN_PB27, 0); /* LCDD22 */ at91_set_B_periph(AT91_PIN_PB28, 0); /* LCDD23 */ +#ifdef CONFIG_FB_INTSRAM + { + void __iomem *fb; + struct resource *fb_res = &lcdc_resources[2]; + size_t fb_len = fb_res->end - fb_res->start + 1; + + fb = ioremap_writecombine(fb_res->start, fb_len); + if (fb) { + memset(fb, 0, fb_len); + iounmap(fb, fb_len); + } + } +#endif + lcdc_data = *data; platform_device_register(&at91_lcdc_device); } diff -Nrup linux-2.6.24/arch/arm/mach-at91/at91sam9rl_devices.c linux-avr32/arch/arm/mach-at91/at91sam9rl_devices.c --- linux-2.6.24/arch/arm/mach-at91/at91sam9rl_devices.c 2008-01-24 17:58:37.000000000 -0500 +++ linux-avr32/arch/arm/mach-at91/at91sam9rl_devices.c 2008-02-01 14:51:35.000000000 -0500 @@ -375,6 +375,20 @@ void __init at91_add_device_lcdc(struct at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */ at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */ +#ifdef CONFIG_FB_INTSRAM + { + void __iomem *fb; + struct resource *fb_res = &lcdc_resources[2]; + size_t fb_len = fb_res->end - fb_res->start + 1; + + fb = ioremap_writecombine(fb_res->start, fb_len); + if (fb) { + memset(fb, 0, fb_len); + iounmap(fb, fb_len); + } + } +#endif + lcdc_data = *data; platform_device_register(&at91_lcdc_device); } diff -Nrup linux-2.6.24/arch/avr32/boards/atngw100/Kconfig linux-avr32/arch/avr32/boards/atngw100/Kconfig --- linux-2.6.24/arch/avr32/boards/atngw100/Kconfig 1969-12-31 19:00:00.000000000 -0500 +++ linux-avr32/arch/avr32/boards/atngw100/Kconfig 2008-02-01 14:51:35.000000000 -0500 @@ -0,0 +1,12 @@ +# NGW100 customization + +config BOARD_ATNGW100_I2C_GPIO + bool "Use GPIO for i2c instead of built-in TWI module" + help + The driver for the built-in TWI module has been plagued by + various problems, while the i2c-gpio driver is based on the + trusty old i2c-algo-bit bitbanging engine, making it work + on pretty much any setup. + + Choose 'Y' here if you're having i2c-related problems and + want to rule out the i2c bus driver. diff -Nrup linux-2.6.24/arch/avr32/boards/atngw100/setup.c linux-avr32/arch/avr32/boards/atngw100/setup.c --- linux-2.6.24/arch/avr32/boards/atngw100/setup.c 2008-01-24 17:58:37.000000000 -0500 +++ linux-avr32/arch/avr32/boards/atngw100/setup.c 2008-02-01 14:51:35.000000000 -0500 @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include @@ -42,6 +42,11 @@ static struct spi_board_info spi0_board_ }, }; +static struct mci_platform_data __initdata mci0_data = { + .detect_pin = GPIO_PIN_PC(25), + .wp_pin = GPIO_PIN_PE(0), +}; + /* * The next two functions should go away as the boot loader is * supposed to initialize the macb address registers with a valid @@ -124,6 +129,7 @@ static struct platform_device ngw_gpio_l } }; +#ifdef CONFIG_BOARD_ATNGW100_I2C_GPIO static struct i2c_gpio_platform_data i2c_gpio_data = { .sda_pin = GPIO_PIN_PA(6), .scl_pin = GPIO_PIN_PA(7), @@ -139,6 +145,7 @@ static struct platform_device i2c_gpio_d .platform_data = &i2c_gpio_data, }, }; +#endif static int __init atngw100_init(void) { @@ -157,6 +164,7 @@ static int __init atngw100_init(void) set_hw_addr(at32_add_device_eth(1, ð_data[1])); at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); + at32_add_device_mci(0, &mci0_data); at32_add_device_usba(0, NULL); for (i = 0; i < ARRAY_SIZE(ngw_leds); i++) { @@ -165,11 +173,15 @@ static int __init atngw100_init(void) } platform_device_register(&ngw_gpio_leds); +#ifdef CONFIG_BOARD_ATNGW100_I2C_GPIO at32_select_gpio(i2c_gpio_data.sda_pin, AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); at32_select_gpio(i2c_gpio_data.scl_pin, AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); platform_device_register(&i2c_gpio_device); +#else + at32_add_device_twi(0); +#endif return 0; } diff -Nrup linux-2.6.24/arch/avr32/boards/atstk1000/atstk1000.h linux-avr32/arch/avr32/boards/atstk1000/atstk1000.h --- linux-2.6.24/arch/avr32/boards/atstk1000/atstk1000.h 2008-01-24 17:58:37.000000000 -0500 +++ linux-avr32/arch/avr32/boards/atstk1000/atstk1000.h 2008-02-01 14:51:35.000000000 -0500 @@ -12,4 +12,6 @@ extern struct atmel_lcdfb_info atstk1000_lcdc_data; +void atstk1000_setup_j2_leds(void); + #endif /* __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H */ diff -Nrup linux-2.6.24/arch/avr32/boards/atstk1000/atstk1002.c linux-avr32/arch/avr32/boards/atstk1000/atstk1002.c --- linux-2.6.24/arch/avr32/boards/atstk1000/atstk1002.c 2008-01-24 17:58:37.000000000 -0500 +++ linux-avr32/arch/avr32/boards/atstk1000/atstk1002.c 2008-02-01 14:51:35.000000000 -0500 @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -22,7 +21,7 @@ #include #include -#include +#include #include #include #include @@ -49,18 +48,16 @@ static struct eth_platform_data __initda }, }; -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC static struct at73c213_board_info at73c213_data = { .ssc_id = 0, .shortname = "AVR32 STK1000 external DAC", }; #endif -#endif -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM static struct spi_board_info spi0_board_info[] __initdata = { -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC { /* AT73C213 */ .modalias = "at73c213", @@ -80,12 +77,25 @@ static struct spi_board_info spi0_board_ }; #endif -#ifdef CONFIG_BOARD_ATSTK1002_SPI1 +#ifdef CONFIG_BOARD_ATSTK100X_SPI1 static struct spi_board_info spi1_board_info[] __initdata = { { /* patch in custom entries here */ } }; #endif +static struct cf_platform_data __initdata cf0_data = { +#ifdef CONFIG_BOARD_ATSTK1000_CF_HACKS + .detect_pin = CONFIG_BOARD_ATSTK1000_CF_DETECT_PIN, + .reset_pin = CONFIG_BOARD_ATSTK1000_CF_RESET_PIN, +#else + .detect_pin = GPIO_PIN_NONE, + .reset_pin = GPIO_PIN_NONE, +#endif + .vcc_pin = GPIO_PIN_NONE, + .ready_pin = GPIO_PIN_PB(27), + .cs = 4, +}; + /* * The next two functions should go away as the boot loader is * supposed to initialize the macb address registers with a valid @@ -141,68 +151,8 @@ static void __init set_hw_addr(struct pl clk_put(pclk); } -#ifdef CONFIG_BOARD_ATSTK1002_J2_LED - -static struct gpio_led stk_j2_led[] = { -#ifdef CONFIG_BOARD_ATSTK1002_J2_LED8 -#define LEDSTRING "J2 jumpered to LED8" - { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), }, - { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), }, - { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), }, - { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), }, - { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), }, - { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), }, - { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), }, - { .name = "led7:amber", .gpio = GPIO_PIN_PB(30), - .default_trigger = "heartbeat", }, -#else /* RGB */ -#define LEDSTRING "J2 jumpered to RGB LEDs" - { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), }, - { .name = "g1:green", .gpio = GPIO_PIN_PB(10), }, - { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), }, - - { .name = "r2:red", .gpio = GPIO_PIN_PB( 9), - .default_trigger = "heartbeat", }, - { .name = "g2:green", .gpio = GPIO_PIN_PB(13), }, - { .name = "b2:blue", .gpio = GPIO_PIN_PB(15), - .default_trigger = "heartbeat", }, - /* PB16, PB30 unused */ -#endif -}; - -static struct gpio_led_platform_data stk_j2_led_data = { - .num_leds = ARRAY_SIZE(stk_j2_led), - .leds = stk_j2_led, -}; - -static struct platform_device stk_j2_led_dev = { - .name = "leds-gpio", - .id = 2, /* gpio block J2 */ - .dev = { - .platform_data = &stk_j2_led_data, - }, -}; - -static void setup_j2_leds(void) -{ - unsigned i; - - for (i = 0; i < ARRAY_SIZE(stk_j2_led); i++) - at32_select_gpio(stk_j2_led[i].gpio, AT32_GPIOF_OUTPUT); - - printk("STK1002: " LEDSTRING "\n"); - platform_device_register(&stk_j2_led_dev); -} - -#else -static void setup_j2_leds(void) -{ -} -#endif - -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM -static void __init at73c213_set_clk(struct at73c213_board_info *info) +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC +static void __init atstk1002_setup_extdac(void) { struct clk *gclk; struct clk *pll; @@ -220,7 +170,7 @@ static void __init at73c213_set_clk(stru } at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); - info->dac_clk = gclk; + at73c213_data.dac_clk = gclk; err_set_clk: clk_put(pll); @@ -229,12 +179,16 @@ err_pll: err_gclk: return; } -#endif -#endif +#else +static void __init atstk1002_setup_extdac(void) +{ + +} +#endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */ void __init setup_board(void) { -#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ #else at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ @@ -271,7 +225,7 @@ static int __init atstk1002_init(void) at32_add_system_devices(); -#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM at32_add_device_usart(1); #else at32_add_device_usart(0); @@ -281,12 +235,16 @@ static int __init atstk1002_init(void) #ifndef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM set_hw_addr(at32_add_device_eth(0, ð_data[0])); #endif -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); #endif -#ifdef CONFIG_BOARD_ATSTK1002_SPI1 +#ifdef CONFIG_BOARD_ATSTK100X_SPI1 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); #endif + at32_add_device_twi(0); +#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM + at32_add_device_mci(0, NULL); +#endif #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM set_hw_addr(at32_add_device_eth(1, ð_data[1])); #else @@ -294,17 +252,18 @@ static int __init atstk1002_init(void) fbmem_start, fbmem_size); #endif at32_add_device_usba(0, NULL); -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM +#ifdef CONFIG_BOARD_ATSTK100X_ENABLE_AC97 + at32_add_device_ac97c(0); +#else + at32_add_device_abdac(0); +#endif +#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM at32_add_device_ssc(0, ATMEL_SSC_TX); #endif + at32_add_device_cf(0, 2, &cf0_data); - setup_j2_leds(); - -#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM -#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM - at73c213_set_clk(&at73c213_data); -#endif -#endif + atstk1000_setup_j2_leds(); + atstk1002_setup_extdac(); return 0; } diff -Nrup linux-2.6.24/arch/avr32/boards/atstk1000/atstk1003.c linux-avr32/arch/avr32/boards/atstk1000/atstk1003.c --- linux-2.6.24/arch/avr32/boards/atstk1000/atstk1003.c 1969-12-31 19:00:00.000000000 -0500 +++ linux-avr32/arch/avr32/boards/atstk1000/atstk1003.c 2008-02-01 14:51:35.000000000 -0500 @@ -0,0 +1,181 @@ +/* + * ATSTK1003 daughterboard-specific init code + * + * Copyright (C) 2007 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include "atstk1000.h" + +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC +static struct at73c213_board_info at73c213_data = { + .ssc_id = 0, + .shortname = "AVR32 STK1000 external DAC", +}; +#endif + +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM +static struct spi_board_info spi0_board_info[] __initdata = { +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC + { + /* AT73C213 */ + .modalias = "at73c213", + .max_speed_hz = 200000, + .chip_select = 0, + .mode = SPI_MODE_1, + .platform_data = &at73c213_data, + }, +#endif + /* + * We can control the LTV350QV LCD panel, but it isn't much + * point since we don't have an LCD controller... + */ +}; +#endif + +#ifdef CONFIG_BOARD_ATSTK100X_SPI1 +static struct spi_board_info spi1_board_info[] __initdata = { { + /* patch in custom entries here */ +} }; +#endif + +static struct cf_platform_data __initdata cf0_data = { +#ifdef CONFIG_BOARD_ATSTK1000_CF_HACKS + .detect_pin = CONFIG_BOARD_ATSTK1000_CF_DETECT_PIN, + .reset_pin = CONFIG_BOARD_ATSTK1000_CF_RESET_PIN, +#else + .detect_pin = GPIO_PIN_NONE, + .reset_pin = GPIO_PIN_NONE, +#endif + .vcc_pin = GPIO_PIN_NONE, + .ready_pin = GPIO_PIN_PB(27), + .cs = 4, +}; + +#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC +static void __init atstk1003_setup_extdac(void) +{ + struct clk *gclk; + struct clk *pll; + + gclk = clk_get(NULL, "gclk0"); + if (IS_ERR(gclk)) + goto err_gclk; + pll = clk_get(NULL, "pll0"); + if (IS_ERR(pll)) + goto err_pll; + + if (clk_set_parent(gclk, pll)) { + pr_debug("STK1000: failed to set pll0 as parent for DAC clock\n"); + goto err_set_clk; + } + + at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); + at73c213_data.dac_clk = gclk; + +err_set_clk: + clk_put(pll); +err_pll: + clk_put(gclk); +err_gclk: + return; +} +#else +static void __init atstk1003_setup_extdac(void) +{ + +} +#endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */ + +void __init setup_board(void) +{ +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM + at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ +#else + at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ +#endif + /* USART 2/unused: expansion connector */ + at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */ + + at32_setup_serial_console(0); +} + +static int __init atstk1003_init(void) +{ + /* + * ATSTK1000 uses 32-bit SDRAM interface. Reserve the + * SDRAM-specific pins so that nobody messes with them. + */ + at32_reserve_pin(GPIO_PIN_PE(0)); /* DATA[16] */ + at32_reserve_pin(GPIO_PIN_PE(1)); /* DATA[17] */ + at32_reserve_pin(GPIO_PIN_PE(2)); /* DATA[18] */ + at32_reserve_pin(GPIO_PIN_PE(3)); /* DATA[19] */ + at32_reserve_pin(GPIO_PIN_PE(4)); /* DATA[20] */ + at32_reserve_pin(GPIO_PIN_PE(5)); /* DATA[21] */ + at32_reserve_pin(GPIO_PIN_PE(6)); /* DATA[22] */ + at32_reserve_pin(GPIO_PIN_PE(7)); /* DATA[23] */ + at32_reserve_pin(GPIO_PIN_PE(8)); /* DATA[24] */ + at32_reserve_pin(GPIO_PIN_PE(9)); /* DATA[25] */ + at32_reserve_pin(GPIO_PIN_PE(10)); /* DATA[26] */ + at32_reserve_pin(GPIO_PIN_PE(11)); /* DATA[27] */ + at32_reserve_pin(GPIO_PIN_PE(12)); /* DATA[28] */ + at32_reserve_pin(GPIO_PIN_PE(13)); /* DATA[29] */ + at32_reserve_pin(GPIO_PIN_PE(14)); /* DATA[30] */ + at32_reserve_pin(GPIO_PIN_PE(15)); /* DATA[31] */ + at32_reserve_pin(GPIO_PIN_PE(26)); /* SDCS */ + + at32_add_system_devices(); + +#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM + at32_add_device_usart(1); +#else + at32_add_device_usart(0); +#endif + at32_add_device_usart(2); + +#ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM + at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); +#endif +#ifdef CONFIG_BOARD_ATSTK100X_SPI1 + at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); +#endif +#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM + at32_add_device_mci(0, NULL); +#endif + at32_add_device_usba(0, NULL); +#ifdef CONFIG_BOARD_ATSTK100X_ENABLE_AC97 + at32_add_device_ac97c(0); +#else + at32_add_device_abdac(0); +#endif +#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM + at32_add_device_ssc(0, ATMEL_SSC_TX); +#endif + at32_add_device_cf(0, 2, &cf0_data); + + atstk1000_setup_j2_leds(); + atstk1003_setup_extdac(); + + return 0; +} +postcore_initcall(atstk1003_init); diff -Nrup linux-2.6.24/arch/avr32/boards/atstk1000/atstk1004.c linux-avr32/arch/avr32/boards/atstk1000/atstk1004.c --- linux-2.6.24/arch/avr32/boards/atstk1000/atstk1004.c 1969-12-31 19:00:00.000000000 -0500 +++ linux-avr32/arch/avr32/boards/atstk1000/atstk1004.c 2008-02-01 14:51:35.000000000 -0500 @@ -0,0 +1,152 @@ +/* + * ATSTK1003 daughterboard-specific init code + * + * Copyright (C) 2007 Atmel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include