diff options
author | Hans-Christian Egtvedt <hcegtvedt@atmel.com> | 2008-02-25 05:24:30 -0500 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-06-27 09:32:28 -0400 |
commit | d86d314f67191011e6f494f6517b8cbd7dd3dc39 (patch) | |
tree | f813482414cae1771c174f458b4914dfe3465fbf /arch/avr32 | |
parent | 47882cf620bcd7b014f6f7fc11be8c045787adac (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>
Diffstat (limited to 'arch/avr32')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 77 |
1 files changed, 77 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 | * -------------------------------------------------------------------- */ | ||
839 | static struct resource atmel_psif0_resource[] __initdata = { | ||
840 | { | ||
841 | .start = 0xffe03c00, | ||
842 | .end = 0xffe03cff, | ||
843 | .flags = IORESOURCE_MEM, | ||
844 | }, | ||
845 | IRQ(18), | ||
846 | }; | ||
847 | static 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 | |||
855 | static struct resource atmel_psif1_resource[] __initdata = { | ||
856 | { | ||
857 | .start = 0xffe03d00, | ||
858 | .end = 0xffe03dff, | ||
859 | .flags = IORESOURCE_MEM, | ||
860 | }, | ||
861 | IRQ(18), | ||
862 | }; | ||
863 | static 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 | |||
871 | struct 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 | |||
906 | err_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, |