Commit c3ece7e7 authored by Peter E. Berger's avatar Peter E. Berger Committed by Johan Hovold

USB: io_ti: Increase insufficient timeout for firmware downloads

The io_ti driver fails to download firmware to Edgeport devices such as
the EP/416 and EP/421 (devices with on-board E2PROM).  One of the problems
is that the default 1 second timeout in ti_vsend_sync() is insufficient
for download operations.  This patch increases the download timeout to
10 seconds.
Signed-off-by: default avatarPeter E. Berger <pberger@brimson.com>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 49bda212
...@@ -210,6 +210,10 @@ static int edge_create_sysfs_attrs(struct usb_serial_port *port); ...@@ -210,6 +210,10 @@ static int edge_create_sysfs_attrs(struct usb_serial_port *port);
static int edge_remove_sysfs_attrs(struct usb_serial_port *port); static int edge_remove_sysfs_attrs(struct usb_serial_port *port);
/* Timeouts in msecs: firmware downloads take longer */
#define TI_VSEND_TIMEOUT_DEFAULT 1000
#define TI_VSEND_TIMEOUT_FW_DOWNLOAD 10000
static int ti_vread_sync(struct usb_device *dev, __u8 request, static int ti_vread_sync(struct usb_device *dev, __u8 request,
__u16 value, __u16 index, u8 *data, int size) __u16 value, __u16 index, u8 *data, int size)
{ {
...@@ -228,14 +232,14 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request, ...@@ -228,14 +232,14 @@ static int ti_vread_sync(struct usb_device *dev, __u8 request,
return 0; return 0;
} }
static int ti_vsend_sync(struct usb_device *dev, __u8 request, static int ti_vsend_sync(struct usb_device *dev, u8 request, u16 value,
__u16 value, __u16 index, u8 *data, int size) u16 index, u8 *data, int size, int timeout)
{ {
int status; int status;
status = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), request, status = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), request,
(USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT), (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT),
value, index, data, size, 1000); value, index, data, size, timeout);
if (status < 0) if (status < 0)
return status; return status;
if (status != size) { if (status != size) {
...@@ -250,7 +254,8 @@ static int send_cmd(struct usb_device *dev, __u8 command, ...@@ -250,7 +254,8 @@ static int send_cmd(struct usb_device *dev, __u8 command,
__u8 moduleid, __u16 value, u8 *data, __u8 moduleid, __u16 value, u8 *data,
int size) int size)
{ {
return ti_vsend_sync(dev, command, value, moduleid, data, size); return ti_vsend_sync(dev, command, value, moduleid, data, size,
TI_VSEND_TIMEOUT_DEFAULT);
} }
/* clear tx/rx buffers and fifo in TI UMP */ /* clear tx/rx buffers and fifo in TI UMP */
...@@ -378,9 +383,9 @@ static int write_boot_mem(struct edgeport_serial *serial, ...@@ -378,9 +383,9 @@ static int write_boot_mem(struct edgeport_serial *serial,
} }
for (i = 0; i < length; ++i) { for (i = 0; i < length; ++i) {
status = ti_vsend_sync(serial->serial->dev, status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE,
UMPC_MEMORY_WRITE, buffer[i], buffer[i], (u16)(i + start_address), NULL,
(__u16)(i + start_address), NULL, 0); 0, TI_VSEND_TIMEOUT_DEFAULT);
if (status) if (status)
return status; return status;
} }
...@@ -421,10 +426,9 @@ static int write_i2c_mem(struct edgeport_serial *serial, ...@@ -421,10 +426,9 @@ static int write_i2c_mem(struct edgeport_serial *serial,
* regardless of host byte order. * regardless of host byte order.
*/ */
be_start_address = swab16((u16)start_address); be_start_address = swab16((u16)start_address);
status = ti_vsend_sync(serial->serial->dev, status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE,
UMPC_MEMORY_WRITE, (__u16)address_type, (u16)address_type, be_start_address,
be_start_address, buffer, write_length, TI_VSEND_TIMEOUT_DEFAULT);
buffer, write_length);
if (status) { if (status) {
dev_dbg(dev, "%s - ERROR %d\n", __func__, status); dev_dbg(dev, "%s - ERROR %d\n", __func__, status);
return status; return status;
...@@ -454,9 +458,8 @@ static int write_i2c_mem(struct edgeport_serial *serial, ...@@ -454,9 +458,8 @@ static int write_i2c_mem(struct edgeport_serial *serial,
*/ */
be_start_address = swab16((u16)start_address); be_start_address = swab16((u16)start_address);
status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE, status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE,
(__u16)address_type, (u16)address_type, be_start_address, buffer,
be_start_address, write_length, TI_VSEND_TIMEOUT_DEFAULT);
buffer, write_length);
if (status) { if (status) {
dev_err(dev, "%s - ERROR %d\n", __func__, status); dev_err(dev, "%s - ERROR %d\n", __func__, status);
return status; return status;
...@@ -1129,7 +1132,8 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -1129,7 +1132,8 @@ static int download_fw(struct edgeport_serial *serial)
/* Reset UMP -- Back to BOOT MODE */ /* Reset UMP -- Back to BOOT MODE */
status = ti_vsend_sync(serial->serial->dev, status = ti_vsend_sync(serial->serial->dev,
UMPC_HARDWARE_RESET, UMPC_HARDWARE_RESET,
0, 0, NULL, 0); 0, 0, NULL, 0,
TI_VSEND_TIMEOUT_DEFAULT);
dev_dbg(dev, "%s - HARDWARE RESET return %d\n", __func__, status); dev_dbg(dev, "%s - HARDWARE RESET return %d\n", __func__, status);
...@@ -1229,7 +1233,9 @@ static int download_fw(struct edgeport_serial *serial) ...@@ -1229,7 +1233,9 @@ static int download_fw(struct edgeport_serial *serial)
/* Tell firmware to copy download image into I2C */ /* Tell firmware to copy download image into I2C */
status = ti_vsend_sync(serial->serial->dev, status = ti_vsend_sync(serial->serial->dev,
UMPC_COPY_DNLD_TO_I2C, 0, 0, NULL, 0); UMPC_COPY_DNLD_TO_I2C,
0, 0, NULL, 0,
TI_VSEND_TIMEOUT_FW_DOWNLOAD);
dev_dbg(dev, "%s - Update complete 0x%x\n", __func__, status); dev_dbg(dev, "%s - Update complete 0x%x\n", __func__, status);
if (status) { if (status) {
......
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