aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/board-cap9adk.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91/board-cap9adk.c')
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c72
1 files changed, 59 insertions, 13 deletions
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index 201b89392dcc..43b37bc91e5f 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -47,6 +47,7 @@
47#include <mach/at91cap9_matrix.h> 47#include <mach/at91cap9_matrix.h>
48#include <mach/at91sam9_smc.h> 48#include <mach/at91sam9_smc.h>
49 49
50#include "sam9_smc.h"
50#include "generic.h" 51#include "generic.h"
51 52
52 53
@@ -195,6 +196,43 @@ static struct atmel_nand_data __initdata cap9adk_nand_data = {
195#endif 196#endif
196}; 197};
197 198
199static struct sam9_smc_config __initdata cap9adk_nand_smc_config = {
200 .ncs_read_setup = 1,
201 .nrd_setup = 2,
202 .ncs_write_setup = 1,
203 .nwe_setup = 2,
204
205 .ncs_read_pulse = 6,
206 .nrd_pulse = 4,
207 .ncs_write_pulse = 6,
208 .nwe_pulse = 4,
209
210 .read_cycle = 8,
211 .write_cycle = 8,
212
213 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
214 .tdf_cycles = 1,
215};
216
217static void __init cap9adk_add_device_nand(void)
218{
219 unsigned long csa;
220
221 csa = at91_sys_read(AT91_MATRIX_EBICSA);
222 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
223
224 /* setup bus-width (8 or 16) */
225 if (cap9adk_nand_data.bus_width_16)
226 cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_16;
227 else
228 cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_8;
229
230 /* configure chip-select 3 (NAND) */
231 sam9_smc_configure(3, &cap9adk_nand_smc_config);
232
233 at91_add_device_nand(&cap9adk_nand_data);
234}
235
198 236
199/* 237/*
200 * NOR flash 238 * NOR flash
@@ -234,6 +272,24 @@ static struct platform_device cap9adk_nor_flash = {
234 .num_resources = ARRAY_SIZE(nor_flash_resources), 272 .num_resources = ARRAY_SIZE(nor_flash_resources),
235}; 273};
236 274
275static struct sam9_smc_config __initdata cap9adk_nor_smc_config = {
276 .ncs_read_setup = 2,
277 .nrd_setup = 4,
278 .ncs_write_setup = 2,
279 .nwe_setup = 4,
280
281 .ncs_read_pulse = 10,
282 .nrd_pulse = 8,
283 .ncs_write_pulse = 10,
284 .nwe_pulse = 8,
285
286 .read_cycle = 16,
287 .write_cycle = 16,
288
289 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16,
290 .tdf_cycles = 1,
291};
292
237static __init void cap9adk_add_device_nor(void) 293static __init void cap9adk_add_device_nor(void)
238{ 294{
239 unsigned long csa; 295 unsigned long csa;
@@ -241,18 +297,8 @@ static __init void cap9adk_add_device_nor(void)
241 csa = at91_sys_read(AT91_MATRIX_EBICSA); 297 csa = at91_sys_read(AT91_MATRIX_EBICSA);
242 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); 298 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
243 299
244 /* set the bus interface characteristics */ 300 /* configure chip-select 0 (NOR) */
245 at91_sys_write(AT91_SMC_SETUP(0), AT91_SMC_NWESETUP_(4) | AT91_SMC_NCS_WRSETUP_(2) 301 sam9_smc_configure(0, &cap9adk_nor_smc_config);
246 | AT91_SMC_NRDSETUP_(4) | AT91_SMC_NCS_RDSETUP_(2));
247
248 at91_sys_write(AT91_SMC_PULSE(0), AT91_SMC_NWEPULSE_(8) | AT91_SMC_NCS_WRPULSE_(10)
249 | AT91_SMC_NRDPULSE_(8) | AT91_SMC_NCS_RDPULSE_(10));
250
251 at91_sys_write(AT91_SMC_CYCLE(0), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
252
253 at91_sys_write(AT91_SMC_MODE(0), AT91_SMC_READMODE | AT91_SMC_WRITEMODE
254 | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE
255 | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1));
256 302
257 platform_device_register(&cap9adk_nor_flash); 303 platform_device_register(&cap9adk_nor_flash);
258} 304}
@@ -344,7 +390,7 @@ static void __init cap9adk_board_init(void)
344 /* Ethernet */ 390 /* Ethernet */
345 at91_add_device_eth(&cap9adk_macb_data); 391 at91_add_device_eth(&cap9adk_macb_data);
346 /* NAND */ 392 /* NAND */
347 at91_add_device_nand(&cap9adk_nand_data); 393 cap9adk_add_device_nand();
348 /* NOR Flash */ 394 /* NOR Flash */
349 cap9adk_add_device_nor(); 395 cap9adk_add_device_nor();
350 /* I2C */ 396 /* I2C */