diff options
| -rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 134af97ff340..b7f233242315 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
| @@ -347,6 +347,111 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
| 347 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | 347 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} |
| 348 | #endif | 348 | #endif |
| 349 | 349 | ||
| 350 | /* -------------------------------------------------------------------- | ||
| 351 | * Compact Flash (PCMCIA or IDE) | ||
| 352 | * -------------------------------------------------------------------- */ | ||
| 353 | |||
| 354 | #if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) || \ | ||
| 355 | defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) | ||
| 356 | |||
| 357 | static struct at91_cf_data cf0_data; | ||
| 358 | |||
| 359 | static struct resource cf0_resources[] = { | ||
| 360 | [0] = { | ||
| 361 | .start = AT91_CHIPSELECT_4, | ||
| 362 | .end = AT91_CHIPSELECT_4 + SZ_256M - 1, | ||
| 363 | .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT, | ||
| 364 | } | ||
| 365 | }; | ||
| 366 | |||
| 367 | static struct platform_device cf0_device = { | ||
| 368 | .id = 0, | ||
| 369 | .dev = { | ||
| 370 | .platform_data = &cf0_data, | ||
| 371 | }, | ||
| 372 | .resource = cf0_resources, | ||
| 373 | .num_resources = ARRAY_SIZE(cf0_resources), | ||
| 374 | }; | ||
| 375 | |||
| 376 | static struct at91_cf_data cf1_data; | ||
| 377 | |||
| 378 | static struct resource cf1_resources[] = { | ||
| 379 | [0] = { | ||
| 380 | .start = AT91_CHIPSELECT_5, | ||
| 381 | .end = AT91_CHIPSELECT_5 + SZ_256M - 1, | ||
| 382 | .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT, | ||
| 383 | } | ||
| 384 | }; | ||
| 385 | |||
| 386 | static struct platform_device cf1_device = { | ||
| 387 | .id = 1, | ||
| 388 | .dev = { | ||
| 389 | .platform_data = &cf1_data, | ||
| 390 | }, | ||
| 391 | .resource = cf1_resources, | ||
| 392 | .num_resources = ARRAY_SIZE(cf1_resources), | ||
| 393 | }; | ||
| 394 | |||
| 395 | void __init at91_add_device_cf(struct at91_cf_data *data) | ||
| 396 | { | ||
| 397 | unsigned long ebi0_csa; | ||
| 398 | struct platform_device *pdev; | ||
| 399 | |||
| 400 | if (!data) | ||
| 401 | return; | ||
| 402 | |||
| 403 | /* | ||
| 404 | * assign CS4 or CS5 to SMC with Compact Flash logic support, | ||
| 405 | * we assume SMC timings are configured by board code, | ||
| 406 | * except True IDE where timings are controlled by driver | ||
| 407 | */ | ||
| 408 | ebi0_csa = at91_sys_read(AT91_MATRIX_EBI0CSA); | ||
| 409 | switch (data->chipselect) { | ||
| 410 | case 4: | ||
| 411 | at91_set_A_periph(AT91_PIN_PD6, 0); /* EBI0_NCS4/CFCS0 */ | ||
| 412 | ebi0_csa |= AT91_MATRIX_EBI0_CS4A_SMC_CF1; | ||
| 413 | cf0_data = *data; | ||
| 414 | pdev = &cf0_device; | ||
| 415 | break; | ||
| 416 | case 5: | ||
| 417 | at91_set_A_periph(AT91_PIN_PD7, 0); /* EBI0_NCS5/CFCS1 */ | ||
| 418 | ebi0_csa |= AT91_MATRIX_EBI0_CS5A_SMC_CF2; | ||
| 419 | cf1_data = *data; | ||
| 420 | pdev = &cf1_device; | ||
| 421 | break; | ||
| 422 | default: | ||
| 423 | printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n", | ||
| 424 | data->chipselect); | ||
| 425 | return; | ||
| 426 | } | ||
| 427 | at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa); | ||
| 428 | |||
| 429 | if (data->det_pin) { | ||
| 430 | at91_set_gpio_input(data->det_pin, 1); | ||
| 431 | at91_set_deglitch(data->det_pin, 1); | ||
| 432 | } | ||
| 433 | |||
| 434 | if (data->irq_pin) { | ||
| 435 | at91_set_gpio_input(data->irq_pin, 1); | ||
| 436 | at91_set_deglitch(data->irq_pin, 1); | ||
| 437 | } | ||
| 438 | |||
| 439 | if (data->vcc_pin) | ||
| 440 | /* initially off */ | ||
| 441 | at91_set_gpio_output(data->vcc_pin, 0); | ||
| 442 | |||
| 443 | /* enable EBI controlled pins */ | ||
| 444 | at91_set_A_periph(AT91_PIN_PD5, 1); /* NWAIT */ | ||
| 445 | at91_set_A_periph(AT91_PIN_PD8, 0); /* CFCE1 */ | ||
| 446 | at91_set_A_periph(AT91_PIN_PD9, 0); /* CFCE2 */ | ||
| 447 | at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */ | ||
| 448 | |||
| 449 | pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "at91_ide" : "at91_cf"; | ||
| 450 | platform_device_register(pdev); | ||
| 451 | } | ||
| 452 | #else | ||
| 453 | void __init at91_add_device_cf(struct at91_cf_data *data) {} | ||
| 454 | #endif | ||
| 350 | 455 | ||
| 351 | /* -------------------------------------------------------------------- | 456 | /* -------------------------------------------------------------------- |
| 352 | * NAND / SmartMedia | 457 | * NAND / SmartMedia |
