aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-08-05 23:07:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-05 23:07:43 -0400
commitf72035fad84c9b51a45fd8afc8024f3df0ba8848 (patch)
tree9f6f740ee37bf11793f551c95435d2e8d687503e
parent6c84239d595dc6ffe39f0f03dae2f64ed200db95 (diff)
parent0bf048abebb6e69be3c1630878419d80944c3cfd (diff)
Merge tag 'usb-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull more USB updates from Greg KH: "Here are a few more straggler patches for USB for 4.8-rc1. Most of these are for the usb-serial driver tree. All of those have been in linux-next for a long time, but missed my previous pull request to you. The remaining change is to fix up a staging tree build error, due to some USB gadget driver changes that went in. I put it in this tree as it was for a USB driver and people are reporting the build error on your tree. All of these have been in linux-next for this week, and longer for the usb-serial changes" * tag 'usb-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: staging: emxx_udc: allow modular build USB: serial: use variable for status USB: serial: option: add support for Telit LE910 PID 0x1206 USB: serial: cp210x: use kmemdup USB: serial: ti_usb_3410_5052: use functions rather than macros USB: serial: ti_usb_3410_5052: remove ti_usb_3410_5052.h USB: serial: ti_usb_3410_5052: use __packed USB: serial: ti_usb_3410_5052: remove useless comments
-rw-r--r--drivers/staging/emxx_udc/Kconfig2
-rw-r--r--drivers/staging/emxx_udc/emxx_udc.c36
-rw-r--r--drivers/usb/serial/cp210x.c4
-rw-r--r--drivers/usb/serial/generic.c18
-rw-r--r--drivers/usb/serial/option.c3
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c271
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.h259
7 files changed, 293 insertions, 300 deletions
diff --git a/drivers/staging/emxx_udc/Kconfig b/drivers/staging/emxx_udc/Kconfig
index cc3402020487..d7577096fb25 100644
--- a/drivers/staging/emxx_udc/Kconfig
+++ b/drivers/staging/emxx_udc/Kconfig
@@ -1,5 +1,5 @@
1config USB_EMXX 1config USB_EMXX
2 bool "EMXX USB Function Device Controller" 2 tristate "EMXX USB Function Device Controller"
3 depends on USB_GADGET && (ARCH_SHMOBILE || (ARM && COMPILE_TEST)) 3 depends on USB_GADGET && (ARCH_SHMOBILE || (ARM && COMPILE_TEST))
4 help 4 help
5 The Emma Mobile series of SoCs from Renesas Electronics and 5 The Emma Mobile series of SoCs from Renesas Electronics and
diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 3bd91758b2da..3b56b2826263 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -15,7 +15,7 @@
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/module.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/ioport.h> 21#include <linux/ioport.h>
@@ -39,9 +39,11 @@
39 39
40#include "emxx_udc.h" 40#include "emxx_udc.h"
41 41
42#define DRIVER_DESC "EMXX UDC driver"
42#define DMA_ADDR_INVALID (~(dma_addr_t)0) 43#define DMA_ADDR_INVALID (~(dma_addr_t)0)
43 44
44static const char driver_name[] = "emxx_udc"; 45static const char driver_name[] = "emxx_udc";
46static const char driver_desc[] = DRIVER_DESC;
45 47
46/*===========================================================================*/ 48/*===========================================================================*/
47/* Prototype */ 49/* Prototype */
@@ -3296,6 +3298,28 @@ static void nbu2ss_drv_shutdown(struct platform_device *pdev)
3296} 3298}
3297 3299
3298/*-------------------------------------------------------------------------*/ 3300/*-------------------------------------------------------------------------*/
3301static int nbu2ss_drv_remove(struct platform_device *pdev)
3302{
3303 struct nbu2ss_udc *udc;
3304 struct nbu2ss_ep *ep;
3305 int i;
3306
3307 udc = &udc_controller;
3308
3309 for (i = 0; i < NUM_ENDPOINTS; i++) {
3310 ep = &udc->ep[i];
3311 if (ep->virt_buf)
3312 dma_free_coherent(NULL, PAGE_SIZE,
3313 (void *)ep->virt_buf, ep->phys_buf);
3314 }
3315
3316 /* Interrupt Handler - Release */
3317 free_irq(INT_VBUS, udc);
3318
3319 return 0;
3320}
3321
3322/*-------------------------------------------------------------------------*/
3299static int nbu2ss_drv_suspend(struct platform_device *pdev, pm_message_t state) 3323static int nbu2ss_drv_suspend(struct platform_device *pdev, pm_message_t state)
3300{ 3324{
3301 struct nbu2ss_udc *udc; 3325 struct nbu2ss_udc *udc;
@@ -3347,12 +3371,16 @@ static int nbu2ss_drv_resume(struct platform_device *pdev)
3347static struct platform_driver udc_driver = { 3371static struct platform_driver udc_driver = {
3348 .probe = nbu2ss_drv_probe, 3372 .probe = nbu2ss_drv_probe,
3349 .shutdown = nbu2ss_drv_shutdown, 3373 .shutdown = nbu2ss_drv_shutdown,
3374 .remove = nbu2ss_drv_remove,
3350 .suspend = nbu2ss_drv_suspend, 3375 .suspend = nbu2ss_drv_suspend,
3351 .resume = nbu2ss_drv_resume, 3376 .resume = nbu2ss_drv_resume,
3352 .driver = { 3377 .driver = {
3353 .name = driver_name, 3378 .name = driver_name,
3354 .suppress_bind_attrs = true,
3355 }, 3379 },
3356}; 3380};
3357 3381
3358builtin_platform_driver(udc_driver); 3382module_platform_driver(udc_driver);
3383
3384MODULE_DESCRIPTION(DRIVER_DESC);
3385MODULE_AUTHOR("Renesas Electronics Corporation");
3386MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 96a70789b4c2..4d6a5c672a3d 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -496,12 +496,10 @@ static int cp210x_write_reg_block(struct usb_serial_port *port, u8 req,
496 void *dmabuf; 496 void *dmabuf;
497 int result; 497 int result;
498 498
499 dmabuf = kmalloc(bufsize, GFP_KERNEL); 499 dmabuf = kmemdup(buf, bufsize, GFP_KERNEL);
500 if (!dmabuf) 500 if (!dmabuf)
501 return -ENOMEM; 501 return -ENOMEM;
502 502
503 memcpy(dmabuf, buf, bufsize);
504
505 result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 503 result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
506 req, REQTYPE_HOST_TO_INTERFACE, 0, 504 req, REQTYPE_HOST_TO_INTERFACE, 0,
507 port_priv->bInterfaceNumber, dmabuf, bufsize, 505 port_priv->bInterfaceNumber, dmabuf, bufsize,
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index ae8c0365abd6..944de657a07a 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -350,6 +350,7 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)
350 struct usb_serial_port *port = urb->context; 350 struct usb_serial_port *port = urb->context;
351 unsigned char *data = urb->transfer_buffer; 351 unsigned char *data = urb->transfer_buffer;
352 unsigned long flags; 352 unsigned long flags;
353 int status = urb->status;
353 int i; 354 int i;
354 355
355 for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) { 356 for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) {
@@ -360,22 +361,22 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb)
360 361
361 dev_dbg(&port->dev, "%s - urb %d, len %d\n", __func__, i, 362 dev_dbg(&port->dev, "%s - urb %d, len %d\n", __func__, i,
362 urb->actual_length); 363 urb->actual_length);
363 switch (urb->status) { 364 switch (status) {
364 case 0: 365 case 0:
365 break; 366 break;
366 case -ENOENT: 367 case -ENOENT:
367 case -ECONNRESET: 368 case -ECONNRESET:
368 case -ESHUTDOWN: 369 case -ESHUTDOWN:
369 dev_dbg(&port->dev, "%s - urb stopped: %d\n", 370 dev_dbg(&port->dev, "%s - urb stopped: %d\n",
370 __func__, urb->status); 371 __func__, status);
371 return; 372 return;
372 case -EPIPE: 373 case -EPIPE:
373 dev_err(&port->dev, "%s - urb stopped: %d\n", 374 dev_err(&port->dev, "%s - urb stopped: %d\n",
374 __func__, urb->status); 375 __func__, status);
375 return; 376 return;
376 default: 377 default:
377 dev_dbg(&port->dev, "%s - nonzero urb status: %d\n", 378 dev_dbg(&port->dev, "%s - nonzero urb status: %d\n",
378 __func__, urb->status); 379 __func__, status);
379 goto resubmit; 380 goto resubmit;
380 } 381 }
381 382
@@ -399,6 +400,7 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
399{ 400{
400 unsigned long flags; 401 unsigned long flags;
401 struct usb_serial_port *port = urb->context; 402 struct usb_serial_port *port = urb->context;
403 int status = urb->status;
402 int i; 404 int i;
403 405
404 for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) { 406 for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) {
@@ -410,22 +412,22 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
410 set_bit(i, &port->write_urbs_free); 412 set_bit(i, &port->write_urbs_free);
411 spin_unlock_irqrestore(&port->lock, flags); 413 spin_unlock_irqrestore(&port->lock, flags);
412 414
413 switch (urb->status) { 415 switch (status) {
414 case 0: 416 case 0:
415 break; 417 break;
416 case -ENOENT: 418 case -ENOENT:
417 case -ECONNRESET: 419 case -ECONNRESET:
418 case -ESHUTDOWN: 420 case -ESHUTDOWN:
419 dev_dbg(&port->dev, "%s - urb stopped: %d\n", 421 dev_dbg(&port->dev, "%s - urb stopped: %d\n",
420 __func__, urb->status); 422 __func__, status);
421 return; 423 return;
422 case -EPIPE: 424 case -EPIPE:
423 dev_err_console(port, "%s - urb stopped: %d\n", 425 dev_err_console(port, "%s - urb stopped: %d\n",
424 __func__, urb->status); 426 __func__, status);
425 return; 427 return;
426 default: 428 default:
427 dev_err_console(port, "%s - nonzero urb status: %d\n", 429 dev_err_console(port, "%s - nonzero urb status: %d\n",
428 __func__, urb->status); 430 __func__, status);
429 goto resubmit; 431 goto resubmit;
430 } 432 }
431 433
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index d96d423d00e6..8e07536c233a 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -273,6 +273,7 @@ static void option_instat_callback(struct urb *urb);
273#define TELIT_PRODUCT_LE922_USBCFG5 0x1045 273#define TELIT_PRODUCT_LE922_USBCFG5 0x1045
274#define TELIT_PRODUCT_LE920 0x1200 274#define TELIT_PRODUCT_LE920 0x1200
275#define TELIT_PRODUCT_LE910 0x1201 275#define TELIT_PRODUCT_LE910 0x1201
276#define TELIT_PRODUCT_LE910_USBCFG4 0x1206
276 277
277/* ZTE PRODUCTS */ 278/* ZTE PRODUCTS */
278#define ZTE_VENDOR_ID 0x19d2 279#define ZTE_VENDOR_ID 0x19d2
@@ -1198,6 +1199,8 @@ static const struct usb_device_id option_ids[] = {
1198 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, 1199 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 },
1199 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), 1200 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
1200 .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, 1201 .driver_info = (kernel_ulong_t)&telit_le910_blacklist },
1202 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
1203 .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
1201 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), 1204 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
1202 .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, 1205 .driver_info = (kernel_ulong_t)&telit_le920_blacklist },
1203 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ 1206 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index e7dbbef2af2a..07b4bf01061d 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -1,5 +1,4 @@
1/* vi: ts=8 sw=8 1/*
2 *
3 * TI 3410/5052 USB Serial Driver 2 * TI 3410/5052 USB Serial Driver
4 * 3 *
5 * Copyright (C) 2004 Texas Instruments 4 * Copyright (C) 2004 Texas Instruments
@@ -35,9 +34,238 @@
35#include <linux/usb.h> 34#include <linux/usb.h>
36#include <linux/usb/serial.h> 35#include <linux/usb/serial.h>
37 36
38#include "ti_usb_3410_5052.h" 37/* Configuration ids */
39 38#define TI_BOOT_CONFIG 1
40/* Defines */ 39#define TI_ACTIVE_CONFIG 2
40
41/* Vendor and product ids */
42#define TI_VENDOR_ID 0x0451
43#define IBM_VENDOR_ID 0x04b3
44#define TI_3410_PRODUCT_ID 0x3410
45#define IBM_4543_PRODUCT_ID 0x4543
46#define IBM_454B_PRODUCT_ID 0x454b
47#define IBM_454C_PRODUCT_ID 0x454c
48#define TI_3410_EZ430_ID 0xF430 /* TI ez430 development tool */
49#define TI_5052_BOOT_PRODUCT_ID 0x5052 /* no EEPROM, no firmware */
50#define TI_5152_BOOT_PRODUCT_ID 0x5152 /* no EEPROM, no firmware */
51#define TI_5052_EEPROM_PRODUCT_ID 0x505A /* EEPROM, no firmware */
52#define TI_5052_FIRMWARE_PRODUCT_ID 0x505F /* firmware is running */
53#define FRI2_PRODUCT_ID 0x5053 /* Fish River Island II */
54
55/* Multi-Tech vendor and product ids */
56#define MTS_VENDOR_ID 0x06E0
57#define MTS_GSM_NO_FW_PRODUCT_ID 0xF108
58#define MTS_CDMA_NO_FW_PRODUCT_ID 0xF109
59#define MTS_CDMA_PRODUCT_ID 0xF110
60#define MTS_GSM_PRODUCT_ID 0xF111
61#define MTS_EDGE_PRODUCT_ID 0xF112
62#define MTS_MT9234MU_PRODUCT_ID 0xF114
63#define MTS_MT9234ZBA_PRODUCT_ID 0xF115
64#define MTS_MT9234ZBAOLD_PRODUCT_ID 0x0319
65
66/* Abbott Diabetics vendor and product ids */
67#define ABBOTT_VENDOR_ID 0x1a61
68#define ABBOTT_STEREO_PLUG_ID 0x3410
69#define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID
70#define ABBOTT_STRIP_PORT_ID 0x3420
71
72/* Honeywell vendor and product IDs */
73#define HONEYWELL_VENDOR_ID 0x10ac
74#define HONEYWELL_HGI80_PRODUCT_ID 0x0102 /* Honeywell HGI80 */
75
76/* Moxa UPORT 11x0 vendor and product IDs */
77#define MXU1_VENDOR_ID 0x110a
78#define MXU1_1110_PRODUCT_ID 0x1110
79#define MXU1_1130_PRODUCT_ID 0x1130
80#define MXU1_1150_PRODUCT_ID 0x1150
81#define MXU1_1151_PRODUCT_ID 0x1151
82#define MXU1_1131_PRODUCT_ID 0x1131
83
84/* Commands */
85#define TI_GET_VERSION 0x01
86#define TI_GET_PORT_STATUS 0x02
87#define TI_GET_PORT_DEV_INFO 0x03
88#define TI_GET_CONFIG 0x04
89#define TI_SET_CONFIG 0x05
90#define TI_OPEN_PORT 0x06
91#define TI_CLOSE_PORT 0x07
92#define TI_START_PORT 0x08
93#define TI_STOP_PORT 0x09
94#define TI_TEST_PORT 0x0A
95#define TI_PURGE_PORT 0x0B
96#define TI_RESET_EXT_DEVICE 0x0C
97#define TI_WRITE_DATA 0x80
98#define TI_READ_DATA 0x81
99#define TI_REQ_TYPE_CLASS 0x82
100
101/* Module identifiers */
102#define TI_I2C_PORT 0x01
103#define TI_IEEE1284_PORT 0x02
104#define TI_UART1_PORT 0x03
105#define TI_UART2_PORT 0x04
106#define TI_RAM_PORT 0x05
107
108/* Modem status */
109#define TI_MSR_DELTA_CTS 0x01
110#define TI_MSR_DELTA_DSR 0x02
111#define TI_MSR_DELTA_RI 0x04
112#define TI_MSR_DELTA_CD 0x08
113#define TI_MSR_CTS 0x10
114#define TI_MSR_DSR 0x20
115#define TI_MSR_RI 0x40
116#define TI_MSR_CD 0x80
117#define TI_MSR_DELTA_MASK 0x0F
118#define TI_MSR_MASK 0xF0
119
120/* Line status */
121#define TI_LSR_OVERRUN_ERROR 0x01
122#define TI_LSR_PARITY_ERROR 0x02
123#define TI_LSR_FRAMING_ERROR 0x04
124#define TI_LSR_BREAK 0x08
125#define TI_LSR_ERROR 0x0F
126#define TI_LSR_RX_FULL 0x10
127#define TI_LSR_TX_EMPTY 0x20
128
129/* Line control */
130#define TI_LCR_BREAK 0x40
131
132/* Modem control */
133#define TI_MCR_LOOP 0x04
134#define TI_MCR_DTR 0x10
135#define TI_MCR_RTS 0x20
136
137/* Mask settings */
138#define TI_UART_ENABLE_RTS_IN 0x0001
139#define TI_UART_DISABLE_RTS 0x0002
140#define TI_UART_ENABLE_PARITY_CHECKING 0x0008
141#define TI_UART_ENABLE_DSR_OUT 0x0010
142#define TI_UART_ENABLE_CTS_OUT 0x0020
143#define TI_UART_ENABLE_X_OUT 0x0040
144#define TI_UART_ENABLE_XA_OUT 0x0080
145#define TI_UART_ENABLE_X_IN 0x0100
146#define TI_UART_ENABLE_DTR_IN 0x0800
147#define TI_UART_DISABLE_DTR 0x1000
148#define TI_UART_ENABLE_MS_INTS 0x2000
149#define TI_UART_ENABLE_AUTO_START_DMA 0x4000
150
151/* Parity */
152#define TI_UART_NO_PARITY 0x00
153#define TI_UART_ODD_PARITY 0x01
154#define TI_UART_EVEN_PARITY 0x02
155#define TI_UART_MARK_PARITY 0x03
156#define TI_UART_SPACE_PARITY 0x04
157
158/* Stop bits */
159#define TI_UART_1_STOP_BITS 0x00
160#define TI_UART_1_5_STOP_BITS 0x01
161#define TI_UART_2_STOP_BITS 0x02
162
163/* Bits per character */
164#define TI_UART_5_DATA_BITS 0x00
165#define TI_UART_6_DATA_BITS 0x01
166#define TI_UART_7_DATA_BITS 0x02
167#define TI_UART_8_DATA_BITS 0x03
168
169/* 232/485 modes */
170#define TI_UART_232 0x00
171#define TI_UART_485_RECEIVER_DISABLED 0x01
172#define TI_UART_485_RECEIVER_ENABLED 0x02
173
174/* Pipe transfer mode and timeout */
175#define TI_PIPE_MODE_CONTINUOUS 0x01
176#define TI_PIPE_MODE_MASK 0x03
177#define TI_PIPE_TIMEOUT_MASK 0x7C
178#define TI_PIPE_TIMEOUT_ENABLE 0x80
179
180/* Config struct */
181struct ti_uart_config {
182 __u16 wBaudRate;
183 __u16 wFlags;
184 __u8 bDataBits;
185 __u8 bParity;
186 __u8 bStopBits;
187 char cXon;
188 char cXoff;
189 __u8 bUartMode;
190} __packed;
191
192/* Get port status */
193struct ti_port_status {
194 __u8 bCmdCode;
195 __u8 bModuleId;
196 __u8 bErrorCode;
197 __u8 bMSR;
198 __u8 bLSR;
199} __packed;
200
201/* Purge modes */
202#define TI_PURGE_OUTPUT 0x00
203#define TI_PURGE_INPUT 0x80
204
205/* Read/Write data */
206#define TI_RW_DATA_ADDR_SFR 0x10
207#define TI_RW_DATA_ADDR_IDATA 0x20
208#define TI_RW_DATA_ADDR_XDATA 0x30
209#define TI_RW_DATA_ADDR_CODE 0x40
210#define TI_RW_DATA_ADDR_GPIO 0x50
211#define TI_RW_DATA_ADDR_I2C 0x60
212#define TI_RW_DATA_ADDR_FLASH 0x70
213#define TI_RW_DATA_ADDR_DSP 0x80
214
215#define TI_RW_DATA_UNSPECIFIED 0x00
216#define TI_RW_DATA_BYTE 0x01
217#define TI_RW_DATA_WORD 0x02
218#define TI_RW_DATA_DOUBLE_WORD 0x04
219
220struct ti_write_data_bytes {
221 __u8 bAddrType;
222 __u8 bDataType;
223 __u8 bDataCounter;
224 __be16 wBaseAddrHi;
225 __be16 wBaseAddrLo;
226 __u8 bData[0];
227} __packed;
228
229struct ti_read_data_request {
230 __u8 bAddrType;
231 __u8 bDataType;
232 __u8 bDataCounter;
233 __be16 wBaseAddrHi;
234 __be16 wBaseAddrLo;
235} __packed;
236
237struct ti_read_data_bytes {
238 __u8 bCmdCode;
239 __u8 bModuleId;
240 __u8 bErrorCode;
241 __u8 bData[0];
242} __packed;
243
244/* Interrupt struct */
245struct ti_interrupt {
246 __u8 bICode;
247 __u8 bIInfo;
248} __packed;
249
250/* Interrupt codes */
251#define TI_CODE_HARDWARE_ERROR 0xFF
252#define TI_CODE_DATA_ERROR 0x03
253#define TI_CODE_MODEM_STATUS 0x04
254
255/* Download firmware max packet size */
256#define TI_DOWNLOAD_MAX_PACKET_SIZE 64
257
258/* Firmware image header */
259struct ti_firmware_header {
260 __le16 wLength;
261 __u8 bCheckSum;
262} __packed;
263
264/* UART addresses */
265#define TI_UART1_BASE_ADDR 0xFFA0 /* UART 1 base address */
266#define TI_UART2_BASE_ADDR 0xFFB0 /* UART 2 base address */
267#define TI_UART_OFFSET_LCR 0x0002 /* UART MCR register offset */
268#define TI_UART_OFFSET_MCR 0x0004 /* UART MCR register offset */
41 269
42#define TI_DRIVER_AUTHOR "Al Borchers <alborchers@steinerpoint.com>" 270#define TI_DRIVER_AUTHOR "Al Borchers <alborchers@steinerpoint.com>"
43#define TI_DRIVER_DESC "TI USB 3410/5052 Serial Driver" 271#define TI_DRIVER_DESC "TI USB 3410/5052 Serial Driver"
@@ -58,9 +286,6 @@
58 286
59#define TI_EXTRA_VID_PID_COUNT 5 287#define TI_EXTRA_VID_PID_COUNT 5
60 288
61
62/* Structures */
63
64struct ti_port { 289struct ti_port {
65 int tp_is_open; 290 int tp_is_open;
66 __u8 tp_msr; 291 __u8 tp_msr;
@@ -84,9 +309,6 @@ struct ti_device {
84 int td_urb_error; 309 int td_urb_error;
85}; 310};
86 311
87
88/* Function Declarations */
89
90static int ti_startup(struct usb_serial *serial); 312static int ti_startup(struct usb_serial *serial);
91static void ti_release(struct usb_serial *serial); 313static void ti_release(struct usb_serial *serial);
92static int ti_port_probe(struct usb_serial_port *port); 314static int ti_port_probe(struct usb_serial_port *port);
@@ -136,13 +358,8 @@ static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev,
136 358
137static int ti_download_firmware(struct ti_device *tdev); 359static int ti_download_firmware(struct ti_device *tdev);
138 360
139
140/* Data */
141
142/* module parameters */
143static int closing_wait = TI_DEFAULT_CLOSING_WAIT; 361static int closing_wait = TI_DEFAULT_CLOSING_WAIT;
144 362
145/* supported devices */
146static const struct usb_device_id ti_id_table_3410[] = { 363static const struct usb_device_id ti_id_table_3410[] = {
147 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, 364 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
148 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, 365 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
@@ -174,7 +391,7 @@ static const struct usb_device_id ti_id_table_5052[] = {
174 { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) }, 391 { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) },
175 { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) }, 392 { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
176 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, 393 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
177 { } /* terminator */ 394 { }
178}; 395};
179 396
180static const struct usb_device_id ti_id_table_combined[] = { 397static const struct usb_device_id ti_id_table_combined[] = {
@@ -275,8 +492,6 @@ static struct usb_serial_driver * const serial_drivers[] = {
275 &ti_1port_device, &ti_2port_device, NULL 492 &ti_1port_device, &ti_2port_device, NULL
276}; 493};
277 494
278/* Module */
279
280MODULE_AUTHOR(TI_DRIVER_AUTHOR); 495MODULE_AUTHOR(TI_DRIVER_AUTHOR);
281MODULE_DESCRIPTION(TI_DRIVER_DESC); 496MODULE_DESCRIPTION(TI_DRIVER_DESC);
282MODULE_LICENSE("GPL"); 497MODULE_LICENSE("GPL");
@@ -302,8 +517,6 @@ MODULE_DEVICE_TABLE(usb, ti_id_table_combined);
302 517
303module_usb_serial_driver(serial_drivers, ti_id_table_combined); 518module_usb_serial_driver(serial_drivers, ti_id_table_combined);
304 519
305/* Functions */
306
307static int ti_startup(struct usb_serial *serial) 520static int ti_startup(struct usb_serial *serial)
308{ 521{
309 struct ti_device *tdev; 522 struct ti_device *tdev;
@@ -319,7 +532,6 @@ static int ti_startup(struct usb_serial *serial)
319 dev->descriptor.bNumConfigurations, 532 dev->descriptor.bNumConfigurations,
320 dev->actconfig->desc.bConfigurationValue); 533 dev->actconfig->desc.bConfigurationValue);
321 534
322 /* create device structure */
323 tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL); 535 tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL);
324 if (!tdev) 536 if (!tdev)
325 return -ENOMEM; 537 return -ENOMEM;
@@ -435,7 +647,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port)
435 struct urb *urb; 647 struct urb *urb;
436 int port_number; 648 int port_number;
437 int status; 649 int status;
438 __u16 open_settings = (__u8)(TI_PIPE_MODE_CONTINOUS | 650 __u16 open_settings = (__u8)(TI_PIPE_MODE_CONTINUOUS |
439 TI_PIPE_TIMEOUT_ENABLE | 651 TI_PIPE_TIMEOUT_ENABLE |
440 (TI_TRANSFER_TIMEOUT << 2)); 652 (TI_TRANSFER_TIMEOUT << 2));
441 653
@@ -954,6 +1166,15 @@ static void ti_break(struct tty_struct *tty, int break_state)
954 dev_dbg(&port->dev, "%s - error setting break, %d\n", __func__, status); 1166 dev_dbg(&port->dev, "%s - error setting break, %d\n", __func__, status);
955} 1167}
956 1168
1169static int ti_get_port_from_code(unsigned char code)
1170{
1171 return (code >> 4) - 3;
1172}
1173
1174static int ti_get_func_from_code(unsigned char code)
1175{
1176 return code & 0x0f;
1177}
957 1178
958static void ti_interrupt_callback(struct urb *urb) 1179static void ti_interrupt_callback(struct urb *urb)
959{ 1180{
@@ -995,8 +1216,8 @@ static void ti_interrupt_callback(struct urb *urb)
995 goto exit; 1216 goto exit;
996 } 1217 }
997 1218
998 port_number = TI_GET_PORT_FROM_CODE(data[0]); 1219 port_number = ti_get_port_from_code(data[0]);
999 function = TI_GET_FUNC_FROM_CODE(data[0]); 1220 function = ti_get_func_from_code(data[0]);
1000 1221
1001 dev_dbg(dev, "%s - port_number %d, function %d, data 0x%02X\n", 1222 dev_dbg(dev, "%s - port_number %d, function %d, data 0x%02X\n",
1002 __func__, port_number, function, data[1]); 1223 __func__, port_number, function, data[1]);
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
deleted file mode 100644
index bbfd3a184600..000000000000
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ /dev/null
@@ -1,259 +0,0 @@
1/* vi: ts=8 sw=8
2 *
3 * TI 3410/5052 USB Serial Driver Header
4 *
5 * Copyright (C) 2004 Texas Instruments
6 *
7 * This driver is based on the Linux io_ti driver, which is
8 * Copyright (C) 2000-2002 Inside Out Networks
9 * Copyright (C) 2001-2002 Greg Kroah-Hartman
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * For questions or problems with this driver, contact Texas Instruments
17 * technical support, or Al Borchers <alborchers@steinerpoint.com>, or
18 * Peter Berger <pberger@brimson.com>.
19 */
20
21#ifndef _TI_3410_5052_H_
22#define _TI_3410_5052_H_
23
24/* Configuration ids */
25#define TI_BOOT_CONFIG 1
26#define TI_ACTIVE_CONFIG 2
27
28/* Vendor and product ids */
29#define TI_VENDOR_ID 0x0451
30#define IBM_VENDOR_ID 0x04b3
31#define TI_3410_PRODUCT_ID 0x3410
32#define IBM_4543_PRODUCT_ID 0x4543
33#define IBM_454B_PRODUCT_ID 0x454b
34#define IBM_454C_PRODUCT_ID 0x454c
35#define TI_3410_EZ430_ID 0xF430 /* TI ez430 development tool */
36#define TI_5052_BOOT_PRODUCT_ID 0x5052 /* no EEPROM, no firmware */
37#define TI_5152_BOOT_PRODUCT_ID 0x5152 /* no EEPROM, no firmware */
38#define TI_5052_EEPROM_PRODUCT_ID 0x505A /* EEPROM, no firmware */
39#define TI_5052_FIRMWARE_PRODUCT_ID 0x505F /* firmware is running */
40#define FRI2_PRODUCT_ID 0x5053 /* Fish River Island II */
41
42/* Multi-Tech vendor and product ids */
43#define MTS_VENDOR_ID 0x06E0
44#define MTS_GSM_NO_FW_PRODUCT_ID 0xF108
45#define MTS_CDMA_NO_FW_PRODUCT_ID 0xF109
46#define MTS_CDMA_PRODUCT_ID 0xF110
47#define MTS_GSM_PRODUCT_ID 0xF111
48#define MTS_EDGE_PRODUCT_ID 0xF112
49#define MTS_MT9234MU_PRODUCT_ID 0xF114
50#define MTS_MT9234ZBA_PRODUCT_ID 0xF115
51#define MTS_MT9234ZBAOLD_PRODUCT_ID 0x0319
52
53/* Abbott Diabetics vendor and product ids */
54#define ABBOTT_VENDOR_ID 0x1a61
55#define ABBOTT_STEREO_PLUG_ID 0x3410
56#define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID
57#define ABBOTT_STRIP_PORT_ID 0x3420
58
59/* Honeywell vendor and product IDs */
60#define HONEYWELL_VENDOR_ID 0x10ac
61#define HONEYWELL_HGI80_PRODUCT_ID 0x0102 /* Honeywell HGI80 */
62
63/* Moxa UPORT 11x0 vendor and product IDs */
64#define MXU1_VENDOR_ID 0x110a
65#define MXU1_1110_PRODUCT_ID 0x1110
66#define MXU1_1130_PRODUCT_ID 0x1130
67#define MXU1_1131_PRODUCT_ID 0x1131
68#define MXU1_1150_PRODUCT_ID 0x1150
69#define MXU1_1151_PRODUCT_ID 0x1151
70
71/* Commands */
72#define TI_GET_VERSION 0x01
73#define TI_GET_PORT_STATUS 0x02
74#define TI_GET_PORT_DEV_INFO 0x03
75#define TI_GET_CONFIG 0x04
76#define TI_SET_CONFIG 0x05
77#define TI_OPEN_PORT 0x06
78#define TI_CLOSE_PORT 0x07
79#define TI_START_PORT 0x08
80#define TI_STOP_PORT 0x09
81#define TI_TEST_PORT 0x0A
82#define TI_PURGE_PORT 0x0B
83#define TI_RESET_EXT_DEVICE 0x0C
84#define TI_WRITE_DATA 0x80
85#define TI_READ_DATA 0x81
86#define TI_REQ_TYPE_CLASS 0x82
87
88/* Module identifiers */
89#define TI_I2C_PORT 0x01
90#define TI_IEEE1284_PORT 0x02
91#define TI_UART1_PORT 0x03
92#define TI_UART2_PORT 0x04
93#define TI_RAM_PORT 0x05
94
95/* Modem status */
96#define TI_MSR_DELTA_CTS 0x01
97#define TI_MSR_DELTA_DSR 0x02
98#define TI_MSR_DELTA_RI 0x04
99#define TI_MSR_DELTA_CD 0x08
100#define TI_MSR_CTS 0x10
101#define TI_MSR_DSR 0x20
102#define TI_MSR_RI 0x40
103#define TI_MSR_CD 0x80
104#define TI_MSR_DELTA_MASK 0x0F
105#define TI_MSR_MASK 0xF0
106
107/* Line status */
108#define TI_LSR_OVERRUN_ERROR 0x01
109#define TI_LSR_PARITY_ERROR 0x02
110#define TI_LSR_FRAMING_ERROR 0x04
111#define TI_LSR_BREAK 0x08
112#define TI_LSR_ERROR 0x0F
113#define TI_LSR_RX_FULL 0x10
114#define TI_LSR_TX_EMPTY 0x20
115
116/* Line control */
117#define TI_LCR_BREAK 0x40
118
119/* Modem control */
120#define TI_MCR_LOOP 0x04
121#define TI_MCR_DTR 0x10
122#define TI_MCR_RTS 0x20
123
124/* Mask settings */
125#define TI_UART_ENABLE_RTS_IN 0x0001
126#define TI_UART_DISABLE_RTS 0x0002
127#define TI_UART_ENABLE_PARITY_CHECKING 0x0008
128#define TI_UART_ENABLE_DSR_OUT 0x0010
129#define TI_UART_ENABLE_CTS_OUT 0x0020
130#define TI_UART_ENABLE_X_OUT 0x0040
131#define TI_UART_ENABLE_XA_OUT 0x0080
132#define TI_UART_ENABLE_X_IN 0x0100
133#define TI_UART_ENABLE_DTR_IN 0x0800
134#define TI_UART_DISABLE_DTR 0x1000
135#define TI_UART_ENABLE_MS_INTS 0x2000
136#define TI_UART_ENABLE_AUTO_START_DMA 0x4000
137
138/* Parity */
139#define TI_UART_NO_PARITY 0x00
140#define TI_UART_ODD_PARITY 0x01
141#define TI_UART_EVEN_PARITY 0x02
142#define TI_UART_MARK_PARITY 0x03
143#define TI_UART_SPACE_PARITY 0x04
144
145/* Stop bits */
146#define TI_UART_1_STOP_BITS 0x00
147#define TI_UART_1_5_STOP_BITS 0x01
148#define TI_UART_2_STOP_BITS 0x02
149
150/* Bits per character */
151#define TI_UART_5_DATA_BITS 0x00
152#define TI_UART_6_DATA_BITS 0x01
153#define TI_UART_7_DATA_BITS 0x02
154#define TI_UART_8_DATA_BITS 0x03
155
156/* 232/485 modes */
157#define TI_UART_232 0x00
158#define TI_UART_485_RECEIVER_DISABLED 0x01
159#define TI_UART_485_RECEIVER_ENABLED 0x02
160
161/* Pipe transfer mode and timeout */
162#define TI_PIPE_MODE_CONTINOUS 0x01
163#define TI_PIPE_MODE_MASK 0x03
164#define TI_PIPE_TIMEOUT_MASK 0x7C
165#define TI_PIPE_TIMEOUT_ENABLE 0x80
166
167/* Config struct */
168struct ti_uart_config {
169 __u16 wBaudRate;
170 __u16 wFlags;
171 __u8 bDataBits;
172 __u8 bParity;
173 __u8 bStopBits;
174 char cXon;
175 char cXoff;
176 __u8 bUartMode;
177} __attribute__((packed));
178
179/* Get port status */
180struct ti_port_status {
181 __u8 bCmdCode;
182 __u8 bModuleId;
183 __u8 bErrorCode;
184 __u8 bMSR;
185 __u8 bLSR;
186} __attribute__((packed));
187
188/* Purge modes */
189#define TI_PURGE_OUTPUT 0x00
190#define TI_PURGE_INPUT 0x80
191
192/* Read/Write data */
193#define TI_RW_DATA_ADDR_SFR 0x10
194#define TI_RW_DATA_ADDR_IDATA 0x20
195#define TI_RW_DATA_ADDR_XDATA 0x30
196#define TI_RW_DATA_ADDR_CODE 0x40
197#define TI_RW_DATA_ADDR_GPIO 0x50
198#define TI_RW_DATA_ADDR_I2C 0x60
199#define TI_RW_DATA_ADDR_FLASH 0x70
200#define TI_RW_DATA_ADDR_DSP 0x80
201
202#define TI_RW_DATA_UNSPECIFIED 0x00
203#define TI_RW_DATA_BYTE 0x01
204#define TI_RW_DATA_WORD 0x02
205#define TI_RW_DATA_DOUBLE_WORD 0x04
206
207struct ti_write_data_bytes {
208 __u8 bAddrType;
209 __u8 bDataType;
210 __u8 bDataCounter;
211 __be16 wBaseAddrHi;
212 __be16 wBaseAddrLo;
213 __u8 bData[0];
214} __attribute__((packed));
215
216struct ti_read_data_request {
217 __u8 bAddrType;
218 __u8 bDataType;
219 __u8 bDataCounter;
220 __be16 wBaseAddrHi;
221 __be16 wBaseAddrLo;
222} __attribute__((packed));
223
224struct ti_read_data_bytes {
225 __u8 bCmdCode;
226 __u8 bModuleId;
227 __u8 bErrorCode;
228 __u8 bData[0];
229} __attribute__((packed));
230
231/* Interrupt struct */
232struct ti_interrupt {
233 __u8 bICode;
234 __u8 bIInfo;
235} __attribute__((packed));
236
237/* Interrupt codes */
238#define TI_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3)
239#define TI_GET_FUNC_FROM_CODE(c) ((c) & 0x0f)
240#define TI_CODE_HARDWARE_ERROR 0xFF
241#define TI_CODE_DATA_ERROR 0x03
242#define TI_CODE_MODEM_STATUS 0x04
243
244/* Download firmware max packet size */
245#define TI_DOWNLOAD_MAX_PACKET_SIZE 64
246
247/* Firmware image header */
248struct ti_firmware_header {
249 __le16 wLength;
250 __u8 bCheckSum;
251} __attribute__((packed));
252
253/* UART addresses */
254#define TI_UART1_BASE_ADDR 0xFFA0 /* UART 1 base address */
255#define TI_UART2_BASE_ADDR 0xFFB0 /* UART 2 base address */
256#define TI_UART_OFFSET_LCR 0x0002 /* UART MCR register offset */
257#define TI_UART_OFFSET_MCR 0x0004 /* UART MCR register offset */
258
259#endif /* _TI_3410_5052_H_ */