diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/init.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 79aec983279..1ac8318d82a 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/ath9k_platform.h> | ||
18 | 19 | ||
19 | #include "ath9k.h" | 20 | #include "ath9k.h" |
20 | 21 | ||
@@ -195,10 +196,27 @@ static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset) | |||
195 | return val; | 196 | return val; |
196 | } | 197 | } |
197 | 198 | ||
198 | static const struct ath_ops ath9k_common_ops = { | 199 | static unsigned int ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr) |
199 | .read = ath9k_ioread32, | 200 | { |
200 | .write = ath9k_iowrite32, | 201 | struct ath_hw *ah = (struct ath_hw *) hw_priv; |
201 | }; | 202 | struct ath_common *common = ath9k_hw_common(ah); |
203 | struct ath_softc *sc = (struct ath_softc *) common->priv; | ||
204 | unsigned long uninitialized_var(flags); | ||
205 | u32 val; | ||
206 | |||
207 | if (ah->config.serialize_regmode == SER_REG_MODE_ON) | ||
208 | spin_lock_irqsave(&sc->sc_serial_rw, flags); | ||
209 | |||
210 | val = ioread32(sc->mem + reg_offset); | ||
211 | val &= ~clr; | ||
212 | val |= set; | ||
213 | iowrite32(val, sc->mem + reg_offset); | ||
214 | |||
215 | if (ah->config.serialize_regmode == SER_REG_MODE_ON) | ||
216 | spin_unlock_irqrestore(&sc->sc_serial_rw, flags); | ||
217 | |||
218 | return val; | ||
219 | } | ||
202 | 220 | ||
203 | /**************************/ | 221 | /**************************/ |
204 | /* Initialization */ | 222 | /* Initialization */ |
@@ -389,13 +407,7 @@ void ath9k_init_crypto(struct ath_softc *sc) | |||
389 | int i = 0; | 407 | int i = 0; |
390 | 408 | ||
391 | /* Get the hardware key cache size. */ | 409 | /* Get the hardware key cache size. */ |
392 | common->keymax = sc->sc_ah->caps.keycache_size; | 410 | common->keymax = AR_KEYTABLE_SIZE; |
393 | if (common->keymax > ATH_KEYMAX) { | ||
394 | ath_dbg(common, ATH_DBG_ANY, | ||
395 | "Warning, using only %u entries in %u key cache\n", | ||
396 | ATH_KEYMAX, common->keymax); | ||
397 | common->keymax = ATH_KEYMAX; | ||
398 | } | ||
399 | 411 | ||
400 | /* | 412 | /* |
401 | * Reset the key cache since some parts do not | 413 | * Reset the key cache since some parts do not |
@@ -537,6 +549,7 @@ static void ath9k_init_misc(struct ath_softc *sc) | |||
537 | static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | 549 | static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, |
538 | const struct ath_bus_ops *bus_ops) | 550 | const struct ath_bus_ops *bus_ops) |
539 | { | 551 | { |
552 | struct ath9k_platform_data *pdata = sc->dev->platform_data; | ||
540 | struct ath_hw *ah = NULL; | 553 | struct ath_hw *ah = NULL; |
541 | struct ath_common *common; | 554 | struct ath_common *common; |
542 | int ret = 0, i; | 555 | int ret = 0, i; |
@@ -549,13 +562,22 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
549 | ah->hw = sc->hw; | 562 | ah->hw = sc->hw; |
550 | ah->hw_version.devid = devid; | 563 | ah->hw_version.devid = devid; |
551 | ah->hw_version.subsysid = subsysid; | 564 | ah->hw_version.subsysid = subsysid; |
565 | ah->reg_ops.read = ath9k_ioread32; | ||
566 | ah->reg_ops.write = ath9k_iowrite32; | ||
567 | ah->reg_ops.rmw = ath9k_reg_rmw; | ||
552 | sc->sc_ah = ah; | 568 | sc->sc_ah = ah; |
553 | 569 | ||
554 | if (!sc->dev->platform_data) | 570 | if (!pdata) { |
555 | ah->ah_flags |= AH_USE_EEPROM; | 571 | ah->ah_flags |= AH_USE_EEPROM; |
572 | sc->sc_ah->led_pin = -1; | ||
573 | } else { | ||
574 | sc->sc_ah->gpio_mask = pdata->gpio_mask; | ||
575 | sc->sc_ah->gpio_val = pdata->gpio_val; | ||
576 | sc->sc_ah->led_pin = pdata->led_pin; | ||
577 | } | ||
556 | 578 | ||
557 | common = ath9k_hw_common(ah); | 579 | common = ath9k_hw_common(ah); |
558 | common->ops = &ath9k_common_ops; | 580 | common->ops = &ah->reg_ops; |
559 | common->bus_ops = bus_ops; | 581 | common->bus_ops = bus_ops; |
560 | common->ah = ah; | 582 | common->ah = ah; |
561 | common->hw = sc->hw; | 583 | common->hw = sc->hw; |
@@ -587,6 +609,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
587 | if (ret) | 609 | if (ret) |
588 | goto err_hw; | 610 | goto err_hw; |
589 | 611 | ||
612 | if (pdata && pdata->macaddr) | ||
613 | memcpy(common->macaddr, pdata->macaddr, ETH_ALEN); | ||
614 | |||
590 | ret = ath9k_init_queues(sc); | 615 | ret = ath9k_init_queues(sc); |
591 | if (ret) | 616 | if (ret) |
592 | goto err_queues; | 617 | goto err_queues; |
@@ -679,6 +704,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
679 | if (AR_SREV_5416(sc->sc_ah)) | 704 | if (AR_SREV_5416(sc->sc_ah)) |
680 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 705 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
681 | 706 | ||
707 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | ||
708 | |||
682 | hw->queues = 4; | 709 | hw->queues = 4; |
683 | hw->max_rates = 4; | 710 | hw->max_rates = 4; |
684 | hw->channel_change_time = 5000; | 711 | hw->channel_change_time = 5000; |