aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9261_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/at91sam9261_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/at91sam9261_devices.c')
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c173
1 files changed, 173 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index f7f02d15045d..266ccf01be53 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -619,6 +619,179 @@ void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
619 619
620 620
621/* -------------------------------------------------------------------- 621/* --------------------------------------------------------------------
622 * SSC -- Synchronous Serial Controller
623 * -------------------------------------------------------------------- */
624
625#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
626static u64 ssc0_dmamask = DMA_BIT_MASK(32);
627
628static struct resource ssc0_resources[] = {
629 [0] = {
630 .start = AT91SAM9261_BASE_SSC0,
631 .end = AT91SAM9261_BASE_SSC0 + SZ_16K - 1,
632 .flags = IORESOURCE_MEM,
633 },
634 [1] = {
635 .start = AT91SAM9261_ID_SSC0,
636 .end = AT91SAM9261_ID_SSC0,
637 .flags = IORESOURCE_IRQ,
638 },
639};
640
641static struct platform_device at91sam9261_ssc0_device = {
642 .name = "ssc",
643 .id = 0,
644 .dev = {
645 .dma_mask = &ssc0_dmamask,
646 .coherent_dma_mask = DMA_BIT_MASK(32),
647 },
648 .resource = ssc0_resources,
649 .num_resources = ARRAY_SIZE(ssc0_resources),
650};
651
652static inline void configure_ssc0_pins(unsigned pins)
653{
654 if (pins & ATMEL_SSC_TF)
655 at91_set_A_periph(AT91_PIN_PB21, 1);
656 if (pins & ATMEL_SSC_TK)
657 at91_set_A_periph(AT91_PIN_PB22, 1);
658 if (pins & ATMEL_SSC_TD)
659 at91_set_A_periph(AT91_PIN_PB23, 1);
660 if (pins & ATMEL_SSC_RD)
661 at91_set_A_periph(AT91_PIN_PB24, 1);
662 if (pins & ATMEL_SSC_RK)
663 at91_set_A_periph(AT91_PIN_PB25, 1);
664 if (pins & ATMEL_SSC_RF)
665 at91_set_A_periph(AT91_PIN_PB26, 1);
666}
667
668static u64 ssc1_dmamask = DMA_BIT_MASK(32);
669
670static struct resource ssc1_resources[] = {
671 [0] = {
672 .start = AT91SAM9261_BASE_SSC1,
673 .end = AT91SAM9261_BASE_SSC1 + SZ_16K - 1,
674 .flags = IORESOURCE_MEM,
675 },
676 [1] = {
677 .start = AT91SAM9261_ID_SSC1,
678 .end = AT91SAM9261_ID_SSC1,
679 .flags = IORESOURCE_IRQ,
680 },
681};
682
683static struct platform_device at91sam9261_ssc1_device = {
684 .name = "ssc",
685 .id = 1,
686 .dev = {
687 .dma_mask = &ssc1_dmamask,
688 .coherent_dma_mask = DMA_BIT_MASK(32),
689 },
690 .resource = ssc1_resources,
691 .num_resources = ARRAY_SIZE(ssc1_resources),
692};
693
694static inline void configure_ssc1_pins(unsigned pins)
695{
696 if (pins & ATMEL_SSC_TF)
697 at91_set_B_periph(AT91_PIN_PA17, 1);
698 if (pins & ATMEL_SSC_TK)
699 at91_set_B_periph(AT91_PIN_PA18, 1);
700 if (pins & ATMEL_SSC_TD)
701 at91_set_B_periph(AT91_PIN_PA19, 1);
702 if (pins & ATMEL_SSC_RD)
703 at91_set_B_periph(AT91_PIN_PA20, 1);
704 if (pins & ATMEL_SSC_RK)
705 at91_set_B_periph(AT91_PIN_PA21, 1);
706 if (pins & ATMEL_SSC_RF)
707 at91_set_B_periph(AT91_PIN_PA22, 1);
708}
709
710static u64 ssc2_dmamask = DMA_BIT_MASK(32);
711
712static struct resource ssc2_resources[] = {
713 [0] = {
714 .start = AT91SAM9261_BASE_SSC2,
715 .end = AT91SAM9261_BASE_SSC2 + SZ_16K - 1,
716 .flags = IORESOURCE_MEM,
717 },
718 [1] = {
719 .start = AT91SAM9261_ID_SSC2,
720 .end = AT91SAM9261_ID_SSC2,
721 .flags = IORESOURCE_IRQ,
722 },
723};
724
725static struct platform_device at91sam9261_ssc2_device = {
726 .name = "ssc",
727 .id = 2,
728 .dev = {
729 .dma_mask = &ssc2_dmamask,
730 .coherent_dma_mask = DMA_BIT_MASK(32),
731 },
732 .resource = ssc2_resources,
733 .num_resources = ARRAY_SIZE(ssc2_resources),
734};
735
736static inline void configure_ssc2_pins(unsigned pins)
737{
738 if (pins & ATMEL_SSC_TF)
739 at91_set_B_periph(AT91_PIN_PC25, 1);
740 if (pins & ATMEL_SSC_TK)
741 at91_set_B_periph(AT91_PIN_PC26, 1);
742 if (pins & ATMEL_SSC_TD)
743 at91_set_B_periph(AT91_PIN_PC27, 1);
744 if (pins & ATMEL_SSC_RD)
745 at91_set_B_periph(AT91_PIN_PC28, 1);
746 if (pins & ATMEL_SSC_RK)
747 at91_set_B_periph(AT91_PIN_PC29, 1);
748 if (pins & ATMEL_SSC_RF)
749 at91_set_B_periph(AT91_PIN_PC30, 1);
750}
751
752/*
753 * SSC controllers are accessed through library code, instead of any
754 * kind of all-singing/all-dancing driver. For example one could be
755 * used by a particular I2S audio codec's driver, while another one
756 * on the same system might be used by a custom data capture driver.
757 */
758void __init at91_add_device_ssc(unsigned id, unsigned pins)
759{
760 struct platform_device *pdev;
761
762 /*
763 * NOTE: caller is responsible for passing information matching
764 * "pins" to whatever will be using each particular controller.
765 */
766 switch (id) {
767 case AT91SAM9261_ID_SSC0:
768 pdev = &at91sam9261_ssc0_device;
769 configure_ssc0_pins(pins);
770 at91_clock_associate("ssc0_clk", &pdev->dev, "pclk");
771 break;
772 case AT91SAM9261_ID_SSC1:
773 pdev = &at91sam9261_ssc1_device;
774 configure_ssc1_pins(pins);
775 at91_clock_associate("ssc1_clk", &pdev->dev, "pclk");
776 break;
777 case AT91SAM9261_ID_SSC2:
778 pdev = &at91sam9261_ssc2_device;
779 configure_ssc2_pins(pins);
780 at91_clock_associate("ssc2_clk", &pdev->dev, "pclk");
781 break;
782 default:
783 return;
784 }
785
786 platform_device_register(pdev);
787}
788
789#else
790void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
791#endif
792
793
794/* --------------------------------------------------------------------
622 * UART 795 * UART
623 * -------------------------------------------------------------------- */ 796 * -------------------------------------------------------------------- */
624 797