diff options
| author | Lennert Buytenhek <buytenh@wantstofly.org> | 2009-10-22 14:20:43 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2009-11-04 18:44:47 -0500 |
| commit | 5b9482dda6dda11dc7050ffa5b4ebfb0c775880f (patch) | |
| tree | bd9bbc20f0845e7789f8b49b11858b0f12aaaf8a | |
| parent | 45eb400d50e1ad84a8e8f9e9a82cd8ae13d7d691 (diff) | |
mwl8k: pci BAR mapping changes
Map BAR0 as well, as we need to write to it during init on some chips.
Also, if BAR0 is a 64bit BAR, the register BAR becomes BAR2, so try
mapping BAR2 if mapping BAR1 fails.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | drivers/net/wireless/mwl8k.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 80df2ebbd602..c0317e298c11 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
| @@ -124,6 +124,7 @@ struct mwl8k_firmware { | |||
| 124 | }; | 124 | }; |
| 125 | 125 | ||
| 126 | struct mwl8k_priv { | 126 | struct mwl8k_priv { |
| 127 | void __iomem *sram; | ||
| 127 | void __iomem *regs; | 128 | void __iomem *regs; |
| 128 | struct ieee80211_hw *hw; | 129 | struct ieee80211_hw *hw; |
| 129 | 130 | ||
| @@ -2987,13 +2988,27 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
| 2987 | SET_IEEE80211_DEV(hw, &pdev->dev); | 2988 | SET_IEEE80211_DEV(hw, &pdev->dev); |
| 2988 | pci_set_drvdata(pdev, hw); | 2989 | pci_set_drvdata(pdev, hw); |
| 2989 | 2990 | ||
| 2990 | priv->regs = pci_iomap(pdev, 1, 0x10000); | 2991 | priv->sram = pci_iomap(pdev, 0, 0x10000); |
| 2991 | if (priv->regs == NULL) { | 2992 | if (priv->sram == NULL) { |
| 2992 | printk(KERN_ERR "%s: Cannot map device memory\n", | 2993 | printk(KERN_ERR "%s: Cannot map device SRAM\n", |
| 2993 | wiphy_name(hw->wiphy)); | 2994 | wiphy_name(hw->wiphy)); |
| 2994 | goto err_iounmap; | 2995 | goto err_iounmap; |
| 2995 | } | 2996 | } |
| 2996 | 2997 | ||
| 2998 | /* | ||
| 2999 | * If BAR0 is a 32 bit BAR, the register BAR will be BAR1. | ||
| 3000 | * If BAR0 is a 64 bit BAR, the register BAR will be BAR2. | ||
| 3001 | */ | ||
| 3002 | priv->regs = pci_iomap(pdev, 1, 0x10000); | ||
| 3003 | if (priv->regs == NULL) { | ||
| 3004 | priv->regs = pci_iomap(pdev, 2, 0x10000); | ||
| 3005 | if (priv->regs == NULL) { | ||
| 3006 | printk(KERN_ERR "%s: Cannot map device registers\n", | ||
| 3007 | wiphy_name(hw->wiphy)); | ||
| 3008 | goto err_iounmap; | ||
| 3009 | } | ||
| 3010 | } | ||
| 3011 | |||
| 2997 | memcpy(priv->channels, mwl8k_channels, sizeof(mwl8k_channels)); | 3012 | memcpy(priv->channels, mwl8k_channels, sizeof(mwl8k_channels)); |
| 2998 | priv->band.band = IEEE80211_BAND_2GHZ; | 3013 | priv->band.band = IEEE80211_BAND_2GHZ; |
| 2999 | priv->band.channels = priv->channels; | 3014 | priv->band.channels = priv->channels; |
| @@ -3165,6 +3180,9 @@ err_iounmap: | |||
| 3165 | if (priv->regs != NULL) | 3180 | if (priv->regs != NULL) |
| 3166 | pci_iounmap(pdev, priv->regs); | 3181 | pci_iounmap(pdev, priv->regs); |
| 3167 | 3182 | ||
| 3183 | if (priv->sram != NULL) | ||
| 3184 | pci_iounmap(pdev, priv->sram); | ||
| 3185 | |||
| 3168 | pci_set_drvdata(pdev, NULL); | 3186 | pci_set_drvdata(pdev, NULL); |
| 3169 | ieee80211_free_hw(hw); | 3187 | ieee80211_free_hw(hw); |
| 3170 | 3188 | ||
| @@ -3212,6 +3230,7 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev) | |||
| 3212 | pci_free_consistent(priv->pdev, 4, priv->cookie, priv->cookie_dma); | 3230 | pci_free_consistent(priv->pdev, 4, priv->cookie, priv->cookie_dma); |
| 3213 | 3231 | ||
| 3214 | pci_iounmap(pdev, priv->regs); | 3232 | pci_iounmap(pdev, priv->regs); |
| 3233 | pci_iounmap(pdev, priv->sram); | ||
| 3215 | pci_set_drvdata(pdev, NULL); | 3234 | pci_set_drvdata(pdev, NULL); |
| 3216 | ieee80211_free_hw(hw); | 3235 | ieee80211_free_hw(hw); |
| 3217 | pci_release_regions(pdev); | 3236 | pci_release_regions(pdev); |
