Merge branch 'for-3.5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj...
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / brcm80211 / brcmsmac / phy / phy_lcn.c
index 0fce56235f38c2040d6b6bff716029d23a6030d6..abfd78822fb8a574e0266a2389f7751f9d4fef9b 100644 (file)
@@ -4817,28 +4817,23 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
        s8 txpwr = 0;
        int i;
        struct brcms_phy_lcnphy *pi_lcn = pi->u.pi_lcnphy;
-       struct phy_shim_info *shim = pi->sh->physhim;
+       struct ssb_sprom *sprom = &pi->d11core->bus->sprom;
 
        if (CHSPEC_IS2G(pi->radio_chanspec)) {
                u16 cckpo = 0;
                u32 offset_ofdm, offset_mcs;
 
-               pi_lcn->lcnphy_tr_isolation_mid =
-                       (u8)wlapi_getintvar(shim, BRCMS_SROM_TRISO2G);
+               pi_lcn->lcnphy_tr_isolation_mid = sprom->fem.ghz2.tr_iso;
 
-               pi_lcn->lcnphy_rx_power_offset =
-                       (u8)wlapi_getintvar(shim, BRCMS_SROM_RXPO2G);
+               pi_lcn->lcnphy_rx_power_offset = sprom->rxpo2g;
 
-               pi->txpa_2g[0] = (s16)wlapi_getintvar(shim, BRCMS_SROM_PA0B0);
-               pi->txpa_2g[1] = (s16)wlapi_getintvar(shim, BRCMS_SROM_PA0B1);
-               pi->txpa_2g[2] = (s16)wlapi_getintvar(shim, BRCMS_SROM_PA0B2);
+               pi->txpa_2g[0] = sprom->pa0b0;
+               pi->txpa_2g[1] = sprom->pa0b1;
+               pi->txpa_2g[2] = sprom->pa0b2;
 
-               pi_lcn->lcnphy_rssi_vf =
-                               (u8)wlapi_getintvar(shim, BRCMS_SROM_RSSISMF2G);
-               pi_lcn->lcnphy_rssi_vc =
-                               (u8)wlapi_getintvar(shim, BRCMS_SROM_RSSISMC2G);
-               pi_lcn->lcnphy_rssi_gs =
-                               (u8)wlapi_getintvar(shim, BRCMS_SROM_RSSISAV2G);
+               pi_lcn->lcnphy_rssi_vf = sprom->rssismf2g;
+               pi_lcn->lcnphy_rssi_vc = sprom->rssismc2g;
+               pi_lcn->lcnphy_rssi_gs = sprom->rssisav2g;
 
                pi_lcn->lcnphy_rssi_vf_lowtemp = pi_lcn->lcnphy_rssi_vf;
                pi_lcn->lcnphy_rssi_vc_lowtemp = pi_lcn->lcnphy_rssi_vc;
@@ -4848,7 +4843,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
                pi_lcn->lcnphy_rssi_vc_hightemp = pi_lcn->lcnphy_rssi_vc;
                pi_lcn->lcnphy_rssi_gs_hightemp = pi_lcn->lcnphy_rssi_gs;
 
-               txpwr = (s8)wlapi_getintvar(shim, BRCMS_SROM_MAXP2GA0);
+               txpwr = sprom->core_pwr_info[0].maxpwr_2g;
                pi->tx_srom_max_2g = txpwr;
 
                for (i = 0; i < PWRTBL_NUM_COEFF; i++) {
@@ -4856,8 +4851,8 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
                        pi->txpa_2g_high_temp[i] = pi->txpa_2g[i];
                }
 
-               cckpo = (u16)wlapi_getintvar(shim, BRCMS_SROM_CCK2GPO);
-               offset_ofdm = (u32)wlapi_getintvar(shim, BRCMS_SROM_OFDM2GPO);
+               cckpo = sprom->cck2gpo;
+               offset_ofdm = sprom->ofdm2gpo;
                if (cckpo) {
                        uint max_pwr_chan = txpwr;
 
@@ -4876,7 +4871,7 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
                } else {
                        u8 opo = 0;
 
-                       opo = (u8)wlapi_getintvar(shim, BRCMS_SROM_OPO);
+                       opo = sprom->opo;
 
                        for (i = TXP_FIRST_CCK; i <= TXP_LAST_CCK; i++)
                                pi->tx_srom_max_rate_2g[i] = txpwr;
@@ -4886,12 +4881,8 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
                                                ((offset_ofdm & 0xf) * 2);
                                offset_ofdm >>= 4;
                        }
-                       offset_mcs =
-                               wlapi_getintvar(shim,
-                                               BRCMS_SROM_MCS2GPO1) << 16;
-                       offset_mcs |=
-                               (u16) wlapi_getintvar(shim,
-                                                     BRCMS_SROM_MCS2GPO0);
+                       offset_mcs = sprom->mcs2gpo[1] << 16;
+                       offset_mcs |= sprom->mcs2gpo[0];
                        pi_lcn->lcnphy_mcs20_po = offset_mcs;
                        for (i = TXP_FIRST_SISO_MCS_20;
                             i <= TXP_LAST_SISO_MCS_20; i++) {
@@ -4901,25 +4892,17 @@ static bool wlc_phy_txpwr_srom_read_lcnphy(struct brcms_phy *pi)
                        }
                }
 
-               pi_lcn->lcnphy_rawtempsense =
-                       (u16)wlapi_getintvar(shim, BRCMS_SROM_RAWTEMPSENSE);
-               pi_lcn->lcnphy_measPower =
-                       (u8)wlapi_getintvar(shim, BRCMS_SROM_MEASPOWER);
-               pi_lcn->lcnphy_tempsense_slope =
-                       (u8)wlapi_getintvar(shim, BRCMS_SROM_TEMPSENSE_SLOPE);
-               pi_lcn->lcnphy_hw_iqcal_en =
-                       (bool)wlapi_getintvar(shim, BRCMS_SROM_HW_IQCAL_EN);
-               pi_lcn->lcnphy_iqcal_swp_dis =
-                       (bool)wlapi_getintvar(shim, BRCMS_SROM_IQCAL_SWP_DIS);
-               pi_lcn->lcnphy_tempcorrx =
-                       (u8)wlapi_getintvar(shim, BRCMS_SROM_TEMPCORRX);
-               pi_lcn->lcnphy_tempsense_option =
-                       (u8)wlapi_getintvar(shim, BRCMS_SROM_TEMPSENSE_OPTION);
-               pi_lcn->lcnphy_freqoffset_corr =
-                       (u8)wlapi_getintvar(shim, BRCMS_SROM_FREQOFFSET_CORR);
-               if ((u8)wlapi_getintvar(shim, BRCMS_SROM_AA2G) > 1)
+               pi_lcn->lcnphy_rawtempsense = sprom->rawtempsense;
+               pi_lcn->lcnphy_measPower = sprom->measpower;
+               pi_lcn->lcnphy_tempsense_slope = sprom->tempsense_slope;
+               pi_lcn->lcnphy_hw_iqcal_en = sprom->hw_iqcal_en;
+               pi_lcn->lcnphy_iqcal_swp_dis = sprom->iqcal_swp_dis;
+               pi_lcn->lcnphy_tempcorrx = sprom->tempcorrx;
+               pi_lcn->lcnphy_tempsense_option = sprom->tempsense_option;
+               pi_lcn->lcnphy_freqoffset_corr = sprom->freqoffset_corr;
+               if (sprom->ant_available_bg > 1)
                        wlc_phy_ant_rxdiv_set((struct brcms_phy_pub *) pi,
-                               (u8) wlapi_getintvar(shim, BRCMS_SROM_AA2G));
+                               sprom->ant_available_bg);
        }
        pi_lcn->lcnphy_cck_dig_filt_type = -1;