[PATCH 6/6 resend] ark3116: Registers 0-7 are 8250 compatible

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

 



Replace numeric constants with macros from serial_reg.h.
Bart Hartgers pointed out that this devices appears to be a
 16450 hiding behind a USB interface.
---
 drivers/usb/serial/ark3116.c |   97 +++++++++++++++++++++---------------------
 1 files changed, 49 insertions(+), 48 deletions(-)

diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 0ab6333..66ef0c5 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -24,6 +24,7 @@
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
 #include <linux/serial.h>
+#include <linux/serial_reg.h>
 #include <linux/uaccess.h>
 
 
@@ -77,8 +78,8 @@ static int ark3116_attach(struct usb_serial *serial)
 		dbg("IrDA mode");
 
 	/* 3 */
-	ark3116_send(serial, 0x02, 0x08);
-	ark3116_send(serial, 0x01, 0x08);
+	ark3116_send(serial, UART_FCR, 0x08);
+	ark3116_send(serial, UART_IER, 0x08);
 	ark3116_send(serial, 0x08, 0x00);
 	ark3116_send(serial, 0x0b, is_irda(serial) ? 0x01 : 0x00);
 
@@ -89,47 +90,47 @@ static int ark3116_attach(struct usb_serial *serial)
 	}
 
 	/* <-- seq7 */
-	ark3116_recv(serial, 0x03, buf);
-	ark3116_send(serial, 0x03, 0x80);
-	ark3116_send(serial, 0x00, 0x1A);
-	ark3116_send(serial, 0x01, 0x00);
-	ark3116_send(serial, 0x03, 0x00);
+	ark3116_recv(serial, UART_LCR, buf);
+	ark3116_send(serial, UART_LCR, 0x80);
+	ark3116_send(serial, UART_DLL, 0x1A);
+	ark3116_send(serial, UART_DLM, 0x00);
+	ark3116_send(serial, UART_LCR, 0x00);
 
 	/* <-- seq12 */
-	ark3116_recv(serial, 0x04, buf);
-	ark3116_send(serial, 0x04, 0x00);
+	ark3116_recv(serial, UART_MCR, buf);
+	ark3116_send(serial, UART_MCR, 0x00);
 
 	/* 14 */
-	ark3116_recv(serial, 0x04, buf);
-	ark3116_send(serial, 0x04, 0x00);
+	ark3116_recv(serial, UART_MCR, buf);
+	ark3116_send(serial, UART_MCR, 0x00);
 
 	/* 16 */
-	ark3116_recv(serial, 0x04, buf);
+	ark3116_recv(serial, UART_MCR, buf);
 	/* --> seq17 */
-	ark3116_send(serial, 0x04, 0x01);
+	ark3116_send(serial, UART_MCR, 0x01);
 
 	/* <-- seq18 */
-	ark3116_recv(serial, 0x04, buf);
+	ark3116_recv(serial, UART_MCR, buf);
 
 	/* --> seq19 */
-	ark3116_send(serial, 0x04, 0x03);
+	ark3116_send(serial, UART_MCR, 0x03);
 
 	/* <-- seq20 */
 	/* seems like serial port status info (RTS, CTS, ...) */
 	/* returns modem control line status?! */
-	ark3116_recv(serial, 0x06, buf);
+	ark3116_recv(serial, UART_MSR, buf);
 
 	/* set 9600 baud & do some init?! */
-	ark3116_send(serial, 0x03, 0x83);
-	ark3116_send(serial, 0x00, 0x38);
-	ark3116_send(serial, 0x01, 0x01);
+	ark3116_send(serial, UART_LCR, 0x83);
+	ark3116_send(serial, UART_DLL, 0x38);
+	ark3116_send(serial, UART_DLM, 0x01);
 	if (is_irda(serial))
 		ark3116_send(serial, 0x09, 0x00);
-	ark3116_send(serial, 0x03, 0x03);
-	ark3116_recv(serial, 0x04, buf);
-	ark3116_send(serial, 0x03, 0x00);
-	ark3116_recv(serial, 0x03, buf);
-	ark3116_send(serial, 0x03, 0x03);
+	ark3116_send(serial, UART_LCR, 0x03);
+	ark3116_recv(serial, UART_MCR, buf);
+	ark3116_send(serial, UART_LCR, 0x00);
+	ark3116_recv(serial, UART_LCR, buf);
+	ark3116_send(serial, UART_LCR, 0x03);
 
 	kfree(buf);
 	return 0;
@@ -259,7 +260,7 @@ static void ark3116_set_termios(struct tty_struct *tty,
 		ark3116_baud = 3000000 / baud;
 
 	/* ? */
-	ark3116_recv(serial, 0x03, buf);
+	ark3116_recv(serial, UART_LCR, buf);
 
 	/* offset = buf[0]; */
 	/* offset = 0x03; */
@@ -267,19 +268,19 @@ static void ark3116_set_termios(struct tty_struct *tty,
 
 	/* set baudrate */
 	dbg("setting baudrate to %d (->reg=%d)", baud, ark3116_baud);
-	ark3116_send(serial, 0x03, 0x83);
-	ark3116_send(serial, 0x00, (ark3116_baud & 0x00FF));
-	ark3116_send(serial, 0x01, (ark3116_baud & 0xFF00) >> 8);
-	ark3116_send(serial, 0x03, 0x03);
+	ark3116_send(serial, UART_LCR, 0x83);
+	ark3116_send(serial, UART_DLL, (ark3116_baud & 0x00FF));
+	ark3116_send(serial, UART_DLM, (ark3116_baud & 0xFF00) >> 8);
+	ark3116_send(serial, UART_LCR, 0x03);
 
 	/* ? */
-	ark3116_recv(serial, 0x04, buf);
-	ark3116_send(serial, 0x03, 0x00);
+	ark3116_recv(serial, UART_MCR, buf);
+	ark3116_send(serial, UART_LCR, 0x00);
 
 	/* set data bit count, stop bit count & parity: */
 	dbg("updating bit count, stop bit or parity (cfg=0x%02X)", config);
-	ark3116_recv(serial, 0x03, buf);
-	ark3116_send(serial, 0x03, config);
+	ark3116_recv(serial, UART_LCR, buf);
+	ark3116_send(serial, UART_LCR, config);
 
 	if (cflag & CRTSCTS)
 		dbg("CRTSCTS not supported by chipset?!");
@@ -311,29 +312,29 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
 		goto err_out;
 
 	/* open */
-	ark3116_recv(serial, 0x03, buf);
+	ark3116_recv(serial, UART_LCR, buf);
 
-	ark3116_send(serial, 0x03, 0x82);
-	ark3116_send(serial, 0x00, 0x1A);
-	ark3116_send(serial, 0x01, 0x00);
-	ark3116_send(serial, 0x03, 0x02);
+	ark3116_send(serial, UART_LCR, 0x82);
+	ark3116_send(serial, UART_DLL, 0x1A);
+	ark3116_send(serial, UART_DLM, 0x00);
+	ark3116_send(serial, UART_LCR, 0x02);
 
-	ark3116_recv(serial, 0x04, buf);
-	ark3116_send(serial, 0x04, 0x02);
+	ark3116_recv(serial, UART_MCR, buf);
+	ark3116_send(serial, UART_MCR, 0x02);
 
-	ark3116_recv(serial, 0x04, buf);
-	ark3116_send(serial, 0x04, 0x00);
+	ark3116_recv(serial, UART_MCR, buf);
+	ark3116_send(serial, UART_MCR, 0x00);
 
-	ark3116_recv(serial, 0x04, buf);
+	ark3116_recv(serial, UART_MCR, buf);
 
-	ark3116_send(serial, 0x04, 0x01);
+	ark3116_send(serial, UART_MCR, 0x01);
 
-	ark3116_recv(serial, 0x04, buf);
+	ark3116_recv(serial, UART_MCR, buf);
 
-	ark3116_send(serial, 0x04, 0x03);
+	ark3116_send(serial, UART_MCR, 0x03);
 
 	/* returns different values (control lines?!) */
-	ark3116_recv(serial, 0x06, buf);
+	ark3116_recv(serial, UART_MSR, buf);
 
 	/* initialise termios */
 	if (tty)
@@ -398,7 +399,7 @@ static int ark3116_tiocmget(struct tty_struct *tty, struct file *file)
 	}
 
 	/* read register */
-	ark3116_recv(serial, 0x06, buf);
+	ark3116_recv(serial, UART_MSR, buf);
 	temp = buf[0];
 	kfree(buf);
 
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux