serial: samsung: Add SICD notifier call
authorYoungmin Nam <youngmin.nam@samsung.com>
Wed, 9 Dec 2015 04:04:56 +0000 (13:04 +0900)
committermyung-su.cha <myung-su.cha@samsung.com>
Wed, 9 May 2018 12:14:45 +0000 (21:14 +0900)
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 <youngmin.nam@samsung.com>
drivers/tty/serial/samsung.c

index 0a0ae037e769a10bcf5cd78f5fd08f62f13f0bda..2ed0916ec685ff5d0f9ff3452200b923595be635 100644 (file)
@@ -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;