[PATCH] tty: serial: Bug fix XR17C/D Exar chips sleep request.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



charset=utf-8
Content-Transfer-Encoding: 8bit

The Exar XR17C/D15x PCI chips does not have the same write protection as
the PCI Express chips, so it is required to make sure that we are setting
or clearing the right bit while controlling sleep mode.

Signed-off-by: Jonatan Goebel <jonatan.goebel@xxxxxxxxxxxx>
---
 drivers/tty/serial/8250/8250_port.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 3f779d25ec0c..7ab4041e3619 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -717,12 +717,30 @@ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
 	 * bit.
 	 */
 	serial8250_rpm_get(p);
-	if ((p->port.type == PORT_XR17V35X) ||
-	   (p->port.type == PORT_XR17D15X)) {
+	if (p->port.type == PORT_XR17V35X) {
 		serial_out(p, UART_EXAR_SLEEP, sleep ? 0xff : 0);
 		goto out;
 	}
 
+	/*
+	 * On the XR17D15x the UART channel may write to all bits, so we
+	 * need to be careful.
+	 */
+	if (p->port.type == PORT_XR17D15X) {
+		int idx = (p->port.mapbase & 0xe00) >> 9; /* mapbase/0x200 */
+		unsigned int val;
+
+		val = serial_in(p, UART_EXAR_SLEEP);
+
+		if (sleep)
+			val |= (1 << idx);
+		else
+			val &= ~(1 << idx);
+
+		serial_out(p, UART_EXAR_SLEEP, val);
+		goto out;
+	}
+
 	if (p->capabilities & UART_CAP_SLEEP) {
 		if (p->capabilities & UART_CAP_EFR) {
 			lcr = serial_in(p, UART_LCR);
-- 
2.17.1


-- 
Esta mensagem foi verificada pelo sistema de antivírus e
 acredita-se estar livre de perigo.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux