diff options
author | Rene Buergel <rene.buergel@sohard.de> | 2012-09-18 09:02:01 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-18 17:26:30 +0100 |
commit | 8d733e26c076f47e7774c0e5baa74c9b1c01199a (patch) | |
tree | 9c7d8885361c63325f0fb7e1ca3f0da00ed89fce /drivers/usb/serial/keyspan_pda.c | |
parent | cc183e2a5ebfdddc8d3498149cae6b4c40551a68 (diff) |
USB: ezusb: add functions for firmware download
This patch adds new functions to upload firmware to the controller. The
drivers currently using ezusb are adapted to use these new functions.
This also fixes a bug occuring during firmware loading in the
whiteheat-driver:
The driver iterates over an ihex-formatted firmware using ++ on a "const
struct ihex_binrec*" which leads to faulty results, because ihex data is
read as length. The function "ihex_next_binrec(record)" has so be used
to work correctly
Signed-off-by: René Bürgel <rene.buergel@sohard.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/keyspan_pda.c')
-rw-r--r-- | drivers/usb/serial/keyspan_pda.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 39ab6687ce2..e1cada31356 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -25,8 +25,6 @@ #include <linux/module.h> #include <linux/spinlock.h> #include <linux/workqueue.h> -#include <linux/firmware.h> -#include <linux/ihex.h> #include <linux/uaccess.h> #include <linux/usb.h> #include <linux/usb/serial.h> @@ -675,8 +673,6 @@ static int keyspan_pda_fake_startup(struct usb_serial *serial) { int response; const char *fw_name; - const struct ihex_binrec *record; - const struct firmware *fw; /* download the firmware here ... */ response = ezusb_fx1_set_reset(serial->dev, 1); @@ -696,30 +692,15 @@ static int keyspan_pda_fake_startup(struct usb_serial *serial) __func__); return -ENODEV; } - if (request_ihex_firmware(&fw, fw_name, &serial->dev->dev)) { + + if (ezusb_fx1_ihex_firmware_download(serial->dev, fw_name) < 0) { dev_err(&serial->dev->dev, "failed to load firmware \"%s\"\n", fw_name); return -ENOENT; } - record = (const struct ihex_binrec *)fw->data; - - while (record) { - response = ezusb_writememory(serial->dev, be32_to_cpu(record->addr), - (unsigned char *)record->data, - be16_to_cpu(record->len), 0xa0); - if (response < 0) { - dev_err(&serial->dev->dev, "ezusb_writememory failed " - "for Keyspan PDA firmware (%d %04X %p %d)\n", - response, be32_to_cpu(record->addr), - record->data, be16_to_cpu(record->len)); - break; - } - record = ihex_next_binrec(record); - } - release_firmware(fw); - /* bring device out of reset. Renumeration will occur in a moment - and the new device will bind to the real driver */ - response = ezusb_fx1_set_reset(serial->dev, 0); + + /* after downloading firmware Renumeration will occur in a + moment and the new device will bind to the real driver */ /* we want this device to fail to have a driver assigned to it. */ return 1; |