diff options
author | Martin K. Petersen <mkp@mkp.net> | 2007-05-22 15:57:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:29:48 -0400 |
commit | fc4cbd755b75c7687b923da5b75ba4a64652582e (patch) | |
tree | a74e17f37aa2158f980636d24f75cf84b94d71ec /drivers/usb/serial/io_ti.c | |
parent | dd4dd19e8d13e1e9bf8295bf71f132b511b130bf (diff) |
USB: io_ti: Digi EdgePort update for new devices
This patch adds support for the most recent Digi EdgePort USB serial
devices.
Signed-off-by: Martin K. Petersen <mkp@mkp.net>
Signed-off-by: Mike Swift <mikes@digi.com>
Signed-off-by: Jeremy McBane <jmcbane@digi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r-- | drivers/usb/serial/io_ti.c | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 544098d2b775..0bd34f8a5db6 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -48,7 +48,7 @@ | |||
48 | /* | 48 | /* |
49 | * Version Information | 49 | * Version Information |
50 | */ | 50 | */ |
51 | #define DRIVER_VERSION "v0.7" | 51 | #define DRIVER_VERSION "v0.7mode043006" |
52 | #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com> and David Iacovelli" | 52 | #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com> and David Iacovelli" |
53 | #define DRIVER_DESC "Edgeport USB Serial Driver" | 53 | #define DRIVER_DESC "Edgeport USB Serial Driver" |
54 | 54 | ||
@@ -173,8 +173,12 @@ static struct usb_device_id edgeport_2port_id_table [] = { | |||
173 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_221C) }, | 173 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_221C) }, |
174 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_22C) }, | 174 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_22C) }, |
175 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_21C) }, | 175 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_21C) }, |
176 | // The 4-port shows up as two 2-port devices | 176 | /* The 4, 8 and 16 port devices show up as multiple 2 port devices */ |
177 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_4S) }, | 177 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_4S) }, |
178 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8) }, | ||
179 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8S) }, | ||
180 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416) }, | ||
181 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416B) }, | ||
178 | { } | 182 | { } |
179 | }; | 183 | }; |
180 | 184 | ||
@@ -209,6 +213,10 @@ static struct usb_device_id id_table_combined [] = { | |||
209 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_22C) }, | 213 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_22C) }, |
210 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_21C) }, | 214 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_21C) }, |
211 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_4S) }, | 215 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_4S) }, |
216 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8) }, | ||
217 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8S) }, | ||
218 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416) }, | ||
219 | { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416B) }, | ||
212 | { } | 220 | { } |
213 | }; | 221 | }; |
214 | 222 | ||
@@ -231,6 +239,7 @@ static int TIStayInBootMode = 0; | |||
231 | static int low_latency = EDGE_LOW_LATENCY; | 239 | static int low_latency = EDGE_LOW_LATENCY; |
232 | static int closing_wait = EDGE_CLOSING_WAIT; | 240 | static int closing_wait = EDGE_CLOSING_WAIT; |
233 | static int ignore_cpu_rev = 0; | 241 | static int ignore_cpu_rev = 0; |
242 | static int default_uart_mode = 0; /* RS232 */ | ||
234 | 243 | ||
235 | 244 | ||
236 | static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned char *data, int length); | 245 | static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned char *data, int length); |
@@ -241,6 +250,10 @@ static int restart_read(struct edgeport_port *edge_port); | |||
241 | static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios); | 250 | static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios); |
242 | static void edge_send(struct usb_serial_port *port); | 251 | static void edge_send(struct usb_serial_port *port); |
243 | 252 | ||
253 | /* sysfs attributes */ | ||
254 | static int edge_create_sysfs_attrs(struct usb_serial_port *port); | ||
255 | static int edge_remove_sysfs_attrs(struct usb_serial_port *port); | ||
256 | |||
244 | /* circular buffer */ | 257 | /* circular buffer */ |
245 | static struct edge_buf *edge_buf_alloc(unsigned int size); | 258 | static struct edge_buf *edge_buf_alloc(unsigned int size); |
246 | static void edge_buf_free(struct edge_buf *eb); | 259 | static void edge_buf_free(struct edge_buf *eb); |
@@ -2758,7 +2771,7 @@ static int edge_startup (struct usb_serial *serial) | |||
2758 | edge_port->port = serial->port[i]; | 2771 | edge_port->port = serial->port[i]; |
2759 | edge_port->edge_serial = edge_serial; | 2772 | edge_port->edge_serial = edge_serial; |
2760 | usb_set_serial_port_data(serial->port[i], edge_port); | 2773 | usb_set_serial_port_data(serial->port[i], edge_port); |
2761 | edge_port->bUartMode = 0; /* Default is RS232 */ | 2774 | edge_port->bUartMode = default_uart_mode; |
2762 | } | 2775 | } |
2763 | 2776 | ||
2764 | return 0; | 2777 | return 0; |
@@ -2784,6 +2797,7 @@ static void edge_shutdown (struct usb_serial *serial) | |||
2784 | 2797 | ||
2785 | for (i=0; i < serial->num_ports; ++i) { | 2798 | for (i=0; i < serial->num_ports; ++i) { |
2786 | edge_port = usb_get_serial_port_data(serial->port[i]); | 2799 | edge_port = usb_get_serial_port_data(serial->port[i]); |
2800 | edge_remove_sysfs_attrs(edge_port->port); | ||
2787 | if (edge_port) { | 2801 | if (edge_port) { |
2788 | edge_buf_free(edge_port->ep_out_buf); | 2802 | edge_buf_free(edge_port->ep_out_buf); |
2789 | kfree(edge_port); | 2803 | kfree(edge_port); |
@@ -2795,6 +2809,48 @@ static void edge_shutdown (struct usb_serial *serial) | |||
2795 | } | 2809 | } |
2796 | 2810 | ||
2797 | 2811 | ||
2812 | /* Sysfs Attributes */ | ||
2813 | |||
2814 | static ssize_t show_uart_mode(struct device *dev, | ||
2815 | struct device_attribute *attr, char *buf) | ||
2816 | { | ||
2817 | struct usb_serial_port *port = to_usb_serial_port(dev); | ||
2818 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | ||
2819 | |||
2820 | return sprintf(buf, "%d\n", edge_port->bUartMode); | ||
2821 | } | ||
2822 | |||
2823 | static ssize_t store_uart_mode(struct device *dev, | ||
2824 | struct device_attribute *attr, const char *valbuf, size_t count) | ||
2825 | { | ||
2826 | struct usb_serial_port *port = to_usb_serial_port(dev); | ||
2827 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | ||
2828 | unsigned int v = simple_strtoul(valbuf, NULL, 0); | ||
2829 | |||
2830 | dbg("%s: setting uart_mode = %d", __FUNCTION__, v); | ||
2831 | |||
2832 | if (v < 256) | ||
2833 | edge_port->bUartMode = v; | ||
2834 | else | ||
2835 | dev_err(dev, "%s - uart_mode %d is invalid\n", __FUNCTION__, v); | ||
2836 | |||
2837 | return count; | ||
2838 | } | ||
2839 | |||
2840 | static DEVICE_ATTR(uart_mode, S_IWUSR | S_IRUGO, show_uart_mode, store_uart_mode); | ||
2841 | |||
2842 | static int edge_create_sysfs_attrs(struct usb_serial_port *port) | ||
2843 | { | ||
2844 | return device_create_file(&port->dev, &dev_attr_uart_mode); | ||
2845 | } | ||
2846 | |||
2847 | static int edge_remove_sysfs_attrs(struct usb_serial_port *port) | ||
2848 | { | ||
2849 | device_remove_file(&port->dev, &dev_attr_uart_mode); | ||
2850 | return 0; | ||
2851 | } | ||
2852 | |||
2853 | |||
2798 | /* Circular Buffer */ | 2854 | /* Circular Buffer */ |
2799 | 2855 | ||
2800 | /* | 2856 | /* |
@@ -2991,6 +3047,7 @@ static struct usb_serial_driver edgeport_1port_device = { | |||
2991 | .unthrottle = edge_unthrottle, | 3047 | .unthrottle = edge_unthrottle, |
2992 | .attach = edge_startup, | 3048 | .attach = edge_startup, |
2993 | .shutdown = edge_shutdown, | 3049 | .shutdown = edge_shutdown, |
3050 | .port_probe = edge_create_sysfs_attrs, | ||
2994 | .ioctl = edge_ioctl, | 3051 | .ioctl = edge_ioctl, |
2995 | .set_termios = edge_set_termios, | 3052 | .set_termios = edge_set_termios, |
2996 | .tiocmget = edge_tiocmget, | 3053 | .tiocmget = edge_tiocmget, |
@@ -3022,6 +3079,7 @@ static struct usb_serial_driver edgeport_2port_device = { | |||
3022 | .unthrottle = edge_unthrottle, | 3079 | .unthrottle = edge_unthrottle, |
3023 | .attach = edge_startup, | 3080 | .attach = edge_startup, |
3024 | .shutdown = edge_shutdown, | 3081 | .shutdown = edge_shutdown, |
3082 | .port_probe = edge_create_sysfs_attrs, | ||
3025 | .ioctl = edge_ioctl, | 3083 | .ioctl = edge_ioctl, |
3026 | .set_termios = edge_set_termios, | 3084 | .set_termios = edge_set_termios, |
3027 | .tiocmget = edge_tiocmget, | 3085 | .tiocmget = edge_tiocmget, |
@@ -3085,3 +3143,6 @@ MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs"); | |||
3085 | module_param(ignore_cpu_rev, bool, S_IRUGO | S_IWUSR); | 3143 | module_param(ignore_cpu_rev, bool, S_IRUGO | S_IWUSR); |
3086 | MODULE_PARM_DESC(ignore_cpu_rev, "Ignore the cpu revision when connecting to a device"); | 3144 | MODULE_PARM_DESC(ignore_cpu_rev, "Ignore the cpu revision when connecting to a device"); |
3087 | 3145 | ||
3146 | module_param(default_uart_mode, int, S_IRUGO | S_IWUSR); | ||
3147 | MODULE_PARM_DESC(default_uart_mode, "Default uart_mode, 0=RS232, ..."); | ||
3148 | |||