aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/boards
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32/boards')
-rw-r--r--arch/avr32/boards/atngw100/evklcd10x.c50
-rw-r--r--arch/avr32/boards/atngw100/setup.c7
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c6
-rw-r--r--arch/avr32/boards/atstk1000/atstk1003.c6
-rw-r--r--arch/avr32/boards/atstk1000/atstk1004.c6
-rw-r--r--arch/avr32/boards/favr-32/setup.c9
-rw-r--r--arch/avr32/boards/hammerhead/setup.c6
-rw-r--r--arch/avr32/boards/merisc/Kconfig5
-rw-r--r--arch/avr32/boards/merisc/Makefile1
-rw-r--r--arch/avr32/boards/merisc/display.c65
-rw-r--r--arch/avr32/boards/merisc/flash.c139
-rw-r--r--arch/avr32/boards/merisc/merisc.h18
-rw-r--r--arch/avr32/boards/merisc/merisc_sysfs.c65
-rw-r--r--arch/avr32/boards/merisc/setup.c297
-rw-r--r--arch/avr32/boards/mimc200/setup.c8
15 files changed, 649 insertions, 39 deletions
diff --git a/arch/avr32/boards/atngw100/evklcd10x.c b/arch/avr32/boards/atngw100/evklcd10x.c
index 8140b22b3461..00337112c5ac 100644
--- a/arch/avr32/boards/atngw100/evklcd10x.c
+++ b/arch/avr32/boards/atngw100/evklcd10x.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/gpio.h>
14#include <linux/fb.h> 15#include <linux/fb.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16 17
@@ -19,26 +20,26 @@
19#include <asm/setup.h> 20#include <asm/setup.h>
20 21
21#include <mach/at32ap700x.h> 22#include <mach/at32ap700x.h>
23#include <mach/portmux.h>
22#include <mach/board.h> 24#include <mach/board.h>
23 25
26#include <sound/atmel-ac97c.h>
27
24static struct ac97c_platform_data __initdata ac97c0_data = { 28static struct ac97c_platform_data __initdata ac97c0_data = {
25 .dma_rx_periph_id = 3, 29 .reset_pin = GPIO_PIN_PB(19),
26 .dma_tx_periph_id = 4,
27 .dma_controller_id = 0,
28 .reset_pin = GPIO_PIN_PB(19),
29}; 30};
30 31
31#ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA 32#ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA
32static struct fb_videomode __initdata tcg057vglad_modes[] = { 33static struct fb_videomode __initdata tcg057vglad_modes[] = {
33 { 34 {
34 .name = "640x480 @ 60", 35 .name = "640x480 @ 50",
35 .refresh = 60, 36 .refresh = 50,
36 .xres = 640, .yres = 480, 37 .xres = 640, .yres = 480,
37 .pixclock = KHZ2PICOS(25180), 38 .pixclock = KHZ2PICOS(25180),
38 39
39 .left_margin = 64, .right_margin = 31, 40 .left_margin = 64, .right_margin = 96,
40 .upper_margin = 34, .lower_margin = 2, 41 .upper_margin = 34, .lower_margin = 11,
41 .hsync_len = 96, .vsync_len = 4, 42 .hsync_len = 64, .vsync_len = 15,
42 43
43 .sync = 0, 44 .sync = 0,
44 .vmode = FB_VMODE_NONINTERLACED, 45 .vmode = FB_VMODE_NONINTERLACED,
@@ -69,14 +70,14 @@ static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
69#elif CONFIG_BOARD_ATNGW100_EVKLCD10X_QVGA 70#elif CONFIG_BOARD_ATNGW100_EVKLCD10X_QVGA
70static struct fb_videomode __initdata tcg057qvlad_modes[] = { 71static struct fb_videomode __initdata tcg057qvlad_modes[] = {
71 { 72 {
72 .name = "320x240 @ 60", 73 .name = "320x240 @ 50",
73 .refresh = 60, 74 .refresh = 50,
74 .xres = 320, .yres = 240, 75 .xres = 320, .yres = 240,
75 .pixclock = KHZ2PICOS(6300), 76 .pixclock = KHZ2PICOS(6300),
76 77
77 .left_margin = 52, .right_margin = 28, 78 .left_margin = 34, .right_margin = 46,
78 .upper_margin = 7, .lower_margin = 2, 79 .upper_margin = 7, .lower_margin = 15,
79 .hsync_len = 96, .vsync_len = 4, 80 .hsync_len = 64, .vsync_len = 12,
80 81
81 .sync = 0, 82 .sync = 0,
82 .vmode = FB_VMODE_NONINTERLACED, 83 .vmode = FB_VMODE_NONINTERLACED,
@@ -144,12 +145,29 @@ static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
144}; 145};
145#endif 146#endif
146 147
148static void atevklcd10x_lcdc_power_control(int on)
149{
150 gpio_set_value(GPIO_PIN_PB(15), on);
151}
152
147static int __init atevklcd10x_init(void) 153static int __init atevklcd10x_init(void)
148{ 154{
149 at32_add_device_ac97c(0, &ac97c0_data); 155 /* PB15 is connected to the enable line on the boost regulator
156 * controlling the backlight for the LCD panel.
157 */
158 at32_select_gpio(GPIO_PIN_PB(15), AT32_GPIOF_OUTPUT);
159 gpio_request(GPIO_PIN_PB(15), "backlight");
160 gpio_direction_output(GPIO_PIN_PB(15), 0);
161
162 atevklcd10x_lcdc_data.atmel_lcdfb_power_control =
163 atevklcd10x_lcdc_power_control;
150 164
151 at32_add_device_lcdc(0, &atevklcd10x_lcdc_data, 165 at32_add_device_lcdc(0, &atevklcd10x_lcdc_data,
152 fbmem_start, fbmem_size, 1); 166 fbmem_start, fbmem_size,
167 ATMEL_LCDC_ALT_18BIT | ATMEL_LCDC_PE_DVAL);
168
169 at32_add_device_ac97c(0, &ac97c0_data, AC97C_BOTH);
170
153 return 0; 171 return 0;
154} 172}
155postcore_initcall(atevklcd10x_init); 173postcore_initcall(atevklcd10x_init);
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 05d3722fff18..5b022aad4bd9 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -56,13 +56,8 @@ static struct spi_board_info spi0_board_info[] __initdata = {
56static struct mci_platform_data __initdata mci0_data = { 56static struct mci_platform_data __initdata mci0_data = {
57 .slot[0] = { 57 .slot[0] = {
58 .bus_width = 4, 58 .bus_width = 4,
59#ifndef CONFIG_BOARD_ATNGW100_EVKLCD10X
60 .detect_pin = GPIO_PIN_PC(25), 59 .detect_pin = GPIO_PIN_PC(25),
61 .wp_pin = GPIO_PIN_PE(0), 60 .wp_pin = GPIO_PIN_PE(0),
62#else
63 .detect_pin = GPIO_PIN_NONE,
64 .wp_pin = GPIO_PIN_NONE,
65#endif
66 }, 61 },
67}; 62};
68 63
@@ -123,7 +118,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
123 118
124void __init setup_board(void) 119void __init setup_board(void)
125{ 120{
126 at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */ 121 at32_map_usart(1, 0, 0); /* USART 1: /dev/ttyS0, DB9 */
127 at32_setup_serial_console(0); 122 at32_setup_serial_console(0);
128} 123}
129 124
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 1f33a106905c..2adc261c9e3d 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -252,12 +252,12 @@ static void __init atstk1002_setup_extdac(void)
252void __init setup_board(void) 252void __init setup_board(void)
253{ 253{
254#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 254#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
255 at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ 255 at32_map_usart(0, 1, 0); /* USART 0/B: /dev/ttyS1, IRDA */
256#else 256#else
257 at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ 257 at32_map_usart(1, 0, 0); /* USART 1/A: /dev/ttyS0, DB9 */
258#endif 258#endif
259 /* USART 2/unused: expansion connector */ 259 /* USART 2/unused: expansion connector */
260 at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */ 260 at32_map_usart(3, 2, 0); /* USART 3/C: /dev/ttyS2, DB9 */
261 261
262 at32_setup_serial_console(0); 262 at32_setup_serial_console(0);
263} 263}
diff --git a/arch/avr32/boards/atstk1000/atstk1003.c b/arch/avr32/boards/atstk1000/atstk1003.c
index b3a23c88bcfe..ff7e23298827 100644
--- a/arch/avr32/boards/atstk1000/atstk1003.c
+++ b/arch/avr32/boards/atstk1000/atstk1003.c
@@ -115,12 +115,12 @@ static void __init atstk1003_setup_extdac(void)
115void __init setup_board(void) 115void __init setup_board(void)
116{ 116{
117#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 117#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
118 at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ 118 at32_map_usart(0, 1, 0); /* USART 0/B: /dev/ttyS1, IRDA */
119#else 119#else
120 at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ 120 at32_map_usart(1, 0, 0); /* USART 1/A: /dev/ttyS0, DB9 */
121#endif 121#endif
122 /* USART 2/unused: expansion connector */ 122 /* USART 2/unused: expansion connector */
123 at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */ 123 at32_map_usart(3, 2, 0); /* USART 3/C: /dev/ttyS2, DB9 */
124 124
125 at32_setup_serial_console(0); 125 at32_setup_serial_console(0);
126} 126}
diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c
index 29b35aca96cd..69a9f0f08c6e 100644
--- a/arch/avr32/boards/atstk1000/atstk1004.c
+++ b/arch/avr32/boards/atstk1000/atstk1004.c
@@ -120,12 +120,12 @@ static void __init atstk1004_setup_extdac(void)
120void __init setup_board(void) 120void __init setup_board(void)
121{ 121{
122#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 122#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
123 at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ 123 at32_map_usart(0, 1, 0); /* USART 0/B: /dev/ttyS1, IRDA */
124#else 124#else
125 at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ 125 at32_map_usart(1, 0, 0); /* USART 1/A: /dev/ttyS0, DB9 */
126#endif 126#endif
127 /* USART 2/unused: expansion connector */ 127 /* USART 2/unused: expansion connector */
128 at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */ 128 at32_map_usart(3, 2, 0); /* USART 3/C: /dev/ttyS2, DB9 */
129 129
130 at32_setup_serial_console(0); 130 at32_setup_serial_console(0);
131} 131}
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 745c408c2ac5..46c9b0a224cf 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -22,6 +22,8 @@
22#include <linux/spi/spi.h> 22#include <linux/spi/spi.h>
23#include <linux/spi/ads7846.h> 23#include <linux/spi/ads7846.h>
24 24
25#include <sound/atmel-abdac.h>
26
25#include <video/atmel_lcdc.h> 27#include <video/atmel_lcdc.h>
26 28
27#include <asm/setup.h> 29#include <asm/setup.h>
@@ -41,6 +43,9 @@ unsigned long at32_board_osc_rates[3] = {
41/* Initialized by bootloader-specific startup code. */ 43/* Initialized by bootloader-specific startup code. */
42struct tag *bootloader_tags __initdata; 44struct tag *bootloader_tags __initdata;
43 45
46static struct atmel_abdac_pdata __initdata abdac0_data = {
47};
48
44struct eth_addr { 49struct eth_addr {
45 u8 addr[6]; 50 u8 addr[6];
46}; 51};
@@ -245,7 +250,7 @@ static void __init favr32_setup_atmel_pwm_bl(void)
245 250
246void __init setup_board(void) 251void __init setup_board(void)
247{ 252{
248 at32_map_usart(3, 0); /* USART 3 => /dev/ttyS0 */ 253 at32_map_usart(3, 0, 0); /* USART 3 => /dev/ttyS0 */
249 at32_setup_serial_console(0); 254 at32_setup_serial_console(0);
250} 255}
251 256
@@ -326,7 +331,7 @@ static int __init favr32_init(void)
326 331
327 spi1_board_info[0].irq = gpio_to_irq(GPIO_PIN_PB(3)); 332 spi1_board_info[0].irq = gpio_to_irq(GPIO_PIN_PB(3));
328 333
329 set_abdac_rate(at32_add_device_abdac(0)); 334 set_abdac_rate(at32_add_device_abdac(0, &abdac0_data));
330 335
331 at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel); 336 at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel);
332 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 337 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
index 4d2fe82b2029..dd009875a405 100644
--- a/arch/avr32/boards/hammerhead/setup.c
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -29,6 +29,8 @@
29#include <mach/init.h> 29#include <mach/init.h>
30#include <mach/portmux.h> 30#include <mach/portmux.h>
31 31
32#include <sound/atmel-ac97c.h>
33
32#include "../../mach-at32ap/clock.h" 34#include "../../mach-at32ap/clock.h"
33#include "flash.h" 35#include "flash.h"
34 36
@@ -163,7 +165,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
163 165
164void __init setup_board(void) 166void __init setup_board(void)
165{ 167{
166 at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */ 168 at32_map_usart(1, 0, 0); /* USART 1: /dev/ttyS0, DB9 */
167 at32_setup_serial_console(0); 169 at32_setup_serial_console(0);
168} 170}
169 171
@@ -233,7 +235,7 @@ static int __init hammerhead_init(void)
233 i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info)); 235 i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
234 236
235#ifdef CONFIG_BOARD_HAMMERHEAD_SND 237#ifdef CONFIG_BOARD_HAMMERHEAD_SND
236 at32_add_device_ac97c(0, &ac97c_data); 238 at32_add_device_ac97c(0, &ac97c_data, AC97C_BOTH);
237#endif 239#endif
238 240
239 /* Select the Touchscreen interrupt pin mode */ 241 /* Select the Touchscreen interrupt pin mode */
diff --git a/arch/avr32/boards/merisc/Kconfig b/arch/avr32/boards/merisc/Kconfig
new file mode 100644
index 000000000000..7e043275d5a9
--- /dev/null
+++ b/arch/avr32/boards/merisc/Kconfig
@@ -0,0 +1,5 @@
1# Merisc customization
2
3if BOARD_MERISC
4
5endif # BOARD_MERISC
diff --git a/arch/avr32/boards/merisc/Makefile b/arch/avr32/boards/merisc/Makefile
new file mode 100644
index 000000000000..d24c78729bd1
--- /dev/null
+++ b/arch/avr32/boards/merisc/Makefile
@@ -0,0 +1 @@
obj-y += setup.o flash.o display.o merisc_sysfs.o
diff --git a/arch/avr32/boards/merisc/display.c b/arch/avr32/boards/merisc/display.c
new file mode 100644
index 000000000000..85a543cd4abc
--- /dev/null
+++ b/arch/avr32/boards/merisc/display.c
@@ -0,0 +1,65 @@
1/*
2 * Display setup code for the Merisc board
3 *
4 * Copyright (C) 2008 Martinsson Elektronik AB
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/fb.h>
13#include <video/atmel_lcdc.h>
14#include <asm/setup.h>
15#include <mach/board.h>
16#include "merisc.h"
17
18static struct fb_videomode merisc_fb_videomode[] = {
19 {
20 .refresh = 44,
21 .xres = 640,
22 .yres = 480,
23 .left_margin = 96,
24 .right_margin = 96,
25 .upper_margin = 34,
26 .lower_margin = 8,
27 .hsync_len = 64,
28 .vsync_len = 64,
29 .name = "640x480 @ 44",
30 .pixclock = KHZ2PICOS(25180),
31 .sync = 0,
32 .vmode = FB_VMODE_NONINTERLACED,
33 },
34};
35
36static struct fb_monspecs merisc_fb_monspecs = {
37 .manufacturer = "Kyo",
38 .monitor = "TCG075VG2AD",
39 .modedb = merisc_fb_videomode,
40 .modedb_len = ARRAY_SIZE(merisc_fb_videomode),
41 .hfmin = 30000,
42 .hfmax = 33333,
43 .vfmin = 60,
44 .vfmax = 90,
45 .dclkmax = 30000000,
46};
47
48struct atmel_lcdfb_info merisc_lcdc_data = {
49 .default_bpp = 24,
50 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
51 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
52 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
53 | ATMEL_LCDC_MEMOR_BIG),
54 .default_monspecs = &merisc_fb_monspecs,
55 .guard_time = 2,
56};
57
58static int __init merisc_display_init(void)
59{
60 at32_add_device_lcdc(0, &merisc_lcdc_data, fbmem_start,
61 fbmem_size, 0);
62
63 return 0;
64}
65device_initcall(merisc_display_init);
diff --git a/arch/avr32/boards/merisc/flash.c b/arch/avr32/boards/merisc/flash.c
new file mode 100644
index 000000000000..8e856fd6f013
--- /dev/null
+++ b/arch/avr32/boards/merisc/flash.c
@@ -0,0 +1,139 @@
1/*
2 * Merisc board-specific flash initialization
3 *
4 * Copyright (C) 2008 Martinsson Elektronik AB
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/mtd/mtd.h>
13#include <linux/mtd/partitions.h>
14#include <linux/mtd/physmap.h>
15#include <mach/smc.h>
16
17/* Will be translated to units of 14.3 ns, rounded up */
18static struct smc_timing flash_timing __initdata = {
19 .ncs_read_setup = 1 * 14,
20 .nrd_setup = 5 * 14,
21 .ncs_write_setup = 1 * 14,
22 .nwe_setup = 2 * 14,
23
24 .ncs_read_pulse = 12 * 14,
25 .nrd_pulse = 7 * 14,
26 .ncs_write_pulse = 8 * 14,
27 .nwe_pulse = 4 * 14,
28
29 .read_cycle = 14 * 14,
30 .write_cycle = 10 * 14,
31};
32
33static struct smc_config flash_config __initdata = {
34 .bus_width = 2,
35 .nrd_controlled = 1,
36 .nwe_controlled = 1,
37 .byte_write = 1,
38 .tdf_cycles = 3,
39};
40
41static struct mtd_partition flash_0_parts[] = {
42 {
43 .name = "boot",
44 .offset = 0x00000000,
45 .size = 0x00060000,
46 .mask_flags = 0,
47 },
48 {
49 .name = "kernel",
50 .offset = 0x00060000,
51 .size = 0x00200000,
52 .mask_flags = 0,
53 },
54 {
55 .name = "root",
56 .offset = 0x00260000,
57 .size = MTDPART_SIZ_FULL,
58 .mask_flags = 0,
59 },
60};
61
62static struct mtd_partition flash_1_parts[] = {
63 {
64 .name = "2ndflash",
65 .offset = 0x00000000,
66 .size = MTDPART_SIZ_FULL,
67 .mask_flags = 0,
68 },
69};
70
71static struct physmap_flash_data flash_data[] = {
72 {
73 .width = 2,
74 .nr_parts = ARRAY_SIZE(flash_0_parts),
75 .parts = flash_0_parts,
76 },
77 {
78 .width = 2,
79 .nr_parts = ARRAY_SIZE(flash_1_parts),
80 .parts = flash_1_parts,
81 }
82};
83
84static struct resource flash_resource[] = {
85 {
86 .start = 0x00000000,
87 .end = 0x03ffffff,
88 .flags = IORESOURCE_MEM,
89 },
90 {
91 .start = 0x04000000,
92 .end = 0x07ffffff,
93 .flags = IORESOURCE_MEM,
94 },
95};
96
97static struct platform_device flash_device[] = {
98 {
99 .name = "physmap-flash",
100 .id = 0,
101 .resource = &flash_resource[0],
102 .num_resources = 1,
103 .dev = {
104 .platform_data = &flash_data[0],
105 },
106 },
107 {
108 .name = "physmap-flash",
109 .id = 1,
110 .resource = &flash_resource[1],
111 .num_resources = 1,
112 .dev = {
113 .platform_data = &flash_data[1],
114 },
115 },
116};
117
118static int __init merisc_flash_init(void)
119{
120 int ret;
121 smc_set_timing(&flash_config, &flash_timing);
122
123 ret = smc_set_configuration(0, &flash_config);
124 if (ret < 0) {
125 printk(KERN_ERR "Merisc: failed to set NOR flash timing #0\n");
126 return ret;
127 }
128
129 ret = smc_set_configuration(4, &flash_config);
130 if (ret < 0) {
131 printk(KERN_ERR "Merisc: failed to set NOR flash timing #1\n");
132 return ret;
133 }
134
135 platform_device_register(&flash_device[0]);
136 platform_device_register(&flash_device[1]);
137 return 0;
138}
139device_initcall(merisc_flash_init);
diff --git a/arch/avr32/boards/merisc/merisc.h b/arch/avr32/boards/merisc/merisc.h
new file mode 100644
index 000000000000..50ffb2f3fcbf
--- /dev/null
+++ b/arch/avr32/boards/merisc/merisc.h
@@ -0,0 +1,18 @@
1/*
2 * Merisc exports
3 *
4 * Copyright (C) 2008 Martinsson Elektronik AB
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ARCH_AVR32_BOARDS_MERISC_MERISC_H
11#define __ARCH_AVR32_BOARDS_MERISC_MERISC_H
12
13const char *merisc_revision(void);
14const char *merisc_model(void);
15
16extern struct class merisc_class;
17
18#endif /* __ARCH_AVR32_BOARDS_MERISC_MERISC_H */
diff --git a/arch/avr32/boards/merisc/merisc_sysfs.c b/arch/avr32/boards/merisc/merisc_sysfs.c
new file mode 100644
index 000000000000..df431fdba9ad
--- /dev/null
+++ b/arch/avr32/boards/merisc/merisc_sysfs.c
@@ -0,0 +1,65 @@
1/*
2 * Merisc sysfs exports
3 *
4 * Copyright (C) 2008 Martinsson Elektronik AB
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/module.h>
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/list.h>
14#include <linux/spinlock.h>
15#include <linux/device.h>
16#include <linux/sysdev.h>
17#include <linux/timer.h>
18#include <linux/err.h>
19#include <linux/ctype.h>
20#include "merisc.h"
21
22static ssize_t merisc_model_show(struct class *class, char *buf)
23{
24 ssize_t ret = 0;
25
26 sprintf(buf, "%s\n", merisc_model());
27 ret = strlen(buf) + 1;
28
29 return ret;
30}
31
32static ssize_t merisc_revision_show(struct class *class, char *buf)
33{
34 ssize_t ret = 0;
35
36 sprintf(buf, "%s\n", merisc_revision());
37 ret = strlen(buf) + 1;
38
39 return ret;
40}
41
42static struct class_attribute merisc_class_attrs[] = {
43 __ATTR(model, S_IRUGO, merisc_model_show, NULL),
44 __ATTR(revision, S_IRUGO, merisc_revision_show, NULL),
45 __ATTR_NULL,
46};
47
48struct class merisc_class = {
49 .name = "merisc",
50 .owner = THIS_MODULE,
51 .class_attrs = merisc_class_attrs,
52};
53
54static int __init merisc_sysfs_init(void)
55{
56 int status;
57
58 status = class_register(&merisc_class);
59 if (status < 0)
60 return status;
61
62 return 0;
63}
64
65postcore_initcall(merisc_sysfs_init);
diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
new file mode 100644
index 000000000000..20b300cf105a
--- /dev/null
+++ b/arch/avr32/boards/merisc/setup.c
@@ -0,0 +1,297 @@
1/*
2 * Board-specific setup code for the Merisc
3 *
4 * Copyright (C) 2008 Martinsson Elektronik AB
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/clk.h>
11#include <linux/etherdevice.h>
12#include <linux/i2c.h>
13#include <linux/i2c-gpio.h>
14#include <linux/gpio.h>
15#include <linux/init.h>
16#include <linux/linkage.h>
17#include <linux/platform_device.h>
18#include <linux/types.h>
19#include <linux/leds.h>
20#include <linux/spi/spi.h>
21#include <linux/spi/ads7846.h>
22#include <linux/irq.h>
23#include <linux/fb.h>
24#include <linux/atmel-mci.h>
25
26#include <asm/io.h>
27#include <asm/setup.h>
28#include <asm/gpio.h>
29
30#include <mach/at32ap700x.h>
31#include <mach/board.h>
32#include <mach/init.h>
33#include <mach/portmux.h>
34
35#include "merisc.h"
36
37/* Holds the autodetected board model and revision */
38static int merisc_board_id;
39
40/* Initialized by bootloader-specific startup code. */
41struct tag *bootloader_tags __initdata;
42
43/* Oscillator frequencies. These are board specific */
44unsigned long at32_board_osc_rates[3] = {
45 [0] = 32768, /* 32.768 kHz on RTC osc */
46 [1] = 20000000, /* 20 MHz on osc0 */
47 [2] = 12000000, /* 12 MHz on osc1 */
48};
49
50struct eth_addr {
51 u8 addr[6];
52};
53
54static struct eth_addr __initdata hw_addr[2];
55static struct eth_platform_data __initdata eth_data[2];
56
57static int ads7846_get_pendown_state_PB26(void)
58{
59 return !gpio_get_value(GPIO_PIN_PB(26));
60}
61
62static int ads7846_get_pendown_state_PB28(void)
63{
64 return !gpio_get_value(GPIO_PIN_PB(28));
65}
66
67static struct ads7846_platform_data __initdata ads7846_data = {
68 .model = 7846,
69 .vref_delay_usecs = 100,
70 .vref_mv = 0,
71 .keep_vref_on = 0,
72 .settle_delay_usecs = 150,
73 .penirq_recheck_delay_usecs = 1,
74 .x_plate_ohms = 800,
75 .debounce_rep = 4,
76 .debounce_max = 10,
77 .debounce_tol = 50,
78 .get_pendown_state = ads7846_get_pendown_state_PB26,
79 .filter_init = NULL,
80 .filter = NULL,
81 .filter_cleanup = NULL,
82};
83
84static struct spi_board_info __initdata spi0_board_info[] = {
85 {
86 .modalias = "ads7846",
87 .max_speed_hz = 3250000,
88 .chip_select = 0,
89 .bus_num = 0,
90 .platform_data = &ads7846_data,
91 .mode = SPI_MODE_0,
92 },
93};
94
95static struct mci_platform_data __initdata mci0_data = {
96 .slot[0] = {
97 .bus_width = 4,
98 .detect_pin = GPIO_PIN_PE(19),
99 .wp_pin = GPIO_PIN_PE(20),
100 },
101};
102
103static int __init parse_tag_ethernet(struct tag *tag)
104{
105 int i;
106
107 i = tag->u.ethernet.mac_index;
108 if (i < ARRAY_SIZE(hw_addr)) {
109 memcpy(hw_addr[i].addr, tag->u.ethernet.hw_address,
110 sizeof(hw_addr[i].addr));
111 }
112
113 return 0;
114}
115__tagtable(ATAG_ETHERNET, parse_tag_ethernet);
116
117static void __init set_hw_addr(struct platform_device *pdev)
118{
119 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
120 const u8 *addr;
121 void __iomem *regs;
122 struct clk *pclk;
123
124 if (!res)
125 return;
126
127 if (pdev->id >= ARRAY_SIZE(hw_addr))
128 return;
129
130 addr = hw_addr[pdev->id].addr;
131 if (!is_valid_ether_addr(addr))
132 return;
133
134 regs = (void __iomem __force *)res->start;
135 pclk = clk_get(&pdev->dev, "pclk");
136 if (!pclk)
137 return;
138
139 clk_enable(pclk);
140 __raw_writel((addr[3] << 24) | (addr[2] << 16)
141 | (addr[1] << 8) | addr[0], regs + 0x98);
142 __raw_writel((addr[5] << 8) | addr[4], regs + 0x9c);
143 clk_disable(pclk);
144 clk_put(pclk);
145}
146
147static struct i2c_gpio_platform_data i2c_gpio_data = {
148 .sda_pin = GPIO_PIN_PA(6),
149 .scl_pin = GPIO_PIN_PA(7),
150 .sda_is_open_drain = 1,
151 .scl_is_open_drain = 1,
152 .udelay = 2,
153};
154
155static struct platform_device i2c_gpio_device = {
156 .name = "i2c-gpio",
157 .id = 0,
158 .dev = {
159 .platform_data = &i2c_gpio_data,
160 },
161};
162
163static struct i2c_board_info __initdata i2c_info[] = {
164 {
165 I2C_BOARD_INFO("pcf8563", 0x51)
166 },
167};
168
169#ifdef CONFIG_LEDS_ATMEL_PWM
170static struct gpio_led stk_pwm_led[] = {
171 {
172 .name = "backlight",
173 .gpio = 0, /* PWM channel 0 (LCD backlight) */
174 },
175};
176
177static struct gpio_led_platform_data stk_pwm_led_data = {
178 .num_leds = ARRAY_SIZE(stk_pwm_led),
179 .leds = stk_pwm_led,
180};
181
182static struct platform_device stk_pwm_led_dev = {
183 .name = "leds-atmel-pwm",
184 .id = -1,
185 .dev = {
186 .platform_data = &stk_pwm_led_data,
187 },
188};
189#endif
190
191const char *merisc_model(void)
192{
193 switch (merisc_board_id) {
194 case 0:
195 case 1:
196 return "500-01";
197 case 2:
198 return "BT";
199 default:
200 return "Unknown";
201 }
202}
203
204const char *merisc_revision(void)
205{
206 switch (merisc_board_id) {
207 case 0:
208 return "B";
209 case 1:
210 return "D";
211 case 2:
212 return "A";
213 default:
214 return "Unknown";
215 }
216}
217
218static void detect_merisc_board_id(void)
219{
220 /* Board ID pins MUST be set as input or the board may be damaged */
221 at32_select_gpio(GPIO_PIN_PA(24), AT32_GPIOF_PULLUP);
222 at32_select_gpio(GPIO_PIN_PA(25), AT32_GPIOF_PULLUP);
223 at32_select_gpio(GPIO_PIN_PA(26), AT32_GPIOF_PULLUP);
224 at32_select_gpio(GPIO_PIN_PA(27), AT32_GPIOF_PULLUP);
225
226 merisc_board_id = !gpio_get_value(GPIO_PIN_PA(24)) +
227 !gpio_get_value(GPIO_PIN_PA(25)) * 2 +
228 !gpio_get_value(GPIO_PIN_PA(26)) * 4 +
229 !gpio_get_value(GPIO_PIN_PA(27)) * 8;
230}
231
232void __init setup_board(void)
233{
234 at32_map_usart(0, 0, 0);
235 at32_map_usart(1, 1, 0);
236 at32_map_usart(3, 3, 0);
237 at32_setup_serial_console(1);
238}
239
240static int __init merisc_init(void)
241{
242 detect_merisc_board_id();
243
244 printk(KERN_NOTICE "BOARD: Merisc %s revision %s\n", merisc_model(),
245 merisc_revision());
246
247 /* Reserve pins for SDRAM */
248 at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL | (1 << 26));
249
250 if (merisc_board_id >= 1)
251 at32_map_usart(2, 2, 0);
252
253 at32_add_device_usart(0);
254 at32_add_device_usart(1);
255 if (merisc_board_id >= 1)
256 at32_add_device_usart(2);
257 at32_add_device_usart(3);
258 set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
259
260 /* ADS7846 PENIRQ */
261 if (merisc_board_id == 0) {
262 ads7846_data.get_pendown_state = ads7846_get_pendown_state_PB26;
263 at32_select_periph(GPIO_PIOB_BASE, 1 << 26,
264 GPIO_PERIPH_A, AT32_GPIOF_PULLUP);
265 spi0_board_info[0].irq = AT32_EXTINT(1);
266 } else {
267 ads7846_data.get_pendown_state = ads7846_get_pendown_state_PB28;
268 at32_select_periph(GPIO_PIOB_BASE, 1 << 28, GPIO_PERIPH_A,
269 AT32_GPIOF_PULLUP);
270 spi0_board_info[0].irq = AT32_EXTINT(3);
271 }
272
273 /* ADS7846 busy pin */
274 at32_select_gpio(GPIO_PIN_PA(4), AT32_GPIOF_PULLUP);
275
276 at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
277
278 at32_add_device_mci(0, &mci0_data);
279
280#ifdef CONFIG_LEDS_ATMEL_PWM
281 at32_add_device_pwm((1 << 0) | (1 << 2));
282 platform_device_register(&stk_pwm_led_dev);
283#else
284 at32_add_device_pwm((1 << 2));
285#endif
286
287 at32_select_gpio(i2c_gpio_data.sda_pin,
288 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
289 at32_select_gpio(i2c_gpio_data.scl_pin,
290 AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
291 platform_device_register(&i2c_gpio_device);
292
293 i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));
294
295 return 0;
296}
297postcore_initcall(merisc_init);
diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c
index 2b58d61f0afc..c1b2175b4fea 100644
--- a/arch/avr32/boards/mimc200/setup.c
+++ b/arch/avr32/boards/mimc200/setup.c
@@ -175,10 +175,10 @@ static void __init set_hw_addr(struct platform_device *pdev)
175 175
176void __init setup_board(void) 176void __init setup_board(void)
177{ 177{
178 at32_map_usart(0, 0); /* USART 0: /dev/ttyS0 (TTL --> Altera) */ 178 at32_map_usart(0, 0, 0); /* USART 0: /dev/ttyS0 (TTL --> Altera) */
179 at32_map_usart(1, 1); /* USART 1: /dev/ttyS1 (RS232) */ 179 at32_map_usart(1, 1, 0); /* USART 1: /dev/ttyS1 (RS232) */
180 at32_map_usart(2, 2); /* USART 2: /dev/ttyS2 (RS485) */ 180 at32_map_usart(2, 2, 0); /* USART 2: /dev/ttyS2 (RS485) */
181 at32_map_usart(3, 3); /* USART 3: /dev/ttyS3 (RS422 Multidrop) */ 181 at32_map_usart(3, 3, 0); /* USART 3: /dev/ttyS3 (RS422 Multidrop) */
182} 182}
183 183
184static struct i2c_gpio_platform_data i2c_gpio_data = { 184static struct i2c_gpio_platform_data i2c_gpio_data = {