diff options
Diffstat (limited to 'arch/arm/mach-at91/sam9_smc.c')
-rw-r--r-- | arch/arm/mach-at91/sam9_smc.c | 47 |
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 | |||
18 | void __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 | } | ||