Merge remote-tracking branch 's5p/for-next'
[linux-2.6/next.git] / arch / arm / mach-at91 / sam9_smc.c
blob5eab6aa621d070dd251411c6523ade62a3402962
1 /*
2 * linux/arch/arm/mach-at91/sam9_smc.c
4 * Copyright (C) 2008 Andrew Victor
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 */
11 #include <linux/module.h>
12 #include <linux/io.h>
14 #include <mach/at91sam9_smc.h>
16 #include "sam9_smc.h"
18 void __init sam9_smc_configure(int cs, struct sam9_smc_config* config)
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)
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)
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)
42 /* Mode register */
43 at91_sys_write(AT91_SMC_MODE(cs),
44 config->mode
45 | AT91_SMC_TDF_(config->tdf_cycles)