aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Blake <ed.blake@imgtec.com>2016-11-10 13:07:56 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-16 04:59:38 -0500
commit0e0b989eb330f0167c191a5c223be352f348c9c0 (patch)
tree298a3f5cebac824d878998b1a0e76f4ff441f9ba
parentdb405a8f8bf70daf57ed88808a2bf9c5fe308c70 (diff)
serial: 8250_dw: Add support for IrDA SIR mode
Add a set_ldisc function to enable/disable IrDA SIR mode according to the new line discipline, if IrDA SIR mode is supported by the hardware configuration. Signed-off-by: Ed Blake <ed.blake@imgtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/8250/8250_dw.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 459d726f9d59..c89fafc972b6 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -53,6 +53,8 @@
53/* Helper for fifo size calculation */ 53/* Helper for fifo size calculation */
54#define DW_UART_CPR_FIFO_SIZE(a) (((a >> 16) & 0xff) * 16) 54#define DW_UART_CPR_FIFO_SIZE(a) (((a >> 16) & 0xff) * 16)
55 55
56/* DesignWare specific register fields */
57#define DW_UART_MCR_SIRE BIT(6)
56 58
57struct dw8250_data { 59struct dw8250_data {
58 u8 usr_reg; 60 u8 usr_reg;
@@ -254,6 +256,22 @@ out:
254 serial8250_do_set_termios(p, termios, old); 256 serial8250_do_set_termios(p, termios, old);
255} 257}
256 258
259static void dw8250_set_ldisc(struct uart_port *p, struct ktermios *termios)
260{
261 struct uart_8250_port *up = up_to_u8250p(p);
262 unsigned int mcr = p->serial_in(p, UART_MCR);
263
264 if (up->capabilities & UART_CAP_IRDA) {
265 if (termios->c_line == N_IRDA)
266 mcr |= DW_UART_MCR_SIRE;
267 else
268 mcr &= ~DW_UART_MCR_SIRE;
269
270 p->serial_out(p, UART_MCR, mcr);
271 }
272 serial8250_do_set_ldisc(p, termios);
273}
274
257/* 275/*
258 * dw8250_fallback_dma_filter will prevent the UART from getting just any free 276 * dw8250_fallback_dma_filter will prevent the UART from getting just any free
259 * channel on platforms that have DMA engines, but don't have any channels 277 * channel on platforms that have DMA engines, but don't have any channels
@@ -357,6 +375,9 @@ static void dw8250_setup_port(struct uart_port *p)
357 375
358 if (reg & DW_UART_CPR_AFCE_MODE) 376 if (reg & DW_UART_CPR_AFCE_MODE)
359 up->capabilities |= UART_CAP_AFE; 377 up->capabilities |= UART_CAP_AFE;
378
379 if (reg & DW_UART_CPR_SIR_MODE)
380 up->capabilities |= UART_CAP_IRDA;
360} 381}
361 382
362static int dw8250_probe(struct platform_device *pdev) 383static int dw8250_probe(struct platform_device *pdev)
@@ -392,6 +413,7 @@ static int dw8250_probe(struct platform_device *pdev)
392 p->iotype = UPIO_MEM; 413 p->iotype = UPIO_MEM;
393 p->serial_in = dw8250_serial_in; 414 p->serial_in = dw8250_serial_in;
394 p->serial_out = dw8250_serial_out; 415 p->serial_out = dw8250_serial_out;
416 p->set_ldisc = dw8250_set_ldisc;
395 417
396 p->membase = devm_ioremap(dev, regs->start, resource_size(regs)); 418 p->membase = devm_ioremap(dev, regs->start, resource_size(regs));
397 if (!p->membase) 419 if (!p->membase)