diff options
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r-- | arch/arm/mach-at91/Makefile | 12 | ||||
-rw-r--r-- | arch/arm/mach-at91/sam9_smc.c | 47 | ||||
-rw-r--r-- | arch/arm/mach-at91/sam9_smc.h | 33 |
3 files changed, 86 insertions, 6 deletions
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index cca612d97ca2..f430a64e8610 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
@@ -11,12 +11,12 @@ obj-$(CONFIG_AT91_PMC_UNIT) += clock.o | |||
11 | 11 | ||
12 | # CPU-specific support | 12 | # CPU-specific support |
13 | obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o | 13 | obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o |
14 | obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o | 14 | obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o |
15 | obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o | 15 | obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o |
16 | obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o | 16 | obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o sam9_smc.o |
17 | obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o | 17 | obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o |
18 | obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o | 18 | obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o |
19 | obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o | 19 | obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o sam9_smc.o |
20 | obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o | 20 | obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o |
21 | 21 | ||
22 | # AT91RM9200 board-specific support | 22 | # AT91RM9200 board-specific support |
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 | } | ||
diff --git a/arch/arm/mach-at91/sam9_smc.h b/arch/arm/mach-at91/sam9_smc.h new file mode 100644 index 000000000000..bf72cfb3455b --- /dev/null +++ b/arch/arm/mach-at91/sam9_smc.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-at91/sam9_smc. | ||
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 | struct sam9_smc_config { | ||
12 | /* Setup register */ | ||
13 | u8 ncs_read_setup; | ||
14 | u8 nrd_setup; | ||
15 | u8 ncs_write_setup; | ||
16 | u8 nwe_setup; | ||
17 | |||
18 | /* Pulse register */ | ||
19 | u8 ncs_read_pulse; | ||
20 | u8 nrd_pulse; | ||
21 | u8 ncs_write_pulse; | ||
22 | u8 nwe_pulse; | ||
23 | |||
24 | /* Cycle register */ | ||
25 | u16 read_cycle; | ||
26 | u16 write_cycle; | ||
27 | |||
28 | /* Mode register */ | ||
29 | u32 mode; | ||
30 | u8 tdf_cycles:4; | ||
31 | }; | ||
32 | |||
33 | extern void __init sam9_smc_configure(int cs, struct sam9_smc_config* config); | ||