diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-01-17 07:03:32 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-19 16:34:01 -0500 |
commit | e53de67449bbcaf5551f54e506a4dff62fc6a49c (patch) | |
tree | 349d11ad4ea7f9277df1027bda320fcb802a253f /drivers/net/wireless/b43/phy_n.c | |
parent | 026816fce48390807859508cd5172e9c79901ef7 (diff) |
b43: N-PHY: implement TX PHY cleanup and setup
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy_n.c')
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 112 |
1 files changed, 110 insertions, 2 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index a1dd381c6c6e..fd93b2a6b494 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -1505,6 +1505,114 @@ static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev) | |||
1505 | return target; | 1505 | return target; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhyCleanup */ | ||
1509 | static void b43_nphy_tx_cal_phy_cleanup(struct b43_wldev *dev) | ||
1510 | { | ||
1511 | u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; | ||
1512 | |||
1513 | if (dev->phy.rev >= 3) { | ||
1514 | b43_phy_write(dev, B43_NPHY_AFECTL_C1, regs[0]); | ||
1515 | b43_phy_write(dev, B43_NPHY_AFECTL_C2, regs[1]); | ||
1516 | b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, regs[2]); | ||
1517 | b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[3]); | ||
1518 | b43_phy_write(dev, B43_NPHY_BBCFG, regs[4]); | ||
1519 | /* TODO: Write an N PHY Table with ID 8, length 1, offset 3, | ||
1520 | width 16, and data from regs[5] */ | ||
1521 | /* TODO: Write an N PHY Table with ID 8, length 1, offset 19, | ||
1522 | width 16, and data from regs[6] */ | ||
1523 | b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[7]); | ||
1524 | b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[8]); | ||
1525 | b43_phy_write(dev, B43_NPHY_PAPD_EN0, regs[9]); | ||
1526 | b43_phy_write(dev, B43_NPHY_PAPD_EN1, regs[10]); | ||
1527 | b43_nphy_reset_cca(dev); | ||
1528 | } else { | ||
1529 | b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, regs[0]); | ||
1530 | b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, regs[1]); | ||
1531 | b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[2]); | ||
1532 | /* TODO: Write an N PHY Table with ID 8, length 1, offset 2, | ||
1533 | width 16, and data from regs[3] */ | ||
1534 | /* TODO: Write an N PHY Table with ID 8, length 1, offset 18, | ||
1535 | width 16, and data from regs[4] */ | ||
1536 | b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[5]); | ||
1537 | b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[6]); | ||
1538 | } | ||
1539 | } | ||
1540 | |||
1541 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhySetup */ | ||
1542 | static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev) | ||
1543 | { | ||
1544 | u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs; | ||
1545 | u16 tmp; | ||
1546 | |||
1547 | regs[0] = b43_phy_read(dev, B43_NPHY_AFECTL_C1); | ||
1548 | regs[1] = b43_phy_read(dev, B43_NPHY_AFECTL_C2); | ||
1549 | if (dev->phy.rev >= 3) { | ||
1550 | b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0xF0FF, 0x0A00); | ||
1551 | b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0xF0FF, 0x0A00); | ||
1552 | |||
1553 | tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER1); | ||
1554 | regs[2] = tmp; | ||
1555 | b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, tmp | 0x0600); | ||
1556 | |||
1557 | tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); | ||
1558 | regs[3] = tmp; | ||
1559 | b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x0600); | ||
1560 | |||
1561 | regs[4] = b43_phy_read(dev, B43_NPHY_BBCFG); | ||
1562 | b43_phy_mask(dev, B43_NPHY_BBCFG, ~B43_NPHY_BBCFG_RSTRX); | ||
1563 | |||
1564 | /* TODO: Read an N PHY Table with ID 8, length 1, offset 3, | ||
1565 | width 16, and data pointing to tmp */ | ||
1566 | regs[5] = tmp; | ||
1567 | |||
1568 | /* TODO: Write an N PHY Table with ID 8, length 1, offset 3, | ||
1569 | width 16, and data 0 */ | ||
1570 | /* TODO: Read an N PHY Table with ID 8, length 1, offset 19, | ||
1571 | width 16, and data pointing to tmp */ | ||
1572 | regs[6] = tmp; | ||
1573 | |||
1574 | /* TODO: Write an N PHY Table with ID 8, length 1, offset 19, | ||
1575 | width 16, and data 0 */ | ||
1576 | regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); | ||
1577 | regs[8] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); | ||
1578 | |||
1579 | /* TODO: Call N PHY RF Ctrl Intc Override with 2, 1, 3 */ | ||
1580 | /* TODO: Call N PHY RF Ctrl Intc Override with 1, 2, 1 */ | ||
1581 | /* TODO: Call N PHY RF Ctrl Intc Override with 1, 8, 2 */ | ||
1582 | |||
1583 | regs[9] = b43_phy_read(dev, B43_NPHY_PAPD_EN0); | ||
1584 | regs[10] = b43_phy_read(dev, B43_NPHY_PAPD_EN1); | ||
1585 | b43_phy_mask(dev, B43_NPHY_PAPD_EN0, ~0x0001); | ||
1586 | b43_phy_mask(dev, B43_NPHY_PAPD_EN1, ~0x0001); | ||
1587 | } else { | ||
1588 | b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, 0xA000); | ||
1589 | b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, 0xA000); | ||
1590 | tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); | ||
1591 | regs[2] = tmp; | ||
1592 | b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x3000); | ||
1593 | /* TODO: Read an N PHY Table with ID 8, length 1, offset 2, | ||
1594 | width 16, and data pointing to tmp */ | ||
1595 | regs[3] = tmp; | ||
1596 | tmp |= 0x2000; | ||
1597 | /* TODO: Write an N PHY Table with ID 8, length 1, offset 2, | ||
1598 | width 16, and data pointer tmp */ | ||
1599 | /* TODO: Read an N PHY Table with ID 8, length 1, offset 18, | ||
1600 | width 16, and data pointer tmp */ | ||
1601 | regs[4] = tmp; | ||
1602 | tmp |= 0x2000; | ||
1603 | /* TODO: Write an N PHY Table with ID 8, length 1, offset 18, | ||
1604 | width 16, and data pointer tmp */ | ||
1605 | regs[5] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); | ||
1606 | regs[6] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); | ||
1607 | if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) | ||
1608 | tmp = 0x0180; | ||
1609 | else | ||
1610 | tmp = 0x0120; | ||
1611 | b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, tmp); | ||
1612 | b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, tmp); | ||
1613 | } | ||
1614 | } | ||
1615 | |||
1508 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */ | 1616 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */ |
1509 | static void b43_nphy_restore_cal(struct b43_wldev *dev) | 1617 | static void b43_nphy_restore_cal(struct b43_wldev *dev) |
1510 | { | 1618 | { |
@@ -1617,7 +1725,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, | |||
1617 | width 16, and data pointer gain */ | 1725 | width 16, and data pointer gain */ |
1618 | 1726 | ||
1619 | b43_nphy_tx_cal_radio_setup(dev); | 1727 | b43_nphy_tx_cal_radio_setup(dev); |
1620 | /* TODO: Call N PHY TX Cal PHY Setup */ | 1728 | b43_nphy_tx_cal_phy_setup(dev); |
1621 | 1729 | ||
1622 | phy6or5x = dev->phy.rev >= 6 || | 1730 | phy6or5x = dev->phy.rev >= 6 || |
1623 | (dev->phy.rev == 5 && nphy->ipa2g_on && | 1731 | (dev->phy.rev == 5 && nphy->ipa2g_on && |
@@ -1788,7 +1896,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, | |||
1788 | b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0); | 1896 | b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0); |
1789 | } | 1897 | } |
1790 | 1898 | ||
1791 | /* TODO: Call N PHY TX Cal PHY Cleanup */ | 1899 | b43_nphy_tx_cal_phy_cleanup(dev); |
1792 | /* TODO: Write an N PHY Table with ID 7, length 2, offset 0x110, | 1900 | /* TODO: Write an N PHY Table with ID 7, length 2, offset 0x110, |
1793 | width 16, and data from save */ | 1901 | width 16, and data from save */ |
1794 | 1902 | ||