aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54/p54pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/p54/p54pci.c')
-rw-r--r--drivers/net/wireless/p54/p54pci.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index c4a868ae6d6b..d21c509325fe 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -47,7 +47,6 @@ MODULE_DEVICE_TABLE(pci, p54p_table);
47static int p54p_upload_firmware(struct ieee80211_hw *dev) 47static int p54p_upload_firmware(struct ieee80211_hw *dev)
48{ 48{
49 struct p54p_priv *priv = dev->priv; 49 struct p54p_priv *priv = dev->priv;
50 const struct firmware *fw_entry = NULL;
51 __le32 reg; 50 __le32 reg;
52 int err; 51 int err;
53 __le32 *data; 52 __le32 *data;
@@ -73,23 +72,15 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev)
73 P54P_WRITE(ctrl_stat, reg); 72 P54P_WRITE(ctrl_stat, reg);
74 wmb(); 73 wmb();
75 74
76 err = request_firmware(&fw_entry, "isl3886pci", &priv->pdev->dev); 75 /* wait for the firmware to reset properly */
77 if (err) { 76 mdelay(10);
78 printk(KERN_ERR "%s (p54pci): cannot find firmware "
79 "(isl3886pci)\n", pci_name(priv->pdev));
80 err = request_firmware(&fw_entry, "isl3886", &priv->pdev->dev);
81 if (err)
82 return err;
83 }
84 77
85 err = p54_parse_firmware(dev, fw_entry); 78 err = p54_parse_firmware(dev, priv->firmware);
86 if (err) { 79 if (err)
87 release_firmware(fw_entry);
88 return err; 80 return err;
89 }
90 81
91 data = (__le32 *) fw_entry->data; 82 data = (__le32 *) priv->firmware->data;
92 remains = fw_entry->size; 83 remains = priv->firmware->size;
93 device_addr = ISL38XX_DEV_FIRMWARE_ADDR; 84 device_addr = ISL38XX_DEV_FIRMWARE_ADDR;
94 while (remains) { 85 while (remains) {
95 u32 i = 0; 86 u32 i = 0;
@@ -107,8 +98,6 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev)
107 P54P_READ(int_enable); 98 P54P_READ(int_enable);
108 } 99 }
109 100
110 release_firmware(fw_entry);
111
112 reg = P54P_READ(ctrl_stat); 101 reg = P54P_READ(ctrl_stat);
113 reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_CLKRUN); 102 reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_CLKRUN);
114 reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET); 103 reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET);
@@ -500,15 +489,14 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
500 if (mem_len < sizeof(struct p54p_csr)) { 489 if (mem_len < sizeof(struct p54p_csr)) {
501 printk(KERN_ERR "%s (p54pci): Too short PCI resources\n", 490 printk(KERN_ERR "%s (p54pci): Too short PCI resources\n",
502 pci_name(pdev)); 491 pci_name(pdev));
503 pci_disable_device(pdev); 492 goto err_disable_dev;
504 return err;
505 } 493 }
506 494
507 err = pci_request_regions(pdev, "p54pci"); 495 err = pci_request_regions(pdev, "p54pci");
508 if (err) { 496 if (err) {
509 printk(KERN_ERR "%s (p54pci): Cannot obtain PCI resources\n", 497 printk(KERN_ERR "%s (p54pci): Cannot obtain PCI resources\n",
510 pci_name(pdev)); 498 pci_name(pdev));
511 return err; 499 goto err_disable_dev;
512 } 500 }
513 501
514 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || 502 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) ||
@@ -561,6 +549,17 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
561 spin_lock_init(&priv->lock); 549 spin_lock_init(&priv->lock);
562 tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev); 550 tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev);
563 551
552 err = request_firmware(&priv->firmware, "isl3886pci",
553 &priv->pdev->dev);
554 if (err) {
555 printk(KERN_ERR "%s (p54pci): cannot find firmware "
556 "(isl3886pci)\n", pci_name(priv->pdev));
557 err = request_firmware(&priv->firmware, "isl3886",
558 &priv->pdev->dev);
559 if (err)
560 goto err_free_common;
561 }
562
564 err = p54p_open(dev); 563 err = p54p_open(dev);
565 if (err) 564 if (err)
566 goto err_free_common; 565 goto err_free_common;
@@ -579,6 +578,7 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
579 return 0; 578 return 0;
580 579
581 err_free_common: 580 err_free_common:
581 release_firmware(priv->firmware);
582 p54_free_common(dev); 582 p54_free_common(dev);
583 pci_free_consistent(pdev, sizeof(*priv->ring_control), 583 pci_free_consistent(pdev, sizeof(*priv->ring_control),
584 priv->ring_control, priv->ring_control_dma); 584 priv->ring_control, priv->ring_control_dma);
@@ -592,6 +592,7 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
592 592
593 err_free_reg: 593 err_free_reg:
594 pci_release_regions(pdev); 594 pci_release_regions(pdev);
595 err_disable_dev:
595 pci_disable_device(pdev); 596 pci_disable_device(pdev);
596 return err; 597 return err;
597} 598}
@@ -606,6 +607,7 @@ static void __devexit p54p_remove(struct pci_dev *pdev)
606 607
607 ieee80211_unregister_hw(dev); 608 ieee80211_unregister_hw(dev);
608 priv = dev->priv; 609 priv = dev->priv;
610 release_firmware(priv->firmware);
609 pci_free_consistent(pdev, sizeof(*priv->ring_control), 611 pci_free_consistent(pdev, sizeof(*priv->ring_control),
610 priv->ring_control, priv->ring_control_dma); 612 priv->ring_control, priv->ring_control_dma);
611 p54_free_common(dev); 613 p54_free_common(dev);