Commit ec6752f5 authored by David Woodhouse's avatar David Woodhouse Committed by David Woodhouse

whiteheat: use request_firmware()

Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 5f24e2d6
......@@ -81,7 +81,8 @@
#include <linux/serial_reg.h>
#include <linux/serial.h>
#include <linux/usb/serial.h>
#include "whiteheat_fw.h" /* firmware for the ConnectTech WhiteHEAT device */
#include <linux/firmware.h>
#include <linux/ihex.h>
#include "whiteheat.h" /* WhiteHEAT specific commands */
static int debug;
......@@ -279,37 +280,52 @@ static int firm_report_tx_done(struct usb_serial_port *port);
*/
static int whiteheat_firmware_download (struct usb_serial *serial, const struct usb_device_id *id)
{
int response;
const struct whiteheat_hex_record *record;
int response, ret = -ENOENT;
const struct firmware *loader_fw = NULL, *firmware_fw = NULL;
const struct ihex_binrec *record;
dbg("%s", __func__);
if (request_ihex_firmware(&firmware_fw, "whiteheat.fw",
&serial->dev->dev)) {
err("%s - request \"whiteheat.fw\" failed", __func__);
goto out;
}
if (request_ihex_firmware(&loader_fw, "whiteheat_loader.fw",
&serial->dev->dev)) {
err("%s - request \"whiteheat_loader.fw\" failed", __func__);
goto out;
}
ret = 0;
response = ezusb_set_reset (serial, 1);
record = &whiteheat_loader[0];
while (record->address != 0xffff) {
response = ezusb_writememory (serial, record->address,
(unsigned char *)record->data, record->data_size, 0xa0);
record = (const struct ihex_binrec *)loader_fw->data;
while (record) {
response = ezusb_writememory (serial, be32_to_cpu(record->addr),
(unsigned char *)record->data,
be16_to_cpu(record->len), 0xa0);
if (response < 0) {
err("%s - ezusb_writememory failed for loader (%d %04X %p %d)",
__func__, response, record->address, record->data, record->data_size);
__func__, response, be32_to_cpu(record->addr),
record->data, be16_to_cpu(record->len));
break;
}
++record;
record = ihex_next_binrec(record);
}
response = ezusb_set_reset (serial, 0);
record = &whiteheat_firmware[0];
while (record->address < 0x1b40) {
++record;
}
while (record->address != 0xffff) {
response = ezusb_writememory (serial, record->address,
(unsigned char *)record->data, record->data_size, 0xa3);
record = (const struct ihex_binrec *)firmware_fw->data;
while (record && be32_to_cpu(record->addr) < 0x1b40)
record = ihex_next_binrec(record);
while (record) {
response = ezusb_writememory (serial, be32_to_cpu(record->addr),
(unsigned char *)record->data,
be16_to_cpu(record->len), 0xa3);
if (response < 0) {
err("%s - ezusb_writememory failed for first firmware step (%d %04X %p %d)",
__func__, response, record->address, record->data, record->data_size);
__func__, response, be32_to_cpu(record->addr),
record->data, be16_to_cpu(record->len));
break;
}
++record;
......@@ -317,21 +333,25 @@ static int whiteheat_firmware_download (struct usb_serial *serial, const struct
response = ezusb_set_reset (serial, 1);
record = &whiteheat_firmware[0];
while (record->address < 0x1b40) {
response = ezusb_writememory (serial, record->address,
(unsigned char *)record->data, record->data_size, 0xa0);
record = (const struct ihex_binrec *)firmware_fw->data;
while (record && be32_to_cpu(record->addr) < 0x1b40) {
response = ezusb_writememory (serial, be32_to_cpu(record->addr),
(unsigned char *)record->data,
be16_to_cpu(record->len), 0xa0);
if (response < 0) {
err("%s - ezusb_writememory failed for second firmware step (%d %04X %p %d)",
__func__, response, record->address, record->data, record->data_size);
__func__, response, be32_to_cpu(record->addr),
record->data, be16_to_cpu(record->len));
break;
}
++record;
}
ret = 0;
response = ezusb_set_reset (serial, 0);
return 0;
out:
release_firmware(loader_fw);
release_firmware(firmware_fw);
return ret;
}
......@@ -1503,6 +1523,9 @@ MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_LICENSE("GPL");
MODULE_FIRMWARE("whiteheat.fw");
MODULE_FIRMWARE("whiteheat_loader.fw");
module_param(urb_pool_size, int, 0);
MODULE_PARM_DESC(urb_pool_size, "Number of urbs to use for buffering");
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -54,6 +54,8 @@ fw-shipped- := keyspan/mpr.fw keyspan/usa18x.fw keyspan/usa19.fw \
keyspan/usa28x.fw keyspan/usa49w.fw keyspan/usa49wlc.fw
endif
fw-shipped-$(CONFIG_USB_SERIAL_TI) += ti_3410.fw ti_5052.fw
fw-shipped-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat_loader.fw whiteheat.fw \
# whiteheat_loader_debug.fw
fw-shipped-$(CONFIG_USB_SERIAL_KEYSPAN_PDA) += keyspan_pda/keyspan_pda.fw
fw-shipped-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda/xircom_pgs.fw
......
......@@ -205,3 +205,24 @@ Licence: Allegedly GPLv2+, but no source visible. Marked:
Found in hex form in kernel source.
--------------------------------------------------------------------------
Driver: whiteheat -- USB ConnectTech WhiteHEAT serial device
File: whiteheat.fw
Version: 4.06
File: whiteheat_loader.fw
File: whiteheat_loader_debug.fw
Licence: Allegedly GPLv2, but no source visible. Marked:
Copyright (C) 2000-2002 ConnectTech Inc
Debug loader claims the following behaviour:
Port 1 LED flashes when the vend_ax program is running
Port 2 LED flashes when any SETUP command arrives
Port 3 LED flashes when any valid VENDOR request occurs
Port 4 LED flashes when the EXTERNAL RAM DOWNLOAD request occurs
Converted from Intel HEX files, used in our binary representation of ihex.
--------------------------------------------------------------------------
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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