aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
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
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')
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c173
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c79
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c173
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c129
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c129
5 files changed, 683 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index a601c7c1670e..cebea4168778 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -636,6 +636,179 @@ void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
636 636
637 637
638/* -------------------------------------------------------------------- 638/* --------------------------------------------------------------------
639 * SSC -- Synchronous Serial Controller
640 * -------------------------------------------------------------------- */
641
642#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
643static u64 ssc0_dmamask = DMA_BIT_MASK(32);
644
645static struct resource ssc0_resources[] = {
646 [0] = {
647 .start = AT91RM9200_BASE_SSC0,
648 .end = AT91RM9200_BASE_SSC0 + SZ_16K - 1,
649 .flags = IORESOURCE_MEM,
650 },
651 [1] = {
652 .start = AT91RM9200_ID_SSC0,
653 .end = AT91RM9200_ID_SSC0,
654 .flags = IORESOURCE_IRQ,
655 },
656};
657
658static struct platform_device at91rm9200_ssc0_device = {
659 .name = "ssc",
660 .id = 0,
661 .dev = {
662 .dma_mask = &ssc0_dmamask,
663 .coherent_dma_mask = DMA_BIT_MASK(32),
664 },
665 .resource = ssc0_resources,
666 .num_resources = ARRAY_SIZE(ssc0_resources),
667};
668
669static inline void configure_ssc0_pins(unsigned pins)
670{
671 if (pins & ATMEL_SSC_TF)
672 at91_set_A_periph(AT91_PIN_PB0, 1);
673 if (pins & ATMEL_SSC_TK)
674 at91_set_A_periph(AT91_PIN_PB1, 1);
675 if (pins & ATMEL_SSC_TD)
676 at91_set_A_periph(AT91_PIN_PB2, 1);
677 if (pins & ATMEL_SSC_RD)
678 at91_set_A_periph(AT91_PIN_PB3, 1);
679 if (pins & ATMEL_SSC_RK)
680 at91_set_A_periph(AT91_PIN_PB4, 1);
681 if (pins & ATMEL_SSC_RF)
682 at91_set_A_periph(AT91_PIN_PB5, 1);
683}
684
685static u64 ssc1_dmamask = DMA_BIT_MASK(32);
686
687static struct resource ssc1_resources[] = {
688 [0] = {
689 .start = AT91RM9200_BASE_SSC1,
690 .end = AT91RM9200_BASE_SSC1 + SZ_16K - 1,
691 .flags = IORESOURCE_MEM,
692 },
693 [1] = {
694 .start = AT91RM9200_ID_SSC1,
695 .end = AT91RM9200_ID_SSC1,
696 .flags = IORESOURCE_IRQ,
697 },
698};
699
700static struct platform_device at91rm9200_ssc1_device = {
701 .name = "ssc",
702 .id = 1,
703 .dev = {
704 .dma_mask = &ssc1_dmamask,
705 .coherent_dma_mask = DMA_BIT_MASK(32),
706 },
707 .resource = ssc1_resources,
708 .num_resources = ARRAY_SIZE(ssc1_resources),
709};
710
711static inline void configure_ssc1_pins(unsigned pins)
712{
713 if (pins & ATMEL_SSC_TF)
714 at91_set_A_periph(AT91_PIN_PB6, 1);
715 if (pins & ATMEL_SSC_TK)
716 at91_set_A_periph(AT91_PIN_PB7, 1);
717 if (pins & ATMEL_SSC_TD)
718 at91_set_A_periph(AT91_PIN_PB8, 1);
719 if (pins & ATMEL_SSC_RD)
720 at91_set_A_periph(AT91_PIN_PB9, 1);
721 if (pins & ATMEL_SSC_RK)
722 at91_set_A_periph(AT91_PIN_PB10, 1);
723 if (pins & ATMEL_SSC_RF)
724 at91_set_A_periph(AT91_PIN_PB11, 1);
725}
726
727static u64 ssc2_dmamask = DMA_BIT_MASK(32);
728
729static struct resource ssc2_resources[] = {
730 [0] = {
731 .start = AT91RM9200_BASE_SSC2,
732 .end = AT91RM9200_BASE_SSC2 + SZ_16K - 1,
733 .flags = IORESOURCE_MEM,
734 },
735 [1] = {
736 .start = AT91RM9200_ID_SSC2,
737 .end = AT91RM9200_ID_SSC2,
738 .flags = IORESOURCE_IRQ,
739 },
740};
741
742static struct platform_device at91rm9200_ssc2_device = {
743 .name = "ssc",
744 .id = 2,
745 .dev = {
746 .dma_mask = &ssc2_dmamask,
747 .coherent_dma_mask = DMA_BIT_MASK(32),
748 },
749 .resource = ssc2_resources,
750 .num_resources = ARRAY_SIZE(ssc2_resources),
751};
752
753static inline void configure_ssc2_pins(unsigned pins)
754{
755 if (pins & ATMEL_SSC_TF)
756 at91_set_A_periph(AT91_PIN_PB12, 1);
757 if (pins & ATMEL_SSC_TK)
758 at91_set_A_periph(AT91_PIN_PB13, 1);
759 if (pins & ATMEL_SSC_TD)
760 at91_set_A_periph(AT91_PIN_PB14, 1);
761 if (pins & ATMEL_SSC_RD)
762 at91_set_A_periph(AT91_PIN_PB15, 1);
763 if (pins & ATMEL_SSC_RK)
764 at91_set_A_periph(AT91_PIN_PB16, 1);
765 if (pins & ATMEL_SSC_RF)
766 at91_set_A_periph(AT91_PIN_PB17, 1);
767}
768
769/*
770 * SSC controllers are accessed through library code, instead of any
771 * kind of all-singing/all-dancing driver. For example one could be
772 * used by a particular I2S audio codec's driver, while another one
773 * on the same system might be used by a custom data capture driver.
774 */
775void __init at91_add_device_ssc(unsigned id, unsigned pins)
776{
777 struct platform_device *pdev;
778
779 /*
780 * NOTE: caller is responsible for passing information matching
781 * "pins" to whatever will be using each particular controller.
782 */
783 switch (id) {
784 case AT91RM9200_ID_SSC0:
785 pdev = &at91rm9200_ssc0_device;
786 configure_ssc0_pins(pins);
787 at91_clock_associate("ssc0_clk", &pdev->dev, "ssc");
788 break;
789 case AT91RM9200_ID_SSC1:
790 pdev = &at91rm9200_ssc1_device;
791 configure_ssc1_pins(pins);
792 at91_clock_associate("ssc1_clk", &pdev->dev, "ssc");
793 break;
794 case AT91RM9200_ID_SSC2:
795 pdev = &at91rm9200_ssc2_device;
796 configure_ssc2_pins(pins);
797 at91_clock_associate("ssc2_clk", &pdev->dev, "ssc");
798 break;
799 default:
800 return;
801 }
802
803 platform_device_register(pdev);
804}
805
806#else
807void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
808#endif
809
810
811/* --------------------------------------------------------------------
639 * UART 812 * UART
640 * -------------------------------------------------------------------- */ 813 * -------------------------------------------------------------------- */
641 814
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)
614static u64 ssc_dmamask = DMA_BIT_MASK(32);
615
616static 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
629static 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
640static 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 */
662void __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
684void __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)
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
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 9bdcf45defcf..f83ef62f2385 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -866,6 +866,135 @@ void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
866 866
867 867
868/* -------------------------------------------------------------------- 868/* --------------------------------------------------------------------
869 * SSC -- Synchronous Serial Controller
870 * -------------------------------------------------------------------- */
871
872#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
873static u64 ssc0_dmamask = DMA_BIT_MASK(32);
874
875static struct resource ssc0_resources[] = {
876 [0] = {
877 .start = AT91SAM9263_BASE_SSC0,
878 .end = AT91SAM9263_BASE_SSC0 + SZ_16K - 1,
879 .flags = IORESOURCE_MEM,
880 },
881 [1] = {
882 .start = AT91SAM9263_ID_SSC0,
883 .end = AT91SAM9263_ID_SSC0,
884 .flags = IORESOURCE_IRQ,
885 },
886};
887
888static struct platform_device at91sam9263_ssc0_device = {
889 .name = "ssc",
890 .id = 0,
891 .dev = {
892 .dma_mask = &ssc0_dmamask,
893 .coherent_dma_mask = DMA_BIT_MASK(32),
894 },
895 .resource = ssc0_resources,
896 .num_resources = ARRAY_SIZE(ssc0_resources),
897};
898
899static inline void configure_ssc0_pins(unsigned pins)
900{
901 if (pins & ATMEL_SSC_TF)
902 at91_set_B_periph(AT91_PIN_PB0, 1);
903 if (pins & ATMEL_SSC_TK)
904 at91_set_B_periph(AT91_PIN_PB1, 1);
905 if (pins & ATMEL_SSC_TD)
906 at91_set_B_periph(AT91_PIN_PB2, 1);
907 if (pins & ATMEL_SSC_RD)
908 at91_set_B_periph(AT91_PIN_PB3, 1);
909 if (pins & ATMEL_SSC_RK)
910 at91_set_B_periph(AT91_PIN_PB4, 1);
911 if (pins & ATMEL_SSC_RF)
912 at91_set_B_periph(AT91_PIN_PB5, 1);
913}
914
915static u64 ssc1_dmamask = DMA_BIT_MASK(32);
916
917static struct resource ssc1_resources[] = {
918 [0] = {
919 .start = AT91SAM9263_BASE_SSC1,
920 .end = AT91SAM9263_BASE_SSC1 + SZ_16K - 1,
921 .flags = IORESOURCE_MEM,
922 },
923 [1] = {
924 .start = AT91SAM9263_ID_SSC1,
925 .end = AT91SAM9263_ID_SSC1,
926 .flags = IORESOURCE_IRQ,
927 },
928};
929
930static struct platform_device at91sam9263_ssc1_device = {
931 .name = "ssc",
932 .id = 1,
933 .dev = {
934 .dma_mask = &ssc1_dmamask,
935 .coherent_dma_mask = DMA_BIT_MASK(32),
936 },
937 .resource = ssc1_resources,
938 .num_resources = ARRAY_SIZE(ssc1_resources),
939};
940
941static inline void configure_ssc1_pins(unsigned pins)
942{
943 if (pins & ATMEL_SSC_TF)
944 at91_set_A_periph(AT91_PIN_PB6, 1);
945 if (pins & ATMEL_SSC_TK)
946 at91_set_A_periph(AT91_PIN_PB7, 1);
947 if (pins & ATMEL_SSC_TD)
948 at91_set_A_periph(AT91_PIN_PB8, 1);
949 if (pins & ATMEL_SSC_RD)
950 at91_set_A_periph(AT91_PIN_PB9, 1);
951 if (pins & ATMEL_SSC_RK)
952 at91_set_A_periph(AT91_PIN_PB10, 1);
953 if (pins & ATMEL_SSC_RF)
954 at91_set_A_periph(AT91_PIN_PB11, 1);
955}
956
957/*
958 * Return the device node so that board init code can use it as the
959 * parent for the device node reflecting how it's used on this board.
960 *
961 * SSC controllers are accessed through library code, instead of any
962 * kind of all-singing/all-dancing driver. For example one could be
963 * used by a particular I2S audio codec's driver, while another one
964 * on the same system might be used by a custom data capture driver.
965 */
966void __init at91_add_device_ssc(unsigned id, unsigned pins)
967{
968 struct platform_device *pdev;
969
970 /*
971 * NOTE: caller is responsible for passing information matching
972 * "pins" to whatever will be using each particular controller.
973 */
974 switch (id) {
975 case AT91SAM9263_ID_SSC0:
976 pdev = &at91sam9263_ssc0_device;
977 configure_ssc0_pins(pins);
978 at91_clock_associate("ssc0_clk", &pdev->dev, "pclk");
979 break;
980 case AT91SAM9263_ID_SSC1:
981 pdev = &at91sam9263_ssc1_device;
982 configure_ssc1_pins(pins);
983 at91_clock_associate("ssc1_clk", &pdev->dev, "pclk");
984 break;
985 default:
986 return;
987 }
988
989 platform_device_register(pdev);
990}
991
992#else
993void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
994#endif
995
996
997/* --------------------------------------------------------------------
869 * UART 998 * UART
870 * -------------------------------------------------------------------- */ 999 * -------------------------------------------------------------------- */
871 1000
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