Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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