diff options
-rw-r--r-- | drivers/usb/serial/cp210x.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index eac7ccaa3c85..8ba1005f6a53 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -301,6 +301,14 @@ static struct usb_serial_driver * const serial_drivers[] = { | |||
301 | #define CONTROL_WRITE_RTS 0x0200 | 301 | #define CONTROL_WRITE_RTS 0x0200 |
302 | 302 | ||
303 | /* | 303 | /* |
304 | * CP210X_PURGE - 16 bits passed in wValue of USB request. | ||
305 | * SiLabs app note AN571 gives a strange description of the 4 bits: | ||
306 | * bit 0 or bit 2 clears the transmit queue and 1 or 3 receive. | ||
307 | * writing 1 to all, however, purges cp2108 well enough to avoid the hang. | ||
308 | */ | ||
309 | #define PURGE_ALL 0x000f | ||
310 | |||
311 | /* | ||
304 | * cp210x_get_config | 312 | * cp210x_get_config |
305 | * Reads from the CP210x configuration registers | 313 | * Reads from the CP210x configuration registers |
306 | * 'size' is specified in bytes. | 314 | * 'size' is specified in bytes. |
@@ -475,7 +483,14 @@ static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
475 | 483 | ||
476 | static void cp210x_close(struct usb_serial_port *port) | 484 | static void cp210x_close(struct usb_serial_port *port) |
477 | { | 485 | { |
486 | unsigned int purge_ctl; | ||
487 | |||
478 | usb_serial_generic_close(port); | 488 | usb_serial_generic_close(port); |
489 | |||
490 | /* Clear both queues; cp2108 needs this to avoid an occasional hang */ | ||
491 | purge_ctl = PURGE_ALL; | ||
492 | cp210x_set_config(port, CP210X_PURGE, &purge_ctl, 2); | ||
493 | |||
479 | cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_DISABLE); | 494 | cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_DISABLE); |
480 | } | 495 | } |
481 | 496 | ||