/*
* USB Cypress M8 driver
*
* Copyright (C) 2004
* Lonnie Mendez (dignome@gmail.com)
* Copyright (C) 2003,2004
* Neil Whelchel (koyama@firstlight.net)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* See Documentation/usb/usb-serial.txt for more information on using this
* driver
*
* See http://geocities.com/i0xox0i for information on this driver and the
* earthmate usb device.
*
* Lonnie Mendez <dignome@gmail.com>
* 4-29-2005
* Fixed problem where setting or retreiving the serial config would fail
* with EPIPE. Removed CRTS toggling so the driver behaves more like
* other usbserial adapters. Issued new interval of 1ms instead of the
* default 10ms. As a result, transfer speed has been substantially
* increased from avg. 850bps to avg. 3300bps. initial termios has also
* been modified. Cleaned up code and formatting issues so it is more
* readable. Replaced the C++ style comments.
*
* Lonnie Mendez <dignome@gmail.com>
* 12-15-2004
* Incorporated write buffering from pl2303 driver. Fixed bug with line
* handling so both lines are raised in cypress_open. (was dropping rts)
* Various code cleanups made as well along with other misc bug fixes.
*
* Lonnie Mendez <dignome@gmail.com>
* 04-10-2004
* Driver modified to support dynamic line settings. Various improvements
* and features.
*
* Neil Whelchel
* 10-2003
* Driver first released.
*
*/
/* Thanks to Neil Whelchel for writing the first cypress m8 implementation
for linux. */
/* Thanks to cypress for providing references for the hid reports. */
/* Thanks to Jiang Zhang for providing links and for general help. */
/* Code originates and was built up from ftdi_sio, belkin, pl2303 and others.*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/spinlock.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
#include <linux/serial.h>
#include <linux/kfifo.h>
#include <linux/delay.h>
#include <linux/uaccess.h>
#include <asm/unaligned.h>
#include "cypress_m8.h"
static int debug;
static int stats;
static int interval;
static int unstable_bauds;
/*
* Version Information
*/
#define DRIVER_VERSION "v1.10"
#define DRIVER_AUTHOR "Lonnie Mendez <dignome@gmail.com>, Neil Whelchel <koyama@firstlight.net>"
#define DRIVER_DESC "Cypress USB to Serial Driver"
/* write buffer size defines */
#define CYPRESS_BUF_SIZE 1024
static const struct usb_device_id id_table_earthmate[] = {
{ USB_DEVICE