diff -Naur linux-2.6.22-gentoo-r5/drivers/usb/serial/ti_fw_3410.h linux-2.6.22-ti_usb/drivers/usb/serial/ti_fw_3410.h --- linux-2.6.22-gentoo-r5/drivers/usb/serial/ti_fw_3410.h 2007-08-24 12:03:23.000000000 -0700 +++ linux-2.6.22-ti_usb/drivers/usb/serial/ti_fw_3410.h 2007-09-10 13:22:56.024517011 -0700 @@ -16,9 +16,6 @@ /* firmware 9/10/04 FW3410_Special_StartWdogOnStartPort */ static unsigned char ti_fw_3410[] = { -0xC2, 0x35, /* firmware image length excluding header, little endian */ -0x00, /* placeholder for checksum */ - 0x02,0x00,0x1e,0x02,0x1a,0xdb,0xff,0xff,0xff,0xff,0xff,0x02,0x32,0xcb,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x02,0x33,0x76,0x75,0x81, 0xce,0x90,0xfd,0xe8,0x85,0x83,0xa0,0x12,0x34,0xea,0xec,0x4d,0x60,0x6a,0x78,0xab, diff -Naur linux-2.6.22-gentoo-r5/drivers/usb/serial/ti_fw_5052.h linux-2.6.22-ti_usb/drivers/usb/serial/ti_fw_5052.h --- linux-2.6.22-gentoo-r5/drivers/usb/serial/ti_fw_5052.h 2007-08-24 12:03:23.000000000 -0700 +++ linux-2.6.22-ti_usb/drivers/usb/serial/ti_fw_5052.h 2007-09-10 13:22:56.024517011 -0700 @@ -16,9 +16,6 @@ /* firmware 9/18/04 */ static unsigned char ti_fw_5052[] = { -0xC1, 0x35, /* firmware image length excluding header, little endian */ -0x00, /* placeholder for checksum */ - 0x02,0x00,0x1e,0x02,0x1b,0x32,0xff,0xff,0xff,0xff,0xff,0x02,0x32,0x6a,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x02,0x33,0x15,0x75,0x81, 0xc8,0x90,0xfe,0xf0,0x85,0x83,0xa0,0x12,0x34,0x7d,0xec,0x4d,0x60,0x6a,0x78,0xa5, diff -Naur linux-2.6.22-gentoo-r5/drivers/usb/serial/ti_usb_3410_5052.c linux-2.6.22-ti_usb/drivers/usb/serial/ti_usb_3410_5052.c --- linux-2.6.22-gentoo-r5/drivers/usb/serial/ti_usb_3410_5052.c 2007-08-24 12:03:23.000000000 -0700 +++ linux-2.6.22-ti_usb/drivers/usb/serial/ti_usb_3410_5052.c 2007-09-10 13:27:57.003571069 -0700 @@ -84,6 +84,7 @@ #include #include #include +#include #include "ti_usb_3410_5052.h" #include "ti_fw_3410.h" /* firmware image for 3410 */ @@ -92,7 +93,7 @@ /* Defines */ -#define TI_DRIVER_VERSION "v0.9" +#define TI_DRIVER_VERSION "v1.1" #define TI_DRIVER_AUTHOR "Al Borchers " #define TI_DRIVER_DESC "TI USB 3410/5052 Serial Driver" @@ -196,6 +197,9 @@ static int ti_download_firmware(struct ti_device *tdev, unsigned char *firmware, unsigned int firmware_size); +static int ti_request_and_download_firmware(struct ti_device *tdev, + char *firmware_name, unsigned char *default_firmware, + unsigned int default_firmware_size); /* circular buffer */ static struct circ_buf *ti_buf_alloc(void); @@ -226,8 +230,13 @@ /* the array dimension is the number of default entries plus */ /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */ /* null entry */ -static struct usb_device_id ti_id_table_3410[1+TI_EXTRA_VID_PID_COUNT+1] = { +static struct usb_device_id ti_id_table_3410[6+TI_EXTRA_VID_PID_COUNT+1] = { { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_GSM_NO_FW_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_CDMA_NO_FW_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_CDMA_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_GSM_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_EDGE_PRODUCT_ID) }, { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, }; @@ -240,6 +249,11 @@ static struct usb_device_id ti_id_table_combined[] = { { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_GSM_NO_FW_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_CDMA_NO_FW_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_CDMA_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_GSM_PRODUCT_ID) }, + { USB_DEVICE(TI_MTS_VENDOR_ID, TI_MTS_EDGE_PRODUCT_ID) }, { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, { USB_DEVICE(TI_VENDOR_ID, TI_5052_BOOT_PRODUCT_ID) }, { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) }, @@ -413,8 +427,10 @@ int i; - dbg("%s - product 0x%4X, num configurations %d, configuration value %d", - __FUNCTION__, le16_to_cpu(dev->descriptor.idProduct), + dbg("%s - vendor 0x%04X, product 0x%04X, num configurations %d, configuration value %d", + __FUNCTION__, + le16_to_cpu(dev->descriptor.idVendor), + le16_to_cpu(dev->descriptor.idProduct), dev->descriptor.bNumConfigurations, dev->actconfig->desc.bConfigurationValue); @@ -436,12 +452,37 @@ /* if we have only 1 configuration, download firmware */ if (dev->descriptor.bNumConfigurations == 1) { - if (tdev->td_is_3410) - status = ti_download_firmware(tdev, ti_fw_3410, - sizeof(ti_fw_3410)); - else - status = ti_download_firmware(tdev, ti_fw_5052, - sizeof(ti_fw_5052)); + if (dev->descriptor.idVendor == TI_MTS_VENDOR_ID) { + switch (dev->descriptor.idProduct) { + case TI_MTS_GSM_NO_FW_PRODUCT_ID: + case TI_MTS_CDMA_NO_FW_PRODUCT_ID: + status = 0; /* no firmware required */ + break; + case TI_MTS_CDMA_PRODUCT_ID: + status = ti_request_and_download_firmware(tdev, + "ti_mts_fw_cdma", NULL, 0); + break; + case TI_MTS_GSM_PRODUCT_ID: + status = ti_request_and_download_firmware(tdev, + "ti_mts_fw_gsm", NULL, 0); + break; + case TI_MTS_EDGE_PRODUCT_ID: + status = ti_request_and_download_firmware(tdev, + "ti_mts_fw_edge", NULL, 0); + break; + default: + status = -ENODEV; + break; + } + } + else if (tdev->td_is_3410) { + status = ti_request_and_download_firmware(tdev, + "ti_fw_3410", ti_fw_3410, sizeof(ti_fw_3410)); + } else { + status = ti_request_and_download_firmware(tdev, + "ti_fw_5052", ti_fw_5052, sizeof(ti_fw_5052)); + } + if (status) goto free_tdev; @@ -1665,13 +1706,15 @@ buffer_size = TI_FIRMWARE_BUF_SIZE + sizeof(struct ti_firmware_header); + if (firmware_size > buffer_size) + return -EINVAL; buffer = kmalloc(buffer_size, GFP_KERNEL); if (!buffer) { dev_err(&dev->dev, "%s - out of memory\n", __FUNCTION__); return -ENOMEM; } - memcpy(buffer, firmware, firmware_size); + memcpy(buffer + sizeof(struct ti_firmware_header), firmware, firmware_size); memset(buffer+firmware_size, 0xff, buffer_size-firmware_size); for(pos = sizeof(struct ti_firmware_header); pos < buffer_size; pos++) @@ -1702,6 +1745,30 @@ } +static int ti_request_and_download_firmware(struct ti_device *tdev, + char *firmware_name, unsigned char *default_firmware, + unsigned int default_firmware_size) +{ + int status; + const struct firmware *fw; + + if (request_firmware(&fw, firmware_name, &tdev->td_serial->dev->dev)) { + if (default_firmware) + return ti_download_firmware(tdev, default_firmware, + default_firmware_size); + dev_err(&tdev->td_serial->dev->dev, + "%s - no firmware image found\n", __FUNCTION__); + return -ENOENT; + } + + status = ti_download_firmware(tdev, fw->data, fw->size); + + release_firmware(fw); + + return status; +} + + /* Circular Buffer Functions */ /* diff -Naur linux-2.6.22-gentoo-r5/drivers/usb/serial/ti_usb_3410_5052.h linux-2.6.22-ti_usb/drivers/usb/serial/ti_usb_3410_5052.h --- linux-2.6.22-gentoo-r5/drivers/usb/serial/ti_usb_3410_5052.h 2007-08-24 12:03:23.000000000 -0700 +++ linux-2.6.22-ti_usb/drivers/usb/serial/ti_usb_3410_5052.h 2007-09-10 13:22:56.028517211 -0700 @@ -34,6 +34,13 @@ #define TI_5052_EEPROM_PRODUCT_ID 0x505A /* EEPROM, no firmware */ #define TI_5052_FIRMWARE_PRODUCT_ID 0x505F /* firmware is running */ +#define TI_MTS_VENDOR_ID 0x06E0 /* Multitech ids */ +#define TI_MTS_GSM_NO_FW_PRODUCT_ID 0xF108 +#define TI_MTS_CDMA_NO_FW_PRODUCT_ID 0xF109 +#define TI_MTS_CDMA_PRODUCT_ID 0xF110 +#define TI_MTS_GSM_PRODUCT_ID 0xF111 +#define TI_MTS_EDGE_PRODUCT_ID 0xF112 + /* Commands */ #define TI_GET_VERSION 0x01 #define TI_GET_PORT_STATUS 0x02