diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-28 15:14:43 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-28 15:14:43 -0400 |
commit | 414f746d232d41ed6ae8632c4495ae795373c44b (patch) | |
tree | 167f9bc8f139c6e82e6732b38c7a938b8a9d31cd /arch/avr32/boards/atstk1000/atstk1002.c | |
parent | 5a7a201c51c324876d00a54e7208af6af12d1ca4 (diff) | |
parent | c9272c4f9fbe2087beb3392f526dc5b19efaa56b (diff) |
Merge branch 'linus' into cpus4096
Diffstat (limited to 'arch/avr32/boards/atstk1000/atstk1002.c')
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1002.c | 97 |
1 files changed, 94 insertions, 3 deletions
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index e11659b732fa..8538ba75ef92 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ATSTK1002 daughterboard-specific init code | 2 | * ATSTK1002/ATSTK1006 daughterboard-specific init code |
3 | * | 3 | * |
4 | * Copyright (C) 2005-2006 Atmel Corporation | 4 | * Copyright (C) 2005-2007 Atmel Corporation |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 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 | 7 | * it under the terms of the GNU General Public License version 2 as |
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <asm/setup.h> | 23 | #include <asm/setup.h> |
24 | #include <asm/atmel-mci.h> | ||
25 | |||
24 | #include <asm/arch/at32ap700x.h> | 26 | #include <asm/arch/at32ap700x.h> |
25 | #include <asm/arch/board.h> | 27 | #include <asm/arch/board.h> |
26 | #include <asm/arch/init.h> | 28 | #include <asm/arch/init.h> |
@@ -35,6 +37,74 @@ unsigned long at32_board_osc_rates[3] = { | |||
35 | [2] = 12000000, /* 12 MHz on osc1 */ | 37 | [2] = 12000000, /* 12 MHz on osc1 */ |
36 | }; | 38 | }; |
37 | 39 | ||
40 | /* | ||
41 | * The ATSTK1006 daughterboard is very similar to the ATSTK1002. Both | ||
42 | * have the AT32AP7000 chip on board; the difference is that the | ||
43 | * STK1006 has 128 MB SDRAM (the STK1002 uses the 8 MB SDRAM chip on | ||
44 | * the STK1000 motherboard) and 256 MB NAND flash (the STK1002 has | ||
45 | * none.) | ||
46 | * | ||
47 | * The RAM difference is handled by the boot loader, so the only | ||
48 | * difference we end up handling here is the NAND flash. | ||
49 | */ | ||
50 | #ifdef CONFIG_BOARD_ATSTK1006 | ||
51 | #include <linux/mtd/partitions.h> | ||
52 | #include <asm/arch/smc.h> | ||
53 | |||
54 | static struct smc_timing nand_timing __initdata = { | ||
55 | .ncs_read_setup = 0, | ||
56 | .nrd_setup = 10, | ||
57 | .ncs_write_setup = 0, | ||
58 | .nwe_setup = 10, | ||
59 | |||
60 | .ncs_read_pulse = 30, | ||
61 | .nrd_pulse = 15, | ||
62 | .ncs_write_pulse = 30, | ||
63 | .nwe_pulse = 15, | ||
64 | |||
65 | .read_cycle = 30, | ||
66 | .write_cycle = 30, | ||
67 | |||
68 | .ncs_read_recover = 0, | ||
69 | .nrd_recover = 15, | ||
70 | .ncs_write_recover = 0, | ||
71 | /* WE# high -> RE# low min 60 ns */ | ||
72 | .nwe_recover = 50, | ||
73 | }; | ||
74 | |||
75 | static struct smc_config nand_config __initdata = { | ||
76 | .bus_width = 1, | ||
77 | .nrd_controlled = 1, | ||
78 | .nwe_controlled = 1, | ||
79 | .nwait_mode = 0, | ||
80 | .byte_write = 0, | ||
81 | .tdf_cycles = 2, | ||
82 | .tdf_mode = 0, | ||
83 | }; | ||
84 | |||
85 | static struct mtd_partition nand_partitions[] = { | ||
86 | { | ||
87 | .name = "main", | ||
88 | .offset = 0x00000000, | ||
89 | .size = MTDPART_SIZ_FULL, | ||
90 | }, | ||
91 | }; | ||
92 | |||
93 | static struct mtd_partition *nand_part_info(int size, int *num_partitions) | ||
94 | { | ||
95 | *num_partitions = ARRAY_SIZE(nand_partitions); | ||
96 | return nand_partitions; | ||
97 | } | ||
98 | |||
99 | struct atmel_nand_data atstk1006_nand_data __initdata = { | ||
100 | .cle = 21, | ||
101 | .ale = 22, | ||
102 | .rdy_pin = GPIO_PIN_PB(30), | ||
103 | .enable_pin = GPIO_PIN_PB(29), | ||
104 | .partition_info = nand_part_info, | ||
105 | }; | ||
106 | #endif | ||
107 | |||
38 | struct eth_addr { | 108 | struct eth_addr { |
39 | u8 addr[6]; | 109 | u8 addr[6]; |
40 | }; | 110 | }; |
@@ -192,6 +262,21 @@ void __init setup_board(void) | |||
192 | at32_setup_serial_console(0); | 262 | at32_setup_serial_console(0); |
193 | } | 263 | } |
194 | 264 | ||
265 | #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | ||
266 | |||
267 | /* MMC card detect requires MACB0 *NOT* be used */ | ||
268 | #ifdef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM | ||
269 | static struct mci_platform_data __initdata mci0_data = { | ||
270 | .detect_pin = GPIO_PIN_PC(14), /* gpio30/sdcd */ | ||
271 | .wp_pin = GPIO_PIN_PC(15), /* gpio31/sdwp */ | ||
272 | }; | ||
273 | #define MCI_PDATA &mci0_data | ||
274 | #else | ||
275 | #define MCI_PDATA NULL | ||
276 | #endif /* SW6 for sd{cd,wp} routing */ | ||
277 | |||
278 | #endif /* SW2 for MMC signal routing */ | ||
279 | |||
195 | static int __init atstk1002_init(void) | 280 | static int __init atstk1002_init(void) |
196 | { | 281 | { |
197 | /* | 282 | /* |
@@ -218,6 +303,12 @@ static int __init atstk1002_init(void) | |||
218 | 303 | ||
219 | at32_add_system_devices(); | 304 | at32_add_system_devices(); |
220 | 305 | ||
306 | #ifdef CONFIG_BOARD_ATSTK1006 | ||
307 | smc_set_timing(&nand_config, &nand_timing); | ||
308 | smc_set_configuration(3, &nand_config); | ||
309 | at32_add_device_nand(0, &atstk1006_nand_data); | ||
310 | #endif | ||
311 | |||
221 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | 312 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM |
222 | at32_add_device_usart(1); | 313 | at32_add_device_usart(1); |
223 | #else | 314 | #else |
@@ -235,7 +326,7 @@ static int __init atstk1002_init(void) | |||
235 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); | 326 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); |
236 | #endif | 327 | #endif |
237 | #ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM | 328 | #ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM |
238 | at32_add_device_mci(0, NULL); | 329 | at32_add_device_mci(0, MCI_PDATA); |
239 | #endif | 330 | #endif |
240 | #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM | 331 | #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM |
241 | set_hw_addr(at32_add_device_eth(1, ð_data[1])); | 332 | set_hw_addr(at32_add_device_eth(1, ð_data[1])); |