aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k/phy.c
diff options
context:
space:
mode:
authorNick Kossifidis <mick@madwifi.org>2008-04-16 11:42:48 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-16 16:00:02 -0400
commit136bfc798fe5378c7c1b5f5294abcfd1428438b3 (patch)
treeb2f09a5a27a2c13f873b21b1911fe6faf5d14d53 /drivers/net/wireless/ath5k/phy.c
parentfcc76c6b3367e654377d61403f4945ac85c4b651 (diff)
ath5k: Add RF2425 initvals
*Add RF2425 initvals (still no rx/tx) This was on my laptop for a long time so it has to go out even if it still doesn't work, i hope i'll get my hands on an eeepc so i can work this out. base.c Changes-licensed-under: 3-clause-BSD rest Changes-licensed-under: ISC Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath5k/phy.c')
-rw-r--r--drivers/net/wireless/ath5k/phy.c123
1 files changed, 118 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath5k/phy.c b/drivers/net/wireless/ath5k/phy.c
index 890ecce8bedc..afd8689e5c03 100644
--- a/drivers/net/wireless/ath5k/phy.c
+++ b/drivers/net/wireless/ath5k/phy.c
@@ -669,6 +669,7 @@ static const struct ath5k_ini_rf rfregs_5413[] = {
669/* RF2413/2414 mode-specific init registers */ 669/* RF2413/2414 mode-specific init registers */
670static const struct ath5k_ini_rf rfregs_2413[] = { 670static const struct ath5k_ini_rf rfregs_2413[] = {
671 { 1, AR5K_RF_BUFFER_CONTROL_4, 671 { 1, AR5K_RF_BUFFER_CONTROL_4,
672 /* mode b mode g mode gTurbo */
672 { 0x00000020, 0x00000020, 0x00000020 } }, 673 { 0x00000020, 0x00000020, 0x00000020 } },
673 { 2, AR5K_RF_BUFFER_CONTROL_3, 674 { 2, AR5K_RF_BUFFER_CONTROL_3,
674 { 0x02001408, 0x02001408, 0x02001408 } }, 675 { 0x02001408, 0x02001408, 0x02001408 } },
@@ -736,6 +737,83 @@ static const struct ath5k_ini_rf rfregs_2413[] = {
736 { 0x0000000e, 0x0000000e, 0x0000000e } }, 737 { 0x0000000e, 0x0000000e, 0x0000000e } },
737}; 738};
738 739
740/* RF2425 mode-specific init registers */
741static const struct ath5k_ini_rf rfregs_2425[] = {
742 { 1, AR5K_RF_BUFFER_CONTROL_4,
743 /* mode g mode gTurbo */
744 { 0x00000020, 0x00000020 } },
745 { 2, AR5K_RF_BUFFER_CONTROL_3,
746 { 0x02001408, 0x02001408 } },
747 { 3, AR5K_RF_BUFFER_CONTROL_6,
748 { 0x00e020c0, 0x00e020c0 } },
749 { 6, AR5K_RF_BUFFER,
750 { 0x10000000, 0x10000000 } },
751 { 6, AR5K_RF_BUFFER,
752 { 0x00000000, 0x00000000 } },
753 { 6, AR5K_RF_BUFFER,
754 { 0x00000000, 0x00000000 } },
755 { 6, AR5K_RF_BUFFER,
756 { 0x00000000, 0x00000000 } },
757 { 6, AR5K_RF_BUFFER,
758 { 0x00000000, 0x00000000 } },
759 { 6, AR5K_RF_BUFFER,
760 { 0x00000000, 0x00000000 } },
761 { 6, AR5K_RF_BUFFER,
762 { 0x00000000, 0x00000000 } },
763 { 6, AR5K_RF_BUFFER,
764 { 0x00000000, 0x00000000 } },
765 { 6, AR5K_RF_BUFFER,
766 { 0x00000000, 0x00000000 } },
767 { 6, AR5K_RF_BUFFER,
768 { 0x00000000, 0x00000000 } },
769 { 6, AR5K_RF_BUFFER,
770 { 0x00000000, 0x00000000 } },
771 { 6, AR5K_RF_BUFFER,
772 { 0x002a0000, 0x002a0000 } },
773 { 6, AR5K_RF_BUFFER,
774 { 0x00000000, 0x00000000 } },
775 { 6, AR5K_RF_BUFFER,
776 { 0x00000000, 0x00000000 } },
777 { 6, AR5K_RF_BUFFER,
778 { 0x00100000, 0x00100000 } },
779 { 6, AR5K_RF_BUFFER,
780 { 0x00020000, 0x00020000 } },
781 { 6, AR5K_RF_BUFFER,
782 { 0x00730000, 0x00730000 } },
783 { 6, AR5K_RF_BUFFER,
784 { 0x00f80000, 0x00f80000 } },
785 { 6, AR5K_RF_BUFFER,
786 { 0x00e70000, 0x00e70000 } },
787 { 6, AR5K_RF_BUFFER,
788 { 0x00140000, 0x00140000 } },
789 { 6, AR5K_RF_BUFFER,
790 { 0x00910040, 0x00910040 } },
791 { 6, AR5K_RF_BUFFER,
792 { 0x0007001a, 0x0007001a } },
793 { 6, AR5K_RF_BUFFER,
794 { 0x00410000, 0x00410000 } },
795 { 6, AR5K_RF_BUFFER,
796 { 0x00810060, 0x00810060 } },
797 { 6, AR5K_RF_BUFFER,
798 { 0x00020803, 0x00020803 } },
799 { 6, AR5K_RF_BUFFER,
800 { 0x00000000, 0x00000000 } },
801 { 6, AR5K_RF_BUFFER,
802 { 0x00000000, 0x00000000 } },
803 { 6, AR5K_RF_BUFFER,
804 { 0x00001660, 0x00001660 } },
805 { 6, AR5K_RF_BUFFER,
806 { 0x00001688, 0x00001688 } },
807 { 6, AR5K_RF_BUFFER_CONTROL_1,
808 { 0x00000001, 0x00000001 } },
809 { 7, AR5K_RF_BUFFER,
810 { 0x00006400, 0x00006400 } },
811 { 7, AR5K_RF_BUFFER,
812 { 0x00000800, 0x00000800 } },
813 { 7, AR5K_RF_BUFFER_CONTROL_2,
814 { 0x0000000e, 0x0000000e } },
815};
816
739/* Initial RF Gain settings for RF5112 */ 817/* Initial RF Gain settings for RF5112 */
740static const struct ath5k_ini_rfgain rfgain_5112[] = { 818static const struct ath5k_ini_rfgain rfgain_5112[] = {
741 /* 5Ghz 2Ghz */ 819 /* 5Ghz 2Ghz */
@@ -1348,7 +1426,8 @@ static int ath5k_hw_rf5112_rfregs(struct ath5k_hw *ah,
1348} 1426}
1349 1427
1350/* 1428/*
1351 * Initialize RF5413/5414 1429 * Initialize RF5413/5414 and future chips
1430 * (until we come up with a better solution)
1352 */ 1431 */
1353static int ath5k_hw_rf5413_rfregs(struct ath5k_hw *ah, 1432static int ath5k_hw_rf5413_rfregs(struct ath5k_hw *ah,
1354 struct ieee80211_channel *channel, unsigned int mode) 1433 struct ieee80211_channel *channel, unsigned int mode)
@@ -1362,19 +1441,41 @@ static int ath5k_hw_rf5413_rfregs(struct ath5k_hw *ah,
1362 1441
1363 rf = ah->ah_rf_banks; 1442 rf = ah->ah_rf_banks;
1364 1443
1365 if (ah->ah_radio == AR5K_RF5413) { 1444 switch (ah->ah_radio) {
1445 case AR5K_RF5413:
1366 rf_ini = rfregs_5413; 1446 rf_ini = rfregs_5413;
1367 rf_size = ARRAY_SIZE(rfregs_5413); 1447 rf_size = ARRAY_SIZE(rfregs_5413);
1368 } else if (ah->ah_radio == AR5K_RF2413) { 1448 break;
1449 case AR5K_RF2413:
1369 rf_ini = rfregs_2413; 1450 rf_ini = rfregs_2413;
1370 rf_size = ARRAY_SIZE(rfregs_2413); 1451 rf_size = ARRAY_SIZE(rfregs_2413);
1452
1371 if (mode < 2) { 1453 if (mode < 2) {
1372 ATH5K_ERR(ah->ah_sc, 1454 ATH5K_ERR(ah->ah_sc,
1373 "invalid channel mode: %i\n", mode); 1455 "invalid channel mode: %i\n", mode);
1374 return -EINVAL; 1456 return -EINVAL;
1375 } 1457 }
1458
1376 mode = mode - 2; 1459 mode = mode - 2;
1377 } else { 1460 break;
1461 case AR5K_RF2425:
1462 rf_ini = rfregs_2425;
1463 rf_size = ARRAY_SIZE(rfregs_2425);
1464
1465 if (mode < 2) {
1466 ATH5K_ERR(ah->ah_sc,
1467 "invalid channel mode: %i\n", mode);
1468 return -EINVAL;
1469 }
1470
1471 /* Map b to g */
1472 if (mode == 2)
1473 mode = 0;
1474 else
1475 mode = mode - 3;
1476
1477 break;
1478 default:
1378 return -EINVAL; 1479 return -EINVAL;
1379 } 1480 }
1380 1481
@@ -1439,6 +1540,10 @@ int ath5k_hw_rfregs(struct ath5k_hw *ah, struct ieee80211_channel *channel,
1439 ah->ah_rf_banks_size = sizeof(rfregs_2413); 1540 ah->ah_rf_banks_size = sizeof(rfregs_2413);
1440 func = ath5k_hw_rf5413_rfregs; 1541 func = ath5k_hw_rf5413_rfregs;
1441 break; 1542 break;
1543 case AR5K_RF2425:
1544 ah->ah_rf_banks_size = sizeof(rfregs_2425);
1545 func = ath5k_hw_rf5413_rfregs;
1546 break;
1442 default: 1547 default:
1443 return -EINVAL; 1548 return -EINVAL;
1444 } 1549 }
@@ -1482,6 +1587,11 @@ int ath5k_hw_rfgain(struct ath5k_hw *ah, unsigned int freq)
1482 size = ARRAY_SIZE(rfgain_2413); 1587 size = ARRAY_SIZE(rfgain_2413);
1483 freq = 0; /* only 2Ghz */ 1588 freq = 0; /* only 2Ghz */
1484 break; 1589 break;
1590 case AR5K_RF2425:
1591 ath5k_rfg = rfgain_2413;
1592 size = ARRAY_SIZE(rfgain_2413);
1593 freq = 0; /* only 2Ghz */
1594 break;
1485 default: 1595 default:
1486 return -EINVAL; 1596 return -EINVAL;
1487 } 1597 }
@@ -2181,8 +2291,11 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
2181 * transmit anything if we call 2291 * transmit anything if we call
2182 * this funtion, so we skip it 2292 * this funtion, so we skip it
2183 * until we fix txpower. 2293 * until we fix txpower.
2294 *
2295 * XXX: Assume same for RF2425
2296 * to be safe.
2184 */ 2297 */
2185 if (ah->ah_radio == AR5K_RF2413) 2298 if ((ah->ah_radio == AR5K_RF2413) || (ah->ah_radio == AR5K_RF2425))
2186 return 0; 2299 return 0;
2187 2300
2188 /* Reset TX power values */ 2301 /* Reset TX power values */