diff options
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_radio.c')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_radio.c | 131 |
1 files changed, 121 insertions, 10 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c index cac604bc0955..4e8d8c936ab4 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c | |||
@@ -1652,7 +1652,7 @@ void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower) | |||
1652 | 1652 | ||
1653 | bcm43xx_ilt_write(bcm, 0x3001, dac); | 1653 | bcm43xx_ilt_write(bcm, 0x3001, dac); |
1654 | 1654 | ||
1655 | radio->txpower[0] = txpower; | 1655 | radio->txpwr_offset = txpower; |
1656 | 1656 | ||
1657 | TODO(); | 1657 | TODO(); |
1658 | //TODO: FuncPlaceholder (Adjust BB loft cancel) | 1658 | //TODO: FuncPlaceholder (Adjust BB loft cancel) |
@@ -1666,17 +1666,14 @@ void bcm43xx_radio_set_txpower_bg(struct bcm43xx_private *bcm, | |||
1666 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 1666 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1667 | 1667 | ||
1668 | if (baseband_attenuation == 0xFFFF) | 1668 | if (baseband_attenuation == 0xFFFF) |
1669 | baseband_attenuation = radio->txpower[0]; | 1669 | baseband_attenuation = radio->baseband_atten; |
1670 | else | ||
1671 | radio->txpower[0] = baseband_attenuation; | ||
1672 | if (radio_attenuation == 0xFFFF) | 1670 | if (radio_attenuation == 0xFFFF) |
1673 | radio_attenuation = radio->txpower[1]; | 1671 | radio_attenuation = radio->radio_atten; |
1674 | else | ||
1675 | radio->txpower[1] = radio_attenuation; | ||
1676 | if (txpower == 0xFFFF) | 1672 | if (txpower == 0xFFFF) |
1677 | txpower = radio->txpower[2]; | 1673 | txpower = radio->txctl1; |
1678 | else | 1674 | radio->baseband_atten = baseband_attenuation; |
1679 | radio->txpower[2] = txpower; | 1675 | radio->radio_atten = radio_attenuation; |
1676 | radio->txctl1 = txpower; | ||
1680 | 1677 | ||
1681 | assert(/*baseband_attenuation >= 0 &&*/ baseband_attenuation <= 11); | 1678 | assert(/*baseband_attenuation >= 0 &&*/ baseband_attenuation <= 11); |
1682 | if (radio->revision < 6) | 1679 | if (radio->revision < 6) |
@@ -1693,10 +1690,124 @@ void bcm43xx_radio_set_txpower_bg(struct bcm43xx_private *bcm, | |||
1693 | (bcm43xx_radio_read16(bcm, 0x0052) & ~0x0070) | 1690 | (bcm43xx_radio_read16(bcm, 0x0052) & ~0x0070) |
1694 | | ((txpower << 4) & 0x0070)); | 1691 | | ((txpower << 4) & 0x0070)); |
1695 | } | 1692 | } |
1693 | //FIXME: The spec is very weird and unclear here. | ||
1696 | if (phy->type == BCM43xx_PHYTYPE_G) | 1694 | if (phy->type == BCM43xx_PHYTYPE_G) |
1697 | bcm43xx_phy_lo_adjust(bcm, 0); | 1695 | bcm43xx_phy_lo_adjust(bcm, 0); |
1698 | } | 1696 | } |
1699 | 1697 | ||
1698 | u16 bcm43xx_default_baseband_attenuation(struct bcm43xx_private *bcm) | ||
1699 | { | ||
1700 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
1701 | |||
1702 | if (radio->version == 0x2050 && radio->revision < 6) | ||
1703 | return 0; | ||
1704 | return 2; | ||
1705 | } | ||
1706 | |||
1707 | u16 bcm43xx_default_radio_attenuation(struct bcm43xx_private *bcm) | ||
1708 | { | ||
1709 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
1710 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
1711 | u16 att = 0xFFFF; | ||
1712 | |||
1713 | if (phy->type == BCM43xx_PHYTYPE_A) | ||
1714 | return 0x60; | ||
1715 | |||
1716 | switch (radio->version) { | ||
1717 | case 0x2053: | ||
1718 | switch (radio->revision) { | ||
1719 | case 1: | ||
1720 | att = 6; | ||
1721 | break; | ||
1722 | } | ||
1723 | break; | ||
1724 | case 0x2050: | ||
1725 | switch (radio->revision) { | ||
1726 | case 0: | ||
1727 | att = 5; | ||
1728 | break; | ||
1729 | case 1: | ||
1730 | if (phy->type == BCM43xx_PHYTYPE_G) { | ||
1731 | if (bcm->board_vendor == PCI_VENDOR_ID_BROADCOM && | ||
1732 | bcm->board_type == 0x421 && | ||
1733 | bcm->board_revision >= 30) | ||
1734 | att = 3; | ||
1735 | else if (bcm->board_vendor == PCI_VENDOR_ID_BROADCOM && | ||
1736 | bcm->board_type == 0x416) | ||
1737 | att = 3; | ||
1738 | else | ||
1739 | att = 1; | ||
1740 | } else { | ||
1741 | if (bcm->board_vendor == PCI_VENDOR_ID_BROADCOM && | ||
1742 | bcm->board_type == 0x421 && | ||
1743 | bcm->board_revision >= 30) | ||
1744 | att = 7; | ||
1745 | else | ||
1746 | att = 6; | ||
1747 | } | ||
1748 | break; | ||
1749 | case 2: | ||
1750 | if (phy->type == BCM43xx_PHYTYPE_G) { | ||
1751 | if (bcm->board_vendor == PCI_VENDOR_ID_BROADCOM && | ||
1752 | bcm->board_type == 0x421 && | ||
1753 | bcm->board_revision >= 30) | ||
1754 | att = 3; | ||
1755 | else if (bcm->board_vendor == PCI_VENDOR_ID_BROADCOM && | ||
1756 | bcm->board_type == 0x416) | ||
1757 | att = 5; | ||
1758 | else if (bcm->chip_id == 0x4320) | ||
1759 | att = 4; | ||
1760 | else | ||
1761 | att = 3; | ||
1762 | } else | ||
1763 | att = 6; | ||
1764 | break; | ||
1765 | case 3: | ||
1766 | att = 5; | ||
1767 | break; | ||
1768 | case 4: | ||
1769 | case 5: | ||
1770 | att = 1; | ||
1771 | break; | ||
1772 | case 6: | ||
1773 | case 7: | ||
1774 | att = 5; | ||
1775 | break; | ||
1776 | case 8: | ||
1777 | att = 0x1A; | ||
1778 | break; | ||
1779 | case 9: | ||
1780 | default: | ||
1781 | att = 5; | ||
1782 | } | ||
1783 | } | ||
1784 | if (bcm->board_vendor == PCI_VENDOR_ID_BROADCOM && | ||
1785 | bcm->board_type == 0x421) { | ||
1786 | if (bcm->board_revision < 0x43) | ||
1787 | att = 2; | ||
1788 | else if (bcm->board_revision < 0x51) | ||
1789 | att = 3; | ||
1790 | } | ||
1791 | if (att == 0xFFFF) | ||
1792 | att = 5; | ||
1793 | |||
1794 | return att; | ||
1795 | } | ||
1796 | |||
1797 | u16 bcm43xx_default_txctl1(struct bcm43xx_private *bcm) | ||
1798 | { | ||
1799 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
1800 | |||
1801 | if (radio->version != 0x2050) | ||
1802 | return 0; | ||
1803 | if (radio->revision == 1) | ||
1804 | return 3; | ||
1805 | if (radio->revision < 6) | ||
1806 | return 2; | ||
1807 | if (radio->revision == 8) | ||
1808 | return 1; | ||
1809 | return 0; | ||
1810 | } | ||
1700 | 1811 | ||
1701 | void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm) | 1812 | void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm) |
1702 | { | 1813 | { |