diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2009-02-27 02:20:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-27 02:20:56 -0500 |
commit | 06e1f9ffa023c030bc87491e75f625f5da4e7d97 (patch) | |
tree | 746620ec933463cc3becfdb8452aecb57b5c09a9 /drivers/net/tehuti.c | |
parent | 1318136fcda34d27ca8c322b6a0550200c3a8cec (diff) |
tehuti: Use request_firmware()
Firmware blob is little endian.
Compile-tested only.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tehuti.c')
-rw-r--r-- | drivers/net/tehuti.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index be9f38f8f0bf..7debd1e4e1f7 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -63,7 +63,6 @@ | |||
63 | */ | 63 | */ |
64 | 64 | ||
65 | #include "tehuti.h" | 65 | #include "tehuti.h" |
66 | #include "tehuti_fw.h" | ||
67 | 66 | ||
68 | static struct pci_device_id __devinitdata bdx_pci_tbl[] = { | 67 | static struct pci_device_id __devinitdata bdx_pci_tbl[] = { |
69 | {0x1FC9, 0x3009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 68 | {0x1FC9, 0x3009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
@@ -318,28 +317,41 @@ static int bdx_poll(struct napi_struct *napi, int budget) | |||
318 | 317 | ||
319 | static int bdx_fw_load(struct bdx_priv *priv) | 318 | static int bdx_fw_load(struct bdx_priv *priv) |
320 | { | 319 | { |
320 | const struct firmware *fw = NULL; | ||
321 | int master, i; | 321 | int master, i; |
322 | int rc; | ||
322 | 323 | ||
323 | ENTER; | 324 | ENTER; |
324 | master = READ_REG(priv, regINIT_SEMAPHORE); | 325 | master = READ_REG(priv, regINIT_SEMAPHORE); |
325 | if (!READ_REG(priv, regINIT_STATUS) && master) { | 326 | if (!READ_REG(priv, regINIT_STATUS) && master) { |
326 | bdx_tx_push_desc_safe(priv, s_firmLoad, sizeof(s_firmLoad)); | 327 | rc = request_firmware(&fw, "tehuti/firmware.bin", &priv->pdev->dev); |
328 | if (rc) | ||
329 | goto out; | ||
330 | bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size); | ||
327 | mdelay(100); | 331 | mdelay(100); |
328 | } | 332 | } |
329 | for (i = 0; i < 200; i++) { | 333 | for (i = 0; i < 200; i++) { |
330 | if (READ_REG(priv, regINIT_STATUS)) | 334 | if (READ_REG(priv, regINIT_STATUS)) { |
331 | break; | 335 | rc = 0; |
336 | goto out; | ||
337 | } | ||
332 | mdelay(2); | 338 | mdelay(2); |
333 | } | 339 | } |
340 | rc = -EIO; | ||
341 | out: | ||
334 | if (master) | 342 | if (master) |
335 | WRITE_REG(priv, regINIT_SEMAPHORE, 1); | 343 | WRITE_REG(priv, regINIT_SEMAPHORE, 1); |
344 | if (fw) | ||
345 | release_firmware(fw); | ||
336 | 346 | ||
337 | if (i == 200) { | 347 | if (rc) { |
338 | ERR("%s: firmware loading failed\n", priv->ndev->name); | 348 | ERR("%s: firmware loading failed\n", priv->ndev->name); |
339 | DBG("VPC = 0x%x VIC = 0x%x INIT_STATUS = 0x%x i=%d\n", | 349 | if (rc == -EIO) |
340 | READ_REG(priv, regVPC), | 350 | DBG("VPC = 0x%x VIC = 0x%x INIT_STATUS = 0x%x i=%d\n", |
341 | READ_REG(priv, regVIC), READ_REG(priv, regINIT_STATUS), i); | 351 | READ_REG(priv, regVPC), |
342 | RET(-EIO); | 352 | READ_REG(priv, regVIC), |
353 | READ_REG(priv, regINIT_STATUS), i); | ||
354 | RET(rc); | ||
343 | } else { | 355 | } else { |
344 | DBG("%s: firmware loading success\n", priv->ndev->name); | 356 | DBG("%s: firmware loading success\n", priv->ndev->name); |
345 | RET(0); | 357 | RET(0); |
@@ -617,13 +629,6 @@ err: | |||
617 | RET(rc); | 629 | RET(rc); |
618 | } | 630 | } |
619 | 631 | ||
620 | static void __init bdx_firmware_endianess(void) | ||
621 | { | ||
622 | int i; | ||
623 | for (i = 0; i < ARRAY_SIZE(s_firmLoad); i++) | ||
624 | s_firmLoad[i] = CPU_CHIP_SWAP32(s_firmLoad[i]); | ||
625 | } | ||
626 | |||
627 | static int bdx_range_check(struct bdx_priv *priv, u32 offset) | 632 | static int bdx_range_check(struct bdx_priv *priv, u32 offset) |
628 | { | 633 | { |
629 | return (offset > (u32) (BDX_REGS_SIZE / priv->nic->port_num)) ? | 634 | return (offset > (u32) (BDX_REGS_SIZE / priv->nic->port_num)) ? |
@@ -2501,7 +2506,6 @@ static void __init print_driver_id(void) | |||
2501 | static int __init bdx_module_init(void) | 2506 | static int __init bdx_module_init(void) |
2502 | { | 2507 | { |
2503 | ENTER; | 2508 | ENTER; |
2504 | bdx_firmware_endianess(); | ||
2505 | init_txd_sizes(); | 2509 | init_txd_sizes(); |
2506 | print_driver_id(); | 2510 | print_driver_id(); |
2507 | RET(pci_register_driver(&bdx_pci_driver)); | 2511 | RET(pci_register_driver(&bdx_pci_driver)); |
@@ -2521,3 +2525,4 @@ module_exit(bdx_module_exit); | |||
2521 | MODULE_LICENSE("GPL"); | 2525 | MODULE_LICENSE("GPL"); |
2522 | MODULE_AUTHOR(DRIVER_AUTHOR); | 2526 | MODULE_AUTHOR(DRIVER_AUTHOR); |
2523 | MODULE_DESCRIPTION(BDX_DRV_DESC); | 2527 | MODULE_DESCRIPTION(BDX_DRV_DESC); |
2528 | MODULE_FIRMWARE("tehuti/firmware.bin"); | ||