aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/amba-pl011.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/amba-pl011.c')
-rw-r--r--drivers/tty/serial/amba-pl011.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 111e6a950779..04af8de8617e 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * Driver for AMBA serial ports 3 * Driver for AMBA serial ports
3 * 4 *
@@ -7,20 +8,6 @@
7 * Copyright (C) 2000 Deep Blue Solutions Ltd. 8 * Copyright (C) 2000 Deep Blue Solutions Ltd.
8 * Copyright (C) 2010 ST-Ericsson SA 9 * Copyright (C) 2010 ST-Ericsson SA
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * This is a generic driver for ARM AMBA-type serial ports. They 11 * This is a generic driver for ARM AMBA-type serial ports. They
25 * have a lot of 16550-like features, but are not register compatible. 12 * have a lot of 16550-like features, but are not register compatible.
26 * Note that although they do have CTS, DCD and DSR inputs, they do 13 * Note that although they do have CTS, DCD and DSR inputs, they do
@@ -281,7 +268,6 @@ struct uart_amba_port {
281 unsigned int old_status; 268 unsigned int old_status;
282 unsigned int fifosize; /* vendor-specific */ 269 unsigned int fifosize; /* vendor-specific */
283 unsigned int old_cr; /* state during shutdown */ 270 unsigned int old_cr; /* state during shutdown */
284 bool autorts;
285 unsigned int fixed_baud; /* vendor-set fixed baud rate */ 271 unsigned int fixed_baud; /* vendor-set fixed baud rate */
286 char type[12]; 272 char type[12];
287#ifdef CONFIG_DMA_ENGINE 273#ifdef CONFIG_DMA_ENGINE
@@ -1078,9 +1064,9 @@ static inline void pl011_dma_rx_stop(struct uart_amba_port *uap)
1078 * Every polling, It checks the residue in the dma buffer and transfer 1064 * Every polling, It checks the residue in the dma buffer and transfer
1079 * data to the tty. Also, last_residue is updated for the next polling. 1065 * data to the tty. Also, last_residue is updated for the next polling.
1080 */ 1066 */
1081static void pl011_dma_rx_poll(unsigned long args) 1067static void pl011_dma_rx_poll(struct timer_list *t)
1082{ 1068{
1083 struct uart_amba_port *uap = (struct uart_amba_port *)args; 1069 struct uart_amba_port *uap = from_timer(uap, t, dmarx.timer);
1084 struct tty_port *port = &uap->port.state->port; 1070 struct tty_port *port = &uap->port.state->port;
1085 struct pl011_dmarx_data *dmarx = &uap->dmarx; 1071 struct pl011_dmarx_data *dmarx = &uap->dmarx;
1086 struct dma_chan *rxchan = uap->dmarx.chan; 1072 struct dma_chan *rxchan = uap->dmarx.chan;
@@ -1192,9 +1178,7 @@ skip_rx:
1192 dev_dbg(uap->port.dev, "could not trigger initial " 1178 dev_dbg(uap->port.dev, "could not trigger initial "
1193 "RX DMA job, fall back to interrupt mode\n"); 1179 "RX DMA job, fall back to interrupt mode\n");
1194 if (uap->dmarx.poll_rate) { 1180 if (uap->dmarx.poll_rate) {
1195 init_timer(&(uap->dmarx.timer)); 1181 timer_setup(&uap->dmarx.timer, pl011_dma_rx_poll, 0);
1196 uap->dmarx.timer.function = pl011_dma_rx_poll;
1197 uap->dmarx.timer.data = (unsigned long)uap;
1198 mod_timer(&uap->dmarx.timer, 1182 mod_timer(&uap->dmarx.timer,
1199 jiffies + 1183 jiffies +
1200 msecs_to_jiffies(uap->dmarx.poll_rate)); 1184 msecs_to_jiffies(uap->dmarx.poll_rate));
@@ -1588,7 +1572,7 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
1588 TIOCMBIT(TIOCM_OUT2, UART011_CR_OUT2); 1572 TIOCMBIT(TIOCM_OUT2, UART011_CR_OUT2);
1589 TIOCMBIT(TIOCM_LOOP, UART011_CR_LBE); 1573 TIOCMBIT(TIOCM_LOOP, UART011_CR_LBE);
1590 1574
1591 if (uap->autorts) { 1575 if (port->status & UPSTAT_AUTORTS) {
1592 /* We need to disable auto-RTS if we want to turn RTS off */ 1576 /* We need to disable auto-RTS if we want to turn RTS off */
1593 TIOCMBIT(TIOCM_RTS, UART011_CR_RTSEN); 1577 TIOCMBIT(TIOCM_RTS, UART011_CR_RTSEN);
1594 } 1578 }
@@ -1842,7 +1826,7 @@ static void pl011_disable_uart(struct uart_amba_port *uap)
1842{ 1826{
1843 unsigned int cr; 1827 unsigned int cr;
1844 1828
1845 uap->autorts = false; 1829 uap->port.status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS);
1846 spin_lock_irq(&uap->port.lock); 1830 spin_lock_irq(&uap->port.lock);
1847 cr = pl011_read(uap, REG_CR); 1831 cr = pl011_read(uap, REG_CR);
1848 uap->old_cr = cr; 1832 uap->old_cr = cr;
@@ -2028,10 +2012,10 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
2028 old_cr |= UART011_CR_RTSEN; 2012 old_cr |= UART011_CR_RTSEN;
2029 2013
2030 old_cr |= UART011_CR_CTSEN; 2014 old_cr |= UART011_CR_CTSEN;
2031 uap->autorts = true; 2015 port->status |= UPSTAT_AUTOCTS | UPSTAT_AUTORTS;
2032 } else { 2016 } else {
2033 old_cr &= ~(UART011_CR_CTSEN | UART011_CR_RTSEN); 2017 old_cr &= ~(UART011_CR_CTSEN | UART011_CR_RTSEN);
2034 uap->autorts = false; 2018 port->status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS);
2035 } 2019 }
2036 2020
2037 if (uap->vendor->oversampling) { 2021 if (uap->vendor->oversampling) {