Commit fdb6357e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/greg/linux/BK/bleed-2.5

into kroah.com:/home/greg/linux/BK/gregkh-2.5
parents d0c451f8 06ad5d94
...@@ -54,6 +54,10 @@ ...@@ -54,6 +54,10 @@
#define USB_VENDOR_ID_STEINBERG 0x0763 #define USB_VENDOR_ID_STEINBERG 0x0763
#define USBMIDI_STEINBERG_USB2MIDI 0x1001 #define USBMIDI_STEINBERG_USB2MIDI 0x1001
/* Mark of the Unicorn MIDI Devices */
#define USB_VENDOR_ID_MOTU 0x07fd
#define USBMIDI_MOTU_FASTLANE 0x0001
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* Supported devices */ /* Supported devices */
...@@ -101,8 +105,15 @@ static struct usb_midi_device usb_midi_devices[] = { ...@@ -101,8 +105,15 @@ static struct usb_midi_device usb_midi_devices[] = {
{ /* Roland SC8850 */ { /* Roland SC8850 */
"Roland SC8850", "Roland SC8850",
USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8850, 2, -1, USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8850, 2, -1,
{ { 0x81, 15 }, {-1, -1} }, /** cables 0,1,2, and 3 **/ { { 0x81, 0x3f }, {-1, -1} },
{ { 0x01, 15 }, {-1, -1} }, { { 0x01, 0x3f }, {-1, -1} },
},
{ /* Roland SC8820 */
"Roland SC8820",
USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8820, 2, -1,
{ { 0x81, 0x13 }, {-1, -1} },
{ { 0x01, 0x13 }, {-1, -1} },
}, },
{ /* Roland SC8820 */ { /* Roland SC8820 */
...@@ -123,6 +134,12 @@ static struct usb_midi_device usb_midi_devices[] = { ...@@ -123,6 +134,12 @@ static struct usb_midi_device usb_midi_devices[] = {
USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_PC300, 2, -1, USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_PC300, 2, -1,
{ { 0x81, 1 }, {-1, -1} }, { { 0x81, 1 }, {-1, -1} },
{ { 0x01, 1 }, {-1, -1} }, { { 0x01, 1 }, {-1, -1} },
},
{ /* MOTU Fastlane USB */
"MOTU Fastlane USB",
USB_VENDOR_ID_MOTU, USBMIDI_MOTU_FASTLANE, 1, 0,
{ { 0x82, 3 }, {-1, -1} },
{ { 0x02, 3 }, {-1, -1} },
} }
}; };
...@@ -138,7 +155,9 @@ static struct usb_device_id usb_midi_ids [] = { ...@@ -138,7 +155,9 @@ static struct usb_device_id usb_midi_ids [] = {
{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UA100G ) }, { USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_UA100G ) },
{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_PC300 ) }, { USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_PC300 ) },
{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8850 ) }, { USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8850 ) },
{ USB_DEVICE( USB_VENDOR_ID_ROLAND, USBMIDI_ROLAND_SC8820 ) },
{ USB_DEVICE( USB_VENDOR_ID_YAMAHA, USBMIDI_YAMAHA_MU1000 ) }, { USB_DEVICE( USB_VENDOR_ID_YAMAHA, USBMIDI_YAMAHA_MU1000 ) },
{ USB_DEVICE( USB_VENDOR_ID_MOTU, USBMIDI_MOTU_FASTLANE ) },
/* { USB_DEVICE( USB_VENDOR_ID_STEINBERG, USBMIDI_STEINBERG_USB2MIDI ) },*/ /* { USB_DEVICE( USB_VENDOR_ID_STEINBERG, USBMIDI_STEINBERG_USB2MIDI ) },*/
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -876,6 +876,7 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -876,6 +876,7 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
} }
hub->children[port] = dev; hub->children[port] = dev;
dev->state = USB_STATE_POWERED;
/* Reset the device, and detect its speed */ /* Reset the device, and detect its speed */
if (usb_hub_port_reset(hub, port, dev, delay)) { if (usb_hub_port_reset(hub, port, dev, delay)) {
......
...@@ -904,17 +904,29 @@ int usb_set_configuration(struct usb_device *dev, int configuration) ...@@ -904,17 +904,29 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
break; break;
} }
} }
if (!cp) { if ((!cp && configuration != 0) || (cp && configuration == 0)) {
warn("selecting invalid configuration %d", configuration); warn("selecting invalid configuration %d", configuration);
return -EINVAL; return -EINVAL;
} }
/* if it's already configured, clear out old state first. */
if (dev->state != USB_STATE_ADDRESS) {
/* FIXME unbind drivers from all "old" interfaces.
* handshake with hcd to reset cached hc endpoint state.
*/
}
if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_CONFIGURATION, 0, configuration, 0, USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
NULL, 0, HZ * USB_CTRL_SET_TIMEOUT)) < 0) NULL, 0, HZ * USB_CTRL_SET_TIMEOUT)) < 0)
return ret; return ret;
if (configuration)
dev->state = USB_STATE_CONFIGURED;
else
dev->state = USB_STATE_ADDRESS;
dev->actconfig = cp; dev->actconfig = cp;
/* reset more hc/hcd endpoint state */
dev->toggle[0] = 0; dev->toggle[0] = 0;
dev->toggle[1] = 0; dev->toggle[1] = 0;
usb_set_maxpacket(dev); usb_set_maxpacket(dev);
......
...@@ -195,7 +195,9 @@ int usb_submit_urb(struct urb *urb, int mem_flags) ...@@ -195,7 +195,9 @@ int usb_submit_urb(struct urb *urb, int mem_flags)
if (!urb || urb->hcpriv || !urb->complete) if (!urb || urb->hcpriv || !urb->complete)
return -EINVAL; return -EINVAL;
if (!(dev = urb->dev) || !dev->present || !dev->bus || dev->devnum <= 0) if (!(dev = urb->dev) ||
(dev->state < USB_STATE_DEFAULT) ||
(!dev->bus) || (dev->devnum <= 0))
return -ENODEV; return -ENODEV;
if (!(op = dev->bus->op) || !op->submit_urb) if (!(op = dev->bus->op) || !op->submit_urb)
return -ENODEV; return -ENODEV;
...@@ -211,6 +213,9 @@ int usb_submit_urb(struct urb *urb, int mem_flags) ...@@ -211,6 +213,9 @@ int usb_submit_urb(struct urb *urb, int mem_flags)
temp = usb_pipetype (pipe); temp = usb_pipetype (pipe);
is_out = usb_pipeout (pipe); is_out = usb_pipeout (pipe);
if (!usb_pipecontrol (pipe) && dev->state < USB_STATE_CONFIGURED)
return -ENODEV;
/* (actually HCDs may need to duplicate this, endpoint might yet /* (actually HCDs may need to duplicate this, endpoint might yet
* stall due to queued bulk/intr transactions that complete after * stall due to queued bulk/intr transactions that complete after
* we check) * we check)
...@@ -376,7 +381,16 @@ int usb_submit_urb(struct urb *urb, int mem_flags) ...@@ -376,7 +381,16 @@ int usb_submit_urb(struct urb *urb, int mem_flags)
*/ */
int usb_unlink_urb(struct urb *urb) int usb_unlink_urb(struct urb *urb)
{ {
if (urb && urb->dev && urb->dev->present && urb->dev->bus && urb->dev->bus->op) /* FIXME
* We should not care about the state here, but the host controllers
* die a horrible death if we submit a urb for a device that has been
* physically removed.
*/
if (urb &&
urb->dev &&
(urb->dev->state >= USB_STATE_DEFAULT) &&
urb->dev->bus &&
urb->dev->bus->op)
return urb->dev->bus->op->unlink_urb(urb); return urb->dev->bus->op->unlink_urb(urb);
else else
return -ENODEV; return -ENODEV;
......
...@@ -679,7 +679,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus) ...@@ -679,7 +679,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus)
memset(dev, 0, sizeof(*dev)); memset(dev, 0, sizeof(*dev));
device_initialize(&dev->dev); device_initialize(&dev->dev);
dev->present = 1; dev->state = USB_STATE_ATTACHED;
usb_bus_get(bus); usb_bus_get(bus);
...@@ -828,6 +828,11 @@ void usb_disconnect(struct usb_device **pdev) ...@@ -828,6 +828,11 @@ void usb_disconnect(struct usb_device **pdev)
*pdev = NULL; *pdev = NULL;
/* mark the device as inactive, so any further urb submissions for
* this device will fail.
*/
dev->state = USB_STATE_NOTATTACHED;
dev_info (&dev->dev, "USB disconnect, address %d\n", dev->devnum); dev_info (&dev->dev, "USB disconnect, address %d\n", dev->devnum);
/* Free up all the children before we remove this device */ /* Free up all the children before we remove this device */
...@@ -855,10 +860,6 @@ void usb_disconnect(struct usb_device **pdev) ...@@ -855,10 +860,6 @@ void usb_disconnect(struct usb_device **pdev)
} }
device_unregister(&dev->dev); device_unregister(&dev->dev);
/* mark the device as not present so any further urb submissions for
* this device will fail. */
dev->present = 0;
/* Decrement the reference count, it'll auto free everything when */ /* Decrement the reference count, it'll auto free everything when */
/* it hits 0 which could very well be now */ /* it hits 0 which could very well be now */
usb_put_dev(dev); usb_put_dev(dev);
...@@ -906,9 +907,17 @@ void usb_connect(struct usb_device *dev) ...@@ -906,9 +907,17 @@ void usb_connect(struct usb_device *dev)
// otherwise used internally, for usb_new_device() // otherwise used internally, for usb_new_device()
int usb_set_address(struct usb_device *dev) int usb_set_address(struct usb_device *dev)
{ {
return usb_control_msg(dev, usb_snddefctrl(dev), USB_REQ_SET_ADDRESS, int retval;
// FIXME USB_CTRL_SET_TIMEOUT
0, dev->devnum, 0, NULL, 0, HZ * USB_CTRL_GET_TIMEOUT); if (dev->devnum == 0)
return -EINVAL;
if (dev->state != USB_STATE_DEFAULT && dev->state != USB_STATE_ADDRESS)
return -EINVAL;
retval = usb_control_msg(dev, usb_snddefctrl(dev), USB_REQ_SET_ADDRESS,
0, dev->devnum, 0, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
if (retval == 0)
dev->state = USB_STATE_ADDRESS;
return retval;
} }
...@@ -1014,7 +1023,8 @@ int usb_new_device(struct usb_device *dev, struct device *parent) ...@@ -1014,7 +1023,8 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
/* dma masks come from the controller; readonly, except to hcd */ /* dma masks come from the controller; readonly, except to hcd */
dev->dev.dma_mask = parent->dma_mask; dev->dev.dma_mask = parent->dma_mask;
/* USB device state == default ... it's not usable yet */ /* it's not usable yet */
dev->state = USB_STATE_DEFAULT;
/* USB 2.0 section 5.5.3 talks about ep0 maxpacket ... /* USB 2.0 section 5.5.3 talks about ep0 maxpacket ...
* it's fixed size except for full speed devices. * it's fixed size except for full speed devices.
...@@ -1049,6 +1059,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent) ...@@ -1049,6 +1059,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
if (err < 0) { if (err < 0) {
dev_err(&dev->dev, "USB device not accepting new address=%d (error=%d)\n", dev_err(&dev->dev, "USB device not accepting new address=%d (error=%d)\n",
dev->devnum, err); dev->devnum, err);
dev->state = USB_STATE_DEFAULT;
clear_bit(dev->devnum, dev->bus->devmap.devicemap); clear_bit(dev->devnum, dev->bus->devmap.devicemap);
dev->devnum = -1; dev->devnum = -1;
return 1; return 1;
......
...@@ -522,7 +522,7 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial) ...@@ -522,7 +522,7 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial)
case EDGE_DOWNLOAD_FILE_I930: case EDGE_DOWNLOAD_FILE_I930:
BootMajorVersion = BootCodeImageVersion_GEN1.MajorVersion; BootMajorVersion = BootCodeImageVersion_GEN1.MajorVersion;
BootMinorVersion = BootCodeImageVersion_GEN1.MinorVersion; BootMinorVersion = BootCodeImageVersion_GEN1.MinorVersion;
BootBuildNumber = BootCodeImageVersion_GEN1.BuildNumber; BootBuildNumber = cpu_to_le16(BootCodeImageVersion_GEN1.BuildNumber);
BootImage = &BootCodeImage_GEN1[0]; BootImage = &BootCodeImage_GEN1[0];
BootSize = sizeof( BootCodeImage_GEN1 ); BootSize = sizeof( BootCodeImage_GEN1 );
break; break;
...@@ -530,7 +530,7 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial) ...@@ -530,7 +530,7 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial)
case EDGE_DOWNLOAD_FILE_80251: case EDGE_DOWNLOAD_FILE_80251:
BootMajorVersion = BootCodeImageVersion_GEN2.MajorVersion; BootMajorVersion = BootCodeImageVersion_GEN2.MajorVersion;
BootMinorVersion = BootCodeImageVersion_GEN2.MinorVersion; BootMinorVersion = BootCodeImageVersion_GEN2.MinorVersion;
BootBuildNumber = BootCodeImageVersion_GEN2.BuildNumber; BootBuildNumber = cpu_to_le16(BootCodeImageVersion_GEN2.BuildNumber);
BootImage = &BootCodeImage_GEN2[0]; BootImage = &BootCodeImage_GEN2[0];
BootSize = sizeof( BootCodeImage_GEN2 ); BootSize = sizeof( BootCodeImage_GEN2 );
break; break;
...@@ -542,26 +542,26 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial) ...@@ -542,26 +542,26 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial)
// Check Boot Image Version // Check Boot Image Version
BootCurVer = (edge_serial->boot_descriptor.MajorVersion << 24) + BootCurVer = (edge_serial->boot_descriptor.MajorVersion << 24) +
(edge_serial->boot_descriptor.MinorVersion << 16) + (edge_serial->boot_descriptor.MinorVersion << 16) +
edge_serial->boot_descriptor.BuildNumber; le16_to_cpu(edge_serial->boot_descriptor.BuildNumber);
BootNewVer = (BootMajorVersion << 24) + BootNewVer = (BootMajorVersion << 24) +
(BootMinorVersion << 16) + (BootMinorVersion << 16) +
BootBuildNumber; le16_to_cpu(BootBuildNumber);
dbg("Current Boot Image version %d.%d.%d", dbg("Current Boot Image version %d.%d.%d",
edge_serial->boot_descriptor.MajorVersion, edge_serial->boot_descriptor.MajorVersion,
edge_serial->boot_descriptor.MinorVersion, edge_serial->boot_descriptor.MinorVersion,
edge_serial->boot_descriptor.BuildNumber); le16_to_cpu(edge_serial->boot_descriptor.BuildNumber));
if (BootNewVer > BootCurVer) { if (BootNewVer > BootCurVer) {
dbg("**Update Boot Image from %d.%d.%d to %d.%d.%d", dbg("**Update Boot Image from %d.%d.%d to %d.%d.%d",
edge_serial->boot_descriptor.MajorVersion, edge_serial->boot_descriptor.MajorVersion,
edge_serial->boot_descriptor.MinorVersion, edge_serial->boot_descriptor.MinorVersion,
edge_serial->boot_descriptor.BuildNumber, le16_to_cpu(edge_serial->boot_descriptor.BuildNumber),
BootMajorVersion, BootMajorVersion,
BootMinorVersion, BootMinorVersion,
BootBuildNumber); le16_to_cpu(BootBuildNumber));
dbg("Downloading new Boot Image"); dbg("Downloading new Boot Image");
...@@ -570,12 +570,12 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial) ...@@ -570,12 +570,12 @@ static void update_edgeport_E2PROM (struct edgeport_serial *edge_serial)
for (;;) { for (;;) {
record = (struct edge_firmware_image_record *)firmware; record = (struct edge_firmware_image_record *)firmware;
response = rom_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]); response = rom_write (edge_serial->serial, le16_to_cpu(record->ExtAddr), le16_to_cpu(record->Addr), le16_to_cpu(record->Len), &record->Data[0]);
if (response < 0) { if (response < 0) {
dev_err(&edge_serial->serial->dev->dev, "sram_write failed (%x, %x, %d)\n", record->ExtAddr, record->Addr, record->Len); dev_err(&edge_serial->serial->dev->dev, "rom_write failed (%x, %x, %d)\n", le16_to_cpu(record->ExtAddr), le16_to_cpu(record->Addr), le16_to_cpu(record->Len));
break; break;
} }
firmware += sizeof (struct edge_firmware_image_record) + record->Len; firmware += sizeof (struct edge_firmware_image_record) + le16_to_cpu(record->Len);
if (firmware >= &BootImage[BootSize]) { if (firmware >= &BootImage[BootSize]) {
break; break;
} }
...@@ -678,12 +678,12 @@ static void get_product_info(struct edgeport_serial *edge_serial) ...@@ -678,12 +678,12 @@ static void get_product_info(struct edgeport_serial *edge_serial)
if (edge_serial->serial->dev->descriptor.idProduct & ION_DEVICE_ID_GENERATION_2) { if (edge_serial->serial->dev->descriptor.idProduct & ION_DEVICE_ID_GENERATION_2) {
product_info->FirmwareMajorVersion = OperationalCodeImageVersion_GEN2.MajorVersion; product_info->FirmwareMajorVersion = OperationalCodeImageVersion_GEN2.MajorVersion;
product_info->FirmwareMinorVersion = OperationalCodeImageVersion_GEN2.MinorVersion; product_info->FirmwareMinorVersion = OperationalCodeImageVersion_GEN2.MinorVersion;
product_info->FirmwareBuildNumber = OperationalCodeImageVersion_GEN2.BuildNumber; product_info->FirmwareBuildNumber = cpu_to_le16(OperationalCodeImageVersion_GEN2.BuildNumber);
product_info->iDownloadFile = EDGE_DOWNLOAD_FILE_80251; product_info->iDownloadFile = EDGE_DOWNLOAD_FILE_80251;
} else { } else {
product_info->FirmwareMajorVersion = OperationalCodeImageVersion_GEN1.MajorVersion; product_info->FirmwareMajorVersion = OperationalCodeImageVersion_GEN1.MajorVersion;
product_info->FirmwareMinorVersion = OperationalCodeImageVersion_GEN1.MinorVersion; product_info->FirmwareMinorVersion = OperationalCodeImageVersion_GEN1.MinorVersion;
product_info->FirmwareBuildNumber = OperationalCodeImageVersion_GEN1.BuildNumber; product_info->FirmwareBuildNumber = cpu_to_le16(OperationalCodeImageVersion_GEN1.BuildNumber);
product_info->iDownloadFile = EDGE_DOWNLOAD_FILE_I930; product_info->iDownloadFile = EDGE_DOWNLOAD_FILE_I930;
} }
...@@ -729,10 +729,10 @@ static void get_product_info(struct edgeport_serial *edge_serial) ...@@ -729,10 +729,10 @@ static void get_product_info(struct edgeport_serial *edge_serial)
dbg(" BoardRev %x", product_info->BoardRev); dbg(" BoardRev %x", product_info->BoardRev);
dbg(" BootMajorVersion %d.%d.%d", product_info->BootMajorVersion, dbg(" BootMajorVersion %d.%d.%d", product_info->BootMajorVersion,
product_info->BootMinorVersion, product_info->BootMinorVersion,
product_info->BootBuildNumber); le16_to_cpu(product_info->BootBuildNumber));
dbg(" FirmwareMajorVersion %d.%d.%d", product_info->FirmwareMajorVersion, dbg(" FirmwareMajorVersion %d.%d.%d", product_info->FirmwareMajorVersion,
product_info->FirmwareMinorVersion, product_info->FirmwareMinorVersion,
product_info->FirmwareBuildNumber); le16_to_cpu(product_info->FirmwareBuildNumber));
dbg(" ManufactureDescDate %d/%d/%d", product_info->ManufactureDescDate[0], dbg(" ManufactureDescDate %d/%d/%d", product_info->ManufactureDescDate[0],
product_info->ManufactureDescDate[1], product_info->ManufactureDescDate[1],
product_info->ManufactureDescDate[2]+1900); product_info->ManufactureDescDate[2]+1900);
...@@ -2326,7 +2326,7 @@ static int sram_write (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u ...@@ -2326,7 +2326,7 @@ static int sram_write (struct usb_serial *serial, __u16 extAddr, __u16 addr, __u
__u16 current_length; __u16 current_length;
unsigned char *transfer_buffer; unsigned char *transfer_buffer;
// dbg("%s - %x, %x, %d", __FUNCTION__, extAddr, addr, length); dbg("%s - %x, %x, %d", __FUNCTION__, extAddr, addr, length);
transfer_buffer = kmalloc (64, GFP_KERNEL); transfer_buffer = kmalloc (64, GFP_KERNEL);
if (!transfer_buffer) { if (!transfer_buffer) {
...@@ -2811,12 +2811,13 @@ static void change_port_settings (struct edgeport_port *edge_port, struct termio ...@@ -2811,12 +2811,13 @@ static void change_port_settings (struct edgeport_port *edge_port, struct termio
* Turns a string from Unicode into ASCII. * Turns a string from Unicode into ASCII.
* Doesn't do a good job with any characters that are outside the normal * Doesn't do a good job with any characters that are outside the normal
* ASCII range, but it's only for debugging... * ASCII range, but it's only for debugging...
* NOTE: expects the unicode in LE format
****************************************************************************/ ****************************************************************************/
static void unicode_to_ascii (char *string, short *unicode, int unicode_size) static void unicode_to_ascii (char *string, short *unicode, int unicode_size)
{ {
int i; int i;
for (i = 0; i < unicode_size; ++i) { for (i = 0; i < unicode_size; ++i) {
string[i] = (char)(unicode[i]); string[i] = (char)(le16_to_cpu(unicode[i]));
} }
string[unicode_size] = 0x00; string[unicode_size] = 0x00;
} }
...@@ -2880,11 +2881,11 @@ static void get_boot_desc (struct edgeport_serial *edge_serial) ...@@ -2880,11 +2881,11 @@ static void get_boot_desc (struct edgeport_serial *edge_serial)
dev_err(&edge_serial->serial->dev->dev, "error in getting boot descriptor\n"); dev_err(&edge_serial->serial->dev->dev, "error in getting boot descriptor\n");
} else { } else {
dbg("**Boot Descriptor:"); dbg("**Boot Descriptor:");
dbg(" BootCodeLength: %d", edge_serial->boot_descriptor.BootCodeLength); dbg(" BootCodeLength: %d", le16_to_cpu(edge_serial->boot_descriptor.BootCodeLength));
dbg(" MajorVersion: %d", edge_serial->boot_descriptor.MajorVersion); dbg(" MajorVersion: %d", edge_serial->boot_descriptor.MajorVersion);
dbg(" MinorVersion: %d", edge_serial->boot_descriptor.MinorVersion); dbg(" MinorVersion: %d", edge_serial->boot_descriptor.MinorVersion);
dbg(" BuildNumber: %d", edge_serial->boot_descriptor.BuildNumber); dbg(" BuildNumber: %d", le16_to_cpu(edge_serial->boot_descriptor.BuildNumber));
dbg(" Capabilities: 0x%x", edge_serial->boot_descriptor.Capabilities); dbg(" Capabilities: 0x%x", le16_to_cpu(edge_serial->boot_descriptor.Capabilities));
dbg(" UConfig0: %d", edge_serial->boot_descriptor.UConfig0); dbg(" UConfig0: %d", edge_serial->boot_descriptor.UConfig0);
dbg(" UConfig1: %d", edge_serial->boot_descriptor.UConfig1); dbg(" UConfig1: %d", edge_serial->boot_descriptor.UConfig1);
} }
...@@ -2936,12 +2937,12 @@ static void load_application_firmware (struct edgeport_serial *edge_serial) ...@@ -2936,12 +2937,12 @@ static void load_application_firmware (struct edgeport_serial *edge_serial)
for (;;) { for (;;) {
record = (struct edge_firmware_image_record *)firmware; record = (struct edge_firmware_image_record *)firmware;
response = sram_write (edge_serial->serial, record->ExtAddr, record->Addr, record->Len, &record->Data[0]); response = sram_write (edge_serial->serial, le16_to_cpu(record->ExtAddr), le16_to_cpu(record->Addr), le16_to_cpu(record->Len), &record->Data[0]);
if (response < 0) { if (response < 0) {
dev_err(&edge_serial->serial->dev->dev, "sram_write failed (%x, %x, %d)\n", record->ExtAddr, record->Addr, record->Len); dev_err(&edge_serial->serial->dev->dev, "sram_write failed (%x, %x, %d)\n", le16_to_cpu(record->ExtAddr), le16_to_cpu(record->Addr), record->Len);
break; break;
} }
firmware += sizeof (struct edge_firmware_image_record) + record->Len; firmware += sizeof (struct edge_firmware_image_record) + le16_to_cpu(record->Len);
if (firmware >= &FirmwareImage[ImageSize]) { if (firmware >= &FirmwareImage[ImageSize]) {
break; break;
} }
......
...@@ -75,6 +75,7 @@ static struct usb_device_id id_table [] = { ...@@ -75,6 +75,7 @@ static struct usb_device_id id_table [] = {
{ USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) },
{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) },
{ USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) },
{ USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -31,3 +31,6 @@ ...@@ -31,3 +31,6 @@
#define TRIPP_VENDOR_ID 0x2478 #define TRIPP_VENDOR_ID 0x2478
#define TRIPP_PRODUCT_ID 0x2008 #define TRIPP_PRODUCT_ID 0x2008
#define RADIOSHACK_VENDOR_ID 0x1453
#define RADIOSHACK_PRODUCT_ID 0x4026
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
* *
* See Documentation/usb/usb-serial.txt for more information on using this driver * See Documentation/usb/usb-serial.txt for more information on using this driver
* *
* (03/05/2003) gkh
* Think Treo support is now working.
*
* (04/03/2002) gkh * (04/03/2002) gkh
* Added support for the Sony OS 4.1 devices. Thanks to Hiroyuki ARAKI * Added support for the Sony OS 4.1 devices. Thanks to Hiroyuki ARAKI
* <hiro@zob.ne.jp> for the information. * <hiro@zob.ne.jp> for the information.
...@@ -156,7 +159,7 @@ ...@@ -156,7 +159,7 @@
/* /*
* Version Information * Version Information
*/ */
#define DRIVER_VERSION "v2.0" #define DRIVER_VERSION "v2.1"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>" #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
#define DRIVER_DESC "USB HandSpring Visor, Palm m50x, Sony Clié driver" #define DRIVER_DESC "USB HandSpring Visor, Palm m50x, Sony Clié driver"
...@@ -177,6 +180,7 @@ static void visor_write_bulk_callback (struct urb *urb, struct pt_regs *regs); ...@@ -177,6 +180,7 @@ static void visor_write_bulk_callback (struct urb *urb, struct pt_regs *regs);
static void visor_read_bulk_callback (struct urb *urb, struct pt_regs *regs); static void visor_read_bulk_callback (struct urb *urb, struct pt_regs *regs);
static void visor_read_int_callback (struct urb *urb, struct pt_regs *regs); static void visor_read_int_callback (struct urb *urb, struct pt_regs *regs);
static int clie_3_5_startup (struct usb_serial *serial); static int clie_3_5_startup (struct usb_serial *serial);
static int treo_attach (struct usb_serial *serial);
static int palm_os_3_probe (struct usb_serial *serial, const struct usb_device_id *id); static int palm_os_3_probe (struct usb_serial *serial, const struct usb_device_id *id);
static int palm_os_4_probe (struct usb_serial *serial, const struct usb_device_id *id); static int palm_os_4_probe (struct usb_serial *serial, const struct usb_device_id *id);
...@@ -262,6 +266,7 @@ static struct usb_serial_device_type handspring_device = { ...@@ -262,6 +266,7 @@ static struct usb_serial_device_type handspring_device = {
.close = visor_close, .close = visor_close,
.throttle = visor_throttle, .throttle = visor_throttle,
.unthrottle = visor_unthrottle, .unthrottle = visor_unthrottle,
.attach = treo_attach,
.probe = visor_probe, .probe = visor_probe,
.calc_num_ports = visor_calc_num_ports, .calc_num_ports = visor_calc_num_ports,
.shutdown = visor_shutdown, .shutdown = visor_shutdown,
...@@ -801,6 +806,48 @@ static int clie_3_5_startup (struct usb_serial *serial) ...@@ -801,6 +806,48 @@ static int clie_3_5_startup (struct usb_serial *serial)
return 0; return 0;
} }
static int treo_attach (struct usb_serial *serial)
{
struct usb_serial_port *port;
int i;
/* Only do this endpoint hack for the Handspring devices with
* interrupt in endpoints, which for now are the Treo devices. */
if ((serial->dev->descriptor.idVendor != HANDSPRING_VENDOR_ID) ||
(serial->num_interrupt_in == 0))
return 0;
dbg("%s", __FUNCTION__);
/* Ok, this is pretty ugly, but these devices want to use the
* interrupt endpoint as paired up with a bulk endpoint for a
* "virtual serial port". So let's force the endpoints to be
* where we want them to be. */
for (i = serial->num_bulk_in; i < serial->num_ports; ++i) {
port = &serial->port[i];
port->read_urb = serial->port[0].read_urb;
port->bulk_in_endpointAddress = serial->port[0].bulk_in_endpointAddress;
port->bulk_in_buffer = serial->port[0].bulk_in_buffer;
}
for (i = serial->num_bulk_out; i < serial->num_ports; ++i) {
port = &serial->port[i];
port->write_urb = serial->port[0].write_urb;
port->bulk_out_size = serial->port[0].bulk_out_size;
port->bulk_out_endpointAddress = serial->port[0].bulk_out_endpointAddress;
port->bulk_out_buffer = serial->port[0].bulk_out_buffer;
}
for (i = serial->num_interrupt_in; i < serial->num_ports; ++i) {
port = &serial->port[i];
port->interrupt_in_urb = serial->port[0].interrupt_in_urb;
port->interrupt_in_endpointAddress = serial->port[0].interrupt_in_endpointAddress;
port->interrupt_in_buffer = serial->port[0].interrupt_in_buffer;
}
return 0;
}
static void visor_shutdown (struct usb_serial *serial) static void visor_shutdown (struct usb_serial *serial)
{ {
......
...@@ -582,20 +582,26 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -582,20 +582,26 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
unsigned short old_sg; unsigned short old_sg;
unsigned old_request_bufflen; unsigned old_request_bufflen;
unsigned char old_sc_data_direction; unsigned char old_sc_data_direction;
unsigned char old_cmd_len;
unsigned char old_cmnd[MAX_COMMAND_SIZE]; unsigned char old_cmnd[MAX_COMMAND_SIZE];
US_DEBUGP("Issuing auto-REQUEST_SENSE\n"); US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
/* save the old command */ /* save the old command */
memcpy(old_cmnd, srb->cmnd, MAX_COMMAND_SIZE); memcpy(old_cmnd, srb->cmnd, MAX_COMMAND_SIZE);
old_cmd_len = srb->cmd_len;
/* set the command and the LUN */ /* set the command and the LUN */
memset(srb->cmnd, 0, MAX_COMMAND_SIZE);
srb->cmnd[0] = REQUEST_SENSE; srb->cmnd[0] = REQUEST_SENSE;
srb->cmnd[1] = old_cmnd[1] & 0xE0; srb->cmnd[1] = old_cmnd[1] & 0xE0;
srb->cmnd[2] = 0;
srb->cmnd[3] = 0;
srb->cmnd[4] = 18; srb->cmnd[4] = 18;
srb->cmnd[5] = 0;
/* FIXME: we must do the protocol translation here */
if (us->subclass == US_SC_RBC || us->subclass == US_SC_SCSI)
srb->cmd_len = 6;
else
srb->cmd_len = 12;
/* set the transfer direction */ /* set the transfer direction */
old_sc_data_direction = srb->sc_data_direction; old_sc_data_direction = srb->sc_data_direction;
...@@ -621,6 +627,7 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -621,6 +627,7 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
srb->request_bufflen = old_request_bufflen; srb->request_bufflen = old_request_bufflen;
srb->use_sg = old_sg; srb->use_sg = old_sg;
srb->sc_data_direction = old_sc_data_direction; srb->sc_data_direction = old_sc_data_direction;
srb->cmd_len = old_cmd_len;
memcpy(srb->cmnd, old_cmnd, MAX_COMMAND_SIZE); memcpy(srb->cmnd, old_cmnd, MAX_COMMAND_SIZE);
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) { if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
......
...@@ -213,7 +213,7 @@ struct usb_tt; ...@@ -213,7 +213,7 @@ struct usb_tt;
struct usb_device { struct usb_device {
int devnum; /* Address on USB bus */ int devnum; /* Address on USB bus */
char devpath [16]; /* Use in messages: /port/port/... */ char devpath [16]; /* Use in messages: /port/port/... */
enum usb_device_state state; /* configured, not attached, etc */
enum usb_device_speed speed; /* high/full/low (or error) */ enum usb_device_speed speed; /* high/full/low (or error) */
struct usb_tt *tt; /* low/full speed dev, highspeed hub */ struct usb_tt *tt; /* low/full speed dev, highspeed hub */
...@@ -240,7 +240,6 @@ struct usb_device { ...@@ -240,7 +240,6 @@ struct usb_device {
int have_langid; /* whether string_langid is valid yet */ int have_langid; /* whether string_langid is valid yet */
int string_langid; /* language ID for strings */ int string_langid; /* language ID for strings */
int present; /* if device is present or not */
void *hcpriv; /* Host Controller private data */ void *hcpriv; /* Host Controller private data */
......
...@@ -291,4 +291,25 @@ enum usb_device_speed { ...@@ -291,4 +291,25 @@ enum usb_device_speed {
USB_SPEED_HIGH /* usb 2.0 */ USB_SPEED_HIGH /* usb 2.0 */
}; };
enum usb_device_state {
/* NOTATTACHED isn't in the USB spec, and this state acts
* the same as ATTACHED ... but it's clearer this way.
*/
USB_STATE_NOTATTACHED = 0,
/* the chapter 9 device states */
USB_STATE_ATTACHED,
USB_STATE_POWERED,
USB_STATE_DEFAULT, /* limited function */
USB_STATE_ADDRESS,
USB_STATE_CONFIGURED, /* most functions */
USB_STATE_SUSPENDED
/* NOTE: there are actually four different SUSPENDED
* states, returning to POWERED, DEFAULT, ADDRESS, or
* CONFIGURED respectively when SOF tokens flow again.
*/
};
#endif /* __LINUX_USB_CH9_H */ #endif /* __LINUX_USB_CH9_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment