From 8f689ed042e20a215edc192739e534c9dc851158 Mon Sep 17 00:00:00 2001 From: Kyungwoo Kang Date: Tue, 11 Jul 2017 15:31:55 +0900 Subject: [PATCH] [COMMON] serial: samsung: Add suspend clock stop fucntion. This patch is for USI_v2 UART port. When the system goes into suspend mode, CLKSTOP_ON register must be set by 1 not to get disturbed by any signal which is not supposed to be. Change-Id: Ia7cceaf4c4f04c7c039819cf80d08cdae6d5686b Signed-off-by: Kyungwoo Kang --- drivers/tty/serial/samsung.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index f3db0e139ce3..3df8070c37a0 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -203,6 +203,7 @@ uart_dbg_store(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR(uart_dbg, 0640, uart_dbg_show, uart_dbg_store); static void exynos_usi_init(struct uart_port *port); +static void exynos_usi_stop(struct uart_port *port); static void s3c24xx_serial_resetport(struct uart_port *port, struct s3c2410_uartcfg *cfg); static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level, @@ -1266,6 +1267,15 @@ static void exynos_usi_init(struct uart_port *port) wr_regl(port, USI_OPTION, USI_HWACG_CLKREQ_ON); } +static void exynos_usi_stop(struct uart_port *port) +{ + /* when USI CLKSTOP_ON is set high, this makes the + * Q-ch state enter into STOP state by driving both the + * IP_CLKREQ and IP_BUSACTREQ as low + */ + wr_regl(port, USI_OPTION, USI_HWACG_CLKSTOP_ON); +} + /* s3c24xx_serial_resetport * * reset the fifos and other the settings. @@ -1731,6 +1741,7 @@ static int s3c24xx_serial_suspend(struct device *dev) ucon = rd_regl(port, S3C2410_UCON); ucon &= ~(S3C2410_UCON_RXIRQMODE | S3C2410_UCON_TXIRQMODE) ; wr_regl(port, S3C2410_UCON, ucon); + exynos_usi_stop(port); uart_clock_disable(ourport); rx_enabled(port) = 0; -- 2.20.1