cp210x.c (d149d6ae17197ce23e2cd6bc5fcdacf7b593e55e) | cp210x.c (7eac35ea29dc54cbc8399de84c9bf16553575b89) |
---|---|
1/* 2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver 3 * 4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 8 * 2 as published by the Free Software Foundation. --- 338 unchanged lines hidden (view full) --- 347 348/* Part number definitions */ 349#define CP210X_PARTNUM_CP2101 0x01 350#define CP210X_PARTNUM_CP2102 0x02 351#define CP210X_PARTNUM_CP2103 0x03 352#define CP210X_PARTNUM_CP2104 0x04 353#define CP210X_PARTNUM_CP2105 0x05 354#define CP210X_PARTNUM_CP2108 0x08 | 1/* 2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver 3 * 4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 8 * 2 as published by the Free Software Foundation. --- 338 unchanged lines hidden (view full) --- 347 348/* Part number definitions */ 349#define CP210X_PARTNUM_CP2101 0x01 350#define CP210X_PARTNUM_CP2102 0x02 351#define CP210X_PARTNUM_CP2103 0x03 352#define CP210X_PARTNUM_CP2104 0x04 353#define CP210X_PARTNUM_CP2105 0x05 354#define CP210X_PARTNUM_CP2108 0x08 |
355#define CP210X_PARTNUM_UNKNOWN 0xFF |
|
355 356/* CP210X_GET_COMM_STATUS returns these 0x13 bytes */ 357struct cp210x_comm_status { 358 __le32 ulErrors; 359 __le32 ulHoldReasons; 360 __le32 ulAmountInInQueue; 361 __le32 ulAmountInOutQueue; 362 u8 bEofReceived; --- 1123 unchanged lines hidden (view full) --- 1486 1487 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 1488 if (!priv) 1489 return -ENOMEM; 1490 1491 result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, 1492 CP210X_GET_PARTNUM, &priv->partnum, 1493 sizeof(priv->partnum)); | 356 357/* CP210X_GET_COMM_STATUS returns these 0x13 bytes */ 358struct cp210x_comm_status { 359 __le32 ulErrors; 360 __le32 ulHoldReasons; 361 __le32 ulAmountInInQueue; 362 __le32 ulAmountInOutQueue; 363 u8 bEofReceived; --- 1123 unchanged lines hidden (view full) --- 1487 1488 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 1489 if (!priv) 1490 return -ENOMEM; 1491 1492 result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, 1493 CP210X_GET_PARTNUM, &priv->partnum, 1494 sizeof(priv->partnum)); |
1494 if (result < 0) 1495 goto err_free_priv; | 1495 if (result < 0) { 1496 dev_warn(&serial->interface->dev, 1497 "querying part number failed\n"); 1498 priv->partnum = CP210X_PARTNUM_UNKNOWN; 1499 } |
1496 1497 usb_set_serial_data(serial, priv); 1498 1499 if (priv->partnum == CP210X_PARTNUM_CP2105) { 1500 result = cp2105_shared_gpio_init(serial); 1501 if (result < 0) { 1502 dev_err(&serial->interface->dev, 1503 "GPIO initialisation failed, continuing without GPIO support\n"); 1504 } 1505 } 1506 1507 return 0; | 1500 1501 usb_set_serial_data(serial, priv); 1502 1503 if (priv->partnum == CP210X_PARTNUM_CP2105) { 1504 result = cp2105_shared_gpio_init(serial); 1505 if (result < 0) { 1506 dev_err(&serial->interface->dev, 1507 "GPIO initialisation failed, continuing without GPIO support\n"); 1508 } 1509 } 1510 1511 return 0; |
1508err_free_priv: 1509 kfree(priv); 1510 1511 return result; | |
1512} 1513 1514static void cp210x_disconnect(struct usb_serial *serial) 1515{ 1516 cp210x_gpio_remove(serial); 1517} 1518 1519static void cp210x_release(struct usb_serial *serial) --- 12 unchanged lines hidden --- | 1512} 1513 1514static void cp210x_disconnect(struct usb_serial *serial) 1515{ 1516 cp210x_gpio_remove(serial); 1517} 1518 1519static void cp210x_release(struct usb_serial *serial) --- 12 unchanged lines hidden --- |