aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans-Christian Egtvedt <hcegtvedt@atmel.com>2008-02-25 05:24:30 -0500
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-06-27 09:32:28 -0400
commitd86d314f67191011e6f494f6517b8cbd7dd3dc39 (patch)
treef813482414cae1771c174f458b4914dfe3465fbf
parent47882cf620bcd7b014f6f7fc11be8c045787adac (diff)
avr32: Add PSIF platform devices
This patch adds the PS/2 interface (PSIF) to the device code, split into two platform devices, one for each port. The function for adding the PSIF platform device is also added to the board header file. Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com> Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c77
-rw-r--r--include/asm-avr32/arch-at32ap/board.h1
2 files changed, 78 insertions, 0 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 08115f9243fb..a9ae7bb108b2 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -834,6 +834,81 @@ void __init at32_add_system_devices(void)
834} 834}
835 835
836/* -------------------------------------------------------------------- 836/* --------------------------------------------------------------------
837 * PSIF
838 * -------------------------------------------------------------------- */
839static struct resource atmel_psif0_resource[] __initdata = {
840 {
841 .start = 0xffe03c00,
842 .end = 0xffe03cff,
843 .flags = IORESOURCE_MEM,
844 },
845 IRQ(18),
846};
847static struct clk atmel_psif0_pclk = {
848 .name = "pclk",
849 .parent = &pba_clk,
850 .mode = pba_clk_mode,
851 .get_rate = pba_clk_get_rate,
852 .index = 15,
853};
854
855static struct resource atmel_psif1_resource[] __initdata = {
856 {
857 .start = 0xffe03d00,
858 .end = 0xffe03dff,
859 .flags = IORESOURCE_MEM,
860 },
861 IRQ(18),
862};
863static struct clk atmel_psif1_pclk = {
864 .name = "pclk",
865 .parent = &pba_clk,
866 .mode = pba_clk_mode,
867 .get_rate = pba_clk_get_rate,
868 .index = 15,
869};
870
871struct platform_device *__init at32_add_device_psif(unsigned int id)
872{
873 struct platform_device *pdev;
874
875 if (!(id == 0 || id == 1))
876 return NULL;
877
878 pdev = platform_device_alloc("atmel_psif", id);
879 if (!pdev)
880 return NULL;
881
882 switch (id) {
883 case 0:
884 if (platform_device_add_resources(pdev, atmel_psif0_resource,
885 ARRAY_SIZE(atmel_psif0_resource)))
886 goto err_add_resources;
887 atmel_psif0_pclk.dev = &pdev->dev;
888 select_peripheral(PA(8), PERIPH_A, 0); /* CLOCK */
889 select_peripheral(PA(9), PERIPH_A, 0); /* DATA */
890 break;
891 case 1:
892 if (platform_device_add_resources(pdev, atmel_psif1_resource,
893 ARRAY_SIZE(atmel_psif1_resource)))
894 goto err_add_resources;
895 atmel_psif1_pclk.dev = &pdev->dev;
896 select_peripheral(PB(11), PERIPH_A, 0); /* CLOCK */
897 select_peripheral(PB(12), PERIPH_A, 0); /* DATA */
898 break;
899 default:
900 return NULL;
901 }
902
903 platform_device_add(pdev);
904 return pdev;
905
906err_add_resources:
907 platform_device_put(pdev);
908 return NULL;
909}
910
911/* --------------------------------------------------------------------
837 * USART 912 * USART
838 * -------------------------------------------------------------------- */ 913 * -------------------------------------------------------------------- */
839 914
@@ -1934,6 +2009,8 @@ struct clk *at32_clock_list[] = {
1934 &pio4_mck, 2009 &pio4_mck,
1935 &at32_tcb0_t0_clk, 2010 &at32_tcb0_t0_clk,
1936 &at32_tcb1_t0_clk, 2011 &at32_tcb1_t0_clk,
2012 &atmel_psif0_pclk,
2013 &atmel_psif1_pclk,
1937 &atmel_usart0_usart, 2014 &atmel_usart0_usart,
1938 &atmel_usart1_usart, 2015 &atmel_usart1_usart,
1939 &atmel_usart2_usart, 2016 &atmel_usart2_usart,
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h
index a78206cdb3dc..b4cddfaca90e 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -80,6 +80,7 @@ struct platform_device *at32_add_device_twi(unsigned int id,
80struct platform_device *at32_add_device_mci(unsigned int id); 80struct platform_device *at32_add_device_mci(unsigned int id);
81struct platform_device *at32_add_device_ac97c(unsigned int id); 81struct platform_device *at32_add_device_ac97c(unsigned int id);
82struct platform_device *at32_add_device_abdac(unsigned int id); 82struct platform_device *at32_add_device_abdac(unsigned int id);
83struct platform_device *at32_add_device_psif(unsigned int id);
83 84
84struct cf_platform_data { 85struct cf_platform_data {
85 int detect_pin; 86 int detect_pin;