diff options
author | Andrew Victor <linux@maxim.org.za> | 2008-01-23 03:18:06 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:00:31 -0500 |
commit | bfbc32663d4846039f88c0eccc1956587d89c042 (patch) | |
tree | 5706e089fe0ab64b66a879100b7391715df5d1ee /arch/arm/mach-at91/at91sam9260_devices.c | |
parent | c6686ff9df086f9473663c2e61c1173c56788b2e (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/at91sam9260_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index c34fde362ad4..2e3db137bc49 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -607,6 +607,85 @@ void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | |||
607 | 607 | ||
608 | 608 | ||
609 | /* -------------------------------------------------------------------- | 609 | /* -------------------------------------------------------------------- |
610 | * SSC -- Synchronous Serial Controller | ||
611 | * -------------------------------------------------------------------- */ | ||
612 | |||
613 | #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) | ||
614 | static u64 ssc_dmamask = DMA_BIT_MASK(32); | ||
615 | |||
616 | static struct resource ssc_resources[] = { | ||
617 | [0] = { | ||
618 | .start = AT91SAM9260_BASE_SSC, | ||
619 | .end = AT91SAM9260_BASE_SSC + SZ_16K - 1, | ||
620 | .flags = IORESOURCE_MEM, | ||
621 | }, | ||
622 | [1] = { | ||
623 | .start = AT91SAM9260_ID_SSC, | ||
624 | .end = AT91SAM9260_ID_SSC, | ||
625 | .flags = IORESOURCE_IRQ, | ||
626 | }, | ||
627 | }; | ||
628 | |||
629 | static struct platform_device at91sam9260_ssc_device = { | ||
630 | .name = "ssc", | ||
631 | .id = 0, | ||
632 | .dev = { | ||
633 | .dma_mask = &ssc_dmamask, | ||
634 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
635 | }, | ||
636 | .resource = ssc_resources, | ||
637 | .num_resources = ARRAY_SIZE(ssc_resources), | ||
638 | }; | ||
639 | |||
640 | static inline void configure_ssc_pins(unsigned pins) | ||
641 | { | ||
642 | if (pins & ATMEL_SSC_TF) | ||
643 | at91_set_A_periph(AT91_PIN_PB17, 1); | ||
644 | if (pins & ATMEL_SSC_TK) | ||
645 | at91_set_A_periph(AT91_PIN_PB16, 1); | ||
646 | if (pins & ATMEL_SSC_TD) | ||
647 | at91_set_A_periph(AT91_PIN_PB18, 1); | ||
648 | if (pins & ATMEL_SSC_RD) | ||
649 | at91_set_A_periph(AT91_PIN_PB19, 1); | ||
650 | if (pins & ATMEL_SSC_RK) | ||
651 | at91_set_A_periph(AT91_PIN_PB20, 1); | ||
652 | if (pins & ATMEL_SSC_RF) | ||
653 | at91_set_A_periph(AT91_PIN_PB21, 1); | ||
654 | } | ||
655 | |||
656 | /* | ||
657 | * SSC controllers are accessed through library code, instead of any | ||
658 | * kind of all-singing/all-dancing driver. For example one could be | ||
659 | * used by a particular I2S audio codec's driver, while another one | ||
660 | * on the same system might be used by a custom data capture driver. | ||
661 | */ | ||
662 | void __init at91_add_device_ssc(unsigned id, unsigned pins) | ||
663 | { | ||
664 | struct platform_device *pdev; | ||
665 | |||
666 | /* | ||
667 | * NOTE: caller is responsible for passing information matching | ||
668 | * "pins" to whatever will be using each particular controller. | ||
669 | */ | ||
670 | switch (id) { | ||
671 | case AT91SAM9260_ID_SSC: | ||
672 | pdev = &at91sam9260_ssc_device; | ||
673 | configure_ssc_pins(pins); | ||
674 | at91_clock_associate("ssc_clk", &pdev->dev, "pclk"); | ||
675 | break; | ||
676 | default: | ||
677 | return; | ||
678 | } | ||
679 | |||
680 | platform_device_register(pdev); | ||
681 | } | ||
682 | |||
683 | #else | ||
684 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | ||
685 | #endif | ||
686 | |||
687 | |||
688 | /* -------------------------------------------------------------------- | ||
610 | * UART | 689 | * UART |
611 | * -------------------------------------------------------------------- */ | 690 | * -------------------------------------------------------------------- */ |
612 | #if defined(CONFIG_SERIAL_ATMEL) | 691 | #if defined(CONFIG_SERIAL_ATMEL) |