diff options
author | Gábor Stefanik <netrolller.3d@gmail.com> | 2009-08-16 12:05:09 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-20 11:35:56 -0400 |
commit | 5269102ec9c1584ccfab71affd1d7600d59f9096 (patch) | |
tree | b6d5fda3874ad2115d5a1957ce365246fb2e73d1 /drivers/net/wireless | |
parent | 055114a38804947554065194d50ded4bc7d7c4c6 (diff) |
b43: LP-PHY: Update code for spec fixes, and fix a few typos
A few typos have been discovered in both the specs and the code.
This patch fixes them.
Also use lpphy_op_switch_channel consistently, and make all users
of it print its return value for easier debugging.
Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/b43/phy_lp.c | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c index cb6c18d2cdbd..4d14102821c8 100644 --- a/drivers/net/wireless/b43/phy_lp.c +++ b/drivers/net/wireless/b43/phy_lp.c | |||
@@ -552,7 +552,7 @@ static void lpphy_2062_init(struct b43_wldev *dev) | |||
552 | B43_WARN_ON(!(bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU)); | 552 | B43_WARN_ON(!(bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU)); |
553 | B43_WARN_ON(crystalfreq == 0); | 553 | B43_WARN_ON(crystalfreq == 0); |
554 | 554 | ||
555 | if (crystalfreq >= 30000000) { | 555 | if (crystalfreq <= 30000000) { |
556 | lpphy->pdiv = 1; | 556 | lpphy->pdiv = 1; |
557 | b43_radio_mask(dev, B2062_S_RFPLL_CTL1, 0xFFFB); | 557 | b43_radio_mask(dev, B2062_S_RFPLL_CTL1, 0xFFFB); |
558 | } else { | 558 | } else { |
@@ -560,14 +560,16 @@ static void lpphy_2062_init(struct b43_wldev *dev) | |||
560 | b43_radio_set(dev, B2062_S_RFPLL_CTL1, 0x4); | 560 | b43_radio_set(dev, B2062_S_RFPLL_CTL1, 0x4); |
561 | } | 561 | } |
562 | 562 | ||
563 | tmp = (800000000 * lpphy->pdiv + crystalfreq) / | 563 | tmp = (((800000000 * lpphy->pdiv + crystalfreq) / |
564 | (32000000 * lpphy->pdiv); | 564 | (2 * crystalfreq)) - 8) & 0xFF; |
565 | tmp = (tmp - 1) & 0xFF; | 565 | b43_radio_write(dev, B2062_S_RFPLL_CTL7, tmp); |
566 | |||
567 | tmp = (((100 * crystalfreq + 16000000 * lpphy->pdiv) / | ||
568 | (32000000 * lpphy->pdiv)) - 1) & 0xFF; | ||
566 | b43_radio_write(dev, B2062_S_RFPLL_CTL18, tmp); | 569 | b43_radio_write(dev, B2062_S_RFPLL_CTL18, tmp); |
567 | 570 | ||
568 | tmp = (2 * crystalfreq + 1000000 * lpphy->pdiv) / | 571 | tmp = (((2 * crystalfreq + 1000000 * lpphy->pdiv) / |
569 | (2000000 * lpphy->pdiv); | 572 | (2000000 * lpphy->pdiv)) - 1) & 0xFF; |
570 | tmp = ((tmp & 0xFF) - 1) & 0xFFFF; | ||
571 | b43_radio_write(dev, B2062_S_RFPLL_CTL19, tmp); | 573 | b43_radio_write(dev, B2062_S_RFPLL_CTL19, tmp); |
572 | 574 | ||
573 | ref = (1000 * lpphy->pdiv + 2 * crystalfreq) / (2000 * lpphy->pdiv); | 575 | ref = (1000 * lpphy->pdiv + 2 * crystalfreq) / (2000 * lpphy->pdiv); |
@@ -671,7 +673,7 @@ static void lpphy_radio_init(struct b43_wldev *dev) | |||
671 | b43_phy_mask(dev, B43_LPPHY_FOURWIRE_CTL, 0xFFFD); | 673 | b43_phy_mask(dev, B43_LPPHY_FOURWIRE_CTL, 0xFFFD); |
672 | udelay(1); | 674 | udelay(1); |
673 | 675 | ||
674 | if (dev->phy.rev < 2) { | 676 | if (dev->phy.radio_ver == 0x2062) { |
675 | lpphy_2062_init(dev); | 677 | lpphy_2062_init(dev); |
676 | } else { | 678 | } else { |
677 | lpphy_2063_init(dev); | 679 | lpphy_2063_init(dev); |
@@ -688,11 +690,18 @@ struct lpphy_iq_est { u32 iq_prod, i_pwr, q_pwr; }; | |||
688 | 690 | ||
689 | static void lpphy_set_rc_cap(struct b43_wldev *dev) | 691 | static void lpphy_set_rc_cap(struct b43_wldev *dev) |
690 | { | 692 | { |
691 | u8 rc_cap = dev->phy.lp->rc_cap; | 693 | struct b43_phy_lp *lpphy = dev->phy.lp; |
694 | |||
695 | u8 rc_cap = (lpphy->rc_cap & 0x1F) >> 1; | ||
692 | 696 | ||
693 | b43_radio_write(dev, B2062_N_RXBB_CALIB2, max_t(u8, rc_cap-4, 0x80)); | 697 | if (dev->phy.rev == 1) //FIXME check channel 14! |
694 | b43_radio_write(dev, B2062_N_TX_CTL_A, ((rc_cap & 0x1F) >> 1) | 0x80); | 698 | rc_cap = max_t(u8, rc_cap + 5, 15); |
695 | b43_radio_write(dev, B2062_S_RXG_CNT16, ((rc_cap & 0x1F) >> 2) | 0x80); | 699 | |
700 | b43_radio_write(dev, B2062_N_RXBB_CALIB2, | ||
701 | max_t(u8, lpphy->rc_cap - 4, 0x80)); | ||
702 | b43_radio_write(dev, B2062_N_TX_CTL_A, rc_cap | 0x80); | ||
703 | b43_radio_write(dev, B2062_S_RXG_CNT16, | ||
704 | ((lpphy->rc_cap & 0x1F) >> 2) | 0x80); | ||
696 | } | 705 | } |
697 | 706 | ||
698 | static u8 lpphy_get_bb_mult(struct b43_wldev *dev) | 707 | static u8 lpphy_get_bb_mult(struct b43_wldev *dev) |
@@ -1101,6 +1110,9 @@ static void lpphy_set_tx_power_control(struct b43_wldev *dev, | |||
1101 | lpphy_write_tx_pctl_mode_to_hardware(dev); | 1110 | lpphy_write_tx_pctl_mode_to_hardware(dev); |
1102 | } | 1111 | } |
1103 | 1112 | ||
1113 | static int b43_lpphy_op_switch_channel(struct b43_wldev *dev, | ||
1114 | unsigned int new_channel); | ||
1115 | |||
1104 | static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev) | 1116 | static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev) |
1105 | { | 1117 | { |
1106 | struct b43_phy_lp *lpphy = dev->phy.lp; | 1118 | struct b43_phy_lp *lpphy = dev->phy.lp; |
@@ -1118,11 +1130,16 @@ static void lpphy_rev0_1_rc_calib(struct b43_wldev *dev) | |||
1118 | old_rf2_ovr, old_rf2_ovrval, old_phy_ctl; | 1130 | old_rf2_ovr, old_rf2_ovrval, old_phy_ctl; |
1119 | enum b43_lpphy_txpctl_mode old_txpctl; | 1131 | enum b43_lpphy_txpctl_mode old_txpctl; |
1120 | u32 normal_pwr, ideal_pwr, mean_sq_pwr, tmp = 0, mean_sq_pwr_min = 0; | 1132 | u32 normal_pwr, ideal_pwr, mean_sq_pwr, tmp = 0, mean_sq_pwr_min = 0; |
1121 | int loopback, i, j, inner_sum; | 1133 | int loopback, i, j, inner_sum, err; |
1122 | 1134 | ||
1123 | memset(&iq_est, 0, sizeof(iq_est)); | 1135 | memset(&iq_est, 0, sizeof(iq_est)); |
1124 | 1136 | ||
1125 | b43_switch_channel(dev, 7); | 1137 | err = b43_lpphy_op_switch_channel(dev, 7); |
1138 | if (err) { | ||
1139 | b43dbg(dev->wl, | ||
1140 | "RC calib: Failed to switch to channel 7, error = %d", | ||
1141 | err); | ||
1142 | } | ||
1126 | old_txg_ovr = (b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVR) >> 6) & 1; | 1143 | old_txg_ovr = (b43_phy_read(dev, B43_LPPHY_AFE_CTL_OVR) >> 6) & 1; |
1127 | old_bbmult = lpphy_get_bb_mult(dev); | 1144 | old_bbmult = lpphy_get_bb_mult(dev); |
1128 | if (old_txg_ovr) | 1145 | if (old_txg_ovr) |
@@ -1881,14 +1898,14 @@ static int lpphy_b2062_tune(struct b43_wldev *dev, | |||
1881 | { | 1898 | { |
1882 | struct b43_phy_lp *lpphy = dev->phy.lp; | 1899 | struct b43_phy_lp *lpphy = dev->phy.lp; |
1883 | struct ssb_bus *bus = dev->dev->bus; | 1900 | struct ssb_bus *bus = dev->dev->bus; |
1884 | static const struct b206x_channel *chandata = NULL; | 1901 | const struct b206x_channel *chandata = NULL; |
1885 | u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; | 1902 | u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; |
1886 | u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9; | 1903 | u32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9; |
1887 | int i, err = 0; | 1904 | int i, err = 0; |
1888 | 1905 | ||
1889 | for (i = 0; i < ARRAY_SIZE(b2063_chantbl); i++) { | 1906 | for (i = 0; i < ARRAY_SIZE(b2062_chantbl); i++) { |
1890 | if (b2063_chantbl[i].channel == channel) { | 1907 | if (b2062_chantbl[i].channel == channel) { |
1891 | chandata = &b2063_chantbl[i]; | 1908 | chandata = &b2062_chantbl[i]; |
1892 | break; | 1909 | break; |
1893 | } | 1910 | } |
1894 | } | 1911 | } |