aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/usb/kaweth.c43
-rw-r--r--drivers/net/usb/kawethfw.h557
-rw-r--r--firmware/Makefile3
-rw-r--r--firmware/WHENCE13
-rw-r--r--firmware/kaweth/new_code.bin.ihex206
-rw-r--r--firmware/kaweth/new_code_fix.bin.ihex40
-rw-r--r--firmware/kaweth/trigger_code.bin.ihex13
-rw-r--r--firmware/kaweth/trigger_code_fix.bin.ihex3
8 files changed, 304 insertions, 574 deletions
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 7c66b052f55a..d6829db51b45 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -57,13 +57,12 @@
57#include <linux/ethtool.h> 57#include <linux/ethtool.h>
58#include <linux/dma-mapping.h> 58#include <linux/dma-mapping.h>
59#include <linux/wait.h> 59#include <linux/wait.h>
60#include <linux/firmware.h>
60#include <asm/uaccess.h> 61#include <asm/uaccess.h>
61#include <asm/byteorder.h> 62#include <asm/byteorder.h>
62 63
63#undef DEBUG 64#undef DEBUG
64 65
65#include "kawethfw.h"
66
67#define KAWETH_MTU 1514 66#define KAWETH_MTU 1514
68#define KAWETH_BUF_SIZE 1664 67#define KAWETH_BUF_SIZE 1664
69#define KAWETH_TX_TIMEOUT (5 * HZ) 68#define KAWETH_TX_TIMEOUT (5 * HZ)
@@ -108,6 +107,10 @@
108MODULE_AUTHOR("Michael Zappe <zapman@interlan.net>, Stephane Alnet <stephane@u-picardie.fr>, Brad Hards <bhards@bigpond.net.au> and Oliver Neukum <oliver@neukum.org>"); 107MODULE_AUTHOR("Michael Zappe <zapman@interlan.net>, Stephane Alnet <stephane@u-picardie.fr>, Brad Hards <bhards@bigpond.net.au> and Oliver Neukum <oliver@neukum.org>");
109MODULE_DESCRIPTION("KL5USB101 USB Ethernet driver"); 108MODULE_DESCRIPTION("KL5USB101 USB Ethernet driver");
110MODULE_LICENSE("GPL"); 109MODULE_LICENSE("GPL");
110MODULE_FIRMWARE("kaweth/new_code.bin");
111MODULE_FIRMWARE("kaweth/new_code_fix.bin");
112MODULE_FIRMWARE("kaweth/trigger_code.bin");
113MODULE_FIRMWARE("kaweth/trigger_code_fix.bin");
111 114
112static const char driver_name[] = "kaweth"; 115static const char driver_name[] = "kaweth";
113 116
@@ -385,17 +388,28 @@ static int kaweth_set_receive_filter(struct kaweth_device *kaweth,
385 * kaweth_download_firmware 388 * kaweth_download_firmware
386 ****************************************************************/ 389 ****************************************************************/
387static int kaweth_download_firmware(struct kaweth_device *kaweth, 390static int kaweth_download_firmware(struct kaweth_device *kaweth,
388 __u8 *data, 391 const char *fwname,
389 __u16 data_len,
390 __u8 interrupt, 392 __u8 interrupt,
391 __u8 type) 393 __u8 type)
392{ 394{
393 if(data_len > KAWETH_FIRMWARE_BUF_SIZE) { 395 const struct firmware *fw;
394 err("Firmware too big: %d", data_len); 396 int data_len;
397 int ret;
398
399 ret = request_firmware(&fw, fwname, &kaweth->dev->dev);
400 if (ret) {
401 err("Firmware request failed\n");
402 return ret;
403 }
404
405 if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) {
406 err("Firmware too big: %zu", fw->size);
395 return -ENOSPC; 407 return -ENOSPC;
396 } 408 }
409 data_len = fw->size;
410 memcpy(kaweth->firmware_buf, fw->data, fw->size);
397 411
398 memcpy(kaweth->firmware_buf, data, data_len); 412 release_firmware(fw);
399 413
400 kaweth->firmware_buf[2] = (data_len & 0xFF) - 7; 414 kaweth->firmware_buf[2] = (data_len & 0xFF) - 7;
401 kaweth->firmware_buf[3] = data_len >> 8; 415 kaweth->firmware_buf[3] = data_len >> 8;
@@ -406,8 +420,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
406 kaweth->firmware_buf[2]); 420 kaweth->firmware_buf[2]);
407 421
408 dbg("Downloading firmware at %p to kaweth device at %p", 422 dbg("Downloading firmware at %p to kaweth device at %p",
409 data, 423 fw->data, kaweth);
410 kaweth);
411 dbg("Firmware length: %d", data_len); 424 dbg("Firmware length: %d", data_len);
412 425
413 return kaweth_control(kaweth, 426 return kaweth_control(kaweth,
@@ -1009,8 +1022,7 @@ static int kaweth_probe(
1009 info("Downloading firmware..."); 1022 info("Downloading firmware...");
1010 kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL); 1023 kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL);
1011 if ((result = kaweth_download_firmware(kaweth, 1024 if ((result = kaweth_download_firmware(kaweth,
1012 kaweth_new_code, 1025 "kaweth/new_code.bin",
1013 len_kaweth_new_code,
1014 100, 1026 100,
1015 2)) < 0) { 1027 2)) < 0) {
1016 err("Error downloading firmware (%d)", result); 1028 err("Error downloading firmware (%d)", result);
@@ -1018,8 +1030,7 @@ static int kaweth_probe(
1018 } 1030 }
1019 1031
1020 if ((result = kaweth_download_firmware(kaweth, 1032 if ((result = kaweth_download_firmware(kaweth,
1021 kaweth_new_code_fix, 1033 "kaweth/new_code_fix.bin",
1022 len_kaweth_new_code_fix,
1023 100, 1034 100,
1024 3)) < 0) { 1035 3)) < 0) {
1025 err("Error downloading firmware fix (%d)", result); 1036 err("Error downloading firmware fix (%d)", result);
@@ -1027,8 +1038,7 @@ static int kaweth_probe(
1027 } 1038 }
1028 1039
1029 if ((result = kaweth_download_firmware(kaweth, 1040 if ((result = kaweth_download_firmware(kaweth,
1030 kaweth_trigger_code, 1041 "kaweth/trigger_code.bin",
1031 len_kaweth_trigger_code,
1032 126, 1042 126,
1033 2)) < 0) { 1043 2)) < 0) {
1034 err("Error downloading trigger code (%d)", result); 1044 err("Error downloading trigger code (%d)", result);
@@ -1037,8 +1047,7 @@ static int kaweth_probe(
1037 } 1047 }
1038 1048
1039 if ((result = kaweth_download_firmware(kaweth, 1049 if ((result = kaweth_download_firmware(kaweth,
1040 kaweth_trigger_code_fix, 1050 "kaweth/trigger_code_fix.bin",
1041 len_kaweth_trigger_code_fix,
1042 126, 1051 126,
1043 3)) < 0) { 1052 3)) < 0) {
1044 err("Error downloading trigger code fix (%d)", result); 1053 err("Error downloading trigger code fix (%d)", result);
diff --git a/drivers/net/usb/kawethfw.h b/drivers/net/usb/kawethfw.h
deleted file mode 100644
index cf85fcb0d1a6..000000000000
--- a/drivers/net/usb/kawethfw.h
+++ /dev/null
@@ -1,557 +0,0 @@
1/******************************************/
2/* NOTE: B6/C3 is data header signature */
3/* 0xAA/0xBB is data length = total */
4/* bytes - 7, 0xCC is type, 0xDD is */
5/* interrupt to use. */
6/******************************************/
7
8/****************************************************************
9 * kaweth_trigger_code
10 ****************************************************************/
11static __u8 kaweth_trigger_code[] =
12{
13 0xB6, 0xC3, 0xAA, 0xBB, 0xCC, 0xDD,
14 0xc8, 0x07, 0xa0, 0x00, 0xf0, 0x07, 0x5e, 0x00,
15 0x06, 0x00, 0xf0, 0x07, 0x0a, 0x00, 0x08, 0x00,
16 0xf0, 0x09, 0x00, 0x00, 0x02, 0x00, 0xe7, 0x07,
17 0x36, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00,
18 0x04, 0x00, 0xe7, 0x07, 0x50, 0xc3, 0x10, 0xc0,
19 0xf0, 0x09, 0x0e, 0xc0, 0x00, 0x00, 0xe7, 0x87,
20 0x01, 0x00, 0x0e, 0xc0, 0x97, 0xcf, 0xd7, 0x09,
21 0x00, 0xc0, 0x17, 0x02, 0xc8, 0x07, 0xa0, 0x00,
22 0xe7, 0x17, 0x50, 0xc3, 0x10, 0xc0, 0x30, 0xd8,
23 0x04, 0x00, 0x30, 0x5c, 0x08, 0x00, 0x04, 0x00,
24 0xb0, 0xc0, 0x06, 0x00, 0xc8, 0x05, 0xe7, 0x05,
25 0x00, 0xc0, 0xc0, 0xdf, 0x97, 0xcf, 0x49, 0xaf,
26 0xc0, 0x07, 0x00, 0x00, 0x60, 0xaf, 0x4a, 0xaf,
27 0x00, 0x0c, 0x0c, 0x00, 0x40, 0xd2, 0x00, 0x1c,
28 0x0c, 0x00, 0x40, 0xd2, 0x30, 0x00, 0x08, 0x00,
29 0xf0, 0x07, 0x00, 0x00, 0x04, 0x00, 0xf0, 0x07,
30 0x86, 0x00, 0x06, 0x00, 0x67, 0xcf, 0x27, 0x0c,
31 0x02, 0x00, 0x00, 0x00, 0x27, 0x0c, 0x00, 0x00,
32 0x0e, 0xc0, 0x49, 0xaf, 0x64, 0xaf, 0xc0, 0x07,
33 0x00, 0x00, 0x4b, 0xaf, 0x4a, 0xaf, 0x5a, 0xcf,
34 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35 0x00, 0x00, 0x94, 0x00, 0x05, 0x00,
36 0x00, 0x00
37};
38/****************************************************************
39 * kaweth_trigger_code_fix
40 ****************************************************************/
41static __u8 kaweth_trigger_code_fix[] =
42{
43 0xB6, 0xC3, 0xAA, 0xBB, 0xCC, 0xDD,
44 0x02, 0x00, 0x06, 0x00, 0x18, 0x00, 0x3e, 0x00,
45 0x80, 0x00, 0x98, 0x00, 0xaa, 0x00,
46 0x00, 0x00