aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9rl_devices.c
diff options
context:
space:
mode:
authorAndrew Victor <linux@maxim.org.za>2008-01-23 03:18:06 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-01-26 10:00:31 -0500
commitbfbc32663d4846039f88c0eccc1956587d89c042 (patch)
tree5706e089fe0ab64b66a879100b7391715df5d1ee /arch/arm/mach-at91/at91sam9rl_devices.c
parentc6686ff9df086f9473663c2e61c1173c56788b2e (diff)
[ARM] 4754/1: [AT91] SSC library support
Core support of the Atmel SSC library for all Atmel AT91 processors. Based on David Brownell's initial patch for the AT91RM9200. Signed-off-by: Andrew Victor <linux@maxim.org.za> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91/at91sam9rl_devices.c')
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c129
1 files changed, 129 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index bec8066f9ba1..e886cdfe919d 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -472,6 +472,135 @@ void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
472 472
473 473
474/* -------------------------------------------------------------------- 474/* --------------------------------------------------------------------
475 * SSC -- Synchronous Serial Controller
476 * -------------------------------------------------------------------- */
477
478#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
479static u64 ssc0_dmamask = DMA_BIT_MASK(32);
480
481static struct resource ssc0_resources[] = {
482 [0] = {
483 .start = AT91SAM9RL_BASE_SSC0,
484 .end = AT91SAM9RL_BASE_SSC0 + SZ_16K - 1,
485 .flags = IORESOURCE_MEM,
486 },
487 [1] = {
488 .start = AT91SAM9RL_ID_SSC0,
489 .end = AT91SAM9RL_ID_SSC0,
490 .flags = IORESOURCE_IRQ,
491 },
492};
493
494static struct platform_device at91sam9rl_ssc0_device = {
495 .name = "ssc",
496 .id = 0,
497 .dev = {
498 .dma_mask = &ssc0_dmamask,
499 .coherent_dma_mask = DMA_BIT_MASK(32),
500 },
501 .resource = ssc0_resources,
502 .num_resources = ARRAY_SIZE(ssc0_resources),
503};
504
505static inline void configure_ssc0_pins(unsigned pins)
506{
507 if (pins & ATMEL_SSC_TF)
508 at91_set_A_periph(AT91_PIN_PC0, 1);
509 if (pins & ATMEL_SSC_TK)
510 at91_set_A_periph(AT91_PIN_PC1, 1);
511 if (pins & ATMEL_SSC_TD)
512 at91_set_A_periph(AT91_PIN_PA15, 1);
513 if (pins & ATMEL_SSC_RD)
514 at91_set_A_periph(AT91_PIN_PA16, 1);
515 if (pins & ATMEL_SSC_RK)
516 at91_set_B_periph(AT91_PIN_PA10, 1);
517 if (pins & ATMEL_SSC_RF)
518 at91_set_B_periph(AT91_PIN_PA22, 1);
519}
520
521static u64 ssc1_dmamask = DMA_BIT_MASK(32);
522
523static struct resource ssc1_resources[] = {
524 [0] = {
525 .start = AT91SAM9RL_BASE_SSC1,
526 .end = AT91SAM9RL_BASE_SSC1 + SZ_16K - 1,
527 .flags = IORESOURCE_MEM,
528 },
529 [1] = {
530 .start = AT91SAM9RL_ID_SSC1,
531 .end = AT91SAM9RL_ID_SSC1,
532 .flags = IORESOURCE_IRQ,
533 },
534};
535
536static struct platform_device at91sam9rl_ssc1_device = {
537 .name = "ssc",
538 .id = 1,
539 .dev = {
540 .dma_mask = &ssc1_dmamask,
541 .coherent_dma_mask = DMA_BIT_MASK(32),
542 },
543 .resource = ssc1_resources,
544 .num_resources = ARRAY_SIZE(ssc1_resources),
545};
546
547static inline void configure_ssc1_pins(unsigned pins)
548{
549 if (pins & ATMEL_SSC_TF)
550 at91_set_B_periph(AT91_PIN_PA29, 1);
551 if (pins & ATMEL_SSC_TK)
552 at91_set_B_periph(AT91_PIN_PA30, 1);
553 if (pins & ATMEL_SSC_TD)
554 at91_set_B_periph(AT91_PIN_PA13, 1);
555 if (pins & ATMEL_SSC_RD)
556 at91_set_B_periph(AT91_PIN_PA14, 1);
557 if (pins & ATMEL_SSC_RK)
558 at91_set_B_periph(AT91_PIN_PA9, 1);
559 if (pins & ATMEL_SSC_RF)
560 at91_set_B_periph(AT91_PIN_PA8, 1);
561}
562
563/*
564 * Return the device node so that board init code can use it as the
565 * parent for the device node reflecting how it's used on this board.
566 *
567 * SSC controllers are accessed through library code, instead of any
568 * kind of all-singing/all-dancing driver. For example one could be
569 * used by a particular I2S audio codec's driver, while another one
570 * on the same system might be used by a custom data capture driver.
571 */
572void __init at91_add_device_ssc(unsigned id, unsigned pins)
573{
574 struct platform_device *pdev;
575
576 /*
577 * NOTE: caller is responsible for passing information matching
578 * "pins" to whatever will be using each particular controller.
579 */
580 switch (id) {
581 case AT91SAM9RL_ID_SSC0:
582 pdev = &at91sam9rl_ssc0_device;
583 configure_ssc0_pins(pins);
584 at91_clock_associate("ssc0_clk", &pdev->dev, "pclk");
585 break;
586 case AT91SAM9RL_ID_SSC1:
587 pdev = &at91sam9rl_ssc1_device;
588 configure_ssc1_pins(pins);
589 at91_clock_associate("ssc1_clk", &pdev->dev, "pclk");
590 break;
591 default:
592 return;
593 }
594
595 platform_device_register(pdev);
596}
597
598#else
599void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
600#endif
601
602
603/* --------------------------------------------------------------------
475 * UART 604 * UART
476 * -------------------------------------------------------------------- */ 605 * -------------------------------------------------------------------- */
477 606