aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Victor <andrew@sanpeople.com>2006-12-01 09:53:20 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-12-01 11:56:44 -0500
commit69c5eccd164200a17b5a24e594b37958d39d2933 (patch)
treea293b139e14bdd5ecfd019cf3337374e32871217
parent58a0cd7887cd689ae42540dd12b3b3131abfbe6c (diff)
[ARM] 3966/1: AT91: RM9200 device data update
This patch contains various updates the at91rm9200_devices.c file: * Consistent naming of resources and platform_devices. * PCMCIA/Compact Flash: Configuration of the memory controller moved out of the driver and into this file. * MMC: Enable the VCC pin (if one is configured) * MMC: Enable the internal pullups on the I/O pins. * NAND: Configuration of the memory controller moved out of the driver and into this file. * Added TWI/I2C resources. * The names of some of the CONFIG_ variables were changed. Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-at91rm9200/at91rm9200_devices.c158
1 files changed, 110 insertions, 48 deletions
diff --git a/arch/arm/mach-at91rm9200/at91rm9200_devices.c b/arch/arm/mach-at91rm9200/at91rm9200_devices.c
index 2b3a23605bf3..4641b99db0ee 100644
--- a/arch/arm/mach-at91rm9200/at91rm9200_devices.c
+++ b/arch/arm/mach-at91rm9200/at91rm9200_devices.c
@@ -15,9 +15,10 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <asm/hardware.h>
19#include <asm/arch/board.h> 18#include <asm/arch/board.h>
20#include <asm/arch/gpio.h> 19#include <asm/arch/gpio.h>
20#include <asm/arch/at91rm9200.h>
21#include <asm/arch/at91rm9200_mc.h>
21 22
22#include "generic.h" 23#include "generic.h"
23 24
@@ -33,7 +34,7 @@
33static u64 ohci_dmamask = 0xffffffffUL; 34static u64 ohci_dmamask = 0xffffffffUL;
34static struct at91_usbh_data usbh_data; 35static struct at91_usbh_data usbh_data;
35 36
36static struct resource at91_usbh_resources[] = { 37static struct resource usbh_resources[] = {
37 [0] = { 38 [0] = {
38 .start = AT91RM9200_UHP_BASE, 39 .start = AT91RM9200_UHP_BASE,
39 .end = AT91RM9200_UHP_BASE + SZ_1M - 1, 40 .end = AT91RM9200_UHP_BASE + SZ_1M - 1,
@@ -54,8 +55,8 @@ static struct platform_device at91rm9200_usbh_device = {
54 .coherent_dma_mask = 0xffffffff, 55 .coherent_dma_mask = 0xffffffff,
55 .platform_data = &usbh_data, 56 .platform_data = &usbh_data,
56 }, 57 },
57 .resource = at91_usbh_resources, 58 .resource = usbh_resources,
58 .num_resources = ARRAY_SIZE(at91_usbh_resources), 59 .num_resources = ARRAY_SIZE(usbh_resources),
59}; 60};
60 61
61void __init at91_add_device_usbh(struct at91_usbh_data *data) 62void __init at91_add_device_usbh(struct at91_usbh_data *data)
@@ -78,7 +79,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
78#ifdef CONFIG_USB_GADGET_AT91 79#ifdef CONFIG_USB_GADGET_AT91
79static struct at91_udc_data udc_data; 80static struct at91_udc_data udc_data;
80 81
81static struct resource at91_udc_resources[] = { 82static struct resource udc_resources[] = {
82 [0] = { 83 [0] = {
83 .start = AT91RM9200_BASE_UDP, 84 .start = AT91RM9200_BASE_UDP,
84 .end = AT91RM9200_BASE_UDP + SZ_16K - 1, 85 .end = AT91RM9200_BASE_UDP + SZ_16K - 1,
@@ -97,8 +98,8 @@ static struct platform_device at91rm9200_udc_device = {
97 .dev = { 98 .dev = {
98 .platform_data = &udc_data, 99 .platform_data = &udc_data,
99 }, 100 },
100 .resource = at91_udc_resources, 101 .resource = udc_resources,
101 .num_resources = ARRAY_SIZE(at91_udc_resources), 102 .num_resources = ARRAY_SIZE(udc_resources),
102}; 103};
103 104
104void __init at91_add_device_udc(struct at91_udc_data *data) 105void __init at91_add_device_udc(struct at91_udc_data *data)
@@ -129,7 +130,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
129static u64 eth_dmamask = 0xffffffffUL; 130static u64 eth_dmamask = 0xffffffffUL;
130static struct at91_eth_data eth_data; 131static struct at91_eth_data eth_data;
131 132
132static struct resource at91_eth_resources[] = { 133static struct resource eth_resources[] = {
133 [0] = { 134 [0] = {
134 .start = AT91_VA_BASE_EMAC, 135 .start = AT91_VA_BASE_EMAC,
135 .end = AT91_VA_BASE_EMAC + SZ_16K - 1, 136 .end = AT91_VA_BASE_EMAC + SZ_16K - 1,
@@ -150,8 +151,8 @@ static struct platform_device at91rm9200_eth_device = {
150 .coherent_dma_mask = 0xffffffff, 151 .coherent_dma_mask = 0xffffffff,
151 .platform_data = &eth_data, 152 .platform_data = &eth_data,
152 }, 153 },
153 .resource = at91_eth_resources, 154 .resource = eth_resources,
154 .num_resources = ARRAY_SIZE(at91_eth_resources), 155 .num_resources = ARRAY_SIZE(eth_resources),
155}; 156};
156 157
157void __init at91_add_device_eth(struct at91_eth_data *data) 158void __init at91_add_device_eth(struct at91_eth_data *data)
@@ -202,11 +203,13 @@ void __init at91_add_device_eth(struct at91_eth_data *data) {}
202#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) 203#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
203static struct at91_cf_data cf_data; 204static struct at91_cf_data cf_data;
204 205
205static struct resource at91_cf_resources[] = { 206#define CF_BASE AT91_CHIPSELECT_4
207
208static struct resource cf_resources[] = {
206 [0] = { 209 [0] = {
207 .start = AT91_CF_BASE, 210 .start = CF_BASE,
208 /* ties up CS4, CS5 and CS6 */ 211 /* ties up CS4, CS5 and CS6 */
209 .end = AT91_CF_BASE + (0x30000000 - 1), 212 .end = CF_BASE + (0x30000000 - 1),
210 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT, 213 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
211 }, 214 },
212}; 215};
@@ -217,15 +220,38 @@ static struct platform_device at91rm9200_cf_device = {
217 .dev = { 220 .dev = {
218 .platform_data = &cf_data, 221 .platform_data = &cf_data,
219 }, 222 },
220 .resource = at91_cf_resources, 223 .resource = cf_resources,
221 .num_resources = ARRAY_SIZE(at91_cf_resources), 224 .num_resources = ARRAY_SIZE(cf_resources),
222}; 225};
223 226
224void __init at91_add_device_cf(struct at91_cf_data *data) 227void __init at91_add_device_cf(struct at91_cf_data *data)
225{ 228{
229 unsigned int csa;
230
226 if (!data) 231 if (!data)
227 return; 232 return;
228 233
234 data->chipselect = 4; /* can only use EBI ChipSelect 4 */
235
236 /* CF takes over CS4, CS5, CS6 */
237 csa = at91_sys_read(AT91_EBI_CSA);
238 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH);
239
240 /*
241 * Static memory controller timing adjustments.
242 * REVISIT: these timings are in terms of MCK cycles, so
243 * when MCK changes (cpufreq etc) so must these values...
244 */
245 at91_sys_write(AT91_SMC_CSR(4),
246 AT91_SMC_ACSS_STD
247 | AT91_SMC_DBW_16
248 | AT91_SMC_BAT
249 | AT91_SMC_WSEN
250 | AT91_SMC_NWS_(32) /* wait states */
251 | AT91_SMC_RWSETUP_(6) /* setup time */
252 | AT91_SMC_RWHOLD_(4) /* hold time */
253 );
254
229 /* input/irq */ 255 /* input/irq */
230 if (data->irq_pin) { 256 if (data->irq_pin) {
231 at91_set_gpio_input(data->irq_pin, 1); 257 at91_set_gpio_input(data->irq_pin, 1);
@@ -245,6 +271,9 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
245 at91_set_A_periph(AT91_PIN_PC11, 0); /* NCS5/CFCE1 */ 271 at91_set_A_periph(AT91_PIN_PC11, 0); /* NCS5/CFCE1 */
246 at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */ 272 at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */
247 273
274 /* nWAIT is _not_ a default setting */
275 at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */
276
248 cf_data = *data; 277 cf_data = *data;
249 platform_device_register(&at91rm9200_cf_device); 278 platform_device_register(&at91rm9200_cf_device);
250} 279}
@@ -257,11 +286,11 @@ void __init at91_add_device_cf(struct at91_cf_data *data) {}
257 * MMC / SD 286 * MMC / SD
258 * -------------------------------------------------------------------- */ 287 * -------------------------------------------------------------------- */
259 288
260#if defined(CONFIG_MMC_AT91RM9200) || defined(CONFIG_MMC_AT91RM9200_MODULE) 289#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
261static u64 mmc_dmamask = 0xffffffffUL; 290static u64 mmc_dmamask = 0xffffffffUL;
262static struct at91_mmc_data mmc_data; 291static struct at91_mmc_data mmc_data;
263 292
264static struct resource at91_mmc_resources[] = { 293static struct resource mmc_resources[] = {
265 [0] = { 294 [0] = {
266 .start = AT91RM9200_BASE_MCI, 295 .start = AT91RM9200_BASE_MCI,
267 .end = AT91RM9200_BASE_MCI + SZ_16K - 1, 296 .end = AT91RM9200_BASE_MCI + SZ_16K - 1,
@@ -282,8 +311,8 @@ static struct platform_device at91rm9200_mmc_device = {
282 .coherent_dma_mask = 0xffffffff, 311 .coherent_dma_mask = 0xffffffff,
283 .platform_data = &mmc_data, 312 .platform_data = &mmc_data,
284 }, 313 },
285 .resource = at91_mmc_resources, 314 .resource = mmc_resources,
286 .num_resources = ARRAY_SIZE(at91_mmc_resources), 315 .num_resources = ARRAY_SIZE(mmc_resources),
287}; 316};
288 317
289void __init at91_add_device_mmc(struct at91_mmc_data *data) 318void __init at91_add_device_mmc(struct at91_mmc_data *data)
@@ -298,31 +327,33 @@ void __init at91_add_device_mmc(struct at91_mmc_data *data)
298 } 327 }
299 if (data->wp_pin) 328 if (data->wp_pin)
300 at91_set_gpio_input(data->wp_pin, 1); 329 at91_set_gpio_input(data->wp_pin, 1);
330 if (data->vcc_pin)
331 at91_set_gpio_output(data->vcc_pin, 0);
301 332
302 /* CLK */ 333 /* CLK */
303 at91_set_A_periph(AT91_PIN_PA27, 0); 334 at91_set_A_periph(AT91_PIN_PA27, 0);
304 335
305 if (data->is_b) { 336 if (data->slot_b) {
306 /* CMD */ 337 /* CMD */
307 at91_set_B_periph(AT91_PIN_PA8, 0); 338 at91_set_B_periph(AT91_PIN_PA8, 1);
308 339
309 /* DAT0, maybe DAT1..DAT3 */ 340 /* DAT0, maybe DAT1..DAT3 */
310 at91_set_B_periph(AT91_PIN_PA9, 0); 341 at91_set_B_periph(AT91_PIN_PA9, 1);
311 if (data->wire4) { 342 if (data->wire4) {
312 at91_set_B_periph(AT91_PIN_PA10, 0); 343 at91_set_B_periph(AT91_PIN_PA10, 1);
313 at91_set_B_periph(AT91_PIN_PA11, 0); 344 at91_set_B_periph(AT91_PIN_PA11, 1);
314 at91_set_B_periph(AT91_PIN_PA12, 0); 345 at91_set_B_periph(AT91_PIN_PA12, 1);
315 } 346 }
316 } else { 347 } else {
317 /* CMD */ 348 /* CMD */
318 at91_set_A_periph(AT91_PIN_PA28, 0); 349 at91_set_A_periph(AT91_PIN_PA28, 1);
319 350
320 /* DAT0, maybe DAT1..DAT3 */ 351 /* DAT0, maybe DAT1..DAT3 */
321 at91_set_A_periph(AT91_PIN_PA29, 0); 352 at91_set_A_periph(AT91_PIN_PA29, 1);
322 if (data->wire4) { 353 if (data->wire4) {
323 at91_set_B_periph(AT91_PIN_PB3, 0); 354 at91_set_B_periph(AT91_PIN_PB3, 1);
324 at91_set_B_periph(AT91_PIN_PB4, 0); 355 at91_set_B_periph(AT91_PIN_PB4, 1);
325 at91_set_B_periph(AT91_PIN_PB5, 0); 356 at91_set_B_periph(AT91_PIN_PB5, 1);
326 } 357 }
327 } 358 }
328 359
@@ -341,29 +372,45 @@ void __init at91_add_device_mmc(struct at91_mmc_data *data) {}
341#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 372#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
342static struct at91_nand_data nand_data; 373static struct at91_nand_data nand_data;
343 374
344static struct resource at91_nand_resources[] = { 375#define NAND_BASE AT91_CHIPSELECT_3
376
377static struct resource nand_resources[] = {
345 { 378 {
346 .start = AT91_SMARTMEDIA_BASE, 379 .start = NAND_BASE,
347 .end = AT91_SMARTMEDIA_BASE + SZ_8M - 1, 380 .end = NAND_BASE + SZ_8M - 1,
348 .flags = IORESOURCE_MEM, 381 .flags = IORESOURCE_MEM,
349 } 382 }
350}; 383};
351 384
352static struct platform_device at91_nand_device = { 385static struct platform_device at91rm9200_nand_device = {
353 .name = "at91_nand", 386 .name = "at91_nand",
354 .id = -1, 387 .id = -1,
355 .dev = { 388 .dev = {
356 .platform_data = &nand_data, 389 .platform_data = &nand_data,
357 }, 390 },
358 .resource = at91_nand_resources, 391 .resource = nand_resources,
359 .num_resources = ARRAY_SIZE(at91_nand_resources), 392 .num_resources = ARRAY_SIZE(nand_resources),
360}; 393};
361 394
362void __init at91_add_device_nand(struct at91_nand_data *data) 395void __init at91_add_device_nand(struct at91_nand_data *data)
363{ 396{
397 unsigned int csa;
398
364 if (!data) 399 if (!data)
365 return; 400 return;
366 401
402 /* enable the address range of CS3 */
403 csa = at91_sys_read(AT91_EBI_CSA);
404 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS3A_SMC_SMARTMEDIA);
405
406 /* set the bus interface characteristics */
407 at91_sys_write(AT91_SMC_CSR(3), AT91_SMC_ACSS_STD | AT91_SMC_DBW_8 | AT91_SMC_WSEN
408 | AT91_SMC_NWS_(5)
409 | AT91_SMC_TDF_(1)
410 | AT91_SMC_RWSETUP_(0) /* tDS Data Set up Time 30 - ns */
411 | AT91_SMC_RWHOLD_(1) /* tDH Data Hold Time 20 - ns */
412 );
413
367 /* enable pin */ 414 /* enable pin */
368 if (data->enable_pin) 415 if (data->enable_pin)
369 at91_set_gpio_output(data->enable_pin, 1); 416 at91_set_gpio_output(data->enable_pin, 1);
@@ -380,7 +427,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
380 at91_set_A_periph(AT91_PIN_PC3, 0); /* SMWE */ 427 at91_set_A_periph(AT91_PIN_PC3, 0); /* SMWE */
381 428
382 nand_data = *data; 429 nand_data = *data;
383 platform_device_register(&at91_nand_device); 430 platform_device_register(&at91rm9200_nand_device);
384} 431}
385#else 432#else
386void __init at91_add_device_nand(struct at91_nand_data *data) {} 433void __init at91_add_device_nand(struct at91_nand_data *data) {}
@@ -392,10 +439,25 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
392 * -------------------------------------------------------------------- */ 439 * -------------------------------------------------------------------- */
393 440
394#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 441#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
442
443static struct resource twi_resources[] = {
444 [0] = {
445 .start = AT91RM9200_BASE_TWI,
446 .end = AT91RM9200_BASE_TWI + SZ_16K - 1,
447 .flags = IORESOURCE_MEM,
448 },
449 [1] = {
450 .start = AT91RM9200_ID_TWI,
451 .end = AT91RM9200_ID_TWI,
452 .flags = IORESOURCE_IRQ,
453 },
454};
455
395static struct platform_device at91rm9200_twi_device = { 456static struct platform_device at91rm9200_twi_device = {
396 .name = "at91_i2c", 457 .name = "at91_i2c",
397 .id = -1, 458 .id = -1,
398 .num_resources = 0, 459 .resource = twi_resources,
460 .num_resources = ARRAY_SIZE(twi_resources),
399}; 461};
400 462
401void __init at91_add_device_i2c(void) 463void __init at91_add_device_i2c(void)
@@ -421,7 +483,7 @@ void __init at91_add_device_i2c(void) {}
421#if defined(CONFIG_SPI_AT91) || defined(CONFIG_SPI_AT91_MODULE) || defined(CONFIG_AT91_SPI) || defined(CONFIG_AT91_SPI_MODULE) 483#if defined(CONFIG_SPI_AT91) || defined(CONFIG_SPI_AT91_MODULE) || defined(CONFIG_AT91_SPI) || defined(CONFIG_AT91_SPI_MODULE)
422static u64 spi_dmamask = 0xffffffffUL; 484static u64 spi_dmamask = 0xffffffffUL;
423 485
424static struct resource at91_spi_resources[] = { 486static struct resource spi_resources[] = {
425 [0] = { 487 [0] = {
426 .start = AT91RM9200_BASE_SPI, 488 .start = AT91RM9200_BASE_SPI,
427 .end = AT91RM9200_BASE_SPI + SZ_16K - 1, 489 .end = AT91RM9200_BASE_SPI + SZ_16K - 1,
@@ -438,14 +500,14 @@ static struct platform_device at91rm9200_spi_device = {
438 .name = "at91_spi", 500 .name = "at91_spi",
439 .id = 0, 501 .id = 0,
440 .dev = { 502 .dev = {
441 .dma_mask = &spi_dmamask, 503 .dma_mask = &spi_dmamask,
442 .coherent_dma_mask = 0xffffffff, 504 .coherent_dma_mask = 0xffffffff,
443 }, 505 },
444 .resource = at91_spi_resources, 506 .resource = spi_resources,
445 .num_resources = ARRAY_SIZE(at91_spi_resources), 507 .num_resources = ARRAY_SIZE(spi_resources),
446}; 508};
447 509
448static const unsigned at91_spi_standard_cs[4] = { AT91_PIN_PA3, AT91_PIN_PA4, AT91_PIN_PA5, AT91_PIN_PA6 }; 510static const unsigned spi_standard_cs[4] = { AT91_PIN_PA3, AT91_PIN_PA4, AT91_PIN_PA5, AT91_PIN_PA6 };
449 511
450void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) 512void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
451{ 513{
@@ -461,7 +523,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
461 if (devices[i].controller_data) 523 if (devices[i].controller_data)
462 cs_pin = (unsigned long) devices[i].controller_data; 524 cs_pin = (unsigned long) devices[i].controller_data;
463 else 525 else
464 cs_pin = at91_spi_standard_cs[devices[i].chip_select]; 526 cs_pin = spi_standard_cs[devices[i].chip_select];
465 527
466#ifdef CONFIG_SPI_AT91_MANUAL_CS 528#ifdef CONFIG_SPI_AT91_MANUAL_CS
467 at91_set_gpio_output(cs_pin, 1); 529 at91_set_gpio_output(cs_pin, 1);
@@ -474,7 +536,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
474 } 536 }
475 537
476 spi_register_board_info(devices, nr_devices); 538 spi_register_board_info(devices, nr_devices);
477 at91_clock_associate("spi0_clk", &at91rm9200_spi_device.dev, "spi"); 539 at91_clock_associate("spi_clk", &at91rm9200_spi_device.dev, "spi");
478 platform_device_register(&at91rm9200_spi_device); 540 platform_device_register(&at91rm9200_spi_device);
479} 541}
480#else 542#else
@@ -486,7 +548,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
486 * RTC 548 * RTC
487 * -------------------------------------------------------------------- */ 549 * -------------------------------------------------------------------- */
488 550
489#if defined(CONFIG_RTC_DRV_AT91) || defined(CONFIG_RTC_DRV_AT91_MODULE) 551#if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
490static struct platform_device at91rm9200_rtc_device = { 552static struct platform_device at91rm9200_rtc_device = {
491 .name = "at91_rtc", 553 .name = "at91_rtc",
492 .id = -1, 554 .id = -1,
@@ -506,7 +568,7 @@ static void __init at91_add_device_rtc(void) {}
506 * Watchdog 568 * Watchdog
507 * -------------------------------------------------------------------- */ 569 * -------------------------------------------------------------------- */
508 570
509#if defined(CONFIG_AT91_WATCHDOG) || defined(CONFIG_AT91_WATCHDOG_MODULE) 571#if defined(CONFIG_AT91RM9200_WATCHDOG) || defined(CONFIG_AT91RM9200_WATCHDOG_MODULE)
510static struct platform_device at91rm9200_wdt_device = { 572static struct platform_device at91rm9200_wdt_device = {
511 .name = "at91_wdt", 573 .name = "at91_wdt",
512 .id = -1, 574 .id = -1,