]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tty: serial: samsung_tty: loopback mode support
authorChanho Park <chanho61.park@samsung.com>
Wed, 29 Jun 2022 00:41:41 +0000 (09:41 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jun 2022 15:09:08 +0000 (17:09 +0200)
Internal loopback mode can be supported by setting
UCON register's Loopback Mode bit. The mode & bit can be supported
since s3c2410 and later SoCs. The prefix of LOOPBACK / BIT(5) naming
should be also changed to S3C2410_ in order to avoid confusion.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Link: https://lore.kernel.org/r/20220629004141.51484-1-chanho61.park@samsung.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/samsung_tty.c
include/linux/serial_s3c.h

index 3e0aa292360505090aa0d4e80c6a573d577a3193..8971fbb49fa3d2ab275f696d079de80d1bd78a43 100644 (file)
@@ -1018,6 +1018,7 @@ static unsigned int s3c24xx_serial_get_mctrl(struct uart_port *port)
 static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
        unsigned int umcon = rd_regl(port, S3C2410_UMCON);
+       unsigned int ucon = rd_reg(port, S3C2410_UCON);
 
        if (mctrl & TIOCM_RTS)
                umcon |= S3C2410_UMCOM_RTS_LOW;
@@ -1025,6 +1026,13 @@ static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
                umcon &= ~S3C2410_UMCOM_RTS_LOW;
 
        wr_regl(port, S3C2410_UMCON, umcon);
+
+       if (mctrl & TIOCM_LOOP)
+               ucon |= S3C2410_UCON_LOOPBACK;
+       else
+               ucon &= ~S3C2410_UCON_LOOPBACK;
+
+       wr_regl(port, S3C2410_UCON, ucon);
 }
 
 static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_state)
index dec15f5b3decb5d98544a9b409fbab8e3e2f1963..1672cf0810ef549abab33601f085a9ba3b445d58 100644 (file)
@@ -83,7 +83,7 @@
 #define S3C2410_UCON_RXIRQMODE   (1<<0)
 #define S3C2410_UCON_RXFIFO_TOI          (1<<7)
 #define S3C2443_UCON_RXERR_IRQEN  (1<<6)
-#define S3C2443_UCON_LOOPBACK    (1<<5)
+#define S3C2410_UCON_LOOPBACK    (1<<5)
 
 #define S3C2410_UCON_DEFAULT     (S3C2410_UCON_TXILEVEL  | \
                                   S3C2410_UCON_RXILEVEL  | \