aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap
diff options
context:
space:
mode:
authorPeter Ma <pma@mediamatech.com>2009-03-31 13:31:02 -0400
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2009-04-01 10:13:45 -0400
commitbf4861cf3e7df123c0c62f00ae2c301c292f669c (patch)
tree916a73a6597b06e719f6f96a499fb0bcaa44a5b6 /arch/avr32/mach-at32ap
parenta6b6b5ff8f31960f760dd849beb70e1ae8ddc0e2 (diff)
avr32: add RTS/CTS/CLK pin selection for the USARTs
Adds extra parameter to AT32 at32_map_usart(), so as to reserve RTS/CTS/CLK pins. All boards under arch/avr32/boards have been updated (trivial change), but not all have been tested. Signed-off-by: Peter Ma <pma@mediamatech.com> Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/mach-at32ap')
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c30
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h7
2 files changed, 27 insertions, 10 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 62501d64322c..7cc653798327 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -966,56 +966,68 @@ static struct resource atmel_usart3_resource[] = {
966DEFINE_DEV_DATA(atmel_usart, 3); 966DEFINE_DEV_DATA(atmel_usart, 3);
967DEV_CLK(usart, atmel_usart3, pba, 6); 967DEV_CLK(usart, atmel_usart3, pba, 6);
968 968
969static inline void configure_usart0_pins(void) 969static inline void configure_usart0_pins(int flags)
970{ 970{
971 u32 pin_mask = (1 << 8) | (1 << 9); /* RXD & TXD */ 971 u32 pin_mask = (1 << 8) | (1 << 9); /* RXD & TXD */
972 if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 6);
973 if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 7);
974 if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 10);
972 975
973 select_peripheral(PIOA, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP); 976 select_peripheral(PIOA, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP);
974} 977}
975 978
976static inline void configure_usart1_pins(void) 979static inline void configure_usart1_pins(int flags)
977{ 980{
978 u32 pin_mask = (1 << 17) | (1 << 18); /* RXD & TXD */ 981 u32 pin_mask = (1 << 17) | (1 << 18); /* RXD & TXD */
982 if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 19);
983 if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 20);
984 if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 16);
979 985
980 select_peripheral(PIOA, pin_mask, PERIPH_A, AT32_GPIOF_PULLUP); 986 select_peripheral(PIOA, pin_mask, PERIPH_A, AT32_GPIOF_PULLUP);
981} 987}
982 988
983static inline void configure_usart2_pins(void) 989static inline void configure_usart2_pins(int flags)
984{ 990{
985 u32 pin_mask = (1 << 26) | (1 << 27); /* RXD & TXD */ 991 u32 pin_mask = (1 << 26) | (1 << 27); /* RXD & TXD */
992 if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 30);
993 if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 29);
994 if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 28);
986 995
987 select_peripheral(PIOB, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP); 996 select_peripheral(PIOB, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP);
988} 997}
989 998
990static inline void configure_usart3_pins(void) 999static inline void configure_usart3_pins(int flags)
991{ 1000{
992 u32 pin_mask = (1 << 18) | (1 << 17); /* RXD & TXD */ 1001 u32 pin_mask = (1 << 18) | (1 << 17); /* RXD & TXD */
1002 if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 16);
1003 if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 15);
1004 if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 19);
993 1005
994 select_peripheral(PIOB, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP); 1006 select_peripheral(PIOB, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP);
995} 1007}
996 1008
997static struct platform_device *__initdata at32_usarts[4]; 1009static struct platform_device *__initdata at32_usarts[4];
998 1010
999void __init at32_map_usart(unsigned int hw_id, unsigned int line) 1011void __init at32_map_usart(unsigned int hw_id, unsigned int line, int flags)
1000{ 1012{
1001 struct platform_device *pdev; 1013 struct platform_device *pdev;
1002 1014
1003 switch (hw_id) { 1015 switch (hw_id) {
1004 case 0: 1016 case 0:
1005 pdev = &atmel_usart0_device; 1017 pdev = &atmel_usart0_device;
1006 configure_usart0_pins(); 1018 configure_usart0_pins(flags);
1007 break; 1019 break;
1008 case 1: 1020 case 1:
1009 pdev = &atmel_usart1_device; 1021 pdev = &atmel_usart1_device;
1010 configure_usart1_pins(); 1022 configure_usart1_pins(flags);
1011 break; 1023 break;
1012 case 2: 1024 case 2:
1013 pdev = &atmel_usart2_device; 1025 pdev = &atmel_usart2_device;
1014 configure_usart2_pins(); 1026 configure_usart2_pins(flags);
1015 break; 1027 break;
1016 case 3: 1028 case 3:
1017 pdev = &atmel_usart3_device; 1029 pdev = &atmel_usart3_device;
1018 configure_usart3_pins(); 1030 configure_usart3_pins(flags);
1019 break; 1031 break;
1020 default: 1032 default:
1021 return; 1033 return;
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index b363b067b0a4..0b8164281899 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -26,12 +26,17 @@ static inline void __deprecated at32_add_system_devices(void)
26#define ATMEL_MAX_UART 4 26#define ATMEL_MAX_UART 4
27extern struct platform_device *atmel_default_console_device; 27extern struct platform_device *atmel_default_console_device;
28 28
29/* Flags for selecting USART extra pins */
30#define ATMEL_USART_RTS 0x01
31#define ATMEL_USART_CTS 0x02
32#define ATMEL_USART_CLK 0x03
33
29struct atmel_uart_data { 34struct atmel_uart_data {
30 short use_dma_tx; /* use transmit DMA? */ 35 short use_dma_tx; /* use transmit DMA? */
31 short use_dma_rx; /* use receive DMA? */ 36 short use_dma_rx; /* use receive DMA? */
32 void __iomem *regs; /* virtual base address, if any */ 37 void __iomem *regs; /* virtual base address, if any */
33}; 38};
34void at32_map_usart(unsigned int hw_id, unsigned int line); 39void at32_map_usart(unsigned int hw_id, unsigned int line, int flags);
35struct platform_device *at32_add_device_usart(unsigned int id); 40struct platform_device *at32_add_device_usart(unsigned int id);
36 41
37struct eth_platform_data { 42struct eth_platform_data {