diff options
author | Andrew Victor <linux@maxim.org.za> | 2008-10-06 15:05:35 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-12-01 12:18:13 -0500 |
commit | 8cdae51aa951e22bc9134cc94c30d1206c84ea8e (patch) | |
tree | de798de64c11336cef860a2c95c2ab998cec5ec4 | |
parent | 461d3b4dcf2b3b92f819b668d16b36a87046fd98 (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>
-rw-r--r-- | arch/arm/mach-at91/board-cam60.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-cap9adk.c | 72 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-qil-a9260.c | 35 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9-l9260.c | 35 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9260ek.c | 37 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9261ek.c | 80 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9263ek.c | 36 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9g20ek.c | 36 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9rlek.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-usb-a9260.c | 35 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-usb-a9263.c | 36 |
11 files changed, 405 insertions, 59 deletions
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c index cdddca54b938..d3ba29c5d8c8 100644 --- a/arch/arm/mach-at91/board-cam60.c +++ b/arch/arm/mach-at91/board-cam60.c | |||
@@ -39,7 +39,9 @@ | |||
39 | 39 | ||
40 | #include <mach/board.h> | 40 | #include <mach/board.h> |
41 | #include <mach/gpio.h> | 41 | #include <mach/gpio.h> |
42 | #include <mach/at91sam9_smc.h> | ||
42 | 43 | ||
44 | #include "sam9_smc.h" | ||
43 | #include "generic.h" | 45 | #include "generic.h" |
44 | 46 | ||
45 | 47 | ||
@@ -151,6 +153,32 @@ static struct atmel_nand_data __initdata cam60_nand_data = { | |||
151 | .partition_info = nand_partitions, | 153 | .partition_info = nand_partitions, |
152 | }; | 154 | }; |
153 | 155 | ||
156 | static struct sam9_smc_config __initdata cam60_nand_smc_config = { | ||
157 | .ncs_read_setup = 0, | ||
158 | .nrd_setup = 1, | ||
159 | .ncs_write_setup = 0, | ||
160 | .nwe_setup = 1, | ||
161 | |||
162 | .ncs_read_pulse = 3, | ||
163 | .nrd_pulse = 3, | ||
164 | .ncs_write_pulse = 3, | ||
165 | .nwe_pulse = 3, | ||
166 | |||
167 | .read_cycle = 5, | ||
168 | .write_cycle = 5, | ||
169 | |||
170 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | ||
171 | .tdf_cycles = 2, | ||
172 | }; | ||
173 | |||
174 | static void __init cam60_add_device_nand(void) | ||
175 | { | ||
176 | /* configure chip-select 3 (NAND) */ | ||
177 | sam9_smc_configure(3, &cam60_nand_smc_config); | ||
178 | |||
179 | at91_add_device_nand(&cam60_nand_data); | ||
180 | } | ||
181 | |||
154 | 182 | ||
155 | static void __init cam60_board_init(void) | 183 | static void __init cam60_board_init(void) |
156 | { | 184 | { |
@@ -165,7 +193,7 @@ static void __init cam60_board_init(void) | |||
165 | at91_set_gpio_output(AT91_PIN_PB18, 1); | 193 | at91_set_gpio_output(AT91_PIN_PB18, 1); |
166 | at91_add_device_usbh(&cam60_usbh_data); | 194 | at91_add_device_usbh(&cam60_usbh_data); |
167 | /* NAND */ | 195 | /* NAND */ |
168 | at91_add_device_nand(&cam60_nand_data); | 196 | cam60_add_device_nand(); |
169 | } | 197 | } |
170 | 198 | ||
171 | MACHINE_START(CAM60, "KwikByte CAM60") | 199 | MACHINE_START(CAM60, "KwikByte CAM60") |
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c index 201b89392dcc..43b37bc91e5f 100644 --- a/arch/arm/mach-at91/board-cap9adk.c +++ b/arch/arm/mach-at91/board-cap9adk.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <mach/at91cap9_matrix.h> | 47 | #include <mach/at91cap9_matrix.h> |
48 | #include <mach/at91sam9_smc.h> | 48 | #include <mach/at91sam9_smc.h> |
49 | 49 | ||
50 | #include "sam9_smc.h" | ||
50 | #include "generic.h" | 51 | #include "generic.h" |
51 | 52 | ||
52 | 53 | ||
@@ -195,6 +196,43 @@ static struct atmel_nand_data __initdata cap9adk_nand_data = { | |||
195 | #endif | 196 | #endif |
196 | }; | 197 | }; |
197 | 198 | ||
199 | static struct sam9_smc_config __initdata cap9adk_nand_smc_config = { | ||
200 | .ncs_read_setup = 1, | ||
201 | .nrd_setup = 2, | ||
202 | .ncs_write_setup = 1, | ||
203 | .nwe_setup = 2, | ||
204 | |||
205 | .ncs_read_pulse = 6, | ||
206 | .nrd_pulse = 4, | ||
207 | .ncs_write_pulse = 6, | ||
208 | .nwe_pulse = 4, | ||
209 | |||
210 | .read_cycle = 8, | ||
211 | .write_cycle = 8, | ||
212 | |||
213 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, | ||
214 | .tdf_cycles = 1, | ||
215 | }; | ||
216 | |||
217 | static void __init cap9adk_add_device_nand(void) | ||
218 | { | ||
219 | unsigned long csa; | ||
220 | |||
221 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | ||
222 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); | ||
223 | |||
224 | /* setup bus-width (8 or 16) */ | ||
225 | if (cap9adk_nand_data.bus_width_16) | ||
226 | cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_16; | ||
227 | else | ||
228 | cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_8; | ||
229 | |||
230 | /* configure chip-select 3 (NAND) */ | ||
231 | sam9_smc_configure(3, &cap9adk_nand_smc_config); | ||
232 | |||
233 | at91_add_device_nand(&cap9adk_nand_data); | ||
234 | } | ||
235 | |||
198 | 236 | ||
199 | /* | 237 | /* |
200 | * NOR flash | 238 | * NOR flash |
@@ -234,6 +272,24 @@ static struct platform_device cap9adk_nor_flash = { | |||
234 | .num_resources = ARRAY_SIZE(nor_flash_resources), | 272 | .num_resources = ARRAY_SIZE(nor_flash_resources), |
235 | }; | 273 | }; |
236 | 274 | ||
275 | static struct sam9_smc_config __initdata cap9adk_nor_smc_config = { | ||
276 | .ncs_read_setup = 2, | ||
277 | .nrd_setup = 4, | ||
278 | .ncs_write_setup = 2, | ||
279 | .nwe_setup = 4, | ||
280 | |||
281 | .ncs_read_pulse = 10, | ||
282 | .nrd_pulse = 8, | ||
283 | .ncs_write_pulse = 10, | ||
284 | .nwe_pulse = 8, | ||
285 | |||
286 | .read_cycle = 16, | ||
287 | .write_cycle = 16, | ||
288 | |||
289 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | AT91_SMC_DBW_16, | ||
290 | .tdf_cycles = 1, | ||
291 | }; | ||
292 | |||
237 | static __init void cap9adk_add_device_nor(void) | 293 | static __init void cap9adk_add_device_nor(void) |
238 | { | 294 | { |
239 | unsigned long csa; | 295 | unsigned long csa; |
@@ -241,18 +297,8 @@ static __init void cap9adk_add_device_nor(void) | |||
241 | csa = at91_sys_read(AT91_MATRIX_EBICSA); | 297 | csa = at91_sys_read(AT91_MATRIX_EBICSA); |
242 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); | 298 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); |
243 | 299 | ||
244 | /* set the bus interface characteristics */ | 300 | /* configure chip-select 0 (NOR) */ |
245 | at91_sys_write(AT91_SMC_SETUP(0), AT91_SMC_NWESETUP_(4) | AT91_SMC_NCS_WRSETUP_(2) | 301 | sam9_smc_configure(0, &cap9adk_nor_smc_config); |
246 | | AT91_SMC_NRDSETUP_(4) | AT91_SMC_NCS_RDSETUP_(2)); | ||
247 | |||
248 | at91_sys_write(AT91_SMC_PULSE(0), AT91_SMC_NWEPULSE_(8) | AT91_SMC_NCS_WRPULSE_(10) | ||
249 | | AT91_SMC_NRDPULSE_(8) | AT91_SMC_NCS_RDPULSE_(10)); | ||
250 | |||
251 | at91_sys_write(AT91_SMC_CYCLE(0), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16)); | ||
252 | |||
253 | at91_sys_write(AT91_SMC_MODE(0), AT91_SMC_READMODE | AT91_SMC_WRITEMODE | ||
254 | | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE | ||
255 | | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1)); | ||
256 | 302 | ||
257 | platform_device_register(&cap9adk_nor_flash); | 303 | platform_device_register(&cap9adk_nor_flash); |
258 | } | 304 | } |
@@ -344,7 +390,7 @@ static void __init cap9adk_board_init(void) | |||
344 | /* Ethernet */ | 390 | /* Ethernet */ |
345 | at91_add_device_eth(&cap9adk_macb_data); | 391 | at91_add_device_eth(&cap9adk_macb_data); |
346 | /* NAND */ | 392 | /* NAND */ |
347 | at91_add_device_nand(&cap9adk_nand_data); | 393 | cap9adk_add_device_nand(); |
348 | /* NOR Flash */ | 394 | /* NOR Flash */ |
349 | cap9adk_add_device_nor(); | 395 | cap9adk_add_device_nor(); |
350 | /* I2C */ | 396 | /* I2C */ |
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c index cfb4571a2e27..4cff9a7e61d2 100644 --- a/arch/arm/mach-at91/board-qil-a9260.c +++ b/arch/arm/mach-at91/board-qil-a9260.c | |||
@@ -41,8 +41,10 @@ | |||
41 | #include <mach/hardware.h> | 41 | #include <mach/hardware.h> |
42 | #include <mach/board.h> | 42 | #include <mach/board.h> |
43 | #include <mach/gpio.h> | 43 | #include <mach/gpio.h> |
44 | #include <mach/at91sam9_smc.h> | ||
44 | #include <mach/at91_shdwc.h> | 45 | #include <mach/at91_shdwc.h> |
45 | 46 | ||
47 | #include "sam9_smc.h" | ||
46 | #include "generic.h" | 48 | #include "generic.h" |
47 | 49 | ||
48 | 50 | ||
@@ -147,13 +149,34 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
147 | .rdy_pin = AT91_PIN_PC13, | 149 | .rdy_pin = AT91_PIN_PC13, |
148 | .enable_pin = AT91_PIN_PC14, | 150 | .enable_pin = AT91_PIN_PC14, |
149 | .partition_info = nand_partitions, | 151 | .partition_info = nand_partitions, |
150 | #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16) | ||
151 | .bus_width_16 = 1, | ||
152 | #else | ||
153 | .bus_width_16 = 0, | ||
154 | #endif | ||
155 | }; | 152 | }; |
156 | 153 | ||
154 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
155 | .ncs_read_setup = 0, | ||
156 | .nrd_setup = 1, | ||
157 | .ncs_write_setup = 0, | ||
158 | .nwe_setup = 1, | ||
159 | |||
160 | .ncs_read_pulse = 3, | ||
161 | .nrd_pulse = 3, | ||
162 | .ncs_write_pulse = 3, | ||
163 | .nwe_pulse = 3, | ||
164 | |||
165 | .read_cycle = 5, | ||
166 | .write_cycle = 5, | ||
167 | |||
168 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | ||
169 | .tdf_cycles = 2, | ||
170 | }; | ||
171 | |||
172 | static void __init ek_add_device_nand(void) | ||
173 | { | ||
174 | /* configure chip-select 3 (NAND) */ | ||
175 | sam9_smc_configure(3, &ek_nand_smc_config); | ||
176 | |||
177 | at91_add_device_nand(&ek_nand_data); | ||
178 | } | ||
179 | |||
157 | /* | 180 | /* |
158 | * MCI (SD/MMC) | 181 | * MCI (SD/MMC) |
159 | */ | 182 | */ |
@@ -227,7 +250,7 @@ static void __init ek_board_init(void) | |||
227 | /* SPI */ | 250 | /* SPI */ |
228 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); | 251 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); |
229 | /* NAND */ | 252 | /* NAND */ |
230 | at91_add_device_nand(&ek_nand_data); | 253 | ek_add_device_nand(); |
231 | /* I2C */ | 254 | /* I2C */ |
232 | at91_add_device_i2c(NULL, 0); | 255 | at91_add_device_i2c(NULL, 0); |
233 | /* Ethernet */ | 256 | /* Ethernet */ |
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c index 99bb4cc23a09..b48346977534 100644 --- a/arch/arm/mach-at91/board-sam9-l9260.c +++ b/arch/arm/mach-at91/board-sam9-l9260.c | |||
@@ -38,7 +38,9 @@ | |||
38 | 38 | ||
39 | #include <mach/board.h> | 39 | #include <mach/board.h> |
40 | #include <mach/gpio.h> | 40 | #include <mach/gpio.h> |
41 | #include <mach/at91sam9_smc.h> | ||
41 | 42 | ||
43 | #include "sam9_smc.h" | ||
42 | #include "generic.h" | 44 | #include "generic.h" |
43 | 45 | ||
44 | 46 | ||
@@ -148,13 +150,34 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
148 | .rdy_pin = AT91_PIN_PC13, | 150 | .rdy_pin = AT91_PIN_PC13, |
149 | .enable_pin = AT91_PIN_PC14, | 151 | .enable_pin = AT91_PIN_PC14, |
150 | .partition_info = nand_partitions, | 152 | .partition_info = nand_partitions, |
151 | #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16) | ||
152 | .bus_width_16 = 1, | ||
153 | #else | ||
154 | .bus_width_16 = 0, | ||
155 | #endif | ||
156 | }; | 153 | }; |
157 | 154 | ||
155 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
156 | .ncs_read_setup = 0, | ||
157 | .nrd_setup = 1, | ||
158 | .ncs_write_setup = 0, | ||
159 | .nwe_setup = 1, | ||
160 | |||
161 | .ncs_read_pulse = 3, | ||
162 | .nrd_pulse = 3, | ||
163 | .ncs_write_pulse = 3, | ||
164 | .nwe_pulse = 3, | ||
165 | |||
166 | .read_cycle = 5, | ||
167 | .write_cycle = 5, | ||
168 | |||
169 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | ||
170 | .tdf_cycles = 2, | ||
171 | }; | ||
172 | |||
173 | static void __init ek_add_device_nand(void) | ||
174 | { | ||
175 | /* configure chip-select 3 (NAND) */ | ||
176 | sam9_smc_configure(3, &ek_nand_smc_config); | ||
177 | |||
178 | at91_add_device_nand(&ek_nand_data); | ||
179 | } | ||
180 | |||
158 | 181 | ||
159 | /* | 182 | /* |
160 | * MCI (SD/MMC) | 183 | * MCI (SD/MMC) |
@@ -178,7 +201,7 @@ static void __init ek_board_init(void) | |||
178 | /* SPI */ | 201 | /* SPI */ |
179 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); | 202 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); |
180 | /* NAND */ | 203 | /* NAND */ |
181 | at91_add_device_nand(&ek_nand_data); | 204 | ek_add_device_nand(); |
182 | /* Ethernet */ | 205 | /* Ethernet */ |
183 | at91_add_device_eth(&ek_macb_data); | 206 | at91_add_device_eth(&ek_macb_data); |
184 | /* MMC */ | 207 | /* MMC */ |
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c index b49eb6e4918a..93a0f8b100eb 100644 --- a/arch/arm/mach-at91/board-sam9260ek.c +++ b/arch/arm/mach-at91/board-sam9260ek.c | |||
@@ -42,7 +42,10 @@ | |||
42 | #include <mach/hardware.h> | 42 | #include <mach/hardware.h> |
43 | #include <mach/board.h> | 43 | #include <mach/board.h> |
44 | #include <mach/gpio.h> | 44 | #include <mach/gpio.h> |
45 | #include <mach/at91sam9_smc.h> | ||
46 | #include <mach/at91_shdwc.h> | ||
45 | 47 | ||
48 | #include "sam9_smc.h" | ||
46 | #include "generic.h" | 49 | #include "generic.h" |
47 | 50 | ||
48 | 51 | ||
@@ -195,6 +198,38 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
195 | #endif | 198 | #endif |
196 | }; | 199 | }; |
197 | 200 | ||
201 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
202 | .ncs_read_setup = 0, | ||
203 | .nrd_setup = 1, | ||
204 | .ncs_write_setup = 0, | ||
205 | .nwe_setup = 1, | ||
206 | |||
207 | .ncs_read_pulse = 3, | ||
208 | .nrd_pulse = 3, | ||
209 | .ncs_write_pulse = 3, | ||
210 | .nwe_pulse = 3, | ||
211 | |||
212 | .read_cycle = 5, | ||
213 | .write_cycle = 5, | ||
214 | |||
215 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, | ||
216 | .tdf_cycles = 2, | ||
217 | }; | ||
218 | |||
219 | static void __init ek_add_device_nand(void) | ||
220 | { | ||
221 | /* setup bus-width (8 or 16) */ | ||
222 | if (ek_nand_data.bus_width_16) | ||
223 | ek_nand_smc_config.mode |= AT91_SMC_DBW_16; | ||
224 | else | ||
225 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | ||
226 | |||
227 | /* configure chip-select 3 (NAND) */ | ||
228 | sam9_smc_configure(3, &ek_nand_smc_config); | ||
229 | |||
230 | at91_add_device_nand(&ek_nand_data); | ||
231 | } | ||
232 | |||
198 | 233 | ||
199 | /* | 234 | /* |
200 | * MCI (SD/MMC) | 235 | * MCI (SD/MMC) |
@@ -303,7 +338,7 @@ static void __init ek_board_init(void) | |||
303 | /* SPI */ | 338 | /* SPI */ |
304 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); | 339 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); |
305 | /* NAND */ | 340 | /* NAND */ |
306 | at91_add_device_nand(&ek_nand_data); | 341 | ek_add_device_nand(); |
307 | /* Ethernet */ | 342 | /* Ethernet */ |
308 | at91_add_device_eth(&ek_macb_data); | 343 | at91_add_device_eth(&ek_macb_data); |
309 | /* MMC */ | 344 | /* MMC */ |
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) |
79 | static struct resource at91sam9261_dm9000_resource[] = { | 81 | static 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 | ||
101 | static struct platform_device at91sam9261_dm9000_device = { | 103 | static 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 | */ | ||
117 | static 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 | |||
111 | static void __init ek_add_device_dm9000(void) | 135 | static 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 |
132 | static void __init ek_add_device_dm9000(void) {} | 149 | static 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 | ||
217 | static 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 | |||
235 | static 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 | ||
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c index 8354015c6a23..57d52528f224 100644 --- a/arch/arm/mach-at91/board-sam9263ek.c +++ b/arch/arm/mach-at91/board-sam9263ek.c | |||
@@ -46,7 +46,9 @@ | |||
46 | #include <mach/board.h> | 46 | #include <mach/board.h> |
47 | #include <mach/gpio.h> | 47 | #include <mach/gpio.h> |
48 | #include <mach/at91sam9_smc.h> | 48 | #include <mach/at91sam9_smc.h> |
49 | #include <mach/at91_shdwc.h> | ||
49 | 50 | ||
51 | #include "sam9_smc.h" | ||
50 | #include "generic.h" | 52 | #include "generic.h" |
51 | 53 | ||
52 | 54 | ||
@@ -203,6 +205,38 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
203 | #endif | 205 | #endif |
204 | }; | 206 | }; |
205 | 207 | ||
208 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
209 | .ncs_read_setup = 0, | ||
210 | .nrd_setup = 1, | ||
211 | .ncs_write_setup = 0, | ||
212 | .nwe_setup = 1, | ||
213 | |||
214 | .ncs_read_pulse = 3, | ||
215 | .nrd_pulse = 3, | ||
216 | .ncs_write_pulse = 3, | ||
217 | .nwe_pulse = 3, | ||
218 | |||
219 | .read_cycle = 5, | ||
220 | .write_cycle = 5, | ||
221 | |||
222 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, | ||
223 | .tdf_cycles = 2, | ||
224 | }; | ||
225 | |||
226 | static void __init ek_add_device_nand(void) | ||
227 | { | ||
228 | /* setup bus-width (8 or 16) */ | ||
229 | if (ek_nand_data.bus_width_16) | ||
230 | ek_nand_smc_config.mode |= AT91_SMC_DBW_16; | ||
231 | else | ||
232 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | ||
233 | |||
234 | /* configure chip-select 3 (NAND) */ | ||
235 | sam9_smc_configure(3, &ek_nand_smc_config); | ||
236 | |||
237 | at91_add_device_nand(&ek_nand_data); | ||
238 | } | ||
239 | |||
206 | 240 | ||
207 | /* | 241 | /* |
208 | * I2C devices | 242 | * I2C devices |
@@ -385,7 +419,7 @@ static void __init ek_board_init(void) | |||
385 | /* Ethernet */ | 419 | /* Ethernet */ |
386 | at91_add_device_eth(&ek_macb_data); | 420 | at91_add_device_eth(&ek_macb_data); |
387 | /* NAND */ | 421 | /* NAND */ |
388 | at91_add_device_nand(&ek_nand_data); | 422 | ek_add_device_nand(); |
389 | /* I2C */ | 423 | /* I2C */ |
390 | at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); | 424 | at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); |
391 | /* LCD Controller */ | 425 | /* LCD Controller */ |
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c index b588ead14d68..81439fe6fb3d 100644 --- a/arch/arm/mach-at91/board-sam9g20ek.c +++ b/arch/arm/mach-at91/board-sam9g20ek.c | |||
@@ -37,7 +37,9 @@ | |||
37 | 37 | ||
38 | #include <mach/board.h> | 38 | #include <mach/board.h> |
39 | #include <mach/gpio.h> | 39 | #include <mach/gpio.h> |
40 | #include <mach/at91sam9_smc.h> | ||
40 | 41 | ||
42 | #include "sam9_smc.h" | ||
41 | #include "generic.h" | 43 | #include "generic.h" |
42 | 44 | ||
43 | 45 | ||
@@ -156,6 +158,38 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
156 | #endif | 158 | #endif |
157 | }; | 159 | }; |
158 | 160 | ||
161 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
162 | .ncs_read_setup = 0, | ||
163 | .nrd_setup = 2, | ||
164 | .ncs_write_setup = 0, | ||
165 | .nwe_setup = 2, | ||
166 | |||
167 | .ncs_read_pulse = 4, | ||
168 | .nrd_pulse = 4, | ||
169 | .ncs_write_pulse = 4, | ||
170 | .nwe_pulse = 4, | ||
171 | |||
172 | .read_cycle = 7, | ||
173 | .write_cycle = 7, | ||
174 | |||
175 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, | ||
176 | .tdf_cycles = 3, | ||
177 | }; | ||
178 | |||
179 | static void __init ek_add_device_nand(void) | ||
180 | { | ||
181 | /* setup bus-width (8 or 16) */ | ||
182 | if (ek_nand_data.bus_width_16) | ||
183 | ek_nand_smc_config.mode |= AT91_SMC_DBW_16; | ||
184 | else | ||
185 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | ||
186 | |||
187 | /* configure chip-select 3 (NAND) */ | ||
188 | sam9_smc_configure(3, &ek_nand_smc_config); | ||
189 | |||
190 | at91_add_device_nand(&ek_nand_data); | ||
191 | } | ||
192 | |||
159 | 193 | ||
160 | /* | 194 | /* |
161 | * MCI (SD/MMC) | 195 | * MCI (SD/MMC) |
@@ -195,7 +229,7 @@ static void __init ek_board_init(void) | |||
195 | /* SPI */ | 229 | /* SPI */ |
196 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); | 230 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); |
197 | /* NAND */ | 231 | /* NAND */ |
198 | at91_add_device_nand(&ek_nand_data); | 232 | ek_add_device_nand(); |
199 | /* Ethernet */ | 233 | /* Ethernet */ |
200 | at91_add_device_eth(&ek_macb_data); | 234 | at91_add_device_eth(&ek_macb_data); |
201 | /* MMC */ | 235 | /* MMC */ |
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c index 270851864308..9b937ee4815a 100644 --- a/arch/arm/mach-at91/board-sam9rlek.c +++ b/arch/arm/mach-at91/board-sam9rlek.c | |||
@@ -29,8 +29,9 @@ | |||
29 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
30 | #include <mach/board.h> | 30 | #include <mach/board.h> |
31 | #include <mach/gpio.h> | 31 | #include <mach/gpio.h> |
32 | #include <mach/at91sam9_smc.h> | 32 | #include <mach/at91_shdwc.h> |
33 | 33 | ||
34 | #include "sam9_smc.h" | ||
34 | #include "generic.h" | 35 | #include "generic.h" |
35 | 36 | ||
36 | 37 | ||
@@ -103,9 +104,34 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
103 | .rdy_pin = AT91_PIN_PD17, | 104 | .rdy_pin = AT91_PIN_PD17, |
104 | .enable_pin = AT91_PIN_PB6, | 105 | .enable_pin = AT91_PIN_PB6, |
105 | .partition_info = nand_partitions, | 106 | .partition_info = nand_partitions, |
106 | .bus_width_16 = 0, | ||
107 | }; | 107 | }; |
108 | 108 | ||
109 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
110 | .ncs_read_setup = 0, | ||
111 | .nrd_setup = 1, | ||
112 | .ncs_write_setup = 0, | ||
113 | .nwe_setup = 1, | ||
114 | |||
115 | .ncs_read_pulse = 3, | ||
116 | .nrd_pulse = 3, | ||
117 | .ncs_write_pulse = 3, | ||
118 | .nwe_pulse = 3, | ||
119 | |||
120 | .read_cycle = 5, | ||
121 | .write_cycle = 5, | ||
122 | |||
123 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | ||
124 | .tdf_cycles = 2, | ||
125 | }; | ||
126 | |||
127 | static void __init ek_add_device_nand(void) | ||
128 | { | ||
129 | /* configure chip-select 3 (NAND) */ | ||
130 | sam9_smc_configure(3, &ek_nand_smc_config); | ||
131 | |||
132 | at91_add_device_nand(&ek_nand_data); | ||
133 | } | ||
134 | |||
109 | 135 | ||
110 | /* | 136 | /* |
111 | * SPI devices | 137 | * SPI devices |
@@ -188,7 +214,7 @@ static void __init ek_board_init(void) | |||
188 | /* I2C */ | 214 | /* I2C */ |
189 | at91_add_device_i2c(NULL, 0); | 215 | at91_add_device_i2c(NULL, 0); |
190 | /* NAND */ | 216 | /* NAND */ |
191 | at91_add_device_nand(&ek_nand_data); | 217 | ek_add_device_nand(); |
192 | /* SPI */ | 218 | /* SPI */ |
193 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); | 219 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); |
194 | /* MMC */ | 220 | /* MMC */ |
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c index 7c350357333a..d13304c0bc45 100644 --- a/arch/arm/mach-at91/board-usb-a9260.c +++ b/arch/arm/mach-at91/board-usb-a9260.c | |||
@@ -41,8 +41,10 @@ | |||
41 | #include <mach/hardware.h> | 41 | #include <mach/hardware.h> |
42 | #include <mach/board.h> | 42 | #include <mach/board.h> |
43 | #include <mach/gpio.h> | 43 | #include <mach/gpio.h> |
44 | #include <mach/at91sam9_smc.h> | ||
44 | #include <mach/at91_shdwc.h> | 45 | #include <mach/at91_shdwc.h> |
45 | 46 | ||
47 | #include "sam9_smc.h" | ||
46 | #include "generic.h" | 48 | #include "generic.h" |
47 | 49 | ||
48 | 50 | ||
@@ -121,13 +123,34 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
121 | .rdy_pin = AT91_PIN_PC13, | 123 | .rdy_pin = AT91_PIN_PC13, |
122 | .enable_pin = AT91_PIN_PC14, | 124 | .enable_pin = AT91_PIN_PC14, |
123 | .partition_info = nand_partitions, | 125 | .partition_info = nand_partitions, |
124 | #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16) | ||
125 | .bus_width_16 = 1, | ||
126 | #else | ||
127 | .bus_width_16 = 0, | ||
128 | #endif | ||
129 | }; | 126 | }; |
130 | 127 | ||
128 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
129 | .ncs_read_setup = 0, | ||
130 | .nrd_setup = 1, | ||
131 | .ncs_write_setup = 0, | ||
132 | .nwe_setup = 1, | ||
133 | |||
134 | .ncs_read_pulse = 3, | ||
135 | .nrd_pulse = 3, | ||
136 | .ncs_write_pulse = 3, | ||
137 | .nwe_pulse = 3, | ||
138 | |||
139 | .read_cycle = 5, | ||
140 | .write_cycle = 5, | ||
141 | |||
142 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | ||
143 | .tdf_cycles = 2, | ||
144 | }; | ||
145 | |||
146 | static void __init ek_add_device_nand(void) | ||
147 | { | ||
148 | /* configure chip-select 3 (NAND) */ | ||
149 | sam9_smc_configure(3, &ek_nand_smc_config); | ||
150 | |||
151 | at91_add_device_nand(&ek_nand_data); | ||
152 | } | ||
153 | |||
131 | /* | 154 | /* |
132 | * GPIO Buttons | 155 | * GPIO Buttons |
133 | */ | 156 | */ |
@@ -189,7 +212,7 @@ static void __init ek_board_init(void) | |||
189 | /* USB Device */ | 212 | /* USB Device */ |
190 | at91_add_device_udc(&ek_udc_data); | 213 | at91_add_device_udc(&ek_udc_data); |
191 | /* NAND */ | 214 | /* NAND */ |
192 | at91_add_device_nand(&ek_nand_data); | 215 | ek_add_device_nand(); |
193 | /* I2C */ | 216 | /* I2C */ |
194 | at91_add_device_i2c(NULL, 0); | 217 | at91_add_device_i2c(NULL, 0); |
195 | /* Ethernet */ | 218 | /* Ethernet */ |
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c index 391b566c4571..d96405b7d578 100644 --- a/arch/arm/mach-at91/board-usb-a9263.c +++ b/arch/arm/mach-at91/board-usb-a9263.c | |||
@@ -40,8 +40,10 @@ | |||
40 | #include <mach/hardware.h> | 40 | #include <mach/hardware.h> |
41 | #include <mach/board.h> | 41 | #include <mach/board.h> |
42 | #include <mach/gpio.h> | 42 | #include <mach/gpio.h> |
43 | #include <mach/at91sam9_smc.h> | ||
43 | #include <mach/at91_shdwc.h> | 44 | #include <mach/at91_shdwc.h> |
44 | 45 | ||
46 | #include "sam9_smc.h" | ||
45 | #include "generic.h" | 47 | #include "generic.h" |
46 | 48 | ||
47 | 49 | ||
@@ -134,13 +136,35 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
134 | .rdy_pin = AT91_PIN_PA22, | 136 | .rdy_pin = AT91_PIN_PA22, |
135 | .enable_pin = AT91_PIN_PD15, | 137 | .enable_pin = AT91_PIN_PD15, |
136 | .partition_info = nand_partitions, | 138 | .partition_info = nand_partitions, |
137 | #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16) | ||
138 | .bus_width_16 = 1, | ||
139 | #else | ||
140 | .bus_width_16 = 0, | ||
141 | #endif | ||
142 | }; | 139 | }; |
143 | 140 | ||
141 | static struct sam9_smc_config __initdata ek_nand_smc_config = { | ||
142 | .ncs_read_setup = 0, | ||
143 | .nrd_setup = 1, | ||
144 | .ncs_write_setup = 0, | ||
145 | .nwe_setup = 1, | ||
146 | |||
147 | .ncs_read_pulse = 3, | ||
148 | .nrd_pulse = 3, | ||
149 | .ncs_write_pulse = 3, | ||
150 | .nwe_pulse = 3, | ||
151 | |||
152 | .read_cycle = 5, | ||
153 | .write_cycle = 5, | ||
154 | |||
155 | .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8, | ||
156 | .tdf_cycles = 2, | ||
157 | }; | ||
158 | |||
159 | static void __init ek_add_device_nand(void) | ||
160 | { | ||
161 | /* configure chip-select 3 (NAND) */ | ||
162 | sam9_smc_configure(3, &ek_nand_smc_config); | ||
163 | |||
164 | at91_add_device_nand(&ek_nand_data); | ||
165 | } | ||
166 | |||
167 | |||
144 | /* | 168 | /* |
145 | * GPIO Buttons | 169 | * GPIO Buttons |
146 | */ | 170 | */ |
@@ -206,7 +230,7 @@ static void __init ek_board_init(void) | |||
206 | /* Ethernet */ | 230 | /* Ethernet */ |
207 | at91_add_device_eth(&ek_macb_data); | 231 | at91_add_device_eth(&ek_macb_data); |
208 | /* NAND */ | 232 | /* NAND */ |
209 | at91_add_device_nand(&ek_nand_data); | 233 | ek_add_device_nand(); |
210 | /* I2C */ | 234 | /* I2C */ |
211 | at91_add_device_i2c(NULL, 0); | 235 | at91_add_device_i2c(NULL, 0); |
212 | /* Push Buttons */ | 236 | /* Push Buttons */ |