Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
authorJohn W. Linville <linville@tuxdriver.com>
Wed, 5 Jan 2011 21:06:25 +0000 (16:06 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 5 Jan 2011 21:06:25 +0000 (16:06 -0500)
Conflicts:
net/bluetooth/Makefile

119 files changed:
MAINTAINERS
drivers/net/wireless/airo.c
drivers/net/wireless/ath/ath5k/Makefile
drivers/net/wireless/ath/ath5k/ath5k.h
drivers/net/wireless/ath/ath5k/attach.c
drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath5k/eeprom.c
drivers/net/wireless/ath/ath5k/eeprom.h
drivers/net/wireless/ath/ath5k/mac80211-ops.c [new file with mode: 0644]
drivers/net/wireless/ath/ath5k/phy.c
drivers/net/wireless/ath/ath5k/reset.c
drivers/net/wireless/ath/ath9k/ar9002_hw.c
drivers/net/wireless/ath/ath9k/ar9002_phy.c
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
drivers/net/wireless/ath/ath9k/ar9003_mac.c
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/beacon.c
drivers/net/wireless/ath/ath9k/eeprom.h
drivers/net/wireless/ath/ath9k/hif_usb.c
drivers/net/wireless/ath/ath9k/hif_usb.h
drivers/net/wireless/ath/ath9k/htc.h
drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
drivers/net/wireless/ath/ath9k/htc_drv_init.c
drivers/net/wireless/ath/ath9k/htc_drv_main.c
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/hw.h
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/ath9k/mac.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/pci.c
drivers/net/wireless/ath/ath9k/rc.c
drivers/net/wireless/ath/ath9k/rc.h
drivers/net/wireless/ath/ath9k/recv.c
drivers/net/wireless/ath/ath9k/wmi.c
drivers/net/wireless/ath/ath9k/wmi.h
drivers/net/wireless/ath/carl9170/phy.c
drivers/net/wireless/ath/carl9170/usb.c
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/phy_n.c
drivers/net/wireless/b43/radio_2056.c
drivers/net/wireless/b43/radio_2056.h
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-helpers.h
drivers/net/wireless/iwlwifi/iwl-led.c
drivers/net/wireless/libertas/if_spi.c
drivers/net/wireless/rndis_wlan.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00config.c
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00ht.c
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt2x00pci.c
drivers/net/wireless/rtl818x/Makefile
drivers/net/wireless/rtl818x/rtl8180.h [deleted file]
drivers/net/wireless/rtl818x/rtl8180/Makefile [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/dev.c [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/grf5101.c [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/grf5101.h [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/max2820.c [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/max2820.h [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/rtl8180.h [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/rtl8225.c [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/rtl8225.h [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/sa2400.c [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180/sa2400.h [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8180_dev.c [deleted file]
drivers/net/wireless/rtl818x/rtl8180_grf5101.c [deleted file]
drivers/net/wireless/rtl818x/rtl8180_grf5101.h [deleted file]
drivers/net/wireless/rtl818x/rtl8180_max2820.c [deleted file]
drivers/net/wireless/rtl818x/rtl8180_max2820.h [deleted file]
drivers/net/wireless/rtl818x/rtl8180_rtl8225.c [deleted file]
drivers/net/wireless/rtl818x/rtl8180_rtl8225.h [deleted file]
drivers/net/wireless/rtl818x/rtl8180_sa2400.c [deleted file]
drivers/net/wireless/rtl818x/rtl8180_sa2400.h [deleted file]
drivers/net/wireless/rtl818x/rtl8187.h [deleted file]
drivers/net/wireless/rtl818x/rtl8187/Makefile [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8187/dev.c [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8187/leds.c [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8187/leds.h [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8187/rfkill.c [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8187/rfkill.h [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8187/rtl8187.h [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8187/rtl8225.c [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8187/rtl8225.h [new file with mode: 0644]
drivers/net/wireless/rtl818x/rtl8187_dev.c [deleted file]
drivers/net/wireless/rtl818x/rtl8187_leds.c [deleted file]
drivers/net/wireless/rtl818x/rtl8187_leds.h [deleted file]
drivers/net/wireless/rtl818x/rtl8187_rfkill.c [deleted file]
drivers/net/wireless/rtl818x/rtl8187_rfkill.h [deleted file]
drivers/net/wireless/rtl818x/rtl8187_rtl8225.c [deleted file]
drivers/net/wireless/rtl818x/rtl8187_rtl8225.h [deleted file]
drivers/net/wireless/rtlwifi/base.c
drivers/net/wireless/rtlwifi/pci.c
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
drivers/net/wireless/wl1251/boot.c
drivers/net/wireless/wl12xx/boot.c
drivers/ssb/scan.c
include/net/bluetooth/bluetooth.h
include/net/bluetooth/hci.h
include/net/bluetooth/hci_core.h
include/net/bluetooth/mgmt.h [new file with mode: 0644]
net/bluetooth/Makefile
net/bluetooth/hci_core.c
net/bluetooth/hci_event.c
net/bluetooth/hci_sock.c
net/bluetooth/l2cap.c
net/bluetooth/mgmt.c [new file with mode: 0644]
net/mac80211/ieee80211_i.h
net/mac80211/key.c
net/mac80211/main.c
net/mac80211/rx.c
net/mac80211/tx.c
net/mac80211/wme.c
net/wireless/reg.c

index aa835f7..2424699 100644 (file)
@@ -5053,7 +5053,7 @@ L:        linux-wireless@vger.kernel.org
 W:     http://linuxwireless.org/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
 S:     Maintained
-F:     drivers/net/wireless/rtl818x/rtl8180*
+F:     drivers/net/wireless/rtl818x/rtl8180/
 
 RTL8187 WIRELESS DRIVER
 M:     Herton Ronaldo Krzesinski <herton@mandriva.com.br>
@@ -5063,7 +5063,7 @@ L:        linux-wireless@vger.kernel.org
 W:     http://linuxwireless.org/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
 S:     Maintained
-F:     drivers/net/wireless/rtl818x/rtl8187*
+F:     drivers/net/wireless/rtl818x/rtl8187/
 
 RTL8192CE WIRELESS DRIVER
 M:     Larry Finger <Larry.Finger@lwfinger.net>
index a36e787..57a79b0 100644 (file)
@@ -4652,24 +4652,18 @@ static ssize_t proc_write( struct file *file,
                           size_t len,
                           loff_t *offset )
 {
-       loff_t pos = *offset;
+       ssize_t ret;
        struct proc_data *priv = file->private_data;
 
        if (!priv->wbuffer)
                return -EINVAL;
 
-       if (pos < 0)
-               return -EINVAL;
-       if (pos >= priv->maxwritelen)
-               return 0;
-       if (len > priv->maxwritelen - pos)
-               len = priv->maxwritelen - pos;
-       if (copy_from_user(priv->wbuffer + pos, buffer, len))
-               return -EFAULT;
-       if ( pos + len > priv->writelen )
-               priv->writelen = len + file->f_pos;
-       *offset = pos + len;
-       return len;
+       ret = simple_write_to_buffer(priv->wbuffer, priv->maxwritelen, offset,
+                                       buffer, len);
+       if (ret > 0)
+               priv->writelen = max_t(int, priv->writelen, *offset);
+
+       return ret;
 }
 
 static int proc_status_open(struct inode *inode, struct file *file)
index 67dd9fd..f60b389 100644 (file)
@@ -14,6 +14,7 @@ ath5k-y                               += led.o
 ath5k-y                                += rfkill.o
 ath5k-y                                += ani.o
 ath5k-y                                += sysfs.o
+ath5k-y                                += mac80211-ops.o
 ath5k-$(CONFIG_ATH5K_DEBUG)    += debug.o
 ath5k-$(CONFIG_ATH5K_AHB)      += ahb.o
 ath5k-$(CONFIG_ATH5K_PCI)      += pci.o
index d6e7440..407e39c 100644 (file)
                udelay(1);                                              \
 } while (0)
 
-/* Register dumps are done per operation mode */
-#define AR5K_INI_RFGAIN_5GHZ           0
-#define AR5K_INI_RFGAIN_2GHZ           1
-
 /*
  * Some tuneable values (these should be changeable by the user)
  * TODO: Make use of them and add more options OR use debug/configfs
@@ -1107,12 +1103,14 @@ struct ath5k_hw {
                /* Values in 0.25dB units */
                s16             txp_min_pwr;
                s16             txp_max_pwr;
+               s16             txp_cur_pwr;
                /* Values in 0.5dB units */
                s16             txp_offset;
                s16             txp_ofdm;
                s16             txp_cck_ofdm_gainf_delta;
                /* Value in dB units */
                s16             txp_cck_ofdm_pwr_delta;
+               bool            txp_setup;
        } ah_txpower;
 
        struct {
@@ -1320,7 +1318,7 @@ void ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode);
 int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower);
 /* Init function */
 int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
-                               u8 mode, u8 ee_mode, u8 freq, bool fast);
+                               u8 mode, bool fast);
 
 /*
  * Functions used internaly
index 9dbc1fa..cdac5cf 100644 (file)
@@ -276,7 +276,7 @@ int ath5k_hw_init(struct ath5k_softc *sc)
        /*
         * Write PCI-E power save settings
         */
-       if ((ah->ah_version == AR5K_AR5212) && pdev && (pdev->is_pcie)) {
+       if ((ah->ah_version == AR5K_AR5212) && pdev && (pci_is_pcie(pdev))) {
                ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES);
                ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES);
 
index e4ec40c..019a74d 100644 (file)
@@ -61,8 +61,8 @@
 #include "debug.h"
 #include "ani.h"
 
-static int modparam_nohwcrypt;
-module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
+int ath5k_modparam_nohwcrypt;
+module_param_named(nohwcrypt, ath5k_modparam_nohwcrypt, bool, S_IRUGO);
 MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
 
 static int modparam_all_channels;
@@ -79,9 +79,8 @@ MODULE_LICENSE("Dual BSD/GPL");
 static int ath5k_init(struct ieee80211_hw *hw);
 static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
                                                                bool skip_pcu);
-static int ath5k_beacon_update(struct ieee80211_hw *hw,
-               struct ieee80211_vif *vif);
-static void ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf);
+int ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
+void ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf);
 
 /* Known SREVs */
 static const struct ath5k_srev_name srev_names[] = {
@@ -177,38 +176,6 @@ static const struct ieee80211_rate ath5k_rates[] = {
        /* XR missing */
 };
 
-static inline void ath5k_txbuf_free_skb(struct ath5k_softc *sc,
-                               struct ath5k_buf *bf)
-{
-       BUG_ON(!bf);
-       if (!bf->skb)
-               return;
-       dma_unmap_single(sc->dev, bf->skbaddr, bf->skb->len,
-                       DMA_TO_DEVICE);
-       dev_kfree_skb_any(bf->skb);
-       bf->skb = NULL;
-       bf->skbaddr = 0;
-       bf->desc->ds_data = 0;
-}
-
-static inline void ath5k_rxbuf_free_skb(struct ath5k_softc *sc,
-                               struct ath5k_buf *bf)
-{
-       struct ath5k_hw *ah = sc->ah;
-       struct ath_common *common = ath5k_hw_common(ah);
-
-       BUG_ON(!bf);
-       if (!bf->skb)
-               return;
-       dma_unmap_single(sc->dev, bf->skbaddr, common->rx_bufsize,
-                       DMA_FROM_DEVICE);
-       dev_kfree_skb_any(bf->skb);
-       bf->skb = NULL;
-       bf->skbaddr = 0;
-       bf->desc->ds_data = 0;
-}
-
-
 static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp)
 {
        u64 tsf = ath5k_hw_get_tsf64(ah);
@@ -462,7 +429,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
  *
  * Called with sc->lock.
  */
-static int
+int
 ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
 {
        ATH5K_DBG(sc, ATH5K_DEBUG_RESET,
@@ -537,8 +504,9 @@ static void ath_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
                        iter_data->opmode = avf->opmode;
 }
 
-static void ath5k_update_bssid_mask_and_opmode(struct ath5k_softc *sc,
-                                              struct ieee80211_vif *vif)
+void
+ath5k_update_bssid_mask_and_opmode(struct ath5k_softc *sc,
+                                  struct ieee80211_vif *vif)
 {
        struct ath_common *common = ath5k_hw_common(sc->ah);
        struct ath_vif_iter_data iter_data;
@@ -577,7 +545,7 @@ static void ath5k_update_bssid_mask_and_opmode(struct ath5k_softc *sc,
                ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask);
 }
 
-static void
+void
 ath5k_mode_setup(struct ath5k_softc *sc, struct ieee80211_vif *vif)
 {
        struct ath5k_hw *ah = sc->ah;
@@ -887,6 +855,37 @@ err:
        return ret;
 }
 
+void
+ath5k_txbuf_free_skb(struct ath5k_softc *sc, struct ath5k_buf *bf)
+{
+       BUG_ON(!bf);
+       if (!bf->skb)
+               return;
+       dma_unmap_single(sc->dev, bf->skbaddr, bf->skb->len,
+                       DMA_TO_DEVICE);
+       dev_kfree_skb_any(bf->skb);
+       bf->skb = NULL;
+       bf->skbaddr = 0;
+       bf->desc->ds_data = 0;
+}
+
+void
+ath5k_rxbuf_free_skb(struct ath5k_softc *sc, struct ath5k_buf *bf)
+{
+       struct ath5k_hw *ah = sc->ah;
+       struct ath_common *common = ath5k_hw_common(ah);
+
+       BUG_ON(!bf);
+       if (!bf->skb)
+               return;
+       dma_unmap_single(sc->dev, bf->skbaddr, common->rx_bufsize,
+                       DMA_FROM_DEVICE);
+       dev_kfree_skb_any(bf->skb);
+       bf->skb = NULL;
+       bf->skbaddr = 0;
+       bf->desc->ds_data = 0;
+}
+
 static void
 ath5k_desc_free(struct ath5k_softc *sc)
 {
@@ -1534,8 +1533,9 @@ unlock:
 * TX Handling *
 \*************/
 
-static int ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
-                         struct ath5k_txq *txq)
+int
+ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
+              struct ath5k_txq *txq)
 {
        struct ath5k_softc *sc = hw->priv;
        struct ath5k_buf *bf;
@@ -1801,7 +1801,7 @@ err_unmap:
  *
  * Called with the beacon lock.
  */
-static int
+int
 ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 {
        int ret;
@@ -1947,7 +1947,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)
  * when we otherwise know we have to update the timers, but we keep it in this
  * function to have it all together in one place.
  */
-static void
+void
 ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf)
 {
        struct ath5k_hw *ah = sc->ah;
@@ -2049,7 +2049,7 @@ ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf)
  * In IBSS mode we use a self-linked tx descriptor if possible. We enable SWBA
  * interrupts to detect TSF updates only.
  */
-static void
+void
 ath5k_beacon_config(struct ath5k_softc *sc)
 {
        struct ath5k_hw *ah = sc->ah;
@@ -2525,7 +2525,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
        return 0;
 }
 
-static int
+int
 ath5k_init_hw(struct ath5k_softc *sc)
 {
        struct ath5k_hw *ah = sc->ah;
@@ -2601,7 +2601,7 @@ static void stop_tasklets(struct ath5k_softc *sc)
  * if another thread does a system call and the thread doing the
  * stop is preempted).
  */
-static int
+int
 ath5k_stop_hw(struct ath5k_softc *sc)
 {
        int ret;
@@ -2703,11 +2703,11 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
 
        /* clear survey data and cycle counters */
        memset(&sc->survey, 0, sizeof(sc->survey));
-       spin_lock(&common->cc_lock);
+       spin_lock_bh(&common->cc_lock);
        ath_hw_cycle_counters_update(common);
        memset(&common->cc_survey, 0, sizeof(common->cc_survey));
        memset(&common->cc_ani, 0, sizeof(common->cc_ani));
-       spin_unlock(&common->cc_lock);
+       spin_unlock_bh(&common->cc_lock);
 
        /*
         * Change channels and update the h/w rate map if we're switching;
@@ -2939,230 +2939,8 @@ ath5k_deinit_softc(struct ath5k_softc *sc)
        free_irq(sc->irq, sc);
 }
 
-/********************\
-* Mac80211 functions *
-\********************/
-
-static int
-ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
-{
-       struct ath5k_softc *sc = hw->priv;
-       u16 qnum = skb_get_queue_mapping(skb);
-
-       if (WARN_ON(qnum >= sc->ah->ah_capabilities.cap_queues.q_tx_num)) {
-               dev_kfree_skb_any(skb);
-               return 0;
-       }
-
-       return ath5k_tx_queue(hw, skb, &sc->txqs[qnum]);
-}
-
-static int ath5k_start(struct ieee80211_hw *hw)
-{
-       return ath5k_init_hw(hw->priv);
-}
-
-static void ath5k_stop(struct ieee80211_hw *hw)
-{
-       ath5k_stop_hw(hw->priv);
-}
-
-static int ath5k_add_interface(struct ieee80211_hw *hw,
-               struct ieee80211_vif *vif)
-{
-       struct ath5k_softc *sc = hw->priv;
-       int ret;
-       struct ath5k_vif *avf = (void *)vif->drv_priv;
-
-       mutex_lock(&sc->lock);
-
-       if ((vif->type == NL80211_IFTYPE_AP ||
-            vif->type == NL80211_IFTYPE_ADHOC)
-           && (sc->num_ap_vifs + sc->num_adhoc_vifs) >= ATH_BCBUF) {
-               ret = -ELNRNG;
-               goto end;
-       }
-
-       /* Don't allow other interfaces if one ad-hoc is configured.
-        * TODO: Fix the problems with ad-hoc and multiple other interfaces.
-        * We would need to operate the HW in ad-hoc mode to allow TSF updates
-        * for the IBSS, but this breaks with additional AP or STA interfaces
-        * at the moment. */
-       if (sc->num_adhoc_vifs ||
-           (sc->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) {
-               ATH5K_ERR(sc, "Only one single ad-hoc interface is allowed.\n");
-               ret = -ELNRNG;
-               goto end;
-       }
-
-       switch (vif->type) {
-       case NL80211_IFTYPE_AP:
-       case NL80211_IFTYPE_STATION:
-       case NL80211_IFTYPE_ADHOC:
-       case NL80211_IFTYPE_MESH_POINT:
-               avf->opmode = vif->type;
-               break;
-       default:
-               ret = -EOPNOTSUPP;
-               goto end;
-       }
-
-       sc->nvifs++;
-       ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "add interface mode %d\n", avf->opmode);
-
-       /* Assign the vap/adhoc to a beacon xmit slot. */
-       if ((avf->opmode == NL80211_IFTYPE_AP) ||
-           (avf->opmode == NL80211_IFTYPE_ADHOC) ||
-           (avf->opmode == NL80211_IFTYPE_MESH_POINT)) {
-               int slot;
-
-               WARN_ON(list_empty(&sc->bcbuf));
-               avf->bbuf = list_first_entry(&sc->bcbuf, struct ath5k_buf,
-                                            list);
-               list_del(&avf->bbuf->list);
-
-               avf->bslot = 0;
-               for (slot = 0; slot < ATH_BCBUF; slot++) {
-                       if (!sc->bslot[slot]) {
-                               avf->bslot = slot;
-                               break;
-                       }
-               }
-               BUG_ON(sc->bslot[avf->bslot] != NULL);
-               sc->bslot[avf->bslot] = vif;
-               if (avf->opmode == NL80211_IFTYPE_AP)
-                       sc->num_ap_vifs++;
-               else if (avf->opmode == NL80211_IFTYPE_ADHOC)
-                       sc->num_adhoc_vifs++;
-       }
-
-       /* Any MAC address is fine, all others are included through the
-        * filter.
-        */
-       memcpy(&sc->lladdr, vif->addr, ETH_ALEN);
-       ath5k_hw_set_lladdr(sc->ah, vif->addr);
-
-       memcpy(&avf->lladdr, vif->addr, ETH_ALEN);
-
-       ath5k_mode_setup(sc, vif);
-
-       ret = 0;
-end:
-       mutex_unlock(&sc->lock);
-       return ret;
-}
-
-static void
-ath5k_remove_interface(struct ieee80211_hw *hw,
-                       struct ieee80211_vif *vif)
-{
-       struct ath5k_softc *sc = hw->priv;
-       struct ath5k_vif *avf = (void *)vif->drv_priv;
-       unsigned int i;
-
-       mutex_lock(&sc->lock);
-       sc->nvifs--;
-
-       if (avf->bbuf) {
-               ath5k_txbuf_free_skb(sc, avf->bbuf);
-               list_add_tail(&avf->bbuf->list, &sc->bcbuf);
-               for (i = 0; i < ATH_BCBUF; i++) {
-                       if (sc->bslot[i] == vif) {
-                               sc->bslot[i] = NULL;
-                               break;
-                       }
-               }
-               avf->bbuf = NULL;
-       }
-       if (avf->opmode == NL80211_IFTYPE_AP)
-               sc->num_ap_vifs--;
-       else if (avf->opmode == NL80211_IFTYPE_ADHOC)
-               sc->num_adhoc_vifs--;
-
-       ath5k_update_bssid_mask_and_opmode(sc, NULL);
-       mutex_unlock(&sc->lock);
-}
-
-/*
- * TODO: Phy disable/diversity etc
- */
-static int
-ath5k_config(struct ieee80211_hw *hw, u32 changed)
-{
-       struct ath5k_softc *sc = hw->priv;
-       struct ath5k_hw *ah = sc->ah;
-       struct ieee80211_conf *conf = &hw->conf;
-       int ret = 0;
-
-       mutex_lock(&sc->lock);
-
-       if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
-               ret = ath5k_chan_set(sc, conf->channel);
-               if (ret < 0)
-                       goto unlock;
-       }
-
-       if ((changed & IEEE80211_CONF_CHANGE_POWER) &&
-       (sc->power_level != conf->power_level)) {
-               sc->power_level = conf->power_level;
-
-               /* Half dB steps */
-               ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2));
-       }
-
-       /* TODO:
-        * 1) Move this on config_interface and handle each case
-        * separately eg. when we have only one STA vif, use
-        * AR5K_ANTMODE_SINGLE_AP
-        *
-        * 2) Allow the user to change antenna mode eg. when only
-        * one antenna is present
-        *
-        * 3) Allow the user to set default/tx antenna when possible
-        *
-        * 4) Default mode should handle 90% of the cases, together
-        * with fixed a/b and single AP modes we should be able to
-        * handle 99%. Sectored modes are extreme cases and i still
-        * haven't found a usage for them. If we decide to support them,
-        * then we must allow the user to set how many tx antennas we
-        * have available
-        */
-       ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode);
-
-unlock:
-       mutex_unlock(&sc->lock);
-       return ret;
-}
-
-static u64 ath5k_prepare_multicast(struct ieee80211_hw *hw,
-                                  struct netdev_hw_addr_list *mc_list)
-{
-       u32 mfilt[2], val;
-       u8 pos;
-       struct netdev_hw_addr *ha;
-
-       mfilt[0] = 0;
-       mfilt[1] = 1;
-
-       netdev_hw_addr_list_for_each(ha, mc_list) {
-               /* calculate XOR of eight 6-bit values */
-               val = get_unaligned_le32(ha->addr + 0);
-               pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
-               val = get_unaligned_le32(ha->addr + 3);
-               pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
-               pos &= 0x3f;
-               mfilt[pos / 32] |= (1 << (pos % 32));
-               /* XXX: we might be able to just do this instead,
-               * but not sure, needs testing, if we do use this we'd
-               * neet to inform below to not reset the mcast */
-               /* ath5k_hw_set_mcast_filterindex(ah,
-                *      ha->addr[5]); */
-       }
-
-       return ((u64)(mfilt[1]) << 32) | mfilt[0];
-}
-
-static bool ath_any_vif_assoc(struct ath5k_softc *sc)
+bool
+ath_any_vif_assoc(struct ath5k_softc *sc)
 {
        struct ath_vif_iter_data iter_data;
        iter_data.hw_macaddr = NULL;
@@ -3175,262 +2953,7 @@ static bool ath_any_vif_assoc(struct ath5k_softc *sc)
        return iter_data.any_assoc;
 }
 
-#define SUPPORTED_FIF_FLAGS \
-       FIF_PROMISC_IN_BSS |  FIF_ALLMULTI | FIF_FCSFAIL | \
-       FIF_PLCPFAIL | FIF_CONTROL | FIF_OTHER_BSS | \
-       FIF_BCN_PRBRESP_PROMISC
-/*
- * o always accept unicast, broadcast, and multicast traffic
- * o multicast traffic for all BSSIDs will be enabled if mac80211
- *   says it should be
- * o maintain current state of phy ofdm or phy cck error reception.
- *   If the hardware detects any of these type of errors then
- *   ath5k_hw_get_rx_filter() will pass to us the respective
- *   hardware filters to be able to receive these type of frames.
- * o probe request frames are accepted only when operating in
- *   hostap, adhoc, or monitor modes
- * o enable promiscuous mode according to the interface state
- * o accept beacons:
- *   - when operating in adhoc mode so the 802.11 layer creates
- *     node table entries for peers,
- *   - when operating in station mode for collecting rssi data when
- *     the station is otherwise quiet, or
- *   - when scanning
- */
-static void ath5k_configure_filter(struct ieee80211_hw *hw,
-               unsigned int changed_flags,
-               unsigned int *new_flags,
-               u64 multicast)
-{
-       struct ath5k_softc *sc = hw->priv;
-       struct ath5k_hw *ah = sc->ah;
-       u32 mfilt[2], rfilt;
-
-       mutex_lock(&sc->lock);
-
-       mfilt[0] = multicast;
-       mfilt[1] = multicast >> 32;
-
-       /* Only deal with supported flags */
-       changed_flags &= SUPPORTED_FIF_FLAGS;
-       *new_flags &= SUPPORTED_FIF_FLAGS;
-
-       /* If HW detects any phy or radar errors, leave those filters on.
-        * Also, always enable Unicast, Broadcasts and Multicast
-        * XXX: move unicast, bssid broadcasts and multicast to mac80211 */
-       rfilt = (ath5k_hw_get_rx_filter(ah) & (AR5K_RX_FILTER_PHYERR)) |
-               (AR5K_RX_FILTER_UCAST | AR5K_RX_FILTER_BCAST |
-               AR5K_RX_FILTER_MCAST);
-
-       if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
-               if (*new_flags & FIF_PROMISC_IN_BSS) {
-                       __set_bit(ATH_STAT_PROMISC, sc->status);
-               } else {
-                       __clear_bit(ATH_STAT_PROMISC, sc->status);
-               }
-       }
-
-       if (test_bit(ATH_STAT_PROMISC, sc->status))
-               rfilt |= AR5K_RX_FILTER_PROM;
-
-       /* Note, AR5K_RX_FILTER_MCAST is already enabled */
-       if (*new_flags & FIF_ALLMULTI) {
-               mfilt[0] =  ~0;
-               mfilt[1] =  ~0;
-       }
-
-       /* This is the best we can do */
-       if (*new_flags & (FIF_FCSFAIL | FIF_PLCPFAIL))
-               rfilt |= AR5K_RX_FILTER_PHYERR;
-
-       /* FIF_BCN_PRBRESP_PROMISC really means to enable beacons
-       * and probes for any BSSID */
-       if ((*new_flags & FIF_BCN_PRBRESP_PROMISC) || (sc->nvifs > 1))
-               rfilt |= AR5K_RX_FILTER_BEACON;
-
-       /* FIF_CONTROL doc says that if FIF_PROMISC_IN_BSS is not
-        * set we should only pass on control frames for this
-        * station. This needs testing. I believe right now this
-        * enables *all* control frames, which is OK.. but
-        * but we should see if we can improve on granularity */
-       if (*new_flags & FIF_CONTROL)
-               rfilt |= AR5K_RX_FILTER_CONTROL;
-
-       /* Additional settings per mode -- this is per ath5k */
-
-       /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */
-
-       switch (sc->opmode) {
-       case NL80211_IFTYPE_MESH_POINT:
-               rfilt |= AR5K_RX_FILTER_CONTROL |
-                        AR5K_RX_FILTER_BEACON |
-                        AR5K_RX_FILTER_PROBEREQ |
-                        AR5K_RX_FILTER_PROM;
-               break;
-       case NL80211_IFTYPE_AP:
-       case NL80211_IFTYPE_ADHOC:
-               rfilt |= AR5K_RX_FILTER_PROBEREQ |
-                        AR5K_RX_FILTER_BEACON;
-               break;
-       case NL80211_IFTYPE_STATION:
-               if (sc->assoc)
-                       rfilt |= AR5K_RX_FILTER_BEACON;
-       default:
-               break;
-       }
-
-       /* Set filters */
-       ath5k_hw_set_rx_filter(ah, rfilt);
-
-       /* Set multicast bits */
-       ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]);
-       /* Set the cached hw filter flags, this will later actually
-        * be set in HW */
-       sc->filter_flags = rfilt;
-
-       mutex_unlock(&sc->lock);
-}
-
-static int
-ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-             struct ieee80211_vif *vif, struct ieee80211_sta *sta,
-             struct ieee80211_key_conf *key)
-{
-       struct ath5k_softc *sc = hw->priv;
-       struct ath5k_hw *ah = sc->ah;
-       struct ath_common *common = ath5k_hw_common(ah);
-       int ret = 0;
-
-       if (modparam_nohwcrypt)
-               return -EOPNOTSUPP;
-
-       switch (key->cipher) {
-       case WLAN_CIPHER_SUITE_WEP40:
-       case WLAN_CIPHER_SUITE_WEP104:
-       case WLAN_CIPHER_SUITE_TKIP:
-               break;
-       case WLAN_CIPHER_SUITE_CCMP:
-               if (common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)
-                       break;
-               return -EOPNOTSUPP;
-       default:
-               WARN_ON(1);
-               return -EINVAL;
-       }
-
-       mutex_lock(&sc->lock);
-
-       switch (cmd) {
-       case SET_KEY:
-               ret = ath_key_config(common, vif, sta, key);
-               if (ret >= 0) {
-                       key->hw_key_idx = ret;
-                       /* push IV and Michael MIC generation to stack */
-                       key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
-                       if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
-                               key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
-                       if (key->cipher == WLAN_CIPHER_SUITE_CCMP)
-                               key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
-                       ret = 0;
-               }
-               break;
-       case DISABLE_KEY:
-               ath_key_delete(common, key);
-               break;
-       default:
-               ret = -EINVAL;
-       }
-
-       mmiowb();
-       mutex_unlock(&sc->lock);
-       return ret;
-}
-
-static int
-ath5k_get_stats(struct ieee80211_hw *hw,
-               struct ieee80211_low_level_stats *stats)
-{
-       struct ath5k_softc *sc = hw->priv;
-
-       /* Force update */
-       ath5k_hw_update_mib_counters(sc->ah);
-
-       stats->dot11ACKFailureCount = sc->stats.ack_fail;
-       stats->dot11RTSFailureCount = sc->stats.rts_fail;
-       stats->dot11RTSSuccessCount = sc->stats.rts_ok;
-       stats->dot11FCSErrorCount = sc->stats.fcs_error;
-
-       return 0;
-}
-
-static int ath5k_get_survey(struct ieee80211_hw *hw, int idx,
-               struct survey_info *survey)
-{
-       struct ath5k_softc *sc = hw->priv;
-       struct ieee80211_conf *conf = &hw->conf;
-       struct ath_common *common = ath5k_hw_common(sc->ah);
-       struct ath_cycle_counters *cc = &common->cc_survey;
-       unsigned int div = common->clockrate * 1000;
-
-       if (idx != 0)
-               return -ENOENT;
-
-       spin_lock_bh(&common->cc_lock);
-       ath_hw_cycle_counters_update(common);
-       if (cc->cycles > 0) {
-               sc->survey.channel_time += cc->cycles / div;
-               sc->survey.channel_time_busy += cc->rx_busy / div;
-               sc->survey.channel_time_rx += cc->rx_frame / div;
-               sc->survey.channel_time_tx += cc->tx_frame / div;
-       }
-       memset(cc, 0, sizeof(*cc));
-       spin_unlock_bh(&common->cc_lock);
-
-       memcpy(survey, &sc->survey, sizeof(*survey));
-
-       survey->channel = conf->channel;
-       survey->noise = sc->ah->ah_noise_floor;
-       survey->filled = SURVEY_INFO_NOISE_DBM |
-                       SURVEY_INFO_CHANNEL_TIME |
-                       SURVEY_INFO_CHANNEL_TIME_BUSY |
-                       SURVEY_INFO_CHANNEL_TIME_RX |
-                       SURVEY_INFO_CHANNEL_TIME_TX;
-
-       return 0;
-}
-
-static u64
-ath5k_get_tsf(struct ieee80211_hw *hw)
-{
-       struct ath5k_softc *sc = hw->priv;
-
-       return ath5k_hw_get_tsf64(sc->ah);
-}
-
-static void
-ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf)
-{
-       struct ath5k_softc *sc = hw->priv;
-
-       ath5k_hw_set_tsf64(sc->ah, tsf);
-}
-
-static void
-ath5k_reset_tsf(struct ieee80211_hw *hw)
-{
-       struct ath5k_softc *sc = hw->priv;
-
-       /*
-        * in IBSS mode we need to update the beacon timers too.
-        * this will also reset the TSF if we call it with 0
-        */
-       if (sc->opmode == NL80211_IFTYPE_ADHOC)
-               ath5k_beacon_update_timers(sc, 0);
-       else
-               ath5k_hw_reset_tsf(sc->ah);
-}
-
-static void
+void
 set_beacon_filter(struct ieee80211_hw *hw, bool enable)
 {
        struct ath5k_softc *sc = hw->priv;
@@ -3444,189 +2967,3 @@ set_beacon_filter(struct ieee80211_hw *hw, bool enable)
        ath5k_hw_set_rx_filter(ah, rfilt);
        sc->filter_flags = rfilt;
 }
-
-static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
-                                   struct ieee80211_vif *vif,
-                                   struct ieee80211_bss_conf *bss_conf,
-                                   u32 changes)
-{
-       struct ath5k_vif *avf = (void *)vif->drv_priv;
-       struct ath5k_softc *sc = hw->priv;
-       struct ath5k_hw *ah = sc->ah;
-       struct ath_common *common = ath5k_hw_common(ah);
-       unsigned long flags;
-
-       mutex_lock(&sc->lock);
-
-       if (changes & BSS_CHANGED_BSSID) {
-               /* Cache for later use during resets */
-               memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
-               common->curaid = 0;
-               ath5k_hw_set_bssid(ah);
-               mmiowb();
-       }
-
-       if (changes & BSS_CHANGED_BEACON_INT)
-               sc->bintval = bss_conf->beacon_int;
-
-       if (changes & BSS_CHANGED_ASSOC) {
-               avf->assoc = bss_conf->assoc;
-               if (bss_conf->assoc)
-                       sc->assoc = bss_conf->assoc;
-               else
-                       sc->assoc = ath_any_vif_assoc(sc);
-
-               if (sc->opmode == NL80211_IFTYPE_STATION)
-                       set_beacon_filter(hw, sc->assoc);
-               ath5k_hw_set_ledstate(sc->ah, sc->assoc ?
-                       AR5K_LED_ASSOC : AR5K_LED_INIT);
-               if (bss_conf->assoc) {
-                       ATH5K_DBG(sc, ATH5K_DEBUG_ANY,
-                                 "Bss Info ASSOC %d, bssid: %pM\n",
-                                 bss_conf->aid, common->curbssid);
-                       common->curaid = bss_conf->aid;
-                       ath5k_hw_set_bssid(ah);
-                       /* Once ANI is available you would start it here */
-               }
-       }
-
-       if (changes & BSS_CHANGED_BEACON) {
-               spin_lock_irqsave(&sc->block, flags);
-               ath5k_beacon_update(hw, vif);
-               spin_unlock_irqrestore(&sc->block, flags);
-       }
-
-       if (changes & BSS_CHANGED_BEACON_ENABLED)
-               sc->enable_beacon = bss_conf->enable_beacon;
-
-       if (changes & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED |
-                      BSS_CHANGED_BEACON_INT))
-               ath5k_beacon_config(sc);
-
-       mutex_unlock(&sc->lock);
-}
-
-static void ath5k_sw_scan_start(struct ieee80211_hw *hw)
-{
-       struct ath5k_softc *sc = hw->priv;
-       if (!sc->assoc)
-               ath5k_hw_set_ledstate(sc->ah, AR5K_LED_SCAN);
-}
-
-static void ath5k_sw_scan_complete(struct ieee80211_hw *hw)
-{
-       struct ath5k_softc *sc = hw->priv;
-       ath5k_hw_set_ledstate(sc->ah, sc->assoc ?
-               AR5K_LED_ASSOC : AR5K_LED_INIT);
-}
-
-/**
- * ath5k_set_coverage_class - Set IEEE 802.11 coverage class
- *
- * @hw: struct ieee80211_hw pointer
- * @coverage_class: IEEE 802.11 coverage class number
- *
- * Mac80211 callback. Sets slot time, ACK timeout and CTS timeout for given
- * coverage class. The values are persistent, they are restored after device
- * reset.
- */
-static void ath5k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
-{
-       struct ath5k_softc *sc = hw->priv;
-
-       mutex_lock(&sc->lock);
-       ath5k_hw_set_coverage_class(sc->ah, coverage_class);
-       mutex_unlock(&sc->lock);
-}
-
-static int ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue,
-                        const struct ieee80211_tx_queue_params *params)
-{
-       struct ath5k_softc *sc = hw->priv;
-       struct ath5k_hw *ah = sc->ah;
-       struct ath5k_txq_info qi;
-       int ret = 0;
-
-       if (queue >= ah->ah_capabilities.cap_queues.q_tx_num)
-               return 0;
-
-       mutex_lock(&sc->lock);
-
-       ath5k_hw_get_tx_queueprops(ah, queue, &qi);
-
-       qi.tqi_aifs = params->aifs;
-       qi.tqi_cw_min = params->cw_min;
-       qi.tqi_cw_max = params->cw_max;
-       qi.tqi_burst_time = params->txop;
-
-       ATH5K_DBG(sc, ATH5K_DEBUG_ANY,
-                 "Configure tx [queue %d],  "
-                 "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n",
-                 queue, params->aifs, params->cw_min,
-                 params->cw_max, params->txop);
-
-       if (ath5k_hw_set_tx_queueprops(ah, queue, &qi)) {
-               ATH5K_ERR(sc,
-                         "Unable to update hardware queue %u!\n", queue);
-               ret = -EIO;
-       } else
-               ath5k_hw_reset_tx_queue(ah, queue);
-
-       mutex_unlock(&sc->lock);
-
-       return ret;
-}
-
-static int ath5k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
-{
-       struct ath5k_softc *sc = hw->priv;
-
-       if (tx_ant == 1 && rx_ant == 1)
-               ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_A);
-       else if (tx_ant == 2 && rx_ant == 2)
-               ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_B);
-       else if ((tx_ant & 3) == 3 && (rx_ant & 3) == 3)
-               ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_DEFAULT);
-       else
-               return -EINVAL;
-       return 0;
-}
-
-static int ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
-{
-       struct ath5k_softc *sc = hw->priv;
-
-       switch (sc->ah->ah_ant_mode) {
-       case AR5K_ANTMODE_FIXED_A:
-               *tx_ant = 1; *rx_ant = 1; break;
-       case AR5K_ANTMODE_FIXED_B:
-               *tx_ant = 2; *rx_ant = 2; break;
-       case AR5K_ANTMODE_DEFAULT:
-               *tx_ant = 3; *rx_ant = 3; break;
-       }
-       return 0;
-}
-
-const struct ieee80211_ops ath5k_hw_ops = {
-       .tx             = ath5k_tx,
-       .start          = ath5k_start,
-       .stop           = ath5k_stop,
-       .add_interface  = ath5k_add_interface,
-       .remove_interface = ath5k_remove_interface,
-       .config         = ath5k_config,
-       .prepare_multicast = ath5k_prepare_multicast,
-       .configure_filter = ath5k_configure_filter,
-       .set_key        = ath5k_set_key,
-       .get_stats      = ath5k_get_stats,
-       .get_survey     = ath5k_get_survey,
-       .conf_tx        = ath5k_conf_tx,
-       .get_tsf        = ath5k_get_tsf,
-       .set_tsf        = ath5k_set_tsf,
-       .reset_tsf      = ath5k_reset_tsf,
-       .bss_info_changed = ath5k_bss_info_changed,
-       .sw_scan_start  = ath5k_sw_scan_start,
-       .sw_scan_complete = ath5k_sw_scan_complete,
-       .set_coverage_class = ath5k_set_coverage_class,
-       .set_antenna    = ath5k_set_antenna,
-       .get_antenna    = ath5k_get_antenna,
-};
index 97eaa9a..80e6256 100644 (file)
@@ -1802,3 +1802,19 @@ ath5k_eeprom_detach(struct ath5k_hw *ah)
        for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; mode++)
                ath5k_eeprom_free_pcal_info(ah, mode);
 }
+
+int
+ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel)
+{
+       switch (channel->hw_value & CHANNEL_MODES) {
+       case CHANNEL_A:
+       case CHANNEL_XR:
+               return AR5K_EEPROM_MODE_11A;
+       case CHANNEL_G:
+               return AR5K_EEPROM_MODE_11G;
+       case CHANNEL_B:
+               return AR5K_EEPROM_MODE_11B;
+       default:
+               return -1;
+       }
+}
index 0017006..7c09e15 100644 (file)
@@ -517,3 +517,5 @@ struct ath5k_eeprom_info {
        u32     ee_antenna[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX];
 };
 
+int
+ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel);
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
new file mode 100644 (file)
index 0000000..d76d68c
--- /dev/null
@@ -0,0 +1,774 @@
+/*-
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * Copyright (c) 2004-2005 Atheros Communications, Inc.
+ * Copyright (c) 2006 Devicescape Software, Inc.
+ * Copyright (c) 2007 Jiri Slaby <jirislaby@gmail.com>
+ * Copyright (c) 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
+ * Copyright (c) 2010 Bruno Randolf <br1@einfach.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *    redistribution must be conditioned upon including a substantially
+ *    similar Disclaimer requirement for further binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ */
+
+#include <asm/unaligned.h>
+
+#include "base.h"
+#include "reg.h"
+
+extern int ath5k_modparam_nohwcrypt;
+
+/* functions used from base.c */
+void set_beacon_filter(struct ieee80211_hw *hw, bool enable);
+bool ath_any_vif_assoc(struct ath5k_softc *sc);
+int ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
+                  struct ath5k_txq *txq);
+int ath5k_init_hw(struct ath5k_softc *sc);
+int ath5k_stop_hw(struct ath5k_softc *sc);
+void ath5k_mode_setup(struct ath5k_softc *sc, struct ieee80211_vif *vif);
+void ath5k_update_bssid_mask_and_opmode(struct ath5k_softc *sc,
+                                       struct ieee80211_vif *vif);
+int ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan);
+void ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf);
+int ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
+void ath5k_beacon_config(struct ath5k_softc *sc);
+void ath5k_txbuf_free_skb(struct ath5k_softc *sc, struct ath5k_buf *bf);
+void ath5k_rxbuf_free_skb(struct ath5k_softc *sc, struct ath5k_buf *bf);
+
+/********************\
+* Mac80211 functions *
+\********************/
+
+static int
+ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
+{
+       struct ath5k_softc *sc = hw->priv;
+       u16 qnum = skb_get_queue_mapping(skb);
+
+       if (WARN_ON(qnum >= sc->ah->ah_capabilities.cap_queues.q_tx_num)) {
+               dev_kfree_skb_any(skb);
+               return 0;
+       }
+
+       return ath5k_tx_queue(hw, skb, &sc->txqs[qnum]);
+}
+
+
+static int
+ath5k_start(struct ieee80211_hw *hw)
+{
+       return ath5k_init_hw(hw->priv);
+}
+
+
+static void
+ath5k_stop(struct ieee80211_hw *hw)
+{
+       ath5k_stop_hw(hw->priv);
+}
+
+
+static int
+ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+       struct ath5k_softc *sc = hw->priv;
+       int ret;
+       struct ath5k_vif *avf = (void *)vif->drv_priv;
+
+       mutex_lock(&sc->lock);
+
+       if ((vif->type == NL80211_IFTYPE_AP ||
+            vif->type == NL80211_IFTYPE_ADHOC)
+           && (sc->num_ap_vifs + sc->num_adhoc_vifs) >= ATH_BCBUF) {
+               ret = -ELNRNG;
+               goto end;
+       }
+
+       /* Don't allow other interfaces if one ad-hoc is configured.
+        * TODO: Fix the problems with ad-hoc and multiple other interfaces.
+        * We would need to operate the HW in ad-hoc mode to allow TSF updates
+        * for the IBSS, but this breaks with additional AP or STA interfaces
+        * at the moment. */
+       if (sc->num_adhoc_vifs ||
+           (sc->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) {
+               ATH5K_ERR(sc, "Only one single ad-hoc interface is allowed.\n");
+               ret = -ELNRNG;
+               goto end;
+       }
+
+       switch (vif->type) {
+       case NL80211_IFTYPE_AP:
+       case NL80211_IFTYPE_STATION:
+       case NL80211_IFTYPE_ADHOC:
+       case NL80211_IFTYPE_MESH_POINT:
+               avf->opmode = vif->type;
+               break;
+       default:
+               ret = -EOPNOTSUPP;
+               goto end;
+       }
+
+       sc->nvifs++;
+       ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "add interface mode %d\n", avf->opmode);
+
+       /* Assign the vap/adhoc to a beacon xmit slot. */
+       if ((avf->opmode == NL80211_IFTYPE_AP) ||
+           (avf->opmode == NL80211_IFTYPE_ADHOC) ||
+           (avf->opmode == NL80211_IFTYPE_MESH_POINT)) {
+               int slot;
+
+               WARN_ON(list_empty(&sc->bcbuf));
+               avf->bbuf = list_first_entry(&sc->bcbuf, struct ath5k_buf,
+                                            list);
+               list_del(&avf->bbuf->list);
+
+               avf->bslot = 0;
+               for (slot = 0; slot < ATH_BCBUF; slot++) {
+                       if (!sc->bslot[slot]) {
+                               avf->bslot = slot;
+                               break;
+                       }
+               }
+               BUG_ON(sc->bslot[avf->bslot] != NULL);
+               sc->bslot[avf->bslot] = vif;
+               if (avf->opmode == NL80211_IFTYPE_AP)
+                       sc->num_ap_vifs++;
+               else if (avf->opmode == NL80211_IFTYPE_ADHOC)
+                       sc->num_adhoc_vifs++;
+       }
+
+       /* Any MAC address is fine, all others are included through the
+        * filter.
+        */
+       memcpy(&sc->lladdr, vif->addr, ETH_ALEN);
+       ath5k_hw_set_lladdr(sc->ah, vif->addr);
+
+       memcpy(&avf->lladdr, vif->addr, ETH_ALEN);
+
+       ath5k_mode_setup(sc, vif);
+
+       ret = 0;
+end:
+       mutex_unlock(&sc->lock);
+       return ret;
+}
+
+
+static void
+ath5k_remove_interface(struct ieee80211_hw *hw,
+                      struct ieee80211_vif *vif)
+{
+       struct ath5k_softc *sc = hw->priv;
+       struct ath5k_vif *avf = (void *)vif->drv_priv;
+       unsigned int i;
+
+       mutex_lock(&sc->lock);
+       sc->nvifs--;
+
+       if (avf->bbuf) {
+               ath5k_txbuf_free_skb(sc, avf->bbuf);
+               list_add_tail(&avf->bbuf->list, &sc->bcbuf);
+               for (i = 0; i < ATH_BCBUF; i++) {
+                       if (sc->bslot[i] == vif) {
+                               sc->bslot[i] = NULL;
+                               break;
+                       }
+               }
+               avf->bbuf = NULL;
+       }
+       if (avf->opmode == NL80211_IFTYPE_AP)
+               sc->num_ap_vifs--;
+       else if (avf->opmode == NL80211_IFTYPE_ADHOC)
+               sc->num_adhoc_vifs--;
+
+       ath5k_update_bssid_mask_and_opmode(sc, NULL);
+       mutex_unlock(&sc->lock);
+}
+
+
+/*
+ * TODO: Phy disable/diversity etc
+ */
+static int
+ath5k_config(struct ieee80211_hw *hw, u32 changed)
+{
+       struct ath5k_softc *sc = hw->priv;
+       struct ath5k_hw *ah = sc->ah;
+       struct ieee80211_conf *conf = &hw->conf;
+       int ret = 0;
+
+       mutex_lock(&sc->lock);
+
+       if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
+               ret = ath5k_chan_set(sc, conf->channel);
+               if (ret < 0)
+                       goto unlock;
+       }
+
+       if ((changed & IEEE80211_CONF_CHANGE_POWER) &&
+       (sc->power_level != conf->power_level)) {
+               sc->power_level = conf->power_level;
+
+               /* Half dB steps */
+               ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2));
+       }
+
+       /* TODO:
+        * 1) Move this on config_interface and handle each case
+        * separately eg. when we have only one STA vif, use
+        * AR5K_ANTMODE_SINGLE_AP
+        *
+        * 2) Allow the user to change antenna mode eg. when only
+        * one antenna is present
+        *
+        * 3) Allow the user to set default/tx antenna when possible
+        *
+        * 4) Default mode should handle 90% of the cases, together
+        * with fixed a/b and single AP modes we should be able to
+        * handle 99%. Sectored modes are extreme cases and i still
+        * haven't found a usage for them. If we decide to support them,
+        * then we must allow the user to set how many tx antennas we
+        * have available
+        */
+       ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode);
+
+unlock:
+       mutex_unlock(&sc->lock);
+       return ret;
+}
+
+
+static void
+ath5k_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+                      struct ieee80211_bss_conf *bss_conf, u32 changes)
+{
+       struct ath5k_vif *avf = (void *)vif->drv_priv;
+       struct ath5k_softc *sc = hw->priv;
+       struct ath5k_hw *ah = sc->ah;
+       struct ath_common *common = ath5k_hw_common(ah);
+       unsigned long flags;
+
+       mutex_lock(&sc->lock);
+
+       if (changes & BSS_CHANGED_BSSID) {
+               /* Cache for later use during resets */
+               memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
+               common->curaid = 0;
+               ath5k_hw_set_bssid(ah);
+               mmiowb();
+       }
+
+       if (changes & BSS_CHANGED_BEACON_INT)
+               sc->bintval = bss_conf->beacon_int;
+
+       if (changes & BSS_CHANGED_ASSOC) {
+               avf->assoc = bss_conf->assoc;
+               if (bss_conf->assoc)
+                       sc->assoc = bss_conf->assoc;
+               else
+                       sc->assoc = ath_any_vif_assoc(sc);
+
+               if (sc->opmode == NL80211_IFTYPE_STATION)
+                       set_beacon_filter(hw, sc->assoc);
+               ath5k_hw_set_ledstate(sc->ah, sc->assoc ?
+                       AR5K_LED_ASSOC : AR5K_LED_INIT);
+               if (bss_conf->assoc) {
+                       ATH5K_DBG(sc, ATH5K_DEBUG_ANY,
+                                 "Bss Info ASSOC %d, bssid: %pM\n",
+                                 bss_conf->aid, common->curbssid);
+                       common->curaid = bss_conf->aid;
+                       ath5k_hw_set_bssid(ah);
+                       /* Once ANI is available you would start it here */
+               }
+       }
+
+       if (changes & BSS_CHANGED_BEACON) {
+               spin_lock_irqsave(&sc->block, flags);
+               ath5k_beacon_update(hw, vif);
+               spin_unlock_irqrestore(&sc->block, flags);
+       }
+
+       if (changes & BSS_CHANGED_BEACON_ENABLED)
+               sc->enable_beacon = bss_conf->enable_beacon;
+
+       if (changes & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED |
+                      BSS_CHANGED_BEACON_INT))
+               ath5k_beacon_config(sc);
+
+       mutex_unlock(&sc->lock);
+}
+
+
+static u64
+ath5k_prepare_multicast(struct ieee80211_hw *hw,
+                       struct netdev_hw_addr_list *mc_list)
+{
+       u32 mfilt[2], val;
+       u8 pos;
+       struct netdev_hw_addr *ha;
+
+       mfilt[0] = 0;
+       mfilt[1] = 1;
+
+       netdev_hw_addr_list_for_each(ha, mc_list) {
+               /* calculate XOR of eight 6-bit values */
+               val = get_unaligned_le32(ha->addr + 0);
+               pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
+               val = get_unaligned_le32(ha->addr + 3);
+               pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
+               pos &= 0x3f;
+               mfilt[pos / 32] |= (1 << (pos % 32));
+               /* XXX: we might be able to just do this instead,
+               * but not sure, needs testing, if we do use this we'd
+               * neet to inform below to not reset the mcast */
+               /* ath5k_hw_set_mcast_filterindex(ah,
+                *      ha->addr[5]); */
+       }
+
+       return ((u64)(mfilt[1]) << 32) | mfilt[0];
+}
+
+
+/*
+ * o always accept unicast, broadcast, and multicast traffic
+ * o multicast traffic for all BSSIDs will be enabled if mac80211
+ *   says it should be
+ * o maintain current state of phy ofdm or phy cck error reception.
+ *   If the hardware detects any of these type of errors then
+ *   ath5k_hw_get_rx_filter() will pass to us the respective
+ *   hardware filters to be able to receive these type of frames.
+ * o probe request frames are accepted only when operating in
+ *   hostap, adhoc, or monitor modes
+ * o enable promiscuous mode according to the interface state
+ * o accept beacons:
+ *   - when operating in adhoc mode so the 802.11 layer creates
+ *     node table entries for peers,
+ *   - when operating in station mode for collecting rssi data when
+ *     the station is otherwise quiet, or
+ *   - when scanning
+ */
+static void
+ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
+                      unsigned int *new_flags, u64 multicast)
+{
+#define SUPPORTED_FIF_FLAGS \
+       (FIF_PROMISC_IN_BSS |  FIF_ALLMULTI | FIF_FCSFAIL | \
+       FIF_PLCPFAIL | FIF_CONTROL | FIF_OTHER_BSS | \
+       FIF_BCN_PRBRESP_PROMISC)
+
+       struct ath5k_softc *sc = hw->priv;
+       struct ath5k_hw *ah = sc->ah;
+       u32 mfilt[2], rfilt;
+
+       mutex_lock(&sc->lock);
+
+       mfilt[0] = multicast;
+       mfilt[1] = multicast >> 32;
+
+       /* Only deal with supported flags */
+       changed_flags &= SUPPORTED_FIF_FLAGS;
+       *new_flags &= SUPPORTED_FIF_FLAGS;
+
+       /* If HW detects any phy or radar errors, leave those filters on.
+        * Also, always enable Unicast, Broadcasts and Multicast
+        * XXX: move unicast, bssid broadcasts and multicast to mac80211 */
+       rfilt = (ath5k_hw_get_rx_filter(ah) & (AR5K_RX_FILTER_PHYERR)) |
+               (AR5K_RX_FILTER_UCAST | AR5K_RX_FILTER_BCAST |
+               AR5K_RX_FILTER_MCAST);
+
+       if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
+               if (*new_flags & FIF_PROMISC_IN_BSS)
+                       __set_bit(ATH_STAT_PROMISC, sc->status);
+               else
+                       __clear_bit(ATH_STAT_PROMISC, sc->status);
+       }
+
+       if (test_bit(ATH_STAT_PROMISC, sc->status))
+               rfilt |= AR5K_RX_FILTER_PROM;
+
+       /* Note, AR5K_RX_FILTER_MCAST is already enabled */
+       if (*new_flags & FIF_ALLMULTI) {
+               mfilt[0] =  ~0;
+               mfilt[1] =  ~0;
+       }
+
+       /* This is the best we can do */
+       if (*new_flags & (FIF_FCSFAIL | FIF_PLCPFAIL))
+               rfilt |= AR5K_RX_FILTER_PHYERR;
+
+       /* FIF_BCN_PRBRESP_PROMISC really means to enable beacons
+       * and probes for any BSSID */
+       if ((*new_flags & FIF_BCN_PRBRESP_PROMISC) || (sc->nvifs > 1))
+               rfilt |= AR5K_RX_FILTER_BEACON;
+
+       /* FIF_CONTROL doc says that if FIF_PROMISC_IN_BSS is not
+        * set we should only pass on control frames for this
+        * station. This needs testing. I believe right now this
+        * enables *all* control frames, which is OK.. but
+        * but we should see if we can improve on granularity */
+       if (*new_flags & FIF_CONTROL)
+               rfilt |= AR5K_RX_FILTER_CONTROL;
+
+       /* Additional settings per mode -- this is per ath5k */
+
+       /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */
+
+       switch (sc->opmode) {
+       case NL80211_IFTYPE_MESH_POINT:
+               rfilt |= AR5K_RX_FILTER_CONTROL |
+                        AR5K_RX_FILTER_BEACON |
+                        AR5K_RX_FILTER_PROBEREQ |
+                        AR5K_RX_FILTER_PROM;
+               break;
+       case NL80211_IFTYPE_AP:
+       case NL80211_IFTYPE_ADHOC:
+               rfilt |= AR5K_RX_FILTER_PROBEREQ |
+                        AR5K_RX_FILTER_BEACON;
+               break;
+       case NL80211_IFTYPE_STATION:
+               if (sc->assoc)
+                       rfilt |= AR5K_RX_FILTER_BEACON;
+       default:
+               break;
+       }
+
+       /* Set filters */
+       ath5k_hw_set_rx_filter(ah, rfilt);
+
+       /* Set multicast bits */
+       ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]);
+       /* Set the cached hw filter flags, this will later actually
+        * be set in HW */
+       sc->filter_flags = rfilt;
+
+       mutex_unlock(&sc->lock);
+}
+
+
+static int
+ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+             struct ieee80211_vif *vif, struct ieee80211_sta *sta,
+             struct ieee80211_key_conf *key)
+{
+       struct ath5k_softc *sc = hw->priv;
+       struct ath5k_hw *ah = sc->ah;
+       struct ath_common *common = ath5k_hw_common(ah);
+       int ret = 0;
+
+       if (ath5k_modparam_nohwcrypt)
+               return -EOPNOTSUPP;
+
+       switch (key->cipher) {
+       case WLAN_CIPHER_SUITE_WEP40:
+       case WLAN_CIPHER_SUITE_WEP104:
+       case WLAN_CIPHER_SUITE_TKIP:
+               break;
+       case WLAN_CIPHER_SUITE_CCMP:
+               if (common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)
+                       break;
+               return -EOPNOTSUPP;
+       default:
+               WARN_ON(1);
+               return -EINVAL;
+       }
+
+       mutex_lock(&sc->lock);
+
+       switch (cmd) {
+       case SET_KEY:
+               ret = ath_key_config(common, vif, sta, key);
+               if (ret >= 0) {
+                       key->hw_key_idx = ret;
+                       /* push IV and Michael MIC generation to stack */
+                       key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
+                       if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
+                               key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
+                       if (key->cipher == WLAN_CIPHER_SUITE_CCMP)
+                               key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
+                       ret = 0;
+               }
+               break;
+       case DISABLE_KEY:
+               ath_key_delete(common, key);
+               break;
+       default:
+               ret = -EINVAL;
+       }
+
+       mmiowb();
+       mutex_unlock(&sc->lock);
+       return ret;
+}
+
+
+static void
+ath5k_sw_scan_start(struct ieee80211_hw *hw)
+{
+       struct ath5k_softc *sc = hw->priv;
+       if (!sc->assoc)
+               ath5k_hw_set_ledstate(sc->ah, AR5K_LED_SCAN);
+}
+
+
+static void
+ath5k_sw_scan_complete(struct ieee80211_hw *hw)
+{
+       struct ath5k_softc *sc = hw->priv;
+       ath5k_hw_set_ledstate(sc->ah, sc->assoc ?
+               AR5K_LED_ASSOC : AR5K_LED_INIT);
+}
+
+
+static int
+ath5k_get_stats(struct ieee80211_hw *hw,
+               struct ieee80211_low_level_stats *stats)
+{
+       struct ath5k_softc *sc = hw->priv;
+
+       /* Force update */
+       ath5k_hw_update_mib_counters(sc->ah);
+
+       stats->dot11ACKFailureCount = sc->stats.ack_fail;
+       stats->dot11RTSFailureCount = sc->stats.rts_fail;
+       stats->dot11RTSSuccessCount = sc->stats.rts_ok;
+       stats->dot11FCSErrorCount = sc->stats.fcs_error;
+
+       return 0;
+}
+
+
+static int
+ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue,
+             const struct ieee80211_tx_queue_params *params)
+{
+       struct ath5k_softc *sc = hw->priv;
+       struct ath5k_hw *ah = sc->ah;
+       struct ath5k_txq_info qi;
+       int ret = 0;
+
+       if (queue >= ah->ah_capabilities.cap_queues.q_tx_num)
+               return 0;
+
+       mutex_lock(&sc->lock);
+
+       ath5k_hw_get_tx_queueprops(ah, queue, &qi);
+
+       qi.tqi_aifs = params->aifs;
+       qi.tqi_cw_min = params->cw_min;
+       qi.tqi_cw_max = params->cw_max;
+       qi.tqi_burst_time = params->txop;
+
+       ATH5K_DBG(sc, ATH5K_DEBUG_ANY,
+                 "Configure tx [queue %d],  "
+                 "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n",
+                 queue, params->aifs, params->cw_min,
+                 params->cw_max, params->txop);
+
+       if (ath5k_hw_set_tx_queueprops(ah, queue, &qi)) {
+               ATH5K_ERR(sc,
+                         "Unable to update hardware queue %u!\n", queue);
+               ret = -EIO;
+       } else
+               ath5k_hw_reset_tx_queue(ah, queue);
+
+       mutex_unlock(&sc->lock);
+
+       return ret;
+}
+
+
+static u64
+ath5k_get_tsf(struct ieee80211_hw *hw)
+{
+       struct ath5k_softc *sc = hw->priv;
+
+       return ath5k_hw_get_tsf64(sc->ah);
+}
+
+
+static void
+ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf)
+{
+       struct ath5k_softc *sc = hw->priv;
+
+       ath5k_hw_set_tsf64(sc->ah, tsf);
+}
+
+
+static void
+ath5k_reset_tsf(struct ieee80211_hw *hw)
+{
+       struct ath5k_softc *sc = hw->priv;
+
+       /*
+        * in IBSS mode we need to update the beacon timers too.
+        * this will also reset the TSF if we call it with 0
+        */
+       if (sc->opmode == NL80211_IFTYPE_ADHOC)
+               ath5k_beacon_update_timers(sc, 0);
+       else
+               ath5k_hw_reset_tsf(sc->ah);
+}
+
+
+static int
+ath5k_get_survey(struct ieee80211_hw *hw, int idx, struct survey_info *survey)
+{
+       struct ath5k_softc *sc = hw->priv;
+       struct ieee80211_conf *conf = &hw->conf;
+       struct ath_common *common = ath5k_hw_common(sc->ah);
+       struct ath_cycle_counters *cc = &common->cc_survey;
+       unsigned int div = common->clockrate * 1000;
+
+       if (idx != 0)
+               return -ENOENT;
+
+       spin_lock_bh(&common->cc_lock);
+       ath_hw_cycle_counters_update(common);
+       if (cc->cycles > 0) {
+               sc->survey.channel_time += cc->cycles / div;
+               sc->survey.channel_time_busy += cc->rx_busy / div;
+               sc->survey.channel_time_rx += cc->rx_frame / div;
+               sc->survey.channel_time_tx += cc->tx_frame / div;
+       }
+       memset(cc, 0, sizeof(*cc));
+       spin_unlock_bh(&common->cc_lock);
+
+       memcpy(survey, &sc->survey, sizeof(*survey));
+
+       survey->channel = conf->channel;
+       survey->noise = sc->ah->ah_noise_floor;
+       survey->filled = SURVEY_INFO_NOISE_DBM |
+                       SURVEY_INFO_CHANNEL_TIME |
+                       SURVEY_INFO_CHANNEL_TIME_BUSY |
+                       SURVEY_INFO_CHANNEL_TIME_RX |
+                       SURVEY_INFO_CHANNEL_TIME_TX;
+
+       return 0;
+}
+
+
+/**
+ * ath5k_set_coverage_class - Set IEEE 802.11 coverage class
+ *
+ * @hw: struct ieee80211_hw pointer
+ * @coverage_class: IEEE 802.11 coverage class number
+ *
+ * Mac80211 callback. Sets slot time, ACK timeout and CTS timeout for given
+ * coverage class. The values are persistent, they are restored after device
+ * reset.
+ */
+static void
+ath5k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
+{
+       struct ath5k_softc *sc = hw->priv;
+
+       mutex_lock(&sc->lock);
+       ath5k_hw_set_coverage_class(sc->ah, coverage_class);
+       mutex_unlock(&sc->lock);
+}
+
+
+static int
+ath5k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
+{
+       struct ath5k_softc *sc = hw->priv;
+
+       if (tx_ant == 1 && rx_ant == 1)
+               ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_A);
+       else if (tx_ant == 2 && rx_ant == 2)
+               ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_B);
+       else if ((tx_ant & 3) == 3 && (rx_ant & 3) == 3)
+               ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_DEFAULT);
+       else
+               return -EINVAL;
+       return 0;
+}
+
+
+static int
+ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
+{
+       struct ath5k_softc *sc = hw->priv;
+
+       switch (sc->ah->ah_ant_mode) {
+       case AR5K_ANTMODE_FIXED_A:
+               *tx_ant = 1; *rx_ant = 1; break;
+       case AR5K_ANTMODE_FIXED_B:
+               *tx_ant = 2; *rx_ant = 2; break;
+       case AR5K_ANTMODE_DEFAULT:
+               *tx_ant = 3; *rx_ant = 3; break;
+       }
+       return 0;
+}
+
+
+const struct ieee80211_ops ath5k_hw_ops = {
+       .tx                     = ath5k_tx,
+       .start                  = ath5k_start,
+       .stop                   = ath5k_stop,
+       .add_interface          = ath5k_add_interface,
+       /* .change_interface    = not implemented */
+       .remove_interface       = ath5k_remove_interface,
+       .config                 = ath5k_config,
+       .bss_info_changed       = ath5k_bss_info_changed,
+       .prepare_multicast      = ath5k_prepare_multicast,
+       .configure_filter       = ath5k_configure_filter,
+       /* .set_tim             = not implemented */
+       .set_key                = ath5k_set_key,
+       /* .update_tkip_key     = not implemented */
+       /* .hw_scan             = not implemented */
+       .sw_scan_start          = ath5k_sw_scan_start,
+       .sw_scan_complete       = ath5k_sw_scan_complete,
+       .get_stats              = ath5k_get_stats,
+       /* .get_tkip_seq        = not implemented */
+       /* .set_frag_threshold  = not implemented */
+       /* .set_rts_threshold   = not implemented */
+       /* .sta_add             = not implemented */
+       /* .sta_remove          = not implemented */
+       /* .sta_notify          = not implemented */
+       .conf_tx                = ath5k_conf_tx,
+       .get_tsf                = ath5k_get_tsf,
+       .set_tsf                = ath5k_set_tsf,
+       .reset_tsf              = ath5k_reset_tsf,
+       /* .tx_last_beacon      = not implemented */
+       /* .ampdu_action        = not needed */
+       .get_survey             = ath5k_get_survey,
+       .set_coverage_class     = ath5k_set_coverage_class,
+       /* .rfkill_poll         = not implemented */
+       /* .flush               = not implemented */
+       /* .channel_switch      = not implemented */
+       /* .napi_poll           = not implemented */
+       .set_antenna            = ath5k_set_antenna,
+       .get_antenna            = ath5k_get_antenna,
+};
index f84afb4..78c26fd 100644 (file)
@@ -609,10 +609,10 @@ done:
 /* Write initial RF gain table to set the RF sensitivity
  * this one works on all RF chips and has nothing to do
  * with gain_F calibration */
-static int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq)
+static int ath5k_hw_rfgain_init(struct ath5k_hw *ah, enum ieee80211_band band)
 {
        const struct ath5k_ini_rfgain *ath5k_rfg;
-       unsigned int i, size;
+       unsigned int i, size, index;
 
        switch (ah->ah_radio) {
        case AR5K_RF5111:
@@ -644,17 +644,11 @@ static int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq)
                return -EINVAL;
        }
 
-       switch (freq) {
-       case AR5K_INI_RFGAIN_2GHZ:
-       case AR5K_INI_RFGAIN_5GHZ:
-               break;
-       default:
-               return -EINVAL;
-       }
+       index = (band == IEEE80211_BAND_2GHZ) ? 1 : 0;
 
        for (i = 0; i < size; i++) {
                AR5K_REG_WAIT(i);
-               ath5k_hw_reg_write(ah, ath5k_rfg[i].rfg_value[freq],
+               ath5k_hw_reg_write(ah, ath5k_rfg[i].rfg_value[index],
                        (u32)ath5k_rfg[i].rfg_register);
        }
 
@@ -1361,20 +1355,7 @@ void ath5k_hw_update_noise_floor(struct ath5k_hw *ah)
                return;
        }
 
-       switch (ah->ah_current_channel->hw_value & CHANNEL_MODES) {
-       case CHANNEL_A:
-       case CHANNEL_XR:
-               ee_mode = AR5K_EEPROM_MODE_11A;
-               break;
-       case CHANNEL_G:
-               ee_mode = AR5K_EEPROM_MODE_11G;
-               break;
-       default:
-       case CHANNEL_B:
-               ee_mode = AR5K_EEPROM_MODE_11B;
-               break;
-       }
-
+       ee_mode = ath5k_eeprom_mode_from_channel(ah->ah_current_channel);
 
        /* completed NF calibration, test threshold */
        nf = ath5k_hw_read_measured_noise_floor(ah);
@@ -1935,7 +1916,8 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
        struct ieee80211_channel *channel = ah->ah_current_channel;
        bool use_def_for_tx, update_def_on_tx, use_def_for_rts, fast_div;
        bool use_def_for_sg;
-       u8 def_ant, tx_ant, ee_mode;
+       int ee_mode;
+       u8 def_ant, tx_ant;
        u32 sta_id1 = 0;
 
        /* if channel is not initialized yet we can't set the antennas
@@ -1947,18 +1929,8 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
 
        def_ant = ah->ah_def_ant;
 
-       switch (channel->hw_value & CHANNEL_MODES) {
-       case CHANNEL_A:
-       case CHANNEL_XR:
-               ee_mode = AR5K_EEPROM_MODE_11A;
-               break;
-       case CHANNEL_G:
-               ee_mode = AR5K_EEPROM_MODE_11G;
-               break;
-       case CHANNEL_B:
-               ee_mode = AR5K_EEPROM_MODE_11B;
-               break;
-       default:
+       ee_mode = ath5k_eeprom_mode_from_channel(channel);
+       if (ee_mode < 0) {
                ATH5K_ERR(ah->ah_sc,
                        "invalid channel: %d\n", channel->center_freq);
                return;
@@ -2593,7 +2565,7 @@ ath5k_combine_linear_pcdac_curves(struct ath5k_hw *ah, s16* table_min,
 
 /* Write PCDAC values on hw */
 static void
-ath5k_setup_pcdac_table(struct ath5k_hw *ah)
+ath5k_write_pcdac_table(struct ath5k_hw *ah)
 {
        u8      *pcdac_out = ah->ah_txpower.txp_pd_table;
        int     i;
@@ -2742,7 +2714,7 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah,
 
 /* Write PDADC values on hw */
 static void
-ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode)
+ath5k_write_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode)
 {
        struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
        u8 *pdadc_out = ah->ah_txpower.txp_pd_table;
@@ -2957,8 +2929,7 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah,
                                        (s16) pcinfo_R->freq,
                                        pcinfo_L->max_pwr, pcinfo_R->max_pwr);
 
-       /* We are ready to go, fill PCDAC/PDADC
-        * table and write settings on hardware */
+       /* Fill PCDAC/PDADC table */
        switch (type) {
        case AR5K_PWRTABLE_LINEAR_PCDAC:
                /* For RF5112 we can have one or two curves
@@ -2971,9 +2942,6 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah,
                 * match max power value with max
                 * table index */
                ah->ah_txpower.txp_offset = 64 - (table_max[0] / 2);
-
-               /* Write settings on hw */
-               ath5k_setup_pcdac_table(ah);
                break;
        case AR5K_PWRTABLE_PWR_TO_PCDAC:
                /* We are done for RF5111 since it has only
@@ -2983,9 +2951,6 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah,
                /* No rate powertable adjustment for RF5111 */
                ah->ah_txpower.txp_min_idx = 0;
                ah->ah_txpower.txp_offset = 0;
-
-               /* Write settings on hw */
-               ath5k_setup_pcdac_table(ah);
                break;
        case AR5K_PWRTABLE_PWR_TO_PDADC:
                /* Set PDADC boundaries and fill
@@ -2993,9 +2958,6 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah,
                ath5k_combine_pwr_to_pdadc_curves(ah, table_min, table_max,
                                                ee->ee_pd_gains[ee_mode]);
 
-               /* Write settings on hw */
-               ath5k_setup_pwr_to_pdadc_table(ah, ee_mode);
-
                /* Set txp.offset, note that table_min
                 * can be negative */
                ah->ah_txpower.txp_offset = table_min[0];
@@ -3004,9 +2966,20 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah,
                return -EINVAL;
        }
 
+       ah->ah_txpower.txp_setup = true;
+
        return 0;
 }
 
+/* Write power table for current channel to hw */
+static void
+ath5k_write_channel_powertable(struct ath5k_hw *ah, u8 ee_mode, u8 type)
+{
+       if (type == AR5K_PWRTABLE_PWR_TO_PDADC)
+               ath5k_write_pwr_to_pdadc_table(ah, ee_mode);
+       else
+               ath5k_write_pcdac_table(ah);
+}
 
 /*
  * Per-rate tx power setting
@@ -3095,7 +3068,7 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr,
 
        /* Min/max in 0.25dB units */
        ah->ah_txpower.txp_min_pwr = 2 * rates[7];
-       ah->ah_txpower.txp_max_pwr = 2 * rates[0];
+       ah->ah_txpower.txp_cur_pwr = 2 * rates[0];
        ah->ah_txpower.txp_ofdm = rates[7];
 }
 
@@ -3105,9 +3078,11 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr,
  */
 static int
 ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
-               u8 ee_mode, u8 txpower, bool fast)
+                u8 txpower)
 {
        struct ath5k_rate_pcal_info rate_info;
+       struct ieee80211_channel *curr_channel = ah->ah_current_channel;
+       int ee_mode;
        u8 type;
        int ret;
 
@@ -3116,6 +3091,13 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
                return -EINVAL;
        }
 
+       ee_mode = ath5k_eeprom_mode_from_channel(channel);
+       if (ee_mode < 0) {
+               ATH5K_ERR(ah->ah_sc,
+                       "invalid channel: %d\n", channel->center_freq);
+               return -EINVAL;
+       }
+
        /* Initialize TX power table */
        switch (ah->ah_radio) {
        case AR5K_RF5110:
@@ -3138,28 +3120,26 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
                return -EINVAL;
        }
 
-       /* If fast is set it means we are on the same channel/mode
-        * so there is no need to recalculate the powertable, we 'll
-        * just use the cached one */
-       if (!fast) {
+       /*
+        * If we don't change channel/mode skip tx powertable calculation
+        * and use the cached one.
+        */
+       if (!ah->ah_txpower.txp_setup ||
+           (channel->hw_value != curr_channel->hw_value) ||
+           (channel->center_freq != curr_channel->center_freq)) {
                /* Reset TX power values */
                memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
                ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
-               ah->ah_txpower.txp_min_pwr = 0;
-               ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER;
 
                /* Calculate the powertable */
                ret = ath5k_setup_channel_powertable(ah, channel,
                                                        ee_mode, type);
                if (ret)
                        return ret;
-       /* Write cached table on hw */
-       } else if (type == AR5K_PWRTABLE_PWR_TO_PDADC)
-               ath5k_setup_pwr_to_pdadc_table(ah, ee_mode);
-       else
-               ath5k_setup_pcdac_table(ah);
-
+       }
 
+       /* Write table on hw */
+       ath5k_write_channel_powertable(ah, ee_mode, type);
 
        /* Limit max power if we have a CTL available */
        ath5k_get_max_ctl_power(ah, channel);
@@ -3214,31 +3194,10 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
 
 int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
 {
-       /*Just a try M.F.*/
-       struct ieee80211_channel *channel = ah->ah_current_channel;
-       u8 ee_mode;
-
-       switch (channel->hw_value & CHANNEL_MODES) {
-       case CHANNEL_A:
-       case CHANNEL_XR:
-               ee_mode = AR5K_EEPROM_MODE_11A;
-               break;
-       case CHANNEL_G:
-               ee_mode = AR5K_EEPROM_MODE_11G;
-               break;
-       case CHANNEL_B:
-               ee_mode = AR5K_EEPROM_MODE_11B;
-               break;
-       default:
-               ATH5K_ERR(ah->ah_sc,
-                       "invalid channel: %d\n", channel->center_freq);
-               return -EINVAL;
-       }
-
        ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_TXPOWER,
                "changing txpower to %d\n", txpower);
 
-       return ath5k_hw_txpower(ah, channel, ee_mode, txpower, true);
+       return ath5k_hw_txpower(ah, ah->ah_current_channel, txpower);
 }
 
 /*************\
@@ -3246,12 +3205,11 @@ int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
 \*************/
 
 int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
-                               u8 mode, u8 ee_mode, u8 freq, bool fast)
+                     u8 mode, bool fast)
 {
        struct ieee80211_channel *curr_channel;
        int ret, i;
        u32 phy_tst1;
-       bool fast_txp;
        ret = 0;
 
        /*
@@ -3281,17 +3239,6 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
                        return -EIO;
        }
 
-       /*
-        * If we don't change channel/mode skip
-        * tx powertable calculation and use the
-        * cached one.
-        */
-       if ((channel->hw_value == curr_channel->hw_value) &&
-       (channel->center_freq == curr_channel->center_freq))
-               fast_txp = true;
-       else
-               fast_txp = false;
-
        /*
         * Set TX power
         *
@@ -3299,9 +3246,8 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
         * RF buffer settings on 5211/5212+ so that we
         * properly set curve indices.
         */
-       ret = ath5k_hw_txpower(ah, channel, ee_mode,
-                               ah->ah_txpower.txp_max_pwr / 2,
-                               fast_txp);
+       ret = ath5k_hw_txpower(ah, channel, ah->ah_txpower.txp_cur_pwr ?
+                       ah->ah_txpower.txp_cur_pwr / 2 : AR5K_TUNE_MAX_TXPOWER);
        if (ret)
                return ret;
 
@@ -3317,7 +3263,7 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
                 * Write initial RF gain settings
                 * This should work for both 5111/5112
                 */
-               ret = ath5k_hw_rfgain_init(ah, freq);
+               ret = ath5k_hw_rfgain_init(ah, channel->band);
                if (ret)
                        return ret;
 
index bc84aaa..8420689 100644 (file)
@@ -537,7 +537,7 @@ int ath5k_hw_on_hold(struct ath5k_hw *ah)
         * we ingore that flag for PCI-E cards. On PCI cards
         * this flag gets cleared after 64 PCI clocks.
         */
-       bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI;
+       bus_flags = (pdev && pci_is_pcie(pdev)) ? 0 : AR5K_RESET_CTL_PCI;
 
        if (ah->ah_version == AR5K_AR5210) {
                ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU |
@@ -594,7 +594,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
         * we ingore that flag for PCI-E cards. On PCI cards
         * this flag gets cleared after 64 PCI clocks.
         */
-       bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI;
+       bus_flags = (pdev && pci_is_pcie(pdev)) ? 0 : AR5K_RESET_CTL_PCI;
 
        if (ah->ah_version == AR5K_AR5210) {
                ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU |
@@ -866,15 +866,18 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
 }
 
 static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
-               struct ieee80211_channel *channel, u8 ee_mode)
+               struct ieee80211_channel *channel)
 {
        struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
        s16 cck_ofdm_pwr_delta;
+       u8 ee_mode;
 
        /* TODO: Add support for AR5210 EEPROM */
        if (ah->ah_version == AR5K_AR5210)
                return;
 
+       ee_mode = ath5k_eeprom_mode_from_channel(channel);
+
        /* Adjust power delta for channel 14 */
        if (channel->center_freq == 2484)
                cck_ofdm_pwr_delta =
@@ -1020,13 +1023,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                struct ieee80211_channel *channel, bool fast, bool skip_pcu)
 {
        u32 s_seq[10], s_led[3], tsf_up, tsf_lo;
-       u8 mode, freq, ee_mode;
+       u8 mode;
        int i, ret;
 
-       ee_mode = 0;
        tsf_up = 0;
        tsf_lo = 0;
-       freq = 0;
        mode = 0;
 
        /*
@@ -1071,8 +1072,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
        switch (channel->hw_value & CHANNEL_MODES) {
        case CHANNEL_A:
                mode = AR5K_MODE_11A;
-               freq = AR5K_INI_RFGAIN_5GHZ;
-               ee_mode = AR5K_EEPROM_MODE_11A;
                break;
        case CHANNEL_G:
 
@@ -1083,8 +1082,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                }
 
                mode = AR5K_MODE_11G;
-               freq = AR5K_INI_RFGAIN_2GHZ;
-               ee_mode = AR5K_EEPROM_MODE_11G;
                break;
        case CHANNEL_B:
 
@@ -1095,8 +1092,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                }
 
                mode = AR5K_MODE_11B;
-               freq = AR5K_INI_RFGAIN_2GHZ;
-               ee_mode = AR5K_EEPROM_MODE_11B;
                break;
        case CHANNEL_XR:
                if (ah->ah_version == AR5K_AR5211) {
@@ -1105,8 +1100,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                        return -EINVAL;
                }
                mode = AR5K_MODE_XR;
-               freq = AR5K_INI_RFGAIN_5GHZ;
-               ee_mode = AR5K_EEPROM_MODE_11A;
                break;
        default:
                ATH5K_ERR(ah->ah_sc,
@@ -1119,8 +1112,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
         * go on. If it fails continue with a normal reset.
         */
        if (fast) {
-               ret = ath5k_hw_phy_init(ah, channel, mode,
-                                       ee_mode, freq, true);
+               ret = ath5k_hw_phy_init(ah, channel, mode, true);
                if (ret) {
                        ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET,
                                "fast chan change failed, falling back to normal reset\n");
@@ -1217,7 +1209,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
        ath5k_hw_tweak_initval_settings(ah, channel);
 
        /* Commit values from EEPROM */
-       ath5k_hw_commit_eeprom_settings(ah, channel, ee_mode);
+       ath5k_hw_commit_eeprom_settings(ah, channel);
 
 
        /*
@@ -1256,7 +1248,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
        /*
         * Initialize PHY
         */
-       ret = ath5k_hw_phy_init(ah, channel, mode, ee_mode, freq, false);
+       ret = ath5k_hw_phy_init(ah, channel, mode, false);
        if (ret) {
                ATH5K_ERR(ah->ah_sc,
                        "failed to initialize PHY (%i) !\n", ret);
index fdb5a83..f8a7771 100644 (file)
@@ -22,7 +22,7 @@
 
 int modparam_force_new_ani;
 module_param_named(force_new_ani, modparam_force_new_ani, int, 0444);
-MODULE_PARM_DESC(nohwcrypt, "Force new ANI for AR5008, AR9001, AR9002");
+MODULE_PARM_DESC(force_new_ani, "Force new ANI for AR5008, AR9001, AR9002");
 
 /* General hardware code for the A5008/AR9001/AR9002 hadware families */
 
index 7ae66a8..7d68d61 100644 (file)
@@ -203,13 +203,14 @@ static void ar9002_hw_spur_mitigate(struct ath_hw *ah,
        for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
                cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
 
+               if (AR_NO_SPUR == cur_bb_spur)
+                       break;
+
                if (is2GHz)
                        cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_2GHZ;
                else
                        cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_5GHZ;
 
-               if (AR_NO_SPUR == cur_bb_spur)
-                       break;
                cur_bb_spur = cur_bb_spur - freq;
 
                if (IS_CHAN_HT40(chan)) {
index 466d2bf..4819747 100644 (file)
@@ -59,6 +59,8 @@
 
 #define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6))
 
+#define EEPROM_DATA_LEN_9485   1088
+
 static int ar9003_hw_power_interpolate(int32_t x,
                                       int32_t *px, int32_t *py, u_int16_t np);
 
@@ -3368,7 +3370,7 @@ found:
                        "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n",
                        cptr, code, reference, length, major, minor);
                if ((!AR_SREV_9485(ah) && length >= 1024) ||
-                   (AR_SREV_9485(ah) && length >= (4 * 1024))) {
+                   (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485)) {
                        ath_dbg(common, ATH_DBG_EEPROM,
                                "Skipping bad header\n");
                        cptr -= COMP_HDR_LEN;
index b6e4ee4..4ceddbb 100644 (file)
@@ -613,9 +613,9 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
                 * possibly be reviewing the last subframe. AR_CRCErr
                 * is the CRC of the actual data.
                 */
-               if (rxsp->status11 & AR_CRCErr) {
+               if (rxsp->status11 & AR_CRCErr)
                        rxs->rs_status |= ATH9K_RXERR_CRC;
-               } else if (rxsp->status11 & AR_PHYErr) {
+               if (rxsp->status11 & AR_PHYErr) {
                        phyerr = MS(rxsp->status11, AR_PHYErrCode);
                        /*
                         * If we reach a point here where AR_PostDelimCRCErr is
@@ -638,11 +638,12 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
                                rxs->rs_phyerr = phyerr;
                        }
 
-               } else if (rxsp->status11 & AR_DecryptCRCErr) {
+               }
+               if (rxsp->status11 & AR_DecryptCRCErr)
                        rxs->rs_status |= ATH9K_RXERR_DECRYPT;
-               } else if (rxsp->status11 & AR_MichaelErr) {
+               if (rxsp->status11 & AR_MichaelErr)
                        rxs->rs_status |= ATH9K_RXERR_MIC;
-               } else if (rxsp->status11 & AR_KeyMiss)
+               if (rxsp->status11 & AR_KeyMiss)
                        rxs->rs_status |= ATH9K_RXERR_DECRYPT;
        }
 
index 2c31f51..3681caf 100644 (file)
@@ -664,11 +664,13 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz)
 }
 
 extern struct ieee80211_ops ath9k_ops;
-extern int modparam_nohwcrypt;
+extern int ath9k_modparam_nohwcrypt;
 extern int led_blink;
 extern int ath9k_pm_qos_value;
+extern bool is_ath9k_unloaded;
 
 irqreturn_t ath_isr(int irq, void *dev);
+void ath9k_init_crypto(struct ath_softc *sc);
 int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
                    const struct ath_bus_ops *bus_ops);
 void ath9k_deinit_device(struct ath_softc *sc);
index 5e108c0..385ba03 100644 (file)
@@ -566,8 +566,6 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
         * last beacon we received (which may be none).
         */
        dtimperiod = conf->dtim_period;
-       if (dtimperiod <= 0)            /* NB: 0 if not known */
-               dtimperiod = 1;
        dtimcount = conf->dtim_count;
        if (dtimcount >= dtimperiod)    /* NB: sanity check */
                dtimcount = 0;
@@ -575,8 +573,6 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
        cfpcount = 0;
 
        sleepduration = conf->listen_interval * intval;
-       if (sleepduration <= 0)
-               sleepduration = intval;
 
        /*
         * Pull nexttbtt forward to reflect the current
@@ -662,8 +658,7 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
 }
 
 static void ath_beacon_config_adhoc(struct ath_softc *sc,
-                                   struct ath_beacon_config *conf,
-                                   struct ieee80211_vif *vif)
+                                   struct ath_beacon_config *conf)
 {
        struct ath_hw *ah = sc->sc_ah;
        struct ath_common *common = ath9k_hw_common(ah);
@@ -718,18 +713,17 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
        /* Setup the beacon configuration parameters */
        if (vif) {
                struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
-
                iftype = vif->type;
-
                cur_conf->beacon_interval = bss_conf->beacon_int;
                cur_conf->dtim_period = bss_conf->dtim_period;
+       } else {
+               iftype = sc->sc_ah->opmode;
+       }
+
                cur_conf->listen_interval = 1;
                cur_conf->dtim_count = 1;
                cur_conf->bmiss_timeout =
                        ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
-       } else {
-               iftype = sc->sc_ah->opmode;
-       }
 
        /*
         * It looks like mac80211 may end up using beacon interval of zero in
@@ -740,13 +734,20 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
        if (cur_conf->beacon_interval == 0)
                cur_conf->beacon_interval = 100;
 
+       /*
+        * Some times we dont parse dtim period from mac80211, in that case
+        * use a default value
+        */
+       if (cur_conf->dtim_period == 0)
+               cur_conf->dtim_period = 1;
+
        switch (iftype) {
        case NL80211_IFTYPE_AP:
                ath_beacon_config_ap(sc, cur_conf);
                break;
        case NL80211_IFTYPE_ADHOC:
        case NL80211_IFTYPE_MESH_POINT:
-               ath_beacon_config_adhoc(sc, cur_conf, vif);
+               ath_beacon_config_adhoc(sc, cur_conf);
                break;
        case NL80211_IFTYPE_STATION:
                ath_beacon_config_sta(sc, cur_conf);
index f6f09d1..58e2ddc 100644 (file)
@@ -23,8 +23,6 @@
 #include <net/cfg80211.h>
 #include "ar9003_eeprom.h"
 
-#define AH_USE_EEPROM   0x1
-
 #ifdef __BIG_ENDIAN
 #define AR5416_EEPROM_MAGIC 0x5aa5
 #else
index 22b68b3..5ab3084 100644 (file)
@@ -153,16 +153,36 @@ static void hif_usb_tx_cb(struct urb *urb)
        case -ENODEV:
        case -ESHUTDOWN:
                /*
-                * The URB has been killed, free the SKBs
-                * and return.
+                * The URB has been killed, free the SKBs.
                 */
                ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue);
-               return;
+
+               /*
+                * If the URBs are being flushed, no need to add this
+                * URB to the free list.
+                */
+               spin_lock(&hif_dev->tx.tx_lock);
+               if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
+                       spin_unlock(&hif_dev->tx.tx_lock);
+                       return;
+               }
+               spin_unlock(&hif_dev->tx.tx_lock);
+
+               /*
+                * In the stop() case, this URB has to be added to
+                * the free list.
+                */
+               goto add_free;
        default:
                break;
        }
 
-       /* Check if TX has been stopped */
+       /*
+        * Check if TX has been stopped, this is needed because
+        * this CB could have been invoked just after the TX lock
+        * was released in hif_stop() and kill_urb() hasn't been
+        * called yet.
+        */
        spin_lock(&hif_dev->tx.tx_lock);
        if (hif_dev->tx.flags & HIF_USB_TX_STOP) {
                spin_unlock(&hif_dev->tx.tx_lock);
@@ -314,6 +334,7 @@ static void hif_usb_start(void *hif_handle, u8 pipe_id)
 static void hif_usb_stop(void *hif_handle, u8 pipe_id)
 {
        struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle;
+       struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL;
        unsigned long flags;
 
        spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
@@ -321,6 +342,12 @@ static void hif_usb_stop(void *hif_handle, u8 pipe_id)
        hif_dev->tx.tx_skb_cnt = 0;
        hif_dev->tx.flags |= HIF_USB_TX_STOP;
        spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
+
+       /* The pending URBs have to be canceled. */
+       list_for_each_entry_safe(tx_buf, tx_buf_tmp,
+                                &hif_dev->tx.tx_pending, list) {
+               usb_kill_urb(tx_buf->urb);
+       }
 }
 
 static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb,
@@ -587,6 +614,7 @@ free:
 static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)
 {
        struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL;
+       unsigned long flags;
 
        list_for_each_entry_safe(tx_buf, tx_buf_tmp,
                                 &hif_dev->tx.tx_buf, list) {
@@ -597,6 +625,10 @@ static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)
                kfree(tx_buf);
        }
 
+       spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
+       hif_dev->tx.flags |= HIF_USB_TX_FLUSH;
+       spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
+
        list_for_each_entry_safe(tx_buf, tx_buf_tmp,
                                 &hif_dev->tx.tx_pending, list) {
                usb_kill_urb(tx_buf->urb);
@@ -993,16 +1025,16 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
 {
        struct usb_device *udev = interface_to_usbdev(interface);
        struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
+       bool unplugged = (udev->state == USB_STATE_NOTATTACHED) ? true : false;
 
        if (hif_dev) {
-               ath9k_htc_hw_deinit(hif_dev->htc_handle,
-                   (udev->state == USB_STATE_NOTATTACHED) ? true : false);
+               ath9k_htc_hw_deinit(hif_dev->htc_handle, unplugged);
                ath9k_htc_hw_free(hif_dev->htc_handle);
                ath9k_hif_usb_dev_deinit(hif_dev);
                usb_set_intfdata(interface, NULL);
        }
 
-       if (hif_dev->flags & HIF_USB_START)
+       if (!unplugged && (hif_dev->flags & HIF_USB_START))
                ath9k_hif_usb_reboot(udev);
 
        kfree(hif_dev);
index e4a5e2e..7b9d863 100644 (file)
@@ -64,6 +64,7 @@ struct tx_buf {
 };
 
 #define HIF_USB_TX_STOP  BIT(0)
+#define HIF_USB_TX_FLUSH BIT(1)
 
 struct hif_usb_tx {
        u8 flags;
index fdf9d5f..a099b3e 100644 (file)
@@ -331,17 +331,15 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv *priv);
 
 #define OP_INVALID                BIT(0)
 #define OP_SCANNING               BIT(1)
-#define OP_FULL_RESET             BIT(2)
-#define OP_LED_ASSOCIATED         BIT(3)
-#define OP_LED_ON                 BIT(4)
-#define OP_PREAMBLE_SHORT         BIT(5)
-#define OP_PROTECT_ENABLE         BIT(6)
-#define OP_ASSOCIATED             BIT(7)
-#define OP_ENABLE_BEACON          BIT(8)
-#define OP_LED_DEINIT             BIT(9)
-#define OP_UNPLUGGED              BIT(10)
-#define OP_BT_PRIORITY_DETECTED           BIT(11)
-#define OP_BT_SCAN                BIT(12)
+#define OP_LED_ASSOCIATED         BIT(2)
+#define OP_LED_ON                 BIT(3)
+#define OP_PREAMBLE_SHORT         BIT(4)
+#define OP_PROTECT_ENABLE         BIT(5)
+#define OP_ASSOCIATED             BIT(6)
+#define OP_ENABLE_BEACON          BIT(7)
+#define OP_LED_DEINIT             BIT(8)
+#define OP_BT_PRIORITY_DETECTED    BIT(9)
+#define OP_BT_SCAN                 BIT(10)
 
 struct ath9k_htc_priv {
        struct device *dev;
@@ -378,7 +376,7 @@ struct ath9k_htc_priv {
        struct ieee80211_vif *vif;
        struct htc_beacon_config cur_beacon_conf;
        unsigned int rxfilter;
-       struct tasklet_struct wmi_tasklet;
+       struct tasklet_struct swba_tasklet;
        struct tasklet_struct rx_tasklet;
        struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
        struct ath9k_htc_rx rx;
@@ -386,6 +384,7 @@ struct ath9k_htc_priv {
        struct sk_buff_head tx_queue;
        struct delayed_work ath9k_ani_work;
        struct work_struct ps_work;
+       struct work_struct fatal_work;
 
        struct mutex htc_pm_lock;
        unsigned long ps_usecount;
@@ -420,6 +419,8 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz)
        common->bus_ops->read_cachesize(common, csz);
 }
 
+void ath9k_htc_reset(struct ath9k_htc_priv *priv);
+
 void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv);
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
                             struct ieee80211_vif *vif);
@@ -435,6 +436,7 @@ void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
 void ath9k_htc_station_work(struct work_struct *work);
 void ath9k_htc_aggr_work(struct work_struct *work);
 void ath9k_ani_work(struct work_struct *work);;
+void ath_start_ani(struct ath9k_htc_priv *priv);
 
 int ath9k_tx_init(struct ath9k_htc_priv *priv);
 void ath9k_tx_tasklet(unsigned long data);
@@ -457,8 +459,13 @@ void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv);
 void ath9k_ps_work(struct work_struct *work);
 bool ath9k_htc_setpower(struct ath9k_htc_priv *priv,
                        enum ath9k_power_mode mode);
+void ath_update_txpow(struct ath9k_htc_priv *priv);
 
 void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv);
+void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw);
+void ath9k_htc_radio_enable(struct ieee80211_hw *hw);
+void ath9k_htc_radio_disable(struct ieee80211_hw *hw);
+void ath9k_led_stop_brightness(struct ath9k_htc_priv *priv);
 void ath9k_init_leds(struct ath9k_htc_priv *priv);
 void ath9k_deinit_leds(struct ath9k_htc_priv *priv);
 
index 283ff97..fe70f67 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2010 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
 #include "htc.h"
 
 /******************/
@@ -131,3 +147,314 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv *priv)
        cancel_delayed_work_sync(&priv->coex_period_work);
        cancel_delayed_work_sync(&priv->duty_cycle_work);
 }
+
+/*******/
+/* LED */
+/*******/
+
+static void ath9k_led_blink_work(struct work_struct *work)
+{
+       struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv,
+                                                  ath9k_led_blink_work.work);
+
+       if (!(priv->op_flags & OP_LED_ASSOCIATED))
+               return;
+
+       if ((priv->led_on_duration == ATH_LED_ON_DURATION_IDLE) ||
+           (priv->led_off_duration == ATH_LED_OFF_DURATION_IDLE))
+               ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 0);
+       else
+               ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin,
+                                 (priv->op_flags & OP_LED_ON) ? 1 : 0);
+
+       ieee80211_queue_delayed_work(priv->hw,
+                                    &priv->ath9k_led_blink_work,
+                                    (priv->op_flags & OP_LED_ON) ?
+                                    msecs_to_jiffies(priv->led_off_duration) :
+                                    msecs_to_jiffies(priv->led_on_duration));
+
+       priv->led_on_duration = priv->led_on_cnt ?
+               max((ATH_LED_ON_DURATION_IDLE - priv->led_on_cnt), 25) :
+               ATH_LED_ON_DURATION_IDLE;
+       priv->led_off_duration = priv->led_off_cnt ?
+               max((ATH_LED_OFF_DURATION_IDLE - priv->led_off_cnt), 10) :
+               ATH_LED_OFF_DURATION_IDLE;
+       priv->led_on_cnt = priv->led_off_cnt = 0;
+
+       if (priv->op_flags & OP_LED_ON)
+               priv->op_flags &= ~OP_LED_ON;
+       else
+               priv->op_flags |= OP_LED_ON;
+}
+
+static void ath9k_led_brightness_work(struct work_struct *work)
+{
+       struct ath_led *led = container_of(work, struct ath_led,
+                                          brightness_work.work);
+       struct ath9k_htc_priv *priv = led->priv;
+
+       switch (led->brightness) {
+       case LED_OFF:
+               if (led->led_type == ATH_LED_ASSOC ||
+                   led->led_type == ATH_LED_RADIO) {
+                       ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin,
+                                         (led->led_type == ATH_LED_RADIO));
+                       priv->op_flags &= ~OP_LED_ASSOCIATED;
+                       if (led->led_type == ATH_LED_RADIO)
+                               priv->op_flags &= ~OP_LED_ON;
+               } else {
+                       priv->led_off_cnt++;
+               }
+               break;
+       case LED_FULL:
+               if (led->led_type == ATH_LED_ASSOC) {
+                       priv->op_flags |= OP_LED_ASSOCIATED;
+                       ieee80211_queue_delayed_work(priv->hw,
+                                            &priv->ath9k_led_blink_work, 0);
+               } else if (led->led_type == ATH_LED_RADIO) {
+                       ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 0);
+                       priv->op_flags |= OP_LED_ON;
+               } else {
+                       priv->led_on_cnt++;
+               }
+               break;
+       default:
+               break;
+       }
+}
+
+static void ath9k_led_brightness(struct led_classdev *led_cdev,
+                                enum led_brightness brightness)
+{
+       struct ath_led *led = container_of(led_cdev, struct ath_led, led_cdev);
+       struct ath9k_htc_priv *priv = led->priv;
+
+       led->brightness = brightness;
+       if (!(priv->op_flags & OP_LED_DEINIT))
+               ieee80211_queue_delayed_work(priv->hw,
+                                            &led->brightness_work, 0);
+}
+
+void ath9k_led_stop_brightness(struct ath9k_htc_priv *priv)
+{
+       cancel_delayed_work_sync(&priv->radio_led.brightness_work);
+       cancel_delayed_work_sync(&priv->assoc_led.brightness_work);
+       cancel_delayed_work_sync(&priv->tx_led.brightness_work);
+       cancel_delayed_work_sync(&priv->rx_led.brightness_work);
+}
+
+static int ath9k_register_led(struct ath9k_htc_priv *priv, struct ath_led *led,
+                             char *trigger)
+{
+       int ret;
+
+       led->priv = priv;
+       led->led_cdev.name = led->name;
+       led->led_cdev.default_trigger = trigger;
+       led->led_cdev.brightness_set = ath9k_led_brightness;
+
+       ret = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_cdev);
+       if (ret)
+               ath_err(ath9k_hw_common(priv->ah),
+                       "Failed to register led:%s", led->name);
+       else
+               led->registered = 1;
+
+       INIT_DELAYED_WORK(&led->brightness_work, ath9k_led_brightness_work);
+
+       return ret;
+}
+
+static void ath9k_unregister_led(struct ath_led *led)
+{
+       if (led->registered) {
+               led_classdev_unregister(&led->led_cdev);
+               led->registered = 0;
+       }
+}
+
+void ath9k_deinit_leds(struct ath9k_htc_priv *priv)
+{
+       priv->op_flags |= OP_LED_DEINIT;
+       ath9k_unregister_led(&priv->assoc_led);
+       priv->op_flags &= ~OP_LED_ASSOCIATED;
+       ath9k_unregister_led(&priv->tx_led);
+       ath9k_unregister_led(&priv->rx_led);
+       ath9k_unregister_led(&priv->radio_led);
+}
+
+void ath9k_init_leds(struct ath9k_htc_priv *priv)
+{
+       char *trigger;
+       int ret;
+
+       if (AR_SREV_9287(priv->ah))
+               priv->ah->led_pin = ATH_LED_PIN_9287;
+       else if (AR_SREV_9271(priv->ah))
+               priv->ah->led_pin = ATH_LED_PIN_9271;
+       else if (AR_DEVID_7010(priv->ah))
+               priv->ah->led_pin = ATH_LED_PIN_7010;
+       else
+               priv->ah->led_pin = ATH_LED_PIN_DEF;
+
+       /* Configure gpio 1 for output */
+       ath9k_hw_cfg_output(priv->ah, priv->ah->led_pin,
+                           AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
+       /* LED off, active low */
+       ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 1);
+
+       INIT_DELAYED_WORK(&priv->ath9k_led_blink_work, ath9k_led_blink_work);
+
+       trigger = ieee80211_get_radio_led_name(priv->hw);
+       snprintf(priv->radio_led.name, sizeof(priv->radio_led.name),
+               "ath9k-%s::radio", wiphy_name(priv->hw->wiphy));
+       ret = ath9k_register_led(priv, &priv->radio_led, trigger);
+       priv->radio_led.led_type = ATH_LED_RADIO;
+       if (ret)
+               goto fail;
+
+       trigger = ieee80211_get_assoc_led_name(priv->hw);
+       snprintf(priv->assoc_led.name, sizeof(priv->assoc_led.name),
+               "ath9k-%s::assoc", wiphy_name(priv->hw->wiphy));
+       ret = ath9k_register_led(priv, &priv->assoc_led, trigger);
+       priv->assoc_led.led_type = ATH_LED_ASSOC;
+       if (ret)
+               goto fail;
+
+       trigger = ieee80211_get_tx_led_name(priv->hw);
+       snprintf(priv->tx_led.name, sizeof(priv->tx_led.name),
+               "ath9k-%s::tx", wiphy_name(priv->hw->wiphy));
+       ret = ath9k_register_led(priv, &priv->tx_led, trigger);
+       priv->tx_led.led_type = ATH_LED_TX;
+       if (ret)
+               goto fail;
+
+       trigger = ieee80211_get_rx_led_name(priv->hw);
+       snprintf(priv->rx_led.name, sizeof(priv->rx_led.name),
+               "ath9k-%s::rx", wiphy_name(priv->hw->wiphy));
+       ret = ath9k_register_led(priv, &priv->rx_led, trigger);
+       priv->rx_led.led_type = ATH_LED_RX;
+       if (ret)
+               goto fail;
+
+       priv->op_flags &= ~OP_LED_DEINIT;
+
+       return;
+
+fail:
+       cancel_delayed_work_sync(&priv->ath9k_led_blink_work);
+       ath9k_deinit_leds(priv);
+}
+
+/*******************/
+/*     Rfkill     */
+/*******************/
+
+static bool ath_is_rfkill_set(struct ath9k_htc_priv *priv)
+{
+       return ath9k_hw_gpio_get(priv->ah, priv->ah->rfkill_gpio) ==
+               priv->ah->rfkill_polarity;
+}
+
+void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw)
+{
+       struct ath9k_htc_priv *priv = hw->priv;
+       bool blocked = !!ath_is_rfkill_set(priv);
+
+       wiphy_rfkill_set_hw_state(hw->wiphy, blocked);
+}
+
+void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv)
+{
+       if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
+               wiphy_rfkill_start_polling(priv->hw->wiphy);
+}
+
+void ath9k_htc_radio_enable(struct ieee80211_hw *hw)
+{
+       struct ath9k_htc_priv *priv = hw->priv;
+       struct ath_hw *ah = priv->ah;
+       struct ath_common *common = ath9k_hw_common(ah);
+       int ret;
+       u8 cmd_rsp;
+
+       if (!ah->curchan)
+               ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
+
+       /* Reset the HW */
+       ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
+       if (ret) {
+               ath_err(common,
+                       "Unable to reset hardware; reset status %d (freq %u MHz)\n",
+                       ret, ah->curchan->channel);
+       }
+
+       ath_update_txpow(priv);
+
+       /* Start RX */
+       WMI_CMD(WMI_START_RECV_CMDID);
+       ath9k_host_rx_init(priv);
+
+       /* Start TX */
+       htc_start(priv->htc);
+       spin_lock_bh(&priv->tx_lock);
+       priv->tx_queues_stop = false;
+       spin_unlock_bh(&priv->tx_lock);
+       ieee80211_wake_queues(hw);
+
+       WMI_CMD(WMI_ENABLE_INTR_CMDID);
+
+       /* Enable LED */
+       ath9k_hw_cfg_output(ah, ah->led_pin,
+                           AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
+       ath9k_hw_set_gpio(ah, ah->led_pin, 0);
+}
+
+void ath9k_htc_radio_disable(struct ieee80211_hw *hw)
+{
+       struct ath9k_htc_priv *priv = hw->priv;
+       struct ath_hw *ah = priv->ah;
+       struct ath_common *common = ath9k_hw_common(ah);
+       int ret;
+       u8 cmd_rsp;
+
+       ath9k_htc_ps_wakeup(priv);
+
+       /* Disable LED */
+       ath9k_hw_set_gpio(ah, ah->led_pin, 1);
+       ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
+
+       WMI_CMD(WMI_DISABLE_INTR_CMDID);
+
+       /* Stop TX */
+       ieee80211_stop_queues(hw);
+       htc_stop(priv->htc);
+       WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
+       skb_queue_purge(&priv->tx_queue);
+
+       /* Stop RX */
+       WMI_CMD(WMI_STOP_RECV_CMDID);
+
+       /*
+        * The MIB counters have to be disabled here,
+        * since the target doesn't do it.
+        */
+       ath9k_hw_disable_mib_counters(ah);
+
+       if (!ah->curchan)
+               ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
+
+       /* Reset the HW */
+       ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
+       if (ret) {
+               ath_err(common,
+                       "Unable to reset hardware; reset status %d (freq %u MHz)\n",
+                       ret, ah->curchan->channel);
+       }
+
+       /* Disable the PHY */
+       ath9k_hw_phy_disable(ah);
+
+       ath9k_htc_ps_restore(priv);
+       ath9k_htc_setpower(priv, ATH9K_PM_FULL_SLEEP);
+}
index 0f6be35..38433f9 100644 (file)
@@ -142,7 +142,7 @@ static void ath9k_deinit_priv(struct ath9k_htc_priv *priv)
 {
        ath9k_htc_exit_debug(priv->ah);
        ath9k_hw_deinit(priv->ah);
-       tasklet_kill(&priv->wmi_tasklet);
+       tasklet_kill(&priv->swba_tasklet);
        tasklet_kill(&priv->rx_tasklet);
        tasklet_kill(&priv->tx_tasklet);
        kfree(priv->ah);
@@ -647,13 +647,15 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
        spin_lock_init(&priv->tx_lock);
        mutex_init(&priv->mutex);
        mutex_init(&priv->htc_pm_lock);
-       tasklet_init(&priv->wmi_tasklet, ath9k_wmi_tasklet,
+       tasklet_init(&priv->swba_tasklet, ath9k_swba_tasklet,
                     (unsigned long)priv);
        tasklet_init(&priv->rx_tasklet, ath9k_rx_tasklet,
                     (unsigned long)priv);
-       tasklet_init(&priv->tx_tasklet, ath9k_tx_tasklet, (unsigned long)priv);
+       tasklet_init(&priv->tx_tasklet, ath9k_tx_tasklet,
+                    (unsigned long)priv);
        INIT_DELAYED_WORK(&priv->ath9k_ani_work, ath9k_ani_work);
        INIT_WORK(&priv->ps_work, ath9k_ps_work);
+       INIT_WORK(&priv->fatal_work, ath9k_fatal_work);
 
        /*
         * Cache line size is used to size and align various
@@ -714,8 +716,7 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
                IEEE80211_HW_HAS_RATE_CONTROL |
                IEEE80211_HW_RX_INCLUDES_FCS |
                IEEE80211_HW_SUPPORTS_PS |
-               IEEE80211_HW_PS_NULLFUNC_STACK |
-               IEEE80211_HW_NEED_DTIM_PERIOD;
+               IEEE80211_HW_PS_NULLFUNC_STACK;
 
        hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_STATION) |
@@ -851,9 +852,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,
        if (ret)
                goto err_init;
 
-       /* The device may have been unplugged earlier. */
-       priv->op_flags &= ~OP_UNPLUGGED;
-
        ret = ath9k_init_device(priv, devid, product, drv_info);
        if (ret)
                goto err_init;
@@ -873,7 +871,7 @@ void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug)
 
                /* Check if the device has been yanked out. */
                if (hotunplug)
-                       htc_handle->drv_priv->op_flags |= OP_UNPLUGGED;
+                       htc_handle->drv_priv->ah->ah_flags |= AH_UNPLUGGED;
 
                ath9k_deinit_device(htc_handle->drv_priv);
                ath9k_deinit_wmi(htc_handle->drv_priv);
index dd17909..845b4c9 100644 (file)
@@ -24,7 +24,7 @@ static struct dentry *ath9k_debugfs_root;
 /* Utilities */
 /*************/
 
-static void ath_update_txpow(struct ath9k_htc_priv *priv)
+void ath_update_txpow(struct ath9k_htc_priv *priv)
 {
        struct ath_hw *ah = priv->ah;
 
@@ -116,6 +116,60 @@ void ath9k_ps_work(struct work_struct *work)
        ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP);
 }
 
+void ath9k_htc_reset(struct ath9k_htc_priv *priv)
+{
+       struct ath_hw *ah = priv->ah;
+       struct ath_common *common = ath9k_hw_common(ah);
+       struct ieee80211_channel *channel = priv->hw->conf.channel;
+       struct ath9k_hw_cal_data *caldata;
+       enum htc_phymode mode;
+       __be16 htc_mode;
+       u8 cmd_rsp;
+       int ret;
+
+       mutex_lock(&priv->mutex);
+       ath9k_htc_ps_wakeup(priv);
+
+       if (priv->op_flags & OP_ASSOCIATED)
+               cancel_delayed_work_sync(&priv->ath9k_ani_work);
+
+       ieee80211_stop_queues(priv->hw);
+       htc_stop(priv->htc);
+       WMI_CMD(WMI_DISABLE_INTR_CMDID);
+       WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
+       WMI_CMD(WMI_STOP_RECV_CMDID);
+
+       caldata = &priv->caldata[channel->hw_value];
+       ret = ath9k_hw_reset(ah, ah->curchan, caldata, false);
+       if (ret) {
+               ath_err(common,
+                       "Unable to reset device (%u Mhz) reset status %d\n",
+                       channel->center_freq, ret);
+       }
+
+       ath_update_txpow(priv);
+
+       WMI_CMD(WMI_START_RECV_CMDID);
+       ath9k_host_rx_init(priv);
+
+       mode = ath9k_htc_get_curmode(priv, ah->curchan);
+       htc_mode = cpu_to_be16(mode);
+       WMI_CMD_BUF(WMI_SET_MODE_CMDID, &htc_mode);
+
+       WMI_CMD(WMI_ENABLE_INTR_CMDID);
+       htc_start(priv->htc);
+
+       if (priv->op_flags & OP_ASSOCIATED) {
+               ath9k_htc_beacon_config(priv, priv->vif);
+               ath_start_ani(priv);
+       }
+
+       ieee80211_wake_queues(priv->hw);
+
+       ath9k_htc_ps_restore(priv);
+       mutex_unlock(&priv->mutex);
+}
+
 static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
                                 struct ieee80211_hw *hw,
                                 struct ath9k_channel *hchan)
@@ -123,7 +177,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
        struct ath_hw *ah = priv->ah;
        struct ath_common *common = ath9k_hw_common(ah);
        struct ieee80211_conf *conf = &common->hw->conf;
-       bool fastcc = true;
+       bool fastcc;
        struct ieee80211_channel *channel = hw->conf.channel;
        struct ath9k_hw_cal_data *caldata;
        enum htc_phymode mode;
@@ -134,8 +188,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
        if (priv->op_flags & OP_INVALID)
                return -EIO;
 
-       if (priv->op_flags & OP_FULL_RESET)
-               fastcc = false;
+       fastcc = !!(hw->conf.flags & IEEE80211_CONF_OFFCHANNEL);
 
        ath9k_htc_ps_wakeup(priv);
        htc_stop(priv->htc);
@@ -177,23 +230,43 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
                goto err;
 
        htc_start(priv->htc);
-
-       priv->op_flags &= ~OP_FULL_RESET;
 err:
        ath9k_htc_ps_restore(priv);
        return ret;
 }
 
+static void __ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv)
+{
+       struct ath_common *common = ath9k_hw_common(priv->ah);
+       struct ath9k_htc_target_vif hvif;
+       int ret = 0;
+       u8 cmd_rsp;
+
+       memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
+       memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
+       hvif.index = 0; /* Should do for now */
+       WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
+       priv->nvifs--;
+}
+
 static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv)
 {
        struct ath_common *common = ath9k_hw_common(priv->ah);
        struct ath9k_htc_target_vif hvif;
+       struct ath9k_htc_target_sta tsta;
        int ret = 0;
        u8 cmd_rsp;
 
        if (priv->nvifs > 0)
                return -ENOBUFS;
 
+       if (priv->nstations >= ATH9K_HTC_MAX_STA)
+               return -ENOBUFS;
+
+       /*
+        * Add an interface.
+        */
+
        memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
        memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
 
@@ -206,23 +279,57 @@ static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv)
                return ret;
 
        priv->nvifs++;
+
+       /*
+        * Associate a station with the interface for packet injection.
+        */
+
+       memset(&tsta, 0, sizeof(struct ath9k_htc_target_sta));
+
+       memcpy(&tsta.macaddr, common->macaddr, ETH_ALEN);
+
+       tsta.is_vif_sta = 1;
+       tsta.sta_index = priv->nstations;
+       tsta.vif_index = hvif.index;
+       tsta.maxampdu = 0xffff;
+
+       WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta);
+       if (ret) {
+               ath_err(common, "Unable to add station entry for monitor mode\n");
+               goto err_vif;
+       }
+
+       priv->nstations++;
+
        return 0;
+
+err_vif:
+       /*
+        * Remove the interface from the target.
+        */
+       __ath9k_htc_remove_monitor_interface(priv);
+       return ret;
 }
 
 static int ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv)
 {
        struct ath_common *common = ath9k_hw_common(priv->ah);
-       struct ath9k_htc_target_vif hvif;
        int ret = 0;
-       u8 cmd_rsp;
+       u8 cmd_rsp, sta_idx;
 
-       memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
-       memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
-       hvif.index = 0; /* Should do for now */
-       WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
-       priv->nvifs--;
+       __ath9k_htc_remove_monitor_interface(priv);
 
-       return ret;
+       sta_idx = 0; /* Only single interface, for now */
+
+       WMI_CMD_BUF(WMI_NODE_REMOVE_CMDID, &sta_idx);
+       if (ret) {
+               ath_err(common, "Unable to remove station entry for monitor mode\n");
+               return ret;
+       }
+
+       priv->nstations--;
+
+       return 0;
 }
 
 static int ath9k_htc_add_station(struct ath9k_htc_priv *priv,
@@ -690,7 +797,7 @@ void ath9k_htc_debug_remove_root(void)
 /* ANI */
 /*******/
 
-static void ath_start_ani(struct ath9k_htc_priv *priv)
+void ath_start_ani(struct ath9k_htc_priv *priv)
 {
        struct ath_common *common = ath9k_hw_common(priv->ah);
        unsigned long timestamp = jiffies_to_msecs(jiffies);
@@ -789,317 +896,6 @@ set_timer:
                                     msecs_to_jiffies(cal_interval));
 }
 
-/*******/
-/* LED */
-/*******/
-
-static void ath9k_led_blink_work(struct work_struct *work)
-{
-       struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv,
-                                                  ath9k_led_blink_work.work);
-
-       if (!(priv->op_flags & OP_LED_ASSOCIATED))
-               return;
-
-       if ((priv->led_on_duration == ATH_LED_ON_DURATION_IDLE) ||
-           (priv->led_off_duration == ATH_LED_OFF_DURATION_IDLE))
-               ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 0);
-       else
-               ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin,
-                                 (priv->op_flags & OP_LED_ON) ? 1 : 0);
-
-       ieee80211_queue_delayed_work(priv->hw,
-                                    &priv->ath9k_led_blink_work,
-                                    (priv->op_flags & OP_LED_ON) ?
-                                    msecs_to_jiffies(priv->led_off_duration) :
-                                    msecs_to_jiffies(priv->led_on_duration));
-
-       priv->led_on_duration = priv->led_on_cnt ?
-               max((ATH_LED_ON_DURATION_IDLE - priv->led_on_cnt), 25) :
-               ATH_LED_ON_DURATION_IDLE;
-       priv->led_off_duration = priv->led_off_cnt ?
-               max((ATH_LED_OFF_DURATION_IDLE - priv->led_off_cnt), 10) :
-               ATH_LED_OFF_DURATION_IDLE;
-       priv->led_on_cnt = priv->led_off_cnt = 0;
-
-       if (priv->op_flags & OP_LED_ON)
-               priv->op_flags &= ~OP_LED_ON;
-       else
-               priv->op_flags |= OP_LED_ON;
-}
-
-static void ath9k_led_brightness_work(struct work_struct *work)
-{
-       struct ath_led *led = container_of(work, struct ath_led,
-                                          brightness_work.work);
-       struct ath9k_htc_priv *priv = led->priv;
-
-       switch (led->brightness) {
-       case LED_OFF:
-               if (led->led_type == ATH_LED_ASSOC ||
-                   led->led_type == ATH_LED_RADIO) {
-                       ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin,
-                                         (led->led_type == ATH_LED_RADIO));
-                       priv->op_flags &= ~OP_LED_ASSOCIATED;
-                       if (led->led_type == ATH_LED_RADIO)
-                               priv->op_flags &= ~OP_LED_ON;
-               } else {
-                       priv->led_off_cnt++;
-               }
-               break;
-       case LED_FULL:
-               if (led->led_type == ATH_LED_ASSOC) {
-                       priv->op_flags |= OP_LED_ASSOCIATED;
-                       ieee80211_queue_delayed_work(priv->hw,
-                                            &priv->ath9k_led_blink_work, 0);
-               } else if (led->led_type == ATH_LED_RADIO) {
-                       ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 0);
-                       priv->op_flags |= OP_LED_ON;
-               } else {
-                       priv->led_on_cnt++;
-               }
-               break;
-       default:
-               break;
-       }
-}
-
-static void ath9k_led_brightness(struct led_classdev *led_cdev,
-                                enum led_brightness brightness)
-{
-       struct ath_led *led = container_of(led_cdev, struct ath_led, led_cdev);
-       struct ath9k_htc_priv *priv = led->priv;
-
-       led->brightness = brightness;
-       if (!(priv->op_flags & OP_LED_DEINIT))
-               ieee80211_queue_delayed_work(priv->hw,
-                                            &led->brightness_work, 0);
-}
-
-static void ath9k_led_stop_brightness(struct ath9k_htc_priv *priv)
-{
-       cancel_delayed_work_sync(&priv->radio_led.brightness_work);
-       cancel_delayed_work_sync(&priv->assoc_led.brightness_work);
-       cancel_delayed_work_sync(&priv->tx_led.brightness_work);
-       cancel_delayed_work_sync(&priv->rx_led.brightness_work);
-}
-
-static int ath9k_register_led(struct ath9k_htc_priv *priv, struct ath_led *led,
-                             char *trigger)
-{
-       int ret;
-
-       led->priv = priv;
-       led->led_cdev.name = led->name;
-       led->led_cdev.default_trigger = trigger;
-       led->led_cdev.brightness_set = ath9k_led_brightness;
-
-       ret = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_cdev);
-       if (ret)
-               ath_err(ath9k_hw_common(priv->ah),
-                       "Failed to register led:%s", led->name);
-       else
-               led->registered = 1;
-
-       INIT_DELAYED_WORK(&led->brightness_work, ath9k_led_brightness_work);
-
-       return ret;
-}
-
-static void ath9k_unregister_led(struct ath_led *led)
-{
-       if (led->registered) {
-               led_classdev_unregister(&led->led_cdev);
-               led->registered = 0;
-       }
-}
-
-void ath9k_deinit_leds(struct ath9k_htc_priv *priv)
-{
-       priv->op_flags |= OP_LED_DEINIT;
-       ath9k_unregister_led(&priv->assoc_led);
-       priv->op_flags &= ~OP_LED_ASSOCIATED;
-       ath9k_unregister_led(&priv->tx_led);
-       ath9k_unregister_led(&priv->rx_led);
-       ath9k_unregister_led(&priv->radio_led);
-}
-
-void ath9k_init_leds(struct ath9k_htc_priv *priv)
-{
-       char *trigger;
-       int ret;
-
-       if (AR_SREV_9287(priv->ah))
-               priv->ah->led_pin = ATH_LED_PIN_9287;
-       else if (AR_SREV_9271(priv->ah))
-               priv->ah->led_pin = ATH_LED_PIN_9271;
-       else if (AR_DEVID_7010(priv->ah))
-               priv->ah->led_pin = ATH_LED_PIN_7010;
-       else
-               priv->ah->led_pin = ATH_LED_PIN_DEF;
-
-       /* Configure gpio 1 for output */
-       ath9k_hw_cfg_output(priv->ah, priv->ah->led_pin,
-                           AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
-       /* LED off, active low */
-       ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin, 1);
-
-       INIT_DELAYED_WORK(&priv->ath9k_led_blink_work, ath9k_led_blink_work);
-
-       trigger = ieee80211_get_radio_led_name(priv->hw);
-       snprintf(priv->radio_led.name, sizeof(priv->radio_led.name),
-               "ath9k-%s::radio", wiphy_name(priv->hw->wiphy));
-       ret = ath9k_register_led(priv, &priv->radio_led, trigger);
-       priv->radio_led.led_type = ATH_LED_RADIO;
-       if (ret)
-               goto fail;
-
-       trigger = ieee80211_get_assoc_led_name(priv->hw);
-       snprintf(priv->assoc_led.name, sizeof(priv->assoc_led.name),
-               "ath9k-%s::assoc", wiphy_name(priv->hw->wiphy));
-       ret = ath9k_register_led(priv, &priv->assoc_led, trigger);
-       priv->assoc_led.led_type = ATH_LED_ASSOC;
-       if (ret)
-               goto fail;
-
-       trigger = ieee80211_get_tx_led_name(priv->hw);
-       snprintf(priv->tx_led.name, sizeof(priv->tx_led.name),
-               "ath9k-%s::tx", wiphy_name(priv->hw->wiphy));
-       ret = ath9k_register_led(priv, &priv->tx_led, trigger);
-       priv->tx_led.led_type = ATH_LED_TX;
-       if (ret)
-               goto fail;
-
-       trigger = ieee80211_get_rx_led_name(priv->hw);
-       snprintf(priv->rx_led.name, sizeof(priv->rx_led.name),
-               "ath9k-%s::rx", wiphy_name(priv->hw->wiphy));
-       ret = ath9k_register_led(priv, &priv->rx_led, trigger);
-       priv->rx_led.led_type = ATH_LED_RX;
-       if (ret)
-               goto fail;
-
-       priv->op_flags &= ~OP_LED_DEINIT;
-
-       return;
-
-fail:
-       cancel_delayed_work_sync(&priv->ath9k_led_blink_work);
-       ath9k_deinit_leds(priv);
-}
-
-/*******************/
-/*     Rfkill     */
-/*******************/
-
-static bool ath_is_rfkill_set(struct ath9k_htc_priv *priv)
-{
-       return ath9k_hw_gpio_get(priv->ah, priv->ah->rfkill_gpio) ==
-               priv->ah->rfkill_polarity;
-}
-
-static void ath9k_htc_rfkill_poll_state(struct ieee80211_hw *hw)
-{
-       struct ath9k_htc_priv *priv = hw->priv;
-       bool blocked = !!ath_is_rfkill_set(priv);
-
-       wiphy_rfkill_set_hw_state(hw->wiphy, blocked);
-}
-
-void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv)
-{
-       if (priv->ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
-               wiphy_rfkill_start_polling(priv->hw->wiphy);
-}
-
-static void ath9k_htc_radio_enable(struct ieee80211_hw *hw)
-{
-       struct ath9k_htc_priv *priv = hw->priv;
-       struct ath_hw *ah = priv->ah;
-       struct ath_common *common = ath9k_hw_common(ah);
-       int ret;
-       u8 cmd_rsp;
-
-       if (!ah->curchan)
-               ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
-
-       /* Reset the HW */
-       ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
-       if (ret) {
-               ath_err(common,
-                       "Unable to reset hardware; reset status %d (freq %u MHz)\n",
-                       ret, ah->curchan->channel);
-       }
-
-       ath_update_txpow(priv);
-
-       /* Start RX */
-       WMI_CMD(WMI_START_RECV_CMDID);
-       ath9k_host_rx_init(priv);
-
-       /* Start TX */
-       htc_start(priv->htc);
-       spin_lock_bh(&priv->tx_lock);
-       priv->tx_queues_stop = false;
-       spin_unlock_bh(&priv->tx_lock);
-       ieee80211_wake_queues(hw);
-
-       WMI_CMD(WMI_ENABLE_INTR_CMDID);
-
-       /* Enable LED */
-       ath9k_hw_cfg_output(ah, ah->led_pin,
-                           AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
-       ath9k_hw_set_gpio(ah, ah->led_pin, 0);
-}
-
-static void ath9k_htc_radio_disable(struct ieee80211_hw *hw)
-{
-       struct ath9k_htc_priv *priv = hw->priv;
-       struct ath_hw *ah = priv->ah;
-       struct ath_common *common = ath9k_hw_common(ah);
-       int ret;
-       u8 cmd_rsp;
-
-       ath9k_htc_ps_wakeup(priv);
-
-       /* Disable LED */
-       ath9k_hw_set_gpio(ah, ah->led_pin, 1);
-       ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
-
-       WMI_CMD(WMI_DISABLE_INTR_CMDID);
-
-       /* Stop TX */
-       ieee80211_stop_queues(hw);
-       htc_stop(priv->htc);
-       WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
-       skb_queue_purge(&priv->tx_queue);
-
-       /* Stop RX */
-       WMI_CMD(WMI_STOP_RECV_CMDID);
-
-       /*
-        * The MIB counters have to be disabled here,
-        * since the target doesn't do it.
-        */
-       ath9k_hw_disable_mib_counters(ah);
-
-       if (!ah->curchan)
-               ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
-
-       /* Reset the HW */
-       ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
-       if (ret) {
-               ath_err(common,
-                       "Unable to reset hardware; reset status %d (freq %u MHz)\n",
-                       ret, ah->curchan->channel);
-       }
-
-       /* Disable the PHY */
-       ath9k_hw_phy_disable(ah);
-
-       ath9k_htc_ps_restore(priv);
-       ath9k_htc_setpower(priv, ATH9K_PM_FULL_SLEEP);
-}
-
 /**********************/
 /* mac80211 Callbacks */
 /**********************/
@@ -1218,6 +1014,12 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
        int ret = 0;
        u8 cmd_rsp;
 
+       /* Cancel all the running timers/work .. */
+       cancel_work_sync(&priv->fatal_work);
+       cancel_work_sync(&priv->ps_work);
+       cancel_delayed_work_sync(&priv->ath9k_led_blink_work);
+       ath9k_led_stop_brightness(priv);
+
        mutex_lock(&priv->mutex);
 
        if (priv->op_flags & OP_INVALID) {
@@ -1226,11 +1028,6 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
                return;
        }
 
-       /* Cancel all the running timers/work .. */
-       cancel_work_sync(&priv->ps_work);
-       cancel_delayed_work_sync(&priv->ath9k_led_blink_work);
-       ath9k_led_stop_brightness(priv);
-
        ath9k_htc_ps_wakeup(priv);
        htc_stop(priv->htc);
        WMI_CMD(WMI_DISABLE_INTR_CMDID);
@@ -1792,7 +1589,6 @@ static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw)
        spin_lock_bh(&priv->beacon_lock);
        priv->op_flags &= ~OP_SCANNING;
        spin_unlock_bh(&priv->beacon_lock);
-       priv->op_flags |= OP_FULL_RESET;
        if (priv->op_flags & OP_ASSOCIATED) {
                ath9k_htc_beacon_config(priv, priv->vif);
                ath_start_ani(priv);
index 4b51ed4..fde9786 100644 (file)
@@ -1615,7 +1615,9 @@ bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
         * simply keep the ATH_DBG_WARN_ON_ONCE() but make
         * ath9k_hw_setpower() return type void.
         */
-       ATH_DBG_WARN_ON_ONCE(!status);
+
+       if (!(ah->ah_flags & AH_UNPLUGGED))
+               ATH_DBG_WARN_ON_ONCE(!status);
 
        return status;
 }
index b8ffaa5..5a3dfec 100644 (file)
@@ -646,6 +646,10 @@ struct ath_nf_limits {
        s16 nominal;
 };
 
+/* ah_flags */
+#define AH_USE_EEPROM   0x1
+#define AH_UNPLUGGED    0x2 /* The card has been physically removed. */
+
 struct ath_hw {
        struct ieee80211_hw *hw;
        struct ath_common common;
index b0e5e71..767d8b8 100644 (file)
@@ -29,8 +29,8 @@ static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
 module_param_named(debug, ath9k_debug, uint, 0);
 MODULE_PARM_DESC(debug, "Debugging mask");
 
-int modparam_nohwcrypt;
-module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
+int ath9k_modparam_nohwcrypt;
+module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444);
 MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
 
 int led_blink;
@@ -45,6 +45,7 @@ int ath9k_pm_qos_value = ATH9K_PM_QOS_DEFAULT_VALUE;
 module_param_named(pmqos, ath9k_pm_qos_value, int, S_IRUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(pmqos, "User specified PM-QOS value");
 
+bool is_ath9k_unloaded;
 /* We use the hw_value as an index into our private channel structure */
 
 #define CHAN2G(_freq, _idx)  { \
@@ -372,7 +373,7 @@ fail:
 #undef DS2PHYS
 }
 
-static void ath9k_init_crypto(struct ath_softc *sc)
+void ath9k_init_crypto(struct ath_softc *sc)
 {
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
        int i = 0;
@@ -647,13 +648,12 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
                IEEE80211_HW_SUPPORTS_PS |
                IEEE80211_HW_PS_NULLFUNC_STACK |
                IEEE80211_HW_SPECTRUM_MGMT |
-               IEEE80211_HW_REPORTS_TX_ACK_STATUS |
-               IEEE80211_HW_NEED_DTIM_PERIOD;
+               IEEE80211_HW_REPORTS_TX_ACK_STATUS;
 
        if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
                 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
 
-       if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || modparam_nohwcrypt)
+       if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt)
                hw->flags |= IEEE80211_HW_MFP_CAPABLE;
 
        hw->wiphy->interface_modes =
@@ -899,6 +899,7 @@ module_init(ath9k_init);
 
 static void __exit ath9k_exit(void)
 {
+       is_ath9k_unloaded = true;
        ath_ahb_exit();
        ath_pci_exit();
        ath_rate_control_unregister();
index e3d2ebf..180170d 100644 (file)
@@ -692,15 +692,16 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
        if ((ads.ds_rxstatus8 & AR_RxFrameOK) == 0) {
                if (ads.ds_rxstatus8 & AR_CRCErr)
                        rs->rs_status |= ATH9K_RXERR_CRC;
-               else if (ads.ds_rxstatus8 & AR_PHYErr) {
+               if (ads.ds_rxstatus8 & AR_PHYErr) {
                        rs->rs_status |= ATH9K_RXERR_PHY;
                        phyerr = MS(ads.ds_rxstatus8, AR_PHYErrCode);
                        rs->rs_phyerr = phyerr;
-               } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
+               }
+               if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
                        rs->rs_status |= ATH9K_RXERR_DECRYPT;
-               else if (ads.ds_rxstatus8 & AR_MichaelErr)
+               if (ads.ds_rxstatus8 & AR_MichaelErr)
                        rs->rs_status |= ATH9K_RXERR_MIC;
-               else if (ads.ds_rxstatus8 & AR_KeyMiss)
+               if (ads.ds_rxstatus8 & AR_KeyMiss)
                        rs->rs_status |= ATH9K_RXERR_DECRYPT;
        }
 
index 8a1691d..f90a6ca 100644 (file)
@@ -285,7 +285,8 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
        ath9k_hw_set_interrupts(ah, ah->imask);
 
        if (!(sc->sc_flags & (SC_OP_OFFCHANNEL))) {
-               ath_beacon_config(sc, NULL);
+               if (sc->sc_flags & SC_OP_BEACONS)
+                       ath_beacon_config(sc, NULL);
                ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0);
                ath_start_ani(common);
        }
@@ -599,7 +600,7 @@ void ath9k_tasklet(unsigned long data)
                return;
        }
 
-       spin_lock_bh(&sc->sc_pcu_lock);
+       spin_lock(&sc->sc_pcu_lock);
 
        if (!ath9k_hw_check_alive(ah))
                ieee80211_queue_work(sc->hw, &sc->hw_check_work);
@@ -643,7 +644,7 @@ void ath9k_tasklet(unsigned long data)
        /* re-enable hardware interrupt */
        ath9k_hw_enable_interrupts(ah);
 
-       spin_unlock_bh(&sc->sc_pcu_lock);
+       spin_unlock(&sc->sc_pcu_lock);
        ath9k_ps_restore(sc);
 }
 
@@ -1328,6 +1329,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
        ath9k_ps_restore(sc);
 
        sc->ps_idle = true;
+       ath9k_set_wiphy_idle(aphy, true);
        ath_radio_disable(sc, hw);
 
        sc->sc_flags |= SC_OP_INVALID;
@@ -1455,6 +1457,7 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
        struct ath_wiphy *aphy = hw->priv;
        struct ath_softc *sc = aphy->sc;
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+       int ret = 0;
 
        ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n");
        mutex_lock(&sc->mutex);
@@ -1464,7 +1467,8 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
        case NL80211_IFTYPE_ADHOC:
                if (sc->nbcnvifs >= ATH_BCBUF) {
                        ath_err(common, "No beacon slot available\n");
-                       return -ENOBUFS;
+                       ret = -ENOBUFS;
+                       goto out;
                }
                break;
        case NL80211_IFTYPE_STATION:
@@ -1478,14 +1482,15 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
        default:
                ath_err(common, "Interface type %d not yet supported\n",
                                vif->type);
-               mutex_unlock(&sc->mutex);
-               return -ENOTSUPP;
+               ret = -ENOTSUPP;
+               goto out;
        }
        vif->type = new_type;
        vif->p2p = p2p;
 
+out:
        mutex_unlock(&sc->mutex);
-       return 0;
+       return ret;
 }
 
 static void ath9k_remove_interface(struct ieee80211_hw *hw,
@@ -1824,7 +1829,7 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
        int ret = 0;
 
-       if (modparam_nohwcrypt)
+       if (ath9k_modparam_nohwcrypt)
                return -ENOSPC;
 
        mutex_lock(&sc->mutex);
index 7ca8499..78ef1f1 100644 (file)
@@ -96,7 +96,7 @@ static void ath_pci_bt_coex_prep(struct ath_common *common)
        struct pci_dev *pdev = to_pci_dev(sc->dev);
        u8 aspm;
 
-       if (!pdev->is_pcie)
+       if (!pci_is_pcie(pdev))
                return;
 
        pci_read_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, &aspm);
@@ -264,6 +264,8 @@ static void ath_pci_remove(struct pci_dev *pdev)
        struct ath_softc *sc = aphy->sc;
        void __iomem *mem = sc->mem;
 
+       if (!is_ath9k_unloaded)
+               sc->sc_ah->ah_flags |= AH_UNPLUGGED;
        ath9k_deinit_device(sc);
        free_irq(sc->irq, sc);
        ieee80211_free_hw(sc->hw);
@@ -309,7 +311,16 @@ static int ath_pci_resume(struct device *device)
                            AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
        ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
 
+         /*
+          * Reset key cache to sane defaults (all entries cleared) instead of
+          * semi-random values after suspend/resume.
+          */
+       ath9k_ps_wakeup(sc);
+       ath9k_init_crypto(sc);
+       ath9k_ps_restore(sc);
+
        sc->ps_idle = true;
+       ath9k_set_wiphy_idle(aphy, true);
        ath_radio_disable(sc, hw);
 
        return 0;
index 896d129..e451478 100644 (file)
@@ -400,7 +400,7 @@ static void ath_rc_sort_validrates(const struct ath_rate_table *rate_table,
        }
 }
 
-static void ath_rc_init_valid_txmask(struct ath_rate_priv *ath_rc_priv)
+static void ath_rc_init_valid_rate_idx(struct ath_rate_priv *ath_rc_priv)
 {
        u8 i;
 
@@ -408,7 +408,7 @@ static void ath_rc_init_valid_txmask(struct ath_rate_priv *ath_rc_priv)
                ath_rc_priv->valid_rate_index[i] = 0;
 }
 
-static inline void ath_rc_set_valid_txmask(struct ath_rate_priv *ath_rc_priv,
+static inline void ath_rc_set_valid_rate_idx(struct ath_rate_priv *ath_rc_priv,
                                           u8 index, int valid_tx_rate)
 {
        BUG_ON(index > ath_rc_priv->rate_table_size);
@@ -489,7 +489,7 @@ static u8 ath_rc_init_validrates(struct ath_rate_priv *ath_rc_priv,
 
                        ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = i;
                        ath_rc_priv->valid_phy_ratecnt[phy] += 1;
-                       ath_rc_set_valid_txmask(ath_rc_priv, i, 1);
+                       ath_rc_set_valid_rate_idx(ath_rc_priv, i, 1);
                        hi = i;
                }
        }
@@ -532,7 +532,7 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv,
                                ath_rc_priv->valid_phy_rateidx[phy]
                                        [valid_rate_count] = j;
                                ath_rc_priv->valid_phy_ratecnt[phy] += 1;
-                               ath_rc_set_valid_txmask(ath_rc_priv, j, 1);
+                               ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1);
                                hi = A_MAX(hi, j);
                        }
                }
@@ -568,7 +568,7 @@ static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv,
                        ath_rc_priv->valid_phy_rateidx[phy]
                                [ath_rc_priv->valid_phy_ratecnt[phy]] = j;
                        ath_rc_priv->valid_phy_ratecnt[phy] += 1;
-                       ath_rc_set_valid_txmask(ath_rc_priv, j, 1);
+                       ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1);
                        hi = A_MAX(hi, j);
                }
        }
@@ -1210,7 +1210,7 @@ static void ath_rc_init(struct ath_softc *sc,
        }
 
        /* Determine the valid rates */
-       ath_rc_init_valid_txmask(ath_rc_priv);
+       ath_rc_init_valid_rate_idx(ath_rc_priv);
 
        for (i = 0; i < WLAN_RC_PHY_MAX; i++) {
                for (j = 0; j < MAX_TX_RATE_PHY; j++)
@@ -1321,7 +1321,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
        struct ath_rate_priv *ath_rc_priv = priv_sta;
        struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
        struct ieee80211_hdr *hdr;
-       int final_ts_idx = 0, tx_status = 0, is_underrun = 0;
+       int final_ts_idx = 0, tx_status = 0;
        int long_retry = 0;
        __le16 fc;
        int i;
@@ -1358,7 +1358,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
                tx_status = 1;
 
        ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status,
-                        (is_underrun) ? sc->hw->max_rate_tries : long_retry);
+                        long_retry);
 
        /* Check if aggregation has to be enabled for this tid */
        if (conf_is_ht(&sc->hw->conf) &&
index 31a004c..5d984b8 100644 (file)
@@ -195,7 +195,6 @@ struct ath_rc_stats {
  * @rate_max_phy: phy index for the max rate
  * @per: PER for every valid rate in %
  * @probe_interval: interval for ratectrl to probe for other rates
- * @prev_data_rix: rate idx of last data frame
  * @ht_cap: HT capabilities
  * @neg_rates: Negotatied rates
  * @neg_ht_rates: Negotiated HT rates
@@ -214,10 +213,8 @@ struct ath_rate_priv {
        u32 probe_time;
        u32 per_down_time;
        u32 probe_interval;
-       u32 prev_data_rix;
        struct ath_rateset neg_rates;
        struct ath_rateset neg_ht_rates;
-       struct ath_rate_softc *asc;
        const struct ath_rate_table *rate_table;
 
        struct dentry *debugfs_rcstats;
index 00ebed3..b2497b8 100644 (file)
@@ -528,7 +528,8 @@ bool ath_stoprecv(struct ath_softc *sc)
                sc->rx.rxlink = NULL;
        spin_unlock_bh(&sc->rx.rxbuflock);
 
-       if (unlikely(!stopped)) {
+       if (!(ah->ah_flags & AH_UNPLUGGED) &&
+           unlikely(!stopped)) {
                ath_err(ath9k_hw_common(sc->sc_ah),
                        "Could not stop RX, we could be "
                        "confusing the DMA engine when we start RX up\n");
index 8f42ea7..dc862f5 100644 (file)
@@ -120,7 +120,7 @@ void ath9k_deinit_wmi(struct ath9k_htc_priv *priv)
        kfree(priv->wmi);
 }
 
-void ath9k_wmi_tasklet(unsigned long data)
+void ath9k_swba_tasklet(unsigned long data)
 {
        struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;
        struct ath_common *common = ath9k_hw_common(priv->ah);
@@ -131,6 +131,16 @@ void ath9k_wmi_tasklet(unsigned long data)
 
 }
 
+void ath9k_fatal_work(struct work_struct *work)
+{
+       struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv,
+                                                  fatal_work);
+       struct ath_common *common = ath9k_hw_common(priv->ah);
+
+       ath_dbg(common, ATH_DBG_FATAL, "FATAL Event received, resetting device\n");
+       ath9k_htc_reset(priv);
+}
+
 static void ath9k_wmi_rsp_callback(struct wmi *wmi, struct sk_buff *skb)
 {
        skb_pull(skb, sizeof(struct wmi_cmd_hdr));
@@ -163,7 +173,11 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
                switch (cmd_id) {
                case WMI_SWBA_EVENTID:
                        wmi->beacon_pending = *(u8 *)wmi_event;
-                       tasklet_schedule(&wmi->drv_priv->wmi_tasklet);
+                       tasklet_schedule(&wmi->drv_priv->swba_tasklet);
+                       break;
+               case WMI_FATAL_EVENTID:
+                       ieee80211_queue_work(wmi->drv_priv->hw,
+                                            &wmi->drv_priv->fatal_work);
                        break;
                case WMI_TXRATE_EVENTID:
 #ifdef CONFIG_ATH9K_HTC_DEBUGFS
@@ -250,7 +264,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
        int time_left, ret = 0;
        unsigned long flags;
 
-       if (wmi->drv_priv->op_flags & OP_UNPLUGGED)
+       if (ah->ah_flags & AH_UNPLUGGED)
                return 0;
 
        skb = alloc_skb(headroom + cmd_len, GFP_ATOMIC);
index ac61074..4208427 100644 (file)
@@ -117,7 +117,8 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
                  u8 *cmd_buf, u32 cmd_len,
                  u8 *rsp_buf, u32 rsp_len,
                  u32 timeout);
-void ath9k_wmi_tasklet(unsigned long data);
+void ath9k_swba_tasklet(unsigned long data);
+void ath9k_fatal_work(struct work_struct *work);
 
 #define WMI_CMD(_wmi_cmd)                                              \
        do {                                                            \
index 82bc81c..b6b0de6 100644 (file)
@@ -1029,8 +1029,6 @@ static int carl9170_init_rf_bank4_pwr(struct ar9170 *ar, bool band5ghz,
        if (err)
                return err;
 
-       msleep(20);
-
        return 0;
 }
 
@@ -1660,12 +1658,6 @@ int carl9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel,
                        return err;
 
                cmd = CARL9170_CMD_RF_INIT;
-
-               msleep(100);
-
-               err = carl9170_echo_test(ar, 0xaabbccdd);
-               if (err)
-                       return err;
        } else {
                cmd = CARL9170_CMD_FREQUENCY;
        }
@@ -1676,6 +1668,8 @@ int carl9170_set_channel(struct ar9170 *ar, struct ieee80211_channel *channel,
 
        err = carl9170_write_reg(ar, AR9170_PHY_REG_HEAVY_CLIP_ENABLE,
                                 0x200);
+       if (err)
+               return err;
 
        err = carl9170_init_rf_bank4_pwr(ar,
                channel->band == IEEE80211_BAND_5GHZ,
index 2d947a3..537732e 100644 (file)
@@ -834,7 +834,7 @@ static int carl9170_usb_load_firmware(struct ar9170 *ar)
        if (err)
                goto err_out;
 
-       /* firmware restarts cmd counter */
+       /* now, start the command response counter */
        ar->cmd_seq = -1;
 
        return 0;
@@ -851,7 +851,12 @@ int carl9170_usb_restart(struct ar9170 *ar)
        if (ar->intf->condition != USB_INTERFACE_BOUND)
                return 0;
 
-       /* Disable command response sequence counter. */
+       /*
+        * Disable the command response sequence counter check.
+        * We already know that the device/firmware is in a bad state.
+        * So, no extra points are awarded to anyone who reminds the
+        * driver about that.
+        */
        ar->cmd_seq = -2;
 
        err = carl9170_reboot(ar);
@@ -903,6 +908,15 @@ static int carl9170_usb_init_device(struct ar9170 *ar)
 {
        int err;
 
+       /*
+        * The carl9170 firmware let's the driver know when it's
+        * ready for action. But we have to be prepared to gracefully
+        * handle all spurious [flushed] messages after each (re-)boot.
+        * Thus the command response counter remains disabled until it
+        * can be safely synchronized.
+        */
+       ar->cmd_seq = -2;
+
        err = carl9170_usb_send_rx_irq_urb(ar);
        if (err)
                goto err_out;
@@ -911,14 +925,21 @@ static int carl9170_usb_init_device(struct ar9170 *ar)
        if (err)
                goto err_unrx;
 
+       err = carl9170_usb_open(ar);
+       if (err)
+               goto err_unrx;
+
        mutex_lock(&ar->mutex);
        err = carl9170_usb_load_firmware(ar);
        mutex_unlock(&ar->mutex);
        if (err)
-               goto err_unrx;
+               goto err_stop;
 
        return 0;
 
+err_stop:
+       carl9170_usb_stop(ar);
+
 err_unrx:
        carl9170_usb_cancel_urbs(ar);
 
@@ -964,10 +985,6 @@ static void carl9170_usb_firmware_finish(struct ar9170 *ar)
        if (err)
                goto err_freefw;
 
-       err = carl9170_usb_open(ar);
-       if (err)
-               goto err_unrx;
-
        err = carl9170_register(ar);
 
        carl9170_usb_stop(ar);
@@ -1043,7 +1060,6 @@ static int carl9170_usb_probe(struct usb_interface *intf,
        atomic_set(&ar->rx_work_urbs, 0);
        atomic_set(&ar->rx_anch_urbs, 0);
        atomic_set(&ar->rx_pool_urbs, 0);
-       ar->cmd_seq = -2;
 
        usb_get_dev(ar->udev);
 
@@ -1090,10 +1106,6 @@ static int carl9170_usb_suspend(struct usb_interface *intf,
 
        carl9170_usb_cancel_urbs(ar);
 
-       /*
-        * firmware automatically reboots for usb suspend.
-        */
-
        return 0;
 }
 
@@ -1106,12 +1118,20 @@ static int carl9170_usb_resume(struct usb_interface *intf)
                return -ENODEV;
 
        usb_unpoison_anchored_urbs(&ar->rx_anch);
+       carl9170_set_state(ar, CARL9170_STOPPED);
 
-       err = carl9170_usb_init_device(ar);
-       if (err)
-               goto err_unrx;
+       /*
+        * The USB documentation demands that [for suspend] all traffic
+        * to and from the device has to stop. This would be fine, but
+        * there's a catch: the device[usb phy] does not come back.
+        *
+        * Upon resume the firmware will "kill" itself and the
+        * boot-code sorts out the magic voodoo.
+        * Not very nice, but there's not much what could go wrong.
+        */
+       msleep(1100);
 
-       err = carl9170_usb_open(ar);
+       err = carl9170_usb_init_device(ar);
        if (err)
                goto err_unrx;
 
@@ -1133,6 +1153,7 @@ static struct usb_driver carl9170_driver = {
 #ifdef CONFIG_PM
        .suspend = carl9170_usb_suspend,
        .resume = carl9170_usb_resume,
+       .reset_resume = carl9170_usb_resume,
 #endif /* CONFIG_PM */
 };
 
index 1aec160..22bc9f1 100644 (file)
@@ -2121,8 +2121,10 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
                filename = "ucode13";
        else if (rev == 14)
                filename = "ucode14";
-       else if (rev >= 15)
+       else if (rev == 15)
                filename = "ucode15";
+       else if ((rev >= 16) && (rev <= 20))
+               filename = "ucode16_mimo";
        else
                goto err_no_ucode;
        err = b43_do_request_fw(ctx, filename, &fw->ucode);
@@ -2165,7 +2167,9 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
                        goto err_no_initvals;
                break;
        case B43_PHYTYPE_N:
-               if ((rev >= 11) && (rev <= 12))
+               if (rev >= 16)
+                       filename = "n0initvals16";
+               else if ((rev >= 11) && (rev <= 12))
                        filename = "n0initvals11";
                else
                        goto err_no_initvals;
@@ -2209,7 +2213,9 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
                        goto err_no_initvals;
                break;
        case B43_PHYTYPE_N:
-               if ((rev >= 11) && (rev <= 12))
+               if (rev >= 16)
+                       filename = "n0bsinitvals16";
+               else if ((rev >= 11) && (rev <= 12))
                        filename = "n0bsinitvals11";
                else
                        goto err_no_initvals;
@@ -4050,7 +4056,7 @@ static int b43_phy_versioning(struct b43_wldev *dev)
                break;
 #ifdef CONFIG_B43_PHY_N
        case B43_PHYTYPE_N:
-               if (phy_rev > 2)
+               if (phy_rev > 9)
                        unsupported = 1;
                break;
 #endif
index a1aa570..ab81ed8 100644 (file)
@@ -139,6 +139,99 @@ static void b43_chantab_radio_upload(struct b43_wldev *dev,
        b43_radio_write(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim);
 }
 
+static void b43_chantab_radio_2056_upload(struct b43_wldev *dev,
+                               const struct b43_nphy_channeltab_entry_rev3 *e)
+{
+       b43_radio_write(dev, B2056_SYN_PLL_VCOCAL1, e->radio_syn_pll_vcocal1);
+       b43_radio_write(dev, B2056_SYN_PLL_VCOCAL2, e->radio_syn_pll_vcocal2);
+       b43_radio_write(dev, B2056_SYN_PLL_REFDIV, e->radio_syn_pll_refdiv);
+       b43_radio_write(dev, B2056_SYN_PLL_MMD2, e->radio_syn_pll_mmd2);
+       b43_radio_write(dev, B2056_SYN_PLL_MMD1, e->radio_syn_pll_mmd1);
+       b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER1,
+                                       e->radio_syn_pll_loopfilter1);
+       b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER2,
+                                       e->radio_syn_pll_loopfilter2);
+       b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER3,
+                                       e->radio_syn_pll_loopfilter3);
+       b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER4,
+                                       e->radio_syn_pll_loopfilter4);
+       b43_radio_write(dev, B2056_SYN_PLL_LOOPFILTER5,
+                                       e->radio_syn_pll_loopfilter5);
+       b43_radio_write(dev, B2056_SYN_RESERVED_ADDR27,
+                                       e->radio_syn_reserved_addr27);
+       b43_radio_write(dev, B2056_SYN_RESERVED_ADDR28,
+                                       e->radio_syn_reserved_addr28);
+       b43_radio_write(dev, B2056_SYN_RESERVED_ADDR29,
+                                       e->radio_syn_reserved_addr29);
+       b43_radio_write(dev, B2056_SYN_LOGEN_VCOBUF1,
+                                       e->radio_syn_logen_vcobuf1);
+       b43_radio_write(dev, B2056_SYN_LOGEN_MIXER2, e->radio_syn_logen_mixer2);
+       b43_radio_write(dev, B2056_SYN_LOGEN_BUF3, e->radio_syn_logen_buf3);
+       b43_radio_write(dev, B2056_SYN_LOGEN_BUF4, e->radio_syn_logen_buf4);
+
+       b43_radio_write(dev, B2056_RX0 | B2056_RX_LNAA_TUNE,
+                                       e->radio_rx0_lnaa_tune);
+       b43_radio_write(dev, B2056_RX0 | B2056_RX_LNAG_TUNE,
+                                       e->radio_rx0_lnag_tune);
+
+       b43_radio_write(dev, B2056_TX0 | B2056_TX_INTPAA_BOOST_TUNE,
+                                       e->radio_tx0_intpaa_boost_tune);
+       b43_radio_write(dev, B2056_TX0 | B2056_TX_INTPAG_BOOST_TUNE,
+                                       e->radio_tx0_intpag_boost_tune);
+       b43_radio_write(dev, B2056_TX0 | B2056_TX_PADA_BOOST_TUNE,
+                                       e->radio_tx0_pada_boost_tune);
+       b43_radio_write(dev, B2056_TX0 | B2056_TX_PADG_BOOST_TUNE,
+                                       e->radio_tx0_padg_boost_tune);
+       b43_radio_write(dev, B2056_TX0 | B2056_TX_PGAA_BOOST_TUNE,
+                                       e->radio_tx0_pgaa_boost_tune);
+       b43_radio_write(dev, B2056_TX0 | B2056_TX_PGAG_BOOST_TUNE,
+                                       e->radio_tx0_pgag_boost_tune);
+       b43_radio_write(dev, B2056_TX0 | B2056_TX_MIXA_BOOST_TUNE,
+                                       e->radio_tx0_mixa_boost_tune);
+       b43_radio_write(dev, B2056_TX0 | B2056_TX_MIXG_BOOST_TUNE,
+                                       e->radio_tx0_mixg_boost_tune);
+
+       b43_radio_write(dev, B2056_RX1 | B2056_RX_LNAA_TUNE,
+                                       e->radio_rx1_lnaa_tune);
+       b43_radio_write(dev, B2056_RX1 | B2056_RX_LNAG_TUNE,
+                                       e->radio_rx1_lnag_tune);
+
+       b43_radio_write(dev, B2056_TX1 | B2056_TX_INTPAA_BOOST_TUNE,
+                                       e->radio_tx1_intpaa_boost_tune);
+       b43_radio_write(dev, B2056_TX1 | B2056_TX_INTPAG_BOOST_TUNE,
+                                       e->radio_tx1_intpag_boost_tune);
+       b43_radio_write(dev, B2056_TX1 | B2056_TX_PADA_BOOST_TUNE,
+                                       e->radio_tx1_pada_boost_tune);
+       b43_radio_write(dev, B2056_TX1 | B2056_TX_PADG_BOOST_TUNE,
+                                       e->radio_tx1_padg_boost_tune);
+       b43_radio_write(dev, B2056_TX1 | B2056_TX_PGAA_BOOST_TUNE,
+                                       e->radio_tx1_pgaa_boost_tune);
+       b43_radio_write(dev, B2056_TX1 | B2056_TX_PGAG_BOOST_TUNE,
+                                       e->radio_tx1_pgag_boost_tune);
+       b43_radio_write(dev, B2056_TX1 | B2056_TX_MIXA_BOOST_TUNE,
+                                       e->radio_tx1_mixa_boost_tune);
+       b43_radio_write(dev, B2056_TX1 | B2056_TX_MIXG_BOOST_TUNE,
+                                       e->radio_tx1_mixg_boost_tune);
+}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2056Setup */
+static void b43_radio_2056_setup(struct b43_wldev *dev,
+                               const struct b43_nphy_channeltab_entry_rev3 *e)
+{
+       B43_WARN_ON(dev->phy.rev < 3);
+
+       b43_chantab_radio_2056_upload(dev, e);
+       /* TODO */
+       udelay(50);
+       /* VCO calibration */
+       b43_radio_write(dev, B2056_SYN_PLL_VCOCAL12, 0x00);
+       b43_radio_write(dev, B2056_TX_INTPAA_PA_MISC, 0x38);
+       b43_radio_write(dev, B2056_TX_INTPAA_PA_MISC, 0x18);
+       b43_radio_write(dev, B2056_TX_INTPAA_PA_MISC, 0x38);
+       b43_radio_write(dev, B2056_TX_INTPAA_PA_MISC, 0x39);
+       udelay(300);
+}
+
 static void b43_chantab_phy_upload(struct b43_wldev *dev,
                                   const struct b43_phy_n_sfo_cfg *e)
 {
@@ -401,16 +494,45 @@ static void b43_radio_init2055(struct b43_wldev *dev)
        b43_radio_init2055_post(dev);
 }
 
+static void b43_radio_init2056_pre(struct b43_wldev *dev)
+{
+       b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
+                    ~B43_NPHY_RFCTL_CMD_CHIP0PU);
+       /* Maybe wl meant to reset and set (order?) RFCTL_CMD_OEPORFORCE? */
+       b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
+                    B43_NPHY_RFCTL_CMD_OEPORFORCE);
+       b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
+                   ~B43_NPHY_RFCTL_CMD_OEPORFORCE);
+       b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
+                   B43_NPHY_RFCTL_CMD_CHIP0PU);
+}
+
+static void b43_radio_init2056_post(struct b43_wldev *dev)
+{
+       b43_radio_set(dev, B2056_SYN_COM_CTRL, 0xB);
+       b43_radio_set(dev, B2056_SYN_COM_PU, 0x2);
+       b43_radio_set(dev, B2056_SYN_COM_RESET, 0x2);
+       msleep(1);
+       b43_radio_mask(dev, B2056_SYN_COM_RESET, ~0x2);
+       b43_radio_mask(dev, B2056_SYN_PLL_MAST2, ~0xFC);
+       b43_radio_mask(dev, B2056_SYN_RCCAL_CTRL0, ~0x1);
+       /*
+       if (nphy->init_por)
+               Call Radio 2056 Recalibrate
+       */
+}
+
 /*
  * Initialize a Broadcom 2056 N-radio
  * http://bcm-v4.sipsolutions.net/802.11/Radio/2056/Init
  */
 static void b43_radio_init2056(struct b43_wldev *dev)
 {
-       /* TODO */
+       b43_radio_init2056_pre(dev);
+       b2056_upload_inittabs(dev, 0, 0);
+       b43_radio_init2056_post(dev);
 }
 
-
 /*
  * Upload the N-PHY tables.
  * http://bcm-v4.sipsolutions.net/802.11/PHY/N/InitTables
@@ -3578,7 +3700,6 @@ static int b43_nphy_set_channel(struct b43_wldev *dev,
        if (dev->phy.rev >= 3) {
                tabent_r3 = b43_nphy_get_chantabent_rev3(dev,
                                                        channel->center_freq);
-               tabent_r3 = NULL;
                if (!tabent_r3)
                        return -ESRCH;
        } else {
@@ -3607,7 +3728,7 @@ static int b43_nphy_set_channel(struct b43_wldev *dev,
        if (dev->phy.rev >= 3) {
                tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 4 : 0;
                b43_radio_maskset(dev, 0x08, 0xFFFB, tmp);
-               /* TODO: PHY Radio2056 Setup (dev, tabent_r3); */
+               b43_radio_2056_setup(dev, tabent_r3);
                b43_nphy_channel_setup(dev, &(tabent_r3->phy_regs), channel);
        } else {
                tmp = (channel->band == IEEE80211_BAND_5GHZ) ? 0x0020 : 0x0050;
@@ -3638,6 +3759,7 @@ static void b43_nphy_op_prepare_structs(struct b43_wldev *dev)
 
        memset(nphy, 0, sizeof(*nphy));
 
+       nphy->hang_avoid = (phy->rev == 3 || phy->rev == 4);
        nphy->gain_boost = true; /* this way we follow wl, assume it is true */
        nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */
        nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */
index 0cdf6a4..8890df0 100644 (file)
 #include "radio_2056.h"
 #include "phy_common.h"
 
+struct b2056_inittab_entry {
+       /* Value to write if we use the 5GHz band. */
+       u16 ghz5;
+       /* Value to write if we use the 2.4GHz band. */
+       u16 ghz2;
+       /* Flags */
+       u8 flags;
+};
+#define B2056_INITTAB_ENTRY_OK 0x01
+#define B2056_INITTAB_UPLOAD   0x02
+#define UPLOAD         .flags = B2056_INITTAB_ENTRY_OK | B2056_INITTAB_UPLOAD
+#define NOUPLOAD       .flags = B2056_INITTAB_ENTRY_OK
+
+struct b2056_inittabs_pts {
+       const struct b2056_inittab_entry *syn;
+       unsigned int syn_length;
+       const struct b2056_inittab_entry *tx;
+       unsigned int tx_length;
+       const struct b2056_inittab_entry *rx;
+       unsigned int rx_length;
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev3_syn[] = {
+       [B2056_SYN_RESERVED_ADDR2]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR3]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR4]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR5]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR6]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR7]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_CTRL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_PU]              = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_COM_OVR]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RESET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RCAL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_TXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXHPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR16]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR17]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR18]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR19]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR20]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR21]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR22]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR23]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR24]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR25]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR26]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR27]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR28]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR29]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR30]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR31]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER1]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER2]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_MASTER]      = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_RCAL]        = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_AFEREG]              = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSE]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSEIDAC]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSERCAL]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LPO]                 = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_MASTER]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_IDAC]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_STATUS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_CODE_OUT]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL0]         = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL1]         = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL2]         = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL3]         = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL4]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL5]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL6]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL7]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL8]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL9]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL11]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST1]           = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST2]           = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST3]           = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, },
+       [B2056_SYN_PLL_BIAS_RESET]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL1]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL3]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL5]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL6]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_REFDIV]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_PFD]             = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_CP1]             = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_CP2]             = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_SYN_PLL_CP3]             = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER1]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER2]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER3]     = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER4]     = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER5]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD1]            = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD2]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO1]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO2]            = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, },
+       [B2056_SYN_PLL_MONITOR1]        = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, },
+       [B2056_SYN_PLL_MONITOR2]        = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL4]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL5]         = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL6]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL7]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL8]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL9]         = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL11]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL12]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_SYN_PLL_VCOCAL13]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_SYN_PLL_VREG]            = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS3]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU2]           = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU8]           = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BIAS_RESET]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RCCR1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF1]       = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER1]        = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER2]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF1]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGENBUF2]           = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, },
+       [B2056_SYN_LOGEN_BUF3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF4]          = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV1]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV2]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV3]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLOUT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_CALEN]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PEAKDET1]      = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_ACL_OVR]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL_WAITCNT]   = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_CALVALID]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev3_tx[] = {
+       [B2056_TX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_GAIN_BW]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_I]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_Q]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_I]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_Q]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER1]       = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RXIQCAL_TXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_VCM_HG]         = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_IQCAL_IDAC]           = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, },
+       [B2056_TX_TSSI_VCM]             = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_AMP_DET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MUX]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSIA]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSIG]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PA_SPARE1]            = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_TX_PA_SPARE2]            = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_TX_INTPAA_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAA_IAUX_STAT]     = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_TX_INTPAA_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_STAT]    = { .ghz5 = 0x002d, .ghz2 = 0x002d, NOUPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAA_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAA_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_STAT]     = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_STAT]    = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAG_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAG_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PADA_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_BOOST_TUNE]      = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, },
+       [B2056_TX_PADA_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PADG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PADG_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PADG_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PGAA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PGAA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAA_BOOST_TUNE]      = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, },
+       [B2056_TX_PGAA_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAA_MISC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PGAG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PGAG_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAG_MISC]            = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_MIXA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXA_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_MIXG]                 = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXG_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_BB_GM_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_GM]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC]            = { .ghz5 = 0x0074, .ghz2 = 0x0074, UPLOAD, },
+       [B2056_TX_TXLPF_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL]          = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF0]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF1]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF2]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF3]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF4]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF5]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF6]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_BW]             = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_TXLPF_GAIN]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_0]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_1]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_2]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_3]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_4]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_5]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_6]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_OPAMP_IDAC]     = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_TX_TXLPF_MISC]           = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, },
+       [B2056_TX_TXSPARE1]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_INTPA_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PAD_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PGA_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_BW]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev3_rx[] = {
+       [B2056_RX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXIQCAL_RXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_RX_RSSI_PU]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_SEL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_GAIN]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_RSSI_NB_IDAC]         = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_POLE]            = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_RSSI_WB1_IDAC]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_RSSI_MISC]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_LNAA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAA_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAA_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_A_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAA1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAA2_IDAC]           = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_RX_LNA1A_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_LNAG_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAG_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAG_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_G_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAG1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAG2_IDAC]           = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_RX_LNA1G_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_MIXA_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXA_VCM]             = { .ghz5 = 0x0099, .ghz2 = 0x0099, NOUPLOAD, },
+       [B2056_RX_MIXA_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_LOB_BIAS]        = { .ghz5 = 0x0044, .ghz2 = 0x0044, UPLOAD, },
+       [B2056_RX_MIXA_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_CMFB_IDAC]       = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_AUX]        = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_MIXA_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXA_MAST_BIAS]       = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, },
+       [B2056_RX_MIXG_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXG_VCM]             = { .ghz5 = 0x0099, .ghz2 = 0x0099, NOUPLOAD, },
+       [B2056_RX_MIXG_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_LOB_BIAS]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_MIXG_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_CMFB_IDAC]       = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXG_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_MASTER]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_IOPAMP]           = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_RX_TIA_QOPAMP]           = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_RX_TIA_IMISC]            = { .ghz5 = 0x0057, .ghz2 = 0x0057, NOUPLOAD, },
+       [B2056_RX_TIA_QMISC]            = { .ghz5 = 0x0057, .ghz2 = 0x0057, NOUPLOAD, },
+       [B2056_RX_TIA_GAIN]             = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_BB_LPF_MASTER]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_AACI_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_RXLPF_IDAC]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_BIAS_DCCANCEL]  = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_RX_RXLPF_OUTVCM]         = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, },
+       [B2056_RX_RXLPF_INVCM_BODY]     = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_CC_OP]          = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RXLPF_GAIN]           = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, },
+       [B2056_RX_RXLPF_Q_BW]           = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, },
+       [B2056_RX_RXLPF_HP_CORNER_BW]   = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_HPC]      = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_LPC]      = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_0]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_UNUSED]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_VGA_MASTER]           = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS]             = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS_DCCANCEL]    = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_RX_VGA_GAIN]             = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_VGA_HP_CORNER_BW]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_VGABUF_BIAS]          = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGABUF_GAIN_BW]       = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_A]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_G]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE1]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAA_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAG_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_MIXTIA_GAIN]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_VGA_BUF_GAIN]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_Q]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_BUF_BW]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_HPC_RC]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev4_syn[] = {
+       [B2056_SYN_RESERVED_ADDR2]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR3]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR4]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR5]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR6]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR7]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_CTRL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_PU]              = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_COM_OVR]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RESET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RCAL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_TXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXHPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR16]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR17]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR18]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR19]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR20]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR21]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR22]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR23]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR24]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR25]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR26]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR27]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR28]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR29]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR30]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR31]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER1]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER2]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_MASTER]      = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_RCAL]        = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_AFEREG]              = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSE]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSEIDAC]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSERCAL]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LPO]                 = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_MASTER]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_IDAC]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_STATUS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_CODE_OUT]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL0]         = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL1]         = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL2]         = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL3]         = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL4]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL5]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL6]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL7]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL8]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL9]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL11]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST1]           = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST2]           = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST3]           = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, },
+       [B2056_SYN_PLL_BIAS_RESET]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL1]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL3]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL5]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL6]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_REFDIV]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_PFD]             = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_CP1]             = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_CP2]             = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_SYN_PLL_CP3]             = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER1]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER2]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER3]     = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER4]     = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER5]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD1]            = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD2]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO1]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO2]            = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, },
+       [B2056_SYN_PLL_MONITOR1]        = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, },
+       [B2056_SYN_PLL_MONITOR2]        = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL4]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL5]         = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL6]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL7]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL8]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL9]         = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL11]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL12]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_SYN_PLL_VCOCAL13]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_SYN_PLL_VREG]            = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS3]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU2]           = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU8]           = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BIAS_RESET]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RCCR1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF1]       = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER1]        = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER2]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF1]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGENBUF2]           = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, },
+       [B2056_SYN_LOGEN_BUF3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF4]          = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV1]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV2]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV3]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLOUT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_CALEN]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PEAKDET1]      = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_ACL_OVR]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL_WAITCNT]   = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_CALVALID]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev4_tx[] = {
+       [B2056_TX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_GAIN_BW]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_I]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_Q]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_I]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_Q]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER1]       = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RXIQCAL_TXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_VCM_HG]         = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_IQCAL_IDAC]           = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, },
+       [B2056_TX_TSSI_VCM]             = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_AMP_DET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MUX]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSIA]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSIG]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PA_SPARE1]            = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_TX_PA_SPARE2]            = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_TX_INTPAA_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAA_IAUX_STAT]     = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_TX_INTPAA_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_STAT]    = { .ghz5 = 0x002d, .ghz2 = 0x002d, NOUPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAA_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAA_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_STAT]     = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_STAT]    = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAG_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAG_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PADA_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_BOOST_TUNE]      = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, },
+       [B2056_TX_PADA_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PADG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PADG_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PADG_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PGAA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PGAA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAA_BOOST_TUNE]      = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, },
+       [B2056_TX_PGAA_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAA_MISC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PGAG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PGAG_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAG_MISC]            = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_MIXA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXA_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_MIXG]                 = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXG_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_BB_GM_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_GM]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC]            = { .ghz5 = 0x0072, .ghz2 = 0x0072, UPLOAD, },
+       [B2056_TX_TXLPF_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL]          = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF0]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF1]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF2]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF3]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF4]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF5]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF6]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_BW]             = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_TXLPF_GAIN]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_0]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_1]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_2]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_3]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_4]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_5]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_6]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_OPAMP_IDAC]     = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_TX_TXLPF_MISC]           = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, },
+       [B2056_TX_TXSPARE1]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_INTPA_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PAD_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PGA_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_BW]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev4_rx[] = {
+       [B2056_RX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXIQCAL_RXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_RX_RSSI_PU]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_SEL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_GAIN]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_RSSI_NB_IDAC]         = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_POLE]            = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_RSSI_WB1_IDAC]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_RSSI_MISC]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_LNAA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAA_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAA_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_A_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAA1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAA2_IDAC]           = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_RX_LNA1A_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_LNAG_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAG_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAG_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_G_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAG1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAG2_IDAC]           = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_RX_LNA1G_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_MIXA_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXA_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXA_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_LOB_BIAS]        = { .ghz5 = 0x0044, .ghz2 = 0x0044, UPLOAD, },
+       [B2056_RX_MIXA_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_CMFB_IDAC]       = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_AUX]        = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_MIXA_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXA_MAST_BIAS]       = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, },
+       [B2056_RX_MIXG_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXG_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXG_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_LOB_BIAS]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_MIXG_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_CMFB_IDAC]       = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXG_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_MASTER]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_IOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_QOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_IMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_QMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_GAIN]             = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_BB_LPF_MASTER]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_AACI_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_RXLPF_IDAC]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_BIAS_DCCANCEL]  = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_RX_RXLPF_OUTVCM]         = { .ghz5 = 0x002f, .ghz2 = 0x002f, UPLOAD, },
+       [B2056_RX_RXLPF_INVCM_BODY]     = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_CC_OP]          = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RXLPF_GAIN]           = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, },
+       [B2056_RX_RXLPF_Q_BW]           = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, },
+       [B2056_RX_RXLPF_HP_CORNER_BW]   = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_HPC]      = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_LPC]      = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_0]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_UNUSED]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_VGA_MASTER]           = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS]             = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS_DCCANCEL]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_RX_VGA_GAIN]             = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_VGA_HP_CORNER_BW]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_VGABUF_BIAS]          = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGABUF_GAIN_BW]       = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_A]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_G]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE1]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAA_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAG_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_MIXTIA_GAIN]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_VGA_BUF_GAIN]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_Q]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_BUF_BW]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_HPC_RC]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev5_syn[] = {
+       [B2056_SYN_RESERVED_ADDR2]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR3]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR4]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR5]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR6]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR7]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_CTRL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_PU]              = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_COM_OVR]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RESET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RCAL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_TXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXHPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR16]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR17]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR18]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR19]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR20]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR21]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR22]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR23]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR24]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR25]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR26]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR27]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR28]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR29]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR30]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR31]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER1]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER2]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_MASTER]      = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_RCAL]        = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_AFEREG]              = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSE]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSEIDAC]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSERCAL]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LPO]                 = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_MASTER]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_IDAC]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_STATUS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_CODE_OUT]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL0]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL1]         = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL2]         = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL3]         = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL4]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL5]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL6]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL7]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL8]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL9]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL11]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST1]           = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST2]           = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST3]           = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, },
+       [B2056_SYN_PLL_BIAS_RESET]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL1]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL3]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL5]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL6]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_REFDIV]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_PFD]             = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_CP1]             = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_CP2]             = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_SYN_PLL_CP3]             = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER1]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER2]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER3]     = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER4]     = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER5]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD1]            = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD2]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO1]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO2]            = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, },
+       [B2056_SYN_PLL_MONITOR1]        = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, },
+       [B2056_SYN_PLL_MONITOR2]        = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL4]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL5]         = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL6]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL7]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL8]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL9]         = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL11]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL12]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_SYN_PLL_VCOCAL13]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_SYN_PLL_VREG]            = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS3]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU2]           = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU8]           = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BIAS_RESET]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RCCR1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF1]       = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER1]        = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER2]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF1]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGENBUF2]           = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, },
+       [B2056_SYN_LOGEN_BUF3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF4]          = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV1]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV2]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV3]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLOUT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_CALEN]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PEAKDET1]      = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_ACL_OVR]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL_WAITCNT]   = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_CALVALID]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev5_tx[] = {
+       [B2056_TX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_GAIN_BW]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_I]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_Q]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_I]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_Q]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER1]       = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RXIQCAL_TXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_VCM_HG]         = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_IQCAL_IDAC]           = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, },
+       [B2056_TX_TSSI_VCM]             = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_AMP_DET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MUX]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSIA]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSIG]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PA_SPARE1]            = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_TX_PA_SPARE2]            = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_TX_INTPAA_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAA_IAUX_STAT]     = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_TX_INTPAA_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_STAT]    = { .ghz5 = 0x002d, .ghz2 = 0x002d, NOUPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAA_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAA_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_STAT]     = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_STAT]    = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAG_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAG_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PADA_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_BOOST_TUNE]      = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, },
+       [B2056_TX_PADA_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PADG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PADG_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PADG_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PGAA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PGAA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAA_BOOST_TUNE]      = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, },
+       [B2056_TX_PGAA_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAA_MISC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PGAG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PGAG_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAG_MISC]            = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_MIXA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXA_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_MIXG]                 = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXG_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_BB_GM_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_GM]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_TX_TXLPF_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL]          = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF0]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF1]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF2]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF3]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF4]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF5]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF6]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_BW]             = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_TXLPF_GAIN]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_0]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_1]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_2]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_3]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_4]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_5]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_6]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_OPAMP_IDAC]     = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_TX_TXLPF_MISC]           = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, },
+       [B2056_TX_TXSPARE1]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_INTPA_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PAD_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PGA_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_BW]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC0]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC1]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC2]           = { .ghz5 = 0x0071, .ghz2 = 0x0071, UPLOAD, },
+       [B2056_TX_GMBB_IDAC3]           = { .ghz5 = 0x0071, .ghz2 = 0x0071, UPLOAD, },
+       [B2056_TX_GMBB_IDAC4]           = { .ghz5 = 0x0072, .ghz2 = 0x0072, UPLOAD, },
+       [B2056_TX_GMBB_IDAC5]           = { .ghz5 = 0x0073, .ghz2 = 0x0073, UPLOAD, },
+       [B2056_TX_GMBB_IDAC6]           = { .ghz5 = 0x0074, .ghz2 = 0x0074, UPLOAD, },
+       [B2056_TX_GMBB_IDAC7]           = { .ghz5 = 0x0075, .ghz2 = 0x0075, UPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev5_rx[] = {
+       [B2056_RX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXIQCAL_RXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_RX_RSSI_PU]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_SEL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_GAIN]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_RSSI_NB_IDAC]         = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_POLE]            = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_RSSI_WB1_IDAC]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_RSSI_MISC]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_LNAA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAA_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAA_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_A_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAA1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAA2_IDAC]           = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_RX_LNA1A_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_LNAG_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAG_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAG_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_G_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAG1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAG2_IDAC]           = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_RX_LNA1G_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_MIXA_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXA_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXA_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_LOB_BIAS]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, UPLOAD, },
+       [B2056_RX_MIXA_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_CMFB_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_RX_MIXA_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_RX_MIXA_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXA_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXG_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXG_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_LOB_BIAS]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_MIXG_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_CMFB_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_RX_MIXG_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXG_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_MASTER]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_IOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_QOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_IMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_QMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_GAIN]             = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_BB_LPF_MASTER]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_AACI_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_RXLPF_IDAC]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_BIAS_DCCANCEL]  = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_RX_RXLPF_OUTVCM]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, },
+       [B2056_RX_RXLPF_INVCM_BODY]     = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_CC_OP]          = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RXLPF_GAIN]           = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, },
+       [B2056_RX_RXLPF_Q_BW]           = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, },
+       [B2056_RX_RXLPF_HP_CORNER_BW]   = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_HPC]      = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_LPC]      = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_0]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_UNUSED]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_VGA_MASTER]           = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS]             = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS_DCCANCEL]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_RX_VGA_GAIN]             = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_VGA_HP_CORNER_BW]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_VGABUF_BIAS]          = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGABUF_GAIN_BW]       = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_A]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_G]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE1]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAA_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAG_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_MIXTIA_GAIN]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_VGA_BUF_GAIN]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_Q]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_BUF_BW]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_HPC_RC]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev6_syn[] = {
+       [B2056_SYN_RESERVED_ADDR2]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR3]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR4]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR5]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR6]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR7]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_CTRL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_PU]              = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_COM_OVR]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RESET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RCAL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_TXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXHPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR16]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR17]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR18]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR19]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR20]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR21]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR22]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR23]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR24]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR25]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR26]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR27]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR28]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR29]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR30]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR31]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER1]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER2]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_MASTER]      = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_RCAL]        = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_AFEREG]              = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSE]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSEIDAC]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSERCAL]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LPO]                 = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_MASTER]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_IDAC]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_STATUS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_CODE_OUT]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL0]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL1]         = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL2]         = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL3]         = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL4]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL5]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL6]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL7]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL8]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL9]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL11]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST1]           = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST2]           = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST3]           = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, },
+       [B2056_SYN_PLL_BIAS_RESET]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL1]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL3]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL5]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL6]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_REFDIV]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_PFD]             = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_CP1]             = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_CP2]             = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_SYN_PLL_CP3]             = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER1]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER2]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER3]     = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER4]     = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER5]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD1]            = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD2]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO1]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO2]            = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, },
+       [B2056_SYN_PLL_MONITOR1]        = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, },
+       [B2056_SYN_PLL_MONITOR2]        = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL4]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL5]         = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL6]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL7]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL8]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL9]         = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL11]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL12]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_SYN_PLL_VCOCAL13]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_SYN_PLL_VREG]            = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS3]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU2]           = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU8]           = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BIAS_RESET]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RCCR1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF1]       = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER1]        = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER2]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF1]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGENBUF2]           = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, },
+       [B2056_SYN_LOGEN_BUF3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF4]          = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV1]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV2]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV3]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLOUT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_CALEN]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PEAKDET1]      = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_ACL_OVR]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL_WAITCNT]   = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_CALVALID]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev6_tx[] = {
+       [B2056_TX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_GAIN_BW]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_I]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_Q]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_I]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_Q]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER1]       = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RXIQCAL_TXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_VCM_HG]         = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_IQCAL_IDAC]           = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, },
+       [B2056_TX_TSSI_VCM]             = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_AMP_DET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MUX]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSIA]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSIG]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PA_SPARE1]            = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_TX_PA_SPARE2]            = { .ghz5 = 0x00ee, .ghz2 = 0x00ee, UPLOAD, },
+       [B2056_TX_INTPAA_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAA_IAUX_STAT]     = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, },
+       [B2056_TX_INTPAA_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_STAT]    = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAA_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAA_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_STAT]     = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_STAT]    = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAG_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAG_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PADA_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_BOOST_TUNE]      = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, },
+       [B2056_TX_PADA_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PADG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PADG_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PADG_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PGAA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PGAA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAA_BOOST_TUNE]      = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, },
+       [B2056_TX_PGAA_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAA_MISC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PGAG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PGAG_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAG_MISC]            = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_MIXA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXA_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_MIXG]                 = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXG_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_BB_GM_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_GM]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_TX_TXLPF_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL]          = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF0]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF1]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF2]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF3]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF4]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF5]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF6]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_BW]             = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_TXLPF_GAIN]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_0]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_1]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_2]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_3]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_4]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_5]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_6]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_OPAMP_IDAC]     = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_TX_TXLPF_MISC]           = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, },
+       [B2056_TX_TXSPARE1]             = { .ghz5 = 0x0030, .ghz2 = 0x0030, UPLOAD, },
+       [B2056_TX_TXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_INTPA_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PAD_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PGA_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_BW]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC0]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC1]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC2]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC3]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC4]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC5]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC6]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC7]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev6_rx[] = {
+       [B2056_RX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXIQCAL_RXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_RX_RSSI_PU]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_SEL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_GAIN]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_RSSI_NB_IDAC]         = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_POLE]            = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_RSSI_WB1_IDAC]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_RSSI_MISC]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_LNAA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAA_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAA_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_A_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAA1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAA2_IDAC]           = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_RX_LNA1A_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_LNAG_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAG_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAG_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_G_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAG1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAG2_IDAC]           = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_RX_LNA1G_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_MIXA_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXA_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXA_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_LOB_BIAS]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, UPLOAD, },
+       [B2056_RX_MIXA_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_CMFB_IDAC]       = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_RX_MIXA_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXA_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXG_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXG_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_LOB_BIAS]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_MIXG_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_CMFB_IDAC]       = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXG_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_MASTER]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_IOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_QOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_IMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_QMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_GAIN]             = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_BB_LPF_MASTER]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_AACI_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_RXLPF_IDAC]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_BIAS_DCCANCEL]  = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_RX_RXLPF_OUTVCM]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, },
+       [B2056_RX_RXLPF_INVCM_BODY]     = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_CC_OP]          = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RXLPF_GAIN]           = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, },
+       [B2056_RX_RXLPF_Q_BW]           = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, },
+       [B2056_RX_RXLPF_HP_CORNER_BW]   = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_HPC]      = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_LPC]      = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_0]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_UNUSED]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_VGA_MASTER]           = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS]             = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS_DCCANCEL]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_RX_VGA_GAIN]             = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_VGA_HP_CORNER_BW]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_VGABUF_BIAS]          = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGABUF_GAIN_BW]       = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_A]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_G]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE1]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE3]             = { .ghz5 = 0x0005, .ghz2 = 0x0005, UPLOAD, },
+       [B2056_RX_RXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAA_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAG_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_MIXTIA_GAIN]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_VGA_BUF_GAIN]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_Q]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_BUF_BW]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_HPC_RC]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev7_syn[] = {
+       [B2056_SYN_RESERVED_ADDR2]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR3]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR4]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR5]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR6]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR7]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_CTRL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_PU]              = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_COM_OVR]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RESET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RCAL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_TXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXHPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR16]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR17]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR18]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR19]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR20]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR21]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR22]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR23]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR24]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR25]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR26]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR27]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR28]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR29]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR30]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR31]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER1]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER2]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_MASTER]      = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_RCAL]        = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_AFEREG]              = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSE]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSEIDAC]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSERCAL]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LPO]                 = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_MASTER]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_IDAC]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_STATUS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_CODE_OUT]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL0]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL1]         = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL2]         = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL3]         = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL4]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL5]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL6]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL7]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL8]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL9]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL11]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST1]           = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST2]           = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST3]           = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, },
+       [B2056_SYN_PLL_BIAS_RESET]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL1]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL3]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL5]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL6]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_REFDIV]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_PFD]             = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_CP1]             = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_CP2]             = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_SYN_PLL_CP3]             = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER1]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER2]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER3]     = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER4]     = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER5]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD1]            = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD2]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO1]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO2]            = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, },
+       [B2056_SYN_PLL_MONITOR1]        = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, },
+       [B2056_SYN_PLL_MONITOR2]        = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL4]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL5]         = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL6]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL7]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL8]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL9]         = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL11]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL12]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_SYN_PLL_VCOCAL13]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_SYN_PLL_VREG]            = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS3]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU2]           = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU8]           = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BIAS_RESET]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RCCR1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF1]       = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER1]        = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER2]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF1]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGENBUF2]           = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, },
+       [B2056_SYN_LOGEN_BUF3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF4]          = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV1]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV2]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV3]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLOUT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_CALEN]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PEAKDET1]      = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_ACL_OVR]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL_WAITCNT]   = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_CALVALID]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev7_tx[] = {
+       [B2056_TX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_GAIN_BW]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_I]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_Q]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_I]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_Q]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER1]       = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RXIQCAL_TXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_VCM_HG]         = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_IQCAL_IDAC]           = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, },
+       [B2056_TX_TSSI_VCM]             = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_AMP_DET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MUX]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSIA]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSIG]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PA_SPARE1]            = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_TX_PA_SPARE2]            = { .ghz5 = 0x00ee, .ghz2 = 0x00ee, UPLOAD, },
+       [B2056_TX_INTPAA_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAA_IAUX_STAT]     = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, },
+       [B2056_TX_INTPAA_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_STAT]    = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAA_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAA_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_STAT]     = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_STAT]    = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAG_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAG_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PADA_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_BOOST_TUNE]      = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, },
+       [B2056_TX_PADA_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PADG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PADG_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PADG_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PGAA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PGAA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAA_BOOST_TUNE]      = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, },
+       [B2056_TX_PGAA_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAA_MISC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PGAG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PGAG_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAG_MISC]            = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_MIXA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXA_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_MIXG]                 = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXG_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_BB_GM_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_GM]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_TX_TXLPF_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL]          = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF0]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF1]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF2]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF3]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF4]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF5]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF6]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_BW]             = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_TXLPF_GAIN]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_0]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_1]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_2]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_3]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_4]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_5]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_6]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_OPAMP_IDAC]     = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_TX_TXLPF_MISC]           = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, },
+       [B2056_TX_TXSPARE1]             = { .ghz5 = 0x0030, .ghz2 = 0x0030, UPLOAD, },
+       [B2056_TX_TXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_INTPA_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PAD_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PGA_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_BW]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC0]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC1]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC2]           = { .ghz5 = 0x0071, .ghz2 = 0x0071, UPLOAD, },
+       [B2056_TX_GMBB_IDAC3]           = { .ghz5 = 0x0071, .ghz2 = 0x0071, UPLOAD, },
+       [B2056_TX_GMBB_IDAC4]           = { .ghz5 = 0x0072, .ghz2 = 0x0072, UPLOAD, },
+       [B2056_TX_GMBB_IDAC5]           = { .ghz5 = 0x0073, .ghz2 = 0x0073, UPLOAD, },
+       [B2056_TX_GMBB_IDAC6]           = { .ghz5 = 0x0074, .ghz2 = 0x0074, UPLOAD, },
+       [B2056_TX_GMBB_IDAC7]           = { .ghz5 = 0x0075, .ghz2 = 0x0075, UPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev7_rx[] = {
+       [B2056_RX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXIQCAL_RXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_RX_RSSI_PU]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_SEL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_GAIN]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_RSSI_NB_IDAC]         = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_POLE]            = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_RSSI_WB1_IDAC]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_RSSI_MISC]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_LNAA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAA_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAA_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_A_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAA1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAA2_IDAC]           = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_RX_LNA1A_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_LNAG_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAG_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAG_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_G_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAG1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAG2_IDAC]           = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_RX_LNA1G_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_MIXA_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXA_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXA_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_LOB_BIAS]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, UPLOAD, },
+       [B2056_RX_MIXA_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_CMFB_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_RX_MIXA_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_RX_MIXA_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXA_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXG_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXG_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_LOB_BIAS]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_MIXG_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_CMFB_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_RX_MIXG_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXG_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_MASTER]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_IOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_QOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_IMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_QMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_GAIN]             = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_BB_LPF_MASTER]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_AACI_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_RXLPF_IDAC]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_BIAS_DCCANCEL]  = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_RX_RXLPF_OUTVCM]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, },
+       [B2056_RX_RXLPF_INVCM_BODY]     = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_CC_OP]          = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RXLPF_GAIN]           = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, },
+       [B2056_RX_RXLPF_Q_BW]           = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, },
+       [B2056_RX_RXLPF_HP_CORNER_BW]   = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_HPC]      = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_LPC]      = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_0]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_UNUSED]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_VGA_MASTER]           = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS]             = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS_DCCANCEL]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_RX_VGA_GAIN]             = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_VGA_HP_CORNER_BW]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_VGABUF_BIAS]          = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGABUF_GAIN_BW]       = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_A]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_G]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE1]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAA_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAG_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_MIXTIA_GAIN]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_VGA_BUF_GAIN]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_Q]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_BUF_BW]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_HPC_RC]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev8_syn[] = {
+       [B2056_SYN_RESERVED_ADDR2]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR3]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR4]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR5]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR6]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR7]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_CTRL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_PU]              = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_COM_OVR]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RESET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RCAL]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_TXLPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_COM_RC_RXHPF]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR16]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR17]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR18]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR19]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR20]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR21]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR22]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR23]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR24]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR25]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR26]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR27]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR28]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR29]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR30]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RESERVED_ADDR31]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER1]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_GPIO_MASTER2]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_MASTER]      = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_TOPBIAS_RCAL]        = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_AFEREG]              = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSE]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSEIDAC]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_TEMPPROCSENSERCAL]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LPO]                 = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_MASTER]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_IDAC]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_VDDCAL_STATUS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCAL_CODE_OUT]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL0]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL1]         = { .ghz5 = 0x001f, .ghz2 = 0x001f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL2]         = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL3]         = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL4]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL5]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL6]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL7]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL8]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL9]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_RCCAL_CTRL11]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_ZCAL_SPARE2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST1]           = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST2]           = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_MAST3]           = { .ghz5 = 0x0018, .ghz2 = 0x0018, NOUPLOAD, },
+       [B2056_SYN_PLL_BIAS_RESET]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL1]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL3]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL5]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_SYN_PLL_XTAL6]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_REFDIV]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_PFD]             = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_CP1]             = { .ghz5 = 0x000f, .ghz2 = 0x000f, NOUPLOAD, },
+       [B2056_SYN_PLL_CP2]             = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_SYN_PLL_CP3]             = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER1]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER2]     = { .ghz5 = 0x000d, .ghz2 = 0x000d, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER3]     = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER4]     = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_PLL_LOOPFILTER5]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD1]            = { .ghz5 = 0x001c, .ghz2 = 0x001c, NOUPLOAD, },
+       [B2056_SYN_PLL_MMD2]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO1]            = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCO2]            = { .ghz5 = 0x00f7, .ghz2 = 0x00f7, UPLOAD, },
+       [B2056_SYN_PLL_MONITOR1]        = { .ghz5 = 0x00b4, .ghz2 = 0x00b4, NOUPLOAD, },
+       [B2056_SYN_PLL_MONITOR2]        = { .ghz5 = 0x00d2, .ghz2 = 0x00d2, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL4]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL5]         = { .ghz5 = 0x0096, .ghz2 = 0x0096, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL6]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL7]         = { .ghz5 = 0x003e, .ghz2 = 0x003e, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL8]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL9]         = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL10]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL11]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_SYN_PLL_VCOCAL12]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_SYN_PLL_VCOCAL13]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_SYN_PLL_VREG]            = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS2]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_PLL_STATUS3]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU2]           = { .ghz5 = 0x0040, .ghz2 = 0x0040, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PU8]           = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BIAS_RESET]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RCCR1]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF1]       = { .ghz5 = 0x0060, .ghz2 = 0x0060, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER1]        = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER2]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF1]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGENBUF2]           = { .ghz5 = 0x008f, .ghz2 = 0x008f, UPLOAD, },
+       [B2056_SYN_LOGEN_BUF3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF4]          = { .ghz5 = 0x00cc, .ghz2 = 0x00cc, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV1]          = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV2]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_DIV3]          = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLOUT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACLCAL3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_CALEN]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_PEAKDET1]      = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_ACL_OVR]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_DIFF_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_ACL_OVR]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_VCOBUF2_OVRVAL]= { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_SYN_LOGEN_MIXER3_OVRVAL] = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF5_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_BUF6_OVRVAL]   = { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CBUFTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSRX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX1_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX2_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX3_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CMOSTX4_OVRVAL]= { .ghz5 = 0x0066, .ghz2 = 0x0066, NOUPLOAD, },
+       [B2056_SYN_LOGEN_ACL_WAITCNT]   = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_SYN_LOGEN_CORE_CALVALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_RX_CMOS_CALVALID]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_SYN_LOGEN_TX_CMOS_VALID] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev8_tx[] = {
+       [B2056_TX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_GAIN_BW]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_I]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_FINE_Q]          = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_I]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_LOFT_COARSE_Q]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER1]       = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_TX_COM_MASTER2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_RXIQCAL_TXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_IQCAL_VCM_HG]         = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_IQCAL_IDAC]           = { .ghz5 = 0x0037, .ghz2 = 0x0037, NOUPLOAD, },
+       [B2056_TX_TSSI_VCM]             = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_TX_AMP_DET]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TX_SSI_MUX]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSIA]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSIG]                = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TSSI_MISC3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PA_SPARE1]            = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_TX_PA_SPARE2]            = { .ghz5 = 0x00ee, .ghz2 = 0x00ee, UPLOAD, },
+       [B2056_TX_INTPAA_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAA_IAUX_STAT]     = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, },
+       [B2056_TX_INTPAA_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_STAT]    = { .ghz5 = 0x0050, .ghz2 = 0x0050, UPLOAD, },
+       [B2056_TX_INTPAA_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAA_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAA_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAA_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_MASTER]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_GAIN]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_BOOST_TUNE]    = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_STAT]     = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_TX_INTPAG_IAUX_DYN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_STAT]    = { .ghz5 = 0x001e, .ghz2 = 0x001e, NOUPLOAD, },
+       [B2056_TX_INTPAG_IMAIN_DYN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_INTPAG_CASCBIAS]      = { .ghz5 = 0x006e, .ghz2 = 0x006e, NOUPLOAD, },
+       [B2056_TX_INTPAG_PASLOPE]       = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_TX_INTPAG_PA_MISC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PADA_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADA_BOOST_TUNE]      = { .ghz5 = 0x0038, .ghz2 = 0x0038, NOUPLOAD, },
+       [B2056_TX_PADA_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PADG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PADG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PADG_CASCBIAS]        = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_TX_PADG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PADG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PADG_SLOPE]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, UPLOAD, },
+       [B2056_TX_PGAA_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAA_IDAC]            = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_TX_PGAA_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAA_BOOST_TUNE]      = { .ghz5 = 0x0083, .ghz2 = 0x0083, NOUPLOAD, },
+       [B2056_TX_PGAA_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAA_MISC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_MASTER]          = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_PGAG_IDAC]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_TX_PGAG_GAIN]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_PGAG_BOOST_TUNE]      = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_TX_PGAG_SLOPE]           = { .ghz5 = 0x0077, .ghz2 = 0x0077, UPLOAD, },
+       [B2056_TX_PGAG_MISC]            = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_TX_MIXA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXA_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_MIXG]                 = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_MIXG_BOOST_TUNE]      = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_TX_BB_GM_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_GM]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_TX_TXLPF_MASTER]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL]          = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF0]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF1]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF2]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF3]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF4]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF5]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_RCCAL_OFF6]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_BW]             = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_TX_TXLPF_GAIN]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_0]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_1]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_2]         = { .ghz5 = 0x000e, .ghz2 = 0x000e, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_3]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_4]         = { .ghz5 = 0x0013, .ghz2 = 0x0013, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_5]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_IDAC_6]         = { .ghz5 = 0x001b, .ghz2 = 0x001b, NOUPLOAD, },
+       [B2056_TX_TXLPF_OPAMP_IDAC]     = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_TX_TXLPF_MISC]           = { .ghz5 = 0x005b, .ghz2 = 0x005b, NOUPLOAD, },
+       [B2056_TX_TXSPARE1]             = { .ghz5 = 0x0030, .ghz2 = 0x0030, UPLOAD, },
+       [B2056_TX_TXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE3]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_TXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_INTPA_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PAD_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_PGA_GAIN]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_GM_TXLPF_GAIN] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_BW]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_STATUS_TXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC0]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC1]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC2]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC3]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC4]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC5]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC6]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+       [B2056_TX_GMBB_IDAC7]           = { .ghz5 = 0x0070, .ghz2 = 0x0070, NOUPLOAD, },
+};
+
+static const struct b2056_inittab_entry b2056_inittab_rev8_rx[] = {
+       [B2056_RX_RESERVED_ADDR2]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR3]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR4]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR5]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR6]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR7]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_CTRL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_PU]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_OVR]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RESET]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RCAL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_TXLPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_COM_RC_RXHPF]         = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR16]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR17]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR18]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR19]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR20]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR21]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR22]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR23]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR24]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR25]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR26]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR27]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR28]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR29]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR30]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RESERVED_ADDR31]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXIQCAL_RXMUX]        = { .ghz5 = 0x0003, .ghz2 = 0x0003, NOUPLOAD, },
+       [B2056_RX_RSSI_PU]              = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_SEL]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RSSI_GAIN]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_RSSI_NB_IDAC]         = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2I_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_1]     = { .ghz5 = 0x0015, .ghz2 = 0x0015, NOUPLOAD, },
+       [B2056_RX_RSSI_WB2Q_IDAC_2]     = { .ghz5 = 0x0005, .ghz2 = 0x0005, NOUPLOAD, },
+       [B2056_RX_RSSI_POLE]            = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_RSSI_WB1_IDAC]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_RSSI_MISC]            = { .ghz5 = 0x0090, .ghz2 = 0x0090, NOUPLOAD, },
+       [B2056_RX_LNAA_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAA_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAA_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_A_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAA1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAA2_IDAC]           = { .ghz5 = 0x00ff, .ghz2 = 0x00ff, UPLOAD, },
+       [B2056_RX_LNA1A_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_LNAG_MASTER]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_LNAG_TUNE]            = { .ghz5 = 0x0088, .ghz2 = 0x0088, NOUPLOAD, },
+       [B2056_RX_LNAG_GAIN]            = { .ghz5 = 0x0032, .ghz2 = 0x0032, NOUPLOAD, },
+       [B2056_RX_LNA_G_SLOPE]          = { .ghz5 = 0x0077, .ghz2 = 0x0077, NOUPLOAD, },
+       [B2056_RX_BIASPOLE_LNAG1_IDAC]  = { .ghz5 = 0x0017, .ghz2 = 0x0017, UPLOAD, },
+       [B2056_RX_LNAG2_IDAC]           = { .ghz5 = 0x00f0, .ghz2 = 0x00f0, UPLOAD, },
+       [B2056_RX_LNA1G_MISC]           = { .ghz5 = 0x0020, .ghz2 = 0x0020, NOUPLOAD, },
+       [B2056_RX_MIXA_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXA_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXA_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_LOB_BIAS]        = { .ghz5 = 0x0088, .ghz2 = 0x0088, UPLOAD, },
+       [B2056_RX_MIXA_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXA_CMFB_IDAC]       = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, UPLOAD, },
+       [B2056_RX_MIXA_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXA_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXA_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_MIXG_VCM]             = { .ghz5 = 0x0055, .ghz2 = 0x0055, UPLOAD, },
+       [B2056_RX_MIXG_CTRLPTAT]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_LOB_BIAS]        = { .ghz5 = 0x0011, .ghz2 = 0x0011, NOUPLOAD, },
+       [B2056_RX_MIXG_CORE_IDAC]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_MIXG_CMFB_IDAC]       = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_AUX]        = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MAIN]       = { .ghz5 = 0x0006, .ghz2 = 0x0006, NOUPLOAD, },
+       [B2056_RX_MIXG_BIAS_MISC]       = { .ghz5 = 0x0004, .ghz2 = 0x0004, NOUPLOAD, },
+       [B2056_RX_MIXG_MAST_BIAS]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_MASTER]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_IOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_QOPAMP]           = { .ghz5 = 0x0026, .ghz2 = 0x0026, UPLOAD, },
+       [B2056_RX_TIA_IMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_QMISC]            = { .ghz5 = 0x000f, .ghz2 = 0x000f, UPLOAD, },
+       [B2056_RX_TIA_GAIN]             = { .ghz5 = 0x0044, .ghz2 = 0x0044, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TIA_SPARE2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_BB_LPF_MASTER]        = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_AACI_MASTER]          = { .ghz5 = 0x0008, .ghz2 = 0x0008, NOUPLOAD, },
+       [B2056_RX_RXLPF_IDAC]           = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_LOWQ] = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_OPAMPBIAS_HIGHQ]= { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_RXLPF_BIAS_DCCANCEL]  = { .ghz5 = 0x0002, .ghz2 = 0x0002, NOUPLOAD, },
+       [B2056_RX_RXLPF_OUTVCM]         = { .ghz5 = 0x0004, .ghz2 = 0x0004, UPLOAD, },
+       [B2056_RX_RXLPF_INVCM_BODY]     = { .ghz5 = 0x0007, .ghz2 = 0x0007, NOUPLOAD, },
+       [B2056_RX_RXLPF_CC_OP]          = { .ghz5 = 0x0055, .ghz2 = 0x0055, NOUPLOAD, },
+       [B2056_RX_RXLPF_GAIN]           = { .ghz5 = 0x0023, .ghz2 = 0x0023, NOUPLOAD, },
+       [B2056_RX_RXLPF_Q_BW]           = { .ghz5 = 0x0041, .ghz2 = 0x0041, NOUPLOAD, },
+       [B2056_RX_RXLPF_HP_CORNER_BW]   = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_HPC]      = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF0]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF1]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF2]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF3]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF4]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF5]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF6]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXHPF_OFF7]           = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_RCCAL_LPC]      = { .ghz5 = 0x000c, .ghz2 = 0x000c, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_0]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_1]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_2]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_3]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXLPF_OFF_4]          = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_UNUSED]               = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_VGA_MASTER]           = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS]             = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGA_BIAS_DCCANCEL]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, UPLOAD, },
+       [B2056_RX_VGA_GAIN]             = { .ghz5 = 0x000a, .ghz2 = 0x000a, NOUPLOAD, },
+       [B2056_RX_VGA_HP_CORNER_BW]     = { .ghz5 = 0x0001, .ghz2 = 0x0001, NOUPLOAD, },
+       [B2056_RX_VGABUF_BIAS]          = { .ghz5 = 0x0022, .ghz2 = 0x0022, NOUPLOAD, },
+       [B2056_RX_VGABUF_GAIN_BW]       = { .ghz5 = 0x0030, .ghz2 = 0x0030, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_A]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_TXFBMIX_G]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE1]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE2]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE3]             = { .ghz5 = 0x0005, .ghz2 = 0x0005, UPLOAD, },
+       [B2056_RX_RXSPARE4]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE5]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE6]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE7]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE8]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE9]             = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE10]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE11]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE12]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE13]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE14]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE15]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_RXSPARE16]            = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAA_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_LNAG_GAIN]     = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_MIXTIA_GAIN]   = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_GAIN]    = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_VGA_BUF_GAIN]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_Q]       = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_BUF_BW]  = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_VGA_HPC] = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_RXLPF_RC]      = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+       [B2056_RX_STATUS_HPC_RC]        = { .ghz5 = 0x0000, .ghz2 = 0x0000, NOUPLOAD, },
+};
+
+#define INITTABSPTS(prefix) \
+       .syn            = prefix##_syn,                 \
+       .syn_length     = ARRAY_SIZE(prefix##_syn),     \
+       .tx             = prefix##_tx,                  \
+       .tx_length      = ARRAY_SIZE(prefix##_tx),      \
+       .rx             = prefix##_rx,                  \
+       .rx_length      = ARRAY_SIZE(prefix##_rx)
+
+struct b2056_inittabs_pts b2056_inittabs[] = {
+       [3] = { INITTABSPTS(b2056_inittab_rev3) },
+       [4] = { INITTABSPTS(b2056_inittab_rev4) },
+       [5] = { INITTABSPTS(b2056_inittab_rev5) },
+       [6] = { INITTABSPTS(b2056_inittab_rev6) },
+       [7] = { INITTABSPTS(b2056_inittab_rev7) },
+       [8] = { INITTABSPTS(b2056_inittab_rev8) },
+       [9] = { INITTABSPTS(b2056_inittab_rev7) },
+};
+
 #define RADIOREGS3(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \
                   r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \
                   r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, \
@@ -6045,15 +9009,88 @@ static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev8[] =
   },
 };
 
-/* TODO: add support for rev4+ devices by searching in rev4+ tables */
+static void b2056_upload_inittab(struct b43_wldev *dev, bool ghz5,
+                                bool ignore_uploadflag, u16 routing,
+                                const struct b2056_inittab_entry *e,
+                                unsigned int length)
+{
+       unsigned int i;
+       u16 value;
+
+       for (i = 0; i < length; i++, e++) {
+               if (!(e->flags & B2056_INITTAB_ENTRY_OK))
+                       continue;
+               if ((e->flags & B2056_INITTAB_UPLOAD) || ignore_uploadflag) {
+                       if (ghz5)
+                               value = e->ghz5;
+                       else
+                               value = e->ghz2;
+                       b43_radio_write(dev, routing | i, value);
+               }
+       }
+}
+
+void b2056_upload_inittabs(struct b43_wldev *dev,
+                          bool ghz5, bool ignore_uploadflag)
+{
+       struct b2056_inittabs_pts *pts;
+
+       if (dev->phy.rev >= ARRAY_SIZE(b2056_inittabs)) {
+               B43_WARN_ON(1);
+               return;
+       }
+       pts = &b2056_inittabs[dev->phy.rev];
+
+       b2056_upload_inittab(dev, ghz5, ignore_uploadflag,
+                               B2056_SYN, pts->syn, pts->syn_length);
+       b2056_upload_inittab(dev, ghz5, ignore_uploadflag,
+                               B2056_TX0, pts->tx, pts->tx_length);
+       b2056_upload_inittab(dev, ghz5, ignore_uploadflag,
+                               B2056_TX1, pts->tx, pts->tx_length);
+       b2056_upload_inittab(dev, ghz5, ignore_uploadflag,
+                               B2056_RX0, pts->rx, pts->rx_length);
+       b2056_upload_inittab(dev, ghz5, ignore_uploadflag,
+                               B2056_RX1, pts->rx, pts->rx_length);
+}
+
 const struct b43_nphy_channeltab_entry_rev3 *
 b43_nphy_get_chantabent_rev3(struct b43_wldev *dev, u16 freq)
 {
        const struct b43_nphy_channeltab_entry_rev3 *e;
-       unsigned int i;
+       unsigned int length, i;
+
+       switch (dev->phy.rev) {
+       case 3:
+               e = b43_nphy_channeltab_rev3;
+               length = ARRAY_SIZE(b43_nphy_channeltab_rev3);
+               break;
+       case 4:
+               e = b43_nphy_channeltab_rev4;
+               length = ARRAY_SIZE(b43_nphy_channeltab_rev4);
+               break;
+       case 5:
+               e = b43_nphy_channeltab_rev5;
+               length = ARRAY_SIZE(b43_nphy_channeltab_rev5);
+               break;
+       case 6:
+               e = b43_nphy_channeltab_rev6;
+               length = ARRAY_SIZE(b43_nphy_channeltab_rev6);
+               break;
+       case 7:
+       case 9:
+               e = b43_nphy_channeltab_rev7_9;
+               length = ARRAY_SIZE(b43_nphy_channeltab_rev7_9);
+               break;
+       case 8:
+               e = b43_nphy_channeltab_rev8;
+               length = ARRAY_SIZE(b43_nphy_channeltab_rev8);
+               break;
+       default:
+               B43_WARN_ON(1);
+               return NULL;
+       }
 
-       for (i = 0; i < ARRAY_SIZE(b43_nphy_channeltab_rev3); i++) {
-               e = &(b43_nphy_channeltab_rev3[i]);
+       for (i = 0; i < length; i++, e++) {
                if (e->freq == freq)
                        return e;
        }
index 302600c..d601f6e 100644 (file)
@@ -1114,4 +1114,7 @@ struct b43_nphy_channeltab_entry_rev3 {
        struct b43_phy_n_sfo_cfg phy_regs;
 };
 
+void b2056_upload_inittabs(struct b43_wldev *dev,
+                          bool ghz5, bool ignore_uploadflag);
+
 #endif /* B43_RADIO_2056_H_ */
index f4bec32..af505bc 100644 (file)
@@ -596,12 +596,7 @@ struct iwl_cfg iwl6005_2bg_cfg = {
        .need_dc_calib = true,                                  \
        .need_temp_offset_calib = true,                         \
        .led_mode = IWL_LED_RF_STATE,                           \
-       .adv_pm = true,                                         \
-       /*                                                      \
-        *Due to bluetooth, we transmit 2.4 GHz probes          \
-        * only on antenna A                                    \
-        */                                                     \
-       .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A
+       .adv_pm = true                                          \
 
 struct iwl_cfg iwl6030_2agn_cfg = {
        .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN",
index 4bc82fc..3dee87e 100644 (file)
@@ -1492,15 +1492,11 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
        if (priv->cfg->scan_rx_antennas[band])
                rx_ant = priv->cfg->scan_rx_antennas[band];
 
-       if (priv->cfg->scan_tx_antennas[band])
-               scan_tx_antennas = priv->cfg->scan_tx_antennas[band];
-
-       if (priv->cfg->bt_params &&
-           priv->cfg->bt_params->advanced_bt_coexist &&
-           priv->bt_full_concurrent) {
-               /* operated as 1x1 in full concurrency mode */
-               scan_tx_antennas = first_antenna(
-                       priv->cfg->scan_tx_antennas[band]);
+       if (band == IEEE80211_BAND_2GHZ &&
+           priv->cfg->bt_params &&
+           priv->cfg->bt_params->advanced_bt_coexist) {
+               /* transmit 2.4 GHz probes only on first antenna */
+               scan_tx_antennas = first_antenna(scan_tx_antennas);
        }
 
        priv->scan_tx_ant[band] = iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band],
index d407547..f13a83a 100644 (file)
@@ -3280,9 +3280,10 @@ void iwlagn_mac_stop(struct ieee80211_hw *hw)
 
        flush_workqueue(priv->workqueue);
 
-       /* enable interrupts again in order to receive rfkill changes */
+       /* User space software may expect getting rfkill changes
+        * even if interface is down */
        iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
-       iwl_enable_interrupts(priv);
+       iwl_enable_rfkill_int(priv);
 
        IWL_DEBUG_MAC80211(priv, "leave\n");
 }
@@ -3634,7 +3635,8 @@ void iwlagn_configure_filter(struct ieee80211_hw *hw,
                        changed_flags, *total_flags);
 
        CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK);
-       CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK);
+       /* Setting _just_ RXON_FILTER_CTL2HOST_MSK causes FH errors */
+       CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_PROMISC_MSK);
        CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK);
 
 #undef CHK
@@ -4190,14 +4192,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
         * 8. Enable interrupts and read RFKILL state
         *********************************************/
 
-       /* enable interrupts if needed: hw bug w/a */
+       /* enable rfkill interrupt: hw bug w/a */
        pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
        if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
                pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
                pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
        }
 
-       iwl_enable_interrupts(priv);
+       iwl_enable_rfkill_int(priv);
 
        /* If platform's RF_KILL switch is NOT set to KILL */
        if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
@@ -4411,7 +4413,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
        {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)},
        {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)},
 
-/* 6x00 Series Gen2a */
+/* 6x05 Series */
        {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6005_2agn_cfg)},
        {IWL_PCI_DEVICE(0x0082, 0x1306, iwl6005_2abg_cfg)},
        {IWL_PCI_DEVICE(0x0082, 0x1307, iwl6005_2bg_cfg)},
@@ -4420,7 +4422,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
        {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)},
        {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)},
 
-/* 6x00 Series Gen2b */
+/* 6x30 Series */
        {IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)},
        {IWL_PCI_DEVICE(0x008A, 0x5307, iwl1030_bg_cfg)},
        {IWL_PCI_DEVICE(0x008A, 0x5325, iwl1030_bgn_cfg)},
@@ -4446,7 +4448,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
        {IWL_PCI_DEVICE(0x0089, 0x1311, iwl6050_2agn_cfg)},
        {IWL_PCI_DEVICE(0x0089, 0x1316, iwl6050_2abg_cfg)},
 
-/* 6x50 WiFi/WiMax Series Gen2 */
+/* 6150 WiFi/WiMax Series */
        {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)},
        {IWL_PCI_DEVICE(0x0885, 0x1306, iwl6150_bgn_cfg)},
        {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)},
index f80685a..a347437 100644 (file)
@@ -411,7 +411,6 @@ struct iwl_cfg {
        const bool need_dc_calib;         /* if used set to true */
        const bool need_temp_offset_calib; /* if used set to true */
        u8 scan_rx_antennas[IEEE80211_NUM_BANDS];
-       u8 scan_tx_antennas[IEEE80211_NUM_BANDS];
        enum iwl_led_mode led_mode;
        const bool adv_pm;
        const bool rx_with_siso_diversity;
index 3f5bedd..8821f08 100644 (file)
@@ -148,6 +148,12 @@ static inline void iwl_disable_interrupts(struct iwl_priv *priv)
        IWL_DEBUG_ISR(priv, "Disabled interrupts\n");
 }
 
+static inline void iwl_enable_rfkill_int(struct iwl_priv *priv)
+{
+       IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n");
+       iwl_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
+}
+
 static inline void iwl_enable_interrupts(struct iwl_priv *priv)
 {
        IWL_DEBUG_ISR(priv, "Enabling interrupts\n");
index 516e557..46ccdf4 100644 (file)
@@ -45,7 +45,7 @@
 /* default: IWL_LED_BLINK(0) using blinking index table */
 static int led_mode;
 module_param(led_mode, int, S_IRUGO);
-MODULE_PARM_DESC(led_mode, "led mode: 0=system default, "
+MODULE_PARM_DESC(led_mode, "0=system default, "
                "1=On(RF On)/Off(RF Off), 2=blinking");
 
 static const struct {
index ecd4d04..0060023 100644 (file)
@@ -784,7 +784,7 @@ static int lbs_spi_thread(void *data)
                                up(&card->spi_thread_terminated);
                                do_exit(0);
                        }
-               } while (err == EINTR);
+               } while (err == -EINTR);
 
                /* Read the host interrupt status register to see what we
                 * can do. */
index 4a4f005..848cc2c 100644 (file)
@@ -129,6 +129,7 @@ MODULE_PARM_DESC(workaround_interval,
 #define OID_802_11_RTS_THRESHOLD               cpu_to_le32(0x0d01020a)
 #define OID_802_11_SUPPORTED_RATES             cpu_to_le32(0x0d01020e)
 #define OID_802_11_CONFIGURATION               cpu_to_le32(0x0d010211)
+#define OID_802_11_POWER_MODE                  cpu_to_le32(0x0d010216)
 #define OID_802_11_BSSID_LIST                  cpu_to_le32(0x0d010217)
 
 
@@ -239,6 +240,12 @@ enum ndis_80211_addwep_bits {
        NDIS_80211_ADDWEP_TRANSMIT_KEY = cpu_to_le32(1 << 31)
 };
 
+enum ndis_80211_power_mode {
+       NDIS_80211_POWER_MODE_CAM,
+       NDIS_80211_POWER_MODE_MAX_PSP,
+       NDIS_80211_POWER_MODE_FAST_PSP,
+};
+
 struct ndis_80211_auth_request {
        __le32 length;
        u8 bssid[6];
@@ -478,6 +485,9 @@ struct rndis_wlan_private {
        struct mutex command_lock;
        unsigned long work_pending;
        int last_qual;
+       s32 cqm_rssi_thold;
+       u32 cqm_rssi_hyst;
+       int last_cqm_event_rssi;
 
        struct ieee80211_supported_band band;
        struct ieee80211_channel channels[ARRAY_SIZE(rndis_channels)];
@@ -500,10 +510,10 @@ struct rndis_wlan_private {
 
        /* hardware state */
        bool radio_on;
+       int power_mode;
        int infra_mode;
        bool connected;
        u8 bssid[ETH_ALEN];
-       struct ndis_80211_ssid essid;
        __le32 current_command_oid;
 
        /* encryption stuff */
@@ -570,7 +580,14 @@ static int rndis_del_pmksa(struct wiphy *wiphy, struct net_device *netdev,
 
 static int rndis_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev);
 
-static struct cfg80211_ops rndis_config_ops = {
+static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
+                               bool enabled, int timeout);
+
+static int rndis_set_cqm_rssi_config(struct wiphy *wiphy,
+                                       struct net_device *dev,
+                                       s32 rssi_thold, u32 rssi_hyst);
+
+static const struct cfg80211_ops rndis_config_ops = {
        .change_virtual_intf = rndis_change_virtual_intf,
        .scan = rndis_scan,
        .set_wiphy_params = rndis_set_wiphy_params,
@@ -589,6 +606,8 @@ static struct cfg80211_ops rndis_config_ops = {
        .set_pmksa = rndis_set_pmksa,
        .del_pmksa = rndis_del_pmksa,
        .flush_pmksa = rndis_flush_pmksa,
+       .set_power_mgmt = rndis_set_power_mgmt,
+       .set_cqm_rssi_config = rndis_set_cqm_rssi_config,
 };
 
 static void *rndis_wiphy_privid = &rndis_wiphy_privid;
@@ -687,6 +706,7 @@ static const char *oid_to_string(__le32 oid)
                OID_STR(OID_802_11_ADD_KEY);
                OID_STR(OID_802_11_REMOVE_KEY);
                OID_STR(OID_802_11_ASSOCIATION_INFORMATION);
+               OID_STR(OID_802_11_CAPABILITY);
                OID_STR(OID_802_11_PMKID);
                OID_STR(OID_802_11_NETWORK_TYPES_SUPPORTED);
                OID_STR(OID_802_11_NETWORK_TYPE_IN_USE);
@@ -697,6 +717,7 @@ static const char *oid_to_string(__le32 oid)
                OID_STR(OID_802_11_RTS_THRESHOLD);
                OID_STR(OID_802_11_SUPPORTED_RATES);
                OID_STR(OID_802_11_CONFIGURATION);
+               OID_STR(OID_802_11_POWER_MODE);
                OID_STR(OID_802_11_BSSID_LIST);
 #undef OID_STR
        }
@@ -1026,7 +1047,6 @@ static int set_essid(struct usbnet *usbdev, struct ndis_80211_ssid *ssid)
                return ret;
        }
        if (ret == 0) {
-               memcpy(&priv->essid, ssid, sizeof(priv->essid));
                priv->radio_on = true;
                netdev_dbg(usbdev->net, "%s(): radio_on = true\n", __func__);
        }
@@ -1967,8 +1987,8 @@ static struct cfg80211_bss *rndis_bss_info_update(struct usbnet *usbdev,
        int ie_len, bssid_len;
        u8 *ie;
 
-       netdev_dbg(usbdev->net, " found bssid: '%.32s' [%pM]\n",
-                  bssid->ssid.essid, bssid->mac);
+       netdev_dbg(usbdev->net, " found bssid: '%.32s' [%pM], len: %d\n",
+                  bssid->ssid.essid, bssid->mac, le32_to_cpu(bssid->length));
 
        /* parse bssid structure */
        bssid_len = le32_to_cpu(bssid->length);
@@ -2002,54 +2022,98 @@ static struct cfg80211_bss *rndis_bss_info_update(struct usbnet *usbdev,
                GFP_KERNEL);
 }
 
+static struct ndis_80211_bssid_ex *next_bssid_list_item(
+                                       struct ndis_80211_bssid_ex *bssid,
+                                       int *bssid_len, void *buf, int len)
+{
+       void *buf_end, *bssid_end;
+
+       buf_end = (char *)buf + len;
+       bssid_end = (char *)bssid + *bssid_len;
+
+       if ((int)(buf_end - bssid_end) < sizeof(bssid->length)) {
+               *bssid_len = 0;
+               return NULL;
+       } else {
+               bssid = (void *)((char *)bssid + *bssid_len);
+               *bssid_len = le32_to_cpu(bssid->length);
+               return bssid;
+       }
+}
+
+static bool check_bssid_list_item(struct ndis_80211_bssid_ex *bssid,
+                                 int bssid_len, void *buf, int len)
+{
+       void *buf_end, *bssid_end;
+
+       if (!bssid || bssid_len <= 0 || bssid_len > len)
+               return false;
+
+       buf_end = (char *)buf + len;
+       bssid_end = (char *)bssid + bssid_len;
+
+       return (int)(buf_end - bssid_end) >= 0 && (int)(bssid_end - buf) >= 0;
+}
+
 static int rndis_check_bssid_list(struct usbnet *usbdev, u8 *match_bssid,
                                        bool *matched)
 {
        void *buf = NULL;
        struct ndis_80211_bssid_list_ex *bssid_list;
        struct ndis_80211_bssid_ex *bssid;
-       int ret = -EINVAL, len, count, bssid_len;
-       bool resized = false;
+       int ret = -EINVAL, len, count, bssid_len, real_count, new_len;
 
-       netdev_dbg(usbdev->net, "check_bssid_list\n");
+       netdev_dbg(usbdev->net, "%s()\n", __func__);
 
        len = CONTROL_BUFFER_SIZE;
 resize_buf:
-       buf = kmalloc(len, GFP_KERNEL);
+       buf = kzalloc(len, GFP_KERNEL);
        if (!buf) {
                ret = -ENOMEM;
                goto out;
        }
 
-       ret = rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &len);
-       if (ret != 0)
+       /* BSSID-list might have got bigger last time we checked, keep
+        * resizing until it won't get any bigger.
+        */
+       new_len = len;
+       ret = rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &new_len);
+       if (ret != 0 || new_len < sizeof(struct ndis_80211_bssid_list_ex))
                goto out;
 
-       if (!resized && len > CONTROL_BUFFER_SIZE) {
-               resized = true;
+       if (new_len > len) {
+               len = new_len;
                kfree(buf);
                goto resize_buf;
        }
 
+       len = new_len;
+
        bssid_list = buf;
-       bssid = bssid_list->bssid;
-       bssid_len = le32_to_cpu(bssid->length);
        count = le32_to_cpu(bssid_list->num_items);
-       netdev_dbg(usbdev->net, "check_bssid_list: %d BSSIDs found (buflen: %d)\n",
-                  count, len);
+       real_count = 0;
+       netdev_dbg(usbdev->net, "%s(): buflen: %d\n", __func__, len);
 
-       while (count && ((void *)bssid + bssid_len) <= (buf + len)) {
+       bssid_len = 0;
+       bssid = next_bssid_list_item(bssid_list->bssid, &bssid_len, buf, len);
+
+       /* Device returns incorrect 'num_items'. Workaround by ignoring the
+        * received 'num_items' and walking through full bssid buffer instead.
+        */
+       while (check_bssid_list_item(bssid, bssid_len, buf, len)) {
                if (rndis_bss_info_update(usbdev, bssid) && match_bssid &&
                    matched) {
                        if (compare_ether_addr(bssid->mac, match_bssid))
                                *matched = true;
                }
 
-               bssid = (void *)bssid + bssid_len;
-               bssid_len = le32_to_cpu(bssid->length);
-               count--;
+               real_count++;
+               bssid = next_bssid_list_item(bssid, &bssid_len, buf, len);
        }
 
+       netdev_dbg(usbdev->net, "%s(): num_items from device: %d, really found:"
+                               " %d\n", __func__, count, real_count);
+
 out:
        kfree(buf);
        return ret;
@@ -2391,6 +2455,9 @@ static int rndis_set_default_key(struct wiphy *wiphy, struct net_device *netdev,
 
        priv->encr_tx_key_index = key_index;
 
+       if (is_wpa_key(priv, key_index))
+               return 0;
+
        key = priv->encr_keys[key_index];
 
        return add_wep_key(usbdev, key.material, key.len, key_index);
@@ -2521,6 +2588,51 @@ static int rndis_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev)
        return rndis_set_oid(usbdev, OID_802_11_PMKID, &pmkid, sizeof(pmkid));
 }
 
+static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
+                               bool enabled, int timeout)
+{
+       struct rndis_wlan_private *priv = wiphy_priv(wiphy);
+       struct usbnet *usbdev = priv->usbdev;
+       int power_mode;
+       __le32 mode;
+       int ret;
+
+       netdev_dbg(usbdev->net, "%s(): %s, %d\n", __func__,
+                               enabled ? "enabled" : "disabled",
+                               timeout);
+
+       if (enabled)
+               power_mode = NDIS_80211_POWER_MODE_FAST_PSP;
+       else
+               power_mode = NDIS_80211_POWER_MODE_CAM;
+
+       if (power_mode == priv->power_mode)
+               return 0;
+
+       priv->power_mode = power_mode;
+
+       mode = cpu_to_le32(power_mode);
+       ret = rndis_set_oid(usbdev, OID_802_11_POWER_MODE, &mode, sizeof(mode));
+
+       netdev_dbg(usbdev->net, "%s(): OID_802_11_POWER_MODE -> %d\n",
+                               __func__, ret);
+
+       return ret;
+}
+
+static int rndis_set_cqm_rssi_config(struct wiphy *wiphy,
+                                       struct net_device *dev,
+                                       s32 rssi_thold, u32 rssi_hyst)
+{
+       struct rndis_wlan_private *priv = wiphy_priv(wiphy);
+
+       priv->cqm_rssi_thold = rssi_thold;
+       priv->cqm_rssi_hyst = rssi_hyst;
+       priv->last_cqm_event_rssi = 0;
+
+       return 0;
+}
+
 static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid,
                                           struct ndis_80211_assoc_info *info)
 {
@@ -3050,6 +3162,32 @@ static int rndis_wlan_get_caps(struct usbnet *usbdev, struct wiphy *wiphy)
        return retval;
 }
 
+static void rndis_do_cqm(struct usbnet *usbdev, s32 rssi)
+{
+       struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
+       enum nl80211_cqm_rssi_threshold_event event;
+       int thold, hyst, last_event;
+
+       if (priv->cqm_rssi_thold >= 0 || rssi >= 0)
+               return;
+       if (priv->infra_mode != NDIS_80211_INFRA_INFRA)
+               return;
+
+       last_event = priv->last_cqm_event_rssi;
+       thold = priv->cqm_rssi_thold;
+       hyst = priv->cqm_rssi_hyst;
+
+       if (rssi < thold && (last_event == 0 || rssi < last_event - hyst))
+               event = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW;
+       else if (rssi > thold && (last_event == 0 || rssi > last_event + hyst))
+               event = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH;
+       else
+               return;
+
+       priv->last_cqm_event_rssi = rssi;
+       cfg80211_cqm_rssi_notify(usbdev->net, event, GFP_KERNEL);
+}
+
 #define DEVICE_POLLER_JIFFIES (HZ)
 static void rndis_device_poller(struct work_struct *work)
 {
@@ -3084,8 +3222,10 @@ static void rndis_device_poller(struct work_struct *work)
 
        len = sizeof(rssi);
        ret = rndis_query_oid(usbdev, OID_802_11_RSSI, &rssi, &len);
-       if (ret == 0)
+       if (ret == 0) {
                priv->last_qual = level_to_qual(le32_to_cpu(rssi));
+               rndis_do_cqm(usbdev, le32_to_cpu(rssi));
+       }
 
        netdev_dbg(usbdev->net, "dev-poller: OID_802_11_RSSI -> %d, rssi:%d, qual: %d\n",
                   ret, le32_to_cpu(rssi), level_to_qual(le32_to_cpu(rssi)));
@@ -3347,13 +3487,15 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
 
        set_default_iw_params(usbdev);
 
+       priv->power_mode = -1;
+
        /* set default rts/frag */
        rndis_set_wiphy_params(wiphy,
                        WIPHY_PARAM_FRAG_THRESHOLD | WIPHY_PARAM_RTS_THRESHOLD);
 
-       /* turn radio on */
-       priv->radio_on = true;
-       disassociate(usbdev, true);
+       /* turn radio off on init */
+       priv->radio_on = false;
+       disassociate(usbdev, false);
        netif_carrier_off(usbdev->net);
 
        return 0;
index baa1468..aa97971 100644 (file)
@@ -688,14 +688,7 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev)
        u32 status;
        u8 qid;
 
-       while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo)) {
-               /* Now remove the tx status from the FIFO */
-               if (kfifo_out(&rt2x00dev->txstatus_fifo, &status,
-                             sizeof(status)) != sizeof(status)) {
-                       WARN_ON(1);
-                       break;
-               }
-
+       while (kfifo_get(&rt2x00dev->txstatus_fifo, &status)) {
                qid = rt2x00_get_field32(status, TX_STA_FIFO_PID_QUEUE);
                if (qid >= QID_RX) {
                        /*
@@ -803,14 +796,7 @@ static void rt2800pci_txstatus_interrupt(struct rt2x00_dev *rt2x00dev)
                if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID))
                        break;
 
-               if (kfifo_is_full(&rt2x00dev->txstatus_fifo)) {
-                       WARNING(rt2x00dev, "TX status FIFO overrun,"
-                               " drop tx status report.\n");
-                       break;
-               }
-
-               if (kfifo_in(&rt2x00dev->txstatus_fifo, &status,
-                            sizeof(status)) != sizeof(status)) {
+               if (!kfifo_put(&rt2x00dev->txstatus_fifo, &status)) {
                        WARNING(rt2x00dev, "TX status FIFO overrun,"
                                "drop tx status report.\n");
                        break;
index 3e0205d..b97a4a5 100644 (file)
@@ -369,7 +369,10 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry,
 static void rt2800usb_write_tx_data(struct queue_entry *entry,
                                        struct txentry_desc *txdesc)
 {
-       u8 padding_len;
+       unsigned int len;
+       int err;
+
+       rt2800_write_tx_data(entry, txdesc);
 
        /*
         * pad(1~3 bytes) is added after each 802.11 payload.
@@ -378,9 +381,14 @@ static void rt2800usb_write_tx_data(struct queue_entry *entry,
         * | TXINFO | TXWI | 802.11 header | L2 pad | payload | pad | USB end pad |
         *                 |<------------- tx_pkt_len ------------->|
         */
-        rt2800_write_tx_data(entry, txdesc);
-        padding_len = roundup(entry->skb->len + 4, 4) - entry->skb->len;
-        memset(skb_put(entry->skb, padding_len), 0, padding_len);
+       len = roundup(entry->skb->len, 4) + 4;
+       err = skb_padto(entry->skb, len);
+       if (unlikely(err)) {
+               WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of memory\n");
+               return;
+       }
+
+       entry->skb->len = len;
 }
 
 /*
index c254d5a..84aaf39 100644 (file)
@@ -347,28 +347,16 @@ struct link {
        struct delayed_work watchdog_work;
 };
 
+enum rt2x00_delayed_flags {
+       DELAYED_UPDATE_BEACON,
+};
+
 /*
  * Interface structure
  * Per interface configuration details, this structure
  * is allocated as the private data for ieee80211_vif.
  */
 struct rt2x00_intf {
-       /*
-        * All fields within the rt2x00_intf structure
-        * must be protected with a spinlock.
-        */
-       spinlock_t lock;
-
-       /*
-        * MAC of the device.
-        */
-       u8 mac[ETH_ALEN];
-
-       /*
-        * BBSID of the AP to associate with.
-        */
-       u8 bssid[ETH_ALEN];
-
        /*
         * beacon->skb must be protected with the mutex.
         */
@@ -384,8 +372,7 @@ struct rt2x00_intf {
        /*
         * Actions that needed rescheduling.
         */
-       unsigned int delayed_flags;
-#define DELAYED_UPDATE_BEACON          0x00000001
+       unsigned long delayed_flags;
 
        /*
         * Software sequence counter, this is only required
@@ -908,7 +895,7 @@ struct rt2x00_dev {
        /*
         * FIFO for storing tx status reports between isr and tasklet.
         */
-       struct kfifo txstatus_fifo;
+       DECLARE_KFIFO_PTR(txstatus_fifo, u32);
 
        /*
         * Tasklet for processing tx status reports (rt2800pci).
index 70ca937..e7f67d5 100644 (file)
@@ -62,13 +62,13 @@ void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
         * This will prevent the device being confused when it wants
         * to ACK frames or consideres itself associated.
         */
-       memset(&conf.mac, 0, sizeof(conf.mac));
+       memset(conf.mac, 0, sizeof(conf.mac));
        if (mac)
-               memcpy(&conf.mac, mac, ETH_ALEN);
+               memcpy(conf.mac, mac, ETH_ALEN);
 
-       memset(&conf.bssid, 0, sizeof(conf.bssid));
+       memset(conf.bssid, 0, sizeof(conf.bssid));
        if (bssid)
-               memcpy(&conf.bssid, bssid, ETH_ALEN);
+               memcpy(conf.bssid, bssid, ETH_ALEN);
 
        flags |= CONFIG_UPDATE_TYPE;
        if (mac || (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count))
index fa74acd..9597a03 100644 (file)
@@ -110,19 +110,6 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
 {
        struct rt2x00_dev *rt2x00dev = data;
        struct rt2x00_intf *intf = vif_to_intf(vif);
-       int delayed_flags;
-
-       /*
-        * Copy all data we need during this action under the protection
-        * of a spinlock. Otherwise race conditions might occur which results
-        * into an invalid configuration.
-        */
-       spin_lock(&intf->lock);
-
-       delayed_flags = intf->delayed_flags;
-       intf->delayed_flags = 0;
-
-       spin_unlock(&intf->lock);
 
        /*
         * It is possible the radio was disabled while the work had been
@@ -133,7 +120,7 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
        if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
                return;
 
-       if (delayed_flags & DELAYED_UPDATE_BEACON)
+       if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags))
                rt2x00queue_update_beacon(rt2x00dev, vif, true);
 }
 
@@ -813,8 +800,7 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
        /*
         * Allocate tx status FIFO for driver use.
         */
-       if (test_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags) &&
-           rt2x00dev->ops->lib->txstatus_tasklet) {
+       if (test_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags)) {
                /*
                 * Allocate txstatus fifo and tasklet, we use a size of 512
                 * for the kfifo which is big enough to store 512/4=128 tx
@@ -828,9 +814,10 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
                        return status;
 
                /* tasklet for processing the tx status reports. */
-               tasklet_init(&rt2x00dev->txstatus_tasklet,
-                            rt2x00dev->ops->lib->txstatus_tasklet,
-                            (unsigned long)rt2x00dev);
+               if (rt2x00dev->ops->lib->txstatus_tasklet)
+                       tasklet_init(&rt2x00dev->txstatus_tasklet,
+                                    rt2x00dev->ops->lib->txstatus_tasklet,
+                                    (unsigned long)rt2x00dev);
 
        }
 
index c637bca..b7ad46e 100644 (file)
@@ -40,8 +40,6 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
        if (tx_info->control.sta)
                txdesc->mpdu_density =
                    tx_info->control.sta->ht_cap.ampdu_density;
-       else
-               txdesc->mpdu_density = 0;
 
        txdesc->ba_size = 7;    /* FIXME: What value is needed? */
 
index 4cac7ad..658542d 100644 (file)
@@ -268,7 +268,6 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
        else
                rt2x00dev->intf_sta_count++;
 
-       spin_lock_init(&intf->lock);
        spin_lock_init(&intf->seqlock);
        mutex_init(&intf->beacon_skb_mutex);
        intf->beacon = entry;
@@ -282,9 +281,8 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
         * STA interfaces at this time, since this can cause
         * invalid behavior in the device.
         */
-       memcpy(&intf->mac, vif->addr, ETH_ALEN);
        rt2x00lib_config_intf(rt2x00dev, intf, vif->type,
-                             intf->mac, NULL);
+                             vif->addr, NULL);
 
        /*
         * Some filters depend on the current working mode. We can force
@@ -445,9 +443,7 @@ static void rt2x00mac_set_tim_iter(void *data, u8 *mac,
            vif->type != NL80211_IFTYPE_WDS)
                return;
 
-       spin_lock(&intf->lock);
-       intf->delayed_flags |= DELAYED_UPDATE_BEACON;
-       spin_unlock(&intf->lock);
+       set_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags);
 }
 
 int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
@@ -472,17 +468,17 @@ EXPORT_SYMBOL_GPL(rt2x00mac_set_tim);
 static void memcpy_tkip(struct rt2x00lib_crypto *crypto, u8 *key, u8 key_len)
 {
        if (key_len > NL80211_TKIP_DATA_OFFSET_ENCR_KEY)
-               memcpy(&crypto->key,
+               memcpy(crypto->key,
                       &key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY],
                       sizeof(crypto->key));
 
        if (key_len > NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY)
-               memcpy(&crypto->tx_mic,
+               memcpy(crypto->tx_mic,
                       &key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY],
                       sizeof(crypto->tx_mic));
 
        if (key_len > NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY)
-               memcpy(&crypto->rx_mic,
+               memcpy(crypto->rx_mic,
                       &key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY],
                       sizeof(crypto->rx_mic));
 }
@@ -492,7 +488,6 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                      struct ieee80211_key_conf *key)
 {
        struct rt2x00_dev *rt2x00dev = hw->priv;
-       struct rt2x00_intf *intf = vif_to_intf(vif);
        int (*set_key) (struct rt2x00_dev *rt2x00dev,
                        struct rt2x00lib_crypto *crypto,
                        struct ieee80211_key_conf *key);
@@ -516,7 +511,7 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
        if (rt2x00dev->intf_sta_count)
                crypto.bssidx = 0;
        else
-               crypto.bssidx = intf->mac[5] & (rt2x00dev->ops->max_ap_intf - 1);
+               crypto.bssidx = vif->addr[5] & (rt2x00dev->ops->max_ap_intf - 1);
 
        crypto.cipher = rt2x00crypto_key_to_cipher(key);
        if (crypto.cipher == CIPHER_NONE)
@@ -534,7 +529,7 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
        if (crypto.cipher == CIPHER_TKIP)
                memcpy_tkip(&crypto, &key->key[0], key->keylen);
        else
-               memcpy(&crypto.key, &key->key[0], key->keylen);
+               memcpy(crypto.key, &key->key[0], key->keylen);
        /*
         * Each BSS has a maximum of 4 shared keys.
         * Shared key index values:
@@ -614,22 +609,8 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
        if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
                return;
 
-       spin_lock(&intf->lock);
-
-       /*
-        * conf->bssid can be NULL if coming from the internal
-        * beacon update routine.
-        */
-       if (changes & BSS_CHANGED_BSSID)
-               memcpy(&intf->bssid, bss_conf->bssid, ETH_ALEN);
-
-       spin_unlock(&intf->lock);
-
        /*
-        * Call rt2x00_config_intf() outside of the spinlock context since
-        * the call will sleep for USB drivers. By using the ieee80211_if_conf
-        * values as arguments we make keep access to rt2x00_intf thread safe
-        * even without the lock.
+        * Update the BSSID.
         */
        if (changes & BSS_CHANGED_BSSID)
                rt2x00lib_config_intf(rt2x00dev, intf, vif->type, NULL,
index 28e6ff1..73631c6 100644 (file)
@@ -286,7 +286,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
        rt2x00dev->irq = pci_dev->irq;
        rt2x00dev->name = pci_name(pci_dev);
 
-       if (pci_dev->is_pcie)
+       if (pci_is_pcie(pci_dev))
                rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
        else
                rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI);
index 93cbfbe..9975690 100644 (file)
@@ -1,7 +1,2 @@
-rtl8180-objs           := rtl8180_dev.o rtl8180_rtl8225.o rtl8180_sa2400.o rtl8180_max2820.o rtl8180_grf5101.o
-rtl8187-objs           := rtl8187_dev.o rtl8187_rtl8225.o rtl8187_leds.o rtl8187_rfkill.o
-
-obj-$(CONFIG_RTL8180)  += rtl8180.o
-obj-$(CONFIG_RTL8187)  += rtl8187.o
-
-
+obj-$(CONFIG_RTL8180)  += rtl8180/
+obj-$(CONFIG_RTL8187)  += rtl8187/
diff --git a/drivers/net/wireless/rtl818x/rtl8180.h b/drivers/net/wireless/rtl818x/rtl8180.h
deleted file mode 100644 (file)
index 3052331..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-#ifndef RTL8180_H
-#define RTL8180_H
-
-#include "rtl818x.h"
-
-#define MAX_RX_SIZE IEEE80211_MAX_RTS_THRESHOLD
-
-#define RF_PARAM_ANALOGPHY     (1 << 0)
-#define RF_PARAM_ANTBDEFAULT   (1 << 1)
-#define RF_PARAM_CARRIERSENSE1 (1 << 2)
-#define RF_PARAM_CARRIERSENSE2 (1 << 3)
-
-#define BB_ANTATTEN_CHAN14     0x0C
-#define BB_ANTENNA_B           0x40
-
-#define BB_HOST_BANG           (1 << 30)
-#define BB_HOST_BANG_EN        (1 << 2)
-#define BB_HOST_BANG_CLK       (1 << 1)
-#define BB_HOST_BANG_DATA      1
-
-#define ANAPARAM_TXDACOFF_SHIFT        27
-#define ANAPARAM_PWR0_SHIFT    28
-#define ANAPARAM_PWR0_MASK     (0x07 << ANAPARAM_PWR0_SHIFT)
-#define ANAPARAM_PWR1_SHIFT    20
-#define ANAPARAM_PWR1_MASK     (0x7F << ANAPARAM_PWR1_SHIFT)
-
-struct rtl8180_tx_desc {
-       __le32 flags;
-       __le16 rts_duration;
-       __le16 plcp_len;
-       __le32 tx_buf;
-       __le32 frame_len;
-       __le32 next_tx_desc;
-       u8 cw;
-       u8 retry_limit;
-       u8 agc;
-       u8 flags2;
-       u32 reserved[2];
-} __packed;
-
-struct rtl8180_rx_desc {
-       __le32 flags;
-       __le32 flags2;
-       union {
-               __le32 rx_buf;
-               __le64 tsft;
-       };
-} __packed;
-
-struct rtl8180_tx_ring {
-       struct rtl8180_tx_desc *desc;
-       dma_addr_t dma;
-       unsigned int idx;
-       unsigned int entries;
-       struct sk_buff_head queue;
-};
-
-struct rtl8180_vif {
-       struct ieee80211_hw *dev;
-
-       /* beaconing */
-       struct delayed_work beacon_work;
-       bool enable_beacon;
-};
-
-struct rtl8180_priv {
-       /* common between rtl818x drivers */
-       struct rtl818x_csr __iomem *map;
-       const struct rtl818x_rf_ops *rf;
-       struct ieee80211_vif *vif;
-
-       /* rtl8180 driver specific */
-       spinlock_t lock;
-       struct rtl8180_rx_desc *rx_ring;
-       dma_addr_t rx_ring_dma;
-       unsigned int rx_idx;
-       struct sk_buff *rx_buf[32];
-       struct rtl8180_tx_ring tx_ring[4];
-       struct ieee80211_channel channels[14];
-       struct ieee80211_rate rates[12];
-       struct ieee80211_supported_band band;
-       struct pci_dev *pdev;
-       u32 rx_conf;
-
-       int r8185;
-       u32 anaparam;
-       u16 rfparam;
-       u8 csthreshold;
-
-       /* sequence # */
-       u16 seqno;
-};
-
-void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
-void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam);
-
-static inline u8 rtl818x_ioread8(struct rtl8180_priv *priv, u8 __iomem *addr)
-{
-       return ioread8(addr);
-}
-
-static inline u16 rtl818x_ioread16(struct rtl8180_priv *priv, __le16 __iomem *addr)
-{
-       return ioread16(addr);
-}
-
-static inline u32 rtl818x_ioread32(struct rtl8180_priv *priv, __le32 __iomem *addr)
-{
-       return ioread32(addr);
-}
-
-static inline void rtl818x_iowrite8(struct rtl8180_priv *priv,
-                                   u8 __iomem *addr, u8 val)
-{
-       iowrite8(val, addr);
-}
-
-static inline void rtl818x_iowrite16(struct rtl8180_priv *priv,
-                                    __le16 __iomem *addr, u16 val)
-{
-       iowrite16(val, addr);
-}
-
-static inline void rtl818x_iowrite32(struct rtl8180_priv *priv,
-                                    __le32 __iomem *addr, u32 val)
-{
-       iowrite32(val, addr);
-}
-
-#endif /* RTL8180_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8180/Makefile b/drivers/net/wireless/rtl818x/rtl8180/Makefile
new file mode 100644 (file)
index 0000000..cb4fb85
--- /dev/null
@@ -0,0 +1,5 @@
+rtl8180-objs           := dev.o rtl8225.o sa2400.o max2820.o grf5101.o
+
+obj-$(CONFIG_RTL8180)  += rtl8180.o
+
+ccflags-y += -Idrivers/net/wireless/rtl818x
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
new file mode 100644 (file)
index 0000000..5851cbc
--- /dev/null
@@ -0,0 +1,1188 @@
+
+/*
+ * Linux device driver for RTL8180 / RTL8185
+ *
+ * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Based on the r8180 driver, which is:
+ * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al.
+ *
+ * Thanks to Realtek for their support!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/etherdevice.h>
+#include <linux/eeprom_93cx6.h>
+#include <net/mac80211.h>
+
+#include "rtl8180.h"
+#include "rtl8225.h"
+#include "sa2400.h"
+#include "max2820.h"
+#include "grf5101.h"
+
+MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
+MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
+MODULE_DESCRIPTION("RTL8180 / RTL8185 PCI wireless driver");
+MODULE_LICENSE("GPL");
+
+static DEFINE_PCI_DEVICE_TABLE(rtl8180_table) = {
+       /* rtl8185 */
+       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8185) },
+       { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x700f) },
+       { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x701f) },
+
+       /* rtl8180 */
+       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8180) },
+       { PCI_DEVICE(0x1799, 0x6001) },
+       { PCI_DEVICE(0x1799, 0x6020) },
+       { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x3300) },
+       { }
+};
+
+MODULE_DEVICE_TABLE(pci, rtl8180_table);
+
+static const struct ieee80211_rate rtl818x_rates[] = {
+       { .bitrate = 10, .hw_value = 0, },
+       { .bitrate = 20, .hw_value = 1, },
+       { .bitrate = 55, .hw_value = 2, },
+       { .bitrate = 110, .hw_value = 3, },
+       { .bitrate = 60, .hw_value = 4, },
+       { .bitrate = 90, .hw_value = 5, },
+       { .bitrate = 120, .hw_value = 6, },
+       { .bitrate = 180, .hw_value = 7, },
+       { .bitrate = 240, .hw_value = 8, },
+       { .bitrate = 360, .hw_value = 9, },
+       { .bitrate = 480, .hw_value = 10, },
+       { .bitrate = 540, .hw_value = 11, },
+};
+
+static const struct ieee80211_channel rtl818x_channels[] = {
+       { .center_freq = 2412 },
+       { .center_freq = 2417 },
+       { .center_freq = 2422 },
+       { .center_freq = 2427 },
+       { .center_freq = 2432 },
+       { .center_freq = 2437 },
+       { .center_freq = 2442 },
+       { .center_freq = 2447 },
+       { .center_freq = 2452 },
+       { .center_freq = 2457 },
+       { .center_freq = 2462 },
+       { .center_freq = 2467 },
+       { .center_freq = 2472 },
+       { .center_freq = 2484 },
+};
+
+
+void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       int i = 10;
+       u32 buf;
+
+       buf = (data << 8) | addr;
+
+       rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->PHY[0], buf | 0x80);
+       while (i--) {
+               rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->PHY[0], buf);
+               if (rtl818x_ioread8(priv, &priv->map->PHY[2]) == (data & 0xFF))
+                       return;
+       }
+}
+
+static void rtl8180_handle_rx(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       unsigned int count = 32;
+       u8 signal, agc, sq;
+
+       while (count--) {
+               struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx];
+               struct sk_buff *skb = priv->rx_buf[priv->rx_idx];
+               u32 flags = le32_to_cpu(entry->flags);
+
+               if (flags & RTL818X_RX_DESC_FLAG_OWN)
+                       return;
+
+               if (unlikely(flags & (RTL818X_RX_DESC_FLAG_DMA_FAIL |
+                                     RTL818X_RX_DESC_FLAG_FOF |
+                                     RTL818X_RX_DESC_FLAG_RX_ERR)))
+                       goto done;
+               else {
+                       u32 flags2 = le32_to_cpu(entry->flags2);
+                       struct ieee80211_rx_status rx_status = {0};
+                       struct sk_buff *new_skb = dev_alloc_skb(MAX_RX_SIZE);
+
+                       if (unlikely(!new_skb))
+                               goto done;
+
+                       pci_unmap_single(priv->pdev,
+                                        *((dma_addr_t *)skb->cb),
+                                        MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
+                       skb_put(skb, flags & 0xFFF);
+
+                       rx_status.antenna = (flags2 >> 15) & 1;
+                       rx_status.rate_idx = (flags >> 20) & 0xF;
+                       agc = (flags2 >> 17) & 0x7F;
+                       if (priv->r8185) {
+                               if (rx_status.rate_idx > 3)
+                                       signal = 90 - clamp_t(u8, agc, 25, 90);
+                               else
+                                       signal = 95 - clamp_t(u8, agc, 30, 95);
+                       } else {
+                               sq = flags2 & 0xff;
+                               signal = priv->rf->calc_rssi(agc, sq);
+                       }
+                       rx_status.signal = signal;
+                       rx_status.freq = dev->conf.channel->center_freq;
+                       rx_status.band = dev->conf.channel->band;
+                       rx_status.mactime = le64_to_cpu(entry->tsft);
+                       rx_status.flag |= RX_FLAG_TSFT;
+                       if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR)
+                               rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
+
+                       memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
+                       ieee80211_rx_irqsafe(dev, skb);
+
+                       skb = new_skb;
+                       priv->rx_buf[priv->rx_idx] = skb;
+                       *((dma_addr_t *) skb->cb) =
+                               pci_map_single(priv->pdev, skb_tail_pointer(skb),
+                                              MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
+               }
+
+       done:
+               entry->rx_buf = cpu_to_le32(*((dma_addr_t *)skb->cb));
+               entry->flags = cpu_to_le32(RTL818X_RX_DESC_FLAG_OWN |
+                                          MAX_RX_SIZE);
+               if (priv->rx_idx == 31)
+                       entry->flags |= cpu_to_le32(RTL818X_RX_DESC_FLAG_EOR);
+               priv->rx_idx = (priv->rx_idx + 1) % 32;
+       }
+}
+
+static void rtl8180_handle_tx(struct ieee80211_hw *dev, unsigned int prio)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       struct rtl8180_tx_ring *ring = &priv->tx_ring[prio];
+
+       while (skb_queue_len(&ring->queue)) {
+               struct rtl8180_tx_desc *entry = &ring->desc[ring->idx];
+               struct sk_buff *skb;
+               struct ieee80211_tx_info *info;
+               u32 flags = le32_to_cpu(entry->flags);
+
+               if (flags & RTL818X_TX_DESC_FLAG_OWN)
+                       return;
+
+               ring->idx = (ring->idx + 1) % ring->entries;
+               skb = __skb_dequeue(&ring->queue);
+               pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf),
+                                skb->len, PCI_DMA_TODEVICE);
+
+               info = IEEE80211_SKB_CB(skb);
+               ieee80211_tx_info_clear_status(info);
+
+               if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
+                   (flags & RTL818X_TX_DESC_FLAG_TX_OK))
+                       info->flags |= IEEE80211_TX_STAT_ACK;
+
+               info->status.rates[0].count = (flags & 0xFF) + 1;
+               info->status.rates[1].idx = -1;
+
+               ieee80211_tx_status_irqsafe(dev, skb);
+               if (ring->entries - skb_queue_len(&ring->queue) == 2)
+                       ieee80211_wake_queue(dev, prio);
+       }
+}
+
+static irqreturn_t rtl8180_interrupt(int irq, void *dev_id)
+{
+       struct ieee80211_hw *dev = dev_id;
+       struct rtl8180_priv *priv = dev->priv;
+       u16 reg;
+
+       spin_lock(&priv->lock);
+       reg = rtl818x_ioread16(priv, &priv->map->INT_STATUS);
+       if (unlikely(reg == 0xFFFF)) {
+               spin_unlock(&priv->lock);
+               return IRQ_HANDLED;
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->INT_STATUS, reg);
+
+       if (reg & (RTL818X_INT_TXB_OK | RTL818X_INT_TXB_ERR))
+               rtl8180_handle_tx(dev, 3);
+
+       if (reg & (RTL818X_INT_TXH_OK | RTL818X_INT_TXH_ERR))
+               rtl8180_handle_tx(dev, 2);
+
+       if (reg & (RTL818X_INT_TXN_OK | RTL818X_INT_TXN_ERR))
+               rtl8180_handle_tx(dev, 1);
+
+       if (reg & (RTL818X_INT_TXL_OK | RTL818X_INT_TXL_ERR))
+               rtl8180_handle_tx(dev, 0);
+
+       if (reg & (RTL818X_INT_RX_OK | RTL818X_INT_RX_ERR))
+               rtl8180_handle_rx(dev);
+
+       spin_unlock(&priv->lock);
+
+       return IRQ_HANDLED;
+}
+
+static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
+{
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+       struct rtl8180_priv *priv = dev->priv;
+       struct rtl8180_tx_ring *ring;
+       struct rtl8180_tx_desc *entry;
+       unsigned long flags;
+       unsigned int idx, prio;
+       dma_addr_t mapping;
+       u32 tx_flags;
+       u8 rc_flags;
+       u16 plcp_len = 0;
+       __le16 rts_duration = 0;
+
+       prio = skb_get_queue_mapping(skb);
+       ring = &priv->tx_ring[prio];
+
+       mapping = pci_map_single(priv->pdev, skb->data,
+                                skb->len, PCI_DMA_TODEVICE);
+
+       tx_flags = RTL818X_TX_DESC_FLAG_OWN | RTL818X_TX_DESC_FLAG_FS |
+                  RTL818X_TX_DESC_FLAG_LS |
+                  (ieee80211_get_tx_rate(dev, info)->hw_value << 24) |
+                  skb->len;
+
+       if (priv->r8185)
+               tx_flags |= RTL818X_TX_DESC_FLAG_DMA |
+                           RTL818X_TX_DESC_FLAG_NO_ENC;
+
+       rc_flags = info->control.rates[0].flags;
+       if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
+               tx_flags |= RTL818X_TX_DESC_FLAG_RTS;
+               tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
+       } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
+               tx_flags |= RTL818X_TX_DESC_FLAG_CTS;
+               tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
+       }
+
+       if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS)
+               rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len,
+                                                     info);
+
+       if (!priv->r8185) {
+               unsigned int remainder;
+
+               plcp_len = DIV_ROUND_UP(16 * (skb->len + 4),
+                               (ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
+               remainder = (16 * (skb->len + 4)) %
+                           ((ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
+               if (remainder <= 6)
+                       plcp_len |= 1 << 15;
+       }
+
+       spin_lock_irqsave(&priv->lock, flags);
+
+       if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
+               if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
+                       priv->seqno += 0x10;
+               hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+               hdr->seq_ctrl |= cpu_to_le16(priv->seqno);
+       }
+
+       idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries;
+       entry = &ring->desc[idx];
+
+       entry->rts_duration = rts_duration;
+       entry->plcp_len = cpu_to_le16(plcp_len);
+       entry->tx_buf = cpu_to_le32(mapping);
+       entry->frame_len = cpu_to_le32(skb->len);
+       entry->flags2 = info->control.rates[1].idx >= 0 ?
+               ieee80211_get_alt_retry_rate(dev, info, 0)->bitrate << 4 : 0;
+       entry->retry_limit = info->control.rates[0].count;
+       entry->flags = cpu_to_le32(tx_flags);
+       __skb_queue_tail(&ring->queue, skb);
+       if (ring->entries - skb_queue_len(&ring->queue) < 2)
+               ieee80211_stop_queue(dev, prio);
+
+       spin_unlock_irqrestore(&priv->lock, flags);
+
+       rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4)));
+
+       return 0;
+}
+
+void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam)
+{
+       u8 reg;
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
+                reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite32(priv, &priv->map->ANAPARAM, anaparam);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
+                reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+}
+
+static int rtl8180_init_hw(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u16 reg;
+
+       rtl818x_iowrite8(priv, &priv->map->CMD, 0);
+       rtl818x_ioread8(priv, &priv->map->CMD);
+       msleep(10);
+
+       /* reset */
+       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
+       rtl818x_ioread8(priv, &priv->map->CMD);
+
+       reg = rtl818x_ioread8(priv, &priv->map->CMD);
+       reg &= (1 << 1);
+       reg |= RTL818X_CMD_RESET;
+       rtl818x_iowrite8(priv, &priv->map->CMD, RTL818X_CMD_RESET);
+       rtl818x_ioread8(priv, &priv->map->CMD);
+       msleep(200);
+
+       /* check success of reset */
+       if (rtl818x_ioread8(priv, &priv->map->CMD) & RTL818X_CMD_RESET) {
+               wiphy_err(dev->wiphy, "reset timeout!\n");
+               return -ETIMEDOUT;
+       }
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_LOAD);
+       rtl818x_ioread8(priv, &priv->map->CMD);
+       msleep(200);
+
+       if (rtl818x_ioread8(priv, &priv->map->CONFIG3) & (1 << 3)) {
+               /* For cardbus */
+               reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
+               reg |= 1 << 1;
+               rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
+               reg = rtl818x_ioread16(priv, &priv->map->FEMR);
+               reg |= (1 << 15) | (1 << 14) | (1 << 4);
+               rtl818x_iowrite16(priv, &priv->map->FEMR, reg);
+       }
+
+       rtl818x_iowrite8(priv, &priv->map->MSR, 0);
+
+       if (!priv->r8185)
+               rtl8180_set_anaparam(priv, priv->anaparam);
+
+       rtl818x_iowrite32(priv, &priv->map->RDSAR, priv->rx_ring_dma);
+       rtl818x_iowrite32(priv, &priv->map->TBDA, priv->tx_ring[3].dma);
+       rtl818x_iowrite32(priv, &priv->map->THPDA, priv->tx_ring[2].dma);
+       rtl818x_iowrite32(priv, &priv->map->TNPDA, priv->tx_ring[1].dma);
+       rtl818x_iowrite32(priv, &priv->map->TLPDA, priv->tx_ring[0].dma);
+
+       /* TODO: necessary? specs indicate not */
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG2);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG2, reg & ~(1 << 3));
+       if (priv->r8185) {
+               reg = rtl818x_ioread8(priv, &priv->map->CONFIG2);
+               rtl818x_iowrite8(priv, &priv->map->CONFIG2, reg | (1 << 4));
+       }
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       /* TODO: set CONFIG5 for calibrating AGC on rtl8180 + philips radio? */
+
+       /* TODO: turn off hw wep on rtl8180 */
+
+       rtl818x_iowrite32(priv, &priv->map->INT_TIMEOUT, 0);
+
+       if (priv->r8185) {
+               rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0);
+               rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0x81);
+               rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (8 << 4) | 0);
+
+               rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3);
+
+               /* TODO: set ClkRun enable? necessary? */
+               reg = rtl818x_ioread8(priv, &priv->map->GP_ENABLE);
+               rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, reg & ~(1 << 6));
+               rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+               reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
+               rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | (1 << 2));
+               rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+       } else {
+               rtl818x_iowrite16(priv, &priv->map->BRSR, 0x1);
+               rtl818x_iowrite8(priv, &priv->map->SECURITY, 0);
+
+               rtl818x_iowrite8(priv, &priv->map->PHY_DELAY, 0x6);
+               rtl818x_iowrite8(priv, &priv->map->CARRIER_SENSE_COUNTER, 0x4C);
+       }
+
+       priv->rf->init(dev);
+       if (priv->r8185)
+               rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3);
+       return 0;
+}
+
+static int rtl8180_init_rx_ring(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       struct rtl8180_rx_desc *entry;
+       int i;
+
+       priv->rx_ring = pci_alloc_consistent(priv->pdev,
+                                            sizeof(*priv->rx_ring) * 32,
+                                            &priv->rx_ring_dma);
+
+       if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) {
+               wiphy_err(dev->wiphy, "Cannot allocate RX ring\n");
+               return -ENOMEM;
+       }
+
+       memset(priv->rx_ring, 0, sizeof(*priv->rx_ring) * 32);
+       priv->rx_idx = 0;
+
+       for (i = 0; i < 32; i++) {
+               struct sk_buff *skb = dev_alloc_skb(MAX_RX_SIZE);
+               dma_addr_t *mapping;
+               entry = &priv->rx_ring[i];
+               if (!skb)
+                       return 0;
+
+               priv->rx_buf[i] = skb;
+               mapping = (dma_addr_t *)skb->cb;
+               *mapping = pci_map_single(priv->pdev, skb_tail_pointer(skb),
+                                         MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
+               entry->rx_buf = cpu_to_le32(*mapping);
+               entry->flags = cpu_to_le32(RTL818X_RX_DESC_FLAG_OWN |
+                                          MAX_RX_SIZE);
+       }
+       entry->flags |= cpu_to_le32(RTL818X_RX_DESC_FLAG_EOR);
+       return 0;
+}
+
+static void rtl8180_free_rx_ring(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       int i;
+
+       for (i = 0; i < 32; i++) {
+               struct sk_buff *skb = priv->rx_buf[i];
+               if (!skb)
+                       continue;
+
+               pci_unmap_single(priv->pdev,
+                                *((dma_addr_t *)skb->cb),
+                                MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
+               kfree_skb(skb);
+       }
+
+       pci_free_consistent(priv->pdev, sizeof(*priv->rx_ring) * 32,
+                           priv->rx_ring, priv->rx_ring_dma);
+       priv->rx_ring = NULL;
+}
+
+static int rtl8180_init_tx_ring(struct ieee80211_hw *dev,
+                               unsigned int prio, unsigned int entries)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       struct rtl8180_tx_desc *ring;
+       dma_addr_t dma;
+       int i;
+
+       ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma);
+       if (!ring || (unsigned long)ring & 0xFF) {
+               wiphy_err(dev->wiphy, "Cannot allocate TX ring (prio = %d)\n",
+                         prio);
+               return -ENOMEM;
+       }
+
+       memset(ring, 0, sizeof(*ring)*entries);
+       priv->tx_ring[prio].desc = ring;
+       priv->tx_ring[prio].dma = dma;
+       priv->tx_ring[prio].idx = 0;
+       priv->tx_ring[prio].entries = entries;
+       skb_queue_head_init(&priv->tx_ring[prio].queue);
+
+       for (i = 0; i < entries; i++)
+               ring[i].next_tx_desc =
+                       cpu_to_le32((u32)dma + ((i + 1) % entries) * sizeof(*ring));
+
+       return 0;
+}
+
+static void rtl8180_free_tx_ring(struct ieee80211_hw *dev, unsigned int prio)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       struct rtl8180_tx_ring *ring = &priv->tx_ring[prio];
+
+       while (skb_queue_len(&ring->queue)) {
+               struct rtl8180_tx_desc *entry = &ring->desc[ring->idx];
+               struct sk_buff *skb = __skb_dequeue(&ring->queue);
+
+               pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf),
+                                skb->len, PCI_DMA_TODEVICE);
+               kfree_skb(skb);
+               ring->idx = (ring->idx + 1) % ring->entries;
+       }
+
+       pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries,
+                           ring->desc, ring->dma);
+       ring->desc = NULL;
+}
+
+static int rtl8180_start(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       int ret, i;
+       u32 reg;
+
+       ret = rtl8180_init_rx_ring(dev);
+       if (ret)
+               return ret;
+
+       for (i = 0; i < 4; i++)
+               if ((ret = rtl8180_init_tx_ring(dev, i, 16)))
+                       goto err_free_rings;
+
+       ret = rtl8180_init_hw(dev);
+       if (ret)
+               goto err_free_rings;
+
+       rtl818x_iowrite32(priv, &priv->map->RDSAR, priv->rx_ring_dma);
+       rtl818x_iowrite32(priv, &priv->map->TBDA, priv->tx_ring[3].dma);
+       rtl818x_iowrite32(priv, &priv->map->THPDA, priv->tx_ring[2].dma);
+       rtl818x_iowrite32(priv, &priv->map->TNPDA, priv->tx_ring[1].dma);
+       rtl818x_iowrite32(priv, &priv->map->TLPDA, priv->tx_ring[0].dma);
+
+       ret = request_irq(priv->pdev->irq, rtl8180_interrupt,
+                         IRQF_SHARED, KBUILD_MODNAME, dev);
+       if (ret) {
+               wiphy_err(dev->wiphy, "failed to register IRQ handler\n");
+               goto err_free_rings;
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF);
+
+       rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0);
+       rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0);
+
+       reg = RTL818X_RX_CONF_ONLYERLPKT |
+             RTL818X_RX_CONF_RX_AUTORESETPHY |
+             RTL818X_RX_CONF_MGMT |
+             RTL818X_RX_CONF_DATA |
+             (7 << 8 /* MAX RX DMA */) |
+             RTL818X_RX_CONF_BROADCAST |
+             RTL818X_RX_CONF_NICMAC;
+
+       if (priv->r8185)
+               reg |= RTL818X_RX_CONF_CSDM1 | RTL818X_RX_CONF_CSDM2;
+       else {
+               reg |= (priv->rfparam & RF_PARAM_CARRIERSENSE1)
+                       ? RTL818X_RX_CONF_CSDM1 : 0;
+               reg |= (priv->rfparam & RF_PARAM_CARRIERSENSE2)
+                       ? RTL818X_RX_CONF_CSDM2 : 0;
+       }
+
+       priv->rx_conf = reg;
+       rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg);
+
+       if (priv->r8185) {
+               reg = rtl818x_ioread8(priv, &priv->map->CW_CONF);
+               reg &= ~RTL818X_CW_CONF_PERPACKET_CW_SHIFT;
+               reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT;
+               rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg);
+
+               reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL);
+               reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT;
+               reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT;
+               reg |=  RTL818X_TX_AGC_CTL_FEEDBACK_ANT;
+               rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg);
+
+               /* disable early TX */
+               rtl818x_iowrite8(priv, (u8 __iomem *)priv->map + 0xec, 0x3f);
+       }
+
+       reg = rtl818x_ioread32(priv, &priv->map->TX_CONF);
+       reg |= (6 << 21 /* MAX TX DMA */) |
+              RTL818X_TX_CONF_NO_ICV;
+
+       if (priv->r8185)
+               reg &= ~RTL818X_TX_CONF_PROBE_DTS;
+       else
+               reg &= ~RTL818X_TX_CONF_HW_SEQNUM;
+
+       /* different meaning, same value on both rtl8185 and rtl8180 */
+       reg &= ~RTL818X_TX_CONF_SAT_HWPLCP;
+
+       rtl818x_iowrite32(priv, &priv->map->TX_CONF, reg);
+
+       reg = rtl818x_ioread8(priv, &priv->map->CMD);
+       reg |= RTL818X_CMD_RX_ENABLE;
+       reg |= RTL818X_CMD_TX_ENABLE;
+       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
+
+       return 0;
+
+ err_free_rings:
+       rtl8180_free_rx_ring(dev);
+       for (i = 0; i < 4; i++)
+               if (priv->tx_ring[i].desc)
+                       rtl8180_free_tx_ring(dev, i);
+
+       return ret;
+}
+
+static void rtl8180_stop(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u8 reg;
+       int i;
+
+       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
+
+       reg = rtl818x_ioread8(priv, &priv->map->CMD);
+       reg &= ~RTL818X_CMD_TX_ENABLE;
+       reg &= ~RTL818X_CMD_RX_ENABLE;
+       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
+
+       priv->rf->stop(dev);
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG4);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG4, reg | RTL818X_CONFIG4_VCOOFF);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       free_irq(priv->pdev->irq, dev);
+
+       rtl8180_free_rx_ring(dev);
+       for (i = 0; i < 4; i++)
+               rtl8180_free_tx_ring(dev, i);
+}
+
+static u64 rtl8180_get_tsf(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+
+       return rtl818x_ioread32(priv, &priv->map->TSFT[0]) |
+              (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32;
+}
+
+static void rtl8180_beacon_work(struct work_struct *work)
+{
+       struct rtl8180_vif *vif_priv =
+               container_of(work, struct rtl8180_vif, beacon_work.work);
+       struct ieee80211_vif *vif =
+               container_of((void *)vif_priv, struct ieee80211_vif, drv_priv);
+       struct ieee80211_hw *dev = vif_priv->dev;
+       struct ieee80211_mgmt *mgmt;
+       struct sk_buff *skb;
+       int err = 0;
+
+       /* don't overflow the tx ring */
+       if (ieee80211_queue_stopped(dev, 0))
+               goto resched;
+
+       /* grab a fresh beacon */
+       skb = ieee80211_beacon_get(dev, vif);
+       if (!skb)
+               goto resched;
+
+       /*
+        * update beacon timestamp w/ TSF value
+        * TODO: make hardware update beacon timestamp
+        */
+       mgmt = (struct ieee80211_mgmt *)skb->data;
+       mgmt->u.beacon.timestamp = cpu_to_le64(rtl8180_get_tsf(dev));
+
+       /* TODO: use actual beacon queue */
+       skb_set_queue_mapping(skb, 0);
+
+       err = rtl8180_tx(dev, skb);
+       WARN_ON(err);
+
+resched:
+       /*
+        * schedule next beacon
+        * TODO: use hardware support for beacon timing
+        */
+       schedule_delayed_work(&vif_priv->beacon_work,
+                       usecs_to_jiffies(1024 * vif->bss_conf.beacon_int));
+}
+
+static int rtl8180_add_interface(struct ieee80211_hw *dev,
+                                struct ieee80211_vif *vif)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       struct rtl8180_vif *vif_priv;
+
+       /*
+        * We only support one active interface at a time.
+        */
+       if (priv->vif)
+               return -EBUSY;
+
+       switch (vif->type) {
+       case NL80211_IFTYPE_STATION:
+       case NL80211_IFTYPE_ADHOC:
+               break;
+       default:
+               return -EOPNOTSUPP;
+       }
+
+       priv->vif = vif;
+
+       /* Initialize driver private area */
+       vif_priv = (struct rtl8180_vif *)&vif->drv_priv;
+       vif_priv->dev = dev;
+       INIT_DELAYED_WORK(&vif_priv->beacon_work, rtl8180_beacon_work);
+       vif_priv->enable_beacon = false;
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0],
+                         le32_to_cpu(*(__le32 *)vif->addr));
+       rtl818x_iowrite16(priv, (__le16 __iomem *)&priv->map->MAC[4],
+                         le16_to_cpu(*(__le16 *)(vif->addr + 4)));
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       return 0;
+}
+
+static void rtl8180_remove_interface(struct ieee80211_hw *dev,
+                                    struct ieee80211_vif *vif)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       priv->vif = NULL;
+}
+
+static int rtl8180_config(struct ieee80211_hw *dev, u32 changed)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       struct ieee80211_conf *conf = &dev->conf;
+
+       priv->rf->set_chan(dev, conf);
+
+       return 0;
+}
+
+static void rtl8180_bss_info_changed(struct ieee80211_hw *dev,
+                                    struct ieee80211_vif *vif,
+                                    struct ieee80211_bss_conf *info,
+                                    u32 changed)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       struct rtl8180_vif *vif_priv;
+       int i;
+       u8 reg;
+
+       vif_priv = (struct rtl8180_vif *)&vif->drv_priv;
+
+       if (changed & BSS_CHANGED_BSSID) {
+               for (i = 0; i < ETH_ALEN; i++)
+                       rtl818x_iowrite8(priv, &priv->map->BSSID[i],
+                                        info->bssid[i]);
+
+               if (is_valid_ether_addr(info->bssid)) {
+                       if (vif->type == NL80211_IFTYPE_ADHOC)
+                               reg = RTL818X_MSR_ADHOC;
+                       else
+                               reg = RTL818X_MSR_INFRA;
+               } else
+                       reg = RTL818X_MSR_NO_LINK;
+               rtl818x_iowrite8(priv, &priv->map->MSR, reg);
+       }
+
+       if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp)
+               priv->rf->conf_erp(dev, info);
+
+       if (changed & BSS_CHANGED_BEACON_ENABLED)
+               vif_priv->enable_beacon = info->enable_beacon;
+
+       if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON)) {
+               cancel_delayed_work_sync(&vif_priv->beacon_work);
+               if (vif_priv->enable_beacon)
+                       schedule_work(&vif_priv->beacon_work.work);
+       }
+}
+
+static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev,
+                                    struct netdev_hw_addr_list *mc_list)
+{
+       return netdev_hw_addr_list_count(mc_list);
+}
+
+static void rtl8180_configure_filter(struct ieee80211_hw *dev,
+                                    unsigned int changed_flags,
+                                    unsigned int *total_flags,
+                                    u64 multicast)
+{
+       struct rtl8180_priv *priv = dev->priv;
+
+       if (changed_flags & FIF_FCSFAIL)
+               priv->rx_conf ^= RTL818X_RX_CONF_FCS;
+       if (changed_flags & FIF_CONTROL)
+               priv->rx_conf ^= RTL818X_RX_CONF_CTRL;
+       if (changed_flags & FIF_OTHER_BSS)
+               priv->rx_conf ^= RTL818X_RX_CONF_MONITOR;
+       if (*total_flags & FIF_ALLMULTI || multicast > 0)
+               priv->rx_conf |= RTL818X_RX_CONF_MULTICAST;
+       else
+               priv->rx_conf &= ~RTL818X_RX_CONF_MULTICAST;
+
+       *total_flags = 0;
+
+       if (priv->rx_conf & RTL818X_RX_CONF_FCS)
+               *total_flags |= FIF_FCSFAIL;
+       if (priv->rx_conf & RTL818X_RX_CONF_CTRL)
+               *total_flags |= FIF_CONTROL;
+       if (priv->rx_conf & RTL818X_RX_CONF_MONITOR)
+               *total_flags |= FIF_OTHER_BSS;
+       if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST)
+               *total_flags |= FIF_ALLMULTI;
+
+       rtl818x_iowrite32(priv, &priv->map->RX_CONF, priv->rx_conf);
+}
+
+static const struct ieee80211_ops rtl8180_ops = {
+       .tx                     = rtl8180_tx,
+       .start                  = rtl8180_start,
+       .stop                   = rtl8180_stop,
+       .add_interface          = rtl8180_add_interface,
+       .remove_interface       = rtl8180_remove_interface,
+       .config                 = rtl8180_config,
+       .bss_info_changed       = rtl8180_bss_info_changed,
+       .prepare_multicast      = rtl8180_prepare_multicast,
+       .configure_filter       = rtl8180_configure_filter,
+       .get_tsf                = rtl8180_get_tsf,
+};
+
+static void rtl8180_eeprom_register_read(struct eeprom_93cx6 *eeprom)
+{
+       struct ieee80211_hw *dev = eeprom->data;
+       struct rtl8180_priv *priv = dev->priv;
+       u8 reg = rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+
+       eeprom->reg_data_in = reg & RTL818X_EEPROM_CMD_WRITE;
+       eeprom->reg_data_out = reg & RTL818X_EEPROM_CMD_READ;
+       eeprom->reg_data_clock = reg & RTL818X_EEPROM_CMD_CK;
+       eeprom->reg_chip_select = reg & RTL818X_EEPROM_CMD_CS;
+}
+
+static void rtl8180_eeprom_register_write(struct eeprom_93cx6 *eeprom)
+{
+       struct ieee80211_hw *dev = eeprom->data;
+       struct rtl8180_priv *priv = dev->priv;
+       u8 reg = 2 << 6;
+
+       if (eeprom->reg_data_in)
+               reg |= RTL818X_EEPROM_CMD_WRITE;
+       if (eeprom->reg_data_out)
+               reg |= RTL818X_EEPROM_CMD_READ;
+       if (eeprom->reg_data_clock)
+               reg |= RTL818X_EEPROM_CMD_CK;
+       if (eeprom->reg_chip_select)
+               reg |= RTL818X_EEPROM_CMD_CS;
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, reg);
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(10);
+}
+
+static int __devinit rtl8180_probe(struct pci_dev *pdev,
+                                  const struct pci_device_id *id)
+{
+       struct ieee80211_hw *dev;
+       struct rtl8180_priv *priv;
+       unsigned long mem_addr, mem_len;
+       unsigned int io_addr, io_len;
+       int err, i;
+       struct eeprom_93cx6 eeprom;
+       const char *chip_name, *rf_name = NULL;
+       u32 reg;
+       u16 eeprom_val;
+       u8 mac_addr[ETH_ALEN];
+
+       err = pci_enable_device(pdev);
+       if (err) {
+               printk(KERN_ERR "%s (rtl8180): Cannot enable new PCI device\n",
+                      pci_name(pdev));
+               return err;
+       }
+
+       err = pci_request_regions(pdev, KBUILD_MODNAME);
+       if (err) {
+               printk(KERN_ERR "%s (rtl8180): Cannot obtain PCI resources\n",
+                      pci_name(pdev));
+               return err;
+       }
+
+       io_addr = pci_resource_start(pdev, 0);
+       io_len = pci_resource_len(pdev, 0);
+       mem_addr = pci_resource_start(pdev, 1);
+       mem_len = pci_resource_len(pdev, 1);
+
+       if (mem_len < sizeof(struct rtl818x_csr) ||
+           io_len < sizeof(struct rtl818x_csr)) {
+               printk(KERN_ERR "%s (rtl8180): Too short PCI resources\n",
+                      pci_name(pdev));
+               err = -ENOMEM;
+               goto err_free_reg;
+       }
+
+       if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) ||
+           (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) {
+               printk(KERN_ERR "%s (rtl8180): No suitable DMA available\n",
+                      pci_name(pdev));
+               goto err_free_reg;
+       }
+
+       pci_set_master(pdev);
+
+       dev = ieee80211_alloc_hw(sizeof(*priv), &rtl8180_ops);
+       if (!dev) {
+               printk(KERN_ERR "%s (rtl8180): ieee80211 alloc failed\n",
+                      pci_name(pdev));
+               err = -ENOMEM;
+               goto err_free_reg;
+       }
+
+       priv = dev->priv;
+       priv->pdev = pdev;
+
+       dev->max_rates = 2;
+       SET_IEEE80211_DEV(dev, &pdev->dev);
+       pci_set_drvdata(pdev, dev);
+
+       priv->map = pci_iomap(pdev, 1, mem_len);
+       if (!priv->map)
+               priv->map = pci_iomap(pdev, 0, io_len);
+
+       if (!priv->map) {
+               printk(KERN_ERR "%s (rtl8180): Cannot map device memory\n",
+                      pci_name(pdev));
+               goto err_free_dev;
+       }
+
+       BUILD_BUG_ON(sizeof(priv->channels) != sizeof(rtl818x_channels));
+       BUILD_BUG_ON(sizeof(priv->rates) != sizeof(rtl818x_rates));
+
+       memcpy(priv->channels, rtl818x_channels, sizeof(rtl818x_channels));
+       memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates));
+
+       priv->band.band = IEEE80211_BAND_2GHZ;
+       priv->band.channels = priv->channels;
+       priv->band.n_channels = ARRAY_SIZE(rtl818x_channels);
+       priv->band.bitrates = priv->rates;
+       priv->band.n_bitrates = 4;
+       dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+
+       dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
+                    IEEE80211_HW_RX_INCLUDES_FCS |
+                    IEEE80211_HW_SIGNAL_UNSPEC;
+       dev->vif_data_size = sizeof(struct rtl8180_vif);
+       dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
+                                       BIT(NL80211_IFTYPE_ADHOC);
+       dev->queues = 1;
+       dev->max_signal = 65;
+
+       reg = rtl818x_ioread32(priv, &priv->map->TX_CONF);
+       reg &= RTL818X_TX_CONF_HWVER_MASK;
+       switch (reg) {
+       case RTL818X_TX_CONF_R8180_ABCD:
+               chip_name = "RTL8180";
+               break;
+       case RTL818X_TX_CONF_R8180_F:
+               chip_name = "RTL8180vF";
+               break;
+       case RTL818X_TX_CONF_R8185_ABC:
+               chip_name = "RTL8185";
+               break;
+       case RTL818X_TX_CONF_R8185_D:
+               chip_name = "RTL8185vD";
+               break;
+       default:
+               printk(KERN_ERR "%s (rtl8180): Unknown chip! (0x%x)\n",
+                      pci_name(pdev), reg >> 25);
+               goto err_iounmap;
+       }
+
+       priv->r8185 = reg & RTL818X_TX_CONF_R8185_ABC;
+       if (priv->r8185) {
+               priv->band.n_bitrates = ARRAY_SIZE(rtl818x_rates);
+               pci_try_set_mwi(pdev);
+       }
+
+       eeprom.data = dev;
+       eeprom.register_read = rtl8180_eeprom_register_read;
+       eeprom.register_write = rtl8180_eeprom_register_write;
+       if (rtl818x_ioread32(priv, &priv->map->RX_CONF) & (1 << 6))
+               eeprom.width = PCI_EEPROM_WIDTH_93C66;
+       else
+               eeprom.width = PCI_EEPROM_WIDTH_93C46;
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_PROGRAM);
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(10);
+
+       eeprom_93cx6_read(&eeprom, 0x06, &eeprom_val);
+       eeprom_val &= 0xFF;
+       switch (eeprom_val) {
+       case 1: rf_name = "Intersil";
+               break;
+       case 2: rf_name = "RFMD";
+               break;
+       case 3: priv->rf = &sa2400_rf_ops;
+               break;
+       case 4: priv->rf = &max2820_rf_ops;
+               break;
+       case 5: priv->rf = &grf5101_rf_ops;
+               break;
+       case 9: priv->rf = rtl8180_detect_rf(dev);
+               break;
+       case 10:
+               rf_name = "RTL8255";
+               break;
+       default:
+               printk(KERN_ERR "%s (rtl8180): Unknown RF! (0x%x)\n",
+                      pci_name(pdev), eeprom_val);
+               goto err_iounmap;
+       }
+
+       if (!priv->rf) {
+               printk(KERN_ERR "%s (rtl8180): %s RF frontend not supported!\n",
+                      pci_name(pdev), rf_name);
+               goto err_iounmap;
+       }
+
+       eeprom_93cx6_read(&eeprom, 0x17, &eeprom_val);
+       priv->csthreshold = eeprom_val >> 8;
+       if (!priv->r8185) {
+               __le32 anaparam;
+               eeprom_93cx6_multiread(&eeprom, 0xD, (__le16 *)&anaparam, 2);
+               priv->anaparam = le32_to_cpu(anaparam);
+               eeprom_93cx6_read(&eeprom, 0x19, &priv->rfparam);
+       }
+
+       eeprom_93cx6_multiread(&eeprom, 0x7, (__le16 *)mac_addr, 3);
+       if (!is_valid_ether_addr(mac_addr)) {
+               printk(KERN_WARNING "%s (rtl8180): Invalid hwaddr! Using"
+                      " randomly generated MAC addr\n", pci_name(pdev));
+               random_ether_addr(mac_addr);
+       }
+       SET_IEEE80211_PERM_ADDR(dev, mac_addr);
+
+       /* CCK TX power */
+       for (i = 0; i < 14; i += 2) {
+               u16 txpwr;
+               eeprom_93cx6_read(&eeprom, 0x10 + (i >> 1), &txpwr);
+               priv->channels[i].hw_value = txpwr & 0xFF;
+               priv->channels[i + 1].hw_value = txpwr >> 8;
+       }
+
+       /* OFDM TX power */
+       if (priv->r8185) {
+               for (i = 0; i < 14; i += 2) {
+                       u16 txpwr;
+                       eeprom_93cx6_read(&eeprom, 0x20 + (i >> 1), &txpwr);
+                       priv->channels[i].hw_value |= (txpwr & 0xFF) << 8;
+                       priv->channels[i + 1].hw_value |= txpwr & 0xFF00;
+               }
+       }
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       spin_lock_init(&priv->lock);
+
+       err = ieee80211_register_hw(dev);
+       if (err) {
+               printk(KERN_ERR "%s (rtl8180): Cannot register device\n",
+                      pci_name(pdev));
+               goto err_iounmap;
+       }
+
+       wiphy_info(dev->wiphy, "hwaddr %pm, %s + %s\n",
+                  mac_addr, chip_name, priv->rf->name);
+
+       return 0;
+
+ err_iounmap:
+       iounmap(priv->map);
+
+ err_free_dev:
+       pci_set_drvdata(pdev, NULL);
+       ieee80211_free_hw(dev);
+
+ err_free_reg:
+       pci_release_regions(pdev);
+       pci_disable_device(pdev);
+       return err;
+}
+
+static void __devexit rtl8180_remove(struct pci_dev *pdev)
+{
+       struct ieee80211_hw *dev = pci_get_drvdata(pdev);
+       struct rtl8180_priv *priv;
+
+       if (!dev)
+               return;
+
+       ieee80211_unregister_hw(dev);
+
+       priv = dev->priv;
+
+       pci_iounmap(pdev, priv->map);
+       pci_release_regions(pdev);
+       pci_disable_device(pdev);
+       ieee80211_free_hw(dev);
+}
+
+#ifdef CONFIG_PM
+static int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+       pci_save_state(pdev);
+       pci_set_power_state(pdev, pci_choose_state(pdev, state));
+       return 0;
+}
+
+static int rtl8180_resume(struct pci_dev *pdev)
+{
+       pci_set_power_state(pdev, PCI_D0);
+       pci_restore_state(pdev);
+       return 0;
+}
+
+#endif /* CONFIG_PM */
+
+static struct pci_driver rtl8180_driver = {
+       .name           = KBUILD_MODNAME,
+       .id_table       = rtl8180_table,
+       .probe          = rtl8180_probe,
+       .remove         = __devexit_p(rtl8180_remove),
+#ifdef CONFIG_PM
+       .suspend        = rtl8180_suspend,
+       .resume         = rtl8180_resume,
+#endif /* CONFIG_PM */
+};
+
+static int __init rtl8180_init(void)
+{
+       return pci_register_driver(&rtl8180_driver);
+}
+
+static void __exit rtl8180_exit(void)
+{
+       pci_unregister_driver(&rtl8180_driver);
+}
+
+module_init(rtl8180_init);
+module_exit(rtl8180_exit);
diff --git a/drivers/net/wireless/rtl818x/rtl8180/grf5101.c b/drivers/net/wireless/rtl818x/rtl8180/grf5101.c
new file mode 100644 (file)
index 0000000..5ee7589
--- /dev/null
@@ -0,0 +1,190 @@
+
+/*
+ * Radio tuning for GCT GRF5101 on RTL8180
+ *
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Code from the BSD driver and the rtl8181 project have been
+ * very useful to understand certain things
+ *
+ * I want to thanks the Authors of such projects and the Ndiswrapper
+ * project Authors.
+ *
+ * A special Big Thanks also is for all people who donated me cards,
+ * making possible the creation of the original rtl8180 driver
+ * from which this code is derived!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/delay.h>
+#include <net/mac80211.h>
+
+#include "rtl8180.h"
+#include "grf5101.h"
+
+static const int grf5101_encode[] = {
+       0x0, 0x8, 0x4, 0xC,
+       0x2, 0xA, 0x6, 0xE,
+       0x1, 0x9, 0x5, 0xD,
+       0x3, 0xB, 0x7, 0xF
+};
+
+static void write_grf5101(struct ieee80211_hw *dev, u8 addr, u32 data)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u32 phy_config;
+
+       phy_config =  grf5101_encode[(data >> 8) & 0xF];
+       phy_config |= grf5101_encode[(data >> 4) & 0xF] << 4;
+       phy_config |= grf5101_encode[data & 0xF] << 8;
+       phy_config |= grf5101_encode[(addr >> 1) & 0xF] << 12;
+       phy_config |= (addr & 1) << 16;
+       phy_config |= grf5101_encode[(data & 0xf000) >> 12] << 24;
+
+       /* MAC will bang bits to the chip */
+       phy_config |= 0x90000000;
+
+       rtl818x_iowrite32(priv,
+               (__le32 __iomem *) &priv->map->RFPinsOutput, phy_config);
+
+       msleep(3);
+}
+
+static void grf5101_write_phy_antenna(struct ieee80211_hw *dev, short chan)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u8 ant = GRF5101_ANTENNA;
+
+       if (priv->rfparam & RF_PARAM_ANTBDEFAULT)
+               ant |= BB_ANTENNA_B;
+
+       if (chan == 14)
+               ant |= BB_ANTATTEN_CHAN14;
+
+       rtl8180_write_phy(dev, 0x10, ant);
+}
+
+static u8 grf5101_rf_calc_rssi(u8 agc, u8 sq)
+{
+       if (agc > 60)
+               return 65;
+
+       /* TODO(?): just return agc (or agc + 5) to avoid mult / div */
+       return 65 * agc / 60;
+}
+
+static void grf5101_rf_set_channel(struct ieee80211_hw *dev,
+                                  struct ieee80211_conf *conf)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       int channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
+       u32 txpw = priv->channels[channel - 1].hw_value & 0xFF;
+       u32 chan = channel - 1;
+
+       /* set TX power */
+       write_grf5101(dev, 0x15, 0x0);
+       write_grf5101(dev, 0x06, txpw);
+       write_grf5101(dev, 0x15, 0x10);
+       write_grf5101(dev, 0x15, 0x0);
+
+       /* set frequency */
+       write_grf5101(dev, 0x07, 0x0);
+       write_grf5101(dev, 0x0B, chan);
+       write_grf5101(dev, 0x07, 0x1000);
+
+       grf5101_write_phy_antenna(dev, channel);
+}
+
+static void grf5101_rf_stop(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u32 anaparam;
+
+       anaparam = priv->anaparam;
+       anaparam &= 0x000fffff;
+       anaparam |= 0x3f900000;
+       rtl8180_set_anaparam(priv, anaparam);
+
+       write_grf5101(dev, 0x07, 0x0);
+       write_grf5101(dev, 0x1f, 0x45);
+       write_grf5101(dev, 0x1f, 0x5);
+       write_grf5101(dev, 0x00, 0x8e4);
+}
+
+static void grf5101_rf_init(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+
+       rtl8180_set_anaparam(priv, priv->anaparam);
+
+       write_grf5101(dev, 0x1f, 0x0);
+       write_grf5101(dev, 0x1f, 0x0);
+       write_grf5101(dev, 0x1f, 0x40);
+       write_grf5101(dev, 0x1f, 0x60);
+       write_grf5101(dev, 0x1f, 0x61);
+       write_grf5101(dev, 0x1f, 0x61);
+       write_grf5101(dev, 0x00, 0xae4);
+       write_grf5101(dev, 0x1f, 0x1);
+       write_grf5101(dev, 0x1f, 0x41);
+       write_grf5101(dev, 0x1f, 0x61);
+
+       write_grf5101(dev, 0x01, 0x1a23);
+       write_grf5101(dev, 0x02, 0x4971);
+       write_grf5101(dev, 0x03, 0x41de);
+       write_grf5101(dev, 0x04, 0x2d80);
+       write_grf5101(dev, 0x05, 0x68ff);       /* 0x61ff original value */
+       write_grf5101(dev, 0x06, 0x0);
+       write_grf5101(dev, 0x07, 0x0);
+       write_grf5101(dev, 0x08, 0x7533);
+       write_grf5101(dev, 0x09, 0xc401);
+       write_grf5101(dev, 0x0a, 0x0);
+       write_grf5101(dev, 0x0c, 0x1c7);
+       write_grf5101(dev, 0x0d, 0x29d3);
+       write_grf5101(dev, 0x0e, 0x2e8);
+       write_grf5101(dev, 0x10, 0x192);
+       write_grf5101(dev, 0x11, 0x248);
+       write_grf5101(dev, 0x12, 0x0);
+       write_grf5101(dev, 0x13, 0x20c4);
+       write_grf5101(dev, 0x14, 0xf4fc);
+       write_grf5101(dev, 0x15, 0x0);
+       write_grf5101(dev, 0x16, 0x1500);
+
+       write_grf5101(dev, 0x07, 0x1000);
+
+       /* baseband configuration */
+       rtl8180_write_phy(dev, 0, 0xa8);
+       rtl8180_write_phy(dev, 3, 0x0);
+       rtl8180_write_phy(dev, 4, 0xc0);
+       rtl8180_write_phy(dev, 5, 0x90);
+       rtl8180_write_phy(dev, 6, 0x1e);
+       rtl8180_write_phy(dev, 7, 0x64);
+
+       grf5101_write_phy_antenna(dev, 1);
+
+       rtl8180_write_phy(dev, 0x11, 0x88);
+
+       if (rtl818x_ioread8(priv, &priv->map->CONFIG2) &
+           RTL818X_CONFIG2_ANTENNA_DIV)
+               rtl8180_write_phy(dev, 0x12, 0xc0); /* enable ant diversity */
+       else
+               rtl8180_write_phy(dev, 0x12, 0x40); /* disable ant diversity */
+
+       rtl8180_write_phy(dev, 0x13, 0x90 | priv->csthreshold);
+
+       rtl8180_write_phy(dev, 0x19, 0x0);
+       rtl8180_write_phy(dev, 0x1a, 0xa0);
+       rtl8180_write_phy(dev, 0x1b, 0x44);
+}
+
+const struct rtl818x_rf_ops grf5101_rf_ops = {
+       .name           = "GCT",
+       .init           = grf5101_rf_init,
+       .stop           = grf5101_rf_stop,
+       .set_chan       = grf5101_rf_set_channel,
+       .calc_rssi      = grf5101_rf_calc_rssi,
+};
diff --git a/drivers/net/wireless/rtl818x/rtl8180/grf5101.h b/drivers/net/wireless/rtl818x/rtl8180/grf5101.h
new file mode 100644 (file)
index 0000000..7664711
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef RTL8180_GRF5101_H
+#define RTL8180_GRF5101_H
+
+/*
+ * Radio tuning for GCT GRF5101 on RTL8180
+ *
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Code from the BSD driver and the rtl8181 project have been
+ * very useful to understand certain things
+ *
+ * I want to thanks the Authors of such projects and the Ndiswrapper
+ * project Authors.
+ *
+ * A special Big Thanks also is for all people who donated me cards,
+ * making possible the creation of the original rtl8180 driver
+ * from which this code is derived!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#define GRF5101_ANTENNA 0xA3
+
+extern const struct rtl818x_rf_ops grf5101_rf_ops;
+
+#endif /* RTL8180_GRF5101_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8180/max2820.c b/drivers/net/wireless/rtl818x/rtl8180/max2820.c
new file mode 100644 (file)
index 0000000..667b336
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Radio tuning for Maxim max2820 on RTL8180
+ *
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Code from the BSD driver and the rtl8181 project have been
+ * very useful to understand certain things
+ *
+ * I want to thanks the Authors of such projects and the Ndiswrapper
+ * project Authors.
+ *
+ * A special Big Thanks also is for all people who donated me cards,
+ * making possible the creation of the original rtl8180 driver
+ * from which this code is derived!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/delay.h>
+#include <net/mac80211.h>
+
+#include "rtl8180.h"
+#include "max2820.h"
+
+static const u32 max2820_chan[] = {
+       12, /* CH 1 */
+       17,
+       22,
+       27,
+       32,
+       37,
+       42,
+       47,
+       52,
+       57,
+       62,
+       67,
+       72,
+       84, /* CH 14 */
+};
+
+static void write_max2820(struct ieee80211_hw *dev, u8 addr, u32 data)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u32 phy_config;
+
+       phy_config = 0x90 + (data & 0xf);
+       phy_config <<= 16;
+       phy_config += addr;
+       phy_config <<= 8;
+       phy_config += (data >> 4) & 0xff;
+
+       rtl818x_iowrite32(priv,
+               (__le32 __iomem *) &priv->map->RFPinsOutput, phy_config);
+
+       msleep(1);
+}
+
+static void max2820_write_phy_antenna(struct ieee80211_hw *dev, short chan)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u8 ant;
+
+       ant = MAXIM_ANTENNA;
+       if (priv->rfparam & RF_PARAM_ANTBDEFAULT)
+               ant |= BB_ANTENNA_B;
+       if (chan == 14)
+               ant |= BB_ANTATTEN_CHAN14;
+
+       rtl8180_write_phy(dev, 0x10, ant);
+}
+
+static u8 max2820_rf_calc_rssi(u8 agc, u8 sq)
+{
+       bool odd;
+
+       odd = !!(agc & 1);
+
+       agc >>= 1;
+       if (odd)
+               agc += 76;
+       else
+               agc += 66;
+
+       /* TODO: change addends above to avoid mult / div below */
+       return 65 * agc / 100;
+}
+
+static void max2820_rf_set_channel(struct ieee80211_hw *dev,
+                                  struct ieee80211_conf *conf)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       int channel = conf ?
+               ieee80211_frequency_to_channel(conf->channel->center_freq) : 1;
+       unsigned int chan_idx = channel - 1;
+       u32 txpw = priv->channels[chan_idx].hw_value & 0xFF;
+       u32 chan = max2820_chan[chan_idx];
+
+       /* While philips SA2400 drive the PA bias from
+        * sa2400, for MAXIM we do this directly from BB */
+       rtl8180_write_phy(dev, 3, txpw);
+
+       max2820_write_phy_antenna(dev, channel);
+       write_max2820(dev, 3, chan);
+}
+
+static void max2820_rf_stop(struct ieee80211_hw *dev)
+{
+       rtl8180_write_phy(dev, 3, 0x8);
+       write_max2820(dev, 1, 0);
+}
+
+
+static void max2820_rf_init(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+
+       /* MAXIM from netbsd driver */
+       write_max2820(dev, 0, 0x007); /* test mode as indicated in datasheet */
+       write_max2820(dev, 1, 0x01e); /* enable register */
+       write_max2820(dev, 2, 0x001); /* synt register */
+
+       max2820_rf_set_channel(dev, NULL);
+
+       write_max2820(dev, 4, 0x313); /* rx register */
+
+       /* PA is driven directly by the BB, we keep the MAXIM bias
+        * at the highest value in case that setting it to lower
+        * values may introduce some further attenuation somewhere..
+        */
+       write_max2820(dev, 5, 0x00f);
+
+       /* baseband configuration */
+       rtl8180_write_phy(dev, 0, 0x88); /* sys1       */
+       rtl8180_write_phy(dev, 3, 0x08); /* txagc      */
+       rtl8180_write_phy(dev, 4, 0xf8); /* lnadet     */
+       rtl8180_write_phy(dev, 5, 0x90); /* ifagcinit  */
+       rtl8180_write_phy(dev, 6, 0x1a); /* ifagclimit */
+       rtl8180_write_phy(dev, 7, 0x64); /* ifagcdet   */
+
+       max2820_write_phy_antenna(dev, 1);
+
+       rtl8180_write_phy(dev, 0x11, 0x88); /* trl */
+
+       if (rtl818x_ioread8(priv, &priv->map->CONFIG2) &
+           RTL818X_CONFIG2_ANTENNA_DIV)
+               rtl8180_write_phy(dev, 0x12, 0xc7);
+       else
+               rtl8180_write_phy(dev, 0x12, 0x47);
+
+       rtl8180_write_phy(dev, 0x13, 0x9b);
+
+       rtl8180_write_phy(dev, 0x19, 0x0);  /* CHESTLIM */
+       rtl8180_write_phy(dev, 0x1a, 0x9f); /* CHSQLIM  */
+
+       max2820_rf_set_channel(dev, NULL);
+}
+
+const struct rtl818x_rf_ops max2820_rf_ops = {
+       .name           = "Maxim",
+       .init           = max2820_rf_init,
+       .stop           = max2820_rf_stop,
+       .set_chan       = max2820_rf_set_channel,
+       .calc_rssi      = max2820_rf_calc_rssi,
+};
diff --git a/drivers/net/wireless/rtl818x/rtl8180/max2820.h b/drivers/net/wireless/rtl818x/rtl8180/max2820.h
new file mode 100644 (file)
index 0000000..61cf6d1
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef RTL8180_MAX2820_H
+#define RTL8180_MAX2820_H
+
+/*
+ * Radio tuning for Maxim max2820 on RTL8180
+ *
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Code from the BSD driver and the rtl8181 project have been
+ * very useful to understand certain things
+ *
+ * I want to thanks the Authors of such projects and the Ndiswrapper
+ * project Authors.
+ *
+ * A special Big Thanks also is for all people who donated me cards,
+ * making possible the creation of the original rtl8180 driver
+ * from which this code is derived!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#define MAXIM_ANTENNA 0xb3
+
+extern const struct rtl818x_rf_ops max2820_rf_ops;
+
+#endif /* RTL8180_MAX2820_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8180/rtl8180.h b/drivers/net/wireless/rtl818x/rtl8180/rtl8180.h
new file mode 100644 (file)
index 0000000..3052331
--- /dev/null
@@ -0,0 +1,130 @@
+#ifndef RTL8180_H
+#define RTL8180_H
+
+#include "rtl818x.h"
+
+#define MAX_RX_SIZE IEEE80211_MAX_RTS_THRESHOLD
+
+#define RF_PARAM_ANALOGPHY     (1 << 0)
+#define RF_PARAM_ANTBDEFAULT   (1 << 1)
+#define RF_PARAM_CARRIERSENSE1 (1 << 2)
+#define RF_PARAM_CARRIERSENSE2 (1 << 3)
+
+#define BB_ANTATTEN_CHAN14     0x0C
+#define BB_ANTENNA_B           0x40
+
+#define BB_HOST_BANG           (1 << 30)
+#define BB_HOST_BANG_EN        (1 << 2)
+#define BB_HOST_BANG_CLK       (1 << 1)
+#define BB_HOST_BANG_DATA      1
+
+#define ANAPARAM_TXDACOFF_SHIFT        27
+#define ANAPARAM_PWR0_SHIFT    28
+#define ANAPARAM_PWR0_MASK     (0x07 << ANAPARAM_PWR0_SHIFT)
+#define ANAPARAM_PWR1_SHIFT    20
+#define ANAPARAM_PWR1_MASK     (0x7F << ANAPARAM_PWR1_SHIFT)
+
+struct rtl8180_tx_desc {
+       __le32 flags;
+       __le16 rts_duration;
+       __le16 plcp_len;
+       __le32 tx_buf;
+       __le32 frame_len;
+       __le32 next_tx_desc;
+       u8 cw;
+       u8 retry_limit;
+       u8 agc;
+       u8 flags2;
+       u32 reserved[2];
+} __packed;
+
+struct rtl8180_rx_desc {
+       __le32 flags;
+       __le32 flags2;
+       union {
+               __le32 rx_buf;
+               __le64 tsft;
+       };
+} __packed;
+
+struct rtl8180_tx_ring {
+       struct rtl8180_tx_desc *desc;
+       dma_addr_t dma;
+       unsigned int idx;
+       unsigned int entries;
+       struct sk_buff_head queue;
+};
+
+struct rtl8180_vif {
+       struct ieee80211_hw *dev;
+
+       /* beaconing */
+       struct delayed_work beacon_work;
+       bool enable_beacon;
+};
+
+struct rtl8180_priv {
+       /* common between rtl818x drivers */
+       struct rtl818x_csr __iomem *map;
+       const struct rtl818x_rf_ops *rf;
+       struct ieee80211_vif *vif;
+
+       /* rtl8180 driver specific */
+       spinlock_t lock;
+       struct rtl8180_rx_desc *rx_ring;
+       dma_addr_t rx_ring_dma;
+       unsigned int rx_idx;
+       struct sk_buff *rx_buf[32];
+       struct rtl8180_tx_ring tx_ring[4];
+       struct ieee80211_channel channels[14];
+       struct ieee80211_rate rates[12];
+       struct ieee80211_supported_band band;
+       struct pci_dev *pdev;
+       u32 rx_conf;
+
+       int r8185;
+       u32 anaparam;
+       u16 rfparam;
+       u8 csthreshold;
+
+       /* sequence # */
+       u16 seqno;
+};
+
+void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
+void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam);
+
+static inline u8 rtl818x_ioread8(struct rtl8180_priv *priv, u8 __iomem *addr)
+{
+       return ioread8(addr);
+}
+
+static inline u16 rtl818x_ioread16(struct rtl8180_priv *priv, __le16 __iomem *addr)
+{
+       return ioread16(addr);
+}
+
+static inline u32 rtl818x_ioread32(struct rtl8180_priv *priv, __le32 __iomem *addr)
+{
+       return ioread32(addr);
+}
+
+static inline void rtl818x_iowrite8(struct rtl8180_priv *priv,
+                                   u8 __iomem *addr, u8 val)
+{
+       iowrite8(val, addr);
+}
+
+static inline void rtl818x_iowrite16(struct rtl8180_priv *priv,
+                                    __le16 __iomem *addr, u16 val)
+{
+       iowrite16(val, addr);
+}
+
+static inline void rtl818x_iowrite32(struct rtl8180_priv *priv,
+                                    __le32 __iomem *addr, u32 val)
+{
+       iowrite32(val, addr);
+}
+
+#endif /* RTL8180_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c
new file mode 100644 (file)
index 0000000..7c4574b
--- /dev/null
@@ -0,0 +1,791 @@
+
+/*
+ * Radio tuning for RTL8225 on RTL8180
+ *
+ * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Based on the r8180 driver, which is:
+ * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
+ *
+ * Thanks to Realtek for their support!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/delay.h>
+#include <net/mac80211.h>
+
+#include "rtl8180.h"
+#include "rtl8225.h"
+
+static void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u16 reg80, reg84, reg82;
+       u32 bangdata;
+       int i;
+
+       bangdata = (data << 4) | (addr & 0xf);
+
+       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput) & 0xfff3;
+       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x7);
+
+       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x7 | 0x400);
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(10);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(2);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(10);
+
+       for (i = 15; i >= 0; i--) {
+               u16 reg = reg80;
+
+               if (bangdata & (1 << i))
+                       reg |= 1;
+
+               if (i & 1)
+                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
+
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1));
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1));
+
+               if (!(i & 1))
+                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(10);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x400);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+}
+
+static u16 rtl8225_read(struct ieee80211_hw *dev, u8 addr)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u16 reg80, reg82, reg84, out;
+       int i;
+
+       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput);
+       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
+       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect) | 0x400;
+
+       reg80 &= ~0xF;
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x000F);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x000F);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(4);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(5);
+
+       for (i = 4; i >= 0; i--) {
+               u16 reg = reg80 | ((addr >> i) & 1);
+
+               if (!(i & 1)) {
+                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
+                       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+                       udelay(1);
+               }
+
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg | (1 << 1));
+               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+               udelay(2);
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg | (1 << 1));
+               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+               udelay(2);
+
+               if (i & 1) {
+                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
+                       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+                       udelay(1);
+               }
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x000E);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x040E);
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                         reg80 | (1 << 3) | (1 << 1));
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(2);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                         reg80 | (1 << 3));
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(2);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                         reg80 | (1 << 3));
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(2);
+
+       out = 0;
+       for (i = 11; i >= 0; i--) {
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3));
+               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+               udelay(1);
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3) | (1 << 1));
+               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+               udelay(2);
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3) | (1 << 1));
+               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+               udelay(2);
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3) | (1 << 1));
+               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+               udelay(2);
+
+               if (rtl818x_ioread16(priv, &priv->map->RFPinsInput) & (1 << 1))
+                       out |= 1 << i;
+
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3));
+               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+               udelay(2);
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                         reg80 | (1 << 3) | (1 << 2));
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       udelay(2);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x03A0);
+
+       return out;
+}
+
+static const u16 rtl8225bcd_rxgain[] = {
+       0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
+       0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+       0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
+       0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+       0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
+       0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
+       0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
+       0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
+       0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+       0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+       0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3,
+       0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb
+};
+
+static const u8 rtl8225_agc[] = {
+       0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+       0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96,
+       0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e,
+       0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86,
+       0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e,
+       0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36,
+       0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e,
+       0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26,
+       0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e,
+       0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16,
+       0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e,
+       0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06,
+       0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01,
+       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
+};
+
+static const u8 rtl8225_gain[] = {
+       0x23, 0x88, 0x7c, 0xa5, /* -82dbm */
+       0x23, 0x88, 0x7c, 0xb5, /* -82dbm */
+       0x23, 0x88, 0x7c, 0xc5, /* -82dbm */
+       0x33, 0x80, 0x79, 0xc5, /* -78dbm */
+       0x43, 0x78, 0x76, 0xc5, /* -74dbm */
+       0x53, 0x60, 0x73, 0xc5, /* -70dbm */
+       0x63, 0x58, 0x70, 0xc5, /* -66dbm */
+};
+
+static const u8 rtl8225_threshold[] = {
+       0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd
+};
+
+static const u8 rtl8225_tx_gain_cck_ofdm[] = {
+       0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
+};
+
+static const u8 rtl8225_tx_power_cck[] = {
+       0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
+       0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
+       0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
+       0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
+       0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
+       0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
+};
+
+static const u8 rtl8225_tx_power_cck_ch14[] = {
+       0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
+       0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
+       0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
+       0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
+       0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
+       0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
+};
+
+static const u8 rtl8225_tx_power_ofdm[] = {
+       0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
+};
+
+static const u32 rtl8225_chan[] = {
+       0x085c, 0x08dc, 0x095c, 0x09dc, 0x0a5c, 0x0adc, 0x0b5c,
+       0x0bdc, 0x0c5c, 0x0cdc, 0x0d5c, 0x0ddc, 0x0e5c, 0x0f72
+};
+
+static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u8 cck_power, ofdm_power;
+       const u8 *tmp;
+       u32 reg;
+       int i;
+
+       cck_power = priv->channels[channel - 1].hw_value & 0xFF;
+       ofdm_power = priv->channels[channel - 1].hw_value >> 8;
+
+       cck_power = min(cck_power, (u8)35);
+       ofdm_power = min(ofdm_power, (u8)35);
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
+                        rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1);
+
+       if (channel == 14)
+               tmp = &rtl8225_tx_power_cck_ch14[(cck_power % 6) * 8];
+       else
+               tmp = &rtl8225_tx_power_cck[(cck_power % 6) * 8];
+
+       for (i = 0; i < 8; i++)
+               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
+
+       msleep(1); /* FIXME: optional? */
+
+       /* anaparam2 on */
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_ON);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM,
+                        rtl8225_tx_gain_cck_ofdm[ofdm_power/6] >> 1);
+
+       tmp = &rtl8225_tx_power_ofdm[ofdm_power % 6];
+
+       rtl8225_write_phy_ofdm(dev, 5, *tmp);
+       rtl8225_write_phy_ofdm(dev, 7, *tmp);
+
+       msleep(1);
+}
+
+static void rtl8225_rf_init(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       int i;
+
+       rtl8180_set_anaparam(priv, RTL8225_ANAPARAM_ON);
+
+       /* host_pci_init */
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x0488);
+       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0);
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       msleep(200);    /* FIXME: ehh?? */
+       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0xFF & ~(1 << 6));
+
+       rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x000a8008);
+
+       /* TODO: check if we need really to change BRSR to do RF config */
+       rtl818x_ioread16(priv, &priv->map->BRSR);
+       rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF);
+       rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       rtl8225_write(dev, 0x0, 0x067);
+       rtl8225_write(dev, 0x1, 0xFE0);
+       rtl8225_write(dev, 0x2, 0x44D);
+       rtl8225_write(dev, 0x3, 0x441);
+       rtl8225_write(dev, 0x4, 0x8BE);
+       rtl8225_write(dev, 0x5, 0xBF0);         /* TODO: minipci */
+       rtl8225_write(dev, 0x6, 0xAE6);
+       rtl8225_write(dev, 0x7, rtl8225_chan[0]);
+       rtl8225_write(dev, 0x8, 0x01F);
+       rtl8225_write(dev, 0x9, 0x334);
+       rtl8225_write(dev, 0xA, 0xFD4);
+       rtl8225_write(dev, 0xB, 0x391);
+       rtl8225_write(dev, 0xC, 0x050);
+       rtl8225_write(dev, 0xD, 0x6DB);
+       rtl8225_write(dev, 0xE, 0x029);
+       rtl8225_write(dev, 0xF, 0x914); msleep(1);
+
+       rtl8225_write(dev, 0x2, 0xC4D); msleep(100);
+
+       rtl8225_write(dev, 0x0, 0x127);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225bcd_rxgain); i++) {
+               rtl8225_write(dev, 0x1, i + 1);
+               rtl8225_write(dev, 0x2, rtl8225bcd_rxgain[i]);
+       }
+
+       rtl8225_write(dev, 0x0, 0x027);
+       rtl8225_write(dev, 0x0, 0x22F);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) {
+               rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]);
+               msleep(1);
+               rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i);
+               msleep(1);
+       }
+
+       msleep(1);
+
+       rtl8225_write_phy_ofdm(dev, 0x00, 0x01); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x01, 0x02); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x02, 0x62); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x03, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x04, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x05, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x06, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x07, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x08, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x09, 0xfe); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0a, 0x09); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0b, 0x80); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0c, 0x01); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0f, 0x38); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x10, 0x84); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x11, 0x03); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x12, 0x20); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x13, 0x20); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x14, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x15, 0x40); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x16, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x17, 0x40); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x18, 0xef); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x19, 0x19); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1a, 0x20); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1b, 0x76); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1c, 0x04); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1e, 0x95); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1f, 0x75); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x20, 0x1f); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x21, 0x27); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x22, 0x16); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x24, 0x46); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x25, 0x20); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x27, 0x88); msleep(1);
+
+       rtl8225_write_phy_cck(dev, 0x00, 0x98); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x03, 0x20); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x04, 0x7e); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x05, 0x12); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x06, 0xfc); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x07, 0x78); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x08, 0x2e); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x10, 0x93); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x11, 0x88); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x12, 0x47); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x13, 0xd0);
+       rtl8225_write_phy_cck(dev, 0x19, 0x00);
+       rtl8225_write_phy_cck(dev, 0x1a, 0xa0);
+       rtl8225_write_phy_cck(dev, 0x1b, 0x08);
+       rtl8225_write_phy_cck(dev, 0x40, 0x86);
+       rtl8225_write_phy_cck(dev, 0x41, 0x8d); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x42, 0x15); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x43, 0x18); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x44, 0x1f); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x45, 0x1e); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x46, 0x1a); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x47, 0x15); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x48, 0x10); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x49, 0x0a); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x4a, 0x05); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x4b, 0x02); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x4c, 0x05); msleep(1);
+
+       rtl818x_iowrite8(priv, &priv->map->TESTR, 0x0D); msleep(1);
+
+       rtl8225_rf_set_tx_power(dev, 1);
+
+       /* RX antenna default to A */
+       rtl8225_write_phy_cck(dev, 0x10, 0x9b); msleep(1);      /* B: 0xDB */
+       rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1);     /* B: 0x10 */
+
+       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);   /* B: 0x00 */
+       msleep(1);
+       rtl818x_iowrite32(priv, (__le32 __iomem *)((void __iomem *)priv->map + 0x94), 0x15c00002);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+
+       rtl8225_write(dev, 0x0c, 0x50);
+       /* set OFDM initial gain */
+       rtl8225_write_phy_ofdm(dev, 0x0d, rtl8225_gain[4 * 4]);
+       rtl8225_write_phy_ofdm(dev, 0x23, rtl8225_gain[4 * 4 + 1]);
+       rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225_gain[4 * 4 + 2]);
+       rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225_gain[4 * 4 + 3]);
+       /* set CCK threshold */
+       rtl8225_write_phy_cck(dev, 0x41, rtl8225_threshold[0]);
+}
+
+static const u8 rtl8225z2_tx_power_cck_ch14[] = {
+       0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00
+};
+
+static const u8 rtl8225z2_tx_power_cck_B[] = {
+       0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x04
+};
+
+static const u8 rtl8225z2_tx_power_cck_A[] = {
+       0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04
+};
+
+static const u8 rtl8225z2_tx_power_cck[] = {
+       0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04
+};
+
+static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u8 cck_power, ofdm_power;
+       const u8 *tmp;
+       int i;
+
+       cck_power = priv->channels[channel - 1].hw_value & 0xFF;
+       ofdm_power = priv->channels[channel - 1].hw_value >> 8;
+
+       if (channel == 14)
+               tmp = rtl8225z2_tx_power_cck_ch14;
+       else if (cck_power == 12)
+               tmp = rtl8225z2_tx_power_cck_B;
+       else if (cck_power == 13)
+               tmp = rtl8225z2_tx_power_cck_A;
+       else
+               tmp = rtl8225z2_tx_power_cck;
+
+       for (i = 0; i < 8; i++)
+               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
+
+       cck_power = min(cck_power, (u8)35);
+       if (cck_power == 13 || cck_power == 14)
+               cck_power = 12;
+       if (cck_power >= 15)
+               cck_power -= 2;
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, cck_power);
+       rtl818x_ioread8(priv, &priv->map->TX_GAIN_CCK);
+       msleep(1);
+
+       ofdm_power = min(ofdm_power, (u8)35);
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, ofdm_power);
+
+       rtl8225_write_phy_ofdm(dev, 2, 0x62);
+       rtl8225_write_phy_ofdm(dev, 5, 0x00);
+       rtl8225_write_phy_ofdm(dev, 6, 0x40);
+       rtl8225_write_phy_ofdm(dev, 7, 0x00);
+       rtl8225_write_phy_ofdm(dev, 8, 0x40);
+
+       msleep(1);
+}
+
+static const u16 rtl8225z2_rxgain[] = {
+       0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
+       0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
+       0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
+       0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
+       0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
+       0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
+       0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
+       0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
+       0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
+       0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
+       0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+       0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+
+static void rtl8225z2_rf_init(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       int i;
+
+       rtl8180_set_anaparam(priv, RTL8225_ANAPARAM_ON);
+
+       /* host_pci_init */
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x0488);
+       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0);
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       msleep(200);    /* FIXME: ehh?? */
+       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0xFF & ~(1 << 6));
+
+       rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x00088008);
+
+       /* TODO: check if we need really to change BRSR to do RF config */
+       rtl818x_ioread16(priv, &priv->map->BRSR);
+       rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF);
+       rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+
+       rtl8225_write(dev, 0x0, 0x0B7); msleep(1);
+       rtl8225_write(dev, 0x1, 0xEE0); msleep(1);
+       rtl8225_write(dev, 0x2, 0x44D); msleep(1);
+       rtl8225_write(dev, 0x3, 0x441); msleep(1);
+       rtl8225_write(dev, 0x4, 0x8C3); msleep(1);
+       rtl8225_write(dev, 0x5, 0xC72); msleep(1);
+       rtl8225_write(dev, 0x6, 0x0E6); msleep(1);
+       rtl8225_write(dev, 0x7, 0x82A); msleep(1);
+       rtl8225_write(dev, 0x8, 0x03F); msleep(1);
+       rtl8225_write(dev, 0x9, 0x335); msleep(1);
+       rtl8225_write(dev, 0xa, 0x9D4); msleep(1);
+       rtl8225_write(dev, 0xb, 0x7BB); msleep(1);
+       rtl8225_write(dev, 0xc, 0x850); msleep(1);
+       rtl8225_write(dev, 0xd, 0xCDF); msleep(1);
+       rtl8225_write(dev, 0xe, 0x02B); msleep(1);
+       rtl8225_write(dev, 0xf, 0x114); msleep(100);
+
+       if (!(rtl8225_read(dev, 6) & (1 << 7))) {
+               rtl8225_write(dev, 0x02, 0x0C4D);
+               msleep(200);
+               rtl8225_write(dev, 0x02, 0x044D);
+               msleep(100);
+               /* TODO: readd calibration failure message when the calibration
+                  check works */
+       }
+
+       rtl8225_write(dev, 0x0, 0x1B7);
+       rtl8225_write(dev, 0x3, 0x002);
+       rtl8225_write(dev, 0x5, 0x004);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) {
+               rtl8225_write(dev, 0x1, i + 1);
+               rtl8225_write(dev, 0x2, rtl8225z2_rxgain[i]);
+       }
+
+       rtl8225_write(dev, 0x0, 0x0B7); msleep(100);
+       rtl8225_write(dev, 0x2, 0xC4D);
+
+       msleep(200);
+       rtl8225_write(dev, 0x2, 0x44D);
+       msleep(100);
+
+       rtl8225_write(dev, 0x00, 0x2BF);
+       rtl8225_write(dev, 0xFF, 0xFFFF);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) {
+               rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]);
+               msleep(1);
+               rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i);
+               msleep(1);
+       }
+
+       msleep(1);
+
+       rtl8225_write_phy_ofdm(dev, 0x00, 0x01); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x01, 0x02); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x02, 0x62); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x03, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x04, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x05, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x06, 0x40); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x07, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x08, 0x40); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x09, 0xfe); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0a, 0x09); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x18, 0xef); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0b, 0x80); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0c, 0x01); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0d, 0x43);
+       rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x0f, 0x38); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x10, 0x84); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x11, 0x06); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x12, 0x20); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x13, 0x20); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x14, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x15, 0x40); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x16, 0x00); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x17, 0x40); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x18, 0xef); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x19, 0x19); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1a, 0x20); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1b, 0x11); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1c, 0x04); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1d, 0xc5); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1e, 0xb3); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x1f, 0x75); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x20, 0x1f); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x21, 0x27); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x22, 0x16); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x23, 0x80); msleep(1); /* FIXME: not needed? */
+       rtl8225_write_phy_ofdm(dev, 0x24, 0x46); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x25, 0x20); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1);
+       rtl8225_write_phy_ofdm(dev, 0x27, 0x88); msleep(1);
+
+       rtl8225_write_phy_cck(dev, 0x00, 0x98); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x03, 0x20); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x04, 0x7e); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x05, 0x12); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x06, 0xfc); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x07, 0x78); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x08, 0x2e); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x10, 0x93); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x11, 0x88); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x12, 0x47); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x13, 0xd0);
+       rtl8225_write_phy_cck(dev, 0x19, 0x00);
+       rtl8225_write_phy_cck(dev, 0x1a, 0xa0);
+       rtl8225_write_phy_cck(dev, 0x1b, 0x08);
+       rtl8225_write_phy_cck(dev, 0x40, 0x86);
+       rtl8225_write_phy_cck(dev, 0x41, 0x8a); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x42, 0x15); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x43, 0x18); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x44, 0x36); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x45, 0x35); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x46, 0x2e); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x47, 0x25); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x48, 0x1c); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x49, 0x12); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x4a, 0x09); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x4b, 0x04); msleep(1);
+       rtl8225_write_phy_cck(dev, 0x4c, 0x05); msleep(1);
+
+       rtl818x_iowrite8(priv, (u8 __iomem *)((void __iomem *)priv->map + 0x5B), 0x0D); msleep(1);
+
+       rtl8225z2_rf_set_tx_power(dev, 1);
+
+       /* RX antenna default to A */
+       rtl8225_write_phy_cck(dev, 0x10, 0x9b); msleep(1);      /* B: 0xDB */
+       rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1);     /* B: 0x10 */
+
+       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);   /* B: 0x00 */
+       msleep(1);
+       rtl818x_iowrite32(priv, (__le32 __iomem *)((void __iomem *)priv->map + 0x94), 0x15c00002);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+}
+
+static void rtl8225_rf_stop(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u8 reg;
+
+       rtl8225_write(dev, 0x4, 0x1f); msleep(1);
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_OFF);
+       rtl818x_iowrite32(priv, &priv->map->ANAPARAM, RTL8225_ANAPARAM_OFF);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+}
+
+static void rtl8225_rf_set_channel(struct ieee80211_hw *dev,
+                                  struct ieee80211_conf *conf)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       int chan = ieee80211_frequency_to_channel(conf->channel->center_freq);
+
+       if (priv->rf->init == rtl8225_rf_init)
+               rtl8225_rf_set_tx_power(dev, chan);
+       else
+               rtl8225z2_rf_set_tx_power(dev, chan);
+
+       rtl8225_write(dev, 0x7, rtl8225_chan[chan - 1]);
+       msleep(10);
+}
+
+static void rtl8225_rf_conf_erp(struct ieee80211_hw *dev,
+                               struct ieee80211_bss_conf *info)
+{
+       struct rtl8180_priv *priv = dev->priv;
+
+       if (info->use_short_slot) {
+               rtl818x_iowrite8(priv, &priv->map->SLOT, 0x9);
+               rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22);
+               rtl818x_iowrite8(priv, &priv->map->DIFS, 0x14);
+               rtl818x_iowrite8(priv, &priv->map->EIFS, 81);
+               rtl818x_iowrite8(priv, &priv->map->CW_VAL, 0x73);
+       } else {
+               rtl818x_iowrite8(priv, &priv->map->SLOT, 0x14);
+               rtl818x_iowrite8(priv, &priv->map->SIFS, 0x44);
+               rtl818x_iowrite8(priv, &priv->map->DIFS, 0x24);
+               rtl818x_iowrite8(priv, &priv->map->EIFS, 81);
+               rtl818x_iowrite8(priv, &priv->map->CW_VAL, 0xa5);
+       }
+}
+
+static const struct rtl818x_rf_ops rtl8225_ops = {
+       .name           = "rtl8225",
+       .init           = rtl8225_rf_init,
+       .stop           = rtl8225_rf_stop,
+       .set_chan       = rtl8225_rf_set_channel,
+       .conf_erp       = rtl8225_rf_conf_erp,
+};
+
+static const struct rtl818x_rf_ops rtl8225z2_ops = {
+       .name           = "rtl8225z2",
+       .init           = rtl8225z2_rf_init,
+       .stop           = rtl8225_rf_stop,
+       .set_chan       = rtl8225_rf_set_channel,
+       .conf_erp       = rtl8225_rf_conf_erp,
+};
+
+const struct rtl818x_rf_ops * rtl8180_detect_rf(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u16 reg8, reg9;
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x0488);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+       msleep(100);
+
+       rtl8225_write(dev, 0, 0x1B7);
+
+       reg8 = rtl8225_read(dev, 8);
+       reg9 = rtl8225_read(dev, 9);
+
+       rtl8225_write(dev, 0, 0x0B7);
+
+       if (reg8 != 0x588 || reg9 != 0x700)
+               return &rtl8225_ops;
+
+       return &rtl8225z2_ops;
+}
diff --git a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.h b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.h
new file mode 100644 (file)
index 0000000..310013a
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef RTL8180_RTL8225_H
+#define RTL8180_RTL8225_H
+
+#define RTL8225_ANAPARAM_ON    0xa0000b59
+#define RTL8225_ANAPARAM2_ON   0x860dec11
+#define RTL8225_ANAPARAM_OFF   0xa00beb59
+#define RTL8225_ANAPARAM2_OFF  0x840dec11
+
+const struct rtl818x_rf_ops * rtl8180_detect_rf(struct ieee80211_hw *);
+
+static inline void rtl8225_write_phy_ofdm(struct ieee80211_hw *dev,
+                                         u8 addr, u8 data)
+{
+       rtl8180_write_phy(dev, addr, data);
+}
+
+static inline void rtl8225_write_phy_cck(struct ieee80211_hw *dev,
+                                        u8 addr, u8 data)
+{
+       rtl8180_write_phy(dev, addr, data | 0x10000);
+}
+
+#endif /* RTL8180_RTL8225_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8180/sa2400.c b/drivers/net/wireless/rtl818x/rtl8180/sa2400.c
new file mode 100644 (file)
index 0000000..44771a6
--- /dev/null
@@ -0,0 +1,228 @@
+
+/*
+ * Radio tuning for Philips SA2400 on RTL8180
+ *
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Code from the BSD driver and the rtl8181 project have been
+ * very useful to understand certain things
+ *
+ * I want to thanks the Authors of such projects and the Ndiswrapper
+ * project Authors.
+ *
+ * A special Big Thanks also is for all people who donated me cards,
+ * making possible the creation of the original rtl8180 driver
+ * from which this code is derived!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/delay.h>
+#include <net/mac80211.h>
+
+#include "rtl8180.h"
+#include "sa2400.h"
+
+static const u32 sa2400_chan[] = {
+       0x00096c, /* ch1 */
+       0x080970,
+       0x100974,
+       0x180978,
+       0x000980,
+       0x080984,
+       0x100988,
+       0x18098c,
+       0x000994,
+       0x080998,
+       0x10099c,
+       0x1809a0,
+       0x0009a8,
+       0x0009b4, /* ch 14 */
+};
+
+static void write_sa2400(struct ieee80211_hw *dev, u8 addr, u32 data)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u32 phy_config;
+
+       /* MAC will bang bits to the sa2400. sw 3-wire is NOT used */
+       phy_config = 0xb0000000;
+
+       phy_config |= ((u32)(addr & 0xf)) << 24;
+       phy_config |= data & 0xffffff;
+
+       rtl818x_iowrite32(priv,
+               (__le32 __iomem *) &priv->map->RFPinsOutput, phy_config);
+
+       msleep(3);
+}
+
+static void sa2400_write_phy_antenna(struct ieee80211_hw *dev, short chan)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u8 ant = SA2400_ANTENNA;
+
+       if (priv->rfparam & RF_PARAM_ANTBDEFAULT)
+               ant |= BB_ANTENNA_B;
+
+       if (chan == 14)
+               ant |= BB_ANTATTEN_CHAN14;
+
+       rtl8180_write_phy(dev, 0x10, ant);
+
+}
+
+static u8 sa2400_rf_rssi_map[] = {
+       0x64, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, 0x5e,
+       0x5d, 0x5c, 0x5b, 0x5a, 0x57, 0x54, 0x52, 0x50,
+       0x4e, 0x4c, 0x4a, 0x48, 0x46, 0x44, 0x41, 0x3f,
+       0x3c, 0x3a, 0x37, 0x36, 0x36, 0x1c, 0x1c, 0x1b,
+       0x1b, 0x1a, 0x1a, 0x19, 0x19, 0x18, 0x18, 0x17,
+       0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13,
+       0x13, 0x12, 0x12, 0x11, 0x11, 0x10, 0x10, 0x0f,
+       0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b,
+       0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07,
+       0x07, 0x06, 0x06, 0x05, 0x04, 0x03, 0x02,
+};
+
+static u8 sa2400_rf_calc_rssi(u8 agc, u8 sq)
+{
+       if (sq == 0x80)
+               return 1;
+
+       if (sq > 78)
+               return 32;
+
+       /* TODO: recalc sa2400_rf_rssi_map to avoid mult / div */
+       return 65 * sa2400_rf_rssi_map[sq] / 100;
+}
+
+static void sa2400_rf_set_channel(struct ieee80211_hw *dev,
+                                 struct ieee80211_conf *conf)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       int channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
+       u32 txpw = priv->channels[channel - 1].hw_value & 0xFF;
+       u32 chan = sa2400_chan[channel - 1];
+
+       write_sa2400(dev, 7, txpw);
+
+       sa2400_write_phy_antenna(dev, channel);
+
+       write_sa2400(dev, 0, chan);
+       write_sa2400(dev, 1, 0xbb50);
+       write_sa2400(dev, 2, 0x80);
+       write_sa2400(dev, 3, 0);
+}
+
+static void sa2400_rf_stop(struct ieee80211_hw *dev)
+{
+       write_sa2400(dev, 4, 0);
+}
+
+static void sa2400_rf_init(struct ieee80211_hw *dev)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       u32 anaparam, txconf;
+       u8 firdac;
+       int analogphy = priv->rfparam & RF_PARAM_ANALOGPHY;
+
+       anaparam = priv->anaparam;
+       anaparam &= ~(1 << ANAPARAM_TXDACOFF_SHIFT);
+       anaparam &= ~ANAPARAM_PWR1_MASK;
+       anaparam &= ~ANAPARAM_PWR0_MASK;
+
+       if (analogphy) {
+               anaparam |= SA2400_ANA_ANAPARAM_PWR1_ON << ANAPARAM_PWR1_SHIFT;
+               firdac = 0;
+       } else {
+               anaparam |= (SA2400_DIG_ANAPARAM_PWR1_ON << ANAPARAM_PWR1_SHIFT);
+               anaparam |= (SA2400_ANAPARAM_PWR0_ON << ANAPARAM_PWR0_SHIFT);
+               firdac = 1 << SA2400_REG4_FIRDAC_SHIFT;
+       }
+
+       rtl8180_set_anaparam(priv, anaparam);
+
+       write_sa2400(dev, 0, sa2400_chan[0]);
+       write_sa2400(dev, 1, 0xbb50);
+       write_sa2400(dev, 2, 0x80);
+       write_sa2400(dev, 3, 0);
+       write_sa2400(dev, 4, 0x19340 | firdac);
+       write_sa2400(dev, 5, 0x1dfb | (SA2400_MAX_SENS - 54) << 15);
+       write_sa2400(dev, 4, 0x19348 | firdac); /* calibrate VCO */
+
+       if (!analogphy)
+               write_sa2400(dev, 4, 0x1938c); /*???*/
+
+       write_sa2400(dev, 4, 0x19340 | firdac);
+
+       write_sa2400(dev, 0, sa2400_chan[0]);
+       write_sa2400(dev, 1, 0xbb50);
+       write_sa2400(dev, 2, 0x80);
+       write_sa2400(dev, 3, 0);
+       write_sa2400(dev, 4, 0x19344 | firdac); /* calibrate filter */
+
+       /* new from rtl8180 embedded driver (rtl8181 project) */
+       write_sa2400(dev, 6, 0x13ff | (1 << 23)); /* MANRX */
+       write_sa2400(dev, 8, 0); /* VCO */
+
+       if (analogphy) {
+               rtl8180_set_anaparam(priv, anaparam |
+                                    (1 << ANAPARAM_TXDACOFF_SHIFT));
+
+               txconf = rtl818x_ioread32(priv, &priv->map->TX_CONF);
+               rtl818x_iowrite32(priv, &priv->map->TX_CONF,
+                       txconf | RTL818X_TX_CONF_LOOPBACK_CONT);
+
+               write_sa2400(dev, 4, 0x19341); /* calibrates DC */
+
+               /* a 5us sleep is required here,
+                * we rely on the 3ms delay introduced in write_sa2400 */
+               write_sa2400(dev, 4, 0x19345);
+
+               /* a 20us sleep is required here,
+                * we rely on the 3ms delay introduced in write_sa2400 */
+
+               rtl818x_iowrite32(priv, &priv->map->TX_CONF, txconf);
+
+               rtl8180_set_anaparam(priv, anaparam);
+       }
+       /* end new code */
+
+       write_sa2400(dev, 4, 0x19341 | firdac); /* RTX MODE */
+
+       /* baseband configuration */
+       rtl8180_write_phy(dev, 0, 0x98);
+       rtl8180_write_phy(dev, 3, 0x38);
+       rtl8180_write_phy(dev, 4, 0xe0);
+       rtl8180_write_phy(dev, 5, 0x90);
+       rtl8180_write_phy(dev, 6, 0x1a);
+       rtl8180_write_phy(dev, 7, 0x64);
+
+       sa2400_write_phy_antenna(dev, 1);
+
+       rtl8180_write_phy(dev, 0x11, 0x80);
+
+       if (rtl818x_ioread8(priv, &priv->map->CONFIG2) &
+           RTL818X_CONFIG2_ANTENNA_DIV)
+               rtl8180_write_phy(dev, 0x12, 0xc7); /* enable ant diversity */
+       else
+               rtl8180_write_phy(dev, 0x12, 0x47); /* disable ant diversity */
+
+       rtl8180_write_phy(dev, 0x13, 0x90 | priv->csthreshold);
+
+       rtl8180_write_phy(dev, 0x19, 0x0);
+       rtl8180_write_phy(dev, 0x1a, 0xa0);
+}
+
+const struct rtl818x_rf_ops sa2400_rf_ops = {
+       .name           = "Philips",
+       .init           = sa2400_rf_init,
+       .stop           = sa2400_rf_stop,
+       .set_chan       = sa2400_rf_set_channel,
+       .calc_rssi      = sa2400_rf_calc_rssi,
+};
diff --git a/drivers/net/wireless/rtl818x/rtl8180/sa2400.h b/drivers/net/wireless/rtl818x/rtl8180/sa2400.h
new file mode 100644 (file)
index 0000000..a4aaa0d
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef RTL8180_SA2400_H
+#define RTL8180_SA2400_H
+
+/*
+ * Radio tuning for Philips SA2400 on RTL8180
+ *
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Code from the BSD driver and the rtl8181 project have been
+ * very useful to understand certain things
+ *
+ * I want to thanks the Authors of such projects and the Ndiswrapper
+ * project Authors.
+ *
+ * A special Big Thanks also is for all people who donated me cards,
+ * making possible the creation of the original rtl8180 driver
+ * from which this code is derived!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#define SA2400_ANTENNA 0x91
+#define SA2400_DIG_ANAPARAM_PWR1_ON 0x8
+#define SA2400_ANA_ANAPARAM_PWR1_ON 0x28
+#define SA2400_ANAPARAM_PWR0_ON 0x3
+
+/* RX sensitivity in dbm */
+#define SA2400_MAX_SENS 85
+
+#define SA2400_REG4_FIRDAC_SHIFT 7
+
+extern const struct rtl818x_rf_ops sa2400_rf_ops;
+
+#endif /* RTL8180_SA2400_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c
deleted file mode 100644 (file)
index 707c688..0000000
+++ /dev/null
@@ -1,1188 +0,0 @@
-
-/*
- * Linux device driver for RTL8180 / RTL8185
- *
- * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Based on the r8180 driver, which is:
- * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al.
- *
- * Thanks to Realtek for their support!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/etherdevice.h>
-#include <linux/eeprom_93cx6.h>
-#include <net/mac80211.h>
-
-#include "rtl8180.h"
-#include "rtl8180_rtl8225.h"
-#include "rtl8180_sa2400.h"
-#include "rtl8180_max2820.h"
-#include "rtl8180_grf5101.h"
-
-MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
-MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
-MODULE_DESCRIPTION("RTL8180 / RTL8185 PCI wireless driver");
-MODULE_LICENSE("GPL");
-
-static DEFINE_PCI_DEVICE_TABLE(rtl8180_table) = {
-       /* rtl8185 */
-       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8185) },
-       { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x700f) },
-       { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x701f) },
-
-       /* rtl8180 */
-       { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8180) },
-       { PCI_DEVICE(0x1799, 0x6001) },
-       { PCI_DEVICE(0x1799, 0x6020) },
-       { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x3300) },
-       { }
-};
-
-MODULE_DEVICE_TABLE(pci, rtl8180_table);
-
-static const struct ieee80211_rate rtl818x_rates[] = {
-       { .bitrate = 10, .hw_value = 0, },
-       { .bitrate = 20, .hw_value = 1, },
-       { .bitrate = 55, .hw_value = 2, },
-       { .bitrate = 110, .hw_value = 3, },
-       { .bitrate = 60, .hw_value = 4, },
-       { .bitrate = 90, .hw_value = 5, },
-       { .bitrate = 120, .hw_value = 6, },
-       { .bitrate = 180, .hw_value = 7, },
-       { .bitrate = 240, .hw_value = 8, },
-       { .bitrate = 360, .hw_value = 9, },
-       { .bitrate = 480, .hw_value = 10, },
-       { .bitrate = 540, .hw_value = 11, },
-};
-
-static const struct ieee80211_channel rtl818x_channels[] = {
-       { .center_freq = 2412 },
-       { .center_freq = 2417 },
-       { .center_freq = 2422 },
-       { .center_freq = 2427 },
-       { .center_freq = 2432 },
-       { .center_freq = 2437 },
-       { .center_freq = 2442 },
-       { .center_freq = 2447 },
-       { .center_freq = 2452 },
-       { .center_freq = 2457 },
-       { .center_freq = 2462 },
-       { .center_freq = 2467 },
-       { .center_freq = 2472 },
-       { .center_freq = 2484 },
-};
-
-
-void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       int i = 10;
-       u32 buf;
-
-       buf = (data << 8) | addr;
-
-       rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->PHY[0], buf | 0x80);
-       while (i--) {
-               rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->PHY[0], buf);
-               if (rtl818x_ioread8(priv, &priv->map->PHY[2]) == (data & 0xFF))
-                       return;
-       }
-}
-
-static void rtl8180_handle_rx(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       unsigned int count = 32;
-       u8 signal, agc, sq;
-
-       while (count--) {
-               struct rtl8180_rx_desc *entry = &priv->rx_ring[priv->rx_idx];
-               struct sk_buff *skb = priv->rx_buf[priv->rx_idx];
-               u32 flags = le32_to_cpu(entry->flags);
-
-               if (flags & RTL818X_RX_DESC_FLAG_OWN)
-                       return;
-
-               if (unlikely(flags & (RTL818X_RX_DESC_FLAG_DMA_FAIL |
-                                     RTL818X_RX_DESC_FLAG_FOF |
-                                     RTL818X_RX_DESC_FLAG_RX_ERR)))
-                       goto done;
-               else {
-                       u32 flags2 = le32_to_cpu(entry->flags2);
-                       struct ieee80211_rx_status rx_status = {0};
-                       struct sk_buff *new_skb = dev_alloc_skb(MAX_RX_SIZE);
-
-                       if (unlikely(!new_skb))
-                               goto done;
-
-                       pci_unmap_single(priv->pdev,
-                                        *((dma_addr_t *)skb->cb),
-                                        MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
-                       skb_put(skb, flags & 0xFFF);
-
-                       rx_status.antenna = (flags2 >> 15) & 1;
-                       rx_status.rate_idx = (flags >> 20) & 0xF;
-                       agc = (flags2 >> 17) & 0x7F;
-                       if (priv->r8185) {
-                               if (rx_status.rate_idx > 3)
-                                       signal = 90 - clamp_t(u8, agc, 25, 90);
-                               else
-                                       signal = 95 - clamp_t(u8, agc, 30, 95);
-                       } else {
-                               sq = flags2 & 0xff;
-                               signal = priv->rf->calc_rssi(agc, sq);
-                       }
-                       rx_status.signal = signal;
-                       rx_status.freq = dev->conf.channel->center_freq;
-                       rx_status.band = dev->conf.channel->band;
-                       rx_status.mactime = le64_to_cpu(entry->tsft);
-                       rx_status.flag |= RX_FLAG_TSFT;
-                       if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR)
-                               rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
-
-                       memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
-                       ieee80211_rx_irqsafe(dev, skb);
-
-                       skb = new_skb;
-                       priv->rx_buf[priv->rx_idx] = skb;
-                       *((dma_addr_t *) skb->cb) =
-                               pci_map_single(priv->pdev, skb_tail_pointer(skb),
-                                              MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
-               }
-
-       done:
-               entry->rx_buf = cpu_to_le32(*((dma_addr_t *)skb->cb));
-               entry->flags = cpu_to_le32(RTL818X_RX_DESC_FLAG_OWN |
-                                          MAX_RX_SIZE);
-               if (priv->rx_idx == 31)
-                       entry->flags |= cpu_to_le32(RTL818X_RX_DESC_FLAG_EOR);
-               priv->rx_idx = (priv->rx_idx + 1) % 32;
-       }
-}
-
-static void rtl8180_handle_tx(struct ieee80211_hw *dev, unsigned int prio)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       struct rtl8180_tx_ring *ring = &priv->tx_ring[prio];
-
-       while (skb_queue_len(&ring->queue)) {
-               struct rtl8180_tx_desc *entry = &ring->desc[ring->idx];
-               struct sk_buff *skb;
-               struct ieee80211_tx_info *info;
-               u32 flags = le32_to_cpu(entry->flags);
-
-               if (flags & RTL818X_TX_DESC_FLAG_OWN)
-                       return;
-
-               ring->idx = (ring->idx + 1) % ring->entries;
-               skb = __skb_dequeue(&ring->queue);
-               pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf),
-                                skb->len, PCI_DMA_TODEVICE);
-
-               info = IEEE80211_SKB_CB(skb);
-               ieee80211_tx_info_clear_status(info);
-
-               if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
-                   (flags & RTL818X_TX_DESC_FLAG_TX_OK))
-                       info->flags |= IEEE80211_TX_STAT_ACK;
-
-               info->status.rates[0].count = (flags & 0xFF) + 1;
-               info->status.rates[1].idx = -1;
-
-               ieee80211_tx_status_irqsafe(dev, skb);
-               if (ring->entries - skb_queue_len(&ring->queue) == 2)
-                       ieee80211_wake_queue(dev, prio);
-       }
-}
-
-static irqreturn_t rtl8180_interrupt(int irq, void *dev_id)
-{
-       struct ieee80211_hw *dev = dev_id;
-       struct rtl8180_priv *priv = dev->priv;
-       u16 reg;
-
-       spin_lock(&priv->lock);
-       reg = rtl818x_ioread16(priv, &priv->map->INT_STATUS);
-       if (unlikely(reg == 0xFFFF)) {
-               spin_unlock(&priv->lock);
-               return IRQ_HANDLED;
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->INT_STATUS, reg);
-
-       if (reg & (RTL818X_INT_TXB_OK | RTL818X_INT_TXB_ERR))
-               rtl8180_handle_tx(dev, 3);
-
-       if (reg & (RTL818X_INT_TXH_OK | RTL818X_INT_TXH_ERR))
-               rtl8180_handle_tx(dev, 2);
-
-       if (reg & (RTL818X_INT_TXN_OK | RTL818X_INT_TXN_ERR))
-               rtl8180_handle_tx(dev, 1);
-
-       if (reg & (RTL818X_INT_TXL_OK | RTL818X_INT_TXL_ERR))
-               rtl8180_handle_tx(dev, 0);
-
-       if (reg & (RTL818X_INT_RX_OK | RTL818X_INT_RX_ERR))
-               rtl8180_handle_rx(dev);
-
-       spin_unlock(&priv->lock);
-
-       return IRQ_HANDLED;
-}
-
-static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
-{
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-       struct rtl8180_priv *priv = dev->priv;
-       struct rtl8180_tx_ring *ring;
-       struct rtl8180_tx_desc *entry;
-       unsigned long flags;
-       unsigned int idx, prio;
-       dma_addr_t mapping;
-       u32 tx_flags;
-       u8 rc_flags;
-       u16 plcp_len = 0;
-       __le16 rts_duration = 0;
-
-       prio = skb_get_queue_mapping(skb);
-       ring = &priv->tx_ring[prio];
-
-       mapping = pci_map_single(priv->pdev, skb->data,
-                                skb->len, PCI_DMA_TODEVICE);
-
-       tx_flags = RTL818X_TX_DESC_FLAG_OWN | RTL818X_TX_DESC_FLAG_FS |
-                  RTL818X_TX_DESC_FLAG_LS |
-                  (ieee80211_get_tx_rate(dev, info)->hw_value << 24) |
-                  skb->len;
-
-       if (priv->r8185)
-               tx_flags |= RTL818X_TX_DESC_FLAG_DMA |
-                           RTL818X_TX_DESC_FLAG_NO_ENC;
-
-       rc_flags = info->control.rates[0].flags;
-       if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
-               tx_flags |= RTL818X_TX_DESC_FLAG_RTS;
-               tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
-       } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
-               tx_flags |= RTL818X_TX_DESC_FLAG_CTS;
-               tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
-       }
-
-       if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS)
-               rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len,
-                                                     info);
-
-       if (!priv->r8185) {
-               unsigned int remainder;
-
-               plcp_len = DIV_ROUND_UP(16 * (skb->len + 4),
-                               (ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
-               remainder = (16 * (skb->len + 4)) %
-                           ((ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
-               if (remainder <= 6)
-                       plcp_len |= 1 << 15;
-       }
-
-       spin_lock_irqsave(&priv->lock, flags);
-
-       if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
-               if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
-                       priv->seqno += 0x10;
-               hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
-               hdr->seq_ctrl |= cpu_to_le16(priv->seqno);
-       }
-
-       idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries;
-       entry = &ring->desc[idx];
-
-       entry->rts_duration = rts_duration;
-       entry->plcp_len = cpu_to_le16(plcp_len);
-       entry->tx_buf = cpu_to_le32(mapping);
-       entry->frame_len = cpu_to_le32(skb->len);
-       entry->flags2 = info->control.rates[1].idx >= 0 ?
-               ieee80211_get_alt_retry_rate(dev, info, 0)->bitrate << 4 : 0;
-       entry->retry_limit = info->control.rates[0].count;
-       entry->flags = cpu_to_le32(tx_flags);
-       __skb_queue_tail(&ring->queue, skb);
-       if (ring->entries - skb_queue_len(&ring->queue) < 2)
-               ieee80211_stop_queue(dev, prio);
-
-       spin_unlock_irqrestore(&priv->lock, flags);
-
-       rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4)));
-
-       return 0;
-}
-
-void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam)
-{
-       u8 reg;
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
-                reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite32(priv, &priv->map->ANAPARAM, anaparam);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
-                reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-}
-
-static int rtl8180_init_hw(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u16 reg;
-
-       rtl818x_iowrite8(priv, &priv->map->CMD, 0);
-       rtl818x_ioread8(priv, &priv->map->CMD);
-       msleep(10);
-
-       /* reset */
-       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
-       rtl818x_ioread8(priv, &priv->map->CMD);
-
-       reg = rtl818x_ioread8(priv, &priv->map->CMD);
-       reg &= (1 << 1);
-       reg |= RTL818X_CMD_RESET;
-       rtl818x_iowrite8(priv, &priv->map->CMD, RTL818X_CMD_RESET);
-       rtl818x_ioread8(priv, &priv->map->CMD);
-       msleep(200);
-
-       /* check success of reset */
-       if (rtl818x_ioread8(priv, &priv->map->CMD) & RTL818X_CMD_RESET) {
-               wiphy_err(dev->wiphy, "reset timeout!\n");
-               return -ETIMEDOUT;
-       }
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_LOAD);
-       rtl818x_ioread8(priv, &priv->map->CMD);
-       msleep(200);
-
-       if (rtl818x_ioread8(priv, &priv->map->CONFIG3) & (1 << 3)) {
-               /* For cardbus */
-               reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
-               reg |= 1 << 1;
-               rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
-               reg = rtl818x_ioread16(priv, &priv->map->FEMR);
-               reg |= (1 << 15) | (1 << 14) | (1 << 4);
-               rtl818x_iowrite16(priv, &priv->map->FEMR, reg);
-       }
-
-       rtl818x_iowrite8(priv, &priv->map->MSR, 0);
-
-       if (!priv->r8185)
-               rtl8180_set_anaparam(priv, priv->anaparam);
-
-       rtl818x_iowrite32(priv, &priv->map->RDSAR, priv->rx_ring_dma);
-       rtl818x_iowrite32(priv, &priv->map->TBDA, priv->tx_ring[3].dma);
-       rtl818x_iowrite32(priv, &priv->map->THPDA, priv->tx_ring[2].dma);
-       rtl818x_iowrite32(priv, &priv->map->TNPDA, priv->tx_ring[1].dma);
-       rtl818x_iowrite32(priv, &priv->map->TLPDA, priv->tx_ring[0].dma);
-
-       /* TODO: necessary? specs indicate not */
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG2);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG2, reg & ~(1 << 3));
-       if (priv->r8185) {
-               reg = rtl818x_ioread8(priv, &priv->map->CONFIG2);
-               rtl818x_iowrite8(priv, &priv->map->CONFIG2, reg | (1 << 4));
-       }
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       /* TODO: set CONFIG5 for calibrating AGC on rtl8180 + philips radio? */
-
-       /* TODO: turn off hw wep on rtl8180 */
-
-       rtl818x_iowrite32(priv, &priv->map->INT_TIMEOUT, 0);
-
-       if (priv->r8185) {
-               rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0);
-               rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0x81);
-               rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (8 << 4) | 0);
-
-               rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3);
-
-               /* TODO: set ClkRun enable? necessary? */
-               reg = rtl818x_ioread8(priv, &priv->map->GP_ENABLE);
-               rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, reg & ~(1 << 6));
-               rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-               reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
-               rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | (1 << 2));
-               rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-       } else {
-               rtl818x_iowrite16(priv, &priv->map->BRSR, 0x1);
-               rtl818x_iowrite8(priv, &priv->map->SECURITY, 0);
-
-               rtl818x_iowrite8(priv, &priv->map->PHY_DELAY, 0x6);
-               rtl818x_iowrite8(priv, &priv->map->CARRIER_SENSE_COUNTER, 0x4C);
-       }
-
-       priv->rf->init(dev);
-       if (priv->r8185)
-               rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3);
-       return 0;
-}
-
-static int rtl8180_init_rx_ring(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       struct rtl8180_rx_desc *entry;
-       int i;
-
-       priv->rx_ring = pci_alloc_consistent(priv->pdev,
-                                            sizeof(*priv->rx_ring) * 32,
-                                            &priv->rx_ring_dma);
-
-       if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) {
-               wiphy_err(dev->wiphy, "Cannot allocate RX ring\n");
-               return -ENOMEM;
-       }
-
-       memset(priv->rx_ring, 0, sizeof(*priv->rx_ring) * 32);
-       priv->rx_idx = 0;
-
-       for (i = 0; i < 32; i++) {
-               struct sk_buff *skb = dev_alloc_skb(MAX_RX_SIZE);
-               dma_addr_t *mapping;
-               entry = &priv->rx_ring[i];
-               if (!skb)
-                       return 0;
-
-               priv->rx_buf[i] = skb;
-               mapping = (dma_addr_t *)skb->cb;
-               *mapping = pci_map_single(priv->pdev, skb_tail_pointer(skb),
-                                         MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
-               entry->rx_buf = cpu_to_le32(*mapping);
-               entry->flags = cpu_to_le32(RTL818X_RX_DESC_FLAG_OWN |
-                                          MAX_RX_SIZE);
-       }
-       entry->flags |= cpu_to_le32(RTL818X_RX_DESC_FLAG_EOR);
-       return 0;
-}
-
-static void rtl8180_free_rx_ring(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       int i;
-
-       for (i = 0; i < 32; i++) {
-               struct sk_buff *skb = priv->rx_buf[i];
-               if (!skb)
-                       continue;
-
-               pci_unmap_single(priv->pdev,
-                                *((dma_addr_t *)skb->cb),
-                                MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
-               kfree_skb(skb);
-       }
-
-       pci_free_consistent(priv->pdev, sizeof(*priv->rx_ring) * 32,
-                           priv->rx_ring, priv->rx_ring_dma);
-       priv->rx_ring = NULL;
-}
-
-static int rtl8180_init_tx_ring(struct ieee80211_hw *dev,
-                               unsigned int prio, unsigned int entries)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       struct rtl8180_tx_desc *ring;
-       dma_addr_t dma;
-       int i;
-
-       ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma);
-       if (!ring || (unsigned long)ring & 0xFF) {
-               wiphy_err(dev->wiphy, "Cannot allocate TX ring (prio = %d)\n",
-                         prio);
-               return -ENOMEM;
-       }
-
-       memset(ring, 0, sizeof(*ring)*entries);
-       priv->tx_ring[prio].desc = ring;
-       priv->tx_ring[prio].dma = dma;
-       priv->tx_ring[prio].idx = 0;
-       priv->tx_ring[prio].entries = entries;
-       skb_queue_head_init(&priv->tx_ring[prio].queue);
-
-       for (i = 0; i < entries; i++)
-               ring[i].next_tx_desc =
-                       cpu_to_le32((u32)dma + ((i + 1) % entries) * sizeof(*ring));
-
-       return 0;
-}
-
-static void rtl8180_free_tx_ring(struct ieee80211_hw *dev, unsigned int prio)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       struct rtl8180_tx_ring *ring = &priv->tx_ring[prio];
-
-       while (skb_queue_len(&ring->queue)) {
-               struct rtl8180_tx_desc *entry = &ring->desc[ring->idx];
-               struct sk_buff *skb = __skb_dequeue(&ring->queue);
-
-               pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf),
-                                skb->len, PCI_DMA_TODEVICE);
-               kfree_skb(skb);
-               ring->idx = (ring->idx + 1) % ring->entries;
-       }
-
-       pci_free_consistent(priv->pdev, sizeof(*ring->desc)*ring->entries,
-                           ring->desc, ring->dma);
-       ring->desc = NULL;
-}
-
-static int rtl8180_start(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       int ret, i;
-       u32 reg;
-
-       ret = rtl8180_init_rx_ring(dev);
-       if (ret)
-               return ret;
-
-       for (i = 0; i < 4; i++)
-               if ((ret = rtl8180_init_tx_ring(dev, i, 16)))
-                       goto err_free_rings;
-
-       ret = rtl8180_init_hw(dev);
-       if (ret)
-               goto err_free_rings;
-
-       rtl818x_iowrite32(priv, &priv->map->RDSAR, priv->rx_ring_dma);
-       rtl818x_iowrite32(priv, &priv->map->TBDA, priv->tx_ring[3].dma);
-       rtl818x_iowrite32(priv, &priv->map->THPDA, priv->tx_ring[2].dma);
-       rtl818x_iowrite32(priv, &priv->map->TNPDA, priv->tx_ring[1].dma);
-       rtl818x_iowrite32(priv, &priv->map->TLPDA, priv->tx_ring[0].dma);
-
-       ret = request_irq(priv->pdev->irq, rtl8180_interrupt,
-                         IRQF_SHARED, KBUILD_MODNAME, dev);
-       if (ret) {
-               wiphy_err(dev->wiphy, "failed to register IRQ handler\n");
-               goto err_free_rings;
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF);
-
-       rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0);
-       rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0);
-
-       reg = RTL818X_RX_CONF_ONLYERLPKT |
-             RTL818X_RX_CONF_RX_AUTORESETPHY |
-             RTL818X_RX_CONF_MGMT |
-             RTL818X_RX_CONF_DATA |
-             (7 << 8 /* MAX RX DMA */) |
-             RTL818X_RX_CONF_BROADCAST |
-             RTL818X_RX_CONF_NICMAC;
-
-       if (priv->r8185)
-               reg |= RTL818X_RX_CONF_CSDM1 | RTL818X_RX_CONF_CSDM2;
-       else {
-               reg |= (priv->rfparam & RF_PARAM_CARRIERSENSE1)
-                       ? RTL818X_RX_CONF_CSDM1 : 0;
-               reg |= (priv->rfparam & RF_PARAM_CARRIERSENSE2)
-                       ? RTL818X_RX_CONF_CSDM2 : 0;
-       }
-
-       priv->rx_conf = reg;
-       rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg);
-
-       if (priv->r8185) {
-               reg = rtl818x_ioread8(priv, &priv->map->CW_CONF);
-               reg &= ~RTL818X_CW_CONF_PERPACKET_CW_SHIFT;
-               reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT;
-               rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg);
-
-               reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL);
-               reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT;
-               reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT;
-               reg |=  RTL818X_TX_AGC_CTL_FEEDBACK_ANT;
-               rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg);
-
-               /* disable early TX */
-               rtl818x_iowrite8(priv, (u8 __iomem *)priv->map + 0xec, 0x3f);
-       }
-
-       reg = rtl818x_ioread32(priv, &priv->map->TX_CONF);
-       reg |= (6 << 21 /* MAX TX DMA */) |
-              RTL818X_TX_CONF_NO_ICV;
-
-       if (priv->r8185)
-               reg &= ~RTL818X_TX_CONF_PROBE_DTS;
-       else
-               reg &= ~RTL818X_TX_CONF_HW_SEQNUM;
-
-       /* different meaning, same value on both rtl8185 and rtl8180 */
-       reg &= ~RTL818X_TX_CONF_SAT_HWPLCP;
-
-       rtl818x_iowrite32(priv, &priv->map->TX_CONF, reg);
-
-       reg = rtl818x_ioread8(priv, &priv->map->CMD);
-       reg |= RTL818X_CMD_RX_ENABLE;
-       reg |= RTL818X_CMD_TX_ENABLE;
-       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
-
-       return 0;
-
- err_free_rings:
-       rtl8180_free_rx_ring(dev);
-       for (i = 0; i < 4; i++)
-               if (priv->tx_ring[i].desc)
-                       rtl8180_free_tx_ring(dev, i);
-
-       return ret;
-}
-
-static void rtl8180_stop(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u8 reg;
-       int i;
-
-       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
-
-       reg = rtl818x_ioread8(priv, &priv->map->CMD);
-       reg &= ~RTL818X_CMD_TX_ENABLE;
-       reg &= ~RTL818X_CMD_RX_ENABLE;
-       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
-
-       priv->rf->stop(dev);
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG4);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG4, reg | RTL818X_CONFIG4_VCOOFF);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       free_irq(priv->pdev->irq, dev);
-
-       rtl8180_free_rx_ring(dev);
-       for (i = 0; i < 4; i++)
-               rtl8180_free_tx_ring(dev, i);
-}
-
-static u64 rtl8180_get_tsf(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-
-       return rtl818x_ioread32(priv, &priv->map->TSFT[0]) |
-              (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32;
-}
-
-static void rtl8180_beacon_work(struct work_struct *work)
-{
-       struct rtl8180_vif *vif_priv =
-               container_of(work, struct rtl8180_vif, beacon_work.work);
-       struct ieee80211_vif *vif =
-               container_of((void *)vif_priv, struct ieee80211_vif, drv_priv);
-       struct ieee80211_hw *dev = vif_priv->dev;
-       struct ieee80211_mgmt *mgmt;
-       struct sk_buff *skb;
-       int err = 0;
-
-       /* don't overflow the tx ring */
-       if (ieee80211_queue_stopped(dev, 0))
-               goto resched;
-
-       /* grab a fresh beacon */
-       skb = ieee80211_beacon_get(dev, vif);
-       if (!skb)
-               goto resched;
-
-       /*
-        * update beacon timestamp w/ TSF value
-        * TODO: make hardware update beacon timestamp
-        */
-       mgmt = (struct ieee80211_mgmt *)skb->data;
-       mgmt->u.beacon.timestamp = cpu_to_le64(rtl8180_get_tsf(dev));
-
-       /* TODO: use actual beacon queue */
-       skb_set_queue_mapping(skb, 0);
-
-       err = rtl8180_tx(dev, skb);
-       WARN_ON(err);
-
-resched:
-       /*
-        * schedule next beacon
-        * TODO: use hardware support for beacon timing
-        */
-       schedule_delayed_work(&vif_priv->beacon_work,
-                       usecs_to_jiffies(1024 * vif->bss_conf.beacon_int));
-}
-
-static int rtl8180_add_interface(struct ieee80211_hw *dev,
-                                struct ieee80211_vif *vif)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       struct rtl8180_vif *vif_priv;
-
-       /*
-        * We only support one active interface at a time.
-        */
-       if (priv->vif)
-               return -EBUSY;
-
-       switch (vif->type) {
-       case NL80211_IFTYPE_STATION:
-       case NL80211_IFTYPE_ADHOC:
-               break;
-       default:
-               return -EOPNOTSUPP;
-       }
-
-       priv->vif = vif;
-
-       /* Initialize driver private area */
-       vif_priv = (struct rtl8180_vif *)&vif->drv_priv;
-       vif_priv->dev = dev;
-       INIT_DELAYED_WORK(&vif_priv->beacon_work, rtl8180_beacon_work);
-       vif_priv->enable_beacon = false;
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0],
-                         le32_to_cpu(*(__le32 *)vif->addr));
-       rtl818x_iowrite16(priv, (__le16 __iomem *)&priv->map->MAC[4],
-                         le16_to_cpu(*(__le16 *)(vif->addr + 4)));
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       return 0;
-}
-
-static void rtl8180_remove_interface(struct ieee80211_hw *dev,
-                                    struct ieee80211_vif *vif)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       priv->vif = NULL;
-}
-
-static int rtl8180_config(struct ieee80211_hw *dev, u32 changed)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       struct ieee80211_conf *conf = &dev->conf;
-
-       priv->rf->set_chan(dev, conf);
-
-       return 0;
-}
-
-static void rtl8180_bss_info_changed(struct ieee80211_hw *dev,
-                                    struct ieee80211_vif *vif,
-                                    struct ieee80211_bss_conf *info,
-                                    u32 changed)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       struct rtl8180_vif *vif_priv;
-       int i;
-       u8 reg;
-
-       vif_priv = (struct rtl8180_vif *)&vif->drv_priv;
-
-       if (changed & BSS_CHANGED_BSSID) {
-               for (i = 0; i < ETH_ALEN; i++)
-                       rtl818x_iowrite8(priv, &priv->map->BSSID[i],
-                                        info->bssid[i]);
-
-               if (is_valid_ether_addr(info->bssid)) {
-                       if (vif->type == NL80211_IFTYPE_ADHOC)
-                               reg = RTL818X_MSR_ADHOC;
-                       else
-                               reg = RTL818X_MSR_INFRA;
-               } else
-                       reg = RTL818X_MSR_NO_LINK;
-               rtl818x_iowrite8(priv, &priv->map->MSR, reg);
-       }
-
-       if (changed & BSS_CHANGED_ERP_SLOT && priv->rf->conf_erp)
-               priv->rf->conf_erp(dev, info);
-
-       if (changed & BSS_CHANGED_BEACON_ENABLED)
-               vif_priv->enable_beacon = info->enable_beacon;
-
-       if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON)) {
-               cancel_delayed_work_sync(&vif_priv->beacon_work);
-               if (vif_priv->enable_beacon)
-                       schedule_work(&vif_priv->beacon_work.work);
-       }
-}
-
-static u64 rtl8180_prepare_multicast(struct ieee80211_hw *dev,
-                                    struct netdev_hw_addr_list *mc_list)
-{
-       return netdev_hw_addr_list_count(mc_list);
-}
-
-static void rtl8180_configure_filter(struct ieee80211_hw *dev,
-                                    unsigned int changed_flags,
-                                    unsigned int *total_flags,
-                                    u64 multicast)
-{
-       struct rtl8180_priv *priv = dev->priv;
-
-       if (changed_flags & FIF_FCSFAIL)
-               priv->rx_conf ^= RTL818X_RX_CONF_FCS;
-       if (changed_flags & FIF_CONTROL)
-               priv->rx_conf ^= RTL818X_RX_CONF_CTRL;
-       if (changed_flags & FIF_OTHER_BSS)
-               priv->rx_conf ^= RTL818X_RX_CONF_MONITOR;
-       if (*total_flags & FIF_ALLMULTI || multicast > 0)
-               priv->rx_conf |= RTL818X_RX_CONF_MULTICAST;
-       else
-               priv->rx_conf &= ~RTL818X_RX_CONF_MULTICAST;
-
-       *total_flags = 0;
-
-       if (priv->rx_conf & RTL818X_RX_CONF_FCS)
-               *total_flags |= FIF_FCSFAIL;
-       if (priv->rx_conf & RTL818X_RX_CONF_CTRL)
-               *total_flags |= FIF_CONTROL;
-       if (priv->rx_conf & RTL818X_RX_CONF_MONITOR)
-               *total_flags |= FIF_OTHER_BSS;
-       if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST)
-               *total_flags |= FIF_ALLMULTI;
-
-       rtl818x_iowrite32(priv, &priv->map->RX_CONF, priv->rx_conf);
-}
-
-static const struct ieee80211_ops rtl8180_ops = {
-       .tx                     = rtl8180_tx,
-       .start                  = rtl8180_start,
-       .stop                   = rtl8180_stop,
-       .add_interface          = rtl8180_add_interface,
-       .remove_interface       = rtl8180_remove_interface,
-       .config                 = rtl8180_config,
-       .bss_info_changed       = rtl8180_bss_info_changed,
-       .prepare_multicast      = rtl8180_prepare_multicast,
-       .configure_filter       = rtl8180_configure_filter,
-       .get_tsf                = rtl8180_get_tsf,
-};
-
-static void rtl8180_eeprom_register_read(struct eeprom_93cx6 *eeprom)
-{
-       struct ieee80211_hw *dev = eeprom->data;
-       struct rtl8180_priv *priv = dev->priv;
-       u8 reg = rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-
-       eeprom->reg_data_in = reg & RTL818X_EEPROM_CMD_WRITE;
-       eeprom->reg_data_out = reg & RTL818X_EEPROM_CMD_READ;
-       eeprom->reg_data_clock = reg & RTL818X_EEPROM_CMD_CK;
-       eeprom->reg_chip_select = reg & RTL818X_EEPROM_CMD_CS;
-}
-
-static void rtl8180_eeprom_register_write(struct eeprom_93cx6 *eeprom)
-{
-       struct ieee80211_hw *dev = eeprom->data;
-       struct rtl8180_priv *priv = dev->priv;
-       u8 reg = 2 << 6;
-
-       if (eeprom->reg_data_in)
-               reg |= RTL818X_EEPROM_CMD_WRITE;
-       if (eeprom->reg_data_out)
-               reg |= RTL818X_EEPROM_CMD_READ;
-       if (eeprom->reg_data_clock)
-               reg |= RTL818X_EEPROM_CMD_CK;
-       if (eeprom->reg_chip_select)
-               reg |= RTL818X_EEPROM_CMD_CS;
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, reg);
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(10);
-}
-
-static int __devinit rtl8180_probe(struct pci_dev *pdev,
-                                  const struct pci_device_id *id)
-{
-       struct ieee80211_hw *dev;
-       struct rtl8180_priv *priv;
-       unsigned long mem_addr, mem_len;
-       unsigned int io_addr, io_len;
-       int err, i;
-       struct eeprom_93cx6 eeprom;
-       const char *chip_name, *rf_name = NULL;
-       u32 reg;
-       u16 eeprom_val;
-       u8 mac_addr[ETH_ALEN];
-
-       err = pci_enable_device(pdev);
-       if (err) {
-               printk(KERN_ERR "%s (rtl8180): Cannot enable new PCI device\n",
-                      pci_name(pdev));
-               return err;
-       }
-
-       err = pci_request_regions(pdev, KBUILD_MODNAME);
-       if (err) {
-               printk(KERN_ERR "%s (rtl8180): Cannot obtain PCI resources\n",
-                      pci_name(pdev));
-               return err;
-       }
-
-       io_addr = pci_resource_start(pdev, 0);
-       io_len = pci_resource_len(pdev, 0);
-       mem_addr = pci_resource_start(pdev, 1);
-       mem_len = pci_resource_len(pdev, 1);
-
-       if (mem_len < sizeof(struct rtl818x_csr) ||
-           io_len < sizeof(struct rtl818x_csr)) {
-               printk(KERN_ERR "%s (rtl8180): Too short PCI resources\n",
-                      pci_name(pdev));
-               err = -ENOMEM;
-               goto err_free_reg;
-       }
-
-       if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) ||
-           (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) {
-               printk(KERN_ERR "%s (rtl8180): No suitable DMA available\n",
-                      pci_name(pdev));
-               goto err_free_reg;
-       }
-
-       pci_set_master(pdev);
-
-       dev = ieee80211_alloc_hw(sizeof(*priv), &rtl8180_ops);
-       if (!dev) {
-               printk(KERN_ERR "%s (rtl8180): ieee80211 alloc failed\n",
-                      pci_name(pdev));
-               err = -ENOMEM;
-               goto err_free_reg;
-       }
-
-       priv = dev->priv;
-       priv->pdev = pdev;
-
-       dev->max_rates = 2;
-       SET_IEEE80211_DEV(dev, &pdev->dev);
-       pci_set_drvdata(pdev, dev);
-
-       priv->map = pci_iomap(pdev, 1, mem_len);
-       if (!priv->map)
-               priv->map = pci_iomap(pdev, 0, io_len);
-
-       if (!priv->map) {
-               printk(KERN_ERR "%s (rtl8180): Cannot map device memory\n",
-                      pci_name(pdev));
-               goto err_free_dev;
-       }
-
-       BUILD_BUG_ON(sizeof(priv->channels) != sizeof(rtl818x_channels));
-       BUILD_BUG_ON(sizeof(priv->rates) != sizeof(rtl818x_rates));
-
-       memcpy(priv->channels, rtl818x_channels, sizeof(rtl818x_channels));
-       memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates));
-
-       priv->band.band = IEEE80211_BAND_2GHZ;
-       priv->band.channels = priv->channels;
-       priv->band.n_channels = ARRAY_SIZE(rtl818x_channels);
-       priv->band.bitrates = priv->rates;
-       priv->band.n_bitrates = 4;
-       dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
-
-       dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-                    IEEE80211_HW_RX_INCLUDES_FCS |
-                    IEEE80211_HW_SIGNAL_UNSPEC;
-       dev->vif_data_size = sizeof(struct rtl8180_vif);
-       dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
-                                       BIT(NL80211_IFTYPE_ADHOC);
-       dev->queues = 1;
-       dev->max_signal = 65;
-
-       reg = rtl818x_ioread32(priv, &priv->map->TX_CONF);
-       reg &= RTL818X_TX_CONF_HWVER_MASK;
-       switch (reg) {
-       case RTL818X_TX_CONF_R8180_ABCD:
-               chip_name = "RTL8180";
-               break;
-       case RTL818X_TX_CONF_R8180_F:
-               chip_name = "RTL8180vF";
-               break;
-       case RTL818X_TX_CONF_R8185_ABC:
-               chip_name = "RTL8185";
-               break;
-       case RTL818X_TX_CONF_R8185_D:
-               chip_name = "RTL8185vD";
-               break;
-       default:
-               printk(KERN_ERR "%s (rtl8180): Unknown chip! (0x%x)\n",
-                      pci_name(pdev), reg >> 25);
-               goto err_iounmap;
-       }
-
-       priv->r8185 = reg & RTL818X_TX_CONF_R8185_ABC;
-       if (priv->r8185) {
-               priv->band.n_bitrates = ARRAY_SIZE(rtl818x_rates);
-               pci_try_set_mwi(pdev);
-       }
-
-       eeprom.data = dev;
-       eeprom.register_read = rtl8180_eeprom_register_read;
-       eeprom.register_write = rtl8180_eeprom_register_write;
-       if (rtl818x_ioread32(priv, &priv->map->RX_CONF) & (1 << 6))
-               eeprom.width = PCI_EEPROM_WIDTH_93C66;
-       else
-               eeprom.width = PCI_EEPROM_WIDTH_93C46;
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_PROGRAM);
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(10);
-
-       eeprom_93cx6_read(&eeprom, 0x06, &eeprom_val);
-       eeprom_val &= 0xFF;
-       switch (eeprom_val) {
-       case 1: rf_name = "Intersil";
-               break;
-       case 2: rf_name = "RFMD";
-               break;
-       case 3: priv->rf = &sa2400_rf_ops;
-               break;
-       case 4: priv->rf = &max2820_rf_ops;
-               break;
-       case 5: priv->rf = &grf5101_rf_ops;
-               break;
-       case 9: priv->rf = rtl8180_detect_rf(dev);
-               break;
-       case 10:
-               rf_name = "RTL8255";
-               break;
-       default:
-               printk(KERN_ERR "%s (rtl8180): Unknown RF! (0x%x)\n",
-                      pci_name(pdev), eeprom_val);
-               goto err_iounmap;
-       }
-
-       if (!priv->rf) {
-               printk(KERN_ERR "%s (rtl8180): %s RF frontend not supported!\n",
-                      pci_name(pdev), rf_name);
-               goto err_iounmap;
-       }
-
-       eeprom_93cx6_read(&eeprom, 0x17, &eeprom_val);
-       priv->csthreshold = eeprom_val >> 8;
-       if (!priv->r8185) {
-               __le32 anaparam;
-               eeprom_93cx6_multiread(&eeprom, 0xD, (__le16 *)&anaparam, 2);
-               priv->anaparam = le32_to_cpu(anaparam);
-               eeprom_93cx6_read(&eeprom, 0x19, &priv->rfparam);
-       }
-
-       eeprom_93cx6_multiread(&eeprom, 0x7, (__le16 *)mac_addr, 3);
-       if (!is_valid_ether_addr(mac_addr)) {
-               printk(KERN_WARNING "%s (rtl8180): Invalid hwaddr! Using"
-                      " randomly generated MAC addr\n", pci_name(pdev));
-               random_ether_addr(mac_addr);
-       }
-       SET_IEEE80211_PERM_ADDR(dev, mac_addr);
-
-       /* CCK TX power */
-       for (i = 0; i < 14; i += 2) {
-               u16 txpwr;
-               eeprom_93cx6_read(&eeprom, 0x10 + (i >> 1), &txpwr);
-               priv->channels[i].hw_value = txpwr & 0xFF;
-               priv->channels[i + 1].hw_value = txpwr >> 8;
-       }
-
-       /* OFDM TX power */
-       if (priv->r8185) {
-               for (i = 0; i < 14; i += 2) {
-                       u16 txpwr;
-                       eeprom_93cx6_read(&eeprom, 0x20 + (i >> 1), &txpwr);
-                       priv->channels[i].hw_value |= (txpwr & 0xFF) << 8;
-                       priv->channels[i + 1].hw_value |= txpwr & 0xFF00;
-               }
-       }
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       spin_lock_init(&priv->lock);
-
-       err = ieee80211_register_hw(dev);
-       if (err) {
-               printk(KERN_ERR "%s (rtl8180): Cannot register device\n",
-                      pci_name(pdev));
-               goto err_iounmap;
-       }
-
-       wiphy_info(dev->wiphy, "hwaddr %pm, %s + %s\n",
-                  mac_addr, chip_name, priv->rf->name);
-
-       return 0;
-
- err_iounmap:
-       iounmap(priv->map);
-
- err_free_dev:
-       pci_set_drvdata(pdev, NULL);
-       ieee80211_free_hw(dev);
-
- err_free_reg:
-       pci_release_regions(pdev);
-       pci_disable_device(pdev);
-       return err;
-}
-
-static void __devexit rtl8180_remove(struct pci_dev *pdev)
-{
-       struct ieee80211_hw *dev = pci_get_drvdata(pdev);
-       struct rtl8180_priv *priv;
-
-       if (!dev)
-               return;
-
-       ieee80211_unregister_hw(dev);
-
-       priv = dev->priv;
-
-       pci_iounmap(pdev, priv->map);
-       pci_release_regions(pdev);
-       pci_disable_device(pdev);
-       ieee80211_free_hw(dev);
-}
-
-#ifdef CONFIG_PM
-static int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state)
-{
-       pci_save_state(pdev);
-       pci_set_power_state(pdev, pci_choose_state(pdev, state));
-       return 0;
-}
-
-static int rtl8180_resume(struct pci_dev *pdev)
-{
-       pci_set_power_state(pdev, PCI_D0);
-       pci_restore_state(pdev);
-       return 0;
-}
-
-#endif /* CONFIG_PM */
-
-static struct pci_driver rtl8180_driver = {
-       .name           = KBUILD_MODNAME,
-       .id_table       = rtl8180_table,
-       .probe          = rtl8180_probe,
-       .remove         = __devexit_p(rtl8180_remove),
-#ifdef CONFIG_PM
-       .suspend        = rtl8180_suspend,
-       .resume         = rtl8180_resume,
-#endif /* CONFIG_PM */
-};
-
-static int __init rtl8180_init(void)
-{
-       return pci_register_driver(&rtl8180_driver);
-}
-
-static void __exit rtl8180_exit(void)
-{
-       pci_unregister_driver(&rtl8180_driver);
-}
-
-module_init(rtl8180_init);
-module_exit(rtl8180_exit);
diff --git a/drivers/net/wireless/rtl818x/rtl8180_grf5101.c b/drivers/net/wireless/rtl818x/rtl8180_grf5101.c
deleted file mode 100644 (file)
index 5cab9df..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-
-/*
- * Radio tuning for GCT GRF5101 on RTL8180
- *
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Code from the BSD driver and the rtl8181 project have been
- * very useful to understand certain things
- *
- * I want to thanks the Authors of such projects and the Ndiswrapper
- * project Authors.
- *
- * A special Big Thanks also is for all people who donated me cards,
- * making possible the creation of the original rtl8180 driver
- * from which this code is derived!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <net/mac80211.h>
-
-#include "rtl8180.h"
-#include "rtl8180_grf5101.h"
-
-static const int grf5101_encode[] = {
-       0x0, 0x8, 0x4, 0xC,
-       0x2, 0xA, 0x6, 0xE,
-       0x1, 0x9, 0x5, 0xD,
-       0x3, 0xB, 0x7, 0xF
-};
-
-static void write_grf5101(struct ieee80211_hw *dev, u8 addr, u32 data)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u32 phy_config;
-
-       phy_config =  grf5101_encode[(data >> 8) & 0xF];
-       phy_config |= grf5101_encode[(data >> 4) & 0xF] << 4;
-       phy_config |= grf5101_encode[data & 0xF] << 8;
-       phy_config |= grf5101_encode[(addr >> 1) & 0xF] << 12;
-       phy_config |= (addr & 1) << 16;
-       phy_config |= grf5101_encode[(data & 0xf000) >> 12] << 24;
-
-       /* MAC will bang bits to the chip */
-       phy_config |= 0x90000000;
-
-       rtl818x_iowrite32(priv,
-               (__le32 __iomem *) &priv->map->RFPinsOutput, phy_config);
-
-       msleep(3);
-}
-
-static void grf5101_write_phy_antenna(struct ieee80211_hw *dev, short chan)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u8 ant = GRF5101_ANTENNA;
-
-       if (priv->rfparam & RF_PARAM_ANTBDEFAULT)
-               ant |= BB_ANTENNA_B;
-
-       if (chan == 14)
-               ant |= BB_ANTATTEN_CHAN14;
-
-       rtl8180_write_phy(dev, 0x10, ant);
-}
-
-static u8 grf5101_rf_calc_rssi(u8 agc, u8 sq)
-{
-       if (agc > 60)
-               return 65;
-
-       /* TODO(?): just return agc (or agc + 5) to avoid mult / div */
-       return 65 * agc / 60;
-}
-
-static void grf5101_rf_set_channel(struct ieee80211_hw *dev,
-                                  struct ieee80211_conf *conf)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       int channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
-       u32 txpw = priv->channels[channel - 1].hw_value & 0xFF;
-       u32 chan = channel - 1;
-
-       /* set TX power */
-       write_grf5101(dev, 0x15, 0x0);
-       write_grf5101(dev, 0x06, txpw);
-       write_grf5101(dev, 0x15, 0x10);
-       write_grf5101(dev, 0x15, 0x0);
-
-       /* set frequency */
-       write_grf5101(dev, 0x07, 0x0);
-       write_grf5101(dev, 0x0B, chan);
-       write_grf5101(dev, 0x07, 0x1000);
-
-       grf5101_write_phy_antenna(dev, channel);
-}
-
-static void grf5101_rf_stop(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u32 anaparam;
-
-       anaparam = priv->anaparam;
-       anaparam &= 0x000fffff;
-       anaparam |= 0x3f900000;
-       rtl8180_set_anaparam(priv, anaparam);
-
-       write_grf5101(dev, 0x07, 0x0);
-       write_grf5101(dev, 0x1f, 0x45);
-       write_grf5101(dev, 0x1f, 0x5);
-       write_grf5101(dev, 0x00, 0x8e4);
-}
-
-static void grf5101_rf_init(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-
-       rtl8180_set_anaparam(priv, priv->anaparam);
-
-       write_grf5101(dev, 0x1f, 0x0);
-       write_grf5101(dev, 0x1f, 0x0);
-       write_grf5101(dev, 0x1f, 0x40);
-       write_grf5101(dev, 0x1f, 0x60);
-       write_grf5101(dev, 0x1f, 0x61);
-       write_grf5101(dev, 0x1f, 0x61);
-       write_grf5101(dev, 0x00, 0xae4);
-       write_grf5101(dev, 0x1f, 0x1);
-       write_grf5101(dev, 0x1f, 0x41);
-       write_grf5101(dev, 0x1f, 0x61);
-
-       write_grf5101(dev, 0x01, 0x1a23);
-       write_grf5101(dev, 0x02, 0x4971);
-       write_grf5101(dev, 0x03, 0x41de);
-       write_grf5101(dev, 0x04, 0x2d80);
-       write_grf5101(dev, 0x05, 0x68ff);       /* 0x61ff original value */
-       write_grf5101(dev, 0x06, 0x0);
-       write_grf5101(dev, 0x07, 0x0);
-       write_grf5101(dev, 0x08, 0x7533);
-       write_grf5101(dev, 0x09, 0xc401);
-       write_grf5101(dev, 0x0a, 0x0);
-       write_grf5101(dev, 0x0c, 0x1c7);
-       write_grf5101(dev, 0x0d, 0x29d3);
-       write_grf5101(dev, 0x0e, 0x2e8);
-       write_grf5101(dev, 0x10, 0x192);
-       write_grf5101(dev, 0x11, 0x248);
-       write_grf5101(dev, 0x12, 0x0);
-       write_grf5101(dev, 0x13, 0x20c4);
-       write_grf5101(dev, 0x14, 0xf4fc);
-       write_grf5101(dev, 0x15, 0x0);
-       write_grf5101(dev, 0x16, 0x1500);
-
-       write_grf5101(dev, 0x07, 0x1000);
-
-       /* baseband configuration */
-       rtl8180_write_phy(dev, 0, 0xa8);
-       rtl8180_write_phy(dev, 3, 0x0);
-       rtl8180_write_phy(dev, 4, 0xc0);
-       rtl8180_write_phy(dev, 5, 0x90);
-       rtl8180_write_phy(dev, 6, 0x1e);
-       rtl8180_write_phy(dev, 7, 0x64);
-
-       grf5101_write_phy_antenna(dev, 1);
-
-       rtl8180_write_phy(dev, 0x11, 0x88);
-
-       if (rtl818x_ioread8(priv, &priv->map->CONFIG2) &
-           RTL818X_CONFIG2_ANTENNA_DIV)
-               rtl8180_write_phy(dev, 0x12, 0xc0); /* enable ant diversity */
-       else
-               rtl8180_write_phy(dev, 0x12, 0x40); /* disable ant diversity */
-
-       rtl8180_write_phy(dev, 0x13, 0x90 | priv->csthreshold);
-
-       rtl8180_write_phy(dev, 0x19, 0x0);
-       rtl8180_write_phy(dev, 0x1a, 0xa0);
-       rtl8180_write_phy(dev, 0x1b, 0x44);
-}
-
-const struct rtl818x_rf_ops grf5101_rf_ops = {
-       .name           = "GCT",
-       .init           = grf5101_rf_init,
-       .stop           = grf5101_rf_stop,
-       .set_chan       = grf5101_rf_set_channel,
-       .calc_rssi      = grf5101_rf_calc_rssi,
-};
diff --git a/drivers/net/wireless/rtl818x/rtl8180_grf5101.h b/drivers/net/wireless/rtl818x/rtl8180_grf5101.h
deleted file mode 100644 (file)
index 7664711..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef RTL8180_GRF5101_H
-#define RTL8180_GRF5101_H
-
-/*
- * Radio tuning for GCT GRF5101 on RTL8180
- *
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Code from the BSD driver and the rtl8181 project have been
- * very useful to understand certain things
- *
- * I want to thanks the Authors of such projects and the Ndiswrapper
- * project Authors.
- *
- * A special Big Thanks also is for all people who donated me cards,
- * making possible the creation of the original rtl8180 driver
- * from which this code is derived!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#define GRF5101_ANTENNA 0xA3
-
-extern const struct rtl818x_rf_ops grf5101_rf_ops;
-
-#endif /* RTL8180_GRF5101_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8180_max2820.c b/drivers/net/wireless/rtl818x/rtl8180_max2820.c
deleted file mode 100644 (file)
index 16c4655..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Radio tuning for Maxim max2820 on RTL8180
- *
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Code from the BSD driver and the rtl8181 project have been
- * very useful to understand certain things
- *
- * I want to thanks the Authors of such projects and the Ndiswrapper
- * project Authors.
- *
- * A special Big Thanks also is for all people who donated me cards,
- * making possible the creation of the original rtl8180 driver
- * from which this code is derived!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <net/mac80211.h>
-
-#include "rtl8180.h"
-#include "rtl8180_max2820.h"
-
-static const u32 max2820_chan[] = {
-       12, /* CH 1 */
-       17,
-       22,
-       27,
-       32,
-       37,
-       42,
-       47,
-       52,
-       57,
-       62,
-       67,
-       72,
-       84, /* CH 14 */
-};
-
-static void write_max2820(struct ieee80211_hw *dev, u8 addr, u32 data)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u32 phy_config;
-
-       phy_config = 0x90 + (data & 0xf);
-       phy_config <<= 16;
-       phy_config += addr;
-       phy_config <<= 8;
-       phy_config += (data >> 4) & 0xff;
-
-       rtl818x_iowrite32(priv,
-               (__le32 __iomem *) &priv->map->RFPinsOutput, phy_config);
-
-       msleep(1);
-}
-
-static void max2820_write_phy_antenna(struct ieee80211_hw *dev, short chan)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u8 ant;
-
-       ant = MAXIM_ANTENNA;
-       if (priv->rfparam & RF_PARAM_ANTBDEFAULT)
-               ant |= BB_ANTENNA_B;
-       if (chan == 14)
-               ant |= BB_ANTATTEN_CHAN14;
-
-       rtl8180_write_phy(dev, 0x10, ant);
-}
-
-static u8 max2820_rf_calc_rssi(u8 agc, u8 sq)
-{
-       bool odd;
-
-       odd = !!(agc & 1);
-
-       agc >>= 1;
-       if (odd)
-               agc += 76;
-       else
-               agc += 66;
-
-       /* TODO: change addends above to avoid mult / div below */
-       return 65 * agc / 100;
-}
-
-static void max2820_rf_set_channel(struct ieee80211_hw *dev,
-                                  struct ieee80211_conf *conf)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       int channel = conf ?
-               ieee80211_frequency_to_channel(conf->channel->center_freq) : 1;
-       unsigned int chan_idx = channel - 1;
-       u32 txpw = priv->channels[chan_idx].hw_value & 0xFF;
-       u32 chan = max2820_chan[chan_idx];
-
-       /* While philips SA2400 drive the PA bias from
-        * sa2400, for MAXIM we do this directly from BB */
-       rtl8180_write_phy(dev, 3, txpw);
-
-       max2820_write_phy_antenna(dev, channel);
-       write_max2820(dev, 3, chan);
-}
-
-static void max2820_rf_stop(struct ieee80211_hw *dev)
-{
-       rtl8180_write_phy(dev, 3, 0x8);
-       write_max2820(dev, 1, 0);
-}
-
-
-static void max2820_rf_init(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-
-       /* MAXIM from netbsd driver */
-       write_max2820(dev, 0, 0x007); /* test mode as indicated in datasheet */
-       write_max2820(dev, 1, 0x01e); /* enable register */
-       write_max2820(dev, 2, 0x001); /* synt register */
-
-       max2820_rf_set_channel(dev, NULL);
-
-       write_max2820(dev, 4, 0x313); /* rx register */
-
-       /* PA is driven directly by the BB, we keep the MAXIM bias
-        * at the highest value in case that setting it to lower
-        * values may introduce some further attenuation somewhere..
-        */
-       write_max2820(dev, 5, 0x00f);
-
-       /* baseband configuration */
-       rtl8180_write_phy(dev, 0, 0x88); /* sys1       */
-       rtl8180_write_phy(dev, 3, 0x08); /* txagc      */
-       rtl8180_write_phy(dev, 4, 0xf8); /* lnadet     */
-       rtl8180_write_phy(dev, 5, 0x90); /* ifagcinit  */
-       rtl8180_write_phy(dev, 6, 0x1a); /* ifagclimit */
-       rtl8180_write_phy(dev, 7, 0x64); /* ifagcdet   */
-
-       max2820_write_phy_antenna(dev, 1);
-
-       rtl8180_write_phy(dev, 0x11, 0x88); /* trl */
-
-       if (rtl818x_ioread8(priv, &priv->map->CONFIG2) &
-           RTL818X_CONFIG2_ANTENNA_DIV)
-               rtl8180_write_phy(dev, 0x12, 0xc7);
-       else
-               rtl8180_write_phy(dev, 0x12, 0x47);
-
-       rtl8180_write_phy(dev, 0x13, 0x9b);
-
-       rtl8180_write_phy(dev, 0x19, 0x0);  /* CHESTLIM */
-       rtl8180_write_phy(dev, 0x1a, 0x9f); /* CHSQLIM  */
-
-       max2820_rf_set_channel(dev, NULL);
-}
-
-const struct rtl818x_rf_ops max2820_rf_ops = {
-       .name           = "Maxim",
-       .init           = max2820_rf_init,
-       .stop           = max2820_rf_stop,
-       .set_chan       = max2820_rf_set_channel,
-       .calc_rssi      = max2820_rf_calc_rssi,
-};
diff --git a/drivers/net/wireless/rtl818x/rtl8180_max2820.h b/drivers/net/wireless/rtl818x/rtl8180_max2820.h
deleted file mode 100644 (file)
index 61cf6d1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef RTL8180_MAX2820_H
-#define RTL8180_MAX2820_H
-
-/*
- * Radio tuning for Maxim max2820 on RTL8180
- *
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Code from the BSD driver and the rtl8181 project have been
- * very useful to understand certain things
- *
- * I want to thanks the Authors of such projects and the Ndiswrapper
- * project Authors.
- *
- * A special Big Thanks also is for all people who donated me cards,
- * making possible the creation of the original rtl8180 driver
- * from which this code is derived!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#define MAXIM_ANTENNA 0xb3
-
-extern const struct rtl818x_rf_ops max2820_rf_ops;
-
-#endif /* RTL8180_MAX2820_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8180_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8180_rtl8225.c
deleted file mode 100644 (file)
index 69e4d47..0000000
+++ /dev/null
@@ -1,791 +0,0 @@
-
-/*
- * Radio tuning for RTL8225 on RTL8180
- *
- * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Based on the r8180 driver, which is:
- * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
- *
- * Thanks to Realtek for their support!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <net/mac80211.h>
-
-#include "rtl8180.h"
-#include "rtl8180_rtl8225.h"
-
-static void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u16 reg80, reg84, reg82;
-       u32 bangdata;
-       int i;
-
-       bangdata = (data << 4) | (addr & 0xf);
-
-       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput) & 0xfff3;
-       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x7);
-
-       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x7 | 0x400);
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(10);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(2);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(10);
-
-       for (i = 15; i >= 0; i--) {
-               u16 reg = reg80;
-
-               if (bangdata & (1 << i))
-                       reg |= 1;
-
-               if (i & 1)
-                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
-
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1));
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1));
-
-               if (!(i & 1))
-                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(10);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x400);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-}
-
-static u16 rtl8225_read(struct ieee80211_hw *dev, u8 addr)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u16 reg80, reg82, reg84, out;
-       int i;
-
-       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput);
-       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
-       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect) | 0x400;
-
-       reg80 &= ~0xF;
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x000F);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x000F);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(4);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(5);
-
-       for (i = 4; i >= 0; i--) {
-               u16 reg = reg80 | ((addr >> i) & 1);
-
-               if (!(i & 1)) {
-                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
-                       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-                       udelay(1);
-               }
-
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg | (1 << 1));
-               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-               udelay(2);
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg | (1 << 1));
-               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-               udelay(2);
-
-               if (i & 1) {
-                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
-                       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-                       udelay(1);
-               }
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x000E);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x040E);
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                         reg80 | (1 << 3) | (1 << 1));
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(2);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                         reg80 | (1 << 3));
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(2);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                         reg80 | (1 << 3));
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(2);
-
-       out = 0;
-       for (i = 11; i >= 0; i--) {
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3));
-               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-               udelay(1);
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3) | (1 << 1));
-               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-               udelay(2);
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3) | (1 << 1));
-               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-               udelay(2);
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3) | (1 << 1));
-               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-               udelay(2);
-
-               if (rtl818x_ioread16(priv, &priv->map->RFPinsInput) & (1 << 1))
-                       out |= 1 << i;
-
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3));
-               rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-               udelay(2);
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                         reg80 | (1 << 3) | (1 << 2));
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       udelay(2);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x03A0);
-
-       return out;
-}
-
-static const u16 rtl8225bcd_rxgain[] = {
-       0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
-       0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
-       0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
-       0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
-       0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
-       0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
-       0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
-       0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
-       0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
-       0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
-       0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3,
-       0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb
-};
-
-static const u8 rtl8225_agc[] = {
-       0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
-       0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96,
-       0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e,
-       0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86,
-       0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e,
-       0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36,
-       0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e,
-       0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26,
-       0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e,
-       0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16,
-       0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e,
-       0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06,
-       0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01,
-       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
-};
-
-static const u8 rtl8225_gain[] = {
-       0x23, 0x88, 0x7c, 0xa5, /* -82dbm */
-       0x23, 0x88, 0x7c, 0xb5, /* -82dbm */
-       0x23, 0x88, 0x7c, 0xc5, /* -82dbm */
-       0x33, 0x80, 0x79, 0xc5, /* -78dbm */
-       0x43, 0x78, 0x76, 0xc5, /* -74dbm */
-       0x53, 0x60, 0x73, 0xc5, /* -70dbm */
-       0x63, 0x58, 0x70, 0xc5, /* -66dbm */
-};
-
-static const u8 rtl8225_threshold[] = {
-       0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd
-};
-
-static const u8 rtl8225_tx_gain_cck_ofdm[] = {
-       0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
-};
-
-static const u8 rtl8225_tx_power_cck[] = {
-       0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
-       0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
-       0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
-       0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
-       0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
-       0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
-};
-
-static const u8 rtl8225_tx_power_cck_ch14[] = {
-       0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
-       0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
-       0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
-       0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
-       0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
-       0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
-};
-
-static const u8 rtl8225_tx_power_ofdm[] = {
-       0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
-};
-
-static const u32 rtl8225_chan[] = {
-       0x085c, 0x08dc, 0x095c, 0x09dc, 0x0a5c, 0x0adc, 0x0b5c,
-       0x0bdc, 0x0c5c, 0x0cdc, 0x0d5c, 0x0ddc, 0x0e5c, 0x0f72
-};
-
-static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u8 cck_power, ofdm_power;
-       const u8 *tmp;
-       u32 reg;
-       int i;
-
-       cck_power = priv->channels[channel - 1].hw_value & 0xFF;
-       ofdm_power = priv->channels[channel - 1].hw_value >> 8;
-
-       cck_power = min(cck_power, (u8)35);
-       ofdm_power = min(ofdm_power, (u8)35);
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
-                        rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1);
-
-       if (channel == 14)
-               tmp = &rtl8225_tx_power_cck_ch14[(cck_power % 6) * 8];
-       else
-               tmp = &rtl8225_tx_power_cck[(cck_power % 6) * 8];
-
-       for (i = 0; i < 8; i++)
-               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
-
-       msleep(1); /* FIXME: optional? */
-
-       /* anaparam2 on */
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_ON);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM,
-                        rtl8225_tx_gain_cck_ofdm[ofdm_power/6] >> 1);
-
-       tmp = &rtl8225_tx_power_ofdm[ofdm_power % 6];
-
-       rtl8225_write_phy_ofdm(dev, 5, *tmp);
-       rtl8225_write_phy_ofdm(dev, 7, *tmp);
-
-       msleep(1);
-}
-
-static void rtl8225_rf_init(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       int i;
-
-       rtl8180_set_anaparam(priv, RTL8225_ANAPARAM_ON);
-
-       /* host_pci_init */
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x0488);
-       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0);
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       msleep(200);    /* FIXME: ehh?? */
-       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0xFF & ~(1 << 6));
-
-       rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x000a8008);
-
-       /* TODO: check if we need really to change BRSR to do RF config */
-       rtl818x_ioread16(priv, &priv->map->BRSR);
-       rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF);
-       rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       rtl8225_write(dev, 0x0, 0x067);
-       rtl8225_write(dev, 0x1, 0xFE0);
-       rtl8225_write(dev, 0x2, 0x44D);
-       rtl8225_write(dev, 0x3, 0x441);
-       rtl8225_write(dev, 0x4, 0x8BE);
-       rtl8225_write(dev, 0x5, 0xBF0);         /* TODO: minipci */
-       rtl8225_write(dev, 0x6, 0xAE6);
-       rtl8225_write(dev, 0x7, rtl8225_chan[0]);
-       rtl8225_write(dev, 0x8, 0x01F);
-       rtl8225_write(dev, 0x9, 0x334);
-       rtl8225_write(dev, 0xA, 0xFD4);
-       rtl8225_write(dev, 0xB, 0x391);
-       rtl8225_write(dev, 0xC, 0x050);
-       rtl8225_write(dev, 0xD, 0x6DB);
-       rtl8225_write(dev, 0xE, 0x029);
-       rtl8225_write(dev, 0xF, 0x914); msleep(1);
-
-       rtl8225_write(dev, 0x2, 0xC4D); msleep(100);
-
-       rtl8225_write(dev, 0x0, 0x127);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225bcd_rxgain); i++) {
-               rtl8225_write(dev, 0x1, i + 1);
-               rtl8225_write(dev, 0x2, rtl8225bcd_rxgain[i]);
-       }
-
-       rtl8225_write(dev, 0x0, 0x027);
-       rtl8225_write(dev, 0x0, 0x22F);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) {
-               rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]);
-               msleep(1);
-               rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i);
-               msleep(1);
-       }
-
-       msleep(1);
-
-       rtl8225_write_phy_ofdm(dev, 0x00, 0x01); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x01, 0x02); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x02, 0x62); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x03, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x04, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x05, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x06, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x07, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x08, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x09, 0xfe); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0a, 0x09); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0b, 0x80); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0c, 0x01); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0f, 0x38); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x10, 0x84); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x11, 0x03); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x12, 0x20); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x13, 0x20); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x14, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x15, 0x40); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x16, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x17, 0x40); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x18, 0xef); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x19, 0x19); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1a, 0x20); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1b, 0x76); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1c, 0x04); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1e, 0x95); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1f, 0x75); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x20, 0x1f); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x21, 0x27); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x22, 0x16); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x24, 0x46); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x25, 0x20); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x27, 0x88); msleep(1);
-
-       rtl8225_write_phy_cck(dev, 0x00, 0x98); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x03, 0x20); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x04, 0x7e); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x05, 0x12); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x06, 0xfc); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x07, 0x78); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x08, 0x2e); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x10, 0x93); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x11, 0x88); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x12, 0x47); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x13, 0xd0);
-       rtl8225_write_phy_cck(dev, 0x19, 0x00);
-       rtl8225_write_phy_cck(dev, 0x1a, 0xa0);
-       rtl8225_write_phy_cck(dev, 0x1b, 0x08);
-       rtl8225_write_phy_cck(dev, 0x40, 0x86);
-       rtl8225_write_phy_cck(dev, 0x41, 0x8d); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x42, 0x15); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x43, 0x18); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x44, 0x1f); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x45, 0x1e); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x46, 0x1a); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x47, 0x15); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x48, 0x10); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x49, 0x0a); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x4a, 0x05); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x4b, 0x02); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x4c, 0x05); msleep(1);
-
-       rtl818x_iowrite8(priv, &priv->map->TESTR, 0x0D); msleep(1);
-
-       rtl8225_rf_set_tx_power(dev, 1);
-
-       /* RX antenna default to A */
-       rtl8225_write_phy_cck(dev, 0x10, 0x9b); msleep(1);      /* B: 0xDB */
-       rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1);     /* B: 0x10 */
-
-       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);   /* B: 0x00 */
-       msleep(1);
-       rtl818x_iowrite32(priv, (__le32 __iomem *)((void __iomem *)priv->map + 0x94), 0x15c00002);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-
-       rtl8225_write(dev, 0x0c, 0x50);
-       /* set OFDM initial gain */
-       rtl8225_write_phy_ofdm(dev, 0x0d, rtl8225_gain[4 * 4]);
-       rtl8225_write_phy_ofdm(dev, 0x23, rtl8225_gain[4 * 4 + 1]);
-       rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225_gain[4 * 4 + 2]);
-       rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225_gain[4 * 4 + 3]);
-       /* set CCK threshold */
-       rtl8225_write_phy_cck(dev, 0x41, rtl8225_threshold[0]);
-}
-
-static const u8 rtl8225z2_tx_power_cck_ch14[] = {
-       0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00
-};
-
-static const u8 rtl8225z2_tx_power_cck_B[] = {
-       0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x04
-};
-
-static const u8 rtl8225z2_tx_power_cck_A[] = {
-       0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04
-};
-
-static const u8 rtl8225z2_tx_power_cck[] = {
-       0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04
-};
-
-static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u8 cck_power, ofdm_power;
-       const u8 *tmp;
-       int i;
-
-       cck_power = priv->channels[channel - 1].hw_value & 0xFF;
-       ofdm_power = priv->channels[channel - 1].hw_value >> 8;
-
-       if (channel == 14)
-               tmp = rtl8225z2_tx_power_cck_ch14;
-       else if (cck_power == 12)
-               tmp = rtl8225z2_tx_power_cck_B;
-       else if (cck_power == 13)
-               tmp = rtl8225z2_tx_power_cck_A;
-       else
-               tmp = rtl8225z2_tx_power_cck;
-
-       for (i = 0; i < 8; i++)
-               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
-
-       cck_power = min(cck_power, (u8)35);
-       if (cck_power == 13 || cck_power == 14)
-               cck_power = 12;
-       if (cck_power >= 15)
-               cck_power -= 2;
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, cck_power);
-       rtl818x_ioread8(priv, &priv->map->TX_GAIN_CCK);
-       msleep(1);
-
-       ofdm_power = min(ofdm_power, (u8)35);
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, ofdm_power);
-
-       rtl8225_write_phy_ofdm(dev, 2, 0x62);
-       rtl8225_write_phy_ofdm(dev, 5, 0x00);
-       rtl8225_write_phy_ofdm(dev, 6, 0x40);
-       rtl8225_write_phy_ofdm(dev, 7, 0x00);
-       rtl8225_write_phy_ofdm(dev, 8, 0x40);
-
-       msleep(1);
-}
-
-static const u16 rtl8225z2_rxgain[] = {
-       0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
-       0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
-       0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
-       0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
-       0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
-       0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
-       0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
-       0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
-       0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
-       0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
-       0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
-       0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
-};
-
-static void rtl8225z2_rf_init(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       int i;
-
-       rtl8180_set_anaparam(priv, RTL8225_ANAPARAM_ON);
-
-       /* host_pci_init */
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x0488);
-       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0);
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       msleep(200);    /* FIXME: ehh?? */
-       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0xFF & ~(1 << 6));
-
-       rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x00088008);
-
-       /* TODO: check if we need really to change BRSR to do RF config */
-       rtl818x_ioread16(priv, &priv->map->BRSR);
-       rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF);
-       rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-
-       rtl8225_write(dev, 0x0, 0x0B7); msleep(1);
-       rtl8225_write(dev, 0x1, 0xEE0); msleep(1);
-       rtl8225_write(dev, 0x2, 0x44D); msleep(1);
-       rtl8225_write(dev, 0x3, 0x441); msleep(1);
-       rtl8225_write(dev, 0x4, 0x8C3); msleep(1);
-       rtl8225_write(dev, 0x5, 0xC72); msleep(1);
-       rtl8225_write(dev, 0x6, 0x0E6); msleep(1);
-       rtl8225_write(dev, 0x7, 0x82A); msleep(1);
-       rtl8225_write(dev, 0x8, 0x03F); msleep(1);
-       rtl8225_write(dev, 0x9, 0x335); msleep(1);
-       rtl8225_write(dev, 0xa, 0x9D4); msleep(1);
-       rtl8225_write(dev, 0xb, 0x7BB); msleep(1);
-       rtl8225_write(dev, 0xc, 0x850); msleep(1);
-       rtl8225_write(dev, 0xd, 0xCDF); msleep(1);
-       rtl8225_write(dev, 0xe, 0x02B); msleep(1);
-       rtl8225_write(dev, 0xf, 0x114); msleep(100);
-
-       if (!(rtl8225_read(dev, 6) & (1 << 7))) {
-               rtl8225_write(dev, 0x02, 0x0C4D);
-               msleep(200);
-               rtl8225_write(dev, 0x02, 0x044D);
-               msleep(100);
-               /* TODO: readd calibration failure message when the calibration
-                  check works */
-       }
-
-       rtl8225_write(dev, 0x0, 0x1B7);
-       rtl8225_write(dev, 0x3, 0x002);
-       rtl8225_write(dev, 0x5, 0x004);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) {
-               rtl8225_write(dev, 0x1, i + 1);
-               rtl8225_write(dev, 0x2, rtl8225z2_rxgain[i]);
-       }
-
-       rtl8225_write(dev, 0x0, 0x0B7); msleep(100);
-       rtl8225_write(dev, 0x2, 0xC4D);
-
-       msleep(200);
-       rtl8225_write(dev, 0x2, 0x44D);
-       msleep(100);
-
-       rtl8225_write(dev, 0x00, 0x2BF);
-       rtl8225_write(dev, 0xFF, 0xFFFF);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) {
-               rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]);
-               msleep(1);
-               rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i);
-               msleep(1);
-       }
-
-       msleep(1);
-
-       rtl8225_write_phy_ofdm(dev, 0x00, 0x01); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x01, 0x02); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x02, 0x62); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x03, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x04, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x05, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x06, 0x40); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x07, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x08, 0x40); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x09, 0xfe); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0a, 0x09); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x18, 0xef); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0b, 0x80); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0c, 0x01); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0d, 0x43);
-       rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x0f, 0x38); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x10, 0x84); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x11, 0x06); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x12, 0x20); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x13, 0x20); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x14, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x15, 0x40); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x16, 0x00); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x17, 0x40); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x18, 0xef); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x19, 0x19); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1a, 0x20); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1b, 0x11); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1c, 0x04); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1d, 0xc5); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1e, 0xb3); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x1f, 0x75); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x20, 0x1f); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x21, 0x27); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x22, 0x16); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x23, 0x80); msleep(1); /* FIXME: not needed? */
-       rtl8225_write_phy_ofdm(dev, 0x24, 0x46); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x25, 0x20); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1);
-       rtl8225_write_phy_ofdm(dev, 0x27, 0x88); msleep(1);
-
-       rtl8225_write_phy_cck(dev, 0x00, 0x98); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x03, 0x20); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x04, 0x7e); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x05, 0x12); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x06, 0xfc); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x07, 0x78); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x08, 0x2e); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x10, 0x93); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x11, 0x88); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x12, 0x47); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x13, 0xd0);
-       rtl8225_write_phy_cck(dev, 0x19, 0x00);
-       rtl8225_write_phy_cck(dev, 0x1a, 0xa0);
-       rtl8225_write_phy_cck(dev, 0x1b, 0x08);
-       rtl8225_write_phy_cck(dev, 0x40, 0x86);
-       rtl8225_write_phy_cck(dev, 0x41, 0x8a); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x42, 0x15); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x43, 0x18); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x44, 0x36); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x45, 0x35); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x46, 0x2e); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x47, 0x25); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x48, 0x1c); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x49, 0x12); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x4a, 0x09); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x4b, 0x04); msleep(1);
-       rtl8225_write_phy_cck(dev, 0x4c, 0x05); msleep(1);
-
-       rtl818x_iowrite8(priv, (u8 __iomem *)((void __iomem *)priv->map + 0x5B), 0x0D); msleep(1);
-
-       rtl8225z2_rf_set_tx_power(dev, 1);
-
-       /* RX antenna default to A */
-       rtl8225_write_phy_cck(dev, 0x10, 0x9b); msleep(1);      /* B: 0xDB */
-       rtl8225_write_phy_ofdm(dev, 0x26, 0x90); msleep(1);     /* B: 0x10 */
-
-       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);   /* B: 0x00 */
-       msleep(1);
-       rtl818x_iowrite32(priv, (__le32 __iomem *)((void __iomem *)priv->map + 0x94), 0x15c00002);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-}
-
-static void rtl8225_rf_stop(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u8 reg;
-
-       rtl8225_write(dev, 0x4, 0x1f); msleep(1);
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_OFF);
-       rtl818x_iowrite32(priv, &priv->map->ANAPARAM, RTL8225_ANAPARAM_OFF);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-}
-
-static void rtl8225_rf_set_channel(struct ieee80211_hw *dev,
-                                  struct ieee80211_conf *conf)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       int chan = ieee80211_frequency_to_channel(conf->channel->center_freq);
-
-       if (priv->rf->init == rtl8225_rf_init)
-               rtl8225_rf_set_tx_power(dev, chan);
-       else
-               rtl8225z2_rf_set_tx_power(dev, chan);
-
-       rtl8225_write(dev, 0x7, rtl8225_chan[chan - 1]);
-       msleep(10);
-}
-
-static void rtl8225_rf_conf_erp(struct ieee80211_hw *dev,
-                               struct ieee80211_bss_conf *info)
-{
-       struct rtl8180_priv *priv = dev->priv;
-
-       if (info->use_short_slot) {
-               rtl818x_iowrite8(priv, &priv->map->SLOT, 0x9);
-               rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22);
-               rtl818x_iowrite8(priv, &priv->map->DIFS, 0x14);
-               rtl818x_iowrite8(priv, &priv->map->EIFS, 81);
-               rtl818x_iowrite8(priv, &priv->map->CW_VAL, 0x73);
-       } else {
-               rtl818x_iowrite8(priv, &priv->map->SLOT, 0x14);
-               rtl818x_iowrite8(priv, &priv->map->SIFS, 0x44);
-               rtl818x_iowrite8(priv, &priv->map->DIFS, 0x24);
-               rtl818x_iowrite8(priv, &priv->map->EIFS, 81);
-               rtl818x_iowrite8(priv, &priv->map->CW_VAL, 0xa5);
-       }
-}
-
-static const struct rtl818x_rf_ops rtl8225_ops = {
-       .name           = "rtl8225",
-       .init           = rtl8225_rf_init,
-       .stop           = rtl8225_rf_stop,
-       .set_chan       = rtl8225_rf_set_channel,
-       .conf_erp       = rtl8225_rf_conf_erp,
-};
-
-static const struct rtl818x_rf_ops rtl8225z2_ops = {
-       .name           = "rtl8225z2",
-       .init           = rtl8225z2_rf_init,
-       .stop           = rtl8225_rf_stop,
-       .set_chan       = rtl8225_rf_set_channel,
-       .conf_erp       = rtl8225_rf_conf_erp,
-};
-
-const struct rtl818x_rf_ops * rtl8180_detect_rf(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u16 reg8, reg9;
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x0488);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-       rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-       msleep(100);
-
-       rtl8225_write(dev, 0, 0x1B7);
-
-       reg8 = rtl8225_read(dev, 8);
-       reg9 = rtl8225_read(dev, 9);
-
-       rtl8225_write(dev, 0, 0x0B7);
-
-       if (reg8 != 0x588 || reg9 != 0x700)
-               return &rtl8225_ops;
-
-       return &rtl8225z2_ops;
-}
diff --git a/drivers/net/wireless/rtl818x/rtl8180_rtl8225.h b/drivers/net/wireless/rtl818x/rtl8180_rtl8225.h
deleted file mode 100644 (file)
index 310013a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef RTL8180_RTL8225_H
-#define RTL8180_RTL8225_H
-
-#define RTL8225_ANAPARAM_ON    0xa0000b59
-#define RTL8225_ANAPARAM2_ON   0x860dec11
-#define RTL8225_ANAPARAM_OFF   0xa00beb59
-#define RTL8225_ANAPARAM2_OFF  0x840dec11
-
-const struct rtl818x_rf_ops * rtl8180_detect_rf(struct ieee80211_hw *);
-
-static inline void rtl8225_write_phy_ofdm(struct ieee80211_hw *dev,
-                                         u8 addr, u8 data)
-{
-       rtl8180_write_phy(dev, addr, data);
-}
-
-static inline void rtl8225_write_phy_cck(struct ieee80211_hw *dev,
-                                        u8 addr, u8 data)
-{
-       rtl8180_write_phy(dev, addr, data | 0x10000);
-}
-
-#endif /* RTL8180_RTL8225_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8180_sa2400.c b/drivers/net/wireless/rtl818x/rtl8180_sa2400.c
deleted file mode 100644 (file)
index d064fcc..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-
-/*
- * Radio tuning for Philips SA2400 on RTL8180
- *
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Code from the BSD driver and the rtl8181 project have been
- * very useful to understand certain things
- *
- * I want to thanks the Authors of such projects and the Ndiswrapper
- * project Authors.
- *
- * A special Big Thanks also is for all people who donated me cards,
- * making possible the creation of the original rtl8180 driver
- * from which this code is derived!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <net/mac80211.h>
-
-#include "rtl8180.h"
-#include "rtl8180_sa2400.h"
-
-static const u32 sa2400_chan[] = {
-       0x00096c, /* ch1 */
-       0x080970,
-       0x100974,
-       0x180978,
-       0x000980,
-       0x080984,
-       0x100988,
-       0x18098c,
-       0x000994,
-       0x080998,
-       0x10099c,
-       0x1809a0,
-       0x0009a8,
-       0x0009b4, /* ch 14 */
-};
-
-static void write_sa2400(struct ieee80211_hw *dev, u8 addr, u32 data)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u32 phy_config;
-
-       /* MAC will bang bits to the sa2400. sw 3-wire is NOT used */
-       phy_config = 0xb0000000;
-
-       phy_config |= ((u32)(addr & 0xf)) << 24;
-       phy_config |= data & 0xffffff;
-
-       rtl818x_iowrite32(priv,
-               (__le32 __iomem *) &priv->map->RFPinsOutput, phy_config);
-
-       msleep(3);
-}
-
-static void sa2400_write_phy_antenna(struct ieee80211_hw *dev, short chan)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u8 ant = SA2400_ANTENNA;
-
-       if (priv->rfparam & RF_PARAM_ANTBDEFAULT)
-               ant |= BB_ANTENNA_B;
-
-       if (chan == 14)
-               ant |= BB_ANTATTEN_CHAN14;
-
-       rtl8180_write_phy(dev, 0x10, ant);
-
-}
-
-static u8 sa2400_rf_rssi_map[] = {
-       0x64, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, 0x5e,
-       0x5d, 0x5c, 0x5b, 0x5a, 0x57, 0x54, 0x52, 0x50,
-       0x4e, 0x4c, 0x4a, 0x48, 0x46, 0x44, 0x41, 0x3f,
-       0x3c, 0x3a, 0x37, 0x36, 0x36, 0x1c, 0x1c, 0x1b,
-       0x1b, 0x1a, 0x1a, 0x19, 0x19, 0x18, 0x18, 0x17,
-       0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13,
-       0x13, 0x12, 0x12, 0x11, 0x11, 0x10, 0x10, 0x0f,
-       0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b,
-       0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07,
-       0x07, 0x06, 0x06, 0x05, 0x04, 0x03, 0x02,
-};
-
-static u8 sa2400_rf_calc_rssi(u8 agc, u8 sq)
-{
-       if (sq == 0x80)
-               return 1;
-
-       if (sq > 78)
-               return 32;
-
-       /* TODO: recalc sa2400_rf_rssi_map to avoid mult / div */
-       return 65 * sa2400_rf_rssi_map[sq] / 100;
-}
-
-static void sa2400_rf_set_channel(struct ieee80211_hw *dev,
-                                 struct ieee80211_conf *conf)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       int channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
-       u32 txpw = priv->channels[channel - 1].hw_value & 0xFF;
-       u32 chan = sa2400_chan[channel - 1];
-
-       write_sa2400(dev, 7, txpw);
-
-       sa2400_write_phy_antenna(dev, channel);
-
-       write_sa2400(dev, 0, chan);
-       write_sa2400(dev, 1, 0xbb50);
-       write_sa2400(dev, 2, 0x80);
-       write_sa2400(dev, 3, 0);
-}
-
-static void sa2400_rf_stop(struct ieee80211_hw *dev)
-{
-       write_sa2400(dev, 4, 0);
-}
-
-static void sa2400_rf_init(struct ieee80211_hw *dev)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       u32 anaparam, txconf;
-       u8 firdac;
-       int analogphy = priv->rfparam & RF_PARAM_ANALOGPHY;
-
-       anaparam = priv->anaparam;
-       anaparam &= ~(1 << ANAPARAM_TXDACOFF_SHIFT);
-       anaparam &= ~ANAPARAM_PWR1_MASK;
-       anaparam &= ~ANAPARAM_PWR0_MASK;
-
-       if (analogphy) {
-               anaparam |= SA2400_ANA_ANAPARAM_PWR1_ON << ANAPARAM_PWR1_SHIFT;
-               firdac = 0;
-       } else {
-               anaparam |= (SA2400_DIG_ANAPARAM_PWR1_ON << ANAPARAM_PWR1_SHIFT);
-               anaparam |= (SA2400_ANAPARAM_PWR0_ON << ANAPARAM_PWR0_SHIFT);
-               firdac = 1 << SA2400_REG4_FIRDAC_SHIFT;
-       }
-
-       rtl8180_set_anaparam(priv, anaparam);
-
-       write_sa2400(dev, 0, sa2400_chan[0]);
-       write_sa2400(dev, 1, 0xbb50);
-       write_sa2400(dev, 2, 0x80);
-       write_sa2400(dev, 3, 0);
-       write_sa2400(dev, 4, 0x19340 | firdac);
-       write_sa2400(dev, 5, 0x1dfb | (SA2400_MAX_SENS - 54) << 15);
-       write_sa2400(dev, 4, 0x19348 | firdac); /* calibrate VCO */
-
-       if (!analogphy)
-               write_sa2400(dev, 4, 0x1938c); /*???*/
-
-       write_sa2400(dev, 4, 0x19340 | firdac);
-
-       write_sa2400(dev, 0, sa2400_chan[0]);
-       write_sa2400(dev, 1, 0xbb50);
-       write_sa2400(dev, 2, 0x80);
-       write_sa2400(dev, 3, 0);
-       write_sa2400(dev, 4, 0x19344 | firdac); /* calibrate filter */
-
-       /* new from rtl8180 embedded driver (rtl8181 project) */
-       write_sa2400(dev, 6, 0x13ff | (1 << 23)); /* MANRX */
-       write_sa2400(dev, 8, 0); /* VCO */
-
-       if (analogphy) {
-               rtl8180_set_anaparam(priv, anaparam |
-                                    (1 << ANAPARAM_TXDACOFF_SHIFT));
-
-               txconf = rtl818x_ioread32(priv, &priv->map->TX_CONF);
-               rtl818x_iowrite32(priv, &priv->map->TX_CONF,
-                       txconf | RTL818X_TX_CONF_LOOPBACK_CONT);
-
-               write_sa2400(dev, 4, 0x19341); /* calibrates DC */
-
-               /* a 5us sleep is required here,
-                * we rely on the 3ms delay introduced in write_sa2400 */
-               write_sa2400(dev, 4, 0x19345);
-
-               /* a 20us sleep is required here,
-                * we rely on the 3ms delay introduced in write_sa2400 */
-
-               rtl818x_iowrite32(priv, &priv->map->TX_CONF, txconf);
-
-               rtl8180_set_anaparam(priv, anaparam);
-       }
-       /* end new code */
-
-       write_sa2400(dev, 4, 0x19341 | firdac); /* RTX MODE */
-
-       /* baseband configuration */
-       rtl8180_write_phy(dev, 0, 0x98);
-       rtl8180_write_phy(dev, 3, 0x38);
-       rtl8180_write_phy(dev, 4, 0xe0);
-       rtl8180_write_phy(dev, 5, 0x90);
-       rtl8180_write_phy(dev, 6, 0x1a);
-       rtl8180_write_phy(dev, 7, 0x64);
-
-       sa2400_write_phy_antenna(dev, 1);
-
-       rtl8180_write_phy(dev, 0x11, 0x80);
-
-       if (rtl818x_ioread8(priv, &priv->map->CONFIG2) &
-           RTL818X_CONFIG2_ANTENNA_DIV)
-               rtl8180_write_phy(dev, 0x12, 0xc7); /* enable ant diversity */
-       else
-               rtl8180_write_phy(dev, 0x12, 0x47); /* disable ant diversity */
-
-       rtl8180_write_phy(dev, 0x13, 0x90 | priv->csthreshold);
-
-       rtl8180_write_phy(dev, 0x19, 0x0);
-       rtl8180_write_phy(dev, 0x1a, 0xa0);
-}
-
-const struct rtl818x_rf_ops sa2400_rf_ops = {
-       .name           = "Philips",
-       .init           = sa2400_rf_init,
-       .stop           = sa2400_rf_stop,
-       .set_chan       = sa2400_rf_set_channel,
-       .calc_rssi      = sa2400_rf_calc_rssi,
-};
diff --git a/drivers/net/wireless/rtl818x/rtl8180_sa2400.h b/drivers/net/wireless/rtl818x/rtl8180_sa2400.h
deleted file mode 100644 (file)
index a4aaa0d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef RTL8180_SA2400_H
-#define RTL8180_SA2400_H
-
-/*
- * Radio tuning for Philips SA2400 on RTL8180
- *
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Code from the BSD driver and the rtl8181 project have been
- * very useful to understand certain things
- *
- * I want to thanks the Authors of such projects and the Ndiswrapper
- * project Authors.
- *
- * A special Big Thanks also is for all people who donated me cards,
- * making possible the creation of the original rtl8180 driver
- * from which this code is derived!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#define SA2400_ANTENNA 0x91
-#define SA2400_DIG_ANAPARAM_PWR1_ON 0x8
-#define SA2400_ANA_ANAPARAM_PWR1_ON 0x28
-#define SA2400_ANAPARAM_PWR0_ON 0x3
-
-/* RX sensitivity in dbm */
-#define SA2400_MAX_SENS 85
-
-#define SA2400_REG4_FIRDAC_SHIFT 7
-
-extern const struct rtl818x_rf_ops sa2400_rf_ops;
-
-#endif /* RTL8180_SA2400_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187.h
deleted file mode 100644 (file)
index 9887816..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Definitions for RTL8187 hardware
- *
- * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Based on the r8187 driver, which is:
- * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef RTL8187_H
-#define RTL8187_H
-
-#include "rtl818x.h"
-#include "rtl8187_leds.h"
-
-#define RTL8187_EEPROM_TXPWR_BASE      0x05
-#define RTL8187_EEPROM_MAC_ADDR                0x07
-#define RTL8187_EEPROM_TXPWR_CHAN_1    0x16    /* 3 channels */
-#define RTL8187_EEPROM_TXPWR_CHAN_6    0x1B    /* 2 channels */
-#define RTL8187_EEPROM_TXPWR_CHAN_4    0x3D    /* 2 channels */
-#define RTL8187_EEPROM_SELECT_GPIO     0x3B
-
-#define RTL8187_REQT_READ      0xC0
-#define RTL8187_REQT_WRITE     0x40
-#define RTL8187_REQ_GET_REG    0x05
-#define RTL8187_REQ_SET_REG    0x05
-
-#define RTL8187_MAX_RX         0x9C4
-
-#define RFKILL_MASK_8187_89_97 0x2
-#define RFKILL_MASK_8198       0x4
-
-struct rtl8187_rx_info {
-       struct urb *urb;
-       struct ieee80211_hw *dev;
-};
-
-struct rtl8187_rx_hdr {
-       __le32 flags;
-       u8 noise;
-       u8 signal;
-       u8 agc;
-       u8 reserved;
-       __le64 mac_time;
-} __packed;
-
-struct rtl8187b_rx_hdr {
-       __le32 flags;
-       __le64 mac_time;
-       u8 sq;
-       u8 rssi;
-       u8 agc;
-       u8 flags2;
-       __le16 snr_long2end;
-       s8 pwdb_g12;
-       u8 fot;
-} __packed;
-
-/* {rtl8187,rtl8187b}_tx_info is in skb */
-
-struct rtl8187_tx_hdr {
-       __le32 flags;
-       __le16 rts_duration;
-       __le16 len;
-       __le32 retry;
-} __packed;
-
-struct rtl8187b_tx_hdr {
-       __le32 flags;
-       __le16 rts_duration;
-       __le16 len;
-       __le32 unused_1;
-       __le16 unused_2;
-       __le16 tx_duration;
-       __le32 unused_3;
-       __le32 retry;
-       __le32 unused_4[2];
-} __packed;
-
-enum {
-       DEVICE_RTL8187,
-       DEVICE_RTL8187B
-};
-
-struct rtl8187_priv {
-       /* common between rtl818x drivers */
-       struct rtl818x_csr *map;
-       const struct rtl818x_rf_ops *rf;
-       struct ieee80211_vif *vif;
-
-       /* The mutex protects the TX loopback state.
-        * Any attempt to set channels concurrently locks the device.
-        */
-       struct mutex conf_mutex;
-
-       /* rtl8187 specific */
-       struct ieee80211_channel channels[14];
-       struct ieee80211_rate rates[12];
-       struct ieee80211_supported_band band;
-       struct usb_device *udev;
-       u32 rx_conf;
-       struct usb_anchor anchored;
-       struct delayed_work work;
-       struct ieee80211_hw *dev;
-#ifdef CONFIG_RTL8187_LEDS
-       struct rtl8187_led led_radio;
-       struct rtl8187_led led_tx;
-       struct rtl8187_led led_rx;
-       struct delayed_work led_on;
-       struct delayed_work led_off;
-#endif
-       u16 txpwr_base;
-       u8 asic_rev;
-       u8 is_rtl8187b;
-       enum {
-               RTL8187BvB,
-               RTL8187BvD,
-               RTL8187BvE
-       } hw_rev;
-       struct sk_buff_head rx_queue;
-       u8 signal;
-       u8 noise;
-       u8 slot_time;
-       u8 aifsn[4];
-       u8 rfkill_mask;
-       struct {
-               __le64 buf;
-               struct sk_buff_head queue;
-       } b_tx_status; /* This queue is used by both -b and non-b devices */
-       struct mutex io_mutex;
-       union {
-               u8 bits8;
-               __le16 bits16;
-               __le32 bits32;
-       } *io_dmabuf;
-       bool rfkill_off;
-};
-
-void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
-
-static inline u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv,
-                                    u8 *addr, u8 idx)
-{
-       u8 val;
-
-       mutex_lock(&priv->io_mutex);
-       usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
-                       RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
-                       (unsigned long)addr, idx & 0x03,
-                       &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
-
-       val = priv->io_dmabuf->bits8;
-       mutex_unlock(&priv->io_mutex);
-
-       return val;
-}
-
-static inline u8 rtl818x_ioread8(struct rtl8187_priv *priv, u8 *addr)
-{
-       return rtl818x_ioread8_idx(priv, addr, 0);
-}
-
-static inline u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv,
-                                      __le16 *addr, u8 idx)
-{
-       __le16 val;
-
-       mutex_lock(&priv->io_mutex);
-       usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
-                       RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
-                       (unsigned long)addr, idx & 0x03,
-                       &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
-
-       val = priv->io_dmabuf->bits16;
-       mutex_unlock(&priv->io_mutex);
-
-       return le16_to_cpu(val);
-}
-
-static inline u16 rtl818x_ioread16(struct rtl8187_priv *priv, __le16 *addr)
-{
-       return rtl818x_ioread16_idx(priv, addr, 0);
-}
-
-static inline u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv,
-                                      __le32 *addr, u8 idx)
-{
-       __le32 val;
-
-       mutex_lock(&priv->io_mutex);
-       usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
-                       RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
-                       (unsigned long)addr, idx & 0x03,
-                       &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
-
-       val = priv->io_dmabuf->bits32;
-       mutex_unlock(&priv->io_mutex);
-
-       return le32_to_cpu(val);
-}
-
-static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr)
-{
-       return rtl818x_ioread32_idx(priv, addr, 0);
-}
-
-static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv,
-                                       u8 *addr, u8 val, u8 idx)
-{
-       mutex_lock(&priv->io_mutex);
-
-       priv->io_dmabuf->bits8 = val;
-       usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
-                       RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
-                       (unsigned long)addr, idx & 0x03,
-                       &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
-
-       mutex_unlock(&priv->io_mutex);
-}
-
-static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val)
-{
-       rtl818x_iowrite8_idx(priv, addr, val, 0);
-}
-
-static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv,
-                                        __le16 *addr, u16 val, u8 idx)
-{
-       mutex_lock(&priv->io_mutex);
-
-       priv->io_dmabuf->bits16 = cpu_to_le16(val);
-       usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
-                       RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
-                       (unsigned long)addr, idx & 0x03,
-                       &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
-
-       mutex_unlock(&priv->io_mutex);
-}
-
-static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr,
-                                    u16 val)
-{
-       rtl818x_iowrite16_idx(priv, addr, val, 0);
-}
-
-static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv,
-                                        __le32 *addr, u32 val, u8 idx)
-{
-       mutex_lock(&priv->io_mutex);
-
-       priv->io_dmabuf->bits32 = cpu_to_le32(val);
-       usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
-                       RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
-                       (unsigned long)addr, idx & 0x03,
-                       &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
-
-       mutex_unlock(&priv->io_mutex);
-}
-
-static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr,
-                                    u32 val)
-{
-       rtl818x_iowrite32_idx(priv, addr, val, 0);
-}
-
-#endif /* RTL8187_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8187/Makefile b/drivers/net/wireless/rtl818x/rtl8187/Makefile
new file mode 100644 (file)
index 0000000..7b62992
--- /dev/null
@@ -0,0 +1,5 @@
+rtl8187-objs           := dev.o rtl8225.o leds.o rfkill.o
+
+obj-$(CONFIG_RTL8187)  += rtl8187.o
+
+ccflags-y += -Idrivers/net/wireless/rtl818x
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
new file mode 100644 (file)
index 0000000..6b82cac
--- /dev/null
@@ -0,0 +1,1591 @@
+/*
+ * Linux device driver for RTL8187
+ *
+ * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Based on the r8187 driver, which is:
+ * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
+ *
+ * The driver was extended to the RTL8187B in 2008 by:
+ *     Herton Ronaldo Krzesinski <herton@mandriva.com.br>
+ *     Hin-Tak Leung <htl10@users.sourceforge.net>
+ *     Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ * Magic delays and register offsets below are taken from the original
+ * r8187 driver sources.  Thanks to Realtek for their support!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/usb.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/etherdevice.h>
+#include <linux/eeprom_93cx6.h>
+#include <net/mac80211.h>
+
+#include "rtl8187.h"
+#include "rtl8225.h"
+#ifdef CONFIG_RTL8187_LEDS
+#include "leds.h"
+#endif
+#include "rfkill.h"
+
+MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
+MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
+MODULE_AUTHOR("Herton Ronaldo Krzesinski <herton@mandriva.com.br>");
+MODULE_AUTHOR("Hin-Tak Leung <htl10@users.sourceforge.net>");
+MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>");
+MODULE_DESCRIPTION("RTL8187/RTL8187B USB wireless driver");
+MODULE_LICENSE("GPL");
+
+static struct usb_device_id rtl8187_table[] __devinitdata = {
+       /* Asus */
+       {USB_DEVICE(0x0b05, 0x171d), .driver_info = DEVICE_RTL8187},
+       /* Belkin */
+       {USB_DEVICE(0x050d, 0x705e), .driver_info = DEVICE_RTL8187B},
+       /* Realtek */
+       {USB_DEVICE(0x0bda, 0x8187), .driver_info = DEVICE_RTL8187},
+       {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B},
+       {USB_DEVICE(0x0bda, 0x8197), .driver_info = DEVICE_RTL8187B},
+       {USB_DEVICE(0x0bda, 0x8198), .driver_info = DEVICE_RTL8187B},
+       /* Surecom */
+       {USB_DEVICE(0x0769, 0x11F2), .driver_info = DEVICE_RTL8187},
+       /* Logitech */
+       {USB_DEVICE(0x0789, 0x010C), .driver_info = DEVICE_RTL8187},
+       /* Netgear */
+       {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187},
+       {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187},
+       {USB_DEVICE(0x0846, 0x4260), .driver_info = DEVICE_RTL8187B},
+       /* HP */
+       {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187},
+       /* Sitecom */
+       {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
+       {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
+       {USB_DEVICE(0x0df6, 0x0029), .driver_info = DEVICE_RTL8187B},
+       /* Sphairon Access Systems GmbH */
+       {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187},
+       /* Dick Smith Electronics */
+       {USB_DEVICE(0x1371, 0x9401), .driver_info = DEVICE_RTL8187},
+       /* Abocom */
+       {USB_DEVICE(0x13d1, 0xabe6), .driver_info = DEVICE_RTL8187},
+       /* Qcom */
+       {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187},
+       /* AirLive */
+       {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187},
+       /* Linksys */
+       {USB_DEVICE(0x1737, 0x0073), .driver_info = DEVICE_RTL8187B},
+       {}
+};
+
+MODULE_DEVICE_TABLE(usb, rtl8187_table);
+
+static const struct ieee80211_rate rtl818x_rates[] = {
+       { .bitrate = 10, .hw_value = 0, },
+       { .bitrate = 20, .hw_value = 1, },
+       { .bitrate = 55, .hw_value = 2, },
+       { .bitrate = 110, .hw_value = 3, },
+       { .bitrate = 60, .hw_value = 4, },
+       { .bitrate = 90, .hw_value = 5, },
+       { .bitrate = 120, .hw_value = 6, },
+       { .bitrate = 180, .hw_value = 7, },
+       { .bitrate = 240, .hw_value = 8, },
+       { .bitrate = 360, .hw_value = 9, },
+       { .bitrate = 480, .hw_value = 10, },
+       { .bitrate = 540, .hw_value = 11, },
+};
+
+static const struct ieee80211_channel rtl818x_channels[] = {
+       { .center_freq = 2412 },
+       { .center_freq = 2417 },
+       { .center_freq = 2422 },
+       { .center_freq = 2427 },
+       { .center_freq = 2432 },
+       { .center_freq = 2437 },
+       { .center_freq = 2442 },
+       { .center_freq = 2447 },
+       { .center_freq = 2452 },
+       { .center_freq = 2457 },
+       { .center_freq = 2462 },
+       { .center_freq = 2467 },
+       { .center_freq = 2472 },
+       { .center_freq = 2484 },
+};
+
+static void rtl8187_iowrite_async_cb(struct urb *urb)
+{
+       kfree(urb->context);
+}
+
+static void rtl8187_iowrite_async(struct rtl8187_priv *priv, __le16 addr,
+                                 void *data, u16 len)
+{
+       struct usb_ctrlrequest *dr;
+       struct urb *urb;
+       struct rtl8187_async_write_data {
+               u8 data[4];
+               struct usb_ctrlrequest dr;
+       } *buf;
+       int rc;
+
+       buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
+       if (!buf)
+               return;
+
+       urb = usb_alloc_urb(0, GFP_ATOMIC);
+       if (!urb) {
+               kfree(buf);
+               return;
+       }
+
+       dr = &buf->dr;
+
+       dr->bRequestType = RTL8187_REQT_WRITE;
+       dr->bRequest = RTL8187_REQ_SET_REG;
+       dr->wValue = addr;
+       dr->wIndex = 0;
+       dr->wLength = cpu_to_le16(len);
+
+       memcpy(buf, data, len);
+
+       usb_fill_control_urb(urb, priv->udev, usb_sndctrlpipe(priv->udev, 0),
+                            (unsigned char *)dr, buf, len,
+                            rtl8187_iowrite_async_cb, buf);
+       usb_anchor_urb(urb, &priv->anchored);
+       rc = usb_submit_urb(urb, GFP_ATOMIC);
+       if (rc < 0) {
+               kfree(buf);
+               usb_unanchor_urb(urb);
+       }
+       usb_free_urb(urb);
+}
+
+static inline void rtl818x_iowrite32_async(struct rtl8187_priv *priv,
+                                          __le32 *addr, u32 val)
+{
+       __le32 buf = cpu_to_le32(val);
+
+       rtl8187_iowrite_async(priv, cpu_to_le16((unsigned long)addr),
+                             &buf, sizeof(buf));
+}
+
+void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data)
+{
+       struct rtl8187_priv *priv = dev->priv;
+
+       data <<= 8;
+       data |= addr | 0x80;
+
+       rtl818x_iowrite8(priv, &priv->map->PHY[3], (data >> 24) & 0xFF);
+       rtl818x_iowrite8(priv, &priv->map->PHY[2], (data >> 16) & 0xFF);
+       rtl818x_iowrite8(priv, &priv->map->PHY[1], (data >> 8) & 0xFF);
+       rtl818x_iowrite8(priv, &priv->map->PHY[0], data & 0xFF);
+}
+
+static void rtl8187_tx_cb(struct urb *urb)
+{
+       struct sk_buff *skb = (struct sk_buff *)urb->context;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_hw *hw = info->rate_driver_data[0];
+       struct rtl8187_priv *priv = hw->priv;
+
+       skb_pull(skb, priv->is_rtl8187b ? sizeof(struct rtl8187b_tx_hdr) :
+                                         sizeof(struct rtl8187_tx_hdr));
+       ieee80211_tx_info_clear_status(info);
+
+       if (!(urb->status) && !(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
+               if (priv->is_rtl8187b) {
+                       skb_queue_tail(&priv->b_tx_status.queue, skb);
+
+                       /* queue is "full", discard last items */
+                       while (skb_queue_len(&priv->b_tx_status.queue) > 5) {
+                               struct sk_buff *old_skb;
+
+                               dev_dbg(&priv->udev->dev,
+                                       "transmit status queue full\n");
+
+                               old_skb = skb_dequeue(&priv->b_tx_status.queue);
+                               ieee80211_tx_status_irqsafe(hw, old_skb);
+                       }
+                       return;
+               } else {
+                       info->flags |= IEEE80211_TX_STAT_ACK;
+               }
+       }
+       if (priv->is_rtl8187b)
+               ieee80211_tx_status_irqsafe(hw, skb);
+       else {
+               /* Retry information for the RTI8187 is only available by
+                * reading a register in the device. We are in interrupt mode
+                * here, thus queue the skb and finish on a work queue. */
+               skb_queue_tail(&priv->b_tx_status.queue, skb);
+               ieee80211_queue_delayed_work(hw, &priv->work, 0);
+       }
+}
+
+static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       unsigned int ep;
+       void *buf;
+       struct urb *urb;
+       __le16 rts_dur = 0;
+       u32 flags;
+       int rc;
+
+       urb = usb_alloc_urb(0, GFP_ATOMIC);
+       if (!urb) {
+               kfree_skb(skb);
+               return NETDEV_TX_OK;
+       }
+
+       flags = skb->len;
+       flags |= RTL818X_TX_DESC_FLAG_NO_ENC;
+
+       flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24;
+       if (ieee80211_has_morefrags(((struct ieee80211_hdr *)skb->data)->frame_control))
+               flags |= RTL818X_TX_DESC_FLAG_MOREFRAG;
+       if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
+               flags |= RTL818X_TX_DESC_FLAG_RTS;
+               flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
+               rts_dur = ieee80211_rts_duration(dev, priv->vif,
+                                                skb->len, info);
+       } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
+               flags |= RTL818X_TX_DESC_FLAG_CTS;
+               flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
+       }
+
+       if (!priv->is_rtl8187b) {
+               struct rtl8187_tx_hdr *hdr =
+                       (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr));
+               hdr->flags = cpu_to_le32(flags);
+               hdr->len = 0;
+               hdr->rts_duration = rts_dur;
+               hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+               buf = hdr;
+
+               ep = 2;
+       } else {
+               /* fc needs to be calculated before skb_push() */
+               unsigned int epmap[4] = { 6, 7, 5, 4 };
+               struct ieee80211_hdr *tx_hdr =
+                       (struct ieee80211_hdr *)(skb->data);
+               u16 fc = le16_to_cpu(tx_hdr->frame_control);
+
+               struct rtl8187b_tx_hdr *hdr =
+                       (struct rtl8187b_tx_hdr *)skb_push(skb, sizeof(*hdr));
+               struct ieee80211_rate *txrate =
+                       ieee80211_get_tx_rate(dev, info);
+               memset(hdr, 0, sizeof(*hdr));
+               hdr->flags = cpu_to_le32(flags);
+               hdr->rts_duration = rts_dur;
+               hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
+               hdr->tx_duration =
+                       ieee80211_generic_frame_duration(dev, priv->vif,
+                                                        skb->len, txrate);
+               buf = hdr;
+
+               if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)
+                       ep = 12;
+               else
+                       ep = epmap[skb_get_queue_mapping(skb)];
+       }
+
+       info->rate_driver_data[0] = dev;
+       info->rate_driver_data[1] = urb;
+
+       usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, ep),
+                         buf, skb->len, rtl8187_tx_cb, skb);
+       urb->transfer_flags |= URB_ZERO_PACKET;
+       usb_anchor_urb(urb, &priv->anchored);
+       rc = usb_submit_urb(urb, GFP_ATOMIC);
+       if (rc < 0) {
+               usb_unanchor_urb(urb);
+               kfree_skb(skb);
+       }
+       usb_free_urb(urb);
+
+       return NETDEV_TX_OK;
+}
+
+static void rtl8187_rx_cb(struct urb *urb)
+{
+       struct sk_buff *skb = (struct sk_buff *)urb->context;
+       struct rtl8187_rx_info *info = (struct rtl8187_rx_info *)skb->cb;
+       struct ieee80211_hw *dev = info->dev;
+       struct rtl8187_priv *priv = dev->priv;
+       struct ieee80211_rx_status rx_status = { 0 };
+       int rate, signal;
+       u32 flags;
+       unsigned long f;
+
+       spin_lock_irqsave(&priv->rx_queue.lock, f);
+       __skb_unlink(skb, &priv->rx_queue);
+       spin_unlock_irqrestore(&priv->rx_queue.lock, f);
+       skb_put(skb, urb->actual_length);
+
+       if (unlikely(urb->status)) {
+               dev_kfree_skb_irq(skb);
+               return;
+       }
+
+       if (!priv->is_rtl8187b) {
+               struct rtl8187_rx_hdr *hdr =
+                       (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
+               flags = le32_to_cpu(hdr->flags);
+               /* As with the RTL8187B below, the AGC is used to calculate
+                * signal strength. In this case, the scaling
+                * constants are derived from the output of p54usb.
+                */
+               signal = -4 - ((27 * hdr->agc) >> 6);
+               rx_status.antenna = (hdr->signal >> 7) & 1;
+               rx_status.mactime = le64_to_cpu(hdr->mac_time);
+       } else {
+               struct rtl8187b_rx_hdr *hdr =
+                       (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
+               /* The Realtek datasheet for the RTL8187B shows that the RX
+                * header contains the following quantities: signal quality,
+                * RSSI, AGC, the received power in dB, and the measured SNR.
+                * In testing, none of these quantities show qualitative
+                * agreement with AP signal strength, except for the AGC,
+                * which is inversely proportional to the strength of the
+                * signal. In the following, the signal strength
+                * is derived from the AGC. The arbitrary scaling constants
+                * are chosen to make the results close to the values obtained
+                * for a BCM4312 using b43 as the driver. The noise is ignored
+                * for now.
+                */
+               flags = le32_to_cpu(hdr->flags);
+               signal = 14 - hdr->agc / 2;
+               rx_status.antenna = (hdr->rssi >> 7) & 1;
+               rx_status.mactime = le64_to_cpu(hdr->mac_time);
+       }
+
+       rx_status.signal = signal;
+       priv->signal = signal;
+       rate = (flags >> 20) & 0xF;
+       skb_trim(skb, flags & 0x0FFF);
+       rx_status.rate_idx = rate;
+       rx_status.freq = dev->conf.channel->center_freq;
+       rx_status.band = dev->conf.channel->band;
+       rx_status.flag |= RX_FLAG_TSFT;
+       if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR)
+               rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
+       memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
+       ieee80211_rx_irqsafe(dev, skb);
+
+       skb = dev_alloc_skb(RTL8187_MAX_RX);
+       if (unlikely(!skb)) {
+               /* TODO check rx queue length and refill *somewhere* */
+               return;
+       }
+
+       info = (struct rtl8187_rx_info *)skb->cb;
+       info->urb = urb;
+       info->dev = dev;
+       urb->transfer_buffer = skb_tail_pointer(skb);
+       urb->context = skb;
+       skb_queue_tail(&priv->rx_queue, skb);
+
+       usb_anchor_urb(urb, &priv->anchored);
+       if (usb_submit_urb(urb, GFP_ATOMIC)) {
+               usb_unanchor_urb(urb);
+               skb_unlink(skb, &priv->rx_queue);
+               dev_kfree_skb_irq(skb);
+       }
+}
+
+static int rtl8187_init_urbs(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       struct urb *entry = NULL;
+       struct sk_buff *skb;
+       struct rtl8187_rx_info *info;
+       int ret = 0;
+
+       while (skb_queue_len(&priv->rx_queue) < 16) {
+               skb = __dev_alloc_skb(RTL8187_MAX_RX, GFP_KERNEL);
+               if (!skb) {
+                       ret = -ENOMEM;
+                       goto err;
+               }
+               entry = usb_alloc_urb(0, GFP_KERNEL);
+               if (!entry) {
+                       ret = -ENOMEM;
+                       goto err;
+               }
+               usb_fill_bulk_urb(entry, priv->udev,
+                                 usb_rcvbulkpipe(priv->udev,
+                                 priv->is_rtl8187b ? 3 : 1),
+                                 skb_tail_pointer(skb),
+                                 RTL8187_MAX_RX, rtl8187_rx_cb, skb);
+               info = (struct rtl8187_rx_info *)skb->cb;
+               info->urb = entry;
+               info->dev = dev;
+               skb_queue_tail(&priv->rx_queue, skb);
+               usb_anchor_urb(entry, &priv->anchored);
+               ret = usb_submit_urb(entry, GFP_KERNEL);
+               if (ret) {
+                       skb_unlink(skb, &priv->rx_queue);
+                       usb_unanchor_urb(entry);
+                       goto err;
+               }
+               usb_free_urb(entry);
+       }
+       return ret;
+
+err:
+       usb_free_urb(entry);
+       kfree_skb(skb);
+       usb_kill_anchored_urbs(&priv->anchored);
+       return ret;
+}
+
+static void rtl8187b_status_cb(struct urb *urb)
+{
+       struct ieee80211_hw *hw = (struct ieee80211_hw *)urb->context;
+       struct rtl8187_priv *priv = hw->priv;
+       u64 val;
+       unsigned int cmd_type;
+
+       if (unlikely(urb->status))
+               return;
+
+       /*
+        * Read from status buffer:
+        *
+        * bits [30:31] = cmd type:
+        * - 0 indicates tx beacon interrupt
+        * - 1 indicates tx close descriptor
+        *
+        * In the case of tx beacon interrupt:
+        * [0:9] = Last Beacon CW
+        * [10:29] = reserved
+        * [30:31] = 00b
+        * [32:63] = Last Beacon TSF
+        *
+        * If it's tx close descriptor:
+        * [0:7] = Packet Retry Count
+        * [8:14] = RTS Retry Count
+        * [15] = TOK
+        * [16:27] = Sequence No
+        * [28] = LS
+        * [29] = FS
+        * [30:31] = 01b
+        * [32:47] = unused (reserved?)
+        * [48:63] = MAC Used Time
+        */
+       val = le64_to_cpu(priv->b_tx_status.buf);
+
+       cmd_type = (val >> 30) & 0x3;
+       if (cmd_type == 1) {
+               unsigned int pkt_rc, seq_no;
+               bool tok;
+               struct sk_buff *skb;
+               struct ieee80211_hdr *ieee80211hdr;
+               unsigned long flags;
+
+               pkt_rc = val & 0xFF;
+               tok = val & (1 << 15);
+               seq_no = (val >> 16) & 0xFFF;
+
+               spin_lock_irqsave(&priv->b_tx_status.queue.lock, flags);
+               skb_queue_reverse_walk(&priv->b_tx_status.queue, skb) {
+                       ieee80211hdr = (struct ieee80211_hdr *)skb->data;
+
+                       /*
+                        * While testing, it was discovered that the seq_no
+                        * doesn't actually contains the sequence number.
+                        * Instead of returning just the 12 bits of sequence
+                        * number, hardware is returning entire sequence control
+                        * (fragment number plus sequence number) in a 12 bit
+                        * only field overflowing after some time. As a
+                        * workaround, just consider the lower bits, and expect
+                        * it's unlikely we wrongly ack some sent data
+                        */
+                       if ((le16_to_cpu(ieee80211hdr->seq_ctrl)
+                           & 0xFFF) == seq_no)
+                               break;
+               }
+               if (skb != (struct sk_buff *) &priv->b_tx_status.queue) {
+                       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+
+                       __skb_unlink(skb, &priv->b_tx_status.queue);
+                       if (tok)
+                               info->flags |= IEEE80211_TX_STAT_ACK;
+                       info->status.rates[0].count = pkt_rc + 1;
+
+                       ieee80211_tx_status_irqsafe(hw, skb);
+               }
+               spin_unlock_irqrestore(&priv->b_tx_status.queue.lock, flags);
+       }
+
+       usb_anchor_urb(urb, &priv->anchored);
+       if (usb_submit_urb(urb, GFP_ATOMIC))
+               usb_unanchor_urb(urb);
+}
+
+static int rtl8187b_init_status_urb(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       struct urb *entry;
+       int ret = 0;
+
+       entry = usb_alloc_urb(0, GFP_KERNEL);
+       if (!entry)
+               return -ENOMEM;
+
+       usb_fill_bulk_urb(entry, priv->udev, usb_rcvbulkpipe(priv->udev, 9),
+                         &priv->b_tx_status.buf, sizeof(priv->b_tx_status.buf),
+                         rtl8187b_status_cb, dev);
+
+       usb_anchor_urb(entry, &priv->anchored);
+       ret = usb_submit_urb(entry, GFP_KERNEL);
+       if (ret)
+               usb_unanchor_urb(entry);
+       usb_free_urb(entry);
+
+       return ret;
+}
+
+static void rtl8187_set_anaparam(struct rtl8187_priv *priv, bool rfon)
+{
+       u32 anaparam, anaparam2;
+       u8 anaparam3, reg;
+
+       if (!priv->is_rtl8187b) {
+               if (rfon) {
+                       anaparam = RTL8187_RTL8225_ANAPARAM_ON;
+                       anaparam2 = RTL8187_RTL8225_ANAPARAM2_ON;
+               } else {
+                       anaparam = RTL8187_RTL8225_ANAPARAM_OFF;
+                       anaparam2 = RTL8187_RTL8225_ANAPARAM2_OFF;
+               }
+       } else {
+               if (rfon) {
+                       anaparam = RTL8187B_RTL8225_ANAPARAM_ON;
+                       anaparam2 = RTL8187B_RTL8225_ANAPARAM2_ON;
+                       anaparam3 = RTL8187B_RTL8225_ANAPARAM3_ON;
+               } else {
+                       anaparam = RTL8187B_RTL8225_ANAPARAM_OFF;
+                       anaparam2 = RTL8187B_RTL8225_ANAPARAM2_OFF;
+                       anaparam3 = RTL8187B_RTL8225_ANAPARAM3_OFF;
+               }
+       }
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
+                        RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
+       reg |= RTL818X_CONFIG3_ANAPARAM_WRITE;
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
+       rtl818x_iowrite32(priv, &priv->map->ANAPARAM, anaparam);
+       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, anaparam2);
+       if (priv->is_rtl8187b)
+               rtl818x_iowrite8(priv, &priv->map->ANAPARAM3, anaparam3);
+       reg &= ~RTL818X_CONFIG3_ANAPARAM_WRITE;
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
+                        RTL818X_EEPROM_CMD_NORMAL);
+}
+
+static int rtl8187_cmd_reset(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u8 reg;
+       int i;
+
+       reg = rtl818x_ioread8(priv, &priv->map->CMD);
+       reg &= (1 << 1);
+       reg |= RTL818X_CMD_RESET;
+       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
+
+       i = 10;
+       do {
+               msleep(2);
+               if (!(rtl818x_ioread8(priv, &priv->map->CMD) &
+                     RTL818X_CMD_RESET))
+                       break;
+       } while (--i);
+
+       if (!i) {
+               wiphy_err(dev->wiphy, "Reset timeout!\n");
+               return -ETIMEDOUT;
+       }
+
+       /* reload registers from eeprom */
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_LOAD);
+
+       i = 10;
+       do {
+               msleep(4);
+               if (!(rtl818x_ioread8(priv, &priv->map->EEPROM_CMD) &
+                     RTL818X_EEPROM_CMD_CONFIG))
+                       break;
+       } while (--i);
+
+       if (!i) {
+               wiphy_err(dev->wiphy, "eeprom reset timeout!\n");
+               return -ETIMEDOUT;
+       }
+
+       return 0;
+}
+
+static int rtl8187_init_hw(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u8 reg;
+       int res;
+
+       /* reset */
+       rtl8187_set_anaparam(priv, true);
+
+       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
+
+       msleep(200);
+       rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x10);
+       rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x11);
+       rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x00);
+       msleep(200);
+
+       res = rtl8187_cmd_reset(dev);
+       if (res)
+               return res;
+
+       rtl8187_set_anaparam(priv, true);
+
+       /* setup card */
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0);
+       rtl818x_iowrite8(priv, &priv->map->GPIO0, 0);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8));
+       rtl818x_iowrite8(priv, &priv->map->GPIO0, 1);
+       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0);
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+
+       rtl818x_iowrite16(priv, (__le16 *)0xFFF4, 0xFFFF);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG1);
+       reg &= 0x3F;
+       reg |= 0x80;
+       rtl818x_iowrite8(priv, &priv->map->CONFIG1, reg);
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       rtl818x_iowrite32(priv, &priv->map->INT_TIMEOUT, 0);
+       rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0);
+       rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0);
+
+       // TODO: set RESP_RATE and BRSR properly
+       rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (8 << 4) | 0);
+       rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3);
+
+       /* host_usb_init */
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0);
+       rtl818x_iowrite8(priv, &priv->map->GPIO0, 0);
+       reg = rtl818x_ioread8(priv, (u8 *)0xFE53);
+       rtl818x_iowrite8(priv, (u8 *)0xFE53, reg | (1 << 7));
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8));
+       rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x20);
+       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x80);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x80);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x80);
+       msleep(100);
+
+       rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x000a8008);
+       rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF);
+       rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
+                        RTL818X_EEPROM_CMD_CONFIG);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
+                        RTL818X_EEPROM_CMD_NORMAL);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FF7);
+       msleep(100);
+
+       priv->rf->init(dev);
+
+       rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3);
+       reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~1;
+       rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg | 1);
+       rtl818x_iowrite16(priv, (__le16 *)0xFFFE, 0x10);
+       rtl818x_iowrite8(priv, &priv->map->TALLY_SEL, 0x80);
+       rtl818x_iowrite8(priv, (u8 *)0xFFFF, 0x60);
+       rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
+
+       return 0;
+}
+
+static const u8 rtl8187b_reg_table[][3] = {
+       {0xF0, 0x32, 0}, {0xF1, 0x32, 0}, {0xF2, 0x00, 0}, {0xF3, 0x00, 0},
+       {0xF4, 0x32, 0}, {0xF5, 0x43, 0}, {0xF6, 0x00, 0}, {0xF7, 0x00, 0},
+       {0xF8, 0x46, 0}, {0xF9, 0xA4, 0}, {0xFA, 0x00, 0}, {0xFB, 0x00, 0},
+       {0xFC, 0x96, 0}, {0xFD, 0xA4, 0}, {0xFE, 0x00, 0}, {0xFF, 0x00, 0},
+
+       {0x58, 0x4B, 1}, {0x59, 0x00, 1}, {0x5A, 0x4B, 1}, {0x5B, 0x00, 1},
+       {0x60, 0x4B, 1}, {0x61, 0x09, 1}, {0x62, 0x4B, 1}, {0x63, 0x09, 1},
+       {0xCE, 0x0F, 1}, {0xCF, 0x00, 1}, {0xF0, 0x4E, 1}, {0xF1, 0x01, 1},
+       {0xF2, 0x02, 1}, {0xF3, 0x03, 1}, {0xF4, 0x04, 1}, {0xF5, 0x05, 1},
+       {0xF6, 0x06, 1}, {0xF7, 0x07, 1}, {0xF8, 0x08, 1},
+
+       {0x4E, 0x00, 2}, {0x0C, 0x04, 2}, {0x21, 0x61, 2}, {0x22, 0x68, 2},
+       {0x23, 0x6F, 2}, {0x24, 0x76, 2}, {0x25, 0x7D, 2}, {0x26, 0x84, 2},
+       {0x27, 0x8D, 2}, {0x4D, 0x08, 2}, {0x50, 0x05, 2}, {0x51, 0xF5, 2},
+       {0x52, 0x04, 2}, {0x53, 0xA0, 2}, {0x54, 0x1F, 2}, {0x55, 0x23, 2},
+       {0x56, 0x45, 2}, {0x57, 0x67, 2}, {0x58, 0x08, 2}, {0x59, 0x08, 2},
+       {0x5A, 0x08, 2}, {0x5B, 0x08, 2}, {0x60, 0x08, 2}, {0x61, 0x08, 2},
+       {0x62, 0x08, 2}, {0x63, 0x08, 2}, {0x64, 0xCF, 2},
+
+       {0x5B, 0x40, 0}, {0x84, 0x88, 0}, {0x85, 0x24, 0}, {0x88, 0x54, 0},
+       {0x8B, 0xB8, 0}, {0x8C, 0x07, 0}, {0x8D, 0x00, 0}, {0x94, 0x1B, 0},
+       {0x95, 0x12, 0}, {0x96, 0x00, 0}, {0x97, 0x06, 0}, {0x9D, 0x1A, 0},
+       {0x9F, 0x10, 0}, {0xB4, 0x22, 0}, {0xBE, 0x80, 0}, {0xDB, 0x00, 0},
+       {0xEE, 0x00, 0}, {0x4C, 0x00, 2},
+
+       {0x9F, 0x00, 3}, {0x8C, 0x01, 0}, {0x8D, 0x10, 0}, {0x8E, 0x08, 0},
+       {0x8F, 0x00, 0}
+};
+
+static int rtl8187b_init_hw(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       int res, i;
+       u8 reg;
+
+       rtl8187_set_anaparam(priv, true);
+
+       /* Reset PLL sequence on 8187B. Realtek note: reduces power
+        * consumption about 30 mA */
+       rtl818x_iowrite8(priv, (u8 *)0xFF61, 0x10);
+       reg = rtl818x_ioread8(priv, (u8 *)0xFF62);
+       rtl818x_iowrite8(priv, (u8 *)0xFF62, reg & ~(1 << 5));
+       rtl818x_iowrite8(priv, (u8 *)0xFF62, reg | (1 << 5));
+
+       res = rtl8187_cmd_reset(dev);
+       if (res)
+               return res;
+
+       rtl8187_set_anaparam(priv, true);
+
+       /* BRSR (Basic Rate Set Register) on 8187B looks to be the same as
+        * RESP_RATE on 8187L in Realtek sources: each bit should be each
+        * one of the 12 rates, all are enabled */
+       rtl818x_iowrite16(priv, (__le16 *)0xFF34, 0x0FFF);
+
+       reg = rtl818x_ioread8(priv, &priv->map->CW_CONF);
+       reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT;
+       rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg);
+
+       /* Auto Rate Fallback Register (ARFR): 1M-54M setting */
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFFE0, 0x0FFF, 1);
+       rtl818x_iowrite8_idx(priv, (u8 *)0xFFE2, 0x00, 1);
+
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFFD4, 0xFFFF, 1);
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
+                        RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG1);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG1, (reg & 0x3F) | 0x80);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
+                        RTL818X_EEPROM_CMD_NORMAL);
+
+       rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0);
+       for (i = 0; i < ARRAY_SIZE(rtl8187b_reg_table); i++) {
+               rtl818x_iowrite8_idx(priv,
+                                    (u8 *)(uintptr_t)
+                                    (rtl8187b_reg_table[i][0] | 0xFF00),
+                                    rtl8187b_reg_table[i][1],
+                                    rtl8187b_reg_table[i][2]);
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->TID_AC_MAP, 0xFA50);
+       rtl818x_iowrite16(priv, &priv->map->INT_MIG, 0);
+
+       rtl818x_iowrite32_idx(priv, (__le32 *)0xFFF0, 0, 1);
+       rtl818x_iowrite32_idx(priv, (__le32 *)0xFFF4, 0, 1);
+       rtl818x_iowrite8_idx(priv, (u8 *)0xFFF8, 0, 1);
+
+       rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x00004001);
+
+       /* RFSW_CTRL register */
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x569A, 2);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x2488);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
+       msleep(100);
+
+       priv->rf->init(dev);
+
+       reg = RTL818X_CMD_TX_ENABLE | RTL818X_CMD_RX_ENABLE;
+       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
+       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF);
+
+       rtl818x_iowrite8(priv, (u8 *)0xFE41, 0xF4);
+       rtl818x_iowrite8(priv, (u8 *)0xFE40, 0x00);
+       rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x00);
+       rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x01);
+       rtl818x_iowrite8(priv, (u8 *)0xFE40, 0x0F);
+       rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x00);
+       rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x01);
+
+       reg = rtl818x_ioread8(priv, (u8 *)0xFFDB);
+       rtl818x_iowrite8(priv, (u8 *)0xFFDB, reg | (1 << 2));
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x59FA, 3);
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF74, 0x59D2, 3);
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF76, 0x59D2, 3);
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF78, 0x19FA, 3);
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF7A, 0x19FA, 3);
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF7C, 0x00D0, 3);
+       rtl818x_iowrite8(priv, (u8 *)0xFF61, 0);
+       rtl818x_iowrite8_idx(priv, (u8 *)0xFF80, 0x0F, 1);
+       rtl818x_iowrite8_idx(priv, (u8 *)0xFF83, 0x03, 1);
+       rtl818x_iowrite8(priv, (u8 *)0xFFDA, 0x10);
+       rtl818x_iowrite8_idx(priv, (u8 *)0xFF4D, 0x08, 2);
+
+       rtl818x_iowrite32(priv, &priv->map->HSSI_PARA, 0x0600321B);
+
+       rtl818x_iowrite16_idx(priv, (__le16 *)0xFFEC, 0x0800, 1);
+
+       priv->slot_time = 0x9;
+       priv->aifsn[0] = 2; /* AIFSN[AC_VO] */
+       priv->aifsn[1] = 2; /* AIFSN[AC_VI] */
+       priv->aifsn[2] = 7; /* AIFSN[AC_BK] */
+       priv->aifsn[3] = 3; /* AIFSN[AC_BE] */
+       rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0);
+
+       /* ENEDCA flag must always be set, transmit issues? */
+       rtl818x_iowrite8(priv, &priv->map->MSR, RTL818X_MSR_ENEDCA);
+
+       return 0;
+}
+
+static void rtl8187_work(struct work_struct *work)
+{
+       /* The RTL8187 returns the retry count through register 0xFFFA. In
+        * addition, it appears to be a cumulative retry count, not the
+        * value for the current TX packet. When multiple TX entries are
+        * queued, the retry count will be valid for the last one in the queue.
+        * The "error" should not matter for purposes of rate setting. */
+       struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv,
+                                   work.work);
+       struct ieee80211_tx_info *info;
+       struct ieee80211_hw *dev = priv->dev;
+       static u16 retry;
+       u16 tmp;
+
+       mutex_lock(&priv->conf_mutex);
+       tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA);
+       while (skb_queue_len(&priv->b_tx_status.queue) > 0) {
+               struct sk_buff *old_skb;
+
+               old_skb = skb_dequeue(&priv->b_tx_status.queue);
+               info = IEEE80211_SKB_CB(old_skb);
+               info->status.rates[0].count = tmp - retry + 1;
+               ieee80211_tx_status_irqsafe(dev, old_skb);
+       }
+       retry = tmp;
+       mutex_unlock(&priv->conf_mutex);
+}
+
+static int rtl8187_start(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u32 reg;
+       int ret;
+
+       mutex_lock(&priv->conf_mutex);
+
+       ret = (!priv->is_rtl8187b) ? rtl8187_init_hw(dev) :
+                                    rtl8187b_init_hw(dev);
+       if (ret)
+               goto rtl8187_start_exit;
+
+       init_usb_anchor(&priv->anchored);
+       priv->dev = dev;
+
+       if (priv->is_rtl8187b) {
+               reg = RTL818X_RX_CONF_MGMT |
+                     RTL818X_RX_CONF_DATA |
+                     RTL818X_RX_CONF_BROADCAST |
+                     RTL818X_RX_CONF_NICMAC |
+                     RTL818X_RX_CONF_BSSID |
+                     (7 << 13 /* RX FIFO threshold NONE */) |
+                     (7 << 10 /* MAX RX DMA */) |
+                     RTL818X_RX_CONF_RX_AUTORESETPHY |
+                     RTL818X_RX_CONF_ONLYERLPKT |
+                     RTL818X_RX_CONF_MULTICAST;
+               priv->rx_conf = reg;
+               rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg);
+
+               reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL);
+               reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT;
+               reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT;
+               reg &= ~RTL818X_TX_AGC_CTL_FEEDBACK_ANT;
+               rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg);
+
+               rtl818x_iowrite32(priv, &priv->map->TX_CONF,
+                                 RTL818X_TX_CONF_HW_SEQNUM |
+                                 RTL818X_TX_CONF_DISREQQSIZE |
+                                 (7 << 8  /* short retry limit */) |
+                                 (7 << 0  /* long retry limit */) |
+                                 (7 << 21 /* MAX TX DMA */));
+               rtl8187_init_urbs(dev);
+               rtl8187b_init_status_urb(dev);
+               goto rtl8187_start_exit;
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF);
+
+       rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0);
+       rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0);
+
+       rtl8187_init_urbs(dev);
+
+       reg = RTL818X_RX_CONF_ONLYERLPKT |
+             RTL818X_RX_CONF_RX_AUTORESETPHY |
+             RTL818X_RX_CONF_BSSID |
+             RTL818X_RX_CONF_MGMT |
+             RTL818X_RX_CONF_DATA |
+             (7 << 13 /* RX FIFO threshold NONE */) |
+             (7 << 10 /* MAX RX DMA */) |
+             RTL818X_RX_CONF_BROADCAST |
+             RTL818X_RX_CONF_NICMAC;
+
+       priv->rx_conf = reg;
+       rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg);
+
+       reg = rtl818x_ioread8(priv, &priv->map->CW_CONF);
+       reg &= ~RTL818X_CW_CONF_PERPACKET_CW_SHIFT;
+       reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT;
+       rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg);
+
+       reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL);
+       reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT;
+       reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT;
+       reg &= ~RTL818X_TX_AGC_CTL_FEEDBACK_ANT;
+       rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg);
+
+       reg  = RTL818X_TX_CONF_CW_MIN |
+              (7 << 21 /* MAX TX DMA */) |
+              RTL818X_TX_CONF_NO_ICV;
+       rtl818x_iowrite32(priv, &priv->map->TX_CONF, reg);
+
+       reg = rtl818x_ioread8(priv, &priv->map->CMD);
+       reg |= RTL818X_CMD_TX_ENABLE;
+       reg |= RTL818X_CMD_RX_ENABLE;
+       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
+       INIT_DELAYED_WORK(&priv->work, rtl8187_work);
+
+rtl8187_start_exit:
+       mutex_unlock(&priv->conf_mutex);
+       return ret;
+}
+
+static void rtl8187_stop(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       struct sk_buff *skb;
+       u32 reg;
+
+       mutex_lock(&priv->conf_mutex);
+       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
+
+       reg = rtl818x_ioread8(priv, &priv->map->CMD);
+       reg &= ~RTL818X_CMD_TX_ENABLE;
+       reg &= ~RTL818X_CMD_RX_ENABLE;
+       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
+
+       priv->rf->stop(dev);
+       rtl8187_set_anaparam(priv, false);
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG4);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG4, reg | RTL818X_CONFIG4_VCOOFF);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       while ((skb = skb_dequeue(&priv->b_tx_status.queue)))
+               dev_kfree_skb_any(skb);
+
+       usb_kill_anchored_urbs(&priv->anchored);
+       mutex_unlock(&priv->conf_mutex);
+
+       if (!priv->is_rtl8187b)
+               cancel_delayed_work_sync(&priv->work);
+}
+
+static int rtl8187_add_interface(struct ieee80211_hw *dev,
+                                struct ieee80211_vif *vif)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       int i;
+       int ret = -EOPNOTSUPP;
+
+       mutex_lock(&priv->conf_mutex);
+       if (priv->vif)
+               goto exit;
+
+       switch (vif->type) {
+       case NL80211_IFTYPE_STATION:
+               break;
+       default:
+               goto exit;
+       }
+
+       ret = 0;
+       priv->vif = vif;
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       for (i = 0; i < ETH_ALEN; i++)
+               rtl818x_iowrite8(priv, &priv->map->MAC[i],
+                                ((u8 *)vif->addr)[i]);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+exit:
+       mutex_unlock(&priv->conf_mutex);
+       return ret;
+}
+
+static void rtl8187_remove_interface(struct ieee80211_hw *dev,
+                                    struct ieee80211_vif *vif)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       mutex_lock(&priv->conf_mutex);
+       priv->vif = NULL;
+       mutex_unlock(&priv->conf_mutex);
+}
+
+static int rtl8187_config(struct ieee80211_hw *dev, u32 changed)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       struct ieee80211_conf *conf = &dev->conf;
+       u32 reg;
+
+       mutex_lock(&priv->conf_mutex);
+       reg = rtl818x_ioread32(priv, &priv->map->TX_CONF);
+       /* Enable TX loopback on MAC level to avoid TX during channel
+        * changes, as this has be seen to causes problems and the
+        * card will stop work until next reset
+        */
+       rtl818x_iowrite32(priv, &priv->map->TX_CONF,
+                         reg | RTL818X_TX_CONF_LOOPBACK_MAC);
+       priv->rf->set_chan(dev, conf);
+       msleep(10);
+       rtl818x_iowrite32(priv, &priv->map->TX_CONF, reg);
+
+       rtl818x_iowrite16(priv, &priv->map->ATIM_WND, 2);
+       rtl818x_iowrite16(priv, &priv->map->ATIMTR_INTERVAL, 100);
+       rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL, 100);
+       rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL_TIME, 100);
+       mutex_unlock(&priv->conf_mutex);
+       return 0;
+}
+
+/*
+ * With 8187B, AC_*_PARAM clashes with FEMR definition in struct rtl818x_csr for
+ * example. Thus we have to use raw values for AC_*_PARAM register addresses.
+ */
+static __le32 *rtl8187b_ac_addr[4] = {
+       (__le32 *) 0xFFF0, /* AC_VO */
+       (__le32 *) 0xFFF4, /* AC_VI */
+       (__le32 *) 0xFFFC, /* AC_BK */
+       (__le32 *) 0xFFF8, /* AC_BE */
+};
+
+#define SIFS_TIME 0xa
+
+static void rtl8187_conf_erp(struct rtl8187_priv *priv, bool use_short_slot,
+                            bool use_short_preamble)
+{
+       if (priv->is_rtl8187b) {
+               u8 difs, eifs;
+               u16 ack_timeout;
+               int queue;
+
+               if (use_short_slot) {
+                       priv->slot_time = 0x9;
+                       difs = 0x1c;
+                       eifs = 0x53;
+               } else {
+                       priv->slot_time = 0x14;
+                       difs = 0x32;
+                       eifs = 0x5b;
+               }
+               rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22);
+               rtl818x_iowrite8(priv, &priv->map->SLOT, priv->slot_time);
+               rtl818x_iowrite8(priv, &priv->map->DIFS, difs);
+
+               /*
+                * BRSR+1 on 8187B is in fact EIFS register
+                * Value in units of 4 us
+                */
+               rtl818x_iowrite8(priv, (u8 *)&priv->map->BRSR + 1, eifs);
+
+               /*
+                * For 8187B, CARRIER_SENSE_COUNTER is in fact ack timeout
+                * register. In units of 4 us like eifs register
+                * ack_timeout = ack duration + plcp + difs + preamble
+                */
+               ack_timeout = 112 + 48 + difs;
+               if (use_short_preamble)
+                       ack_timeout += 72;
+               else
+                       ack_timeout += 144;
+               rtl818x_iowrite8(priv, &priv->map->CARRIER_SENSE_COUNTER,
+                                DIV_ROUND_UP(ack_timeout, 4));
+
+               for (queue = 0; queue < 4; queue++)
+                       rtl818x_iowrite8(priv, (u8 *) rtl8187b_ac_addr[queue],
+                                        priv->aifsn[queue] * priv->slot_time +
+                                        SIFS_TIME);
+       } else {
+               rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22);
+               if (use_short_slot) {
+                       rtl818x_iowrite8(priv, &priv->map->SLOT, 0x9);
+                       rtl818x_iowrite8(priv, &priv->map->DIFS, 0x14);
+                       rtl818x_iowrite8(priv, &priv->map->EIFS, 91 - 0x14);
+               } else {
+                       rtl818x_iowrite8(priv, &priv->map->SLOT, 0x14);
+                       rtl818x_iowrite8(priv, &priv->map->DIFS, 0x24);
+                       rtl818x_iowrite8(priv, &priv->map->EIFS, 91 - 0x24);
+               }
+       }
+}
+
+static void rtl8187_bss_info_changed(struct ieee80211_hw *dev,
+                                    struct ieee80211_vif *vif,
+                                    struct ieee80211_bss_conf *info,
+                                    u32 changed)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       int i;
+       u8 reg;
+
+       if (changed & BSS_CHANGED_BSSID) {
+               mutex_lock(&priv->conf_mutex);
+               for (i = 0; i < ETH_ALEN; i++)
+                       rtl818x_iowrite8(priv, &priv->map->BSSID[i],
+                                        info->bssid[i]);
+
+               if (priv->is_rtl8187b)
+                       reg = RTL818X_MSR_ENEDCA;
+               else
+                       reg = 0;
+
+               if (is_valid_ether_addr(info->bssid))
+                       reg |= RTL818X_MSR_INFRA;
+               else
+                       reg |= RTL818X_MSR_NO_LINK;
+
+               rtl818x_iowrite8(priv, &priv->map->MSR, reg);
+
+               mutex_unlock(&priv->conf_mutex);
+       }
+
+       if (changed & (BSS_CHANGED_ERP_SLOT | BSS_CHANGED_ERP_PREAMBLE))
+               rtl8187_conf_erp(priv, info->use_short_slot,
+                                info->use_short_preamble);
+}
+
+static u64 rtl8187_prepare_multicast(struct ieee80211_hw *dev,
+                                    struct netdev_hw_addr_list *mc_list)
+{
+       return netdev_hw_addr_list_count(mc_list);
+}
+
+static void rtl8187_configure_filter(struct ieee80211_hw *dev,
+                                    unsigned int changed_flags,
+                                    unsigned int *total_flags,
+                                    u64 multicast)
+{
+       struct rtl8187_priv *priv = dev->priv;
+
+       if (changed_flags & FIF_FCSFAIL)
+               priv->rx_conf ^= RTL818X_RX_CONF_FCS;
+       if (changed_flags & FIF_CONTROL)
+               priv->rx_conf ^= RTL818X_RX_CONF_CTRL;
+       if (changed_flags & FIF_OTHER_BSS)
+               priv->rx_conf ^= RTL818X_RX_CONF_MONITOR;
+       if (*total_flags & FIF_ALLMULTI || multicast > 0)
+               priv->rx_conf |= RTL818X_RX_CONF_MULTICAST;
+       else
+               priv->rx_conf &= ~RTL818X_RX_CONF_MULTICAST;
+
+       *total_flags = 0;
+
+       if (priv->rx_conf & RTL818X_RX_CONF_FCS)
+               *total_flags |= FIF_FCSFAIL;
+       if (priv->rx_conf & RTL818X_RX_CONF_CTRL)
+               *total_flags |= FIF_CONTROL;
+       if (priv->rx_conf & RTL818X_RX_CONF_MONITOR)
+               *total_flags |= FIF_OTHER_BSS;
+       if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST)
+               *total_flags |= FIF_ALLMULTI;
+
+       rtl818x_iowrite32_async(priv, &priv->map->RX_CONF, priv->rx_conf);
+}
+
+static int rtl8187_conf_tx(struct ieee80211_hw *dev, u16 queue,
+                          const struct ieee80211_tx_queue_params *params)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u8 cw_min, cw_max;
+
+       if (queue > 3)
+               return -EINVAL;
+
+       cw_min = fls(params->cw_min);
+       cw_max = fls(params->cw_max);
+
+       if (priv->is_rtl8187b) {
+               priv->aifsn[queue] = params->aifs;
+
+               /*
+                * This is the structure of AC_*_PARAM registers in 8187B:
+                * - TXOP limit field, bit offset = 16
+                * - ECWmax, bit offset = 12
+                * - ECWmin, bit offset = 8
+                * - AIFS, bit offset = 0
+                */
+               rtl818x_iowrite32(priv, rtl8187b_ac_addr[queue],
+                                 (params->txop << 16) | (cw_max << 12) |
+                                 (cw_min << 8) | (params->aifs *
+                                 priv->slot_time + SIFS_TIME));
+       } else {
+               if (queue != 0)
+                       return -EINVAL;
+
+               rtl818x_iowrite8(priv, &priv->map->CW_VAL,
+                                cw_min | (cw_max << 4));
+       }
+       return 0;
+}
+
+static u64 rtl8187_get_tsf(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+
+       return rtl818x_ioread32(priv, &priv->map->TSFT[0]) |
+              (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32;
+}
+
+static const struct ieee80211_ops rtl8187_ops = {
+       .tx                     = rtl8187_tx,
+       .start                  = rtl8187_start,
+       .stop                   = rtl8187_stop,
+       .add_interface          = rtl8187_add_interface,
+       .remove_interface       = rtl8187_remove_interface,
+       .config                 = rtl8187_config,
+       .bss_info_changed       = rtl8187_bss_info_changed,
+       .prepare_multicast      = rtl8187_prepare_multicast,
+       .configure_filter       = rtl8187_configure_filter,
+       .conf_tx                = rtl8187_conf_tx,
+       .rfkill_poll            = rtl8187_rfkill_poll,
+       .get_tsf                = rtl8187_get_tsf,
+};
+
+static void rtl8187_eeprom_register_read(struct eeprom_93cx6 *eeprom)
+{
+       struct ieee80211_hw *dev = eeprom->data;
+       struct rtl8187_priv *priv = dev->priv;
+       u8 reg = rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
+
+       eeprom->reg_data_in = reg & RTL818X_EEPROM_CMD_WRITE;
+       eeprom->reg_data_out = reg & RTL818X_EEPROM_CMD_READ;
+       eeprom->reg_data_clock = reg & RTL818X_EEPROM_CMD_CK;
+       eeprom->reg_chip_select = reg & RTL818X_EEPROM_CMD_CS;
+}
+
+static void rtl8187_eeprom_register_write(struct eeprom_93cx6 *eeprom)
+{
+       struct ieee80211_hw *dev = eeprom->data;
+       struct rtl8187_priv *priv = dev->priv;
+       u8 reg = RTL818X_EEPROM_CMD_PROGRAM;
+
+       if (eeprom->reg_data_in)
+               reg |= RTL818X_EEPROM_CMD_WRITE;
+       if (eeprom->reg_data_out)
+               reg |= RTL818X_EEPROM_CMD_READ;
+       if (eeprom->reg_data_clock)
+               reg |= RTL818X_EEPROM_CMD_CK;
+       if (eeprom->reg_chip_select)
+               reg |= RTL818X_EEPROM_CMD_CS;
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, reg);
+       udelay(10);
+}
+
+static int __devinit rtl8187_probe(struct usb_interface *intf,
+                                  const struct usb_device_id *id)
+{
+       struct usb_device *udev = interface_to_usbdev(intf);
+       struct ieee80211_hw *dev;
+       struct rtl8187_priv *priv;
+       struct eeprom_93cx6 eeprom;
+       struct ieee80211_channel *channel;
+       const char *chip_name;
+       u16 txpwr, reg;
+       u16 product_id = le16_to_cpu(udev->descriptor.idProduct);
+       int err, i;
+       u8 mac_addr[ETH_ALEN];
+
+       dev = ieee80211_alloc_hw(sizeof(*priv), &rtl8187_ops);
+       if (!dev) {
+               printk(KERN_ERR "rtl8187: ieee80211 alloc failed\n");
+               return -ENOMEM;
+       }
+
+       priv = dev->priv;
+       priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
+
+       /* allocate "DMA aware" buffer for register accesses */
+       priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
+       if (!priv->io_dmabuf) {
+               err = -ENOMEM;
+               goto err_free_dev;
+       }
+       mutex_init(&priv->io_mutex);
+
+       SET_IEEE80211_DEV(dev, &intf->dev);
+       usb_set_intfdata(intf, dev);
+       priv->udev = udev;
+
+       usb_get_dev(udev);
+
+       skb_queue_head_init(&priv->rx_queue);
+
+       BUILD_BUG_ON(sizeof(priv->channels) != sizeof(rtl818x_channels));
+       BUILD_BUG_ON(sizeof(priv->rates) != sizeof(rtl818x_rates));
+
+       memcpy(priv->channels, rtl818x_channels, sizeof(rtl818x_channels));
+       memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates));
+       priv->map = (struct rtl818x_csr *)0xFF00;
+
+       priv->band.band = IEEE80211_BAND_2GHZ;
+       priv->band.channels = priv->channels;
+       priv->band.n_channels = ARRAY_SIZE(rtl818x_channels);
+       priv->band.bitrates = priv->rates;
+       priv->band.n_bitrates = ARRAY_SIZE(rtl818x_rates);
+       dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+
+
+       dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
+                    IEEE80211_HW_SIGNAL_DBM |
+                    IEEE80211_HW_RX_INCLUDES_FCS;
+
+       eeprom.data = dev;
+       eeprom.register_read = rtl8187_eeprom_register_read;
+       eeprom.register_write = rtl8187_eeprom_register_write;
+       if (rtl818x_ioread32(priv, &priv->map->RX_CONF) & (1 << 6))
+               eeprom.width = PCI_EEPROM_WIDTH_93C66;
+       else
+               eeprom.width = PCI_EEPROM_WIDTH_93C46;
+
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       udelay(10);
+
+       eeprom_93cx6_multiread(&eeprom, RTL8187_EEPROM_MAC_ADDR,
+                              (__le16 __force *)mac_addr, 3);
+       if (!is_valid_ether_addr(mac_addr)) {
+               printk(KERN_WARNING "rtl8187: Invalid hwaddr! Using randomly "
+                      "generated MAC address\n");
+               random_ether_addr(mac_addr);
+       }
+       SET_IEEE80211_PERM_ADDR(dev, mac_addr);
+
+       channel = priv->channels;
+       for (i = 0; i < 3; i++) {
+               eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_1 + i,
+                                 &txpwr);
+               (*channel++).hw_value = txpwr & 0xFF;
+               (*channel++).hw_value = txpwr >> 8;
+       }
+       for (i = 0; i < 2; i++) {
+               eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_4 + i,
+                                 &txpwr);
+               (*channel++).hw_value = txpwr & 0xFF;
+               (*channel++).hw_value = txpwr >> 8;
+       }
+
+       eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_BASE,
+                         &priv->txpwr_base);
+
+       reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~1;
+       rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg | 1);
+       /* 0 means asic B-cut, we should use SW 3 wire
+        * bit-by-bit banging for radio. 1 means we can use
+        * USB specific request to write radio registers */
+       priv->asic_rev = rtl818x_ioread8(priv, (u8 *)0xFFFE) & 0x3;
+       rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       if (!priv->is_rtl8187b) {
+               u32 reg32;
+               reg32 = rtl818x_ioread32(priv, &priv->map->TX_CONF);
+               reg32 &= RTL818X_TX_CONF_HWVER_MASK;
+               switch (reg32) {
+               case RTL818X_TX_CONF_R8187vD_B:
+                       /* Some RTL8187B devices have a USB ID of 0x8187
+                        * detect them here */
+                       chip_name = "RTL8187BvB(early)";
+                       priv->is_rtl8187b = 1;
+                       priv->hw_rev = RTL8187BvB;
+                       break;
+               case RTL818X_TX_CONF_R8187vD:
+                       chip_name = "RTL8187vD";
+                       break;
+               default:
+                       chip_name = "RTL8187vB (default)";
+               }
+       } else {
+               /*
+                * Force USB request to write radio registers for 8187B, Realtek
+                * only uses it in their sources
+                */
+               /*if (priv->asic_rev == 0) {
+                       printk(KERN_WARNING "rtl8187: Forcing use of USB "
+                              "requests to write to radio registers\n");
+                       priv->asic_rev = 1;
+               }*/
+               switch (rtl818x_ioread8(priv, (u8 *)0xFFE1)) {
+               case RTL818X_R8187B_B:
+                       chip_name = "RTL8187BvB";
+                       priv->hw_rev = RTL8187BvB;
+                       break;
+               case RTL818X_R8187B_D:
+                       chip_name = "RTL8187BvD";
+                       priv->hw_rev = RTL8187BvD;
+                       break;
+               case RTL818X_R8187B_E:
+                       chip_name = "RTL8187BvE";
+                       priv->hw_rev = RTL8187BvE;
+                       break;
+               default:
+                       chip_name = "RTL8187BvB (default)";
+                       priv->hw_rev = RTL8187BvB;
+               }
+       }
+
+       if (!priv->is_rtl8187b) {
+               for (i = 0; i < 2; i++) {
+                       eeprom_93cx6_read(&eeprom,
+                                         RTL8187_EEPROM_TXPWR_CHAN_6 + i,
+                                         &txpwr);
+                       (*channel++).hw_value = txpwr & 0xFF;
+                       (*channel++).hw_value = txpwr >> 8;
+               }
+       } else {
+               eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_6,
+                                 &txpwr);
+               (*channel++).hw_value = txpwr & 0xFF;
+
+               eeprom_93cx6_read(&eeprom, 0x0A, &txpwr);
+               (*channel++).hw_value = txpwr & 0xFF;
+
+               eeprom_93cx6_read(&eeprom, 0x1C, &txpwr);
+               (*channel++).hw_value = txpwr & 0xFF;
+               (*channel++).hw_value = txpwr >> 8;
+       }
+       /* Handle the differing rfkill GPIO bit in different models */
+       priv->rfkill_mask = RFKILL_MASK_8187_89_97;
+       if (product_id == 0x8197 || product_id == 0x8198) {
+               eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_SELECT_GPIO, &reg);
+               if (reg & 0xFF00)
+                       priv->rfkill_mask = RFKILL_MASK_8198;
+       }
+
+       /*
+        * XXX: Once this driver supports anything that requires
+        *      beacons it must implement IEEE80211_TX_CTL_ASSIGN_SEQ.
+        */
+       dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
+
+       if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b)
+               printk(KERN_INFO "rtl8187: inconsistency between id with OEM"
+                      " info!\n");
+
+       priv->rf = rtl8187_detect_rf(dev);
+       dev->extra_tx_headroom = (!priv->is_rtl8187b) ?
+                                 sizeof(struct rtl8187_tx_hdr) :
+                                 sizeof(struct rtl8187b_tx_hdr);
+       if (!priv->is_rtl8187b)
+               dev->queues = 1;
+       else
+               dev->queues = 4;
+
+       err = ieee80211_register_hw(dev);
+       if (err) {
+               printk(KERN_ERR "rtl8187: Cannot register device\n");
+               goto err_free_dmabuf;
+       }
+       mutex_init(&priv->conf_mutex);
+       skb_queue_head_init(&priv->b_tx_status.queue);
+
+       wiphy_info(dev->wiphy, "hwaddr %pM, %s V%d + %s, rfkill mask %d\n",
+                  mac_addr, chip_name, priv->asic_rev, priv->rf->name,
+                  priv->rfkill_mask);
+
+#ifdef CONFIG_RTL8187_LEDS
+       eeprom_93cx6_read(&eeprom, 0x3F, &reg);
+       reg &= 0xFF;
+       rtl8187_leds_init(dev, reg);
+#endif
+       rtl8187_rfkill_init(dev);
+
+       return 0;
+
+ err_free_dmabuf:
+       kfree(priv->io_dmabuf);
+ err_free_dev:
+       ieee80211_free_hw(dev);
+       usb_set_intfdata(intf, NULL);
+       usb_put_dev(udev);
+       return err;
+}
+
+static void __devexit rtl8187_disconnect(struct usb_interface *intf)
+{
+       struct ieee80211_hw *dev = usb_get_intfdata(intf);
+       struct rtl8187_priv *priv;
+
+       if (!dev)
+               return;
+
+#ifdef CONFIG_RTL8187_LEDS
+       rtl8187_leds_exit(dev);
+#endif
+       rtl8187_rfkill_exit(dev);
+       ieee80211_unregister_hw(dev);
+
+       priv = dev->priv;
+       usb_reset_device(priv->udev);
+       usb_put_dev(interface_to_usbdev(intf));
+       kfree(priv->io_dmabuf);
+       ieee80211_free_hw(dev);
+}
+
+static struct usb_driver rtl8187_driver = {
+       .name           = KBUILD_MODNAME,
+       .id_table       = rtl8187_table,
+       .probe          = rtl8187_probe,
+       .disconnect     = __devexit_p(rtl8187_disconnect),
+};
+
+static int __init rtl8187_init(void)
+{
+       return usb_register(&rtl8187_driver);
+}
+
+static void __exit rtl8187_exit(void)
+{
+       usb_deregister(&rtl8187_driver);
+}
+
+module_init(rtl8187_init);
+module_exit(rtl8187_exit);
diff --git a/drivers/net/wireless/rtl818x/rtl8187/leds.c b/drivers/net/wireless/rtl818x/rtl8187/leds.c
new file mode 100644 (file)
index 0000000..2e0de2f
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Linux LED driver for RTL8187
+ *
+ * Copyright 2009 Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ * Based on the LED handling in the r8187 driver, which is:
+ * Copyright (c) Realtek Semiconductor Corp. All rights reserved.
+ *
+ * Thanks to Realtek for their support!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifdef CONFIG_RTL8187_LEDS
+
+#include <net/mac80211.h>
+#include <linux/usb.h>
+#include <linux/eeprom_93cx6.h>
+
+#include "rtl8187.h"
+#include "leds.h"
+
+static void led_turn_on(struct work_struct *work)
+{
+       /* As this routine does read/write operations on the hardware, it must
+        * be run from a work queue.
+        */
+       u8 reg;
+       struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv,
+                                   led_on.work);
+       struct rtl8187_led *led = &priv->led_tx;
+
+       /* Don't change the LED, when the device is down. */
+       if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED)
+               return ;
+
+       /* Skip if the LED is not registered. */
+       if (!led->dev)
+               return;
+       mutex_lock(&priv->conf_mutex);
+       switch (led->ledpin) {
+       case LED_PIN_GPIO0:
+               rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x01);
+               rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0x00);
+               break;
+       case LED_PIN_LED0:
+               reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~(1 << 4);
+               rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
+               break;
+       case LED_PIN_LED1:
+               reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~(1 << 5);
+               rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
+               break;
+       case LED_PIN_HW:
+       default:
+               break;
+       }
+       mutex_unlock(&priv->conf_mutex);
+}
+
+static void led_turn_off(struct work_struct *work)
+{
+       /* As this routine does read/write operations on the hardware, it must
+        * be run from a work queue.
+        */
+       u8 reg;
+       struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv,
+                                   led_off.work);
+       struct rtl8187_led *led = &priv->led_tx;
+
+       /* Don't change the LED, when the device is down. */
+       if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED)
+               return ;
+
+       /* Skip if the LED is not registered. */
+       if (!led->dev)
+               return;
+       mutex_lock(&priv->conf_mutex);
+       switch (led->ledpin) {
+       case LED_PIN_GPIO0:
+               rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x01);
+               rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0x01);
+               break;
+       case LED_PIN_LED0:
+               reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) | (1 << 4);
+               rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
+               break;
+       case LED_PIN_LED1:
+               reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) | (1 << 5);
+               rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
+               break;
+       case LED_PIN_HW:
+       default:
+               break;
+       }
+       mutex_unlock(&priv->conf_mutex);
+}
+
+/* Callback from the LED subsystem. */
+static void rtl8187_led_brightness_set(struct led_classdev *led_dev,
+                                  enum led_brightness brightness)
+{
+       struct rtl8187_led *led = container_of(led_dev, struct rtl8187_led,
+                                              led_dev);
+       struct ieee80211_hw *hw = led->dev;
+       struct rtl8187_priv *priv;
+       static bool radio_on;
+
+       if (!hw)
+               return;
+       priv = hw->priv;
+       if (led->is_radio) {
+               if (brightness == LED_FULL) {
+                       ieee80211_queue_delayed_work(hw, &priv->led_on, 0);
+                       radio_on = true;
+               } else if (radio_on) {
+                       radio_on = false;
+                       cancel_delayed_work_sync(&priv->led_on);
+                       ieee80211_queue_delayed_work(hw, &priv->led_off, 0);
+               }
+       } else if (radio_on) {
+               if (brightness == LED_OFF) {
+                       ieee80211_queue_delayed_work(hw, &priv->led_off, 0);
+                       /* The LED is off for 1/20 sec - it just blinks. */
+                       ieee80211_queue_delayed_work(hw, &priv->led_on,
+                                                    HZ / 20);
+               } else
+                       ieee80211_queue_delayed_work(hw, &priv->led_on, 0);
+       }
+}
+
+static int rtl8187_register_led(struct ieee80211_hw *dev,
+                               struct rtl8187_led *led, const char *name,
+                               const char *default_trigger, u8 ledpin,
+                               bool is_radio)
+{
+       int err;
+       struct rtl8187_priv *priv = dev->priv;
+
+       if (led->dev)
+               return -EEXIST;
+       if (!default_trigger)
+               return -EINVAL;
+       led->dev = dev;
+       led->ledpin = ledpin;
+       led->is_radio = is_radio;
+       strncpy(led->name, name, sizeof(led->name));
+
+       led->led_dev.name = led->name;
+       led->led_dev.default_trigger = default_trigger;
+       led->led_dev.brightness_set = rtl8187_led_brightness_set;
+
+       err = led_classdev_register(&priv->udev->dev, &led->led_dev);
+       if (err) {
+               printk(KERN_INFO "LEDs: Failed to register %s\n", name);
+               led->dev = NULL;
+               return err;
+       }
+       return 0;
+}
+
+static void rtl8187_unregister_led(struct rtl8187_led *led)
+{
+       struct ieee80211_hw *hw = led->dev;
+       struct rtl8187_priv *priv = hw->priv;
+
+       led_classdev_unregister(&led->led_dev);
+       flush_delayed_work(&priv->led_off);
+       led->dev = NULL;
+}
+
+void rtl8187_leds_init(struct ieee80211_hw *dev, u16 custid)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       char name[RTL8187_LED_MAX_NAME_LEN + 1];
+       u8 ledpin;
+       int err;
+
+       /* According to the vendor driver, the LED operation depends on the
+        * customer ID encoded in the EEPROM
+        */
+       printk(KERN_INFO "rtl8187: Customer ID is 0x%02X\n", custid);
+       switch (custid) {
+       case EEPROM_CID_RSVD0:
+       case EEPROM_CID_RSVD1:
+       case EEPROM_CID_SERCOMM_PS:
+       case EEPROM_CID_QMI:
+       case EEPROM_CID_DELL:
+       case EEPROM_CID_TOSHIBA:
+               ledpin = LED_PIN_GPIO0;
+               break;
+       case EEPROM_CID_ALPHA0:
+               ledpin = LED_PIN_LED0;
+               break;
+       case EEPROM_CID_HW:
+               ledpin = LED_PIN_HW;
+               break;
+       default:
+               ledpin = LED_PIN_GPIO0;
+       }
+
+       INIT_DELAYED_WORK(&priv->led_on, led_turn_on);
+       INIT_DELAYED_WORK(&priv->led_off, led_turn_off);
+
+       snprintf(name, sizeof(name),
+                "rtl8187-%s::radio", wiphy_name(dev->wiphy));
+       err = rtl8187_register_led(dev, &priv->led_radio, name,
+                        ieee80211_get_radio_led_name(dev), ledpin, true);
+       if (err)
+               return;
+
+       snprintf(name, sizeof(name),
+                "rtl8187-%s::tx", wiphy_name(dev->wiphy));
+       err = rtl8187_register_led(dev, &priv->led_tx, name,
+                        ieee80211_get_tx_led_name(dev), ledpin, false);
+       if (err)
+               goto err_tx;
+
+       snprintf(name, sizeof(name),
+                "rtl8187-%s::rx", wiphy_name(dev->wiphy));
+       err = rtl8187_register_led(dev, &priv->led_rx, name,
+                        ieee80211_get_rx_led_name(dev), ledpin, false);
+       if (!err)
+               return;
+
+       /* registration of RX LED failed - unregister */
+       rtl8187_unregister_led(&priv->led_tx);
+err_tx:
+       rtl8187_unregister_led(&priv->led_radio);
+}
+
+void rtl8187_leds_exit(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+
+       rtl8187_unregister_led(&priv->led_radio);
+       rtl8187_unregister_led(&priv->led_rx);
+       rtl8187_unregister_led(&priv->led_tx);
+       cancel_delayed_work_sync(&priv->led_off);
+       cancel_delayed_work_sync(&priv->led_on);
+}
+#endif /* def CONFIG_RTL8187_LEDS */
+
diff --git a/drivers/net/wireless/rtl818x/rtl8187/leds.h b/drivers/net/wireless/rtl818x/rtl8187/leds.h
new file mode 100644 (file)
index 0000000..d743c96
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Definitions for RTL8187 leds
+ *
+ * Copyright 2009 Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ * Based on the LED handling in the r8187 driver, which is:
+ * Copyright (c) Realtek Semiconductor Corp. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef RTL8187_LED_H
+#define RTL8187_LED_H
+
+#ifdef CONFIG_RTL8187_LEDS
+
+#define RTL8187_LED_MAX_NAME_LEN       21
+
+#include <linux/leds.h>
+#include <linux/types.h>
+
+enum {
+       LED_PIN_LED0,
+       LED_PIN_LED1,
+       LED_PIN_GPIO0,
+       LED_PIN_HW
+};
+
+enum {
+       EEPROM_CID_RSVD0 = 0x00,
+       EEPROM_CID_RSVD1 = 0xFF,
+       EEPROM_CID_ALPHA0 = 0x01,
+       EEPROM_CID_SERCOMM_PS = 0x02,
+       EEPROM_CID_HW = 0x03,
+       EEPROM_CID_TOSHIBA = 0x04,
+       EEPROM_CID_QMI = 0x07,
+       EEPROM_CID_DELL = 0x08
+};
+
+struct rtl8187_led {
+       struct ieee80211_hw *dev;
+       /* The LED class device */
+       struct led_classdev led_dev;
+       /* The pin/method used to control the led */
+       u8 ledpin;
+       /* The unique name string for this LED device. */
+       char name[RTL8187_LED_MAX_NAME_LEN + 1];
+       /* If the LED is radio or tx/rx */
+       bool is_radio;
+};
+
+void rtl8187_leds_init(struct ieee80211_hw *dev, u16 code);
+void rtl8187_leds_exit(struct ieee80211_hw *dev);
+
+#endif /* def CONFIG_RTL8187_LEDS */
+
+#endif /* RTL8187_LED_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rfkill.c b/drivers/net/wireless/rtl818x/rtl8187/rfkill.c
new file mode 100644 (file)
index 0000000..3411671
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Linux RFKILL support for RTL8187
+ *
+ * Copyright (c) 2009 Herton Ronaldo Krzesinski <herton@mandriva.com.br>
+ *
+ * Based on the RFKILL handling in the r8187 driver, which is:
+ * Copyright (c) Realtek Semiconductor Corp. All rights reserved.
+ *
+ * Thanks to Realtek for their support!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/types.h>
+#include <linux/usb.h>
+#include <net/mac80211.h>
+
+#include "rtl8187.h"
+#include "rfkill.h"
+
+static bool rtl8187_is_radio_enabled(struct rtl8187_priv *priv)
+{
+       u8 gpio;
+
+       gpio = rtl818x_ioread8(priv, &priv->map->GPIO0);
+       rtl818x_iowrite8(priv, &priv->map->GPIO0, gpio & ~priv->rfkill_mask);
+       gpio = rtl818x_ioread8(priv, &priv->map->GPIO1);
+
+       return gpio & priv->rfkill_mask;
+}
+
+void rtl8187_rfkill_init(struct ieee80211_hw *hw)
+{
+       struct rtl8187_priv *priv = hw->priv;
+
+       priv->rfkill_off = rtl8187_is_radio_enabled(priv);
+       printk(KERN_INFO "rtl8187: wireless switch is %s\n",
+              priv->rfkill_off ? "on" : "off");
+       wiphy_rfkill_set_hw_state(hw->wiphy, !priv->rfkill_off);
+       wiphy_rfkill_start_polling(hw->wiphy);
+}
+
+void rtl8187_rfkill_poll(struct ieee80211_hw *hw)
+{
+       bool enabled;
+       struct rtl8187_priv *priv = hw->priv;
+
+       mutex_lock(&priv->conf_mutex);
+       enabled = rtl8187_is_radio_enabled(priv);
+       if (unlikely(enabled != priv->rfkill_off)) {
+               priv->rfkill_off = enabled;
+               printk(KERN_INFO "rtl8187: wireless radio switch turned %s\n",
+                      enabled ? "on" : "off");
+               wiphy_rfkill_set_hw_state(hw->wiphy, !enabled);
+       }
+       mutex_unlock(&priv->conf_mutex);
+}
+
+void rtl8187_rfkill_exit(struct ieee80211_hw *hw)
+{
+       wiphy_rfkill_stop_polling(hw->wiphy);
+}
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rfkill.h b/drivers/net/wireless/rtl818x/rtl8187/rfkill.h
new file mode 100644 (file)
index 0000000..e12575e
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef RTL8187_RFKILL_H
+#define RTL8187_RFKILL_H
+
+void rtl8187_rfkill_init(struct ieee80211_hw *hw);
+void rtl8187_rfkill_poll(struct ieee80211_hw *hw);
+void rtl8187_rfkill_exit(struct ieee80211_hw *hw);
+
+#endif /* RTL8187_RFKILL_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h
new file mode 100644 (file)
index 0000000..0d7b142
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ * Definitions for RTL8187 hardware
+ *
+ * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Based on the r8187 driver, which is:
+ * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef RTL8187_H
+#define RTL8187_H
+
+#include "rtl818x.h"
+#include "leds.h"
+
+#define RTL8187_EEPROM_TXPWR_BASE      0x05
+#define RTL8187_EEPROM_MAC_ADDR                0x07
+#define RTL8187_EEPROM_TXPWR_CHAN_1    0x16    /* 3 channels */
+#define RTL8187_EEPROM_TXPWR_CHAN_6    0x1B    /* 2 channels */
+#define RTL8187_EEPROM_TXPWR_CHAN_4    0x3D    /* 2 channels */
+#define RTL8187_EEPROM_SELECT_GPIO     0x3B
+
+#define RTL8187_REQT_READ      0xC0
+#define RTL8187_REQT_WRITE     0x40
+#define RTL8187_REQ_GET_REG    0x05
+#define RTL8187_REQ_SET_REG    0x05
+
+#define RTL8187_MAX_RX         0x9C4
+
+#define RFKILL_MASK_8187_89_97 0x2
+#define RFKILL_MASK_8198       0x4
+
+struct rtl8187_rx_info {
+       struct urb *urb;
+       struct ieee80211_hw *dev;
+};
+
+struct rtl8187_rx_hdr {
+       __le32 flags;
+       u8 noise;
+       u8 signal;
+       u8 agc;
+       u8 reserved;
+       __le64 mac_time;
+} __packed;
+
+struct rtl8187b_rx_hdr {
+       __le32 flags;
+       __le64 mac_time;
+       u8 sq;
+       u8 rssi;
+       u8 agc;
+       u8 flags2;
+       __le16 snr_long2end;
+       s8 pwdb_g12;
+       u8 fot;
+} __packed;
+
+/* {rtl8187,rtl8187b}_tx_info is in skb */
+
+struct rtl8187_tx_hdr {
+       __le32 flags;
+       __le16 rts_duration;
+       __le16 len;
+       __le32 retry;
+} __packed;
+
+struct rtl8187b_tx_hdr {
+       __le32 flags;
+       __le16 rts_duration;
+       __le16 len;
+       __le32 unused_1;
+       __le16 unused_2;
+       __le16 tx_duration;
+       __le32 unused_3;
+       __le32 retry;
+       __le32 unused_4[2];
+} __packed;
+
+enum {
+       DEVICE_RTL8187,
+       DEVICE_RTL8187B
+};
+
+struct rtl8187_priv {
+       /* common between rtl818x drivers */
+       struct rtl818x_csr *map;
+       const struct rtl818x_rf_ops *rf;
+       struct ieee80211_vif *vif;
+
+       /* The mutex protects the TX loopback state.
+        * Any attempt to set channels concurrently locks the device.
+        */
+       struct mutex conf_mutex;
+
+       /* rtl8187 specific */
+       struct ieee80211_channel channels[14];
+       struct ieee80211_rate rates[12];
+       struct ieee80211_supported_band band;
+       struct usb_device *udev;
+       u32 rx_conf;
+       struct usb_anchor anchored;
+       struct delayed_work work;
+       struct ieee80211_hw *dev;
+#ifdef CONFIG_RTL8187_LEDS
+       struct rtl8187_led led_radio;
+       struct rtl8187_led led_tx;
+       struct rtl8187_led led_rx;
+       struct delayed_work led_on;
+       struct delayed_work led_off;
+#endif
+       u16 txpwr_base;
+       u8 asic_rev;
+       u8 is_rtl8187b;
+       enum {
+               RTL8187BvB,
+               RTL8187BvD,
+               RTL8187BvE
+       } hw_rev;
+       struct sk_buff_head rx_queue;
+       u8 signal;
+       u8 noise;
+       u8 slot_time;
+       u8 aifsn[4];
+       u8 rfkill_mask;
+       struct {
+               __le64 buf;
+               struct sk_buff_head queue;
+       } b_tx_status; /* This queue is used by both -b and non-b devices */
+       struct mutex io_mutex;
+       union {
+               u8 bits8;
+               __le16 bits16;
+               __le32 bits32;
+       } *io_dmabuf;
+       bool rfkill_off;
+};
+
+void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
+
+static inline u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv,
+                                    u8 *addr, u8 idx)
+{
+       u8 val;
+
+       mutex_lock(&priv->io_mutex);
+       usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
+                       RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
+                       (unsigned long)addr, idx & 0x03,
+                       &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
+
+       val = priv->io_dmabuf->bits8;
+       mutex_unlock(&priv->io_mutex);
+
+       return val;
+}
+
+static inline u8 rtl818x_ioread8(struct rtl8187_priv *priv, u8 *addr)
+{
+       return rtl818x_ioread8_idx(priv, addr, 0);
+}
+
+static inline u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv,
+                                      __le16 *addr, u8 idx)
+{
+       __le16 val;
+
+       mutex_lock(&priv->io_mutex);
+       usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
+                       RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
+                       (unsigned long)addr, idx & 0x03,
+                       &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
+
+       val = priv->io_dmabuf->bits16;
+       mutex_unlock(&priv->io_mutex);
+
+       return le16_to_cpu(val);
+}
+
+static inline u16 rtl818x_ioread16(struct rtl8187_priv *priv, __le16 *addr)
+{
+       return rtl818x_ioread16_idx(priv, addr, 0);
+}
+
+static inline u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv,
+                                      __le32 *addr, u8 idx)
+{
+       __le32 val;
+
+       mutex_lock(&priv->io_mutex);
+       usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
+                       RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
+                       (unsigned long)addr, idx & 0x03,
+                       &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
+
+       val = priv->io_dmabuf->bits32;
+       mutex_unlock(&priv->io_mutex);
+
+       return le32_to_cpu(val);
+}
+
+static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr)
+{
+       return rtl818x_ioread32_idx(priv, addr, 0);
+}
+
+static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv,
+                                       u8 *addr, u8 val, u8 idx)
+{
+       mutex_lock(&priv->io_mutex);
+
+       priv->io_dmabuf->bits8 = val;
+       usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
+                       RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
+                       (unsigned long)addr, idx & 0x03,
+                       &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
+
+       mutex_unlock(&priv->io_mutex);
+}
+
+static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val)
+{
+       rtl818x_iowrite8_idx(priv, addr, val, 0);
+}
+
+static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv,
+                                        __le16 *addr, u16 val, u8 idx)
+{
+       mutex_lock(&priv->io_mutex);
+
+       priv->io_dmabuf->bits16 = cpu_to_le16(val);
+       usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
+                       RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
+                       (unsigned long)addr, idx & 0x03,
+                       &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
+
+       mutex_unlock(&priv->io_mutex);
+}
+
+static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr,
+                                    u16 val)
+{
+       rtl818x_iowrite16_idx(priv, addr, val, 0);
+}
+
+static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv,
+                                        __le32 *addr, u32 val, u8 idx)
+{
+       mutex_lock(&priv->io_mutex);
+
+       priv->io_dmabuf->bits32 = cpu_to_le32(val);
+       usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
+                       RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
+                       (unsigned long)addr, idx & 0x03,
+                       &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
+
+       mutex_unlock(&priv->io_mutex);
+}
+
+static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr,
+                                    u32 val)
+{
+       rtl818x_iowrite32_idx(priv, addr, val, 0);
+}
+
+#endif /* RTL8187_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c
new file mode 100644 (file)
index 0000000..908903f
--- /dev/null
@@ -0,0 +1,961 @@
+/*
+ * Radio tuning for RTL8225 on RTL8187
+ *
+ * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Based on the r8187 driver, which is:
+ * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
+ *
+ * Magic delays, register offsets, and phy value tables below are
+ * taken from the original r8187 driver sources.  Thanks to Realtek
+ * for their support!
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/usb.h>
+#include <net/mac80211.h>
+
+#include "rtl8187.h"
+#include "rtl8225.h"
+
+static void rtl8225_write_bitbang(struct ieee80211_hw *dev, u8 addr, u16 data)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u16 reg80, reg84, reg82;
+       u32 bangdata;
+       int i;
+
+       bangdata = (data << 4) | (addr & 0xf);
+
+       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput) & 0xfff3;
+       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x7);
+
+       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x7);
+       udelay(10);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       udelay(2);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
+       udelay(10);
+
+       for (i = 15; i >= 0; i--) {
+               u16 reg = reg80 | (bangdata & (1 << i)) >> i;
+
+               if (i & 1)
+                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
+
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1));
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1));
+
+               if (!(i & 1))
+                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       udelay(10);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84);
+}
+
+static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u16 reg80, reg82, reg84;
+
+       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput);
+       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
+       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect);
+
+       reg80 &= ~(0x3 << 2);
+       reg84 &= ~0xF;
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x0007);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x0007);
+       udelay(10);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       udelay(2);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
+       udelay(10);
+
+       mutex_lock(&priv->io_mutex);
+
+       priv->io_dmabuf->bits16 = data;
+       usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
+                       RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
+                       addr, 0x8225, &priv->io_dmabuf->bits16, sizeof(data),
+                       HZ / 2);
+
+       mutex_unlock(&priv->io_mutex);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       udelay(10);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84);
+}
+
+static void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data)
+{
+       struct rtl8187_priv *priv = dev->priv;
+
+       if (priv->asic_rev)
+               rtl8225_write_8051(dev, addr, cpu_to_le16(data));
+       else
+               rtl8225_write_bitbang(dev, addr, data);
+}
+
+static u16 rtl8225_read(struct ieee80211_hw *dev, u8 addr)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u16 reg80, reg82, reg84, out;
+       int i;
+
+       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput);
+       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
+       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect);
+
+       reg80 &= ~0xF;
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x000F);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x000F);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
+       udelay(4);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
+       udelay(5);
+
+       for (i = 4; i >= 0; i--) {
+               u16 reg = reg80 | ((addr >> i) & 1);
+
+               if (!(i & 1)) {
+                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
+                       udelay(1);
+               }
+
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg | (1 << 1));
+               udelay(2);
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg | (1 << 1));
+               udelay(2);
+
+               if (i & 1) {
+                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
+                       udelay(1);
+               }
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                         reg80 | (1 << 3) | (1 << 1));
+       udelay(2);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                         reg80 | (1 << 3));
+       udelay(2);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                         reg80 | (1 << 3));
+       udelay(2);
+
+       out = 0;
+       for (i = 11; i >= 0; i--) {
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3));
+               udelay(1);
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3) | (1 << 1));
+               udelay(2);
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3) | (1 << 1));
+               udelay(2);
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3) | (1 << 1));
+               udelay(2);
+
+               if (rtl818x_ioread16(priv, &priv->map->RFPinsInput) & (1 << 1))
+                       out |= 1 << i;
+
+               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                                 reg80 | (1 << 3));
+               udelay(2);
+       }
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
+                         reg80 | (1 << 3) | (1 << 2));
+       udelay(2);
+
+       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84);
+       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x03A0);
+
+       return out;
+}
+
+static const u16 rtl8225bcd_rxgain[] = {
+       0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
+       0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+       0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
+       0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+       0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
+       0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
+       0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
+       0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
+       0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+       0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+       0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3,
+       0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb
+};
+
+static const u8 rtl8225_agc[] = {
+       0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+       0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96,
+       0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e,
+       0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86,
+       0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e,
+       0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36,
+       0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e,
+       0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26,
+       0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e,
+       0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16,
+       0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e,
+       0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06,
+       0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01,
+       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
+};
+
+static const u8 rtl8225_gain[] = {
+       0x23, 0x88, 0x7c, 0xa5, /* -82dBm */
+       0x23, 0x88, 0x7c, 0xb5, /* -82dBm */
+       0x23, 0x88, 0x7c, 0xc5, /* -82dBm */
+       0x33, 0x80, 0x79, 0xc5, /* -78dBm */
+       0x43, 0x78, 0x76, 0xc5, /* -74dBm */
+       0x53, 0x60, 0x73, 0xc5, /* -70dBm */
+       0x63, 0x58, 0x70, 0xc5, /* -66dBm */
+};
+
+static const u8 rtl8225_threshold[] = {
+       0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd
+};
+
+static const u8 rtl8225_tx_gain_cck_ofdm[] = {
+       0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
+};
+
+static const u8 rtl8225_tx_power_cck[] = {
+       0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
+       0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
+       0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
+       0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
+       0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
+       0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
+};
+
+static const u8 rtl8225_tx_power_cck_ch14[] = {
+       0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
+       0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
+       0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
+       0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
+       0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
+       0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
+};
+
+static const u8 rtl8225_tx_power_ofdm[] = {
+       0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
+};
+
+static const u32 rtl8225_chan[] = {
+       0x085c, 0x08dc, 0x095c, 0x09dc, 0x0a5c, 0x0adc, 0x0b5c,
+       0x0bdc, 0x0c5c, 0x0cdc, 0x0d5c, 0x0ddc, 0x0e5c, 0x0f72
+};
+
+static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u8 cck_power, ofdm_power;
+       const u8 *tmp;
+       u32 reg;
+       int i;
+
+       cck_power = priv->channels[channel - 1].hw_value & 0xF;
+       ofdm_power = priv->channels[channel - 1].hw_value >> 4;
+
+       cck_power = min(cck_power, (u8)11);
+       if (ofdm_power > (u8)15)
+               ofdm_power = 25;
+       else
+               ofdm_power += 10;
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
+                        rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1);
+
+       if (channel == 14)
+               tmp = &rtl8225_tx_power_cck_ch14[(cck_power % 6) * 8];
+       else
+               tmp = &rtl8225_tx_power_cck[(cck_power % 6) * 8];
+
+       for (i = 0; i < 8; i++)
+               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
+
+       msleep(1); // FIXME: optional?
+
+       /* anaparam2 on */
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
+                       reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2,
+                         RTL8187_RTL8225_ANAPARAM2_ON);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
+                       reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       rtl8225_write_phy_ofdm(dev, 2, 0x42);
+       rtl8225_write_phy_ofdm(dev, 6, 0x00);
+       rtl8225_write_phy_ofdm(dev, 8, 0x00);
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM,
+                        rtl8225_tx_gain_cck_ofdm[ofdm_power / 6] >> 1);
+
+       tmp = &rtl8225_tx_power_ofdm[ofdm_power % 6];
+
+       rtl8225_write_phy_ofdm(dev, 5, *tmp);
+       rtl8225_write_phy_ofdm(dev, 7, *tmp);
+
+       msleep(1);
+}
+
+static void rtl8225_rf_init(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       int i;
+
+       rtl8225_write(dev, 0x0, 0x067);
+       rtl8225_write(dev, 0x1, 0xFE0);
+       rtl8225_write(dev, 0x2, 0x44D);
+       rtl8225_write(dev, 0x3, 0x441);
+       rtl8225_write(dev, 0x4, 0x486);
+       rtl8225_write(dev, 0x5, 0xBC0);
+       rtl8225_write(dev, 0x6, 0xAE6);
+       rtl8225_write(dev, 0x7, 0x82A);
+       rtl8225_write(dev, 0x8, 0x01F);
+       rtl8225_write(dev, 0x9, 0x334);
+       rtl8225_write(dev, 0xA, 0xFD4);
+       rtl8225_write(dev, 0xB, 0x391);
+       rtl8225_write(dev, 0xC, 0x050);
+       rtl8225_write(dev, 0xD, 0x6DB);
+       rtl8225_write(dev, 0xE, 0x029);
+       rtl8225_write(dev, 0xF, 0x914); msleep(100);
+
+       rtl8225_write(dev, 0x2, 0xC4D); msleep(200);
+       rtl8225_write(dev, 0x2, 0x44D); msleep(200);
+
+       if (!(rtl8225_read(dev, 6) & (1 << 7))) {
+               rtl8225_write(dev, 0x02, 0x0c4d);
+               msleep(200);
+               rtl8225_write(dev, 0x02, 0x044d);
+               msleep(100);
+               if (!(rtl8225_read(dev, 6) & (1 << 7)))
+                       wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n",
+                                  rtl8225_read(dev, 6));
+       }
+
+       rtl8225_write(dev, 0x0, 0x127);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225bcd_rxgain); i++) {
+               rtl8225_write(dev, 0x1, i + 1);
+               rtl8225_write(dev, 0x2, rtl8225bcd_rxgain[i]);
+       }
+
+       rtl8225_write(dev, 0x0, 0x027);
+       rtl8225_write(dev, 0x0, 0x22F);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) {
+               rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]);
+               rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i);
+       }
+
+       msleep(1);
+
+       rtl8225_write_phy_ofdm(dev, 0x00, 0x01);
+       rtl8225_write_phy_ofdm(dev, 0x01, 0x02);
+       rtl8225_write_phy_ofdm(dev, 0x02, 0x42);
+       rtl8225_write_phy_ofdm(dev, 0x03, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x04, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x05, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x06, 0x40);
+       rtl8225_write_phy_ofdm(dev, 0x07, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x08, 0x40);
+       rtl8225_write_phy_ofdm(dev, 0x09, 0xfe);
+       rtl8225_write_phy_ofdm(dev, 0x0a, 0x09);
+       rtl8225_write_phy_ofdm(dev, 0x0b, 0x80);
+       rtl8225_write_phy_ofdm(dev, 0x0c, 0x01);
+       rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3);
+       rtl8225_write_phy_ofdm(dev, 0x0f, 0x38);
+       rtl8225_write_phy_ofdm(dev, 0x10, 0x84);
+       rtl8225_write_phy_ofdm(dev, 0x11, 0x06);
+       rtl8225_write_phy_ofdm(dev, 0x12, 0x20);
+       rtl8225_write_phy_ofdm(dev, 0x13, 0x20);
+       rtl8225_write_phy_ofdm(dev, 0x14, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x15, 0x40);
+       rtl8225_write_phy_ofdm(dev, 0x16, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x17, 0x40);
+       rtl8225_write_phy_ofdm(dev, 0x18, 0xef);
+       rtl8225_write_phy_ofdm(dev, 0x19, 0x19);
+       rtl8225_write_phy_ofdm(dev, 0x1a, 0x20);
+       rtl8225_write_phy_ofdm(dev, 0x1b, 0x76);
+       rtl8225_write_phy_ofdm(dev, 0x1c, 0x04);
+       rtl8225_write_phy_ofdm(dev, 0x1e, 0x95);
+       rtl8225_write_phy_ofdm(dev, 0x1f, 0x75);
+       rtl8225_write_phy_ofdm(dev, 0x20, 0x1f);
+       rtl8225_write_phy_ofdm(dev, 0x21, 0x27);
+       rtl8225_write_phy_ofdm(dev, 0x22, 0x16);
+       rtl8225_write_phy_ofdm(dev, 0x24, 0x46);
+       rtl8225_write_phy_ofdm(dev, 0x25, 0x20);
+       rtl8225_write_phy_ofdm(dev, 0x26, 0x90);
+       rtl8225_write_phy_ofdm(dev, 0x27, 0x88);
+
+       rtl8225_write_phy_ofdm(dev, 0x0d, rtl8225_gain[2 * 4]);
+       rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225_gain[2 * 4 + 2]);
+       rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225_gain[2 * 4 + 3]);
+       rtl8225_write_phy_ofdm(dev, 0x23, rtl8225_gain[2 * 4 + 1]);
+
+       rtl8225_write_phy_cck(dev, 0x00, 0x98);
+       rtl8225_write_phy_cck(dev, 0x03, 0x20);
+       rtl8225_write_phy_cck(dev, 0x04, 0x7e);
+       rtl8225_write_phy_cck(dev, 0x05, 0x12);
+       rtl8225_write_phy_cck(dev, 0x06, 0xfc);
+       rtl8225_write_phy_cck(dev, 0x07, 0x78);
+       rtl8225_write_phy_cck(dev, 0x08, 0x2e);
+       rtl8225_write_phy_cck(dev, 0x10, 0x9b);
+       rtl8225_write_phy_cck(dev, 0x11, 0x88);
+       rtl8225_write_phy_cck(dev, 0x12, 0x47);
+       rtl8225_write_phy_cck(dev, 0x13, 0xd0);
+       rtl8225_write_phy_cck(dev, 0x19, 0x00);
+       rtl8225_write_phy_cck(dev, 0x1a, 0xa0);
+       rtl8225_write_phy_cck(dev, 0x1b, 0x08);
+       rtl8225_write_phy_cck(dev, 0x40, 0x86);
+       rtl8225_write_phy_cck(dev, 0x41, 0x8d);
+       rtl8225_write_phy_cck(dev, 0x42, 0x15);
+       rtl8225_write_phy_cck(dev, 0x43, 0x18);
+       rtl8225_write_phy_cck(dev, 0x44, 0x1f);
+       rtl8225_write_phy_cck(dev, 0x45, 0x1e);
+       rtl8225_write_phy_cck(dev, 0x46, 0x1a);
+       rtl8225_write_phy_cck(dev, 0x47, 0x15);
+       rtl8225_write_phy_cck(dev, 0x48, 0x10);
+       rtl8225_write_phy_cck(dev, 0x49, 0x0a);
+       rtl8225_write_phy_cck(dev, 0x4a, 0x05);
+       rtl8225_write_phy_cck(dev, 0x4b, 0x02);
+       rtl8225_write_phy_cck(dev, 0x4c, 0x05);
+
+       rtl818x_iowrite8(priv, &priv->map->TESTR, 0x0D);
+
+       rtl8225_rf_set_tx_power(dev, 1);
+
+       /* RX antenna default to A */
+       rtl8225_write_phy_cck(dev, 0x10, 0x9b);                 /* B: 0xDB */
+       rtl8225_write_phy_ofdm(dev, 0x26, 0x90);                /* B: 0x10 */
+
+       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);   /* B: 0x00 */
+       msleep(1);
+       rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002);
+
+       /* set sensitivity */
+       rtl8225_write(dev, 0x0c, 0x50);
+       rtl8225_write_phy_ofdm(dev, 0x0d, rtl8225_gain[2 * 4]);
+       rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225_gain[2 * 4 + 2]);
+       rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225_gain[2 * 4 + 3]);
+       rtl8225_write_phy_ofdm(dev, 0x23, rtl8225_gain[2 * 4 + 1]);
+       rtl8225_write_phy_cck(dev, 0x41, rtl8225_threshold[2]);
+}
+
+static const u8 rtl8225z2_agc[] = {
+       0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, 0x55, 0x53, 0x51, 0x4f,
+       0x4d, 0x4b, 0x49, 0x47, 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x39, 0x37,
+       0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25, 0x23, 0x21, 0x1f,
+       0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11, 0x0f, 0x0d, 0x0b, 0x09, 0x07,
+       0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+       0x01, 0x01, 0x01, 0x01, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
+       0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28,
+       0x28, 0x29, 0x2a, 0x2a, 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d,
+       0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30,
+       0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
+       0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31
+};
+static const u8 rtl8225z2_ofdm[] = {
+       0x10, 0x0d, 0x01, 0x00, 0x14, 0xfb, 0xfb, 0x60,
+       0x00, 0x60, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00,
+       0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0xa8, 0x26,
+       0x32, 0x33, 0x07, 0xa5, 0x6f, 0x55, 0xc8, 0xb3,
+       0x0a, 0xe1, 0x2C, 0x8a, 0x86, 0x83, 0x34, 0x0f,
+       0x4f, 0x24, 0x6f, 0xc2, 0x6b, 0x40, 0x80, 0x00,
+       0xc0, 0xc1, 0x58, 0xf1, 0x00, 0xe4, 0x90, 0x3e,
+       0x6d, 0x3c, 0xfb, 0x07
+};
+
+static const u8 rtl8225z2_tx_power_cck_ch14[] = {
+       0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00,
+       0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00,
+       0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00,
+       0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00
+};
+
+static const u8 rtl8225z2_tx_power_cck[] = {
+       0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04,
+       0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03,
+       0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03,
+       0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03
+};
+
+static const u8 rtl8225z2_tx_power_ofdm[] = {
+       0x42, 0x00, 0x40, 0x00, 0x40
+};
+
+static const u8 rtl8225z2_tx_gain_cck_ofdm[] = {
+       0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+       0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+       0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
+       0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
+       0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23
+};
+
+static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u8 cck_power, ofdm_power;
+       const u8 *tmp;
+       u32 reg;
+       int i;
+
+       cck_power = priv->channels[channel - 1].hw_value & 0xF;
+       ofdm_power = priv->channels[channel - 1].hw_value >> 4;
+
+       cck_power = min(cck_power, (u8)15);
+       cck_power += priv->txpwr_base & 0xF;
+       cck_power = min(cck_power, (u8)35);
+
+       if (ofdm_power > (u8)15)
+               ofdm_power = 25;
+       else
+               ofdm_power += 10;
+       ofdm_power += priv->txpwr_base >> 4;
+       ofdm_power = min(ofdm_power, (u8)35);
+
+       if (channel == 14)
+               tmp = rtl8225z2_tx_power_cck_ch14;
+       else
+               tmp = rtl8225z2_tx_power_cck;
+
+       for (i = 0; i < 8; i++)
+               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
+                        rtl8225z2_tx_gain_cck_ofdm[cck_power]);
+       msleep(1);
+
+       /* anaparam2 on */
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
+                       reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2,
+                         RTL8187_RTL8225_ANAPARAM2_ON);
+       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
+                       reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+
+       rtl8225_write_phy_ofdm(dev, 2, 0x42);
+       rtl8225_write_phy_ofdm(dev, 5, 0x00);
+       rtl8225_write_phy_ofdm(dev, 6, 0x40);
+       rtl8225_write_phy_ofdm(dev, 7, 0x00);
+       rtl8225_write_phy_ofdm(dev, 8, 0x40);
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM,
+                        rtl8225z2_tx_gain_cck_ofdm[ofdm_power]);
+       msleep(1);
+}
+
+static void rtl8225z2_b_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       u8 cck_power, ofdm_power;
+       const u8 *tmp;
+       int i;
+
+       cck_power = priv->channels[channel - 1].hw_value & 0xF;
+       ofdm_power = priv->channels[channel - 1].hw_value >> 4;
+
+       if (cck_power > 15)
+               cck_power = (priv->hw_rev == RTL8187BvB) ? 15 : 22;
+       else
+               cck_power += (priv->hw_rev == RTL8187BvB) ? 0 : 7;
+       cck_power += priv->txpwr_base & 0xF;
+       cck_power = min(cck_power, (u8)35);
+
+       if (ofdm_power > 15)
+               ofdm_power = (priv->hw_rev == RTL8187BvB) ? 17 : 25;
+       else
+               ofdm_power += (priv->hw_rev == RTL8187BvB) ? 2 : 10;
+       ofdm_power += (priv->txpwr_base >> 4) & 0xF;
+       ofdm_power = min(ofdm_power, (u8)35);
+
+       if (channel == 14)
+               tmp = rtl8225z2_tx_power_cck_ch14;
+       else
+               tmp = rtl8225z2_tx_power_cck;
+
+       if (priv->hw_rev == RTL8187BvB) {
+               if (cck_power <= 6)
+                       ; /* do nothing */
+               else if (cck_power <= 11)
+                       tmp += 8;
+               else
+                       tmp += 16;
+       } else {
+               if (cck_power <= 5)
+                       ; /* do nothing */
+               else if (cck_power <= 11)
+                       tmp += 8;
+               else if (cck_power <= 17)
+                       tmp += 16;
+               else
+                       tmp += 24;
+       }
+
+       for (i = 0; i < 8; i++)
+               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
+                        rtl8225z2_tx_gain_cck_ofdm[cck_power] << 1);
+       msleep(1);
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM,
+                        rtl8225z2_tx_gain_cck_ofdm[ofdm_power] << 1);
+       if (priv->hw_rev == RTL8187BvB) {
+               if (ofdm_power <= 11) {
+                       rtl8225_write_phy_ofdm(dev, 0x87, 0x60);
+                       rtl8225_write_phy_ofdm(dev, 0x89, 0x60);
+               } else {
+                       rtl8225_write_phy_ofdm(dev, 0x87, 0x5c);
+                       rtl8225_write_phy_ofdm(dev, 0x89, 0x5c);
+               }
+       } else {
+               if (ofdm_power <= 11) {
+                       rtl8225_write_phy_ofdm(dev, 0x87, 0x5c);
+                       rtl8225_write_phy_ofdm(dev, 0x89, 0x5c);
+               } else if (ofdm_power <= 17) {
+                       rtl8225_write_phy_ofdm(dev, 0x87, 0x54);
+                       rtl8225_write_phy_ofdm(dev, 0x89, 0x54);
+               } else {
+                       rtl8225_write_phy_ofdm(dev, 0x87, 0x50);
+                       rtl8225_write_phy_ofdm(dev, 0x89, 0x50);
+               }
+       }
+       msleep(1);
+}
+
+static const u16 rtl8225z2_rxgain[] = {
+       0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
+       0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+       0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
+       0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+       0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
+       0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
+       0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
+       0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
+       0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+       0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+       0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
+       0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
+};
+
+static const u8 rtl8225z2_gain_bg[] = {
+       0x23, 0x15, 0xa5, /* -82-1dBm */
+       0x23, 0x15, 0xb5, /* -82-2dBm */
+       0x23, 0x15, 0xc5, /* -82-3dBm */
+       0x33, 0x15, 0xc5, /* -78dBm */
+       0x43, 0x15, 0xc5, /* -74dBm */
+       0x53, 0x15, 0xc5, /* -70dBm */
+       0x63, 0x15, 0xc5  /* -66dBm */
+};
+
+static void rtl8225z2_rf_init(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       int i;
+
+       rtl8225_write(dev, 0x0, 0x2BF);
+       rtl8225_write(dev, 0x1, 0xEE0);
+       rtl8225_write(dev, 0x2, 0x44D);
+       rtl8225_write(dev, 0x3, 0x441);
+       rtl8225_write(dev, 0x4, 0x8C3);
+       rtl8225_write(dev, 0x5, 0xC72);
+       rtl8225_write(dev, 0x6, 0x0E6);
+       rtl8225_write(dev, 0x7, 0x82A);
+       rtl8225_write(dev, 0x8, 0x03F);
+       rtl8225_write(dev, 0x9, 0x335);
+       rtl8225_write(dev, 0xa, 0x9D4);
+       rtl8225_write(dev, 0xb, 0x7BB);
+       rtl8225_write(dev, 0xc, 0x850);
+       rtl8225_write(dev, 0xd, 0xCDF);
+       rtl8225_write(dev, 0xe, 0x02B);
+       rtl8225_write(dev, 0xf, 0x114);
+       msleep(100);
+
+       rtl8225_write(dev, 0x0, 0x1B7);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) {
+               rtl8225_write(dev, 0x1, i + 1);
+               rtl8225_write(dev, 0x2, rtl8225z2_rxgain[i]);
+       }
+
+       rtl8225_write(dev, 0x3, 0x080);
+       rtl8225_write(dev, 0x5, 0x004);
+       rtl8225_write(dev, 0x0, 0x0B7);
+       rtl8225_write(dev, 0x2, 0xc4D);
+
+       msleep(200);
+       rtl8225_write(dev, 0x2, 0x44D);
+       msleep(100);
+
+       if (!(rtl8225_read(dev, 6) & (1 << 7))) {
+               rtl8225_write(dev, 0x02, 0x0C4D);
+               msleep(200);
+               rtl8225_write(dev, 0x02, 0x044D);
+               msleep(100);
+               if (!(rtl8225_read(dev, 6) & (1 << 7)))
+                       wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n",
+                                  rtl8225_read(dev, 6));
+       }
+
+       msleep(200);
+
+       rtl8225_write(dev, 0x0, 0x2BF);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) {
+               rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]);
+               rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i);
+       }
+
+       msleep(1);
+
+       rtl8225_write_phy_ofdm(dev, 0x00, 0x01);
+       rtl8225_write_phy_ofdm(dev, 0x01, 0x02);
+       rtl8225_write_phy_ofdm(dev, 0x02, 0x42);
+       rtl8225_write_phy_ofdm(dev, 0x03, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x04, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x05, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x06, 0x40);
+       rtl8225_write_phy_ofdm(dev, 0x07, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x08, 0x40);
+       rtl8225_write_phy_ofdm(dev, 0x09, 0xfe);
+       rtl8225_write_phy_ofdm(dev, 0x0a, 0x08);
+       rtl8225_write_phy_ofdm(dev, 0x0b, 0x80);
+       rtl8225_write_phy_ofdm(dev, 0x0c, 0x01);
+       rtl8225_write_phy_ofdm(dev, 0x0d, 0x43);
+       rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3);
+       rtl8225_write_phy_ofdm(dev, 0x0f, 0x38);
+       rtl8225_write_phy_ofdm(dev, 0x10, 0x84);
+       rtl8225_write_phy_ofdm(dev, 0x11, 0x07);
+       rtl8225_write_phy_ofdm(dev, 0x12, 0x20);
+       rtl8225_write_phy_ofdm(dev, 0x13, 0x20);
+       rtl8225_write_phy_ofdm(dev, 0x14, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x15, 0x40);
+       rtl8225_write_phy_ofdm(dev, 0x16, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x17, 0x40);
+       rtl8225_write_phy_ofdm(dev, 0x18, 0xef);
+       rtl8225_write_phy_ofdm(dev, 0x19, 0x19);
+       rtl8225_write_phy_ofdm(dev, 0x1a, 0x20);
+       rtl8225_write_phy_ofdm(dev, 0x1b, 0x15);
+       rtl8225_write_phy_ofdm(dev, 0x1c, 0x04);
+       rtl8225_write_phy_ofdm(dev, 0x1d, 0xc5);
+       rtl8225_write_phy_ofdm(dev, 0x1e, 0x95);
+       rtl8225_write_phy_ofdm(dev, 0x1f, 0x75);
+       rtl8225_write_phy_ofdm(dev, 0x20, 0x1f);
+       rtl8225_write_phy_ofdm(dev, 0x21, 0x17);
+       rtl8225_write_phy_ofdm(dev, 0x22, 0x16);
+       rtl8225_write_phy_ofdm(dev, 0x23, 0x80);
+       rtl8225_write_phy_ofdm(dev, 0x24, 0x46);
+       rtl8225_write_phy_ofdm(dev, 0x25, 0x00);
+       rtl8225_write_phy_ofdm(dev, 0x26, 0x90);
+       rtl8225_write_phy_ofdm(dev, 0x27, 0x88);
+
+       rtl8225_write_phy_ofdm(dev, 0x0b, rtl8225z2_gain_bg[4 * 3]);
+       rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225z2_gain_bg[4 * 3 + 1]);
+       rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225z2_gain_bg[4 * 3 + 2]);
+       rtl8225_write_phy_ofdm(dev, 0x21, 0x37);
+
+       rtl8225_write_phy_cck(dev, 0x00, 0x98);
+       rtl8225_write_phy_cck(dev, 0x03, 0x20);
+       rtl8225_write_phy_cck(dev, 0x04, 0x7e);
+       rtl8225_write_phy_cck(dev, 0x05, 0x12);
+       rtl8225_write_phy_cck(dev, 0x06, 0xfc);
+       rtl8225_write_phy_cck(dev, 0x07, 0x78);
+       rtl8225_write_phy_cck(dev, 0x08, 0x2e);
+       rtl8225_write_phy_cck(dev, 0x10, 0x9b);
+       rtl8225_write_phy_cck(dev, 0x11, 0x88);
+       rtl8225_write_phy_cck(dev, 0x12, 0x47);
+       rtl8225_write_phy_cck(dev, 0x13, 0xd0);
+       rtl8225_write_phy_cck(dev, 0x19, 0x00);
+       rtl8225_write_phy_cck(dev, 0x1a, 0xa0);
+       rtl8225_write_phy_cck(dev, 0x1b, 0x08);
+       rtl8225_write_phy_cck(dev, 0x40, 0x86);
+       rtl8225_write_phy_cck(dev, 0x41, 0x8d);
+       rtl8225_write_phy_cck(dev, 0x42, 0x15);
+       rtl8225_write_phy_cck(dev, 0x43, 0x18);
+       rtl8225_write_phy_cck(dev, 0x44, 0x36);
+       rtl8225_write_phy_cck(dev, 0x45, 0x35);
+       rtl8225_write_phy_cck(dev, 0x46, 0x2e);
+       rtl8225_write_phy_cck(dev, 0x47, 0x25);
+       rtl8225_write_phy_cck(dev, 0x48, 0x1c);
+       rtl8225_write_phy_cck(dev, 0x49, 0x12);
+       rtl8225_write_phy_cck(dev, 0x4a, 0x09);
+       rtl8225_write_phy_cck(dev, 0x4b, 0x04);
+       rtl8225_write_phy_cck(dev, 0x4c, 0x05);
+
+       rtl818x_iowrite8(priv, (u8 *)0xFF5B, 0x0D); msleep(1);
+
+       rtl8225z2_rf_set_tx_power(dev, 1);
+
+       /* RX antenna default to A */
+       rtl8225_write_phy_cck(dev, 0x10, 0x9b);                 /* B: 0xDB */
+       rtl8225_write_phy_ofdm(dev, 0x26, 0x90);                /* B: 0x10 */
+
+       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);   /* B: 0x00 */
+       msleep(1);
+       rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002);
+}
+
+static void rtl8225z2_b_rf_init(struct ieee80211_hw *dev)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       int i;
+
+       rtl8225_write(dev, 0x0, 0x0B7);
+       rtl8225_write(dev, 0x1, 0xEE0);
+       rtl8225_write(dev, 0x2, 0x44D);
+       rtl8225_write(dev, 0x3, 0x441);
+       rtl8225_write(dev, 0x4, 0x8C3);
+       rtl8225_write(dev, 0x5, 0xC72);
+       rtl8225_write(dev, 0x6, 0x0E6);
+       rtl8225_write(dev, 0x7, 0x82A);
+       rtl8225_write(dev, 0x8, 0x03F);
+       rtl8225_write(dev, 0x9, 0x335);
+       rtl8225_write(dev, 0xa, 0x9D4);
+       rtl8225_write(dev, 0xb, 0x7BB);
+       rtl8225_write(dev, 0xc, 0x850);
+       rtl8225_write(dev, 0xd, 0xCDF);
+       rtl8225_write(dev, 0xe, 0x02B);
+       rtl8225_write(dev, 0xf, 0x114);
+
+       rtl8225_write(dev, 0x0, 0x1B7);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) {
+               rtl8225_write(dev, 0x1, i + 1);
+               rtl8225_write(dev, 0x2, rtl8225z2_rxgain[i]);
+       }
+
+       rtl8225_write(dev, 0x3, 0x080);
+       rtl8225_write(dev, 0x5, 0x004);
+       rtl8225_write(dev, 0x0, 0x0B7);
+
+       rtl8225_write(dev, 0x2, 0xC4D);
+
+       rtl8225_write(dev, 0x2, 0x44D);
+       rtl8225_write(dev, 0x0, 0x2BF);
+
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, 0x03);
+       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, 0x07);
+       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);
+
+       rtl8225_write_phy_ofdm(dev, 0x80, 0x12);
+       for (i = 0; i < ARRAY_SIZE(rtl8225z2_agc); i++) {
+               rtl8225_write_phy_ofdm(dev, 0xF, rtl8225z2_agc[i]);
+               rtl8225_write_phy_ofdm(dev, 0xE, 0x80 + i);
+               rtl8225_write_phy_ofdm(dev, 0xE, 0);
+       }
+       rtl8225_write_phy_ofdm(dev, 0x80, 0x10);
+
+       for (i = 0; i < ARRAY_SIZE(rtl8225z2_ofdm); i++)
+               rtl8225_write_phy_ofdm(dev, i, rtl8225z2_ofdm[i]);
+
+       rtl8225_write_phy_ofdm(dev, 0x97, 0x46);
+       rtl8225_write_phy_ofdm(dev, 0xa4, 0xb6);
+       rtl8225_write_phy_ofdm(dev, 0x85, 0xfc);
+       rtl8225_write_phy_cck(dev, 0xc1, 0x88);
+}
+
+static void rtl8225_rf_stop(struct ieee80211_hw *dev)
+{
+       rtl8225_write(dev, 0x4, 0x1f);
+}
+
+static void rtl8225_rf_set_channel(struct ieee80211_hw *dev,
+                                  struct ieee80211_conf *conf)
+{
+       struct rtl8187_priv *priv = dev->priv;
+       int chan = ieee80211_frequency_to_channel(conf->channel->center_freq);
+
+       if (priv->rf->init == rtl8225_rf_init)
+               rtl8225_rf_set_tx_power(dev, chan);
+       else if (priv->rf->init == rtl8225z2_rf_init)
+               rtl8225z2_rf_set_tx_power(dev, chan);
+       else
+               rtl8225z2_b_rf_set_tx_power(dev, chan);
+
+       rtl8225_write(dev, 0x7, rtl8225_chan[chan - 1]);
+       msleep(10);
+}
+
+static const struct rtl818x_rf_ops rtl8225_ops = {
+       .name           = "rtl8225",
+       .init           = rtl8225_rf_init,
+       .stop           = rtl8225_rf_stop,
+       .set_chan       = rtl8225_rf_set_channel
+};
+
+static const struct rtl818x_rf_ops rtl8225z2_ops = {
+       .name           = "rtl8225z2",
+       .init           = rtl8225z2_rf_init,
+       .stop           = rtl8225_rf_stop,
+       .set_chan       = rtl8225_rf_set_channel
+};
+
+static const struct rtl818x_rf_ops rtl8225z2_b_ops = {
+       .name           = "rtl8225z2",
+       .init           = rtl8225z2_b_rf_init,
+       .stop           = rtl8225_rf_stop,
+       .set_chan       = rtl8225_rf_set_channel
+};
+
+const struct rtl818x_rf_ops * rtl8187_detect_rf(struct ieee80211_hw *dev)
+{
+       u16 reg8, reg9;
+       struct rtl8187_priv *priv = dev->priv;
+
+       if (!priv->is_rtl8187b) {
+               rtl8225_write(dev, 0, 0x1B7);
+
+               reg8 = rtl8225_read(dev, 8);
+               reg9 = rtl8225_read(dev, 9);
+
+               rtl8225_write(dev, 0, 0x0B7);
+
+               if (reg8 != 0x588 || reg9 != 0x700)
+                       return &rtl8225_ops;
+
+               return &rtl8225z2_ops;
+       } else
+               return &rtl8225z2_b_ops;
+}
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.h
new file mode 100644 (file)
index 0000000..20c5b6e
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Radio tuning definitions for RTL8225 on RTL8187
+ *
+ * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
+ *
+ * Based on the r8187 driver, which is:
+ * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef RTL8187_RTL8225_H
+#define RTL8187_RTL8225_H
+
+#define RTL8187_RTL8225_ANAPARAM_ON    0xa0000a59
+#define RTL8187_RTL8225_ANAPARAM2_ON   0x860c7312
+#define RTL8187_RTL8225_ANAPARAM_OFF   0xa00beb59
+#define RTL8187_RTL8225_ANAPARAM2_OFF  0x840dec11
+
+#define RTL8187B_RTL8225_ANAPARAM_ON   0x45090658
+#define RTL8187B_RTL8225_ANAPARAM2_ON  0x727f3f52
+#define RTL8187B_RTL8225_ANAPARAM3_ON  0x00
+#define RTL8187B_RTL8225_ANAPARAM_OFF  0x55480658
+#define RTL8187B_RTL8225_ANAPARAM2_OFF 0x72003f50
+#define RTL8187B_RTL8225_ANAPARAM3_OFF 0x00
+
+const struct rtl818x_rf_ops * rtl8187_detect_rf(struct ieee80211_hw *);
+
+static inline void rtl8225_write_phy_ofdm(struct ieee80211_hw *dev,
+                                         u8 addr, u32 data)
+{
+       rtl8187_write_phy(dev, addr, data);
+}
+
+static inline void rtl8225_write_phy_cck(struct ieee80211_hw *dev,
+                                        u8 addr, u32 data)
+{
+       rtl8187_write_phy(dev, addr, data | 0x10000);
+}
+
+#endif /* RTL8187_RTL8225_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
deleted file mode 100644 (file)
index eeee244..0000000
+++ /dev/null
@@ -1,1591 +0,0 @@
-/*
- * Linux device driver for RTL8187
- *
- * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Based on the r8187 driver, which is:
- * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
- *
- * The driver was extended to the RTL8187B in 2008 by:
- *     Herton Ronaldo Krzesinski <herton@mandriva.com.br>
- *     Hin-Tak Leung <htl10@users.sourceforge.net>
- *     Larry Finger <Larry.Finger@lwfinger.net>
- *
- * Magic delays and register offsets below are taken from the original
- * r8187 driver sources.  Thanks to Realtek for their support!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/usb.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/etherdevice.h>
-#include <linux/eeprom_93cx6.h>
-#include <net/mac80211.h>
-
-#include "rtl8187.h"
-#include "rtl8187_rtl8225.h"
-#ifdef CONFIG_RTL8187_LEDS
-#include "rtl8187_leds.h"
-#endif
-#include "rtl8187_rfkill.h"
-
-MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
-MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
-MODULE_AUTHOR("Herton Ronaldo Krzesinski <herton@mandriva.com.br>");
-MODULE_AUTHOR("Hin-Tak Leung <htl10@users.sourceforge.net>");
-MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>");
-MODULE_DESCRIPTION("RTL8187/RTL8187B USB wireless driver");
-MODULE_LICENSE("GPL");
-
-static struct usb_device_id rtl8187_table[] __devinitdata = {
-       /* Asus */
-       {USB_DEVICE(0x0b05, 0x171d), .driver_info = DEVICE_RTL8187},
-       /* Belkin */
-       {USB_DEVICE(0x050d, 0x705e), .driver_info = DEVICE_RTL8187B},
-       /* Realtek */
-       {USB_DEVICE(0x0bda, 0x8187), .driver_info = DEVICE_RTL8187},
-       {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B},
-       {USB_DEVICE(0x0bda, 0x8197), .driver_info = DEVICE_RTL8187B},
-       {USB_DEVICE(0x0bda, 0x8198), .driver_info = DEVICE_RTL8187B},
-       /* Surecom */
-       {USB_DEVICE(0x0769, 0x11F2), .driver_info = DEVICE_RTL8187},
-       /* Logitech */
-       {USB_DEVICE(0x0789, 0x010C), .driver_info = DEVICE_RTL8187},
-       /* Netgear */
-       {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187},
-       {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187},
-       {USB_DEVICE(0x0846, 0x4260), .driver_info = DEVICE_RTL8187B},
-       /* HP */
-       {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187},
-       /* Sitecom */
-       {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
-       {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
-       {USB_DEVICE(0x0df6, 0x0029), .driver_info = DEVICE_RTL8187B},
-       /* Sphairon Access Systems GmbH */
-       {USB_DEVICE(0x114B, 0x0150), .driver_info = DEVICE_RTL8187},
-       /* Dick Smith Electronics */
-       {USB_DEVICE(0x1371, 0x9401), .driver_info = DEVICE_RTL8187},
-       /* Abocom */
-       {USB_DEVICE(0x13d1, 0xabe6), .driver_info = DEVICE_RTL8187},
-       /* Qcom */
-       {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187},
-       /* AirLive */
-       {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187},
-       /* Linksys */
-       {USB_DEVICE(0x1737, 0x0073), .driver_info = DEVICE_RTL8187B},
-       {}
-};
-
-MODULE_DEVICE_TABLE(usb, rtl8187_table);
-
-static const struct ieee80211_rate rtl818x_rates[] = {
-       { .bitrate = 10, .hw_value = 0, },
-       { .bitrate = 20, .hw_value = 1, },
-       { .bitrate = 55, .hw_value = 2, },
-       { .bitrate = 110, .hw_value = 3, },
-       { .bitrate = 60, .hw_value = 4, },
-       { .bitrate = 90, .hw_value = 5, },
-       { .bitrate = 120, .hw_value = 6, },
-       { .bitrate = 180, .hw_value = 7, },
-       { .bitrate = 240, .hw_value = 8, },
-       { .bitrate = 360, .hw_value = 9, },
-       { .bitrate = 480, .hw_value = 10, },
-       { .bitrate = 540, .hw_value = 11, },
-};
-
-static const struct ieee80211_channel rtl818x_channels[] = {
-       { .center_freq = 2412 },
-       { .center_freq = 2417 },
-       { .center_freq = 2422 },
-       { .center_freq = 2427 },
-       { .center_freq = 2432 },
-       { .center_freq = 2437 },
-       { .center_freq = 2442 },
-       { .center_freq = 2447 },
-       { .center_freq = 2452 },
-       { .center_freq = 2457 },
-       { .center_freq = 2462 },
-       { .center_freq = 2467 },
-       { .center_freq = 2472 },
-       { .center_freq = 2484 },
-};
-
-static void rtl8187_iowrite_async_cb(struct urb *urb)
-{
-       kfree(urb->context);
-}
-
-static void rtl8187_iowrite_async(struct rtl8187_priv *priv, __le16 addr,
-                                 void *data, u16 len)
-{
-       struct usb_ctrlrequest *dr;
-       struct urb *urb;
-       struct rtl8187_async_write_data {
-               u8 data[4];
-               struct usb_ctrlrequest dr;
-       } *buf;
-       int rc;
-
-       buf = kmalloc(sizeof(*buf), GFP_ATOMIC);
-       if (!buf)
-               return;
-
-       urb = usb_alloc_urb(0, GFP_ATOMIC);
-       if (!urb) {
-               kfree(buf);
-               return;
-       }
-
-       dr = &buf->dr;
-
-       dr->bRequestType = RTL8187_REQT_WRITE;
-       dr->bRequest = RTL8187_REQ_SET_REG;
-       dr->wValue = addr;
-       dr->wIndex = 0;
-       dr->wLength = cpu_to_le16(len);
-
-       memcpy(buf, data, len);
-
-       usb_fill_control_urb(urb, priv->udev, usb_sndctrlpipe(priv->udev, 0),
-                            (unsigned char *)dr, buf, len,
-                            rtl8187_iowrite_async_cb, buf);
-       usb_anchor_urb(urb, &priv->anchored);
-       rc = usb_submit_urb(urb, GFP_ATOMIC);
-       if (rc < 0) {
-               kfree(buf);
-               usb_unanchor_urb(urb);
-       }
-       usb_free_urb(urb);
-}
-
-static inline void rtl818x_iowrite32_async(struct rtl8187_priv *priv,
-                                          __le32 *addr, u32 val)
-{
-       __le32 buf = cpu_to_le32(val);
-
-       rtl8187_iowrite_async(priv, cpu_to_le16((unsigned long)addr),
-                             &buf, sizeof(buf));
-}
-
-void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data)
-{
-       struct rtl8187_priv *priv = dev->priv;
-
-       data <<= 8;
-       data |= addr | 0x80;
-
-       rtl818x_iowrite8(priv, &priv->map->PHY[3], (data >> 24) & 0xFF);
-       rtl818x_iowrite8(priv, &priv->map->PHY[2], (data >> 16) & 0xFF);
-       rtl818x_iowrite8(priv, &priv->map->PHY[1], (data >> 8) & 0xFF);
-       rtl818x_iowrite8(priv, &priv->map->PHY[0], data & 0xFF);
-}
-
-static void rtl8187_tx_cb(struct urb *urb)
-{
-       struct sk_buff *skb = (struct sk_buff *)urb->context;
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       struct ieee80211_hw *hw = info->rate_driver_data[0];
-       struct rtl8187_priv *priv = hw->priv;
-
-       skb_pull(skb, priv->is_rtl8187b ? sizeof(struct rtl8187b_tx_hdr) :
-                                         sizeof(struct rtl8187_tx_hdr));
-       ieee80211_tx_info_clear_status(info);
-
-       if (!(urb->status) && !(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
-               if (priv->is_rtl8187b) {
-                       skb_queue_tail(&priv->b_tx_status.queue, skb);
-
-                       /* queue is "full", discard last items */
-                       while (skb_queue_len(&priv->b_tx_status.queue) > 5) {
-                               struct sk_buff *old_skb;
-
-                               dev_dbg(&priv->udev->dev,
-                                       "transmit status queue full\n");
-
-                               old_skb = skb_dequeue(&priv->b_tx_status.queue);
-                               ieee80211_tx_status_irqsafe(hw, old_skb);
-                       }
-                       return;
-               } else {
-                       info->flags |= IEEE80211_TX_STAT_ACK;
-               }
-       }
-       if (priv->is_rtl8187b)
-               ieee80211_tx_status_irqsafe(hw, skb);
-       else {
-               /* Retry information for the RTI8187 is only available by
-                * reading a register in the device. We are in interrupt mode
-                * here, thus queue the skb and finish on a work queue. */
-               skb_queue_tail(&priv->b_tx_status.queue, skb);
-               ieee80211_queue_delayed_work(hw, &priv->work, 0);
-       }
-}
-
-static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       unsigned int ep;
-       void *buf;
-       struct urb *urb;
-       __le16 rts_dur = 0;
-       u32 flags;
-       int rc;
-
-       urb = usb_alloc_urb(0, GFP_ATOMIC);
-       if (!urb) {
-               kfree_skb(skb);
-               return NETDEV_TX_OK;
-       }
-
-       flags = skb->len;
-       flags |= RTL818X_TX_DESC_FLAG_NO_ENC;
-
-       flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24;
-       if (ieee80211_has_morefrags(((struct ieee80211_hdr *)skb->data)->frame_control))
-               flags |= RTL818X_TX_DESC_FLAG_MOREFRAG;
-       if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
-               flags |= RTL818X_TX_DESC_FLAG_RTS;
-               flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
-               rts_dur = ieee80211_rts_duration(dev, priv->vif,
-                                                skb->len, info);
-       } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
-               flags |= RTL818X_TX_DESC_FLAG_CTS;
-               flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
-       }
-
-       if (!priv->is_rtl8187b) {
-               struct rtl8187_tx_hdr *hdr =
-                       (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr));
-               hdr->flags = cpu_to_le32(flags);
-               hdr->len = 0;
-               hdr->rts_duration = rts_dur;
-               hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
-               buf = hdr;
-
-               ep = 2;
-       } else {
-               /* fc needs to be calculated before skb_push() */
-               unsigned int epmap[4] = { 6, 7, 5, 4 };
-               struct ieee80211_hdr *tx_hdr =
-                       (struct ieee80211_hdr *)(skb->data);
-               u16 fc = le16_to_cpu(tx_hdr->frame_control);
-
-               struct rtl8187b_tx_hdr *hdr =
-                       (struct rtl8187b_tx_hdr *)skb_push(skb, sizeof(*hdr));
-               struct ieee80211_rate *txrate =
-                       ieee80211_get_tx_rate(dev, info);
-               memset(hdr, 0, sizeof(*hdr));
-               hdr->flags = cpu_to_le32(flags);
-               hdr->rts_duration = rts_dur;
-               hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
-               hdr->tx_duration =
-                       ieee80211_generic_frame_duration(dev, priv->vif,
-                                                        skb->len, txrate);
-               buf = hdr;
-
-               if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)
-                       ep = 12;
-               else
-                       ep = epmap[skb_get_queue_mapping(skb)];
-       }
-
-       info->rate_driver_data[0] = dev;
-       info->rate_driver_data[1] = urb;
-
-       usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, ep),
-                         buf, skb->len, rtl8187_tx_cb, skb);
-       urb->transfer_flags |= URB_ZERO_PACKET;
-       usb_anchor_urb(urb, &priv->anchored);
-       rc = usb_submit_urb(urb, GFP_ATOMIC);
-       if (rc < 0) {
-               usb_unanchor_urb(urb);
-               kfree_skb(skb);
-       }
-       usb_free_urb(urb);
-
-       return NETDEV_TX_OK;
-}
-
-static void rtl8187_rx_cb(struct urb *urb)
-{
-       struct sk_buff *skb = (struct sk_buff *)urb->context;
-       struct rtl8187_rx_info *info = (struct rtl8187_rx_info *)skb->cb;
-       struct ieee80211_hw *dev = info->dev;
-       struct rtl8187_priv *priv = dev->priv;
-       struct ieee80211_rx_status rx_status = { 0 };
-       int rate, signal;
-       u32 flags;
-       unsigned long f;
-
-       spin_lock_irqsave(&priv->rx_queue.lock, f);
-       __skb_unlink(skb, &priv->rx_queue);
-       spin_unlock_irqrestore(&priv->rx_queue.lock, f);
-       skb_put(skb, urb->actual_length);
-
-       if (unlikely(urb->status)) {
-               dev_kfree_skb_irq(skb);
-               return;
-       }
-
-       if (!priv->is_rtl8187b) {
-               struct rtl8187_rx_hdr *hdr =
-                       (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
-               flags = le32_to_cpu(hdr->flags);
-               /* As with the RTL8187B below, the AGC is used to calculate
-                * signal strength. In this case, the scaling
-                * constants are derived from the output of p54usb.
-                */
-               signal = -4 - ((27 * hdr->agc) >> 6);
-               rx_status.antenna = (hdr->signal >> 7) & 1;
-               rx_status.mactime = le64_to_cpu(hdr->mac_time);
-       } else {
-               struct rtl8187b_rx_hdr *hdr =
-                       (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
-               /* The Realtek datasheet for the RTL8187B shows that the RX
-                * header contains the following quantities: signal quality,
-                * RSSI, AGC, the received power in dB, and the measured SNR.
-                * In testing, none of these quantities show qualitative
-                * agreement with AP signal strength, except for the AGC,
-                * which is inversely proportional to the strength of the
-                * signal. In the following, the signal strength
-                * is derived from the AGC. The arbitrary scaling constants
-                * are chosen to make the results close to the values obtained
-                * for a BCM4312 using b43 as the driver. The noise is ignored
-                * for now.
-                */
-               flags = le32_to_cpu(hdr->flags);
-               signal = 14 - hdr->agc / 2;
-               rx_status.antenna = (hdr->rssi >> 7) & 1;
-               rx_status.mactime = le64_to_cpu(hdr->mac_time);
-       }
-
-       rx_status.signal = signal;
-       priv->signal = signal;
-       rate = (flags >> 20) & 0xF;
-       skb_trim(skb, flags & 0x0FFF);
-       rx_status.rate_idx = rate;
-       rx_status.freq = dev->conf.channel->center_freq;
-       rx_status.band = dev->conf.channel->band;
-       rx_status.flag |= RX_FLAG_TSFT;
-       if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR)
-               rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
-       memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
-       ieee80211_rx_irqsafe(dev, skb);
-
-       skb = dev_alloc_skb(RTL8187_MAX_RX);
-       if (unlikely(!skb)) {
-               /* TODO check rx queue length and refill *somewhere* */
-               return;
-       }
-
-       info = (struct rtl8187_rx_info *)skb->cb;
-       info->urb = urb;
-       info->dev = dev;
-       urb->transfer_buffer = skb_tail_pointer(skb);
-       urb->context = skb;
-       skb_queue_tail(&priv->rx_queue, skb);
-
-       usb_anchor_urb(urb, &priv->anchored);
-       if (usb_submit_urb(urb, GFP_ATOMIC)) {
-               usb_unanchor_urb(urb);
-               skb_unlink(skb, &priv->rx_queue);
-               dev_kfree_skb_irq(skb);
-       }
-}
-
-static int rtl8187_init_urbs(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       struct urb *entry = NULL;
-       struct sk_buff *skb;
-       struct rtl8187_rx_info *info;
-       int ret = 0;
-
-       while (skb_queue_len(&priv->rx_queue) < 16) {
-               skb = __dev_alloc_skb(RTL8187_MAX_RX, GFP_KERNEL);
-               if (!skb) {
-                       ret = -ENOMEM;
-                       goto err;
-               }
-               entry = usb_alloc_urb(0, GFP_KERNEL);
-               if (!entry) {
-                       ret = -ENOMEM;
-                       goto err;
-               }
-               usb_fill_bulk_urb(entry, priv->udev,
-                                 usb_rcvbulkpipe(priv->udev,
-                                 priv->is_rtl8187b ? 3 : 1),
-                                 skb_tail_pointer(skb),
-                                 RTL8187_MAX_RX, rtl8187_rx_cb, skb);
-               info = (struct rtl8187_rx_info *)skb->cb;
-               info->urb = entry;
-               info->dev = dev;
-               skb_queue_tail(&priv->rx_queue, skb);
-               usb_anchor_urb(entry, &priv->anchored);
-               ret = usb_submit_urb(entry, GFP_KERNEL);
-               if (ret) {
-                       skb_unlink(skb, &priv->rx_queue);
-                       usb_unanchor_urb(entry);
-                       goto err;
-               }
-               usb_free_urb(entry);
-       }
-       return ret;
-
-err:
-       usb_free_urb(entry);
-       kfree_skb(skb);
-       usb_kill_anchored_urbs(&priv->anchored);
-       return ret;
-}
-
-static void rtl8187b_status_cb(struct urb *urb)
-{
-       struct ieee80211_hw *hw = (struct ieee80211_hw *)urb->context;
-       struct rtl8187_priv *priv = hw->priv;
-       u64 val;
-       unsigned int cmd_type;
-
-       if (unlikely(urb->status))
-               return;
-
-       /*
-        * Read from status buffer:
-        *
-        * bits [30:31] = cmd type:
-        * - 0 indicates tx beacon interrupt
-        * - 1 indicates tx close descriptor
-        *
-        * In the case of tx beacon interrupt:
-        * [0:9] = Last Beacon CW
-        * [10:29] = reserved
-        * [30:31] = 00b
-        * [32:63] = Last Beacon TSF
-        *
-        * If it's tx close descriptor:
-        * [0:7] = Packet Retry Count
-        * [8:14] = RTS Retry Count
-        * [15] = TOK
-        * [16:27] = Sequence No
-        * [28] = LS
-        * [29] = FS
-        * [30:31] = 01b
-        * [32:47] = unused (reserved?)
-        * [48:63] = MAC Used Time
-        */
-       val = le64_to_cpu(priv->b_tx_status.buf);
-
-       cmd_type = (val >> 30) & 0x3;
-       if (cmd_type == 1) {
-               unsigned int pkt_rc, seq_no;
-               bool tok;
-               struct sk_buff *skb;
-               struct ieee80211_hdr *ieee80211hdr;
-               unsigned long flags;
-
-               pkt_rc = val & 0xFF;
-               tok = val & (1 << 15);
-               seq_no = (val >> 16) & 0xFFF;
-
-               spin_lock_irqsave(&priv->b_tx_status.queue.lock, flags);
-               skb_queue_reverse_walk(&priv->b_tx_status.queue, skb) {
-                       ieee80211hdr = (struct ieee80211_hdr *)skb->data;
-
-                       /*
-                        * While testing, it was discovered that the seq_no
-                        * doesn't actually contains the sequence number.
-                        * Instead of returning just the 12 bits of sequence
-                        * number, hardware is returning entire sequence control
-                        * (fragment number plus sequence number) in a 12 bit
-                        * only field overflowing after some time. As a
-                        * workaround, just consider the lower bits, and expect
-                        * it's unlikely we wrongly ack some sent data
-                        */
-                       if ((le16_to_cpu(ieee80211hdr->seq_ctrl)
-                           & 0xFFF) == seq_no)
-                               break;
-               }
-               if (skb != (struct sk_buff *) &priv->b_tx_status.queue) {
-                       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-
-                       __skb_unlink(skb, &priv->b_tx_status.queue);
-                       if (tok)
-                               info->flags |= IEEE80211_TX_STAT_ACK;
-                       info->status.rates[0].count = pkt_rc + 1;
-
-                       ieee80211_tx_status_irqsafe(hw, skb);
-               }
-               spin_unlock_irqrestore(&priv->b_tx_status.queue.lock, flags);
-       }
-
-       usb_anchor_urb(urb, &priv->anchored);
-       if (usb_submit_urb(urb, GFP_ATOMIC))
-               usb_unanchor_urb(urb);
-}
-
-static int rtl8187b_init_status_urb(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       struct urb *entry;
-       int ret = 0;
-
-       entry = usb_alloc_urb(0, GFP_KERNEL);
-       if (!entry)
-               return -ENOMEM;
-
-       usb_fill_bulk_urb(entry, priv->udev, usb_rcvbulkpipe(priv->udev, 9),
-                         &priv->b_tx_status.buf, sizeof(priv->b_tx_status.buf),
-                         rtl8187b_status_cb, dev);
-
-       usb_anchor_urb(entry, &priv->anchored);
-       ret = usb_submit_urb(entry, GFP_KERNEL);
-       if (ret)
-               usb_unanchor_urb(entry);
-       usb_free_urb(entry);
-
-       return ret;
-}
-
-static void rtl8187_set_anaparam(struct rtl8187_priv *priv, bool rfon)
-{
-       u32 anaparam, anaparam2;
-       u8 anaparam3, reg;
-
-       if (!priv->is_rtl8187b) {
-               if (rfon) {
-                       anaparam = RTL8187_RTL8225_ANAPARAM_ON;
-                       anaparam2 = RTL8187_RTL8225_ANAPARAM2_ON;
-               } else {
-                       anaparam = RTL8187_RTL8225_ANAPARAM_OFF;
-                       anaparam2 = RTL8187_RTL8225_ANAPARAM2_OFF;
-               }
-       } else {
-               if (rfon) {
-                       anaparam = RTL8187B_RTL8225_ANAPARAM_ON;
-                       anaparam2 = RTL8187B_RTL8225_ANAPARAM2_ON;
-                       anaparam3 = RTL8187B_RTL8225_ANAPARAM3_ON;
-               } else {
-                       anaparam = RTL8187B_RTL8225_ANAPARAM_OFF;
-                       anaparam2 = RTL8187B_RTL8225_ANAPARAM2_OFF;
-                       anaparam3 = RTL8187B_RTL8225_ANAPARAM3_OFF;
-               }
-       }
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
-                        RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
-       reg |= RTL818X_CONFIG3_ANAPARAM_WRITE;
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
-       rtl818x_iowrite32(priv, &priv->map->ANAPARAM, anaparam);
-       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, anaparam2);
-       if (priv->is_rtl8187b)
-               rtl818x_iowrite8(priv, &priv->map->ANAPARAM3, anaparam3);
-       reg &= ~RTL818X_CONFIG3_ANAPARAM_WRITE;
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
-                        RTL818X_EEPROM_CMD_NORMAL);
-}
-
-static int rtl8187_cmd_reset(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u8 reg;
-       int i;
-
-       reg = rtl818x_ioread8(priv, &priv->map->CMD);
-       reg &= (1 << 1);
-       reg |= RTL818X_CMD_RESET;
-       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
-
-       i = 10;
-       do {
-               msleep(2);
-               if (!(rtl818x_ioread8(priv, &priv->map->CMD) &
-                     RTL818X_CMD_RESET))
-                       break;
-       } while (--i);
-
-       if (!i) {
-               wiphy_err(dev->wiphy, "Reset timeout!\n");
-               return -ETIMEDOUT;
-       }
-
-       /* reload registers from eeprom */
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_LOAD);
-
-       i = 10;
-       do {
-               msleep(4);
-               if (!(rtl818x_ioread8(priv, &priv->map->EEPROM_CMD) &
-                     RTL818X_EEPROM_CMD_CONFIG))
-                       break;
-       } while (--i);
-
-       if (!i) {
-               wiphy_err(dev->wiphy, "eeprom reset timeout!\n");
-               return -ETIMEDOUT;
-       }
-
-       return 0;
-}
-
-static int rtl8187_init_hw(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u8 reg;
-       int res;
-
-       /* reset */
-       rtl8187_set_anaparam(priv, true);
-
-       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
-
-       msleep(200);
-       rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x10);
-       rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x11);
-       rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x00);
-       msleep(200);
-
-       res = rtl8187_cmd_reset(dev);
-       if (res)
-               return res;
-
-       rtl8187_set_anaparam(priv, true);
-
-       /* setup card */
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0);
-       rtl818x_iowrite8(priv, &priv->map->GPIO0, 0);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8));
-       rtl818x_iowrite8(priv, &priv->map->GPIO0, 1);
-       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0);
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-
-       rtl818x_iowrite16(priv, (__le16 *)0xFFF4, 0xFFFF);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG1);
-       reg &= 0x3F;
-       reg |= 0x80;
-       rtl818x_iowrite8(priv, &priv->map->CONFIG1, reg);
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       rtl818x_iowrite32(priv, &priv->map->INT_TIMEOUT, 0);
-       rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0);
-       rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0);
-
-       // TODO: set RESP_RATE and BRSR properly
-       rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (8 << 4) | 0);
-       rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3);
-
-       /* host_usb_init */
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0);
-       rtl818x_iowrite8(priv, &priv->map->GPIO0, 0);
-       reg = rtl818x_ioread8(priv, (u8 *)0xFE53);
-       rtl818x_iowrite8(priv, (u8 *)0xFE53, reg | (1 << 7));
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, (4 << 8));
-       rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x20);
-       rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x80);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x80);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x80);
-       msleep(100);
-
-       rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x000a8008);
-       rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF);
-       rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
-                        RTL818X_EEPROM_CMD_CONFIG);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
-                        RTL818X_EEPROM_CMD_NORMAL);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FF7);
-       msleep(100);
-
-       priv->rf->init(dev);
-
-       rtl818x_iowrite16(priv, &priv->map->BRSR, 0x01F3);
-       reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~1;
-       rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg | 1);
-       rtl818x_iowrite16(priv, (__le16 *)0xFFFE, 0x10);
-       rtl818x_iowrite8(priv, &priv->map->TALLY_SEL, 0x80);
-       rtl818x_iowrite8(priv, (u8 *)0xFFFF, 0x60);
-       rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
-
-       return 0;
-}
-
-static const u8 rtl8187b_reg_table[][3] = {
-       {0xF0, 0x32, 0}, {0xF1, 0x32, 0}, {0xF2, 0x00, 0}, {0xF3, 0x00, 0},
-       {0xF4, 0x32, 0}, {0xF5, 0x43, 0}, {0xF6, 0x00, 0}, {0xF7, 0x00, 0},
-       {0xF8, 0x46, 0}, {0xF9, 0xA4, 0}, {0xFA, 0x00, 0}, {0xFB, 0x00, 0},
-       {0xFC, 0x96, 0}, {0xFD, 0xA4, 0}, {0xFE, 0x00, 0}, {0xFF, 0x00, 0},
-
-       {0x58, 0x4B, 1}, {0x59, 0x00, 1}, {0x5A, 0x4B, 1}, {0x5B, 0x00, 1},
-       {0x60, 0x4B, 1}, {0x61, 0x09, 1}, {0x62, 0x4B, 1}, {0x63, 0x09, 1},
-       {0xCE, 0x0F, 1}, {0xCF, 0x00, 1}, {0xF0, 0x4E, 1}, {0xF1, 0x01, 1},
-       {0xF2, 0x02, 1}, {0xF3, 0x03, 1}, {0xF4, 0x04, 1}, {0xF5, 0x05, 1},
-       {0xF6, 0x06, 1}, {0xF7, 0x07, 1}, {0xF8, 0x08, 1},
-
-       {0x4E, 0x00, 2}, {0x0C, 0x04, 2}, {0x21, 0x61, 2}, {0x22, 0x68, 2},
-       {0x23, 0x6F, 2}, {0x24, 0x76, 2}, {0x25, 0x7D, 2}, {0x26, 0x84, 2},
-       {0x27, 0x8D, 2}, {0x4D, 0x08, 2}, {0x50, 0x05, 2}, {0x51, 0xF5, 2},
-       {0x52, 0x04, 2}, {0x53, 0xA0, 2}, {0x54, 0x1F, 2}, {0x55, 0x23, 2},
-       {0x56, 0x45, 2}, {0x57, 0x67, 2}, {0x58, 0x08, 2}, {0x59, 0x08, 2},
-       {0x5A, 0x08, 2}, {0x5B, 0x08, 2}, {0x60, 0x08, 2}, {0x61, 0x08, 2},
-       {0x62, 0x08, 2}, {0x63, 0x08, 2}, {0x64, 0xCF, 2},
-
-       {0x5B, 0x40, 0}, {0x84, 0x88, 0}, {0x85, 0x24, 0}, {0x88, 0x54, 0},
-       {0x8B, 0xB8, 0}, {0x8C, 0x07, 0}, {0x8D, 0x00, 0}, {0x94, 0x1B, 0},
-       {0x95, 0x12, 0}, {0x96, 0x00, 0}, {0x97, 0x06, 0}, {0x9D, 0x1A, 0},
-       {0x9F, 0x10, 0}, {0xB4, 0x22, 0}, {0xBE, 0x80, 0}, {0xDB, 0x00, 0},
-       {0xEE, 0x00, 0}, {0x4C, 0x00, 2},
-
-       {0x9F, 0x00, 3}, {0x8C, 0x01, 0}, {0x8D, 0x10, 0}, {0x8E, 0x08, 0},
-       {0x8F, 0x00, 0}
-};
-
-static int rtl8187b_init_hw(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       int res, i;
-       u8 reg;
-
-       rtl8187_set_anaparam(priv, true);
-
-       /* Reset PLL sequence on 8187B. Realtek note: reduces power
-        * consumption about 30 mA */
-       rtl818x_iowrite8(priv, (u8 *)0xFF61, 0x10);
-       reg = rtl818x_ioread8(priv, (u8 *)0xFF62);
-       rtl818x_iowrite8(priv, (u8 *)0xFF62, reg & ~(1 << 5));
-       rtl818x_iowrite8(priv, (u8 *)0xFF62, reg | (1 << 5));
-
-       res = rtl8187_cmd_reset(dev);
-       if (res)
-               return res;
-
-       rtl8187_set_anaparam(priv, true);
-
-       /* BRSR (Basic Rate Set Register) on 8187B looks to be the same as
-        * RESP_RATE on 8187L in Realtek sources: each bit should be each
-        * one of the 12 rates, all are enabled */
-       rtl818x_iowrite16(priv, (__le16 *)0xFF34, 0x0FFF);
-
-       reg = rtl818x_ioread8(priv, &priv->map->CW_CONF);
-       reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT;
-       rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg);
-
-       /* Auto Rate Fallback Register (ARFR): 1M-54M setting */
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFFE0, 0x0FFF, 1);
-       rtl818x_iowrite8_idx(priv, (u8 *)0xFFE2, 0x00, 1);
-
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFFD4, 0xFFFF, 1);
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
-                        RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG1);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG1, (reg & 0x3F) | 0x80);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD,
-                        RTL818X_EEPROM_CMD_NORMAL);
-
-       rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0);
-       for (i = 0; i < ARRAY_SIZE(rtl8187b_reg_table); i++) {
-               rtl818x_iowrite8_idx(priv,
-                                    (u8 *)(uintptr_t)
-                                    (rtl8187b_reg_table[i][0] | 0xFF00),
-                                    rtl8187b_reg_table[i][1],
-                                    rtl8187b_reg_table[i][2]);
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->TID_AC_MAP, 0xFA50);
-       rtl818x_iowrite16(priv, &priv->map->INT_MIG, 0);
-
-       rtl818x_iowrite32_idx(priv, (__le32 *)0xFFF0, 0, 1);
-       rtl818x_iowrite32_idx(priv, (__le32 *)0xFFF4, 0, 1);
-       rtl818x_iowrite8_idx(priv, (u8 *)0xFFF8, 0, 1);
-
-       rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x00004001);
-
-       /* RFSW_CTRL register */
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x569A, 2);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x2488);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF);
-       msleep(100);
-
-       priv->rf->init(dev);
-
-       reg = RTL818X_CMD_TX_ENABLE | RTL818X_CMD_RX_ENABLE;
-       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
-       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF);
-
-       rtl818x_iowrite8(priv, (u8 *)0xFE41, 0xF4);
-       rtl818x_iowrite8(priv, (u8 *)0xFE40, 0x00);
-       rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x00);
-       rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x01);
-       rtl818x_iowrite8(priv, (u8 *)0xFE40, 0x0F);
-       rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x00);
-       rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x01);
-
-       reg = rtl818x_ioread8(priv, (u8 *)0xFFDB);
-       rtl818x_iowrite8(priv, (u8 *)0xFFDB, reg | (1 << 2));
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x59FA, 3);
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF74, 0x59D2, 3);
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF76, 0x59D2, 3);
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF78, 0x19FA, 3);
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF7A, 0x19FA, 3);
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFF7C, 0x00D0, 3);
-       rtl818x_iowrite8(priv, (u8 *)0xFF61, 0);
-       rtl818x_iowrite8_idx(priv, (u8 *)0xFF80, 0x0F, 1);
-       rtl818x_iowrite8_idx(priv, (u8 *)0xFF83, 0x03, 1);
-       rtl818x_iowrite8(priv, (u8 *)0xFFDA, 0x10);
-       rtl818x_iowrite8_idx(priv, (u8 *)0xFF4D, 0x08, 2);
-
-       rtl818x_iowrite32(priv, &priv->map->HSSI_PARA, 0x0600321B);
-
-       rtl818x_iowrite16_idx(priv, (__le16 *)0xFFEC, 0x0800, 1);
-
-       priv->slot_time = 0x9;
-       priv->aifsn[0] = 2; /* AIFSN[AC_VO] */
-       priv->aifsn[1] = 2; /* AIFSN[AC_VI] */
-       priv->aifsn[2] = 7; /* AIFSN[AC_BK] */
-       priv->aifsn[3] = 3; /* AIFSN[AC_BE] */
-       rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0);
-
-       /* ENEDCA flag must always be set, transmit issues? */
-       rtl818x_iowrite8(priv, &priv->map->MSR, RTL818X_MSR_ENEDCA);
-
-       return 0;
-}
-
-static void rtl8187_work(struct work_struct *work)
-{
-       /* The RTL8187 returns the retry count through register 0xFFFA. In
-        * addition, it appears to be a cumulative retry count, not the
-        * value for the current TX packet. When multiple TX entries are
-        * queued, the retry count will be valid for the last one in the queue.
-        * The "error" should not matter for purposes of rate setting. */
-       struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv,
-                                   work.work);
-       struct ieee80211_tx_info *info;
-       struct ieee80211_hw *dev = priv->dev;
-       static u16 retry;
-       u16 tmp;
-
-       mutex_lock(&priv->conf_mutex);
-       tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA);
-       while (skb_queue_len(&priv->b_tx_status.queue) > 0) {
-               struct sk_buff *old_skb;
-
-               old_skb = skb_dequeue(&priv->b_tx_status.queue);
-               info = IEEE80211_SKB_CB(old_skb);
-               info->status.rates[0].count = tmp - retry + 1;
-               ieee80211_tx_status_irqsafe(dev, old_skb);
-       }
-       retry = tmp;
-       mutex_unlock(&priv->conf_mutex);
-}
-
-static int rtl8187_start(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u32 reg;
-       int ret;
-
-       mutex_lock(&priv->conf_mutex);
-
-       ret = (!priv->is_rtl8187b) ? rtl8187_init_hw(dev) :
-                                    rtl8187b_init_hw(dev);
-       if (ret)
-               goto rtl8187_start_exit;
-
-       init_usb_anchor(&priv->anchored);
-       priv->dev = dev;
-
-       if (priv->is_rtl8187b) {
-               reg = RTL818X_RX_CONF_MGMT |
-                     RTL818X_RX_CONF_DATA |
-                     RTL818X_RX_CONF_BROADCAST |
-                     RTL818X_RX_CONF_NICMAC |
-                     RTL818X_RX_CONF_BSSID |
-                     (7 << 13 /* RX FIFO threshold NONE */) |
-                     (7 << 10 /* MAX RX DMA */) |
-                     RTL818X_RX_CONF_RX_AUTORESETPHY |
-                     RTL818X_RX_CONF_ONLYERLPKT |
-                     RTL818X_RX_CONF_MULTICAST;
-               priv->rx_conf = reg;
-               rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg);
-
-               reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL);
-               reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT;
-               reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT;
-               reg &= ~RTL818X_TX_AGC_CTL_FEEDBACK_ANT;
-               rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg);
-
-               rtl818x_iowrite32(priv, &priv->map->TX_CONF,
-                                 RTL818X_TX_CONF_HW_SEQNUM |
-                                 RTL818X_TX_CONF_DISREQQSIZE |
-                                 (7 << 8  /* short retry limit */) |
-                                 (7 << 0  /* long retry limit */) |
-                                 (7 << 21 /* MAX TX DMA */));
-               rtl8187_init_urbs(dev);
-               rtl8187b_init_status_urb(dev);
-               goto rtl8187_start_exit;
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF);
-
-       rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0);
-       rtl818x_iowrite32(priv, &priv->map->MAR[1], ~0);
-
-       rtl8187_init_urbs(dev);
-
-       reg = RTL818X_RX_CONF_ONLYERLPKT |
-             RTL818X_RX_CONF_RX_AUTORESETPHY |
-             RTL818X_RX_CONF_BSSID |
-             RTL818X_RX_CONF_MGMT |
-             RTL818X_RX_CONF_DATA |
-             (7 << 13 /* RX FIFO threshold NONE */) |
-             (7 << 10 /* MAX RX DMA */) |
-             RTL818X_RX_CONF_BROADCAST |
-             RTL818X_RX_CONF_NICMAC;
-
-       priv->rx_conf = reg;
-       rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg);
-
-       reg = rtl818x_ioread8(priv, &priv->map->CW_CONF);
-       reg &= ~RTL818X_CW_CONF_PERPACKET_CW_SHIFT;
-       reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT;
-       rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg);
-
-       reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL);
-       reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT;
-       reg &= ~RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT;
-       reg &= ~RTL818X_TX_AGC_CTL_FEEDBACK_ANT;
-       rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg);
-
-       reg  = RTL818X_TX_CONF_CW_MIN |
-              (7 << 21 /* MAX TX DMA */) |
-              RTL818X_TX_CONF_NO_ICV;
-       rtl818x_iowrite32(priv, &priv->map->TX_CONF, reg);
-
-       reg = rtl818x_ioread8(priv, &priv->map->CMD);
-       reg |= RTL818X_CMD_TX_ENABLE;
-       reg |= RTL818X_CMD_RX_ENABLE;
-       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
-       INIT_DELAYED_WORK(&priv->work, rtl8187_work);
-
-rtl8187_start_exit:
-       mutex_unlock(&priv->conf_mutex);
-       return ret;
-}
-
-static void rtl8187_stop(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       struct sk_buff *skb;
-       u32 reg;
-
-       mutex_lock(&priv->conf_mutex);
-       rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0);
-
-       reg = rtl818x_ioread8(priv, &priv->map->CMD);
-       reg &= ~RTL818X_CMD_TX_ENABLE;
-       reg &= ~RTL818X_CMD_RX_ENABLE;
-       rtl818x_iowrite8(priv, &priv->map->CMD, reg);
-
-       priv->rf->stop(dev);
-       rtl8187_set_anaparam(priv, false);
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG4);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG4, reg | RTL818X_CONFIG4_VCOOFF);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       while ((skb = skb_dequeue(&priv->b_tx_status.queue)))
-               dev_kfree_skb_any(skb);
-
-       usb_kill_anchored_urbs(&priv->anchored);
-       mutex_unlock(&priv->conf_mutex);
-
-       if (!priv->is_rtl8187b)
-               cancel_delayed_work_sync(&priv->work);
-}
-
-static int rtl8187_add_interface(struct ieee80211_hw *dev,
-                                struct ieee80211_vif *vif)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       int i;
-       int ret = -EOPNOTSUPP;
-
-       mutex_lock(&priv->conf_mutex);
-       if (priv->vif)
-               goto exit;
-
-       switch (vif->type) {
-       case NL80211_IFTYPE_STATION:
-               break;
-       default:
-               goto exit;
-       }
-
-       ret = 0;
-       priv->vif = vif;
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       for (i = 0; i < ETH_ALEN; i++)
-               rtl818x_iowrite8(priv, &priv->map->MAC[i],
-                                ((u8 *)vif->addr)[i]);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-exit:
-       mutex_unlock(&priv->conf_mutex);
-       return ret;
-}
-
-static void rtl8187_remove_interface(struct ieee80211_hw *dev,
-                                    struct ieee80211_vif *vif)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       mutex_lock(&priv->conf_mutex);
-       priv->vif = NULL;
-       mutex_unlock(&priv->conf_mutex);
-}
-
-static int rtl8187_config(struct ieee80211_hw *dev, u32 changed)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       struct ieee80211_conf *conf = &dev->conf;
-       u32 reg;
-
-       mutex_lock(&priv->conf_mutex);
-       reg = rtl818x_ioread32(priv, &priv->map->TX_CONF);
-       /* Enable TX loopback on MAC level to avoid TX during channel
-        * changes, as this has be seen to causes problems and the
-        * card will stop work until next reset
-        */
-       rtl818x_iowrite32(priv, &priv->map->TX_CONF,
-                         reg | RTL818X_TX_CONF_LOOPBACK_MAC);
-       priv->rf->set_chan(dev, conf);
-       msleep(10);
-       rtl818x_iowrite32(priv, &priv->map->TX_CONF, reg);
-
-       rtl818x_iowrite16(priv, &priv->map->ATIM_WND, 2);
-       rtl818x_iowrite16(priv, &priv->map->ATIMTR_INTERVAL, 100);
-       rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL, 100);
-       rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL_TIME, 100);
-       mutex_unlock(&priv->conf_mutex);
-       return 0;
-}
-
-/*
- * With 8187B, AC_*_PARAM clashes with FEMR definition in struct rtl818x_csr for
- * example. Thus we have to use raw values for AC_*_PARAM register addresses.
- */
-static __le32 *rtl8187b_ac_addr[4] = {
-       (__le32 *) 0xFFF0, /* AC_VO */
-       (__le32 *) 0xFFF4, /* AC_VI */
-       (__le32 *) 0xFFFC, /* AC_BK */
-       (__le32 *) 0xFFF8, /* AC_BE */
-};
-
-#define SIFS_TIME 0xa
-
-static void rtl8187_conf_erp(struct rtl8187_priv *priv, bool use_short_slot,
-                            bool use_short_preamble)
-{
-       if (priv->is_rtl8187b) {
-               u8 difs, eifs;
-               u16 ack_timeout;
-               int queue;
-
-               if (use_short_slot) {
-                       priv->slot_time = 0x9;
-                       difs = 0x1c;
-                       eifs = 0x53;
-               } else {
-                       priv->slot_time = 0x14;
-                       difs = 0x32;
-                       eifs = 0x5b;
-               }
-               rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22);
-               rtl818x_iowrite8(priv, &priv->map->SLOT, priv->slot_time);
-               rtl818x_iowrite8(priv, &priv->map->DIFS, difs);
-
-               /*
-                * BRSR+1 on 8187B is in fact EIFS register
-                * Value in units of 4 us
-                */
-               rtl818x_iowrite8(priv, (u8 *)&priv->map->BRSR + 1, eifs);
-
-               /*
-                * For 8187B, CARRIER_SENSE_COUNTER is in fact ack timeout
-                * register. In units of 4 us like eifs register
-                * ack_timeout = ack duration + plcp + difs + preamble
-                */
-               ack_timeout = 112 + 48 + difs;
-               if (use_short_preamble)
-                       ack_timeout += 72;
-               else
-                       ack_timeout += 144;
-               rtl818x_iowrite8(priv, &priv->map->CARRIER_SENSE_COUNTER,
-                                DIV_ROUND_UP(ack_timeout, 4));
-
-               for (queue = 0; queue < 4; queue++)
-                       rtl818x_iowrite8(priv, (u8 *) rtl8187b_ac_addr[queue],
-                                        priv->aifsn[queue] * priv->slot_time +
-                                        SIFS_TIME);
-       } else {
-               rtl818x_iowrite8(priv, &priv->map->SIFS, 0x22);
-               if (use_short_slot) {
-                       rtl818x_iowrite8(priv, &priv->map->SLOT, 0x9);
-                       rtl818x_iowrite8(priv, &priv->map->DIFS, 0x14);
-                       rtl818x_iowrite8(priv, &priv->map->EIFS, 91 - 0x14);
-               } else {
-                       rtl818x_iowrite8(priv, &priv->map->SLOT, 0x14);
-                       rtl818x_iowrite8(priv, &priv->map->DIFS, 0x24);
-                       rtl818x_iowrite8(priv, &priv->map->EIFS, 91 - 0x24);
-               }
-       }
-}
-
-static void rtl8187_bss_info_changed(struct ieee80211_hw *dev,
-                                    struct ieee80211_vif *vif,
-                                    struct ieee80211_bss_conf *info,
-                                    u32 changed)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       int i;
-       u8 reg;
-
-       if (changed & BSS_CHANGED_BSSID) {
-               mutex_lock(&priv->conf_mutex);
-               for (i = 0; i < ETH_ALEN; i++)
-                       rtl818x_iowrite8(priv, &priv->map->BSSID[i],
-                                        info->bssid[i]);
-
-               if (priv->is_rtl8187b)
-                       reg = RTL818X_MSR_ENEDCA;
-               else
-                       reg = 0;
-
-               if (is_valid_ether_addr(info->bssid))
-                       reg |= RTL818X_MSR_INFRA;
-               else
-                       reg |= RTL818X_MSR_NO_LINK;
-
-               rtl818x_iowrite8(priv, &priv->map->MSR, reg);
-
-               mutex_unlock(&priv->conf_mutex);
-       }
-
-       if (changed & (BSS_CHANGED_ERP_SLOT | BSS_CHANGED_ERP_PREAMBLE))
-               rtl8187_conf_erp(priv, info->use_short_slot,
-                                info->use_short_preamble);
-}
-
-static u64 rtl8187_prepare_multicast(struct ieee80211_hw *dev,
-                                    struct netdev_hw_addr_list *mc_list)
-{
-       return netdev_hw_addr_list_count(mc_list);
-}
-
-static void rtl8187_configure_filter(struct ieee80211_hw *dev,
-                                    unsigned int changed_flags,
-                                    unsigned int *total_flags,
-                                    u64 multicast)
-{
-       struct rtl8187_priv *priv = dev->priv;
-
-       if (changed_flags & FIF_FCSFAIL)
-               priv->rx_conf ^= RTL818X_RX_CONF_FCS;
-       if (changed_flags & FIF_CONTROL)
-               priv->rx_conf ^= RTL818X_RX_CONF_CTRL;
-       if (changed_flags & FIF_OTHER_BSS)
-               priv->rx_conf ^= RTL818X_RX_CONF_MONITOR;
-       if (*total_flags & FIF_ALLMULTI || multicast > 0)
-               priv->rx_conf |= RTL818X_RX_CONF_MULTICAST;
-       else
-               priv->rx_conf &= ~RTL818X_RX_CONF_MULTICAST;
-
-       *total_flags = 0;
-
-       if (priv->rx_conf & RTL818X_RX_CONF_FCS)
-               *total_flags |= FIF_FCSFAIL;
-       if (priv->rx_conf & RTL818X_RX_CONF_CTRL)
-               *total_flags |= FIF_CONTROL;
-       if (priv->rx_conf & RTL818X_RX_CONF_MONITOR)
-               *total_flags |= FIF_OTHER_BSS;
-       if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST)
-               *total_flags |= FIF_ALLMULTI;
-
-       rtl818x_iowrite32_async(priv, &priv->map->RX_CONF, priv->rx_conf);
-}
-
-static int rtl8187_conf_tx(struct ieee80211_hw *dev, u16 queue,
-                          const struct ieee80211_tx_queue_params *params)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u8 cw_min, cw_max;
-
-       if (queue > 3)
-               return -EINVAL;
-
-       cw_min = fls(params->cw_min);
-       cw_max = fls(params->cw_max);
-
-       if (priv->is_rtl8187b) {
-               priv->aifsn[queue] = params->aifs;
-
-               /*
-                * This is the structure of AC_*_PARAM registers in 8187B:
-                * - TXOP limit field, bit offset = 16
-                * - ECWmax, bit offset = 12
-                * - ECWmin, bit offset = 8
-                * - AIFS, bit offset = 0
-                */
-               rtl818x_iowrite32(priv, rtl8187b_ac_addr[queue],
-                                 (params->txop << 16) | (cw_max << 12) |
-                                 (cw_min << 8) | (params->aifs *
-                                 priv->slot_time + SIFS_TIME));
-       } else {
-               if (queue != 0)
-                       return -EINVAL;
-
-               rtl818x_iowrite8(priv, &priv->map->CW_VAL,
-                                cw_min | (cw_max << 4));
-       }
-       return 0;
-}
-
-static u64 rtl8187_get_tsf(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-
-       return rtl818x_ioread32(priv, &priv->map->TSFT[0]) |
-              (u64)(rtl818x_ioread32(priv, &priv->map->TSFT[1])) << 32;
-}
-
-static const struct ieee80211_ops rtl8187_ops = {
-       .tx                     = rtl8187_tx,
-       .start                  = rtl8187_start,
-       .stop                   = rtl8187_stop,
-       .add_interface          = rtl8187_add_interface,
-       .remove_interface       = rtl8187_remove_interface,
-       .config                 = rtl8187_config,
-       .bss_info_changed       = rtl8187_bss_info_changed,
-       .prepare_multicast      = rtl8187_prepare_multicast,
-       .configure_filter       = rtl8187_configure_filter,
-       .conf_tx                = rtl8187_conf_tx,
-       .rfkill_poll            = rtl8187_rfkill_poll,
-       .get_tsf                = rtl8187_get_tsf,
-};
-
-static void rtl8187_eeprom_register_read(struct eeprom_93cx6 *eeprom)
-{
-       struct ieee80211_hw *dev = eeprom->data;
-       struct rtl8187_priv *priv = dev->priv;
-       u8 reg = rtl818x_ioread8(priv, &priv->map->EEPROM_CMD);
-
-       eeprom->reg_data_in = reg & RTL818X_EEPROM_CMD_WRITE;
-       eeprom->reg_data_out = reg & RTL818X_EEPROM_CMD_READ;
-       eeprom->reg_data_clock = reg & RTL818X_EEPROM_CMD_CK;
-       eeprom->reg_chip_select = reg & RTL818X_EEPROM_CMD_CS;
-}
-
-static void rtl8187_eeprom_register_write(struct eeprom_93cx6 *eeprom)
-{
-       struct ieee80211_hw *dev = eeprom->data;
-       struct rtl8187_priv *priv = dev->priv;
-       u8 reg = RTL818X_EEPROM_CMD_PROGRAM;
-
-       if (eeprom->reg_data_in)
-               reg |= RTL818X_EEPROM_CMD_WRITE;
-       if (eeprom->reg_data_out)
-               reg |= RTL818X_EEPROM_CMD_READ;
-       if (eeprom->reg_data_clock)
-               reg |= RTL818X_EEPROM_CMD_CK;
-       if (eeprom->reg_chip_select)
-               reg |= RTL818X_EEPROM_CMD_CS;
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, reg);
-       udelay(10);
-}
-
-static int __devinit rtl8187_probe(struct usb_interface *intf,
-                                  const struct usb_device_id *id)
-{
-       struct usb_device *udev = interface_to_usbdev(intf);
-       struct ieee80211_hw *dev;
-       struct rtl8187_priv *priv;
-       struct eeprom_93cx6 eeprom;
-       struct ieee80211_channel *channel;
-       const char *chip_name;
-       u16 txpwr, reg;
-       u16 product_id = le16_to_cpu(udev->descriptor.idProduct);
-       int err, i;
-       u8 mac_addr[ETH_ALEN];
-
-       dev = ieee80211_alloc_hw(sizeof(*priv), &rtl8187_ops);
-       if (!dev) {
-               printk(KERN_ERR "rtl8187: ieee80211 alloc failed\n");
-               return -ENOMEM;
-       }
-
-       priv = dev->priv;
-       priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
-
-       /* allocate "DMA aware" buffer for register accesses */
-       priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
-       if (!priv->io_dmabuf) {
-               err = -ENOMEM;
-               goto err_free_dev;
-       }
-       mutex_init(&priv->io_mutex);
-
-       SET_IEEE80211_DEV(dev, &intf->dev);
-       usb_set_intfdata(intf, dev);
-       priv->udev = udev;
-
-       usb_get_dev(udev);
-
-       skb_queue_head_init(&priv->rx_queue);
-
-       BUILD_BUG_ON(sizeof(priv->channels) != sizeof(rtl818x_channels));
-       BUILD_BUG_ON(sizeof(priv->rates) != sizeof(rtl818x_rates));
-
-       memcpy(priv->channels, rtl818x_channels, sizeof(rtl818x_channels));
-       memcpy(priv->rates, rtl818x_rates, sizeof(rtl818x_rates));
-       priv->map = (struct rtl818x_csr *)0xFF00;
-
-       priv->band.band = IEEE80211_BAND_2GHZ;
-       priv->band.channels = priv->channels;
-       priv->band.n_channels = ARRAY_SIZE(rtl818x_channels);
-       priv->band.bitrates = priv->rates;
-       priv->band.n_bitrates = ARRAY_SIZE(rtl818x_rates);
-       dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
-
-
-       dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-                    IEEE80211_HW_SIGNAL_DBM |
-                    IEEE80211_HW_RX_INCLUDES_FCS;
-
-       eeprom.data = dev;
-       eeprom.register_read = rtl8187_eeprom_register_read;
-       eeprom.register_write = rtl8187_eeprom_register_write;
-       if (rtl818x_ioread32(priv, &priv->map->RX_CONF) & (1 << 6))
-               eeprom.width = PCI_EEPROM_WIDTH_93C66;
-       else
-               eeprom.width = PCI_EEPROM_WIDTH_93C46;
-
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       udelay(10);
-
-       eeprom_93cx6_multiread(&eeprom, RTL8187_EEPROM_MAC_ADDR,
-                              (__le16 __force *)mac_addr, 3);
-       if (!is_valid_ether_addr(mac_addr)) {
-               printk(KERN_WARNING "rtl8187: Invalid hwaddr! Using randomly "
-                      "generated MAC address\n");
-               random_ether_addr(mac_addr);
-       }
-       SET_IEEE80211_PERM_ADDR(dev, mac_addr);
-
-       channel = priv->channels;
-       for (i = 0; i < 3; i++) {
-               eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_1 + i,
-                                 &txpwr);
-               (*channel++).hw_value = txpwr & 0xFF;
-               (*channel++).hw_value = txpwr >> 8;
-       }
-       for (i = 0; i < 2; i++) {
-               eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_4 + i,
-                                 &txpwr);
-               (*channel++).hw_value = txpwr & 0xFF;
-               (*channel++).hw_value = txpwr >> 8;
-       }
-
-       eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_BASE,
-                         &priv->txpwr_base);
-
-       reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~1;
-       rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg | 1);
-       /* 0 means asic B-cut, we should use SW 3 wire
-        * bit-by-bit banging for radio. 1 means we can use
-        * USB specific request to write radio registers */
-       priv->asic_rev = rtl818x_ioread8(priv, (u8 *)0xFFFE) & 0x3;
-       rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       if (!priv->is_rtl8187b) {
-               u32 reg32;
-               reg32 = rtl818x_ioread32(priv, &priv->map->TX_CONF);
-               reg32 &= RTL818X_TX_CONF_HWVER_MASK;
-               switch (reg32) {
-               case RTL818X_TX_CONF_R8187vD_B:
-                       /* Some RTL8187B devices have a USB ID of 0x8187
-                        * detect them here */
-                       chip_name = "RTL8187BvB(early)";
-                       priv->is_rtl8187b = 1;
-                       priv->hw_rev = RTL8187BvB;
-                       break;
-               case RTL818X_TX_CONF_R8187vD:
-                       chip_name = "RTL8187vD";
-                       break;
-               default:
-                       chip_name = "RTL8187vB (default)";
-               }
-       } else {
-               /*
-                * Force USB request to write radio registers for 8187B, Realtek
-                * only uses it in their sources
-                */
-               /*if (priv->asic_rev == 0) {
-                       printk(KERN_WARNING "rtl8187: Forcing use of USB "
-                              "requests to write to radio registers\n");
-                       priv->asic_rev = 1;
-               }*/
-               switch (rtl818x_ioread8(priv, (u8 *)0xFFE1)) {
-               case RTL818X_R8187B_B:
-                       chip_name = "RTL8187BvB";
-                       priv->hw_rev = RTL8187BvB;
-                       break;
-               case RTL818X_R8187B_D:
-                       chip_name = "RTL8187BvD";
-                       priv->hw_rev = RTL8187BvD;
-                       break;
-               case RTL818X_R8187B_E:
-                       chip_name = "RTL8187BvE";
-                       priv->hw_rev = RTL8187BvE;
-                       break;
-               default:
-                       chip_name = "RTL8187BvB (default)";
-                       priv->hw_rev = RTL8187BvB;
-               }
-       }
-
-       if (!priv->is_rtl8187b) {
-               for (i = 0; i < 2; i++) {
-                       eeprom_93cx6_read(&eeprom,
-                                         RTL8187_EEPROM_TXPWR_CHAN_6 + i,
-                                         &txpwr);
-                       (*channel++).hw_value = txpwr & 0xFF;
-                       (*channel++).hw_value = txpwr >> 8;
-               }
-       } else {
-               eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_TXPWR_CHAN_6,
-                                 &txpwr);
-               (*channel++).hw_value = txpwr & 0xFF;
-
-               eeprom_93cx6_read(&eeprom, 0x0A, &txpwr);
-               (*channel++).hw_value = txpwr & 0xFF;
-
-               eeprom_93cx6_read(&eeprom, 0x1C, &txpwr);
-               (*channel++).hw_value = txpwr & 0xFF;
-               (*channel++).hw_value = txpwr >> 8;
-       }
-       /* Handle the differing rfkill GPIO bit in different models */
-       priv->rfkill_mask = RFKILL_MASK_8187_89_97;
-       if (product_id == 0x8197 || product_id == 0x8198) {
-               eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_SELECT_GPIO, &reg);
-               if (reg & 0xFF00)
-                       priv->rfkill_mask = RFKILL_MASK_8198;
-       }
-
-       /*
-        * XXX: Once this driver supports anything that requires
-        *      beacons it must implement IEEE80211_TX_CTL_ASSIGN_SEQ.
-        */
-       dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
-
-       if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b)
-               printk(KERN_INFO "rtl8187: inconsistency between id with OEM"
-                      " info!\n");
-
-       priv->rf = rtl8187_detect_rf(dev);
-       dev->extra_tx_headroom = (!priv->is_rtl8187b) ?
-                                 sizeof(struct rtl8187_tx_hdr) :
-                                 sizeof(struct rtl8187b_tx_hdr);
-       if (!priv->is_rtl8187b)
-               dev->queues = 1;
-       else
-               dev->queues = 4;
-
-       err = ieee80211_register_hw(dev);
-       if (err) {
-               printk(KERN_ERR "rtl8187: Cannot register device\n");
-               goto err_free_dmabuf;
-       }
-       mutex_init(&priv->conf_mutex);
-       skb_queue_head_init(&priv->b_tx_status.queue);
-
-       wiphy_info(dev->wiphy, "hwaddr %pM, %s V%d + %s, rfkill mask %d\n",
-                  mac_addr, chip_name, priv->asic_rev, priv->rf->name,
-                  priv->rfkill_mask);
-
-#ifdef CONFIG_RTL8187_LEDS
-       eeprom_93cx6_read(&eeprom, 0x3F, &reg);
-       reg &= 0xFF;
-       rtl8187_leds_init(dev, reg);
-#endif
-       rtl8187_rfkill_init(dev);
-
-       return 0;
-
- err_free_dmabuf:
-       kfree(priv->io_dmabuf);
- err_free_dev:
-       ieee80211_free_hw(dev);
-       usb_set_intfdata(intf, NULL);
-       usb_put_dev(udev);
-       return err;
-}
-
-static void __devexit rtl8187_disconnect(struct usb_interface *intf)
-{
-       struct ieee80211_hw *dev = usb_get_intfdata(intf);
-       struct rtl8187_priv *priv;
-
-       if (!dev)
-               return;
-
-#ifdef CONFIG_RTL8187_LEDS
-       rtl8187_leds_exit(dev);
-#endif
-       rtl8187_rfkill_exit(dev);
-       ieee80211_unregister_hw(dev);
-
-       priv = dev->priv;
-       usb_reset_device(priv->udev);
-       usb_put_dev(interface_to_usbdev(intf));
-       kfree(priv->io_dmabuf);
-       ieee80211_free_hw(dev);
-}
-
-static struct usb_driver rtl8187_driver = {
-       .name           = KBUILD_MODNAME,
-       .id_table       = rtl8187_table,
-       .probe          = rtl8187_probe,
-       .disconnect     = __devexit_p(rtl8187_disconnect),
-};
-
-static int __init rtl8187_init(void)
-{
-       return usb_register(&rtl8187_driver);
-}
-
-static void __exit rtl8187_exit(void)
-{
-       usb_deregister(&rtl8187_driver);
-}
-
-module_init(rtl8187_init);
-module_exit(rtl8187_exit);
diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.c b/drivers/net/wireless/rtl818x/rtl8187_leds.c
deleted file mode 100644 (file)
index 4637337..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Linux LED driver for RTL8187
- *
- * Copyright 2009 Larry Finger <Larry.Finger@lwfinger.net>
- *
- * Based on the LED handling in the r8187 driver, which is:
- * Copyright (c) Realtek Semiconductor Corp. All rights reserved.
- *
- * Thanks to Realtek for their support!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifdef CONFIG_RTL8187_LEDS
-
-#include <net/mac80211.h>
-#include <linux/usb.h>
-#include <linux/eeprom_93cx6.h>
-
-#include "rtl8187.h"
-#include "rtl8187_leds.h"
-
-static void led_turn_on(struct work_struct *work)
-{
-       /* As this routine does read/write operations on the hardware, it must
-        * be run from a work queue.
-        */
-       u8 reg;
-       struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv,
-                                   led_on.work);
-       struct rtl8187_led *led = &priv->led_tx;
-
-       /* Don't change the LED, when the device is down. */
-       if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED)
-               return ;
-
-       /* Skip if the LED is not registered. */
-       if (!led->dev)
-               return;
-       mutex_lock(&priv->conf_mutex);
-       switch (led->ledpin) {
-       case LED_PIN_GPIO0:
-               rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x01);
-               rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0x00);
-               break;
-       case LED_PIN_LED0:
-               reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~(1 << 4);
-               rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
-               break;
-       case LED_PIN_LED1:
-               reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) & ~(1 << 5);
-               rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
-               break;
-       case LED_PIN_HW:
-       default:
-               break;
-       }
-       mutex_unlock(&priv->conf_mutex);
-}
-
-static void led_turn_off(struct work_struct *work)
-{
-       /* As this routine does read/write operations on the hardware, it must
-        * be run from a work queue.
-        */
-       u8 reg;
-       struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv,
-                                   led_off.work);
-       struct rtl8187_led *led = &priv->led_tx;
-
-       /* Don't change the LED, when the device is down. */
-       if (!priv->vif || priv->vif->type == NL80211_IFTYPE_UNSPECIFIED)
-               return ;
-
-       /* Skip if the LED is not registered. */
-       if (!led->dev)
-               return;
-       mutex_lock(&priv->conf_mutex);
-       switch (led->ledpin) {
-       case LED_PIN_GPIO0:
-               rtl818x_iowrite8(priv, &priv->map->GPIO0, 0x01);
-               rtl818x_iowrite8(priv, &priv->map->GP_ENABLE, 0x01);
-               break;
-       case LED_PIN_LED0:
-               reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) | (1 << 4);
-               rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
-               break;
-       case LED_PIN_LED1:
-               reg = rtl818x_ioread8(priv, &priv->map->PGSELECT) | (1 << 5);
-               rtl818x_iowrite8(priv, &priv->map->PGSELECT, reg);
-               break;
-       case LED_PIN_HW:
-       default:
-               break;
-       }
-       mutex_unlock(&priv->conf_mutex);
-}
-
-/* Callback from the LED subsystem. */
-static void rtl8187_led_brightness_set(struct led_classdev *led_dev,
-                                  enum led_brightness brightness)
-{
-       struct rtl8187_led *led = container_of(led_dev, struct rtl8187_led,
-                                              led_dev);
-       struct ieee80211_hw *hw = led->dev;
-       struct rtl8187_priv *priv;
-       static bool radio_on;
-
-       if (!hw)
-               return;
-       priv = hw->priv;
-       if (led->is_radio) {
-               if (brightness == LED_FULL) {
-                       ieee80211_queue_delayed_work(hw, &priv->led_on, 0);
-                       radio_on = true;
-               } else if (radio_on) {
-                       radio_on = false;
-                       cancel_delayed_work_sync(&priv->led_on);
-                       ieee80211_queue_delayed_work(hw, &priv->led_off, 0);
-               }
-       } else if (radio_on) {
-               if (brightness == LED_OFF) {
-                       ieee80211_queue_delayed_work(hw, &priv->led_off, 0);
-                       /* The LED is off for 1/20 sec - it just blinks. */
-                       ieee80211_queue_delayed_work(hw, &priv->led_on,
-                                                    HZ / 20);
-               } else
-                       ieee80211_queue_delayed_work(hw, &priv->led_on, 0);
-       }
-}
-
-static int rtl8187_register_led(struct ieee80211_hw *dev,
-                               struct rtl8187_led *led, const char *name,
-                               const char *default_trigger, u8 ledpin,
-                               bool is_radio)
-{
-       int err;
-       struct rtl8187_priv *priv = dev->priv;
-
-       if (led->dev)
-               return -EEXIST;
-       if (!default_trigger)
-               return -EINVAL;
-       led->dev = dev;
-       led->ledpin = ledpin;
-       led->is_radio = is_radio;
-       strncpy(led->name, name, sizeof(led->name));
-
-       led->led_dev.name = led->name;
-       led->led_dev.default_trigger = default_trigger;
-       led->led_dev.brightness_set = rtl8187_led_brightness_set;
-
-       err = led_classdev_register(&priv->udev->dev, &led->led_dev);
-       if (err) {
-               printk(KERN_INFO "LEDs: Failed to register %s\n", name);
-               led->dev = NULL;
-               return err;
-       }
-       return 0;
-}
-
-static void rtl8187_unregister_led(struct rtl8187_led *led)
-{
-       struct ieee80211_hw *hw = led->dev;
-       struct rtl8187_priv *priv = hw->priv;
-
-       led_classdev_unregister(&led->led_dev);
-       flush_delayed_work(&priv->led_off);
-       led->dev = NULL;
-}
-
-void rtl8187_leds_init(struct ieee80211_hw *dev, u16 custid)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       char name[RTL8187_LED_MAX_NAME_LEN + 1];
-       u8 ledpin;
-       int err;
-
-       /* According to the vendor driver, the LED operation depends on the
-        * customer ID encoded in the EEPROM
-        */
-       printk(KERN_INFO "rtl8187: Customer ID is 0x%02X\n", custid);
-       switch (custid) {
-       case EEPROM_CID_RSVD0:
-       case EEPROM_CID_RSVD1:
-       case EEPROM_CID_SERCOMM_PS:
-       case EEPROM_CID_QMI:
-       case EEPROM_CID_DELL:
-       case EEPROM_CID_TOSHIBA:
-               ledpin = LED_PIN_GPIO0;
-               break;
-       case EEPROM_CID_ALPHA0:
-               ledpin = LED_PIN_LED0;
-               break;
-       case EEPROM_CID_HW:
-               ledpin = LED_PIN_HW;
-               break;
-       default:
-               ledpin = LED_PIN_GPIO0;
-       }
-
-       INIT_DELAYED_WORK(&priv->led_on, led_turn_on);
-       INIT_DELAYED_WORK(&priv->led_off, led_turn_off);
-
-       snprintf(name, sizeof(name),
-                "rtl8187-%s::radio", wiphy_name(dev->wiphy));
-       err = rtl8187_register_led(dev, &priv->led_radio, name,
-                        ieee80211_get_radio_led_name(dev), ledpin, true);
-       if (err)
-               return;
-
-       snprintf(name, sizeof(name),
-                "rtl8187-%s::tx", wiphy_name(dev->wiphy));
-       err = rtl8187_register_led(dev, &priv->led_tx, name,
-                        ieee80211_get_tx_led_name(dev), ledpin, false);
-       if (err)
-               goto err_tx;
-
-       snprintf(name, sizeof(name),
-                "rtl8187-%s::rx", wiphy_name(dev->wiphy));
-       err = rtl8187_register_led(dev, &priv->led_rx, name,
-                        ieee80211_get_rx_led_name(dev), ledpin, false);
-       if (!err)
-               return;
-
-       /* registration of RX LED failed - unregister */
-       rtl8187_unregister_led(&priv->led_tx);
-err_tx:
-       rtl8187_unregister_led(&priv->led_radio);
-}
-
-void rtl8187_leds_exit(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-
-       rtl8187_unregister_led(&priv->led_radio);
-       rtl8187_unregister_led(&priv->led_rx);
-       rtl8187_unregister_led(&priv->led_tx);
-       cancel_delayed_work_sync(&priv->led_off);
-       cancel_delayed_work_sync(&priv->led_on);
-}
-#endif /* def CONFIG_RTL8187_LEDS */
-
diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.h b/drivers/net/wireless/rtl818x/rtl8187_leds.h
deleted file mode 100644 (file)
index d743c96..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Definitions for RTL8187 leds
- *
- * Copyright 2009 Larry Finger <Larry.Finger@lwfinger.net>
- *
- * Based on the LED handling in the r8187 driver, which is:
- * Copyright (c) Realtek Semiconductor Corp. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef RTL8187_LED_H
-#define RTL8187_LED_H
-
-#ifdef CONFIG_RTL8187_LEDS
-
-#define RTL8187_LED_MAX_NAME_LEN       21
-
-#include <linux/leds.h>
-#include <linux/types.h>
-
-enum {
-       LED_PIN_LED0,
-       LED_PIN_LED1,
-       LED_PIN_GPIO0,
-       LED_PIN_HW
-};
-
-enum {
-       EEPROM_CID_RSVD0 = 0x00,
-       EEPROM_CID_RSVD1 = 0xFF,
-       EEPROM_CID_ALPHA0 = 0x01,
-       EEPROM_CID_SERCOMM_PS = 0x02,
-       EEPROM_CID_HW = 0x03,
-       EEPROM_CID_TOSHIBA = 0x04,
-       EEPROM_CID_QMI = 0x07,
-       EEPROM_CID_DELL = 0x08
-};
-
-struct rtl8187_led {
-       struct ieee80211_hw *dev;
-       /* The LED class device */
-       struct led_classdev led_dev;
-       /* The pin/method used to control the led */
-       u8 ledpin;
-       /* The unique name string for this LED device. */
-       char name[RTL8187_LED_MAX_NAME_LEN + 1];
-       /* If the LED is radio or tx/rx */
-       bool is_radio;
-};
-
-void rtl8187_leds_init(struct ieee80211_hw *dev, u16 code);
-void rtl8187_leds_exit(struct ieee80211_hw *dev);
-
-#endif /* def CONFIG_RTL8187_LEDS */
-
-#endif /* RTL8187_LED_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rfkill.c b/drivers/net/wireless/rtl818x/rtl8187_rfkill.c
deleted file mode 100644 (file)
index 03555e1..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Linux RFKILL support for RTL8187
- *
- * Copyright (c) 2009 Herton Ronaldo Krzesinski <herton@mandriva.com.br>
- *
- * Based on the RFKILL handling in the r8187 driver, which is:
- * Copyright (c) Realtek Semiconductor Corp. All rights reserved.
- *
- * Thanks to Realtek for their support!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/types.h>
-#include <linux/usb.h>
-#include <net/mac80211.h>
-
-#include "rtl8187.h"
-#include "rtl8187_rfkill.h"
-
-static bool rtl8187_is_radio_enabled(struct rtl8187_priv *priv)
-{
-       u8 gpio;
-
-       gpio = rtl818x_ioread8(priv, &priv->map->GPIO0);
-       rtl818x_iowrite8(priv, &priv->map->GPIO0, gpio & ~priv->rfkill_mask);
-       gpio = rtl818x_ioread8(priv, &priv->map->GPIO1);
-
-       return gpio & priv->rfkill_mask;
-}
-
-void rtl8187_rfkill_init(struct ieee80211_hw *hw)
-{
-       struct rtl8187_priv *priv = hw->priv;
-
-       priv->rfkill_off = rtl8187_is_radio_enabled(priv);
-       printk(KERN_INFO "rtl8187: wireless switch is %s\n",
-              priv->rfkill_off ? "on" : "off");
-       wiphy_rfkill_set_hw_state(hw->wiphy, !priv->rfkill_off);
-       wiphy_rfkill_start_polling(hw->wiphy);
-}
-
-void rtl8187_rfkill_poll(struct ieee80211_hw *hw)
-{
-       bool enabled;
-       struct rtl8187_priv *priv = hw->priv;
-
-       mutex_lock(&priv->conf_mutex);
-       enabled = rtl8187_is_radio_enabled(priv);
-       if (unlikely(enabled != priv->rfkill_off)) {
-               priv->rfkill_off = enabled;
-               printk(KERN_INFO "rtl8187: wireless radio switch turned %s\n",
-                      enabled ? "on" : "off");
-               wiphy_rfkill_set_hw_state(hw->wiphy, !enabled);
-       }
-       mutex_unlock(&priv->conf_mutex);
-}
-
-void rtl8187_rfkill_exit(struct ieee80211_hw *hw)
-{
-       wiphy_rfkill_stop_polling(hw->wiphy);
-}
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rfkill.h b/drivers/net/wireless/rtl818x/rtl8187_rfkill.h
deleted file mode 100644 (file)
index e12575e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef RTL8187_RFKILL_H
-#define RTL8187_RFKILL_H
-
-void rtl8187_rfkill_init(struct ieee80211_hw *hw);
-void rtl8187_rfkill_poll(struct ieee80211_hw *hw);
-void rtl8187_rfkill_exit(struct ieee80211_hw *hw);
-
-#endif /* RTL8187_RFKILL_H */
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
deleted file mode 100644 (file)
index 5c6666f..0000000
+++ /dev/null
@@ -1,961 +0,0 @@
-/*
- * Radio tuning for RTL8225 on RTL8187
- *
- * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Based on the r8187 driver, which is:
- * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
- *
- * Magic delays, register offsets, and phy value tables below are
- * taken from the original r8187 driver sources.  Thanks to Realtek
- * for their support!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/init.h>
-#include <linux/usb.h>
-#include <net/mac80211.h>
-
-#include "rtl8187.h"
-#include "rtl8187_rtl8225.h"
-
-static void rtl8225_write_bitbang(struct ieee80211_hw *dev, u8 addr, u16 data)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u16 reg80, reg84, reg82;
-       u32 bangdata;
-       int i;
-
-       bangdata = (data << 4) | (addr & 0xf);
-
-       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput) & 0xfff3;
-       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x7);
-
-       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x7);
-       udelay(10);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       udelay(2);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
-       udelay(10);
-
-       for (i = 15; i >= 0; i--) {
-               u16 reg = reg80 | (bangdata & (1 << i)) >> i;
-
-               if (i & 1)
-                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
-
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1));
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg | (1 << 1));
-
-               if (!(i & 1))
-                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       udelay(10);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84);
-}
-
-static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u16 reg80, reg82, reg84;
-
-       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput);
-       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
-       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect);
-
-       reg80 &= ~(0x3 << 2);
-       reg84 &= ~0xF;
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x0007);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x0007);
-       udelay(10);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       udelay(2);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
-       udelay(10);
-
-       mutex_lock(&priv->io_mutex);
-
-       priv->io_dmabuf->bits16 = data;
-       usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
-                       RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
-                       addr, 0x8225, &priv->io_dmabuf->bits16, sizeof(data),
-                       HZ / 2);
-
-       mutex_unlock(&priv->io_mutex);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       udelay(10);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84);
-}
-
-static void rtl8225_write(struct ieee80211_hw *dev, u8 addr, u16 data)
-{
-       struct rtl8187_priv *priv = dev->priv;
-
-       if (priv->asic_rev)
-               rtl8225_write_8051(dev, addr, cpu_to_le16(data));
-       else
-               rtl8225_write_bitbang(dev, addr, data);
-}
-
-static u16 rtl8225_read(struct ieee80211_hw *dev, u8 addr)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u16 reg80, reg82, reg84, out;
-       int i;
-
-       reg80 = rtl818x_ioread16(priv, &priv->map->RFPinsOutput);
-       reg82 = rtl818x_ioread16(priv, &priv->map->RFPinsEnable);
-       reg84 = rtl818x_ioread16(priv, &priv->map->RFPinsSelect);
-
-       reg80 &= ~0xF;
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82 | 0x000F);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84 | 0x000F);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
-       udelay(4);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
-       udelay(5);
-
-       for (i = 4; i >= 0; i--) {
-               u16 reg = reg80 | ((addr >> i) & 1);
-
-               if (!(i & 1)) {
-                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
-                       udelay(1);
-               }
-
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg | (1 << 1));
-               udelay(2);
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg | (1 << 1));
-               udelay(2);
-
-               if (i & 1) {
-                       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg);
-                       udelay(1);
-               }
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                         reg80 | (1 << 3) | (1 << 1));
-       udelay(2);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                         reg80 | (1 << 3));
-       udelay(2);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                         reg80 | (1 << 3));
-       udelay(2);
-
-       out = 0;
-       for (i = 11; i >= 0; i--) {
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3));
-               udelay(1);
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3) | (1 << 1));
-               udelay(2);
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3) | (1 << 1));
-               udelay(2);
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3) | (1 << 1));
-               udelay(2);
-
-               if (rtl818x_ioread16(priv, &priv->map->RFPinsInput) & (1 << 1))
-                       out |= 1 << i;
-
-               rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                                 reg80 | (1 << 3));
-               udelay(2);
-       }
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput,
-                         reg80 | (1 << 3) | (1 << 2));
-       udelay(2);
-
-       rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, reg82);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, reg84);
-       rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x03A0);
-
-       return out;
-}
-
-static const u16 rtl8225bcd_rxgain[] = {
-       0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
-       0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
-       0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
-       0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
-       0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
-       0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
-       0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
-       0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
-       0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
-       0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
-       0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3,
-       0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb
-};
-
-static const u8 rtl8225_agc[] = {
-       0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
-       0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96,
-       0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e,
-       0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86,
-       0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e,
-       0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36,
-       0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e,
-       0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26,
-       0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e,
-       0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16,
-       0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e,
-       0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06,
-       0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01,
-       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
-};
-
-static const u8 rtl8225_gain[] = {
-       0x23, 0x88, 0x7c, 0xa5, /* -82dBm */
-       0x23, 0x88, 0x7c, 0xb5, /* -82dBm */
-       0x23, 0x88, 0x7c, 0xc5, /* -82dBm */
-       0x33, 0x80, 0x79, 0xc5, /* -78dBm */
-       0x43, 0x78, 0x76, 0xc5, /* -74dBm */
-       0x53, 0x60, 0x73, 0xc5, /* -70dBm */
-       0x63, 0x58, 0x70, 0xc5, /* -66dBm */
-};
-
-static const u8 rtl8225_threshold[] = {
-       0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd
-};
-
-static const u8 rtl8225_tx_gain_cck_ofdm[] = {
-       0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
-};
-
-static const u8 rtl8225_tx_power_cck[] = {
-       0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
-       0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
-       0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
-       0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
-       0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
-       0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
-};
-
-static const u8 rtl8225_tx_power_cck_ch14[] = {
-       0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
-       0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
-       0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
-       0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
-       0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
-       0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
-};
-
-static const u8 rtl8225_tx_power_ofdm[] = {
-       0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
-};
-
-static const u32 rtl8225_chan[] = {
-       0x085c, 0x08dc, 0x095c, 0x09dc, 0x0a5c, 0x0adc, 0x0b5c,
-       0x0bdc, 0x0c5c, 0x0cdc, 0x0d5c, 0x0ddc, 0x0e5c, 0x0f72
-};
-
-static void rtl8225_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u8 cck_power, ofdm_power;
-       const u8 *tmp;
-       u32 reg;
-       int i;
-
-       cck_power = priv->channels[channel - 1].hw_value & 0xF;
-       ofdm_power = priv->channels[channel - 1].hw_value >> 4;
-
-       cck_power = min(cck_power, (u8)11);
-       if (ofdm_power > (u8)15)
-               ofdm_power = 25;
-       else
-               ofdm_power += 10;
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
-                        rtl8225_tx_gain_cck_ofdm[cck_power / 6] >> 1);
-
-       if (channel == 14)
-               tmp = &rtl8225_tx_power_cck_ch14[(cck_power % 6) * 8];
-       else
-               tmp = &rtl8225_tx_power_cck[(cck_power % 6) * 8];
-
-       for (i = 0; i < 8; i++)
-               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
-
-       msleep(1); // FIXME: optional?
-
-       /* anaparam2 on */
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
-                       reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2,
-                         RTL8187_RTL8225_ANAPARAM2_ON);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
-                       reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       rtl8225_write_phy_ofdm(dev, 2, 0x42);
-       rtl8225_write_phy_ofdm(dev, 6, 0x00);
-       rtl8225_write_phy_ofdm(dev, 8, 0x00);
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM,
-                        rtl8225_tx_gain_cck_ofdm[ofdm_power / 6] >> 1);
-
-       tmp = &rtl8225_tx_power_ofdm[ofdm_power % 6];
-
-       rtl8225_write_phy_ofdm(dev, 5, *tmp);
-       rtl8225_write_phy_ofdm(dev, 7, *tmp);
-
-       msleep(1);
-}
-
-static void rtl8225_rf_init(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       int i;
-
-       rtl8225_write(dev, 0x0, 0x067);
-       rtl8225_write(dev, 0x1, 0xFE0);
-       rtl8225_write(dev, 0x2, 0x44D);
-       rtl8225_write(dev, 0x3, 0x441);
-       rtl8225_write(dev, 0x4, 0x486);
-       rtl8225_write(dev, 0x5, 0xBC0);
-       rtl8225_write(dev, 0x6, 0xAE6);
-       rtl8225_write(dev, 0x7, 0x82A);
-       rtl8225_write(dev, 0x8, 0x01F);
-       rtl8225_write(dev, 0x9, 0x334);
-       rtl8225_write(dev, 0xA, 0xFD4);
-       rtl8225_write(dev, 0xB, 0x391);
-       rtl8225_write(dev, 0xC, 0x050);
-       rtl8225_write(dev, 0xD, 0x6DB);
-       rtl8225_write(dev, 0xE, 0x029);
-       rtl8225_write(dev, 0xF, 0x914); msleep(100);
-
-       rtl8225_write(dev, 0x2, 0xC4D); msleep(200);
-       rtl8225_write(dev, 0x2, 0x44D); msleep(200);
-
-       if (!(rtl8225_read(dev, 6) & (1 << 7))) {
-               rtl8225_write(dev, 0x02, 0x0c4d);
-               msleep(200);
-               rtl8225_write(dev, 0x02, 0x044d);
-               msleep(100);
-               if (!(rtl8225_read(dev, 6) & (1 << 7)))
-                       wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n",
-                                  rtl8225_read(dev, 6));
-       }
-
-       rtl8225_write(dev, 0x0, 0x127);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225bcd_rxgain); i++) {
-               rtl8225_write(dev, 0x1, i + 1);
-               rtl8225_write(dev, 0x2, rtl8225bcd_rxgain[i]);
-       }
-
-       rtl8225_write(dev, 0x0, 0x027);
-       rtl8225_write(dev, 0x0, 0x22F);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) {
-               rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]);
-               rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i);
-       }
-
-       msleep(1);
-
-       rtl8225_write_phy_ofdm(dev, 0x00, 0x01);
-       rtl8225_write_phy_ofdm(dev, 0x01, 0x02);
-       rtl8225_write_phy_ofdm(dev, 0x02, 0x42);
-       rtl8225_write_phy_ofdm(dev, 0x03, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x04, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x05, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x06, 0x40);
-       rtl8225_write_phy_ofdm(dev, 0x07, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x08, 0x40);
-       rtl8225_write_phy_ofdm(dev, 0x09, 0xfe);
-       rtl8225_write_phy_ofdm(dev, 0x0a, 0x09);
-       rtl8225_write_phy_ofdm(dev, 0x0b, 0x80);
-       rtl8225_write_phy_ofdm(dev, 0x0c, 0x01);
-       rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3);
-       rtl8225_write_phy_ofdm(dev, 0x0f, 0x38);
-       rtl8225_write_phy_ofdm(dev, 0x10, 0x84);
-       rtl8225_write_phy_ofdm(dev, 0x11, 0x06);
-       rtl8225_write_phy_ofdm(dev, 0x12, 0x20);
-       rtl8225_write_phy_ofdm(dev, 0x13, 0x20);
-       rtl8225_write_phy_ofdm(dev, 0x14, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x15, 0x40);
-       rtl8225_write_phy_ofdm(dev, 0x16, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x17, 0x40);
-       rtl8225_write_phy_ofdm(dev, 0x18, 0xef);
-       rtl8225_write_phy_ofdm(dev, 0x19, 0x19);
-       rtl8225_write_phy_ofdm(dev, 0x1a, 0x20);
-       rtl8225_write_phy_ofdm(dev, 0x1b, 0x76);
-       rtl8225_write_phy_ofdm(dev, 0x1c, 0x04);
-       rtl8225_write_phy_ofdm(dev, 0x1e, 0x95);
-       rtl8225_write_phy_ofdm(dev, 0x1f, 0x75);
-       rtl8225_write_phy_ofdm(dev, 0x20, 0x1f);
-       rtl8225_write_phy_ofdm(dev, 0x21, 0x27);
-       rtl8225_write_phy_ofdm(dev, 0x22, 0x16);
-       rtl8225_write_phy_ofdm(dev, 0x24, 0x46);
-       rtl8225_write_phy_ofdm(dev, 0x25, 0x20);
-       rtl8225_write_phy_ofdm(dev, 0x26, 0x90);
-       rtl8225_write_phy_ofdm(dev, 0x27, 0x88);
-
-       rtl8225_write_phy_ofdm(dev, 0x0d, rtl8225_gain[2 * 4]);
-       rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225_gain[2 * 4 + 2]);
-       rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225_gain[2 * 4 + 3]);
-       rtl8225_write_phy_ofdm(dev, 0x23, rtl8225_gain[2 * 4 + 1]);
-
-       rtl8225_write_phy_cck(dev, 0x00, 0x98);
-       rtl8225_write_phy_cck(dev, 0x03, 0x20);
-       rtl8225_write_phy_cck(dev, 0x04, 0x7e);
-       rtl8225_write_phy_cck(dev, 0x05, 0x12);
-       rtl8225_write_phy_cck(dev, 0x06, 0xfc);
-       rtl8225_write_phy_cck(dev, 0x07, 0x78);
-       rtl8225_write_phy_cck(dev, 0x08, 0x2e);
-       rtl8225_write_phy_cck(dev, 0x10, 0x9b);
-       rtl8225_write_phy_cck(dev, 0x11, 0x88);
-       rtl8225_write_phy_cck(dev, 0x12, 0x47);
-       rtl8225_write_phy_cck(dev, 0x13, 0xd0);
-       rtl8225_write_phy_cck(dev, 0x19, 0x00);
-       rtl8225_write_phy_cck(dev, 0x1a, 0xa0);
-       rtl8225_write_phy_cck(dev, 0x1b, 0x08);
-       rtl8225_write_phy_cck(dev, 0x40, 0x86);
-       rtl8225_write_phy_cck(dev, 0x41, 0x8d);
-       rtl8225_write_phy_cck(dev, 0x42, 0x15);
-       rtl8225_write_phy_cck(dev, 0x43, 0x18);
-       rtl8225_write_phy_cck(dev, 0x44, 0x1f);
-       rtl8225_write_phy_cck(dev, 0x45, 0x1e);
-       rtl8225_write_phy_cck(dev, 0x46, 0x1a);
-       rtl8225_write_phy_cck(dev, 0x47, 0x15);
-       rtl8225_write_phy_cck(dev, 0x48, 0x10);
-       rtl8225_write_phy_cck(dev, 0x49, 0x0a);
-       rtl8225_write_phy_cck(dev, 0x4a, 0x05);
-       rtl8225_write_phy_cck(dev, 0x4b, 0x02);
-       rtl8225_write_phy_cck(dev, 0x4c, 0x05);
-
-       rtl818x_iowrite8(priv, &priv->map->TESTR, 0x0D);
-
-       rtl8225_rf_set_tx_power(dev, 1);
-
-       /* RX antenna default to A */
-       rtl8225_write_phy_cck(dev, 0x10, 0x9b);                 /* B: 0xDB */
-       rtl8225_write_phy_ofdm(dev, 0x26, 0x90);                /* B: 0x10 */
-
-       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);   /* B: 0x00 */
-       msleep(1);
-       rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002);
-
-       /* set sensitivity */
-       rtl8225_write(dev, 0x0c, 0x50);
-       rtl8225_write_phy_ofdm(dev, 0x0d, rtl8225_gain[2 * 4]);
-       rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225_gain[2 * 4 + 2]);
-       rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225_gain[2 * 4 + 3]);
-       rtl8225_write_phy_ofdm(dev, 0x23, rtl8225_gain[2 * 4 + 1]);
-       rtl8225_write_phy_cck(dev, 0x41, rtl8225_threshold[2]);
-}
-
-static const u8 rtl8225z2_agc[] = {
-       0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, 0x55, 0x53, 0x51, 0x4f,
-       0x4d, 0x4b, 0x49, 0x47, 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x39, 0x37,
-       0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25, 0x23, 0x21, 0x1f,
-       0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11, 0x0f, 0x0d, 0x0b, 0x09, 0x07,
-       0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-       0x01, 0x01, 0x01, 0x01, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
-       0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28,
-       0x28, 0x29, 0x2a, 0x2a, 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d,
-       0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30,
-       0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
-       0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31
-};
-static const u8 rtl8225z2_ofdm[] = {
-       0x10, 0x0d, 0x01, 0x00, 0x14, 0xfb, 0xfb, 0x60,
-       0x00, 0x60, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00,
-       0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0xa8, 0x26,
-       0x32, 0x33, 0x07, 0xa5, 0x6f, 0x55, 0xc8, 0xb3,
-       0x0a, 0xe1, 0x2C, 0x8a, 0x86, 0x83, 0x34, 0x0f,
-       0x4f, 0x24, 0x6f, 0xc2, 0x6b, 0x40, 0x80, 0x00,
-       0xc0, 0xc1, 0x58, 0xf1, 0x00, 0xe4, 0x90, 0x3e,
-       0x6d, 0x3c, 0xfb, 0x07
-};
-
-static const u8 rtl8225z2_tx_power_cck_ch14[] = {
-       0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00,
-       0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00,
-       0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00,
-       0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00
-};
-
-static const u8 rtl8225z2_tx_power_cck[] = {
-       0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04,
-       0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03,
-       0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03,
-       0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03
-};
-
-static const u8 rtl8225z2_tx_power_ofdm[] = {
-       0x42, 0x00, 0x40, 0x00, 0x40
-};
-
-static const u8 rtl8225z2_tx_gain_cck_ofdm[] = {
-       0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
-       0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
-       0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
-       0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-       0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
-       0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23
-};
-
-static void rtl8225z2_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u8 cck_power, ofdm_power;
-       const u8 *tmp;
-       u32 reg;
-       int i;
-
-       cck_power = priv->channels[channel - 1].hw_value & 0xF;
-       ofdm_power = priv->channels[channel - 1].hw_value >> 4;
-
-       cck_power = min(cck_power, (u8)15);
-       cck_power += priv->txpwr_base & 0xF;
-       cck_power = min(cck_power, (u8)35);
-
-       if (ofdm_power > (u8)15)
-               ofdm_power = 25;
-       else
-               ofdm_power += 10;
-       ofdm_power += priv->txpwr_base >> 4;
-       ofdm_power = min(ofdm_power, (u8)35);
-
-       if (channel == 14)
-               tmp = rtl8225z2_tx_power_cck_ch14;
-       else
-               tmp = rtl8225z2_tx_power_cck;
-
-       for (i = 0; i < 8; i++)
-               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
-                        rtl8225z2_tx_gain_cck_ofdm[cck_power]);
-       msleep(1);
-
-       /* anaparam2 on */
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       reg = rtl818x_ioread8(priv, &priv->map->CONFIG3);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
-                       reg | RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite32(priv, &priv->map->ANAPARAM2,
-                         RTL8187_RTL8225_ANAPARAM2_ON);
-       rtl818x_iowrite8(priv, &priv->map->CONFIG3,
-                       reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE);
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-
-       rtl8225_write_phy_ofdm(dev, 2, 0x42);
-       rtl8225_write_phy_ofdm(dev, 5, 0x00);
-       rtl8225_write_phy_ofdm(dev, 6, 0x40);
-       rtl8225_write_phy_ofdm(dev, 7, 0x00);
-       rtl8225_write_phy_ofdm(dev, 8, 0x40);
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM,
-                        rtl8225z2_tx_gain_cck_ofdm[ofdm_power]);
-       msleep(1);
-}
-
-static void rtl8225z2_b_rf_set_tx_power(struct ieee80211_hw *dev, int channel)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       u8 cck_power, ofdm_power;
-       const u8 *tmp;
-       int i;
-
-       cck_power = priv->channels[channel - 1].hw_value & 0xF;
-       ofdm_power = priv->channels[channel - 1].hw_value >> 4;
-
-       if (cck_power > 15)
-               cck_power = (priv->hw_rev == RTL8187BvB) ? 15 : 22;
-       else
-               cck_power += (priv->hw_rev == RTL8187BvB) ? 0 : 7;
-       cck_power += priv->txpwr_base & 0xF;
-       cck_power = min(cck_power, (u8)35);
-
-       if (ofdm_power > 15)
-               ofdm_power = (priv->hw_rev == RTL8187BvB) ? 17 : 25;
-       else
-               ofdm_power += (priv->hw_rev == RTL8187BvB) ? 2 : 10;
-       ofdm_power += (priv->txpwr_base >> 4) & 0xF;
-       ofdm_power = min(ofdm_power, (u8)35);
-
-       if (channel == 14)
-               tmp = rtl8225z2_tx_power_cck_ch14;
-       else
-               tmp = rtl8225z2_tx_power_cck;
-
-       if (priv->hw_rev == RTL8187BvB) {
-               if (cck_power <= 6)
-                       ; /* do nothing */
-               else if (cck_power <= 11)
-                       tmp += 8;
-               else
-                       tmp += 16;
-       } else {
-               if (cck_power <= 5)
-                       ; /* do nothing */
-               else if (cck_power <= 11)
-                       tmp += 8;
-               else if (cck_power <= 17)
-                       tmp += 16;
-               else
-                       tmp += 24;
-       }
-
-       for (i = 0; i < 8; i++)
-               rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
-                        rtl8225z2_tx_gain_cck_ofdm[cck_power] << 1);
-       msleep(1);
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM,
-                        rtl8225z2_tx_gain_cck_ofdm[ofdm_power] << 1);
-       if (priv->hw_rev == RTL8187BvB) {
-               if (ofdm_power <= 11) {
-                       rtl8225_write_phy_ofdm(dev, 0x87, 0x60);
-                       rtl8225_write_phy_ofdm(dev, 0x89, 0x60);
-               } else {
-                       rtl8225_write_phy_ofdm(dev, 0x87, 0x5c);
-                       rtl8225_write_phy_ofdm(dev, 0x89, 0x5c);
-               }
-       } else {
-               if (ofdm_power <= 11) {
-                       rtl8225_write_phy_ofdm(dev, 0x87, 0x5c);
-                       rtl8225_write_phy_ofdm(dev, 0x89, 0x5c);
-               } else if (ofdm_power <= 17) {
-                       rtl8225_write_phy_ofdm(dev, 0x87, 0x54);
-                       rtl8225_write_phy_ofdm(dev, 0x89, 0x54);
-               } else {
-                       rtl8225_write_phy_ofdm(dev, 0x87, 0x50);
-                       rtl8225_write_phy_ofdm(dev, 0x89, 0x50);
-               }
-       }
-       msleep(1);
-}
-
-static const u16 rtl8225z2_rxgain[] = {
-       0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
-       0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
-       0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
-       0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
-       0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
-       0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
-       0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
-       0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
-       0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
-       0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
-       0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
-       0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
-};
-
-static const u8 rtl8225z2_gain_bg[] = {
-       0x23, 0x15, 0xa5, /* -82-1dBm */
-       0x23, 0x15, 0xb5, /* -82-2dBm */
-       0x23, 0x15, 0xc5, /* -82-3dBm */
-       0x33, 0x15, 0xc5, /* -78dBm */
-       0x43, 0x15, 0xc5, /* -74dBm */
-       0x53, 0x15, 0xc5, /* -70dBm */
-       0x63, 0x15, 0xc5  /* -66dBm */
-};
-
-static void rtl8225z2_rf_init(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       int i;
-
-       rtl8225_write(dev, 0x0, 0x2BF);
-       rtl8225_write(dev, 0x1, 0xEE0);
-       rtl8225_write(dev, 0x2, 0x44D);
-       rtl8225_write(dev, 0x3, 0x441);
-       rtl8225_write(dev, 0x4, 0x8C3);
-       rtl8225_write(dev, 0x5, 0xC72);
-       rtl8225_write(dev, 0x6, 0x0E6);
-       rtl8225_write(dev, 0x7, 0x82A);
-       rtl8225_write(dev, 0x8, 0x03F);
-       rtl8225_write(dev, 0x9, 0x335);
-       rtl8225_write(dev, 0xa, 0x9D4);
-       rtl8225_write(dev, 0xb, 0x7BB);
-       rtl8225_write(dev, 0xc, 0x850);
-       rtl8225_write(dev, 0xd, 0xCDF);
-       rtl8225_write(dev, 0xe, 0x02B);
-       rtl8225_write(dev, 0xf, 0x114);
-       msleep(100);
-
-       rtl8225_write(dev, 0x0, 0x1B7);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) {
-               rtl8225_write(dev, 0x1, i + 1);
-               rtl8225_write(dev, 0x2, rtl8225z2_rxgain[i]);
-       }
-
-       rtl8225_write(dev, 0x3, 0x080);
-       rtl8225_write(dev, 0x5, 0x004);
-       rtl8225_write(dev, 0x0, 0x0B7);
-       rtl8225_write(dev, 0x2, 0xc4D);
-
-       msleep(200);
-       rtl8225_write(dev, 0x2, 0x44D);
-       msleep(100);
-
-       if (!(rtl8225_read(dev, 6) & (1 << 7))) {
-               rtl8225_write(dev, 0x02, 0x0C4D);
-               msleep(200);
-               rtl8225_write(dev, 0x02, 0x044D);
-               msleep(100);
-               if (!(rtl8225_read(dev, 6) & (1 << 7)))
-                       wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n",
-                                  rtl8225_read(dev, 6));
-       }
-
-       msleep(200);
-
-       rtl8225_write(dev, 0x0, 0x2BF);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) {
-               rtl8225_write_phy_ofdm(dev, 0xB, rtl8225_agc[i]);
-               rtl8225_write_phy_ofdm(dev, 0xA, 0x80 + i);
-       }
-
-       msleep(1);
-
-       rtl8225_write_phy_ofdm(dev, 0x00, 0x01);
-       rtl8225_write_phy_ofdm(dev, 0x01, 0x02);
-       rtl8225_write_phy_ofdm(dev, 0x02, 0x42);
-       rtl8225_write_phy_ofdm(dev, 0x03, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x04, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x05, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x06, 0x40);
-       rtl8225_write_phy_ofdm(dev, 0x07, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x08, 0x40);
-       rtl8225_write_phy_ofdm(dev, 0x09, 0xfe);
-       rtl8225_write_phy_ofdm(dev, 0x0a, 0x08);
-       rtl8225_write_phy_ofdm(dev, 0x0b, 0x80);
-       rtl8225_write_phy_ofdm(dev, 0x0c, 0x01);
-       rtl8225_write_phy_ofdm(dev, 0x0d, 0x43);
-       rtl8225_write_phy_ofdm(dev, 0x0e, 0xd3);
-       rtl8225_write_phy_ofdm(dev, 0x0f, 0x38);
-       rtl8225_write_phy_ofdm(dev, 0x10, 0x84);
-       rtl8225_write_phy_ofdm(dev, 0x11, 0x07);
-       rtl8225_write_phy_ofdm(dev, 0x12, 0x20);
-       rtl8225_write_phy_ofdm(dev, 0x13, 0x20);
-       rtl8225_write_phy_ofdm(dev, 0x14, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x15, 0x40);
-       rtl8225_write_phy_ofdm(dev, 0x16, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x17, 0x40);
-       rtl8225_write_phy_ofdm(dev, 0x18, 0xef);
-       rtl8225_write_phy_ofdm(dev, 0x19, 0x19);
-       rtl8225_write_phy_ofdm(dev, 0x1a, 0x20);
-       rtl8225_write_phy_ofdm(dev, 0x1b, 0x15);
-       rtl8225_write_phy_ofdm(dev, 0x1c, 0x04);
-       rtl8225_write_phy_ofdm(dev, 0x1d, 0xc5);
-       rtl8225_write_phy_ofdm(dev, 0x1e, 0x95);
-       rtl8225_write_phy_ofdm(dev, 0x1f, 0x75);
-       rtl8225_write_phy_ofdm(dev, 0x20, 0x1f);
-       rtl8225_write_phy_ofdm(dev, 0x21, 0x17);
-       rtl8225_write_phy_ofdm(dev, 0x22, 0x16);
-       rtl8225_write_phy_ofdm(dev, 0x23, 0x80);
-       rtl8225_write_phy_ofdm(dev, 0x24, 0x46);
-       rtl8225_write_phy_ofdm(dev, 0x25, 0x00);
-       rtl8225_write_phy_ofdm(dev, 0x26, 0x90);
-       rtl8225_write_phy_ofdm(dev, 0x27, 0x88);
-
-       rtl8225_write_phy_ofdm(dev, 0x0b, rtl8225z2_gain_bg[4 * 3]);
-       rtl8225_write_phy_ofdm(dev, 0x1b, rtl8225z2_gain_bg[4 * 3 + 1]);
-       rtl8225_write_phy_ofdm(dev, 0x1d, rtl8225z2_gain_bg[4 * 3 + 2]);
-       rtl8225_write_phy_ofdm(dev, 0x21, 0x37);
-
-       rtl8225_write_phy_cck(dev, 0x00, 0x98);
-       rtl8225_write_phy_cck(dev, 0x03, 0x20);
-       rtl8225_write_phy_cck(dev, 0x04, 0x7e);
-       rtl8225_write_phy_cck(dev, 0x05, 0x12);
-       rtl8225_write_phy_cck(dev, 0x06, 0xfc);
-       rtl8225_write_phy_cck(dev, 0x07, 0x78);
-       rtl8225_write_phy_cck(dev, 0x08, 0x2e);
-       rtl8225_write_phy_cck(dev, 0x10, 0x9b);
-       rtl8225_write_phy_cck(dev, 0x11, 0x88);
-       rtl8225_write_phy_cck(dev, 0x12, 0x47);
-       rtl8225_write_phy_cck(dev, 0x13, 0xd0);
-       rtl8225_write_phy_cck(dev, 0x19, 0x00);
-       rtl8225_write_phy_cck(dev, 0x1a, 0xa0);
-       rtl8225_write_phy_cck(dev, 0x1b, 0x08);
-       rtl8225_write_phy_cck(dev, 0x40, 0x86);
-       rtl8225_write_phy_cck(dev, 0x41, 0x8d);
-       rtl8225_write_phy_cck(dev, 0x42, 0x15);
-       rtl8225_write_phy_cck(dev, 0x43, 0x18);
-       rtl8225_write_phy_cck(dev, 0x44, 0x36);
-       rtl8225_write_phy_cck(dev, 0x45, 0x35);
-       rtl8225_write_phy_cck(dev, 0x46, 0x2e);
-       rtl8225_write_phy_cck(dev, 0x47, 0x25);
-       rtl8225_write_phy_cck(dev, 0x48, 0x1c);
-       rtl8225_write_phy_cck(dev, 0x49, 0x12);
-       rtl8225_write_phy_cck(dev, 0x4a, 0x09);
-       rtl8225_write_phy_cck(dev, 0x4b, 0x04);
-       rtl8225_write_phy_cck(dev, 0x4c, 0x05);
-
-       rtl818x_iowrite8(priv, (u8 *)0xFF5B, 0x0D); msleep(1);
-
-       rtl8225z2_rf_set_tx_power(dev, 1);
-
-       /* RX antenna default to A */
-       rtl8225_write_phy_cck(dev, 0x10, 0x9b);                 /* B: 0xDB */
-       rtl8225_write_phy_ofdm(dev, 0x26, 0x90);                /* B: 0x10 */
-
-       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);   /* B: 0x00 */
-       msleep(1);
-       rtl818x_iowrite32(priv, (__le32 *)0xFF94, 0x3dc00002);
-}
-
-static void rtl8225z2_b_rf_init(struct ieee80211_hw *dev)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       int i;
-
-       rtl8225_write(dev, 0x0, 0x0B7);
-       rtl8225_write(dev, 0x1, 0xEE0);
-       rtl8225_write(dev, 0x2, 0x44D);
-       rtl8225_write(dev, 0x3, 0x441);
-       rtl8225_write(dev, 0x4, 0x8C3);
-       rtl8225_write(dev, 0x5, 0xC72);
-       rtl8225_write(dev, 0x6, 0x0E6);
-       rtl8225_write(dev, 0x7, 0x82A);
-       rtl8225_write(dev, 0x8, 0x03F);
-       rtl8225_write(dev, 0x9, 0x335);
-       rtl8225_write(dev, 0xa, 0x9D4);
-       rtl8225_write(dev, 0xb, 0x7BB);
-       rtl8225_write(dev, 0xc, 0x850);
-       rtl8225_write(dev, 0xd, 0xCDF);
-       rtl8225_write(dev, 0xe, 0x02B);
-       rtl8225_write(dev, 0xf, 0x114);
-
-       rtl8225_write(dev, 0x0, 0x1B7);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) {
-               rtl8225_write(dev, 0x1, i + 1);
-               rtl8225_write(dev, 0x2, rtl8225z2_rxgain[i]);
-       }
-
-       rtl8225_write(dev, 0x3, 0x080);
-       rtl8225_write(dev, 0x5, 0x004);
-       rtl8225_write(dev, 0x0, 0x0B7);
-
-       rtl8225_write(dev, 0x2, 0xC4D);
-
-       rtl8225_write(dev, 0x2, 0x44D);
-       rtl8225_write(dev, 0x0, 0x2BF);
-
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK, 0x03);
-       rtl818x_iowrite8(priv, &priv->map->TX_GAIN_OFDM, 0x07);
-       rtl818x_iowrite8(priv, &priv->map->TX_ANTENNA, 0x03);
-
-       rtl8225_write_phy_ofdm(dev, 0x80, 0x12);
-       for (i = 0; i < ARRAY_SIZE(rtl8225z2_agc); i++) {
-               rtl8225_write_phy_ofdm(dev, 0xF, rtl8225z2_agc[i]);
-               rtl8225_write_phy_ofdm(dev, 0xE, 0x80 + i);
-               rtl8225_write_phy_ofdm(dev, 0xE, 0);
-       }
-       rtl8225_write_phy_ofdm(dev, 0x80, 0x10);
-
-       for (i = 0; i < ARRAY_SIZE(rtl8225z2_ofdm); i++)
-               rtl8225_write_phy_ofdm(dev, i, rtl8225z2_ofdm[i]);
-
-       rtl8225_write_phy_ofdm(dev, 0x97, 0x46);
-       rtl8225_write_phy_ofdm(dev, 0xa4, 0xb6);
-       rtl8225_write_phy_ofdm(dev, 0x85, 0xfc);
-       rtl8225_write_phy_cck(dev, 0xc1, 0x88);
-}
-
-static void rtl8225_rf_stop(struct ieee80211_hw *dev)
-{
-       rtl8225_write(dev, 0x4, 0x1f);
-}
-
-static void rtl8225_rf_set_channel(struct ieee80211_hw *dev,
-                                  struct ieee80211_conf *conf)
-{
-       struct rtl8187_priv *priv = dev->priv;
-       int chan = ieee80211_frequency_to_channel(conf->channel->center_freq);
-
-       if (priv->rf->init == rtl8225_rf_init)
-               rtl8225_rf_set_tx_power(dev, chan);
-       else if (priv->rf->init == rtl8225z2_rf_init)
-               rtl8225z2_rf_set_tx_power(dev, chan);
-       else
-               rtl8225z2_b_rf_set_tx_power(dev, chan);
-
-       rtl8225_write(dev, 0x7, rtl8225_chan[chan - 1]);
-       msleep(10);
-}
-
-static const struct rtl818x_rf_ops rtl8225_ops = {
-       .name           = "rtl8225",
-       .init           = rtl8225_rf_init,
-       .stop           = rtl8225_rf_stop,
-       .set_chan       = rtl8225_rf_set_channel
-};
-
-static const struct rtl818x_rf_ops rtl8225z2_ops = {
-       .name           = "rtl8225z2",
-       .init           = rtl8225z2_rf_init,
-       .stop           = rtl8225_rf_stop,
-       .set_chan       = rtl8225_rf_set_channel
-};
-
-static const struct rtl818x_rf_ops rtl8225z2_b_ops = {
-       .name           = "rtl8225z2",
-       .init           = rtl8225z2_b_rf_init,
-       .stop           = rtl8225_rf_stop,
-       .set_chan       = rtl8225_rf_set_channel
-};
-
-const struct rtl818x_rf_ops * rtl8187_detect_rf(struct ieee80211_hw *dev)
-{
-       u16 reg8, reg9;
-       struct rtl8187_priv *priv = dev->priv;
-
-       if (!priv->is_rtl8187b) {
-               rtl8225_write(dev, 0, 0x1B7);
-
-               reg8 = rtl8225_read(dev, 8);
-               reg9 = rtl8225_read(dev, 9);
-
-               rtl8225_write(dev, 0, 0x0B7);
-
-               if (reg8 != 0x588 || reg9 != 0x700)
-                       return &rtl8225_ops;
-
-               return &rtl8225z2_ops;
-       } else
-               return &rtl8225z2_b_ops;
-}
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.h b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.h
deleted file mode 100644 (file)
index 20c5b6e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Radio tuning definitions for RTL8225 on RTL8187
- *
- * Copyright 2007 Michael Wu <flamingice@sourmilk.net>
- * Copyright 2007 Andrea Merello <andreamrl@tiscali.it>
- *
- * Based on the r8187 driver, which is:
- * Copyright 2005 Andrea Merello <andreamrl@tiscali.it>, et al.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef RTL8187_RTL8225_H
-#define RTL8187_RTL8225_H
-
-#define RTL8187_RTL8225_ANAPARAM_ON    0xa0000a59
-#define RTL8187_RTL8225_ANAPARAM2_ON   0x860c7312
-#define RTL8187_RTL8225_ANAPARAM_OFF   0xa00beb59
-#define RTL8187_RTL8225_ANAPARAM2_OFF  0x840dec11
-
-#define RTL8187B_RTL8225_ANAPARAM_ON   0x45090658
-#define RTL8187B_RTL8225_ANAPARAM2_ON  0x727f3f52
-#define RTL8187B_RTL8225_ANAPARAM3_ON  0x00
-#define RTL8187B_RTL8225_ANAPARAM_OFF  0x55480658
-#define RTL8187B_RTL8225_ANAPARAM2_OFF 0x72003f50
-#define RTL8187B_RTL8225_ANAPARAM3_OFF 0x00
-
-const struct rtl818x_rf_ops * rtl8187_detect_rf(struct ieee80211_hw *);
-
-static inline void rtl8225_write_phy_ofdm(struct ieee80211_hw *dev,
-                                         u8 addr, u32 data)
-{
-       rtl8187_write_phy(dev, addr, data);
-}
-
-static inline void rtl8225_write_phy_cck(struct ieee80211_hw *dev,
-                                        u8 addr, u32 data)
-{
-       rtl8187_write_phy(dev, addr, data | 0x10000);
-}
-
-#endif /* RTL8187_RTL8225_H */
index f6cc073..cf0b73e 100644 (file)
@@ -251,16 +251,14 @@ void rtl_init_rfkill(struct ieee80211_hw *hw)
        bool blocked;
        u8 valid = 0;
 
-       /*set init state to rf on */
-       rtlpriv->rfkill.rfkill_state = 1;
-
        radio_state = rtlpriv->cfg->ops->radio_onoff_checking(hw, &valid);
 
-       if (valid) {
-               RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
-                        (KERN_INFO "wireless switch is %s\n",
-                         rtlpriv->rfkill.rfkill_state ? "on" : "off"));
+       /*set init state to that of switch */
+       rtlpriv->rfkill.rfkill_state = radio_state;
+       printk(KERN_INFO "rtlwifi: wireless switch is %s\n",
+              rtlpriv->rfkill.rfkill_state ? "on" : "off");
 
+       if (valid) {
                rtlpriv->rfkill.rfkill_state = radio_state;
 
                blocked = (rtlpriv->rfkill.rfkill_state == 1) ? 0 : 1;
index bf3b574..0fa36aa 100644 (file)
@@ -612,10 +612,22 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
                                                    num_rx_inperiod++;
                                }
 
-                               if (unlikely(!rtl_action_proc(hw, skb, false)))
+                               if (unlikely(!rtl_action_proc(hw, skb,
+                                   false))) {
                                        dev_kfree_skb_any(skb);
-                               else
-                                       ieee80211_rx_irqsafe(hw, skb);
+                               } else {
+                                       struct sk_buff *uskb = NULL;
+                                       u8 *pdata;
+                                       uskb = dev_alloc_skb(skb->len + 128);
+                                       memcpy(IEEE80211_SKB_RXCB(uskb),
+                                                       &rx_status,
+                                                       sizeof(rx_status));
+                                       pdata = (u8 *)skb_put(uskb, skb->len);
+                                       memcpy(pdata, skb->data, skb->len);
+                                       dev_kfree_skb_any(skb);
+
+                                       ieee80211_rx_irqsafe(hw, uskb);
+                               }
                        } else {
                                dev_kfree_skb_any(skb);
                        }
@@ -1608,7 +1620,7 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
                pcipriv->ndis_adapter.pcibridge_funcnum =
                    PCI_FUNC(bridge_pdev->devfn);
                pcipriv->ndis_adapter.pcibridge_pciehdr_offset =
-                   bridge_pdev->pcie_cap;
+                   pci_pcie_cap(bridge_pdev);
                pcipriv->ndis_adapter.pcicfg_addrport =
                    (pcipriv->ndis_adapter.pcibridge_busnum << 16) |
                    (pcipriv->ndis_adapter.pcibridge_devnum << 11) |
index 1266dbe..1c41a0c 100644 (file)
@@ -962,17 +962,6 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw)
        rtl_cam_reset_all_entry(hw);
        rtl92ce_enable_hw_security_config(hw);
        ppsc->rfpwr_state = ERFON;
-       tmp_u1b = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG)&(~BIT(3));
-       rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, tmp_u1b);
-       tmp_u1b = rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL);
-       ppsc->rfoff_reason |= (tmp_u1b & BIT(3)) ? 0 : RF_CHANGE_BY_HW;
-       if (ppsc->rfoff_reason > RF_CHANGE_BY_PS)
-               rtl_ps_set_rf_state(hw, ERFOFF, ppsc->rfoff_reason, true);
-       else {
-               ppsc->rfpwr_state = ERFON;
-               ppsc->rfoff_reason = 0;
-               rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_ON);
-       }
        rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr);
        _rtl92ce_enable_aspm_back_door(hw);
        rtlpriv->intf_ops->enable_aspm(hw);
index 61572df..d729daf 100644 (file)
@@ -19,7 +19,6 @@
  *
  */
 
-#include <linux/gpio.h>
 #include <linux/slab.h>
 
 #include "reg.h"
index 4a9f929..4df04f8 100644 (file)
@@ -21,7 +21,6 @@
  *
  */
 
-#include <linux/gpio.h>
 #include <linux/slab.h>
 
 #include "acx.h"
index ee079ab..5a0985d 100644 (file)
@@ -405,10 +405,10 @@ int ssb_bus_scan(struct ssb_bus *bus,
                                /* Ignore PCI cores on PCI-E cards.
                                 * Ignore PCI-E cores on PCI cards. */
                                if (dev->id.coreid == SSB_DEV_PCI) {
-                                       if (bus->host_pci->is_pcie)
+                                       if (pci_is_pcie(bus->host_pci))
                                                continue;
                                } else {
-                                       if (!bus->host_pci->is_pcie)
+                                       if (!pci_is_pcie(bus->host_pci))
                                                continue;
                                }
                        }
index d81ea79..0c5e725 100644 (file)
@@ -144,6 +144,7 @@ struct bt_skb_cb {
        __u8 tx_seq;
        __u8 retries;
        __u8 sar;
+       unsigned short channel;
 };
 #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
 
index f3c5ed6..29a7a8c 100644 (file)
@@ -934,9 +934,13 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
 struct sockaddr_hci {
        sa_family_t    hci_family;
        unsigned short hci_dev;
+       unsigned short hci_channel;
 };
 #define HCI_DEV_NONE   0xffff
 
+#define HCI_CHANNEL_RAW                0
+#define HCI_CHANNEL_CONTROL    1
+
 struct hci_filter {
        unsigned long type_mask;
        unsigned long event_mask[2];
index 9c08625..a29feb0 100644 (file)
@@ -129,6 +129,7 @@ struct hci_dev {
        wait_queue_head_t       req_wait_q;
        __u32                   req_status;
        __u32                   req_result;
+       __u16                   req_last_cmd;
 
        struct inquiry_cache    inq_cache;
        struct hci_conn_hash    conn_hash;
@@ -660,6 +661,11 @@ void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);
 /* ----- HCI Sockets ----- */
 void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb);
 
+/* Management interface */
+int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
+int mgmt_index_added(u16 index);
+int mgmt_index_removed(u16 index);
+
 /* HCI info for socket */
 #define hci_pi(sk) ((struct hci_pinfo *) sk)
 
@@ -668,6 +674,7 @@ struct hci_pinfo {
        struct hci_dev    *hdev;
        struct hci_filter filter;
        __u32             cmsg_mask;
+       unsigned short   channel;
 };
 
 /* HCI security filter */
@@ -687,6 +694,6 @@ struct hci_sec_filter {
 #define hci_req_lock(d)                mutex_lock(&d->req_lock)
 #define hci_req_unlock(d)      mutex_unlock(&d->req_lock)
 
-void hci_req_complete(struct hci_dev *hdev, int result);
+void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result);
 
 #endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
new file mode 100644 (file)
index 0000000..ca29c13
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+   BlueZ - Bluetooth protocol stack for Linux
+
+   Copyright (C) 2010  Nokia Corporation
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 2 as
+   published by the Free Software Foundation;
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
+   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
+   SOFTWARE IS DISCLAIMED.
+*/
+
+struct mgmt_hdr {
+       __le16 opcode;
+       __le16 len;
+} __packed;
+#define MGMT_HDR_SIZE                  4
+
+#define MGMT_OP_READ_VERSION           0x0001
+struct mgmt_rp_read_version {
+       __u8 version;
+       __le16 revision;
+} __packed;
+
+#define MGMT_OP_READ_INDEX_LIST                0x0003
+struct mgmt_rp_read_index_list {
+       __le16 num_controllers;
+       __le16 index[0];
+} __packed;
+
+#define MGMT_OP_READ_INFO              0x0004
+struct mgmt_cp_read_info {
+       __le16 index;
+} __packed;
+struct mgmt_rp_read_info {
+       __le16 index;
+       __u8 type;
+       __u8 powered;
+       __u8 discoverable;
+       __u8 pairable;
+       __u8 sec_mode;
+       bdaddr_t bdaddr;
+       __u8 dev_class[3];
+       __u8 features[8];
+       __u16 manufacturer;
+       __u8 hci_ver;
+       __u16 hci_rev;
+} __packed;
+
+#define MGMT_EV_CMD_COMPLETE           0x0001
+struct mgmt_ev_cmd_complete {
+       __le16 opcode;
+       __u8 data[0];
+} __packed;
+
+#define MGMT_EV_CMD_STATUS             0x0002
+struct mgmt_ev_cmd_status {
+       __u8 status;
+       __le16 opcode;
+} __packed;
+
+#define MGMT_EV_CONTROLLER_ERROR       0x0003
+struct mgmt_ev_controller_error {
+       __le16 index;
+       __u8 error_code;
+} __packed;
+
+#define MGMT_EV_INDEX_ADDED            0x0004
+struct mgmt_ev_index_added {
+       __le16 index;
+} __packed;
+
+#define MGMT_EV_INDEX_REMOVED          0x0005
+struct mgmt_ev_index_removed {
+       __le16 index;
+} __packed;
index 7ca1f46..250f954 100644 (file)
@@ -10,4 +10,4 @@ obj-$(CONFIG_BT_BNEP) += bnep/
 obj-$(CONFIG_BT_CMTP)  += cmtp/
 obj-$(CONFIG_BT_HIDP)  += hidp/
 
-bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o hci_sock.o hci_sysfs.o lib.o
+bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o hci_sock.o hci_sysfs.o lib.o
index 51c61f7..8b602d8 100644 (file)
@@ -91,9 +91,16 @@ static void hci_notify(struct hci_dev *hdev, int event)
 
 /* ---- HCI requests ---- */
 
-void hci_req_complete(struct hci_dev *hdev, int result)
+void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result)
 {
-       BT_DBG("%s result 0x%2.2x", hdev->name, result);
+       BT_DBG("%s command 0x%04x result 0x%2.2x", hdev->name, cmd, result);
+
+       /* If the request has set req_last_cmd (typical for multi-HCI
+        * command requests) check if the completed command matches
+        * this, and if not just return. Single HCI command requests
+        * typically leave req_last_cmd as 0 */
+       if (hdev->req_last_cmd && cmd != hdev->req_last_cmd)
+               return;
 
        if (hdev->req_status == HCI_REQ_PEND) {
                hdev->req_result = result;
@@ -149,7 +156,7 @@ static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev,
                break;
        }
 
-       hdev->req_status = hdev->req_result = 0;
+       hdev->req_last_cmd = hdev->req_status = hdev->req_result = 0;
 
        BT_DBG("%s end: err %d", hdev->name, err);
 
@@ -252,6 +259,8 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
        /* Connection accept timeout ~20 secs */
        param = cpu_to_le16(0x7d00);
        hci_send_cmd(hdev, HCI_OP_WRITE_CA_TIMEOUT, 2, &param);
+
+       hdev->req_last_cmd = HCI_OP_WRITE_CA_TIMEOUT;
 }
 
 static void hci_scan_req(struct hci_dev *hdev, unsigned long opt)
@@ -960,6 +969,7 @@ int hci_register_dev(struct hci_dev *hdev)
                }
        }
 
+       mgmt_index_added(hdev->id);
        hci_notify(hdev, HCI_DEV_REG);
 
        return id;
@@ -989,6 +999,7 @@ int hci_unregister_dev(struct hci_dev *hdev)
        for (i = 0; i < NUM_REASSEMBLY; i++)
                kfree_skb(hdev->reassembly[i]);
 
+       mgmt_index_removed(hdev->id);
        hci_notify(hdev, HCI_DEV_UNREG);
 
        if (hdev->rfkill) {
index 8923b36..3810017 100644 (file)
@@ -58,7 +58,7 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)
 
        clear_bit(HCI_INQUIRY, &hdev->flags);
 
-       hci_req_complete(hdev, status);
+       hci_req_complete(hdev, HCI_OP_INQUIRY_CANCEL, status);
 
        hci_conn_check_pending(hdev);
 }
@@ -174,7 +174,7 @@ static void hci_cc_write_def_link_policy(struct hci_dev *hdev, struct sk_buff *s
        if (!status)
                hdev->link_policy = get_unaligned_le16(sent);
 
-       hci_req_complete(hdev, status);
+       hci_req_complete(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, status);
 }
 
 static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
@@ -183,7 +183,7 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
 
        BT_DBG("%s status 0x%x", hdev->name, status);
 
-       hci_req_complete(hdev, status);
+       hci_req_complete(hdev, HCI_OP_RESET, status);
 }
 
 static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb)
@@ -235,7 +235,7 @@ static void hci_cc_write_auth_enable(struct hci_dev *hdev, struct sk_buff *skb)
                        clear_bit(HCI_AUTH, &hdev->flags);
        }
 
-       hci_req_complete(hdev, status);
+       hci_req_complete(hdev, HCI_OP_WRITE_AUTH_ENABLE, status);
 }
 
 static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb)
@@ -258,7 +258,7 @@ static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb)
                        clear_bit(HCI_ENCRYPT, &hdev->flags);
        }
 
-       hci_req_complete(hdev, status);
+       hci_req_complete(hdev, HCI_OP_WRITE_ENCRYPT_MODE, status);
 }
 
 static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb)
@@ -285,7 +285,7 @@ static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb)
                        set_bit(HCI_PSCAN, &hdev->flags);
        }
 
-       hci_req_complete(hdev, status);
+       hci_req_complete(hdev, HCI_OP_WRITE_SCAN_ENABLE, status);
 }
 
 static void hci_cc_read_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb)
@@ -383,7 +383,7 @@ static void hci_cc_host_buffer_size(struct hci_dev *hdev, struct sk_buff *skb)
 
        BT_DBG("%s status 0x%x", hdev->name, status);
 
-       hci_req_complete(hdev, status);
+       hci_req_complete(hdev, HCI_OP_HOST_BUFFER_SIZE, status);
 }
 
 static void hci_cc_read_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb)
@@ -536,7 +536,16 @@ static void hci_cc_read_bd_addr(struct hci_dev *hdev, struct sk_buff *skb)
        if (!rp->status)
                bacpy(&hdev->bdaddr, &rp->bdaddr);
 
-       hci_req_complete(hdev, rp->status);
+       hci_req_complete(hdev, HCI_OP_READ_BD_ADDR, rp->status);
+}
+
+static void hci_cc_write_ca_timeout(struct hci_dev *hdev, struct sk_buff *skb)
+{
+       __u8 status = *((__u8 *) skb->data);
+
+       BT_DBG("%s status 0x%x", hdev->name, status);
+
+       hci_req_complete(hdev, HCI_OP_WRITE_CA_TIMEOUT, status);
 }
 
 static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
@@ -544,7 +553,7 @@ static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
        BT_DBG("%s status 0x%x", hdev->name, status);
 
        if (status) {
-               hci_req_complete(hdev, status);
+               hci_req_complete(hdev, HCI_OP_INQUIRY, status);
 
                hci_conn_check_pending(hdev);
        } else
@@ -871,7 +880,7 @@ static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff
 
        clear_bit(HCI_INQUIRY, &hdev->flags);
 
-       hci_req_complete(hdev, status);
+       hci_req_complete(hdev, HCI_OP_INQUIRY, status);
 
        hci_conn_check_pending(hdev);
 }
@@ -1379,6 +1388,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk
                hci_cc_read_bd_addr(hdev, skb);
                break;
 
+       case HCI_OP_WRITE_CA_TIMEOUT:
+               hci_cc_write_ca_timeout(hdev, skb);
+               break;
+
        default:
                BT_DBG("%s opcode 0x%x", hdev->name, opcode);
                break;
index b3753ba..29827c7 100644 (file)
@@ -49,6 +49,8 @@
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci_core.h>
 
+static int enable_mgmt;
+
 /* ----- HCI socket interface ----- */
 
 static inline int hci_test_bit(int nr, void *addr)
@@ -102,6 +104,12 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
                if (skb->sk == sk)
                        continue;
 
+               if (bt_cb(skb)->channel != hci_pi(sk)->channel)
+                       continue;
+
+               if (bt_cb(skb)->channel == HCI_CHANNEL_CONTROL)
+                       goto clone;
+
                /* Apply filter */
                flt = &hci_pi(sk)->filter;
 
@@ -125,12 +133,14 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
                                continue;
                }
 
+clone:
                nskb = skb_clone(skb, GFP_ATOMIC);
                if (!nskb)
                        continue;
 
                /* Put type byte before the data */
-               memcpy(skb_push(nskb, 1), &bt_cb(nskb)->pkt_type, 1);
+               if (bt_cb(skb)->channel == HCI_CHANNEL_RAW)
+                       memcpy(skb_push(nskb, 1), &bt_cb(nskb)->pkt_type, 1);
 
                if (sock_queue_rcv_skb(sk, nskb))
                        kfree_skb(nskb);
@@ -353,25 +363,38 @@ static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long a
 
 static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
 {
-       struct sockaddr_hci *haddr = (struct sockaddr_hci *) addr;
+       struct sockaddr_hci haddr;
        struct sock *sk = sock->sk;
        struct hci_dev *hdev = NULL;
-       int err = 0;
+       int len, err = 0;
 
        BT_DBG("sock %p sk %p", sock, sk);
 
-       if (!haddr || haddr->hci_family != AF_BLUETOOTH)
+       if (!addr)
+               return -EINVAL;
+
+       memset(&haddr, 0, sizeof(haddr));
+       len = min_t(unsigned int, sizeof(haddr), addr_len);
+       memcpy(&haddr, addr, len);
+
+       if (haddr.hci_family != AF_BLUETOOTH)
+               return -EINVAL;
+
+       if (haddr.hci_channel > HCI_CHANNEL_CONTROL)
+               return -EINVAL;
+
+       if (haddr.hci_channel == HCI_CHANNEL_CONTROL && !enable_mgmt)
                return -EINVAL;
 
        lock_sock(sk);
 
-       if (hci_pi(sk)->hdev) {
+       if (sk->sk_state == BT_BOUND || hci_pi(sk)->hdev) {
                err = -EALREADY;
                goto done;
        }
 
-       if (haddr->hci_dev != HCI_DEV_NONE) {
-               hdev = hci_dev_get(haddr->hci_dev);
+       if (haddr.hci_dev != HCI_DEV_NONE) {
+               hdev = hci_dev_get(haddr.hci_dev);
                if (!hdev) {
                        err = -ENODEV;
                        goto done;
@@ -380,6 +403,7 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
                atomic_inc(&hdev->promisc);
        }
 
+       hci_pi(sk)->channel = haddr.hci_channel;
        hci_pi(sk)->hdev = hdev;
        sk->sk_state = BT_BOUND;
 
@@ -502,6 +526,17 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
 
        lock_sock(sk);
 
+       switch (hci_pi(sk)->channel) {
+       case HCI_CHANNEL_RAW:
+               break;
+       case HCI_CHANNEL_CONTROL:
+               err = mgmt_control(sk, msg, len);
+               goto done;
+       default:
+               err = -EINVAL;
+               goto done;
+       }
+
        hdev = hci_pi(sk)->hdev;
        if (!hdev) {
                err = -EBADFD;
@@ -831,3 +866,6 @@ void __exit hci_sock_cleanup(void)
 
        proto_unregister(&hci_sk_proto);
 }
+
+module_param(enable_mgmt, bool, 0644);
+MODULE_PARM_DESC(enable_mgmt, "Enable Management interface");
index c12eccf..c791fcd 100644 (file)
@@ -3124,8 +3124,14 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
        if (!sk)
                return -ENOENT;
 
-       if (sk->sk_state == BT_DISCONN)
+       if (sk->sk_state != BT_CONFIG) {
+               struct l2cap_cmd_rej rej;
+
+               rej.reason = cpu_to_le16(0x0002);
+               l2cap_send_cmd(conn, cmd->ident, L2CAP_COMMAND_REJ,
+                               sizeof(rej), &rej);
                goto unlock;
+       }
 
        /* Reject if config buffer is too small. */
        len = cmd_len - sizeof(*req);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
new file mode 100644 (file)
index 0000000..f827fd9
--- /dev/null
@@ -0,0 +1,308 @@
+/*
+   BlueZ - Bluetooth protocol stack for Linux
+   Copyright (C) 2010  Nokia Corporation
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 2 as
+   published by the Free Software Foundation;
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
+   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
+   SOFTWARE IS DISCLAIMED.
+*/
+
+/* Bluetooth HCI Management interface */
+
+#include <asm/uaccess.h>
+#include <asm/unaligned.h>
+
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
+#include <net/bluetooth/mgmt.h>
+
+#define MGMT_VERSION   0
+#define MGMT_REVISION  1
+
+static int cmd_status(struct sock *sk, u16 cmd, u8 status)
+{
+       struct sk_buff *skb;
+       struct mgmt_hdr *hdr;
+       struct mgmt_ev_cmd_status *ev;
+
+       BT_DBG("sock %p", sk);
+
+       skb = alloc_skb(sizeof(*hdr) + sizeof(*ev), GFP_ATOMIC);
+       if (!skb)
+               return -ENOMEM;
+
+       hdr = (void *) skb_put(skb, sizeof(*hdr));
+
+       hdr->opcode = cpu_to_le16(MGMT_EV_CMD_STATUS);
+       hdr->len = cpu_to_le16(sizeof(*ev));
+
+       ev = (void *) skb_put(skb, sizeof(*ev));
+       ev->status = status;
+       put_unaligned_le16(cmd, &ev->opcode);
+
+       if (sock_queue_rcv_skb(sk, skb) < 0)
+               kfree_skb(skb);
+
+       return 0;
+}
+
+static int read_version(struct sock *sk)
+{
+       struct sk_buff *skb;
+       struct mgmt_hdr *hdr;
+       struct mgmt_ev_cmd_complete *ev;
+       struct mgmt_rp_read_version *rp;
+
+       BT_DBG("sock %p", sk);
+
+       skb = alloc_skb(sizeof(*hdr) + sizeof(*ev) + sizeof(*rp), GFP_ATOMIC);
+       if (!skb)
+               return -ENOMEM;
+
+       hdr = (void *) skb_put(skb, sizeof(*hdr));
+       hdr->opcode = cpu_to_le16(MGMT_EV_CMD_COMPLETE);
+       hdr->len = cpu_to_le16(sizeof(*ev) + sizeof(*rp));
+
+       ev = (void *) skb_put(skb, sizeof(*ev));
+       put_unaligned_le16(MGMT_OP_READ_VERSION, &ev->opcode);
+
+       rp = (void *) skb_put(skb, sizeof(*rp));
+       rp->version = MGMT_VERSION;
+       put_unaligned_le16(MGMT_REVISION, &rp->revision);
+
+       if (sock_queue_rcv_skb(sk, skb) < 0)
+               kfree_skb(skb);
+
+       return 0;
+}
+
+static int read_index_list(struct sock *sk)
+{
+       struct sk_buff *skb;
+       struct mgmt_hdr *hdr;
+       struct mgmt_ev_cmd_complete *ev;
+       struct mgmt_rp_read_index_list *rp;
+       struct list_head *p;
+       size_t body_len;
+       u16 count;
+       int i;
+
+       BT_DBG("sock %p", sk);
+
+       read_lock(&hci_dev_list_lock);
+
+       count = 0;
+       list_for_each(p, &hci_dev_list) {
+               count++;
+       }
+
+       body_len = sizeof(*ev) + sizeof(*rp) + (2 * count);
+       skb = alloc_skb(sizeof(*hdr) + body_len, GFP_ATOMIC);
+       if (!skb)
+               return -ENOMEM;
+
+       hdr = (void *) skb_put(skb, sizeof(*hdr));
+       hdr->opcode = cpu_to_le16(MGMT_EV_CMD_COMPLETE);
+       hdr->len = cpu_to_le16(body_len);
+
+       ev = (void *) skb_put(skb, sizeof(*ev));
+       put_unaligned_le16(MGMT_OP_READ_INDEX_LIST, &ev->opcode);
+
+       rp = (void *) skb_put(skb, sizeof(*rp) + (2 * count));
+       put_unaligned_le16(count, &rp->num_controllers);
+
+       i = 0;
+       list_for_each(p, &hci_dev_list) {
+               struct hci_dev *d = list_entry(p, struct hci_dev, list);
+               put_unaligned_le16(d->id, &rp->index[i++]);
+               BT_DBG("Added hci%u", d->id);
+       }
+
+       read_unlock(&hci_dev_list_lock);
+
+       if (sock_queue_rcv_skb(sk, skb) < 0)
+               kfree_skb(skb);
+
+       return 0;
+}
+
+static int read_controller_info(struct sock *sk, unsigned char *data, u16 len)
+{
+       struct sk_buff *skb;
+       struct mgmt_hdr *hdr;
+       struct mgmt_ev_cmd_complete *ev;
+       struct mgmt_rp_read_info *rp;
+       struct mgmt_cp_read_info *cp;
+       struct hci_dev *hdev;
+       u16 dev_id;
+
+       BT_DBG("sock %p", sk);
+
+       if (len != 2)
+               return cmd_status(sk, MGMT_OP_READ_INFO, EINVAL);
+
+       skb = alloc_skb(sizeof(*hdr) + sizeof(*ev) + sizeof(*rp), GFP_ATOMIC);
+       if (!skb)
+               return -ENOMEM;
+
+       hdr = (void *) skb_put(skb, sizeof(*hdr));
+       hdr->opcode = cpu_to_le16(MGMT_EV_CMD_COMPLETE);
+       hdr->len = cpu_to_le16(sizeof(*ev) + sizeof(*rp));
+
+       ev = (void *) skb_put(skb, sizeof(*ev));
+       put_unaligned_le16(MGMT_OP_READ_INFO, &ev->opcode);
+
+       rp = (void *) skb_put(skb, sizeof(*rp));
+
+       cp = (void *) data;
+       dev_id = get_unaligned_le16(&cp->index);
+
+       BT_DBG("request for hci%u", dev_id);
+
+       hdev = hci_dev_get(dev_id);
+       if (!hdev) {
+               kfree_skb(skb);
+               return cmd_status(sk, MGMT_OP_READ_INFO, ENODEV);
+       }
+
+       hci_dev_lock_bh(hdev);
+
+       put_unaligned_le16(hdev->id, &rp->index);
+       rp->type = hdev->dev_type;
+
+       rp->powered = test_bit(HCI_UP, &hdev->flags);
+       rp->discoverable = test_bit(HCI_ISCAN, &hdev->flags);
+       rp->pairable = test_bit(HCI_PSCAN, &hdev->flags);
+
+       if (test_bit(HCI_AUTH, &hdev->flags))
+               rp->sec_mode = 3;
+       else if (hdev->ssp_mode > 0)
+               rp->sec_mode = 4;
+       else
+               rp->sec_mode = 2;
+
+       bacpy(&rp->bdaddr, &hdev->bdaddr);
+       memcpy(rp->features, hdev->features, 8);
+       memcpy(rp->dev_class, hdev->dev_class, 3);
+       put_unaligned_le16(hdev->manufacturer, &rp->manufacturer);
+       rp->hci_ver = hdev->hci_ver;
+       put_unaligned_le16(hdev->hci_rev, &rp->hci_rev);
+
+       hci_dev_unlock_bh(hdev);
+       hci_dev_put(hdev);
+
+       if (sock_queue_rcv_skb(sk, skb) < 0)
+               kfree_skb(skb);
+
+       return 0;
+}
+
+int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen)
+{
+       unsigned char *buf;
+       struct mgmt_hdr *hdr;
+       u16 opcode, len;
+       int err;
+
+       BT_DBG("got %zu bytes", msglen);
+
+       if (msglen < sizeof(*hdr))
+               return -EINVAL;
+
+       buf = kmalloc(msglen, GFP_ATOMIC);
+       if (!buf)
+               return -ENOMEM;
+
+       if (memcpy_fromiovec(buf, msg->msg_iov, msglen)) {
+               err = -EFAULT;
+               goto done;
+       }
+
+       hdr = (struct mgmt_hdr *) buf;
+       opcode = get_unaligned_le16(&hdr->opcode);
+       len = get_unaligned_le16(&hdr->len);
+
+       if (len != msglen - sizeof(*hdr)) {
+               err = -EINVAL;
+               goto done;
+       }
+
+       switch (opcode) {
+       case MGMT_OP_READ_VERSION:
+               err = read_version(sk);
+               break;
+       case MGMT_OP_READ_INDEX_LIST:
+               err = read_index_list(sk);
+               break;
+       case MGMT_OP_READ_INFO:
+               err = read_controller_info(sk, buf + sizeof(*hdr), len);
+               break;
+       default:
+               BT_DBG("Unknown op %u", opcode);
+               err = cmd_status(sk, opcode, 0x01);
+               break;
+       }
+
+       if (err < 0)
+               goto done;
+
+       err = msglen;
+
+done:
+       kfree(buf);
+       return err;
+}
+
+static int mgmt_event(u16 event, void *data, u16 data_len)
+{
+       struct sk_buff *skb;
+       struct mgmt_hdr *hdr;
+
+       skb = alloc_skb(sizeof(*hdr) + data_len, GFP_ATOMIC);
+       if (!skb)
+               return -ENOMEM;
+
+       bt_cb(skb)->channel = HCI_CHANNEL_CONTROL;
+
+       hdr = (void *) skb_put(skb, sizeof(*hdr));
+       hdr->opcode = cpu_to_le16(event);
+       hdr->len = cpu_to_le16(data_len);
+
+       memcpy(skb_put(skb, data_len), data, data_len);
+
+       hci_send_to_sock(NULL, skb);
+       kfree_skb(skb);
+
+       return 0;
+}
+
+int mgmt_index_added(u16 index)
+{
+       struct mgmt_ev_index_added ev;
+
+       put_unaligned_le16(index, &ev.index);
+
+       return mgmt_event(MGMT_EV_INDEX_ADDED, &ev, sizeof(ev));
+}
+
+int mgmt_index_removed(u16 index)
+{
+       struct mgmt_ev_index_added ev;
+
+       put_unaligned_le16(index, &ev.index);
+
+       return mgmt_event(MGMT_EV_INDEX_REMOVED, &ev, sizeof(ev));
+}
index a05893a..95cdd2a 100644 (file)
@@ -168,6 +168,7 @@ typedef unsigned __bitwise__ ieee80211_rx_result;
  * @IEEE80211_RX_FRAGMENTED: fragmented frame
  * @IEEE80211_RX_AMSDU: a-MSDU packet
  * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed
+ * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering
  *
  * These are per-frame flags that are attached to a frame in the
  * @rx_flags field of &struct ieee80211_rx_status.
@@ -178,6 +179,7 @@ enum ieee80211_packet_rx_flags {
        IEEE80211_RX_FRAGMENTED                 = BIT(2),
        IEEE80211_RX_AMSDU                      = BIT(3),
        IEEE80211_RX_MALFORMED_ACTION_FRM       = BIT(4),
+       IEEE80211_RX_DEFERRED_RELEASE           = BIT(5),
 };
 
 /**
@@ -774,6 +776,15 @@ struct ieee80211_local {
        struct sk_buff_head skb_queue;
        struct sk_buff_head skb_queue_unreliable;
 
+       /*
+        * Internal FIFO queue which is shared between multiple rx path
+        * stages. Its main task is to provide a serialization mechanism,
+        * so all rx handlers can enjoy having exclusive access to their
+        * private data structures.
+        */
+       struct sk_buff_head rx_skb_queue;
+       bool running_rx_handler;        /* protected by rx_skb_queue.lock */
+
        /* Station data */
        /*
         * The mutex only protects the list and counter,
index 84cf919..8c02469 100644 (file)
  * keys and per-station keys. Since each station belongs to an interface,
  * each station key also belongs to that interface.
  *
- * Hardware acceleration is done on a best-effort basis, for each key
- * that is eligible the hardware is asked to enable that key but if
- * it cannot do that they key is simply kept for software encryption.
- * There is currently no way of knowing this except by looking into
- * debugfs.
+ * Hardware acceleration is done on a best-effort basis for algorithms
+ * that are implemented in software,  for each key the hardware is asked
+ * to enable that key for offloading but if it cannot do that the key is
+ * simply kept for software encryption (unless it is for an algorithm
+ * that isn't implemented in software).
+ * There is currently no way of knowing whether a key is handled in SW
+ * or HW except by looking into debugfs.
  *
- * All key operations are protected internally.
- *
- * Within mac80211, key references are, just as STA structure references,
- * protected by RCU. Note, however, that some things are unprotected,
- * namely the key->sta dereferences within the hardware acceleration
- * functions. This means that sta_info_destroy() must remove the key
- * which waits for an RCU grace period.
+ * All key management is internally protected by a mutex. Within all
+ * other parts of mac80211, key references are, just as STA structure
+ * references, protected by RCU. Note, however, that some things are
+ * unprotected, namely the key->sta dereferences within the hardware
+ * acceleration functions. This means that sta_info_destroy() must
+ * remove the key which waits for an RCU grace period.
  */
 
 static const u8 bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
@@ -279,13 +280,8 @@ static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
                                                         new->conf.keyidx);
        }
 
-       if (old) {
-               /*
-                * We'll use an empty list to indicate that the key
-                * has already been removed.
-                */
-               list_del_init(&old->list);
-       }
+       if (old)
+               list_del(&old->list);
 }
 
 struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
@@ -379,6 +375,12 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key)
        if (!key)
                return;
 
+       /*
+        * Synchronize so the TX path can no longer be using
+        * this key before we free/remove it.
+        */
+       synchronize_rcu();
+
        if (key->local)
                ieee80211_key_disable_hw_accel(key);
 
@@ -420,8 +422,8 @@ int ieee80211_key_link(struct ieee80211_key *key,
                        struct sta_info *ap;
 
                        /*
-                        * We're getting a sta pointer in,
-                        * so must be under RCU read lock.
+                        * We're getting a sta pointer in, so must be under
+                        * appropriate locking for sta_info_get().
                         */
 
                        /* same here, the AP could be using QoS */
index bbe8e0a..4b088b3 100644 (file)
@@ -569,6 +569,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
        spin_lock_init(&local->filter_lock);
        spin_lock_init(&local->queue_stop_reason_lock);
 
+       skb_queue_head_init(&local->rx_skb_queue);
+
        INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);
 
        ieee80211_work_init(local);
@@ -914,6 +916,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
                wiphy_warn(local->hw.wiphy, "skb_queue not empty\n");
        skb_queue_purge(&local->skb_queue);
        skb_queue_purge(&local->skb_queue_unreliable);
+       skb_queue_purge(&local->rx_skb_queue);
 
        destroy_workqueue(local->workqueue);
        wiphy_unregister(local->hw.wiphy);
index 5e9d3bc..a6701ed 100644 (file)
@@ -533,10 +533,11 @@ static inline u16 seq_sub(u16 sq1, u16 sq2)
 
 static void ieee80211_release_reorder_frame(struct ieee80211_hw *hw,
                                            struct tid_ampdu_rx *tid_agg_rx,
-                                           int index,
-                                           struct sk_buff_head *frames)
+                                           int index)
 {
+       struct ieee80211_local *local = hw_to_local(hw);
        struct sk_buff *skb = tid_agg_rx->reorder_buf[index];
+       struct ieee80211_rx_status *status;
 
        lockdep_assert_held(&tid_agg_rx->reorder_lock);
 
@@ -546,7 +547,9 @@ static void ieee80211_release_reorder_frame(struct ieee80211_hw *hw,
        /* release the frame from the reorder ring buffer */
        tid_agg_rx->stored_mpdu_num--;
        tid_agg_rx->reorder_buf[index] = NULL;
-       __skb_queue_tail(frames, skb);
+       status = IEEE80211_SKB_RXCB(skb);
+       status->rx_flags |= IEEE80211_RX_DEFERRED_RELEASE;
+       skb_queue_tail(&local->rx_skb_queue, skb);
 
 no_frame:
        tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num);
@@ -554,8 +557,7 @@ no_frame:
 
 static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw,
                                             struct tid_ampdu_rx *tid_agg_rx,
-                                            u16 head_seq_num,
-                                            struct sk_buff_head *frames)
+                                            u16 head_seq_num)
 {
        int index;
 
@@ -564,7 +566,7 @@ static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw,
        while (seq_less(tid_agg_rx->head_seq_num, head_seq_num)) {
                index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) %
                                                        tid_agg_rx->buf_size;
-               ieee80211_release_reorder_frame(hw, tid_agg_rx, index, frames);
+               ieee80211_release_reorder_frame(hw, tid_agg_rx, index);
        }
 }
 
@@ -580,8 +582,7 @@ static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw,
 #define HT_RX_REORDER_BUF_TIMEOUT (HZ / 10)
 
 static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw,
-                                         struct tid_ampdu_rx *tid_agg_rx,
-                                         struct sk_buff_head *frames)
+                                         struct tid_ampdu_rx *tid_agg_rx)
 {
        int index, j;
 
@@ -612,8 +613,7 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw,
                                wiphy_debug(hw->wiphy,
                                            "release an RX reorder frame due to timeout on earlier frames\n");
 #endif
-                       ieee80211_release_reorder_frame(hw, tid_agg_rx,
-                                                       j, frames);
+                       ieee80211_release_reorder_frame(hw, tid_agg_rx, j);
 
                        /*
                         * Increment the head seq# also for the skipped slots.
@@ -623,31 +623,11 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw,
                        skipped = 0;
                }
        } else while (tid_agg_rx->reorder_buf[index]) {
-               ieee80211_release_reorder_frame(hw, tid_agg_rx, index, frames);
+               ieee80211_release_reorder_frame(hw, tid_agg_rx, index);
                index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) %
                                                        tid_agg_rx->buf_size;
        }
 
-       /*
-        * Disable the reorder release timer for now.
-        *
-        * The current implementation lacks a proper locking scheme
-        * which would protect vital statistic and debug counters
-        * from being updated by two different but concurrent BHs.
-        *
-        * More information about the topic is available from:
-        * - thread: http://marc.info/?t=128635927000001
-        *
-        * What was wrong:
-        * =>  http://marc.info/?l=linux-wireless&m=128636170811964
-        * "Basically the thing is that until your patch, the data
-        *  in the struct didn't actually need locking because it
-        *  was accessed by the RX path only which is not concurrent."
-        *
-        * List of what needs to be fixed:
-        * => http://marc.info/?l=linux-wireless&m=128656352920957
-        *
-
        if (tid_agg_rx->stored_mpdu_num) {
                j = index = seq_sub(tid_agg_rx->head_seq_num,
                                    tid_agg_rx->ssn) % tid_agg_rx->buf_size;
@@ -666,10 +646,6 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw,
        } else {
                del_timer(&tid_agg_rx->reorder_timer);
        }
-       */
-
-set_release_timer:
-       return;
 }
 
 /*
@@ -679,8 +655,7 @@ set_release_timer:
  */
 static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
                                             struct tid_ampdu_rx *tid_agg_rx,
-                                            struct sk_buff *skb,
-                                            struct sk_buff_head *frames)
+                                            struct sk_buff *skb)
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        u16 sc = le16_to_cpu(hdr->seq_ctrl);
@@ -707,8 +682,7 @@ static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
        if (!seq_less(mpdu_seq_num, head_seq_num + buf_size)) {
                head_seq_num = seq_inc(seq_sub(mpdu_seq_num, buf_size));
                /* release stored frames up to new head to stack */
-               ieee80211_release_reorder_frames(hw, tid_agg_rx, head_seq_num,
-                                                frames);
+               ieee80211_release_reorder_frames(hw, tid_agg_rx, head_seq_num);
        }
 
        /* Now the new frame is always in the range of the reordering buffer */
@@ -736,7 +710,7 @@ static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
        tid_agg_rx->reorder_buf[index] = skb;
        tid_agg_rx->reorder_time[index] = jiffies;
        tid_agg_rx->stored_mpdu_num++;
-       ieee80211_sta_reorder_release(hw, tid_agg_rx, frames);
+       ieee80211_sta_reorder_release(hw, tid_agg_rx);
 
  out:
        spin_unlock(&tid_agg_rx->reorder_lock);
@@ -747,8 +721,7 @@ static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
  * Reorder MPDUs from A-MPDUs, keeping them on a buffer. Returns
  * true if the MPDU was buffered, false if it should be processed.
  */
-static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx,
-                                      struct sk_buff_head *frames)
+static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx)
 {
        struct sk_buff *skb = rx->skb;
        struct ieee80211_local *local = rx->local;
@@ -803,11 +776,11 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx,
         * sure that we cannot get to it any more before doing
         * anything with it.
         */
-       if (ieee80211_sta_manage_reorder_buf(hw, tid_agg_rx, skb, frames))
+       if (ieee80211_sta_manage_reorder_buf(hw, tid_agg_rx, skb))
                return;
 
  dont_reorder:
-       __skb_queue_tail(frames, skb);
+       skb_queue_tail(&local->rx_skb_queue, skb);
 }
 
 static ieee80211_rx_result debug_noinline
@@ -1189,6 +1162,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
         * exchange sequence.
         */
        if (!ieee80211_has_morefrags(hdr->frame_control) &&
+           !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) &&
            (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
             rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) {
                if (test_sta_flags(sta, WLAN_STA_PS_STA)) {
@@ -1831,11 +1805,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 
                        fwd_skb = skb_copy(skb, GFP_ATOMIC);
 
-                       if (!fwd_skb && net_ratelimit()) {
+                       if (!fwd_skb && net_ratelimit())
                                printk(KERN_DEBUG "%s: failed to clone mesh frame\n",
                                                   sdata->name);
+                       if (!fwd_skb)
                                goto out;
-                       }
 
                        fwd_hdr =  (struct ieee80211_hdr *) fwd_skb->data;
                        memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
@@ -1930,7 +1904,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
 }
 
 static ieee80211_rx_result debug_noinline
-ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx, struct sk_buff_head *frames)
+ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
 {
        struct ieee80211_local *local = rx->local;
        struct ieee80211_hw *hw = &local->hw;
@@ -1970,8 +1944,7 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx, struct sk_buff_head *frames)
 
                spin_lock(&tid_agg_rx->reorder_lock);
                /* release stored frames up to start of BAR */
-               ieee80211_release_reorder_frames(hw, tid_agg_rx, start_seq_num,
-                                                frames);
+               ieee80211_release_reorder_frames(hw, tid_agg_rx, start_seq_num);
                spin_unlock(&tid_agg_rx->reorder_lock);
 
                kfree_skb(skb);
@@ -2488,8 +2461,7 @@ static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx,
        }
 }
 
-static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
-                                 struct sk_buff_head *frames)
+static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx)
 {
        ieee80211_rx_result res = RX_DROP_MONITOR;
        struct sk_buff *skb;
@@ -2501,7 +2473,15 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
                        goto rxh_next;  \
        } while (0);
 
-       while ((skb = __skb_dequeue(frames))) {
+       spin_lock(&rx->local->rx_skb_queue.lock);
+       if (rx->local->running_rx_handler)
+               goto unlock;
+
+       rx->local->running_rx_handler = true;
+
+       while ((skb = __skb_dequeue(&rx->local->rx_skb_queue))) {
+               spin_unlock(&rx->local->rx_skb_queue.lock);
+
                /*
                 * all the other fields are valid across frames
                 * that belong to an aMPDU since they are on the
@@ -2524,12 +2504,7 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
                        CALL_RXH(ieee80211_rx_h_mesh_fwding);
 #endif
                CALL_RXH(ieee80211_rx_h_data)
-
-               /* special treatment -- needs the queue */
-               res = ieee80211_rx_h_ctrl(rx, frames);
-               if (res != RX_CONTINUE)
-                       goto rxh_next;
-
+               CALL_RXH(ieee80211_rx_h_ctrl);
                CALL_RXH(ieee80211_rx_h_mgmt_check)
                CALL_RXH(ieee80211_rx_h_action)
                CALL_RXH(ieee80211_rx_h_userspace_mgmt)
@@ -2538,18 +2513,20 @@ static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx,
 
  rxh_next:
                ieee80211_rx_handlers_result(rx, res);
-
+               spin_lock(&rx->local->rx_skb_queue.lock);
 #undef CALL_RXH
        }
+
+       rx->local->running_rx_handler = false;
+
+ unlock:
+       spin_unlock(&rx->local->rx_skb_queue.lock);
 }
 
 static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
 {
-       struct sk_buff_head reorder_release;
        ieee80211_rx_result res = RX_DROP_MONITOR;
 
-       __skb_queue_head_init(&reorder_release);
-
 #define CALL_RXH(rxh)                  \
        do {                            \
                res = rxh(rx);          \
@@ -2560,9 +2537,9 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
        CALL_RXH(ieee80211_rx_h_passive_scan)
        CALL_RXH(ieee80211_rx_h_check)
 
-       ieee80211_rx_reorder_ampdu(rx, &reorder_release);
+       ieee80211_rx_reorder_ampdu(rx);
 
-       ieee80211_rx_handlers(rx, &reorder_release);
+       ieee80211_rx_handlers(rx);
        return;
 
  rxh_next:
@@ -2577,7 +2554,6 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
  */
 void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
 {
-       struct sk_buff_head frames;
        struct ieee80211_rx_data rx = {
                .sta = sta,
                .sdata = sta->sdata,
@@ -2590,13 +2566,11 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
        if (!tid_agg_rx)
                return;
 
-       __skb_queue_head_init(&frames);
-
        spin_lock(&tid_agg_rx->reorder_lock);
-       ieee80211_sta_reorder_release(&sta->local->hw, tid_agg_rx, &frames);
+       ieee80211_sta_reorder_release(&sta->local->hw, tid_agg_rx);
        spin_unlock(&tid_agg_rx->reorder_lock);
 
-       ieee80211_rx_handlers(&rx, &frames);
+       ieee80211_rx_handlers(&rx);
 }
 
 /* main receive path */
index 68c2fbd..5950e3a 100644 (file)
@@ -1750,6 +1750,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
        __le16 fc;
        struct ieee80211_hdr hdr;
        struct ieee80211s_hdr mesh_hdr __maybe_unused;
+       struct mesh_path *mppath = NULL;
        const u8 *encaps_data;
        int encaps_len, skip_header_bytes;
        int nh_pos, h_pos;
@@ -1810,16 +1811,23 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
                        ret = NETDEV_TX_OK;
                        goto fail;
                }
+               if (!is_multicast_ether_addr(skb->data))
+                       mppath = mpp_path_lookup(skb->data, sdata);
 
+               /*
+                * Do not use address extension, if it is a packet from
+                * the same interface and the destination is not being
+                * proxied by any other mest point.
+                */
                if (compare_ether_addr(sdata->vif.addr,
-                                      skb->data + ETH_ALEN) == 0) {
+                                      skb->data + ETH_ALEN) == 0 &&
+                   (!mppath || !compare_ether_addr(mppath->mpp, skb->data))) {
                        hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc,
                                        skb->data, skb->data + ETH_ALEN);
                        meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr,
                                        sdata, NULL, NULL);
                } else {
                        /* packet from other interface */
-                       struct mesh_path *mppath;
                        int is_mesh_mcast = 1;
                        const u8 *mesh_da;
 
@@ -1830,8 +1838,6 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
                        else {
                                static const u8 bcast[ETH_ALEN] =
                                        { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
-                               mppath = mpp_path_lookup(skb->data, sdata);
                                if (mppath) {
                                        /* RA TA mDA mSA AE:DA SA */
                                        mesh_da = mppath->mpp;
index 58e75bb..28bc084 100644 (file)
@@ -59,26 +59,22 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
 {
        struct ieee80211_local *local = sdata->local;
        struct sta_info *sta = NULL;
-       u32 sta_flags = 0;
        const u8 *ra = NULL;
        bool qos = false;
 
        if (local->hw.queues < 4 || skb->len < 6) {
                skb->priority = 0; /* required for correct WPA/11i MIC */
-               return min_t(u16, local->hw.queues - 1,
-                            ieee802_1d_to_ac[skb->priority]);
+               return min_t(u16, local->hw.queues - 1, IEEE80211_AC_BE);
        }
 
        rcu_read_lock();
        switch (sdata->vif.type) {
        case NL80211_IFTYPE_AP_VLAN:
-               rcu_read_lock();
                sta = rcu_dereference(sdata->u.vlan.sta);
-               if (sta)
-                       sta_flags = get_sta_flags(sta);
-               rcu_read_unlock();
-               if (sta)
+               if (sta) {
+                       qos = get_sta_flags(sta) & WLAN_STA_WME;
                        break;
+               }
        case NL80211_IFTYPE_AP:
                ra = skb->data;
                break;
@@ -107,17 +103,13 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
        if (!sta && ra && !is_multicast_ether_addr(ra)) {
                sta = sta_info_get(sdata, ra);
                if (sta)
-                       sta_flags = get_sta_flags(sta);
+                       qos = get_sta_flags(sta) & WLAN_STA_WME;
        }
-
-       if (sta_flags & WLAN_STA_WME)
-               qos = true;
-
        rcu_read_unlock();
 
        if (!qos) {
                skb->priority = 0; /* required for correct WPA/11i MIC */
-               return ieee802_1d_to_ac[skb->priority];
+               return IEEE80211_AC_BE;
        }
 
        /* use the data classifier to determine what 802.1d tag the
index 99d4183..37693b6 100644 (file)
@@ -752,7 +752,7 @@ static void chan_reg_rule_print_dbg(struct ieee80211_channel *chan,
                snprintf(max_antenna_gain, 32, "%d", power_rule->max_antenna_gain);
 
        REG_DBG_PRINT("Updating information on frequency %d MHz "
-                     "for %d a MHz width channel with regulatory rule:\n",
+                     "for a %d MHz width channel with regulatory rule:\n",
                      chan->center_freq,
                      KHZ_TO_MHZ(desired_bw_khz));