aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorNicolas Ferre <nicolas.ferre@atmel.com>2013-10-17 11:37:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-17 16:31:19 -0400
commit731d9cae0204a8948c7db2f551edcd5d5822ed95 (patch)
tree904a627df3c9809d9d60bd3cbaae72309f604e32 /drivers/tty
parent892db58bd1285d44e6e1a1e36157161990ec5ae4 (diff)
tty/serial: at91: add a fallback option to determine uart/usart property
On older SoC, the "name" field is not filled in the register map. Fix the way to figure out if the serial port is an uart or an usart for these older products (with corresponding properties). Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/atmel_serial.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 6b0f75eac8a2..c7d99af46a96 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -99,6 +99,7 @@ static void atmel_stop_rx(struct uart_port *port);
99#define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR) 99#define UART_PUT_RTOR(port,v) __raw_writel(v, (port)->membase + ATMEL_US_RTOR)
100#define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR) 100#define UART_PUT_TTGR(port, v) __raw_writel(v, (port)->membase + ATMEL_US_TTGR)
101#define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME) 101#define UART_GET_IP_NAME(port) __raw_readl((port)->membase + ATMEL_US_NAME)
102#define UART_GET_IP_VERSION(port) __raw_readl((port)->membase + ATMEL_US_VERSION)
102 103
103 /* PDC registers */ 104 /* PDC registers */
104#define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) 105#define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR)
@@ -1503,6 +1504,7 @@ static void atmel_get_ip_name(struct uart_port *port)
1503{ 1504{
1504 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 1505 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
1505 int name = UART_GET_IP_NAME(port); 1506 int name = UART_GET_IP_NAME(port);
1507 u32 version;
1506 int usart, uart; 1508 int usart, uart;
1507 /* usart and uart ascii */ 1509 /* usart and uart ascii */
1508 usart = 0x55534152; 1510 usart = 0x55534152;
@@ -1517,7 +1519,22 @@ static void atmel_get_ip_name(struct uart_port *port)
1517 dev_dbg(port->dev, "This is uart\n"); 1519 dev_dbg(port->dev, "This is uart\n");
1518 atmel_port->is_usart = false; 1520 atmel_port->is_usart = false;
1519 } else { 1521 } else {
1520 dev_err(port->dev, "Not supported ip name, set to uart\n"); 1522 /* fallback for older SoCs: use version field */
1523 version = UART_GET_IP_VERSION(port);
1524 switch (version) {
1525 case 0x302:
1526 case 0x10213:
1527 dev_dbg(port->dev, "This version is usart\n");
1528 atmel_port->is_usart = true;
1529 break;
1530 case 0x203:
1531 case 0x10202:
1532 dev_dbg(port->dev, "This version is uart\n");
1533 atmel_port->is_usart = false;
1534 break;
1535 default:
1536 dev_err(port->dev, "Not supported ip name nor version, set to uart\n");
1537 }
1521 } 1538 }
1522} 1539}
1523 1540