diff options
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap700x.c')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 30 |
1 files changed, 21 insertions, 9 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[] = { | |||
966 | DEFINE_DEV_DATA(atmel_usart, 3); | 966 | DEFINE_DEV_DATA(atmel_usart, 3); |
967 | DEV_CLK(usart, atmel_usart3, pba, 6); | 967 | DEV_CLK(usart, atmel_usart3, pba, 6); |
968 | 968 | ||
969 | static inline void configure_usart0_pins(void) | 969 | static 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 | ||
976 | static inline void configure_usart1_pins(void) | 979 | static 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 | ||
983 | static inline void configure_usart2_pins(void) | 989 | static 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 | ||
990 | static inline void configure_usart3_pins(void) | 999 | static 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 | ||
997 | static struct platform_device *__initdata at32_usarts[4]; | 1009 | static struct platform_device *__initdata at32_usarts[4]; |
998 | 1010 | ||
999 | void __init at32_map_usart(unsigned int hw_id, unsigned int line) | 1011 | void __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; |