diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/ahb.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/ahb.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c index ba682a0b2dd8..9f69a4c9a3f3 100644 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ b/drivers/net/wireless/ath/ath5k/ahb.c | |||
@@ -35,8 +35,8 @@ static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz) | |||
35 | static bool | 35 | static bool |
36 | ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) | 36 | ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) |
37 | { | 37 | { |
38 | struct ath5k_softc *sc = common->priv; | 38 | struct ath5k_hw *ah = common->priv; |
39 | struct platform_device *pdev = to_platform_device(sc->dev); | 39 | struct platform_device *pdev = to_platform_device(ah->dev); |
40 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; | 40 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; |
41 | u16 *eeprom, *eeprom_end; | 41 | u16 *eeprom, *eeprom_end; |
42 | 42 | ||
@@ -56,8 +56,7 @@ ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) | |||
56 | 56 | ||
57 | int ath5k_hw_read_srev(struct ath5k_hw *ah) | 57 | int ath5k_hw_read_srev(struct ath5k_hw *ah) |
58 | { | 58 | { |
59 | struct ath5k_softc *sc = ah->ah_sc; | 59 | struct platform_device *pdev = to_platform_device(ah->dev); |
60 | struct platform_device *pdev = to_platform_device(sc->dev); | ||
61 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; | 60 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; |
62 | ah->ah_mac_srev = bcfg->devid; | 61 | ah->ah_mac_srev = bcfg->devid; |
63 | return 0; | 62 | return 0; |
@@ -65,12 +64,11 @@ int ath5k_hw_read_srev(struct ath5k_hw *ah) | |||
65 | 64 | ||
66 | static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) | 65 | static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) |
67 | { | 66 | { |
68 | struct ath5k_softc *sc = ah->ah_sc; | 67 | struct platform_device *pdev = to_platform_device(ah->dev); |
69 | struct platform_device *pdev = to_platform_device(sc->dev); | ||
70 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; | 68 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; |
71 | u8 *cfg_mac; | 69 | u8 *cfg_mac; |
72 | 70 | ||
73 | if (to_platform_device(sc->dev)->id == 0) | 71 | if (to_platform_device(ah->dev)->id == 0) |
74 | cfg_mac = bcfg->config->wlan0_mac; | 72 | cfg_mac = bcfg->config->wlan0_mac; |
75 | else | 73 | else |
76 | cfg_mac = bcfg->config->wlan1_mac; | 74 | cfg_mac = bcfg->config->wlan1_mac; |
@@ -90,7 +88,7 @@ static const struct ath_bus_ops ath_ahb_bus_ops = { | |||
90 | static int ath_ahb_probe(struct platform_device *pdev) | 88 | static int ath_ahb_probe(struct platform_device *pdev) |
91 | { | 89 | { |
92 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; | 90 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; |
93 | struct ath5k_softc *sc; | 91 | struct ath5k_hw *ah; |
94 | struct ieee80211_hw *hw; | 92 | struct ieee80211_hw *hw; |
95 | struct resource *res; | 93 | struct resource *res; |
96 | void __iomem *mem; | 94 | void __iomem *mem; |
@@ -127,19 +125,19 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
127 | 125 | ||
128 | irq = res->start; | 126 | irq = res->start; |
129 | 127 | ||
130 | hw = ieee80211_alloc_hw(sizeof(struct ath5k_softc), &ath5k_hw_ops); | 128 | hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops); |
131 | if (hw == NULL) { | 129 | if (hw == NULL) { |
132 | dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); | 130 | dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); |
133 | ret = -ENOMEM; | 131 | ret = -ENOMEM; |
134 | goto err_out; | 132 | goto err_out; |
135 | } | 133 | } |
136 | 134 | ||
137 | sc = hw->priv; | 135 | ah = hw->priv; |
138 | sc->hw = hw; | 136 | ah->hw = hw; |
139 | sc->dev = &pdev->dev; | 137 | ah->dev = &pdev->dev; |
140 | sc->iobase = mem; | 138 | ah->iobase = mem; |
141 | sc->irq = irq; | 139 | ah->irq = irq; |
142 | sc->devid = bcfg->devid; | 140 | ah->devid = bcfg->devid; |
143 | 141 | ||
144 | if (bcfg->devid >= AR5K_SREV_AR2315_R6) { | 142 | if (bcfg->devid >= AR5K_SREV_AR2315_R6) { |
145 | /* Enable WMAC AHB arbitration */ | 143 | /* Enable WMAC AHB arbitration */ |
@@ -155,7 +153,7 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
155 | /* Enable WMAC DMA access (assuming 5312 or 231x*/ | 153 | /* Enable WMAC DMA access (assuming 5312 or 231x*/ |
156 | /* TODO: check other platforms */ | 154 | /* TODO: check other platforms */ |
157 | reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); | 155 | reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); |
158 | if (to_platform_device(sc->dev)->id == 0) | 156 | if (to_platform_device(ah->dev)->id == 0) |
159 | reg |= AR5K_AR5312_ENABLE_WLAN0; | 157 | reg |= AR5K_AR5312_ENABLE_WLAN0; |
160 | else | 158 | else |
161 | reg |= AR5K_AR5312_ENABLE_WLAN1; | 159 | reg |= AR5K_AR5312_ENABLE_WLAN1; |
@@ -166,13 +164,13 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
166 | * used as pass-through. Disable 2 GHz support in the | 164 | * used as pass-through. Disable 2 GHz support in the |
167 | * driver for it | 165 | * driver for it |
168 | */ | 166 | */ |
169 | if (to_platform_device(sc->dev)->id == 0 && | 167 | if (to_platform_device(ah->dev)->id == 0 && |
170 | (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) == | 168 | (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) == |
171 | (BD_WLAN1 | BD_WLAN0)) | 169 | (BD_WLAN1 | BD_WLAN0)) |
172 | __set_bit(ATH_STAT_2G_DISABLED, sc->status); | 170 | __set_bit(ATH_STAT_2G_DISABLED, ah->status); |
173 | } | 171 | } |
174 | 172 | ||
175 | ret = ath5k_init_softc(sc, &ath_ahb_bus_ops); | 173 | ret = ath5k_init_softc(ah, &ath_ahb_bus_ops); |
176 | if (ret != 0) { | 174 | if (ret != 0) { |
177 | dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret); | 175 | dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret); |
178 | ret = -ENODEV; | 176 | ret = -ENODEV; |
@@ -194,13 +192,13 @@ static int ath_ahb_remove(struct platform_device *pdev) | |||
194 | { | 192 | { |
195 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; | 193 | struct ar231x_board_config *bcfg = pdev->dev.platform_data; |
196 | struct ieee80211_hw *hw = platform_get_drvdata(pdev); | 194 | struct ieee80211_hw *hw = platform_get_drvdata(pdev); |
197 | struct ath5k_softc *sc; | 195 | struct ath5k_hw *ah; |
198 | u32 reg; | 196 | u32 reg; |
199 | 197 | ||
200 | if (!hw) | 198 | if (!hw) |
201 | return 0; | 199 | return 0; |
202 | 200 | ||
203 | sc = hw->priv; | 201 | ah = hw->priv; |
204 | 202 | ||
205 | if (bcfg->devid >= AR5K_SREV_AR2315_R6) { | 203 | if (bcfg->devid >= AR5K_SREV_AR2315_R6) { |
206 | /* Disable WMAC AHB arbitration */ | 204 | /* Disable WMAC AHB arbitration */ |
@@ -210,14 +208,14 @@ static int ath_ahb_remove(struct platform_device *pdev) | |||
210 | } else { | 208 | } else { |
211 | /*Stop DMA access */ | 209 | /*Stop DMA access */ |
212 | reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); | 210 | reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); |
213 | if (to_platform_device(sc->dev)->id == 0) | 211 | if (to_platform_device(ah->dev)->id == 0) |
214 | reg &= ~AR5K_AR5312_ENABLE_WLAN0; | 212 | reg &= ~AR5K_AR5312_ENABLE_WLAN0; |
215 | else | 213 | else |
216 | reg &= ~AR5K_AR5312_ENABLE_WLAN1; | 214 | reg &= ~AR5K_AR5312_ENABLE_WLAN1; |
217 | __raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE); | 215 | __raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE); |
218 | } | 216 | } |
219 | 217 | ||
220 | ath5k_deinit_softc(sc); | 218 | ath5k_deinit_softc(ah); |
221 | platform_set_drvdata(pdev, NULL); | 219 | platform_set_drvdata(pdev, NULL); |
222 | ieee80211_free_hw(hw); | 220 | ieee80211_free_hw(hw); |
223 | 221 | ||