aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/fsl_lpuart.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/fsl_lpuart.c')
-rw-r--r--drivers/tty/serial/fsl_lpuart.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index f0252184291e..c84e6f0db54e 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1,12 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * Freescale lpuart serial port driver 3 * Freescale lpuart serial port driver
3 * 4 *
4 * Copyright 2012-2014 Freescale Semiconductor, Inc. 5 * Copyright 2012-2014 Freescale Semiconductor, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */ 6 */
11 7
12#if defined(CONFIG_SERIAL_FSL_LPUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 8#if defined(CONFIG_SERIAL_FSL_LPUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
@@ -1632,12 +1628,11 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
1632{ 1628{
1633 struct lpuart_port *sport = container_of(port, struct lpuart_port, port); 1629 struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
1634 unsigned long flags; 1630 unsigned long flags;
1635 unsigned long ctrl, old_ctrl, bd, modem; 1631 unsigned long ctrl, old_ctrl, modem;
1636 unsigned int baud; 1632 unsigned int baud;
1637 unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; 1633 unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
1638 1634
1639 ctrl = old_ctrl = lpuart32_read(&sport->port, UARTCTRL); 1635 ctrl = old_ctrl = lpuart32_read(&sport->port, UARTCTRL);
1640 bd = lpuart32_read(&sport->port, UARTBAUD);
1641 modem = lpuart32_read(&sport->port, UARTMODIR); 1636 modem = lpuart32_read(&sport->port, UARTMODIR);
1642 /* 1637 /*
1643 * only support CS8 and CS7, and for CS7 must enable PE. 1638 * only support CS8 and CS7, and for CS7 must enable PE.
@@ -2212,6 +2207,24 @@ static int lpuart_probe(struct platform_device *pdev)
2212 if (ret) 2207 if (ret)
2213 goto failed_attach_port; 2208 goto failed_attach_port;
2214 2209
2210 of_get_rs485_mode(np, &sport->port.rs485);
2211
2212 if (sport->port.rs485.flags & SER_RS485_RX_DURING_TX) {
2213 dev_err(&pdev->dev, "driver doesn't support RX during TX\n");
2214 return -ENOSYS;
2215 }
2216
2217 if (sport->port.rs485.delay_rts_before_send ||
2218 sport->port.rs485.delay_rts_after_send) {
2219 dev_err(&pdev->dev, "driver doesn't support RTS delays\n");
2220 return -ENOSYS;
2221 }
2222
2223 if (sport->port.rs485.flags & SER_RS485_ENABLED) {
2224 sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND;
2225 writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM);
2226 }
2227
2215 sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx"); 2228 sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx");
2216 if (!sport->dma_tx_chan) 2229 if (!sport->dma_tx_chan)
2217 dev_info(sport->port.dev, "DMA tx channel request failed, " 2230 dev_info(sport->port.dev, "DMA tx channel request failed, "
@@ -2222,12 +2235,6 @@ static int lpuart_probe(struct platform_device *pdev)
2222 dev_info(sport->port.dev, "DMA rx channel request failed, " 2235 dev_info(sport->port.dev, "DMA rx channel request failed, "
2223 "operating without rx DMA\n"); 2236 "operating without rx DMA\n");
2224 2237
2225 if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) {
2226 sport->port.rs485.flags |= SER_RS485_ENABLED;
2227 sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND;
2228 writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM);
2229 }
2230
2231 return 0; 2238 return 0;
2232 2239
2233failed_attach_port: 2240failed_attach_port: