aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/sam9_smc.c
diff options
context:
space:
mode:
authorAndrew Victor <linux@maxim.org.za>2008-10-13 15:28:13 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-12-01 12:18:08 -0500
commit6781002bec5237ee8ac1e1daeb0ba976e780a884 (patch)
tree4072b3d6f46c3f48db973aefec5e21cc724f7d9a /arch/arm/mach-at91/sam9_smc.c
parent37efe6427dd50e889473fb3c7fcec02dbbd098eb (diff)
[ARM] 5287/2: [AT91] Configuration of Static Memory Controller
Add a structure 'sam9_smc_config' and function sam9_smc_configure() to allow the board-specific files to specify the configuration of the Static Memory Controller per chip-select. This allows the board file to specify timings for NAND flash, NOR flash or other external peripherals. This functionality can be used for all the SAM9 and CAP9 processors. (the AT91RM9200 has a different memory-controller) This patch is based on similar code in the AVR32 architecture. Signed-off-by: Andrew Victor <linux@maxim.org.za> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91/sam9_smc.c')
-rw-r--r--arch/arm/mach-at91/sam9_smc.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c
new file mode 100644
index 000000000000..5eab6aa621d0
--- /dev/null
+++ b/arch/arm/mach-at91/sam9_smc.c
@@ -0,0 +1,47 @@
1/*
2 * linux/arch/arm/mach-at91/sam9_smc.c
3 *
4 * Copyright (C) 2008 Andrew Victor
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
11#include <linux/module.h>
12#include <linux/io.h>
13
14#include <mach/at91sam9_smc.h>
15
16#include "sam9_smc.h"
17
18void __init sam9_smc_configure(int cs, struct sam9_smc_config* config)
19{
20 /* Setup register */
21 at91_sys_write(AT91_SMC_SETUP(cs),
22 AT91_SMC_NWESETUP_(config->nwe_setup)
23 | AT91_SMC_NCS_WRSETUP_(config->ncs_write_setup)
24 | AT91_SMC_NRDSETUP_(config->nrd_setup)
25 | AT91_SMC_NCS_RDSETUP_(config->ncs_read_setup)
26 );
27
28 /* Pulse register */
29 at91_sys_write(AT91_SMC_PULSE(cs),
30 AT91_SMC_NWEPULSE_(config->nwe_pulse)
31 | AT91_SMC_NCS_WRPULSE_(config->ncs_write_pulse)
32 | AT91_SMC_NRDPULSE_(config->nrd_pulse)
33 | AT91_SMC_NCS_RDPULSE_(config->ncs_read_pulse)
34 );
35
36 /* Cycle register */
37 at91_sys_write(AT91_SMC_CYCLE(cs),
38 AT91_SMC_NWECYCLE_(config->write_cycle)
39 | AT91_SMC_NRDCYCLE_(config->read_cycle)
40 );
41
42 /* Mode register */
43 at91_sys_write(AT91_SMC_MODE(cs),
44 config->mode
45 | AT91_SMC_TDF_(config->tdf_cycles)
46 );
47}