p54: enable rx/tx antenna diversity by eeprom bits
authorChristian Lamparter <chunkeey@web.de>
Tue, 30 Dec 2008 12:48:19 +0000 (13:48 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 29 Jan 2009 20:59:43 +0000 (15:59 -0500)
Respect all documented bits in the eeprom about the device diversity features.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/p54/p54.h
drivers/net/wireless/p54/p54common.c
drivers/net/wireless/p54/p54common.h

index ab79e32f0b27c495c3c20eb43310882ff1aaa8b9..6bd147c47ae00e132b336733c4a9b350244fe728 100644 (file)
@@ -99,6 +99,8 @@ struct p54_common {
        struct mutex conf_mutex;
        u8 mac_addr[ETH_ALEN];
        u8 bssid[ETH_ALEN];
+       u8 rx_diversity_mask;
+       u8 tx_diversity_mask;
        struct pda_iq_autocal_entry *iq_autocal;
        unsigned int iq_autocal_len;
        struct pda_channel_output_limit *output_limit;
index 0907e6f246e69f516d97c205ce73ad584626862d..6e9f73745b6859fd671b131c9e52abcf119c34b6 100644 (file)
@@ -563,6 +563,10 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
                dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2GHz;
        if (!(synth & PDR_SYNTH_5_GHZ_DISABLED))
                dev->wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5GHz;
+       if ((synth & PDR_SYNTH_RX_DIV_MASK) == PDR_SYNTH_RX_DIV_SUPPORTED)
+               priv->rx_diversity_mask = 3;
+       if ((synth & PDR_SYNTH_TX_DIV_MASK) == PDR_SYNTH_TX_DIV_SUPPORTED)
+               priv->tx_diversity_mask = 3;
 
        if (!is_valid_ether_addr(dev->wiphy->perm_addr)) {
                u8 perm_addr[ETH_ALEN];
@@ -1512,8 +1516,8 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
        txhdr->hw_queue = queue;
        txhdr->backlog = current_queue->len;
        memset(txhdr->durations, 0, sizeof(txhdr->durations));
-       txhdr->tx_antenna = (info->antenna_sel_tx == 0) ?
-               2 : info->antenna_sel_tx - 1;
+       txhdr->tx_antenna = ((info->antenna_sel_tx == 0) ?
+               2 : info->antenna_sel_tx - 1) & priv->tx_diversity_mask;
        txhdr->output_power = priv->output_power;
        txhdr->cts_rate = cts_rate;
        if (padding)
@@ -1584,7 +1588,7 @@ static int p54_setup_mac(struct ieee80211_hw *dev)
        setup->mac_mode = cpu_to_le16(mode);
        memcpy(setup->mac_addr, priv->mac_addr, ETH_ALEN);
        memcpy(setup->bssid, priv->bssid, ETH_ALEN);
-       setup->rx_antenna = 2; /* automatic */
+       setup->rx_antenna = 2 & priv->rx_diversity_mask; /* automatic */
        setup->rx_align = 0;
        if (priv->fw_var < 0x500) {
                setup->v1.basic_rate_mask = cpu_to_le32(priv->basic_rate_mask);
index 163e3adba422b67769b52ee2decf7458c0662899..035e7731248445bedbe902b4da6fb51fa8c207a6 100644 (file)
@@ -31,7 +31,7 @@ struct bootrec {
 #define PDR_SYNTH_IQ_CAL_DISABLED      0x0008
 #define PDR_SYNTH_IQ_CAL_ZIF           0x0010
 #define PDR_SYNTH_FAA_SWITCH_MASK      0x0020
-#define PDR_SYNTH_FAA_SWITCH_ENABLED   0x0001
+#define PDR_SYNTH_FAA_SWITCH_ENABLED   0x0020
 #define PDR_SYNTH_24_GHZ_MASK          0x0040
 #define PDR_SYNTH_24_GHZ_DISABLED      0x0040
 #define PDR_SYNTH_5_GHZ_MASK           0x0080