aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32
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
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')
-rw-r--r--arch/avr32/boards/atngw100/setup.c2
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c6
-rw-r--r--arch/avr32/boards/atstk1000/atstk1003.c6
-rw-r--r--arch/avr32/boards/atstk1000/atstk1004.c6
-rw-r--r--arch/avr32/boards/favr-32/setup.c2
-rw-r--r--arch/avr32/boards/hammerhead/setup.c2
-rw-r--r--arch/avr32/boards/merisc/setup.c8
-rw-r--r--arch/avr32/boards/mimc200/setup.c8
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c30
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h7
10 files changed, 47 insertions, 30 deletions
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index feac0035800c..5b022aad4bd9 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -118,7 +118,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
118 118
119void __init setup_board(void) 119void __init setup_board(void)
120{ 120{
121 at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */ 121 at32_map_usart(1, 0, 0); /* USART 1: /dev/ttyS0, DB9 */
122 at32_setup_serial_console(0); 122 at32_setup_serial_console(0);
123} 123}
124 124
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 1f33a106905c..2adc261c9e3d 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -252,12 +252,12 @@ static void __init atstk1002_setup_extdac(void)
252void __init setup_board(void) 252void __init setup_board(void)
253{ 253{
254#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 254#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
255 at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ 255 at32_map_usart(0, 1, 0); /* USART 0/B: /dev/ttyS1, IRDA */
256#else 256#else
257 at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ 257 at32_map_usart(1, 0, 0); /* USART 1/A: /dev/ttyS0, DB9 */
258#endif 258#endif
259 /* USART 2/unused: expansion connector */ 259 /* USART 2/unused: expansion connector */
260 at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */ 260 at32_map_usart(3, 2, 0); /* USART 3/C: /dev/ttyS2, DB9 */
261 261
262 at32_setup_serial_console(0); 262 at32_setup_serial_console(0);
263} 263}
diff --git a/arch/avr32/boards/atstk1000/atstk1003.c b/arch/avr32/boards/atstk1000/atstk1003.c
index b3a23c88bcfe..ff7e23298827 100644
--- a/arch/avr32/boards/atstk1000/atstk1003.c
+++ b/arch/avr32/boards/atstk1000/atstk1003.c
@@ -115,12 +115,12 @@ static void __init atstk1003_setup_extdac(void)
115void __init setup_board(void) 115void __init setup_board(void)
116{ 116{
117#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 117#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
118 at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ 118 at32_map_usart(0, 1, 0); /* USART 0/B: /dev/ttyS1, IRDA */
119#else 119#else
120 at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ 120 at32_map_usart(1, 0, 0); /* USART 1/A: /dev/ttyS0, DB9 */
121#endif 121#endif
122 /* USART 2/unused: expansion connector */ 122 /* USART 2/unused: expansion connector */
123 at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */ 123 at32_map_usart(3, 2, 0); /* USART 3/C: /dev/ttyS2, DB9 */
124 124
125 at32_setup_serial_console(0); 125 at32_setup_serial_console(0);
126} 126}
diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c
index 29b35aca96cd..69a9f0f08c6e 100644
--- a/arch/avr32/boards/atstk1000/atstk1004.c
+++ b/arch/avr32/boards/atstk1000/atstk1004.c
@@ -120,12 +120,12 @@ static void __init atstk1004_setup_extdac(void)
120void __init setup_board(void) 120void __init setup_board(void)
121{ 121{
122#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 122#ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
123 at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ 123 at32_map_usart(0, 1, 0); /* USART 0/B: /dev/ttyS1, IRDA */
124#else 124#else
125 at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ 125 at32_map_usart(1, 0, 0); /* USART 1/A: /dev/ttyS0, DB9 */
126#endif 126#endif
127 /* USART 2/unused: expansion connector */ 127 /* USART 2/unused: expansion connector */
128 at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */ 128 at32_map_usart(3, 2, 0); /* USART 3/C: /dev/ttyS2, DB9 */
129 129
130 at32_setup_serial_console(0); 130 at32_setup_serial_console(0);
131} 131}
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index cf6e4e5624d0..46c9b0a224cf 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -250,7 +250,7 @@ static void __init favr32_setup_atmel_pwm_bl(void)
250 250
251void __init setup_board(void) 251void __init setup_board(void)
252{ 252{
253 at32_map_usart(3, 0); /* USART 3 => /dev/ttyS0 */ 253 at32_map_usart(3, 0, 0); /* USART 3 => /dev/ttyS0 */
254 at32_setup_serial_console(0); 254 at32_setup_serial_console(0);
255} 255}
256 256
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
index a5c2da25c4fe..dd009875a405 100644
--- a/arch/avr32/boards/hammerhead/setup.c
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -165,7 +165,7 @@ static void __init set_hw_addr(struct platform_device *pdev)
165 165
166void __init setup_board(void) 166void __init setup_board(void)
167{ 167{
168 at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */ 168 at32_map_usart(1, 0, 0); /* USART 1: /dev/ttyS0, DB9 */
169 at32_setup_serial_console(0); 169 at32_setup_serial_console(0);
170} 170}
171 171
diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
index 58acdb4fc9b3..20b300cf105a 100644
--- a/arch/avr32/boards/merisc/setup.c
+++ b/arch/avr32/boards/merisc/setup.c
@@ -231,9 +231,9 @@ static void detect_merisc_board_id(void)
231 231
232void __init setup_board(void) 232void __init setup_board(void)
233{ 233{
234 at32_map_usart(0, 0); 234 at32_map_usart(0, 0, 0);
235 at32_map_usart(1, 1); 235 at32_map_usart(1, 1, 0);
236 at32_map_usart(3, 3); 236 at32_map_usart(3, 3, 0);
237 at32_setup_serial_console(1); 237 at32_setup_serial_console(1);
238} 238}
239 239
@@ -248,7 +248,7 @@ static int __init merisc_init(void)
248 at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL | (1 << 26)); 248 at32_reserve_pin(GPIO_PIOE_BASE, ATMEL_EBI_PE_DATA_ALL | (1 << 26));
249 249
250 if (merisc_board_id >= 1) 250 if (merisc_board_id >= 1)
251 at32_map_usart(2, 2); 251 at32_map_usart(2, 2, 0);
252 252
253 at32_add_device_usart(0); 253 at32_add_device_usart(0);
254 at32_add_device_usart(1); 254 at32_add_device_usart(1);
diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c
index 2b58d61f0afc..c1b2175b4fea 100644
--- a/arch/avr32/boards/mimc200/setup.c
+++ b/arch/avr32/boards/mimc200/setup.c
@@ -175,10 +175,10 @@ static void __init set_hw_addr(struct platform_device *pdev)
175 175
176void __init setup_board(void) 176void __init setup_board(void)
177{ 177{
178 at32_map_usart(0, 0); /* USART 0: /dev/ttyS0 (TTL --> Altera) */ 178 at32_map_usart(0, 0, 0); /* USART 0: /dev/ttyS0 (TTL --> Altera) */
179 at32_map_usart(1, 1); /* USART 1: /dev/ttyS1 (RS232) */ 179 at32_map_usart(1, 1, 0); /* USART 1: /dev/ttyS1 (RS232) */
180 at32_map_usart(2, 2); /* USART 2: /dev/ttyS2 (RS485) */ 180 at32_map_usart(2, 2, 0); /* USART 2: /dev/ttyS2 (RS485) */
181 at32_map_usart(3, 3); /* USART 3: /dev/ttyS3 (RS422 Multidrop) */ 181 at32_map_usart(3, 3, 0); /* USART 3: /dev/ttyS3 (RS422 Multidrop) */
182} 182}
183 183
184static struct i2c_gpio_platform_data i2c_gpio_data = { 184static struct i2c_gpio_platform_data i2c_gpio_data = {
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 {