From 8057d979bd32730deea7df594100b75184ac1415 Mon Sep 17 00:00:00 2001 From: Youngmin Nam Date: Wed, 9 Dec 2015 13:04:56 +0900 Subject: [PATCH] serial: samsung: Add SICD notifier call This patch sets RTS as HIGH not to receive data from external device when AP enters SICD. And sets RTS as LOW to receive data when AP comes out SICD Change-Id: Ie1260e635d15d9e60ed36ea12669411d5b0be20c Signed-off-by: Youngmin Nam --- drivers/tty/serial/samsung.c | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 0a0ae037e769..2ed0916ec685 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -1462,10 +1462,60 @@ EXPORT_SYMBOL_GPL(s3c24xx_serial_fifo_wait); static int s3c24xx_serial_notifier(struct notifier_block *self, unsigned long cmd, void *v) { + struct s3c24xx_uart_port *ourport; + struct uart_port *port; + unsigned long flags; + unsigned int umcon; + switch (cmd) { case LPA_ENTER: s3c24xx_serial_fifo_wait(); break; + + case SICD_ENTER: + case SICD_AUD_ENTER: + list_for_each_entry(ourport, &drvdata_list, node) { + if (uart_console(&ourport->port)) + continue; + + port = &ourport->port; + + spin_lock_irqsave(&port->lock, flags); + + uart_clock_enable(ourport); + /* disable auto flow control & set nRTS for High */ + umcon = rd_regl(port, S3C2410_UMCON); + umcon &= ~(S3C2410_UMCOM_AFC | S3C2410_UMCOM_RTS_LOW); + wr_regl(port, S3C2410_UMCON, umcon); + uart_clock_disable(ourport); + + spin_unlock_irqrestore(&port->lock, flags); + } + break; + + case SICD_EXIT: + case SICD_AUD_EXIT: + list_for_each_entry(ourport, &drvdata_list, node) { + if (uart_console(&ourport->port)) + continue; + + port = &ourport->port; + + spin_lock_irqsave(&port->lock, flags); + + uart_clock_enable(ourport); + /* enable auto flow control */ + umcon = rd_regl(port, S3C2410_UMCON); + umcon |= S3C2410_UMCOM_AFC; + wr_regl(port, S3C2410_UMCON, umcon); + uart_clock_disable(ourport); + + spin_unlock_irqrestore(&port->lock, flags); + } + break; + + default: + break; } return NOTIFY_DONE; -- 2.20.1