aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x/bnx2x_main.c
diff options
context:
space:
mode:
authorDmitry Kravkov <dmitry@broadcom.com>2010-08-03 17:49:40 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-17 00:06:18 -0400
commit6891dd25d3f82e50979b27fde1980aa96320b975 (patch)
tree8e1b1b74726f6ff6590864c648caa846b6734ea0 /drivers/net/bnx2x/bnx2x_main.c
parenteca6fc7836af8eec9ba7e029b604690451bb44a0 (diff)
bnx2x: Load firmware in open() instead of probe()
Loading firmware when actually bringing eth device up. This also will allow driver to be insmoded when filesystem with firmware files is not available yet. Suggested by Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_main.c')
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index b4ec2b02a465..13309f1717b9 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -7254,7 +7254,7 @@ static void __devinit bnx2x_get_pcie_width_speed(struct bnx2x *bp,
7254 *speed = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT; 7254 *speed = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT;
7255} 7255}
7256 7256
7257static int __devinit bnx2x_check_firmware(struct bnx2x *bp) 7257static int bnx2x_check_firmware(struct bnx2x *bp)
7258{ 7258{
7259 const struct firmware *firmware = bp->firmware; 7259 const struct firmware *firmware = bp->firmware;
7260 struct bnx2x_fw_file_hdr *fw_hdr; 7260 struct bnx2x_fw_file_hdr *fw_hdr;
@@ -7365,7 +7365,7 @@ do { \
7365 (u8 *)bp->arr, len); \ 7365 (u8 *)bp->arr, len); \
7366} while (0) 7366} while (0)
7367 7367
7368static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev) 7368int bnx2x_init_firmware(struct bnx2x *bp)
7369{ 7369{
7370 const char *fw_file_name; 7370 const char *fw_file_name;
7371 struct bnx2x_fw_file_hdr *fw_hdr; 7371 struct bnx2x_fw_file_hdr *fw_hdr;
@@ -7376,21 +7376,21 @@ static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev)
7376 else if (CHIP_IS_E1H(bp)) 7376 else if (CHIP_IS_E1H(bp))
7377 fw_file_name = FW_FILE_NAME_E1H; 7377 fw_file_name = FW_FILE_NAME_E1H;
7378 else { 7378 else {
7379 dev_err(dev, "Unsupported chip revision\n"); 7379 BNX2X_ERR("Unsupported chip revision\n");
7380 return -EINVAL; 7380 return -EINVAL;
7381 } 7381 }
7382 7382
7383 dev_info(dev, "Loading %s\n", fw_file_name); 7383 BNX2X_DEV_INFO("Loading %s\n", fw_file_name);
7384 7384
7385 rc = request_firmware(&bp->firmware, fw_file_name, dev); 7385 rc = request_firmware(&bp->firmware, fw_file_name, &bp->pdev->dev);
7386 if (rc) { 7386 if (rc) {
7387 dev_err(dev, "Can't load firmware file %s\n", fw_file_name); 7387 BNX2X_ERR("Can't load firmware file %s\n", fw_file_name);
7388 goto request_firmware_exit; 7388 goto request_firmware_exit;
7389 } 7389 }
7390 7390
7391 rc = bnx2x_check_firmware(bp); 7391 rc = bnx2x_check_firmware(bp);
7392 if (rc) { 7392 if (rc) {
7393 dev_err(dev, "Corrupt firmware file %s\n", fw_file_name); 7393 BNX2X_ERR("Corrupt firmware file %s\n", fw_file_name);
7394 goto request_firmware_exit; 7394 goto request_firmware_exit;
7395 } 7395 }
7396 7396
@@ -7468,13 +7468,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
7468 if (rc) 7468 if (rc)
7469 goto init_one_exit; 7469 goto init_one_exit;
7470 7470
7471 /* Set init arrays */
7472 rc = bnx2x_init_firmware(bp, &pdev->dev);
7473 if (rc) {
7474 dev_err(&pdev->dev, "Error loading firmware\n");
7475 goto init_one_exit;
7476 }
7477
7478 rc = register_netdev(dev); 7471 rc = register_netdev(dev);
7479 if (rc) { 7472 if (rc) {
7480 dev_err(&pdev->dev, "Cannot register net device\n"); 7473 dev_err(&pdev->dev, "Cannot register net device\n");
@@ -7525,11 +7518,6 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev)
7525 /* Make sure RESET task is not scheduled before continuing */ 7518 /* Make sure RESET task is not scheduled before continuing */
7526 cancel_delayed_work_sync(&bp->reset_task); 7519 cancel_delayed_work_sync(&bp->reset_task);
7527 7520
7528 kfree(bp->init_ops_offsets);
7529 kfree(bp->init_ops);
7530 kfree(bp->init_data);
7531 release_firmware(bp->firmware);
7532
7533 if (bp->regview) 7521 if (bp->regview)
7534 iounmap(bp->regview); 7522 iounmap(bp->regview);
7535 7523