diff options
author | Peter Ma <pma@mediamatech.com> | 2009-03-31 21:31:02 +0400 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2009-04-01 18:13:45 +0400 |
commit | bf4861cf3e7df123c0c62f00ae2c301c292f669c (patch) | |
tree | 916a73a6597b06e719f6f96a499fb0bcaa44a5b6 /arch/avr32/mach-at32ap | |
parent | a6b6b5ff8f31960f760dd849beb70e1ae8ddc0e2 (diff) | |
download | linux-bf4861cf3e7df123c0c62f00ae2c301c292f669c.tar.xz |
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.c | 30 | ||||
-rw-r--r-- | arch/avr32/mach-at32ap/include/mach/board.h | 7 |
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[] = { DEFINE_DEV_DATA(atmel_usart, 3); DEV_CLK(usart, atmel_usart3, pba, 6); -static inline void configure_usart0_pins(void) +static inline void configure_usart0_pins(int flags) { u32 pin_mask = (1 << 8) | (1 << 9); /* RXD & TXD */ + if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 6); + if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 7); + if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 10); select_peripheral(PIOA, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP); } -static inline void configure_usart1_pins(void) +static inline void configure_usart1_pins(int flags) { u32 pin_mask = (1 << 17) | (1 << 18); /* RXD & TXD */ + if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 19); + if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 20); + if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 16); select_peripheral(PIOA, pin_mask, PERIPH_A, AT32_GPIOF_PULLUP); } -static inline void configure_usart2_pins(void) +static inline void configure_usart2_pins(int flags) { u32 pin_mask = (1 << 26) | (1 << 27); /* RXD & TXD */ + if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 30); + if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 29); + if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 28); select_peripheral(PIOB, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP); } -static inline void configure_usart3_pins(void) +static inline void configure_usart3_pins(int flags) { u32 pin_mask = (1 << 18) | (1 << 17); /* RXD & TXD */ + if (flags & ATMEL_USART_RTS) pin_mask |= (1 << 16); + if (flags & ATMEL_USART_CTS) pin_mask |= (1 << 15); + if (flags & ATMEL_USART_CLK) pin_mask |= (1 << 19); select_peripheral(PIOB, pin_mask, PERIPH_B, AT32_GPIOF_PULLUP); } static struct platform_device *__initdata at32_usarts[4]; -void __init at32_map_usart(unsigned int hw_id, unsigned int line) +void __init at32_map_usart(unsigned int hw_id, unsigned int line, int flags) { struct platform_device *pdev; switch (hw_id) { case 0: pdev = &atmel_usart0_device; - configure_usart0_pins(); + configure_usart0_pins(flags); break; case 1: pdev = &atmel_usart1_device; - configure_usart1_pins(); + configure_usart1_pins(flags); break; case 2: pdev = &atmel_usart2_device; - configure_usart2_pins(); + configure_usart2_pins(flags); break; case 3: pdev = &atmel_usart3_device; - configure_usart3_pins(); + configure_usart3_pins(flags); break; default: 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) #define ATMEL_MAX_UART 4 extern struct platform_device *atmel_default_console_device; +/* Flags for selecting USART extra pins */ +#define ATMEL_USART_RTS 0x01 +#define ATMEL_USART_CTS 0x02 +#define ATMEL_USART_CLK 0x03 + struct atmel_uart_data { short use_dma_tx; /* use transmit DMA? */ short use_dma_rx; /* use receive DMA? */ void __iomem *regs; /* virtual base address, if any */ }; -void at32_map_usart(unsigned int hw_id, unsigned int line); +void at32_map_usart(unsigned int hw_id, unsigned int line, int flags); struct platform_device *at32_add_device_usart(unsigned int id); struct eth_platform_data { |