aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/board-sam9261ek.c
diff options
context:
space:
mode:
authorAndrew Victor <linux@maxim.org.za>2008-10-06 15:05:35 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-12-01 12:18:13 -0500
commit8cdae51aa951e22bc9134cc94c30d1206c84ea8e (patch)
treede798de64c11336cef860a2c95c2ab998cec5ec4 /arch/arm/mach-at91/board-sam9261ek.c
parent461d3b4dcf2b3b92f819b668d16b36a87046fd98 (diff)
[ARM] 5289/1: [AT91] Convert boards to use sam9_smc_configure()
Convert the SAM9 and CAP9 board-specific files to make use of the sam9_smc_configure() method to configure the memory-controller for external peripherals. The following boards have been modified: cam60 : NAND cap9adk : NAND, NOR qil-a9260 : NAND sam9-l9260 : NAND sam9260ek : NAND sam9261ek : DM9000 Ethernet, NAND sam9263 : NAND sam9g20ek : NAND sam9rlek : NAND usb-a9260 : NAND usb-a9263 .: NAND 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/board-sam9261ek.c')
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c80
1 files changed, 65 insertions, 15 deletions
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 4977409d4fc6..d5266da55311 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -47,7 +47,9 @@
47#include <mach/board.h> 47#include <mach/board.h>
48#include <mach/gpio.h> 48#include <mach/gpio.h>
49#include <mach/at91sam9_smc.h> 49#include <mach/at91sam9_smc.h>
50#include <mach/at91_shdwc.h>
50 51
52#include "sam9_smc.h"
51#include "generic.h" 53#include "generic.h"
52 54
53 55
@@ -76,7 +78,7 @@ static void __init ek_init_irq(void)
76 * DM9000 ethernet device 78 * DM9000 ethernet device
77 */ 79 */
78#if defined(CONFIG_DM9000) 80#if defined(CONFIG_DM9000)
79static struct resource at91sam9261_dm9000_resource[] = { 81static struct resource dm9000_resource[] = {
80 [0] = { 82 [0] = {
81 .start = AT91_CHIPSELECT_2, 83 .start = AT91_CHIPSELECT_2,
82 .end = AT91_CHIPSELECT_2 + 3, 84 .end = AT91_CHIPSELECT_2 + 3,
@@ -98,27 +100,42 @@ static struct dm9000_plat_data dm9000_platdata = {
98 .flags = DM9000_PLATF_16BITONLY, 100 .flags = DM9000_PLATF_16BITONLY,
99}; 101};
100 102
101static struct platform_device at91sam9261_dm9000_device = { 103static struct platform_device dm9000_device = {
102 .name = "dm9000", 104 .name = "dm9000",
103 .id = 0, 105 .id = 0,
104 .num_resources = ARRAY_SIZE(at91sam9261_dm9000_resource), 106 .num_resources = ARRAY_SIZE(dm9000_resource),
105 .resource = at91sam9261_dm9000_resource, 107 .resource = dm9000_resource,
106 .dev = { 108 .dev = {
107 .platform_data = &dm9000_platdata, 109 .platform_data = &dm9000_platdata,
108 } 110 }
109}; 111};
110 112
113/*
114 * SMC timings for the DM9000.
115 * Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
116 */
117static struct sam9_smc_config __initdata dm9000_smc_config = {
118 .ncs_read_setup = 0,
119 .nrd_setup = 2,
120 .ncs_write_setup = 0,
121 .nwe_setup = 2,
122
123 .ncs_read_pulse = 8,
124 .nrd_pulse = 4,
125 .ncs_write_pulse = 8,
126 .nwe_pulse = 4,
127
128 .read_cycle = 16,
129 .write_cycle = 16,
130
131 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16,
132 .tdf_cycles = 1,
133};
134
111static void __init ek_add_device_dm9000(void) 135static void __init ek_add_device_dm9000(void)
112{ 136{
113 /* 137 /* Configure chip-select 2 (DM9000) */
114 * Configure Chip-Select 2 on SMC for the DM9000. 138 sam9_smc_configure(2, &dm9000_smc_config);
115 * Note: These timings were calculated for MASTER_CLOCK = 100000000
116 * according to the DM9000 timings.
117 */
118 at91_sys_write(AT91_SMC_SETUP(2), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(0) | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(0));
119 at91_sys_write(AT91_SMC_PULSE(2), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(8) | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(8));
120 at91_sys_write(AT91_SMC_CYCLE(2), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
121 at91_sys_write(AT91_SMC_MODE(2), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1));
122 139
123 /* Configure Reset signal as output */ 140 /* Configure Reset signal as output */
124 at91_set_gpio_output(AT91_PIN_PC10, 0); 141 at91_set_gpio_output(AT91_PIN_PC10, 0);
@@ -126,7 +143,7 @@ static void __init ek_add_device_dm9000(void)
126 /* Configure Interrupt pin as input, no pull-up */ 143 /* Configure Interrupt pin as input, no pull-up */
127 at91_set_gpio_input(AT91_PIN_PC11, 0); 144 at91_set_gpio_input(AT91_PIN_PC11, 0);
128 145
129 platform_device_register(&at91sam9261_dm9000_device); 146 platform_device_register(&dm9000_device);
130} 147}
131#else 148#else
132static void __init ek_add_device_dm9000(void) {} 149static void __init ek_add_device_dm9000(void) {}
@@ -197,6 +214,39 @@ static struct atmel_nand_data __initdata ek_nand_data = {
197#endif 214#endif
198}; 215};
199 216
217static struct sam9_smc_config __initdata ek_nand_smc_config = {
218 .ncs_read_setup = 0,
219 .nrd_setup = 1,
220 .ncs_write_setup = 0,
221 .nwe_setup = 1,
222
223 .ncs_read_pulse = 3,
224 .nrd_pulse = 3,
225 .ncs_write_pulse = 3,
226 .nwe_pulse = 3,
227
228 .read_cycle = 5,
229 .write_cycle = 5,
230
231 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
232 .tdf_cycles = 2,
233};
234
235static void __init ek_add_device_nand(void)
236{
237 /* setup bus-width (8 or 16) */
238 if (ek_nand_data.bus_width_16)
239 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
240 else
241 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
242
243 /* configure chip-select 3 (NAND) */
244 sam9_smc_configure(3, &ek_nand_smc_config);
245
246 at91_add_device_nand(&ek_nand_data);
247}
248
249
200/* 250/*
201 * ADS7846 Touchscreen 251 * ADS7846 Touchscreen
202 */ 252 */
@@ -525,7 +575,7 @@ static void __init ek_board_init(void)
525 /* I2C */ 575 /* I2C */
526 at91_add_device_i2c(NULL, 0); 576 at91_add_device_i2c(NULL, 0);
527 /* NAND */ 577 /* NAND */
528 at91_add_device_nand(&ek_nand_data); 578 ek_add_device_nand();
529 /* DM9000 ethernet */ 579 /* DM9000 ethernet */
530 ek_add_device_dm9000(); 580 ek_add_device_dm9000();
531 581