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/at91sam9263_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/at91sam9263_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 129 |
1 files changed, 129 insertions, 0 deletions
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) | ||
873 | static u64 ssc0_dmamask = DMA_BIT_MASK(32); | ||
874 | |||
875 | static 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 | |||
888 | static 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 | |||
899 | static 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 | |||
915 | static u64 ssc1_dmamask = DMA_BIT_MASK(32); | ||
916 | |||
917 | static 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 | |||
930 | static 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 | |||
941 | static 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 | */ | ||
966 | void __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 | ||
993 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | ||
994 | #endif | ||
995 | |||
996 | |||
997 | /* -------------------------------------------------------------------- | ||
869 | * UART | 998 | * UART |
870 | * -------------------------------------------------------------------- */ | 999 | * -------------------------------------------------------------------- */ |
871 | 1000 | ||