aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91rm9200_devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91/at91rm9200_devices.c')
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c173
1 files changed, 173 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