提交 79682499 编写于 作者: D David Woodhouse 提交者: David Woodhouse

kaweth: use request_firmware()

Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
上级 0f805b86
......@@ -57,13 +57,12 @@
#include <linux/ethtool.h>
#include <linux/dma-mapping.h>
#include <linux/wait.h>
#include <linux/firmware.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
#undef DEBUG
#include "kawethfw.h"
#define KAWETH_MTU 1514
#define KAWETH_BUF_SIZE 1664
#define KAWETH_TX_TIMEOUT (5 * HZ)
......@@ -108,6 +107,10 @@
MODULE_AUTHOR("Michael Zappe <zapman@interlan.net>, Stephane Alnet <stephane@u-picardie.fr>, Brad Hards <bhards@bigpond.net.au> and Oliver Neukum <oliver@neukum.org>");
MODULE_DESCRIPTION("KL5USB101 USB Ethernet driver");
MODULE_LICENSE("GPL");
MODULE_FIRMWARE("kaweth/new_code.bin");
MODULE_FIRMWARE("kaweth/new_code_fix.bin");
MODULE_FIRMWARE("kaweth/trigger_code.bin");
MODULE_FIRMWARE("kaweth/trigger_code_fix.bin");
static const char driver_name[] = "kaweth";
......@@ -385,17 +388,28 @@ static int kaweth_set_receive_filter(struct kaweth_device *kaweth,
* kaweth_download_firmware
****************************************************************/
static int kaweth_download_firmware(struct kaweth_device *kaweth,
__u8 *data,
__u16 data_len,
const char *fwname,
__u8 interrupt,
__u8 type)
{
if(data_len > KAWETH_FIRMWARE_BUF_SIZE) {
err("Firmware too big: %d", data_len);
const struct firmware *fw;
int data_len;
int ret;
ret = request_firmware(&fw, fwname, &kaweth->dev->dev);
if (ret) {
err("Firmware request failed\n");
return ret;
}
if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) {
err("Firmware too big: %zu", fw->size);
return -ENOSPC;
}
data_len = fw->size;
memcpy(kaweth->firmware_buf, fw->data, fw->size);
memcpy(kaweth->firmware_buf, data, data_len);
release_firmware(fw);
kaweth->firmware_buf[2] = (data_len & 0xFF) - 7;
kaweth->firmware_buf[3] = data_len >> 8;
......@@ -406,8 +420,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
kaweth->firmware_buf[2]);
dbg("Downloading firmware at %p to kaweth device at %p",
data,
kaweth);
fw->data, kaweth);
dbg("Firmware length: %d", data_len);
return kaweth_control(kaweth,
......@@ -1009,8 +1022,7 @@ static int kaweth_probe(
info("Downloading firmware...");
kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL);
if ((result = kaweth_download_firmware(kaweth,
kaweth_new_code,
len_kaweth_new_code,
"kaweth/new_code.bin",
100,
2)) < 0) {
err("Error downloading firmware (%d)", result);
......@@ -1018,8 +1030,7 @@ static int kaweth_probe(
}
if ((result = kaweth_download_firmware(kaweth,
kaweth_new_code_fix,
len_kaweth_new_code_fix,
"kaweth/new_code_fix.bin",
100,
3)) < 0) {
err("Error downloading firmware fix (%d)", result);
......@@ -1027,8 +1038,7 @@ static int kaweth_probe(
}
if ((result = kaweth_download_firmware(kaweth,
kaweth_trigger_code,
len_kaweth_trigger_code,
"kaweth/trigger_code.bin",
126,
2)) < 0) {
err("Error downloading trigger code (%d)", result);
......@@ -1037,8 +1047,7 @@ static int kaweth_probe(
}
if ((result = kaweth_download_firmware(kaweth,
kaweth_trigger_code_fix,
len_kaweth_trigger_code_fix,
"kaweth/trigger_code_fix.bin",
126,
3)) < 0) {
err("Error downloading trigger code fix (%d)", result);
......
此差异已折叠。
......@@ -26,6 +26,9 @@ fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \
ess/maestro3_assp_minisrc.fw
fw-shipped-$(CONFIG_SND_YMFPCI) += yamaha/ds1_ctrl.fw yamaha/ds1_dsp.fw \
yamaha/ds1e_ctrl.fw
fw-shipped-$(CONFIG_USB_KAWETH) += kaweth/new_code.bin kaweth/trigger_code.bin \
kaweth/new_code_fix.bin \
kaweth/trigger_code_fix.bin
fw-shipped-all := $(fw-shipped-y) $(fw-shipped-m) $(fw-shipped-)
......
......@@ -57,3 +57,16 @@ Original licence info:
* expressed or implied about its fitness for any purpose.
--------------------------------------------------------------------------
Driver: kaweth -- USB KLSI KL5USB101-based Ethernet device
File: kaweth/new_code.bin
File: kaweth/new_code_fix.bin
File: kaweth/trigger_code.bin
File: kaweth/trigger_code_fix.bin
Licence: Unknown
Found in hex form in the kernel source.
--------------------------------------------------------------------------
:10000000B6C3AABBCCDD9FCFDE06E7570000C4060F
:1000100097C1E767FF1F28C0E787000424C0E76790
:10002000FFF922C097CFD70900C0E709A2C0BE06DA
:100030009FAF3600E70500C0A7CFBC0697CFE757B4
:100040000000B806A7A1B80697CFE757000014082C
:100050000AC0E7570000A4C0A7C07A069FAF920766
:10006000E70700001408E757FFFFBA069FA0380013
:10007000E759BA06BE069FA03800C809CA0608623A
:100080009FA13608C00976060060A7C07A069FAF18
:10009000CC02E7570000B806A7C17A069FAF04005C
:1000A000E75700008E060AC1E70920C01008E7D014
:1000B0001008E767400010089FAF920CC009D006F7
:1000C000006005C4C059BE0602C09FAFEC009FAFE0
:1000D0003402E7570000A6069FA07A02A7CF7A064F
:1000E0004802E709BE06D006C83704009FAF0803E0
:1000F00097CFE7570000CE0697C0D70900C0C1DFF1
:10010000C809C606086214C02704C6061094F00782
:1001100010080200C107010070000400F007300160
:10012000060050AFE707FFFFD006E7070000CE0646
:10013000E70500C097CFD70900C0C1DF4802D0094A
:10014000C6062702C606E70500C097CF4802C83793
:100150000400000C0C00006021C0C0373E0023C921
:10016000C057B4051BC8C0173F00C067C0FF3000B0
:100170000800F007000004000002C0174C00300027
:100180000600F007A0010A004802C1070200D709D3
:1001900000C0C1DF51AFE70500C097CF9FAF080394
:1001A0009FAF7A0297CF9FAF7A02C9370400C1DFB1
:1001B000C809A20650026702A206D107000027D88C
:1001C000AA06C0DF9FAFC40197CFE7570000D20651
:1001D00097C1E7570100A80697C0C809A0060862A2
:1001E00097C00002C0170E0027003401270C0C0036
:1001F0003601E70750C312C0E707CC0B0200E70740
:100200000100A806E707050090C097CFC809A4061B
:10021000086202C0106407C1E70700009E06E707F6
:100220007204240097CF2704A406C8170E002702E3
:100230009E06E7078004240097CFD70900C0C1DFDE
:10024000E7570000900613C19FAF0602E757000072
:100250009E0613C0E7099E063001E707F20532014A
:10026000E707100096C0E7099E06900604CFE757FF
:1002700000009E0602C19FAF0602E70500C097CFAF
:10028000D70900C0C1DF0892E7570200AA0602C3DF
:10029000C809A4062702A606086203C1E70500C034
:1002A00097CF2704A406E70500C0F0074000080028
:1002B000F007000004000002C0170C003000060028
:1002C000F00746010A00C8170400C107020051AF39
:1002D00097CFE7570000960697C0C1DFC80996067A
:1002E000270496062752980603C1E7079606980644
:1002F000C0DF1702C8170E009FAFBA03C805006021
:1003000003C09FAF240397CF9FAF080397CF570237
:10031000C907A406D70900C0C1DF08621BC050048A
:100320001102E70500C0C90597CF9702CA09D60692
:10033000F21701000400F22700000600CA172C0083
:10034000F87701000E0006C0CAD9F857FF000E006A
:1003500001C1CAD9221C0C00E2270000E2170100EB
:10036000E2270000CA05000C0C00C0174100C0675E
:10037000C0FF300008000002C0170C00300006006B
:10038000F007DA000A00F00700000400000C080083
:1003900040D10100C019CE06C059C20604C949AFF8
:1003A0009FAFEC004AAF6710CE06C8170400C10724
:1003B0000100D70900C0C1DF50AFE70500C097CFEB
:1003C000C0070100C109AC06C177010097C1D87709
:1003D000010012C0C9076A069FAF080404C1C177B3
:1003E000080013C097CFC177020097C1C1771000F2
:1003F0000CC09FAF2C0497CFC177040006C0C9077B
:1004000070069FAF080497C000CF009097CF50545C
:1004100097C1705C0200020097C1705C0400040088
:1004200097CF8001C0006000300018000C0006006B
:100430000000CB09B206CC09B4060B5311C0C902A7
:10044000CA071C049FAF080497C00AC882080ACFD5
:1004500082089FAF080497C005C28930826078C1C6
:10046000009097CF8910095379C2893082087ACFDA
:10047000C0DF97CFC0DF97CFE70996C09206E709A4
:1004800098C094060FCFE70996C09206E70998C076
:100490009406E7099E063001E707F2053201E707F7
:1004A000100096C0D70900C01702C8099006C837C7
:1004B0000E00E7772A00920630C09702CA09D606D6
:1004C000E777200092060EC0F21701001000F22715
:1004D00000001200E7770A009206CA051EC09702C4
:1004E000CA09D606F21701000C00F22700000E0020
:1004F000E7770200920607C0F21701004400F227D6
:100500000000460006CFF21701006000F22700004D
:100510006200CA059FAF08030FCF57020902F10915
:1005200094060C00F1DA0C00C80998065002670224
:100530009806D1070000C905E7099E069006E7570F
:100540000000900602C09FAF0602C805E70500C084
:10055000C0DF97CFD70900C0170017029702C00964
:1005600092C0E707040090C0CA09D606E70700005A
:10057000A806E7076A040200C077020008C0F21765
:1005800001005000F227000052009FCF2406C077E0
:10059000100006C0F21701005800F22700005A00B0
:1005A000C077800006C0F21701007000F22700003B
:1005B0007200C07708001DC1F21701000800F22781
:1005C00000000A00C077000206C0F21701006400B4
:1005D000F22700006600C077400006C0F217010055
:1005E0005C00F22700005E00C077010001C01BCF55
:1005F0001ACFF21701000000F22700000200C8091C
:100600003401CA171400D877010005C0CAD9D857D9
:10061000FF0001C0CAD9E21994C0E2270000E21726
:100620000100E22700009FAF40069FAFC401E757DB
:100630000000D2069FA10E0ACA05C805C005E7053D
:1006400000C0C0DF97CFC809A006086297C0270482
:10065000A0062752A20603C1E707A006A2069FAF85
:100660000803E7570000AA0602C027DAAA0697CFB8
:10067000FFFFFFFFFFFF0000000000000000000080
:10068000000000000000000000000000000000006A
:10069000000000000000000000000000000000005A
:1006A000000000000000000000000000000000004A
:1006B000000000000000000000000000000000003A
:1006C00000000000000000003F00000000000000EB
:1006D000000000000000FFFF01000000000000001B
:1006E000FFFFFB13E7570080B20006C2E707EE0BDF
:1006F0001200E707340CB200E707C607F202C80988
:10070000B400F80702000D00D7090EC0E70700008B
:100710000EC0C809DE00C8170900C907DA06C007FD
:100720000400680A00DA7DC1E709C0007C06E70919
:10073000BE007806E7091000BC06C807D6079FAFC1
:10074000AE079FAF000AC809DE00000E0F004190FF
:100750009FDE060044AF2700B2062700B40627003C
:10076000B606C007740044AF2700D6060800009004
:10077000C1073A00200001DA7DC19FAFBA09C00766
:10078000440048AF27007A069FAF960AE7070100AA
:10079000C006E7050EC097CF49AFE78743000EC0FC
:1007A000E707FFFFBE069FAFAE0AC007010060AFBC
:1007B0004AAF97CF00080908110800DA7CC197CF2B
:1007C0006704CC02C0DF5194B1AF0600C1DFC90994
:1007D000CC02496275C1C0DFA7CFD6020E0024004B
:1007E000800422004E05D0000E0AAA003008BE0088
:1007F0004A0A1000200004006E0402006A04060089
:10080000000024C0040428C0FEFB1EC0000422C057
:10081000FFF4C000900900000000FFFF56086008C8
:10082000D008DA0800090409080932094209500908
:1008300052095A095A092702CA0697CFE70700004A
:10084000CA060A0E0100CA570E009FC35A09CA37CA
:1008500000009FC25A090AD2B2CF1608C809DE00AA
:1008600007069FCF6C091702C809DE00000E0F00B3
:1008700041909FDE0600C805305006009FC85A0907
:10088000270C0200B006C009B2062700B406E7072D
:100890000000AE0627008006001C06002700B606F2
:1008A00041906750B0060DC067007E06270C060019
:1008B0008206E707BC088406C8077E06419051AF50
:1008C00097CF9FAF480CE709B606B406E709B00614
:1008D000AE0659AF97CF270C0200AC0659AF97CFA1
:1008E000090C020009DA49D2C919D606C8077E06E2
:1008F000E00700006002E0070400D007CC0848DBF6
:10090000419050AF97CF59AF97CF59AF97CFF0578E
:100910000600060025C1E7077006800641906700C3
:100920007E06270C06008206E7078C098406C807A6
:100930007E06419051AF97CF070C0600C7570600BF
:100940000FC1C807700615CF000C020000DA40D1B5
:100950002700C2061ECF1DCF270C0200CC0619CFE0
:1009600027022001E70708002201E7071300B0C0B3
:1009700097CF419067007E06E70182062702800636
:10098000E7078C098406C8077E06C107008050AFC0
:1009900097CF59AF97CF006005C0E7070000C406A6
:1009A000A7CF7C069FAF000AE7070100C40649AF46
:1009B000D70900C007AFE70500C04AAFA7CF7C0644
:1009C000C007FE7F44AF4000C03700014190C037F0
:1009D0000800DFDE5006C057100002C2C00710003A
:1009E00027009A0641909FDE400644AF27009C06F0
:1009F000C0099A06419000D200D89FDE080044AF9B
:100A00002700C80697CFE787008428C0E767FFFB69
:100A100024C097CFE7870100D206E7570000A80659
:100A200097C19FAF000AE787000622C0E7070000D2
:100A300090C0E767FEFF3EC0E70726000AC0E787D1
:100A400001003EC0E707FFFFBE069FAF100B97CF28
:100A50001700A7AF7806C00527007606E7870100D4
:100A6000D2069FAF000AE7070C0040C09FAF100BF3
:100A700000902700A6062700AA06E709B206B406DA
:100A80002700AE062700AC069FAFAE0AC0070000E5
:100A90002700B2022700B40227008E06C007060016
:100AA000C809DE00C8170300C9077006290A00DA62
:100AB0007DC197CFD70900C0C1DF009027009606FF
:100AC000E707960698062700A006E707A006A206F5
:100AD0002700A6062700900627009E06C8099C0648
:100AE000C1099A06C907A40611020902C8174006DF
:100AF00001DA7AC15194C809C806C907C606C109F6
:100B00009A0611020902C817080001DA7AC1519445
:100B1000E70500C097CFE7570000760697C09FAF64
:100B20000400E709BE06BA06E757FFFFBA0604C18C
:100B3000E707100BB80697CFE7173200BA06E7674A
:100B4000FF07BA06E707460BB80697CFE75700003E
:100B5000C00623C0E707040090C0E707008080C0FC
:100B6000E707000080C0E707008080C0C0070000E2
:100B7000C0070000C0070000E707000080C0E707CB
:100B8000008080C0E707008040C0C0070000E70782
:100B9000000040C0E707000080C0E707040090C0E5
:100BA000E707000240C0E7070C0240C0E70700006B
:100BB000C006E7070000B806E7070000D206D7091D
:100BC00000C0C1DF9FAF3402E70500C09FAFC40182
:100BD00097CFD70900C0170017029702E757000008
:100BE000A80606C0C00992C0C07709029FC15C0573
:100BF0009FCF3206D7090EC0E70700000EC09FAF97
:100C0000020CE7050EC097CFD70900C01702C8092C
:100C1000B0C0E767FE7FB0C0C87700209FC164EB1B
:100C2000E7570000C8029FC180EBC899CA02C86795
:100C300004009FC196EB9FCF4CEBE7070000A6C0D6
:100C4000E709B0C0C802E7070300B0C097CFC009EA
:100C5000B006C037010097C9C909B2060200419029
:100C60004802C91706009FAF08049FA2720C02DA5F
:100C700077C1416071C197CF170257024304210425
:100C8000E00043042104E00043042104E000C10724
:100C90000100C905C80597CFE70701008E06C80700
:100CA0008606E70700008606E70710088806E707BC
:100CB00004008A06E707BC0C8C06C107038050AF0E
:0C0CC00097CFE70700008E0697CF0000DA
:00000001FF
:10000000B6C3AABBCCDD0200080028002C003400D7
:100010003C0040004800540058005E006400680046
:100020006E006C00720076007C00800086008A0002
:100030009000940098009E00A600AA00B000B400B2
:10004000B800C000C600CA00D000D400D800E0004C
:10005000DE00E800F000FC0004010A0118012201A2
:1000600028013A013E017E0198019C01A201AC01E8
:10007000B201BA01C001C801D001D601F401FC01EE
:10008000080216021A0222022A022E023E0244022C
:100090004A025002640262026C02720286028C0200
:1000A00090029E02BC02D002D802DC02E002E8020A
:1000B000E602F402FE0204030C0328037C0390030F
:1000C00094039C03A203C003D003D403EE03FA03FA
:1000D000FE032E0432043C0440044E0476047C04E7
:1000E00084048A048E04A604B004B804BE04D204B6
:1000F000DC04EE0410051A0524052A05360534052E
:100100003C05420564056A056E058605220626063D
:100110002C06300642064A064E06560654065A0675
:1001200060066606E806EE06F406160726072C07A4
:10013000320736073A073E07520756075A07640741
:1001400076077A07800784078A079E07A207DA07DF
:10015000DE07E207E607EA07EE07F207F6070E08F2
:10016000160818081A081C081E0820082208240867
:10017000260828082A082C082E0832083A084608BB
:100180004E0854085E0878087E08820886088C08A5
:10019000900898089E08A408AA08B008AE08B408F9
:1001A000BE08C408C208CA08C808D408E408E80899
:1001B000F608140912091A092009260924092A092E
:1001C0003E094C0956097009740978097E097C09B1
:1001D000820998099C09A009A609B809DC09E8095F
:1001E000EC09FC09120A180A1E0A420A460A4E0ABB
:1001F000540A5A0A5E0A680A6E0A720A780A760A6D
:100200007C0A800A840A940AA40AB80ABE0ABC0AB4
:10021000C20AC80AC60ACC0AD00AD40AD80ADC0A1A
:10022000E00AF20AF60AFA0A140B1A0B200B1E0B4C
:10023000260B2E0B2C0B360B3C0B420B400B4A0BA8
:10024000AA0BB00BB60BC00BC80BDA0BE80BEC0B10
:10025000FA0B4A0C540C620C660C960C9A0CA00C0F
:0E026000A60CA40CAC0CB20CB00CC00C000030
:00000001FF
:10000000B6C3AABBCCDDC807A000F0075E0006009F
:10001000F0070A000800F00900000200E7073600B8
:100020000000F00700000400E70750C310C0F0090B
:100030000EC00000E78701000EC097CFD70900C0AF
:100040001702C807A000E71750C310C030D804003B
:10005000305C08000400B0C00600C805E70500C019
:10006000C0DF97CF49AFC007000060AF4AAF000CB8
:100070000C0040D2001C0C0040D230000800F007F9
:1000800000000400F0078600060067CF270C02007E
:100090000000270C00000EC049AF64AFC00700008D
:1000A0004BAF4AAF5ACF0000000000000000000034
:0600B000940005000000B1
:00000001FF
:10000000B6C3AABBCCDD0200060018003E0080008B
:060010009800AA000000A8
:00000001FF
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册