aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
diff options
context:
space:
mode:
authorRajkumar Manoharan <rmanohar@qca.qualcomm.com>2011-11-08 03:49:32 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-11-11 12:32:48 -0500
commitdf222edc09a0219ea0c5c6cec6217abb334280c4 (patch)
tree7ca3ef426a617cfaa965d54206cfc7afc65532f9 /drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
parentaa95a48d46328f35403f3b03e0cafb3c5883aaba (diff)
ath9k_hw: Read and configure quick drop for AR9003
Read and configure quick drop feild from AR9003 eeprom inorder to help with strong signal. This patch also removes obsolate parameters ob, db_stage2, db_stage_3, db_stage4 from the eeprom templates. Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ar9003_eeprom.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c108
1 files changed, 50 insertions, 58 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 3b262ba6b17..de103ef0d53 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -121,10 +121,8 @@ static const struct ar9300_eeprom ar9300_default = {
121 * if the register is per chain 121 * if the register is per chain
122 */ 122 */
123 .noiseFloorThreshCh = {-1, 0, 0}, 123 .noiseFloorThreshCh = {-1, 0, 0},
124 .ob = {1, 1, 1},/* 3 chain */ 124 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
125 .db_stage2 = {1, 1, 1}, /* 3 chain */ 125 .quick_drop = 0,
126 .db_stage3 = {0, 0, 0},
127 .db_stage4 = {0, 0, 0},
128 .xpaBiasLvl = 0, 126 .xpaBiasLvl = 0,
129 .txFrameToDataStart = 0x0e, 127 .txFrameToDataStart = 0x0e,
130 .txFrameToPaOn = 0x0e, 128 .txFrameToPaOn = 0x0e,
@@ -144,7 +142,7 @@ static const struct ar9300_eeprom ar9300_default = {
144 }, 142 },
145 .base_ext1 = { 143 .base_ext1 = {
146 .ant_div_control = 0, 144 .ant_div_control = 0,
147 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 145 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
148 }, 146 },
149 .calFreqPier2G = { 147 .calFreqPier2G = {
150 FREQ2FBIN(2412, 1), 148 FREQ2FBIN(2412, 1),
@@ -323,10 +321,8 @@ static const struct ar9300_eeprom ar9300_default = {
323 .spurChans = {0, 0, 0, 0, 0}, 321 .spurChans = {0, 0, 0, 0, 0},
324 /* noiseFloorThreshCh Check if the register is per chain */ 322 /* noiseFloorThreshCh Check if the register is per chain */
325 .noiseFloorThreshCh = {-1, 0, 0}, 323 .noiseFloorThreshCh = {-1, 0, 0},
326 .ob = {3, 3, 3}, /* 3 chain */ 324 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
327 .db_stage2 = {3, 3, 3}, /* 3 chain */ 325 .quick_drop = 0,
328 .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
329 .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
330 .xpaBiasLvl = 0, 326 .xpaBiasLvl = 0,
331 .txFrameToDataStart = 0x0e, 327 .txFrameToDataStart = 0x0e,
332 .txFrameToPaOn = 0x0e, 328 .txFrameToPaOn = 0x0e,
@@ -698,10 +694,8 @@ static const struct ar9300_eeprom ar9300_x113 = {
698 * if the register is per chain 694 * if the register is per chain
699 */ 695 */
700 .noiseFloorThreshCh = {-1, 0, 0}, 696 .noiseFloorThreshCh = {-1, 0, 0},
701 .ob = {1, 1, 1},/* 3 chain */ 697 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
702 .db_stage2 = {1, 1, 1}, /* 3 chain */ 698 .quick_drop = 0,
703 .db_stage3 = {0, 0, 0},
704 .db_stage4 = {0, 0, 0},
705 .xpaBiasLvl = 0, 699 .xpaBiasLvl = 0,
706 .txFrameToDataStart = 0x0e, 700 .txFrameToDataStart = 0x0e,
707 .txFrameToPaOn = 0x0e, 701 .txFrameToPaOn = 0x0e,
@@ -721,7 +715,7 @@ static const struct ar9300_eeprom ar9300_x113 = {
721 }, 715 },
722 .base_ext1 = { 716 .base_ext1 = {
723 .ant_div_control = 0, 717 .ant_div_control = 0,
724 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 718 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
725 }, 719 },
726 .calFreqPier2G = { 720 .calFreqPier2G = {
727 FREQ2FBIN(2412, 1), 721 FREQ2FBIN(2412, 1),
@@ -900,10 +894,8 @@ static const struct ar9300_eeprom ar9300_x113 = {
900 .spurChans = {FREQ2FBIN(5500, 0), 0, 0, 0, 0}, 894 .spurChans = {FREQ2FBIN(5500, 0), 0, 0, 0, 0},
901 /* noiseFloorThreshCh Check if the register is per chain */ 895 /* noiseFloorThreshCh Check if the register is per chain */
902 .noiseFloorThreshCh = {-1, 0, 0}, 896 .noiseFloorThreshCh = {-1, 0, 0},
903 .ob = {3, 3, 3}, /* 3 chain */ 897 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
904 .db_stage2 = {3, 3, 3}, /* 3 chain */ 898 .quick_drop = 0,
905 .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
906 .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
907 .xpaBiasLvl = 0xf, 899 .xpaBiasLvl = 0xf,
908 .txFrameToDataStart = 0x0e, 900 .txFrameToDataStart = 0x0e,
909 .txFrameToPaOn = 0x0e, 901 .txFrameToPaOn = 0x0e,
@@ -1276,10 +1268,8 @@ static const struct ar9300_eeprom ar9300_h112 = {
1276 * if the register is per chain 1268 * if the register is per chain
1277 */ 1269 */
1278 .noiseFloorThreshCh = {-1, 0, 0}, 1270 .noiseFloorThreshCh = {-1, 0, 0},
1279 .ob = {1, 1, 1},/* 3 chain */ 1271 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1280 .db_stage2 = {1, 1, 1}, /* 3 chain */ 1272 .quick_drop = 0,
1281 .db_stage3 = {0, 0, 0},
1282 .db_stage4 = {0, 0, 0},
1283 .xpaBiasLvl = 0, 1273 .xpaBiasLvl = 0,
1284 .txFrameToDataStart = 0x0e, 1274 .txFrameToDataStart = 0x0e,
1285 .txFrameToPaOn = 0x0e, 1275 .txFrameToPaOn = 0x0e,
@@ -1299,7 +1289,7 @@ static const struct ar9300_eeprom ar9300_h112 = {
1299 }, 1289 },
1300 .base_ext1 = { 1290 .base_ext1 = {
1301 .ant_div_control = 0, 1291 .ant_div_control = 0,
1302 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 1292 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
1303 }, 1293 },
1304 .calFreqPier2G = { 1294 .calFreqPier2G = {
1305 FREQ2FBIN(2412, 1), 1295 FREQ2FBIN(2412, 1),
@@ -1478,10 +1468,8 @@ static const struct ar9300_eeprom ar9300_h112 = {
1478 .spurChans = {0, 0, 0, 0, 0}, 1468 .spurChans = {0, 0, 0, 0, 0},
1479 /* noiseFloorThreshCh Check if the register is per chain */ 1469 /* noiseFloorThreshCh Check if the register is per chain */
1480 .noiseFloorThreshCh = {-1, 0, 0}, 1470 .noiseFloorThreshCh = {-1, 0, 0},
1481 .ob = {3, 3, 3}, /* 3 chain */ 1471 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1482 .db_stage2 = {3, 3, 3}, /* 3 chain */ 1472 .quick_drop = 0,
1483 .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
1484 .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
1485 .xpaBiasLvl = 0, 1473 .xpaBiasLvl = 0,
1486 .txFrameToDataStart = 0x0e, 1474 .txFrameToDataStart = 0x0e,
1487 .txFrameToPaOn = 0x0e, 1475 .txFrameToPaOn = 0x0e,
@@ -1854,10 +1842,8 @@ static const struct ar9300_eeprom ar9300_x112 = {
1854 * if the register is per chain 1842 * if the register is per chain
1855 */ 1843 */
1856 .noiseFloorThreshCh = {-1, 0, 0}, 1844 .noiseFloorThreshCh = {-1, 0, 0},
1857 .ob = {1, 1, 1},/* 3 chain */ 1845 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
1858 .db_stage2 = {1, 1, 1}, /* 3 chain */ 1846 .quick_drop = 0,
1859 .db_stage3 = {0, 0, 0},
1860 .db_stage4 = {0, 0, 0},
1861 .xpaBiasLvl = 0, 1847 .xpaBiasLvl = 0,
1862 .txFrameToDataStart = 0x0e, 1848 .txFrameToDataStart = 0x0e,
1863 .txFrameToPaOn = 0x0e, 1849 .txFrameToPaOn = 0x0e,
@@ -1877,7 +1863,7 @@ static const struct ar9300_eeprom ar9300_x112 = {
1877 }, 1863 },
1878 .base_ext1 = { 1864 .base_ext1 = {
1879 .ant_div_control = 0, 1865 .ant_div_control = 0,
1880 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 1866 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
1881 }, 1867 },
1882 .calFreqPier2G = { 1868 .calFreqPier2G = {
1883 FREQ2FBIN(2412, 1), 1869 FREQ2FBIN(2412, 1),
@@ -2056,10 +2042,8 @@ static const struct ar9300_eeprom ar9300_x112 = {
2056 .spurChans = {0, 0, 0, 0, 0}, 2042 .spurChans = {0, 0, 0, 0, 0},
2057 /* noiseFloorThreshch check if the register is per chain */ 2043 /* noiseFloorThreshch check if the register is per chain */
2058 .noiseFloorThreshCh = {-1, 0, 0}, 2044 .noiseFloorThreshCh = {-1, 0, 0},
2059 .ob = {3, 3, 3}, /* 3 chain */ 2045 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2060 .db_stage2 = {3, 3, 3}, /* 3 chain */ 2046 .quick_drop = 0,
2061 .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
2062 .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
2063 .xpaBiasLvl = 0, 2047 .xpaBiasLvl = 0,
2064 .txFrameToDataStart = 0x0e, 2048 .txFrameToDataStart = 0x0e,
2065 .txFrameToPaOn = 0x0e, 2049 .txFrameToPaOn = 0x0e,
@@ -2431,10 +2415,8 @@ static const struct ar9300_eeprom ar9300_h116 = {
2431 * if the register is per chain 2415 * if the register is per chain
2432 */ 2416 */
2433 .noiseFloorThreshCh = {-1, 0, 0}, 2417 .noiseFloorThreshCh = {-1, 0, 0},
2434 .ob = {1, 1, 1},/* 3 chain */ 2418 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2435 .db_stage2 = {1, 1, 1}, /* 3 chain */ 2419 .quick_drop = 0,
2436 .db_stage3 = {0, 0, 0},
2437 .db_stage4 = {0, 0, 0},
2438 .xpaBiasLvl = 0, 2420 .xpaBiasLvl = 0,
2439 .txFrameToDataStart = 0x0e, 2421 .txFrameToDataStart = 0x0e,
2440 .txFrameToPaOn = 0x0e, 2422 .txFrameToPaOn = 0x0e,
@@ -2454,7 +2436,7 @@ static const struct ar9300_eeprom ar9300_h116 = {
2454 }, 2436 },
2455 .base_ext1 = { 2437 .base_ext1 = {
2456 .ant_div_control = 0, 2438 .ant_div_control = 0,
2457 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} 2439 .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
2458 }, 2440 },
2459 .calFreqPier2G = { 2441 .calFreqPier2G = {
2460 FREQ2FBIN(2412, 1), 2442 FREQ2FBIN(2412, 1),
@@ -2633,10 +2615,8 @@ static const struct ar9300_eeprom ar9300_h116 = {
2633 .spurChans = {0, 0, 0, 0, 0}, 2615 .spurChans = {0, 0, 0, 0, 0},
2634 /* noiseFloorThreshCh Check if the register is per chain */ 2616 /* noiseFloorThreshCh Check if the register is per chain */
2635 .noiseFloorThreshCh = {-1, 0, 0}, 2617 .noiseFloorThreshCh = {-1, 0, 0},
2636 .ob = {3, 3, 3}, /* 3 chain */ 2618 .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
2637 .db_stage2 = {3, 3, 3}, /* 3 chain */ 2619 .quick_drop = 0,
2638 .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
2639 .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
2640 .xpaBiasLvl = 0, 2620 .xpaBiasLvl = 0,
2641 .txFrameToDataStart = 0x0e, 2621 .txFrameToDataStart = 0x0e,
2642 .txFrameToPaOn = 0x0e, 2622 .txFrameToPaOn = 0x0e,
@@ -3023,6 +3003,8 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
3023 return eep->modalHeader5G.antennaGain; 3003 return eep->modalHeader5G.antennaGain;
3024 case EEP_ANTENNA_GAIN_2G: 3004 case EEP_ANTENNA_GAIN_2G:
3025 return eep->modalHeader2G.antennaGain; 3005 return eep->modalHeader2G.antennaGain;
3006 case EEP_QUICK_DROP:
3007 return pBase->miscConfiguration & BIT(1);
3026 default: 3008 default:
3027 return 0; 3009 return 0;
3028 } 3010 }
@@ -3428,25 +3410,13 @@ static u32 ar9003_dump_modal_eeprom(char *buf, u32 len, u32 size,
3428 PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]); 3410 PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]);
3429 PR_EEP("Chain1 NF Threshold", modal_hdr->noiseFloorThreshCh[1]); 3411 PR_EEP("Chain1 NF Threshold", modal_hdr->noiseFloorThreshCh[1]);
3430 PR_EEP("Chain2 NF Threshold", modal_hdr->noiseFloorThreshCh[2]); 3412 PR_EEP("Chain2 NF Threshold", modal_hdr->noiseFloorThreshCh[2]);
3413 PR_EEP("Quick Drop", modal_hdr->quick_drop);
3431 PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl); 3414 PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl);
3432 PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart); 3415 PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart);
3433 PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn); 3416 PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn);
3434 PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn); 3417 PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn);
3435 PR_EEP("txClip", modal_hdr->txClip); 3418 PR_EEP("txClip", modal_hdr->txClip);
3436 PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize); 3419 PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize);
3437 PR_EEP("Chain0 ob", modal_hdr->ob[0]);
3438 PR_EEP("Chain1 ob", modal_hdr->ob[1]);
3439 PR_EEP("Chain2 ob", modal_hdr->ob[2]);
3440
3441 PR_EEP("Chain0 db_stage2", modal_hdr->db_stage2[0]);
3442 PR_EEP("Chain1 db_stage2", modal_hdr->db_stage2[1]);
3443 PR_EEP("Chain2 db_stage2", modal_hdr->db_stage2[2]);
3444 PR_EEP("Chain0 db_stage3", modal_hdr->db_stage3[0]);
3445 PR_EEP("Chain1 db_stage3", modal_hdr->db_stage3[1]);
3446 PR_EEP("Chain2 db_stage3", modal_hdr->db_stage3[2]);
3447 PR_EEP("Chain0 db_stage4", modal_hdr->db_stage4[0]);
3448 PR_EEP("Chain1 db_stage4", modal_hdr->db_stage4[1]);
3449 PR_EEP("Chain2 db_stage4", modal_hdr->db_stage4[2]);
3450 3420
3451 return len; 3421 return len;
3452} 3422}
@@ -3503,6 +3473,7 @@ static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
3503 PR_EEP("Internal regulator", !!(pBase->featureEnable & BIT(4))); 3473 PR_EEP("Internal regulator", !!(pBase->featureEnable & BIT(4)));
3504 PR_EEP("Enable Paprd", !!(pBase->featureEnable & BIT(5))); 3474 PR_EEP("Enable Paprd", !!(pBase->featureEnable & BIT(5)));
3505 PR_EEP("Driver Strength", !!(pBase->miscConfiguration & BIT(0))); 3475 PR_EEP("Driver Strength", !!(pBase->miscConfiguration & BIT(0)));
3476 PR_EEP("Quick Drop", !!(pBase->miscConfiguration & BIT(1)));
3506 PR_EEP("Chain mask Reduce", (pBase->miscConfiguration >> 0x3) & 0x1); 3477 PR_EEP("Chain mask Reduce", (pBase->miscConfiguration >> 0x3) & 0x1);
3507 PR_EEP("Write enable Gpio", pBase->eepromWriteEnableGpio); 3478 PR_EEP("Write enable Gpio", pBase->eepromWriteEnableGpio);
3508 PR_EEP("WLAN Disable Gpio", pBase->wlanDisableGpio); 3479 PR_EEP("WLAN Disable Gpio", pBase->wlanDisableGpio);
@@ -3965,6 +3936,26 @@ static void ar9003_hw_apply_tuning_caps(struct ath_hw *ah)
3965 } 3936 }
3966} 3937}
3967 3938
3939static void ar9003_hw_quick_drop_apply(struct ath_hw *ah, u16 freq)
3940{
3941 struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
3942 int quick_drop = ath9k_hw_ar9300_get_eeprom(ah, EEP_QUICK_DROP);
3943 s32 t[3], f[3] = {5180, 5500, 5785};
3944
3945 if (!quick_drop)
3946 return;
3947
3948 if (freq < 4000)
3949 quick_drop = eep->modalHeader2G.quick_drop;
3950 else {
3951 t[0] = eep->base_ext1.quick_drop_low;
3952 t[1] = eep->modalHeader5G.quick_drop;
3953 t[2] = eep->base_ext1.quick_drop_high;
3954 quick_drop = ar9003_hw_power_interpolate(freq, f, t, 3);
3955 }
3956 REG_RMW_FIELD(ah, AR_PHY_AGC, AR_PHY_AGC_QUICK_DROP, quick_drop);
3957}
3958
3968static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah, 3959static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,
3969 struct ath9k_channel *chan) 3960 struct ath9k_channel *chan)
3970{ 3961{
@@ -3972,6 +3963,7 @@ static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,
3972 ar9003_hw_ant_ctrl_apply(ah, IS_CHAN_2GHZ(chan)); 3963 ar9003_hw_ant_ctrl_apply(ah, IS_CHAN_2GHZ(chan));
3973 ar9003_hw_drive_strength_apply(ah); 3964 ar9003_hw_drive_strength_apply(ah);
3974 ar9003_hw_atten_apply(ah, chan); 3965 ar9003_hw_atten_apply(ah, chan);
3966 ar9003_hw_quick_drop_apply(ah, chan->channel);
3975 if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah)) 3967 if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah))
3976 ar9003_hw_internal_regulator_apply(ah); 3968 ar9003_hw_internal_regulator_apply(ah);
3977 if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah)) 3969 if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah))