~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/net/wireless/ath/ath9k/init.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2008-2009 Atheros Communications Inc.
 
2
 * Copyright (c) 2008-2011 Atheros Communications Inc.
3
3
 *
4
4
 * Permission to use, copy, modify, and/or distribute this software for any
5
5
 * purpose with or without fee is hereby granted, provided that the above
15
15
 */
16
16
 
17
17
#include <linux/slab.h>
 
18
#include <linux/ath9k_platform.h>
18
19
 
19
20
#include "ath9k.h"
20
21
 
195
196
        return val;
196
197
}
197
198
 
198
 
static const struct ath_ops ath9k_common_ops = {
199
 
        .read = ath9k_ioread32,
200
 
        .write = ath9k_iowrite32,
201
 
};
 
199
static unsigned int ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
 
200
{
 
201
        struct ath_hw *ah = (struct ath_hw *) hw_priv;
 
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
222
/*     Initialization     */
389
407
        int i = 0;
390
408
 
391
409
        /* Get the hardware key cache size. */
392
 
        common->keymax = sc->sc_ah->caps.keycache_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
 
        }
 
410
        common->keymax = AR_KEYTABLE_SIZE;
399
411
 
400
412
        /*
401
413
         * Reset the key cache since some parts do not
537
549
static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
538
550
                            const struct ath_bus_ops *bus_ops)
539
551
{
 
552
        struct ath9k_platform_data *pdata = sc->dev->platform_data;
540
553
        struct ath_hw *ah = NULL;
541
554
        struct ath_common *common;
542
555
        int ret = 0, i;
549
562
        ah->hw = sc->hw;
550
563
        ah->hw_version.devid = devid;
551
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
568
        sc->sc_ah = ah;
553
569
 
554
 
        if (!sc->dev->platform_data)
 
570
        if (!pdata) {
555
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
                ah->is_clk_25mhz = pdata->is_clk_25mhz;
 
578
        }
556
579
 
557
580
        common = ath9k_hw_common(ah);
558
 
        common->ops = &ath9k_common_ops;
 
581
        common->ops = &ah->reg_ops;
559
582
        common->bus_ops = bus_ops;
560
583
        common->ah = ah;
561
584
        common->hw = sc->hw;
587
610
        if (ret)
588
611
                goto err_hw;
589
612
 
 
613
        if (pdata && pdata->macaddr)
 
614
                memcpy(common->macaddr, pdata->macaddr, ETH_ALEN);
 
615
 
590
616
        ret = ath9k_init_queues(sc);
591
617
        if (ret)
592
618
                goto err_queues;
639
665
static void ath9k_init_txpower_limits(struct ath_softc *sc)
640
666
{
641
667
        struct ath_hw *ah = sc->sc_ah;
 
668
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
642
669
        struct ath9k_channel *curchan = ah->curchan;
643
670
 
 
671
        ah->txchainmask = common->tx_chainmask;
644
672
        if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
645
673
                ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ);
646
674
        if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
679
707
        if (AR_SREV_5416(sc->sc_ah))
680
708
                hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
681
709
 
 
710
        hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
 
711
 
682
712
        hw->queues = 4;
683
713
        hw->max_rates = 4;
684
714
        hw->channel_change_time = 5000;
773
803
 
774
804
        INIT_WORK(&sc->hw_check_work, ath_hw_check);
775
805
        INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
 
806
        INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work);
776
807
        sc->last_rssi = ATH_RSSI_DUMMY_MARKER;
777
808
 
778
809
        ath_init_leds(sc);