diff options
author | Bill Pemberton <wfp5p@virginia.edu> | 2010-08-05 17:01:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-23 23:50:15 -0400 |
commit | 79f203a26a07a9d5701c404925e85eb161b72cde (patch) | |
tree | 3bbe3adb4561aa3889b56e5bd624cd133edb6290 /drivers/usb/serial/ssu100.c | |
parent | 9b2cef31f2823558eb92a35624d37439599f3f9f (diff) |
USB: ssu100: remove duplicate #defines in ssu100
The ssu100 uses a TI16C550C UART so the SERIAL_ defines in this code
are duplicates of those found in serial_reg.h. Remove the defines in
ssu100.c and use the ones in the header file.
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/ssu100.c')
-rw-r--r-- | drivers/usb/serial/ssu100.c | 86 |
1 files changed, 31 insertions, 55 deletions
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index c7193880a2b6..3c586b5790e1 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/serial.h> | 15 | #include <linux/serial.h> |
16 | #include <linux/usb.h> | 16 | #include <linux/usb.h> |
17 | #include <linux/usb/serial.h> | 17 | #include <linux/usb/serial.h> |
18 | #include <linux/serial_reg.h> | ||
18 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
19 | 20 | ||
20 | #define QT_OPEN_CLOSE_CHANNEL 0xca | 21 | #define QT_OPEN_CLOSE_CHANNEL 0xca |
@@ -27,36 +28,11 @@ | |||
27 | #define QT_HW_FLOW_CONTROL_MASK 0xc5 | 28 | #define QT_HW_FLOW_CONTROL_MASK 0xc5 |
28 | #define QT_SW_FLOW_CONTROL_MASK 0xc6 | 29 | #define QT_SW_FLOW_CONTROL_MASK 0xc6 |
29 | 30 | ||
30 | #define MODEM_CTL_REGISTER 0x04 | ||
31 | #define MODEM_STATUS_REGISTER 0x06 | ||
32 | |||
33 | |||
34 | #define SERIAL_LSR_OE 0x02 | ||
35 | #define SERIAL_LSR_PE 0x04 | ||
36 | #define SERIAL_LSR_FE 0x08 | ||
37 | #define SERIAL_LSR_BI 0x10 | ||
38 | |||
39 | #define SERIAL_LSR_TEMT 0x40 | ||
40 | |||
41 | #define SERIAL_MCR_DTR 0x01 | ||
42 | #define SERIAL_MCR_RTS 0x02 | ||
43 | #define SERIAL_MCR_LOOP 0x10 | ||
44 | |||
45 | #define SERIAL_MSR_CTS 0x10 | ||
46 | #define SERIAL_MSR_CD 0x80 | ||
47 | #define SERIAL_MSR_RI 0x40 | ||
48 | #define SERIAL_MSR_DSR 0x20 | ||
49 | #define SERIAL_MSR_MASK 0xf0 | 31 | #define SERIAL_MSR_MASK 0xf0 |
50 | 32 | ||
51 | #define SERIAL_CRTSCTS ((SERIAL_MCR_RTS << 8) | SERIAL_MSR_CTS) | 33 | #define SERIAL_CRTSCTS ((UART_MCR_RTS << 8) | UART_MSR_CTS) |
52 | |||
53 | #define SERIAL_8_DATA 0x03 | ||
54 | #define SERIAL_7_DATA 0x02 | ||
55 | #define SERIAL_6_DATA 0x01 | ||
56 | #define SERIAL_5_DATA 0x00 | ||
57 | 34 | ||
58 | #define SERIAL_ODD_PARITY 0X08 | 35 | #define SERIAL_EVEN_PARITY (UART_LCR_PARITY | UART_LCR_EPAR) |
59 | #define SERIAL_EVEN_PARITY 0X18 | ||
60 | 36 | ||
61 | #define MAX_BAUD_RATE 460800 | 37 | #define MAX_BAUD_RATE 460800 |
62 | 38 | ||
@@ -153,7 +129,7 @@ static inline int ssu100_setregister(struct usb_device *dev, | |||
153 | unsigned short uart, | 129 | unsigned short uart, |
154 | u16 data) | 130 | u16 data) |
155 | { | 131 | { |
156 | u16 value = (data << 8) | MODEM_CTL_REGISTER; | 132 | u16 value = (data << 8) | UART_MCR; |
157 | 133 | ||
158 | return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 134 | return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
159 | QT_SET_GET_REGISTER, 0x40, value, uart, | 135 | QT_SET_GET_REGISTER, 0x40, value, uart, |
@@ -179,9 +155,9 @@ static inline int update_mctrl(struct usb_device *dev, unsigned int set, | |||
179 | clear &= ~set; /* 'set' takes precedence over 'clear' */ | 155 | clear &= ~set; /* 'set' takes precedence over 'clear' */ |
180 | urb_value = 0; | 156 | urb_value = 0; |
181 | if (set & TIOCM_DTR) | 157 | if (set & TIOCM_DTR) |
182 | urb_value |= SERIAL_MCR_DTR; | 158 | urb_value |= UART_MCR_DTR; |
183 | if (set & TIOCM_RTS) | 159 | if (set & TIOCM_RTS) |
184 | urb_value |= SERIAL_MCR_RTS; | 160 | urb_value |= UART_MCR_RTS; |
185 | 161 | ||
186 | result = ssu100_setregister(dev, 0, urb_value); | 162 | result = ssu100_setregister(dev, 0, urb_value); |
187 | if (result < 0) | 163 | if (result < 0) |
@@ -265,24 +241,24 @@ static void ssu100_set_termios(struct tty_struct *tty, | |||
265 | 241 | ||
266 | if (cflag & PARENB) { | 242 | if (cflag & PARENB) { |
267 | if (cflag & PARODD) | 243 | if (cflag & PARODD) |
268 | urb_value |= SERIAL_ODD_PARITY; | 244 | urb_value |= UART_LCR_PARITY; |
269 | else | 245 | else |
270 | urb_value |= SERIAL_EVEN_PARITY; | 246 | urb_value |= SERIAL_EVEN_PARITY; |
271 | } | 247 | } |
272 | 248 | ||
273 | switch (cflag & CSIZE) { | 249 | switch (cflag & CSIZE) { |
274 | case CS5: | 250 | case CS5: |
275 | urb_value |= SERIAL_5_DATA; | 251 | urb_value |= UART_LCR_WLEN5; |
276 | break; | 252 | break; |
277 | case CS6: | 253 | case CS6: |
278 | urb_value |= SERIAL_6_DATA; | 254 | urb_value |= UART_LCR_WLEN6; |
279 | break; | 255 | break; |
280 | case CS7: | 256 | case CS7: |
281 | urb_value |= SERIAL_7_DATA; | 257 | urb_value |= UART_LCR_WLEN7; |
282 | break; | 258 | break; |
283 | default: | 259 | default: |
284 | case CS8: | 260 | case CS8: |
285 | urb_value |= SERIAL_8_DATA; | 261 | urb_value |= UART_LCR_WLEN8; |
286 | break; | 262 | break; |
287 | } | 263 | } |
288 | 264 | ||
@@ -353,11 +329,11 @@ static int ssu100_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
353 | } | 329 | } |
354 | 330 | ||
355 | spin_lock_irqsave(&priv->status_lock, flags); | 331 | spin_lock_irqsave(&priv->status_lock, flags); |
356 | priv->shadowLSR = data[0] & (SERIAL_LSR_OE | SERIAL_LSR_PE | | 332 | priv->shadowLSR = data[0] & (UART_LSR_OE | UART_LSR_PE | |
357 | SERIAL_LSR_FE | SERIAL_LSR_BI); | 333 | UART_LSR_FE | UART_LSR_BI); |
358 | 334 | ||
359 | priv->shadowMSR = data[1] & (SERIAL_MSR_CTS | SERIAL_MSR_DSR | | 335 | priv->shadowMSR = data[1] & (UART_MSR_CTS | UART_MSR_DSR | |
360 | SERIAL_MSR_RI | SERIAL_MSR_CD); | 336 | UART_MSR_RI | UART_MSR_DCD); |
361 | spin_unlock_irqrestore(&priv->status_lock, flags); | 337 | spin_unlock_irqrestore(&priv->status_lock, flags); |
362 | 338 | ||
363 | kfree(data); | 339 | kfree(data); |
@@ -430,10 +406,10 @@ static int ssu100_ioctl(struct tty_struct *tty, struct file *file, | |||
430 | /* Return 0 if caller wanted to know about | 406 | /* Return 0 if caller wanted to know about |
431 | these bits */ | 407 | these bits */ |
432 | 408 | ||
433 | if (((arg & TIOCM_RNG) && (diff & SERIAL_MSR_RI)) || | 409 | if (((arg & TIOCM_RNG) && (diff & UART_MSR_RI)) || |
434 | ((arg & TIOCM_DSR) && (diff & SERIAL_MSR_DSR)) || | 410 | ((arg & TIOCM_DSR) && (diff & UART_MSR_DSR)) || |
435 | ((arg & TIOCM_CD) && (diff & SERIAL_MSR_CD)) || | 411 | ((arg & TIOCM_CD) && (diff & UART_MSR_DCD)) || |
436 | ((arg & TIOCM_CTS) && (diff & SERIAL_MSR_CTS))) | 412 | ((arg & TIOCM_CTS) && (diff & UART_MSR_CTS))) |
437 | return 0; | 413 | return 0; |
438 | } | 414 | } |
439 | } | 415 | } |
@@ -513,20 +489,20 @@ static int ssu100_tiocmget(struct tty_struct *tty, struct file *file) | |||
513 | if (!d) | 489 | if (!d) |
514 | return -ENOMEM; | 490 | return -ENOMEM; |
515 | 491 | ||
516 | r = ssu100_getregister(dev, 0, MODEM_CTL_REGISTER, d); | 492 | r = ssu100_getregister(dev, 0, UART_MCR, d); |
517 | if (r < 0) | 493 | if (r < 0) |
518 | goto mget_out; | 494 | goto mget_out; |
519 | 495 | ||
520 | r = ssu100_getregister(dev, 0, MODEM_STATUS_REGISTER, d+1); | 496 | r = ssu100_getregister(dev, 0, UART_MSR, d+1); |
521 | if (r < 0) | 497 | if (r < 0) |
522 | goto mget_out; | 498 | goto mget_out; |
523 | 499 | ||
524 | r = (d[0] & SERIAL_MCR_DTR ? TIOCM_DTR : 0) | | 500 | r = (d[0] & UART_MCR_DTR ? TIOCM_DTR : 0) | |
525 | (d[0] & SERIAL_MCR_RTS ? TIOCM_RTS : 0) | | 501 | (d[0] & UART_MCR_RTS ? TIOCM_RTS : 0) | |
526 | (d[1] & SERIAL_MSR_CTS ? TIOCM_CTS : 0) | | 502 | (d[1] & UART_MSR_CTS ? TIOCM_CTS : 0) | |
527 | (d[1] & SERIAL_MSR_CD ? TIOCM_CAR : 0) | | 503 | (d[1] & UART_MSR_DCD ? TIOCM_CAR : 0) | |
528 | (d[1] & SERIAL_MSR_RI ? TIOCM_RI : 0) | | 504 | (d[1] & UART_MSR_RI ? TIOCM_RI : 0) | |
529 | (d[1] & SERIAL_MSR_DSR ? TIOCM_DSR : 0); | 505 | (d[1] & UART_MSR_DSR ? TIOCM_DSR : 0); |
530 | 506 | ||
531 | mget_out: | 507 | mget_out: |
532 | kfree(d); | 508 | kfree(d); |
@@ -579,10 +555,10 @@ static int ssu100_process_packet(struct tty_struct *tty, | |||
579 | (packet[0] == 0x1b) && (packet[1] == 0x1b) && | 555 | (packet[0] == 0x1b) && (packet[1] == 0x1b) && |
580 | ((packet[2] == 0x00) || (packet[2] == 0x01))) { | 556 | ((packet[2] == 0x00) || (packet[2] == 0x01))) { |
581 | if (packet[2] == 0x00) | 557 | if (packet[2] == 0x00) |
582 | priv->shadowLSR = packet[3] & (SERIAL_LSR_OE | | 558 | priv->shadowLSR = packet[3] & (UART_LSR_OE | |
583 | SERIAL_LSR_PE | | 559 | UART_LSR_PE | |
584 | SERIAL_LSR_FE | | 560 | UART_LSR_FE | |
585 | SERIAL_LSR_BI); | 561 | UART_LSR_BI); |
586 | 562 | ||
587 | if (packet[2] == 0x01) { | 563 | if (packet[2] == 0x01) { |
588 | priv->shadowMSR = packet[3]; | 564 | priv->shadowMSR = packet[3]; |