aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tehuti.c
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2009-02-27 02:20:56 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-27 02:20:56 -0500
commit06e1f9ffa023c030bc87491e75f625f5da4e7d97 (patch)
tree746620ec933463cc3becfdb8452aecb57b5c09a9 /drivers/net/tehuti.c
parent1318136fcda34d27ca8c322b6a0550200c3a8cec (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.c39
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
68static struct pci_device_id __devinitdata bdx_pci_tbl[] = { 67static 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
319static int bdx_fw_load(struct bdx_priv *priv) 318static 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;
341out:
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
620static 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
627static int bdx_range_check(struct bdx_priv *priv, u32 offset) 632static 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)
2501static int __init bdx_module_init(void) 2506static 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);
2521MODULE_LICENSE("GPL"); 2525MODULE_LICENSE("GPL");
2522MODULE_AUTHOR(DRIVER_AUTHOR); 2526MODULE_AUTHOR(DRIVER_AUTHOR);
2523MODULE_DESCRIPTION(BDX_DRV_DESC); 2527MODULE_DESCRIPTION(BDX_DRV_DESC);
2528MODULE_FIRMWARE("tehuti/firmware.bin");