| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | |
|---|
| 3 | 4 | Broadcom B43legacy wireless driver |
|---|
| .. | .. |
|---|
| 12 | 13 | Some parts of the code in this file are derived from the ipw2200 |
|---|
| 13 | 14 | driver Copyright(c) 2003 - 2004 Intel Corporation. |
|---|
| 14 | 15 | |
|---|
| 15 | | - This program is free software; you can redistribute it and/or modify |
|---|
| 16 | | - it under the terms of the GNU General Public License as published by |
|---|
| 17 | | - the Free Software Foundation; either version 2 of the License, or |
|---|
| 18 | | - (at your option) any later version. |
|---|
| 19 | | - |
|---|
| 20 | | - This program is distributed in the hope that it will be useful, |
|---|
| 21 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 22 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 23 | | - GNU General Public License for more details. |
|---|
| 24 | | - |
|---|
| 25 | | - You should have received a copy of the GNU General Public License |
|---|
| 26 | | - along with this program; see the file COPYING. If not, write to |
|---|
| 27 | | - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, |
|---|
| 28 | | - Boston, MA 02110-1301, USA. |
|---|
| 29 | 16 | |
|---|
| 30 | 17 | */ |
|---|
| 31 | 18 | |
|---|
| .. | .. |
|---|
| 82 | 69 | |
|---|
| 83 | 70 | static void b43legacy_phy_initg(struct b43legacy_wldev *dev); |
|---|
| 84 | 71 | |
|---|
| 85 | | - |
|---|
| 86 | | -static inline |
|---|
| 87 | | -void b43legacy_voluntary_preempt(void) |
|---|
| 88 | | -{ |
|---|
| 89 | | - B43legacy_BUG_ON(!(!in_atomic() && !in_irq() && |
|---|
| 90 | | - !in_interrupt() && !irqs_disabled())); |
|---|
| 91 | | -#ifndef CONFIG_PREEMPT |
|---|
| 92 | | - cond_resched(); |
|---|
| 93 | | -#endif /* CONFIG_PREEMPT */ |
|---|
| 94 | | -} |
|---|
| 95 | | - |
|---|
| 96 | 72 | /* Lock the PHY registers against concurrent access from the microcode. |
|---|
| 97 | 73 | * This lock is nonrecursive. */ |
|---|
| 98 | 74 | void b43legacy_phy_lock(struct b43legacy_wldev *dev) |
|---|
| .. | .. |
|---|
| 134 | 110 | void b43legacy_phy_write(struct b43legacy_wldev *dev, u16 offset, u16 val) |
|---|
| 135 | 111 | { |
|---|
| 136 | 112 | b43legacy_write16(dev, B43legacy_MMIO_PHY_CONTROL, offset); |
|---|
| 137 | | - mmiowb(); |
|---|
| 138 | 113 | b43legacy_write16(dev, B43legacy_MMIO_PHY_DATA, val); |
|---|
| 139 | 114 | } |
|---|
| 140 | 115 | |
|---|
| .. | .. |
|---|
| 154 | 129 | } |
|---|
| 155 | 130 | |
|---|
| 156 | 131 | /* initialize B PHY power control |
|---|
| 157 | | - * as described in http://bcm-specs.sipsolutions.net/InitPowerControl |
|---|
| 132 | + * as described in https://bcm-specs.sipsolutions.net/InitPowerControl |
|---|
| 158 | 133 | */ |
|---|
| 159 | 134 | static void b43legacy_phy_init_pctl(struct b43legacy_wldev *dev) |
|---|
| 160 | 135 | { |
|---|
| .. | .. |
|---|
| 1138 | 1113 | ret += b43legacy_phy_read(dev, 0x002C); |
|---|
| 1139 | 1114 | } |
|---|
| 1140 | 1115 | local_irq_restore(flags); |
|---|
| 1141 | | - b43legacy_voluntary_preempt(); |
|---|
| 1116 | + cond_resched(); |
|---|
| 1142 | 1117 | |
|---|
| 1143 | 1118 | return ret; |
|---|
| 1144 | 1119 | } |
|---|
| .. | .. |
|---|
| 1148 | 1123 | struct b43legacy_phy *phy = &dev->phy; |
|---|
| 1149 | 1124 | u16 regstack[12] = { 0 }; |
|---|
| 1150 | 1125 | u16 mls; |
|---|
| 1151 | | - u16 fval; |
|---|
| 1126 | + s16 fval; |
|---|
| 1152 | 1127 | int i; |
|---|
| 1153 | 1128 | int j; |
|---|
| 1154 | 1129 | |
|---|
| .. | .. |
|---|
| 1267 | 1242 | } |
|---|
| 1268 | 1243 | ret = b43legacy_phy_read(dev, 0x002D); |
|---|
| 1269 | 1244 | local_irq_restore(flags); |
|---|
| 1270 | | - b43legacy_voluntary_preempt(); |
|---|
| 1245 | + cond_resched(); |
|---|
| 1271 | 1246 | |
|---|
| 1272 | 1247 | return ret; |
|---|
| 1273 | 1248 | } |
|---|
| .. | .. |
|---|
| 1486 | 1461 | b43legacy_phy_write(dev, 0x0060, value); |
|---|
| 1487 | 1462 | } |
|---|
| 1488 | 1463 | |
|---|
| 1489 | | -/* http://bcm-specs.sipsolutions.net/LocalOscillator/Measure */ |
|---|
| 1464 | +/* https://bcm-specs.sipsolutions.net/LocalOscillator/Measure */ |
|---|
| 1490 | 1465 | void b43legacy_phy_lo_g_measure(struct b43legacy_wldev *dev) |
|---|
| 1491 | 1466 | { |
|---|
| 1492 | 1467 | static const u8 pairorder[10] = { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8 }; |
|---|
| .. | .. |
|---|
| 1605 | 1580 | b43legacy_radio_write16(dev, 0x43, i); |
|---|
| 1606 | 1581 | b43legacy_radio_write16(dev, 0x52, phy->txctl2); |
|---|
| 1607 | 1582 | udelay(10); |
|---|
| 1608 | | - b43legacy_voluntary_preempt(); |
|---|
| 1583 | + cond_resched(); |
|---|
| 1609 | 1584 | |
|---|
| 1610 | 1585 | b43legacy_phy_set_baseband_attenuation(dev, j * 2); |
|---|
| 1611 | 1586 | |
|---|
| .. | .. |
|---|
| 1656 | 1631 | phy->txctl2 |
|---|
| 1657 | 1632 | | (3/*txctl1*/ << 4)); |
|---|
| 1658 | 1633 | udelay(10); |
|---|
| 1659 | | - b43legacy_voluntary_preempt(); |
|---|
| 1634 | + cond_resched(); |
|---|
| 1660 | 1635 | |
|---|
| 1661 | 1636 | b43legacy_phy_set_baseband_attenuation(dev, j * 2); |
|---|
| 1662 | 1637 | |
|---|
| .. | .. |
|---|
| 1679 | 1654 | b43legacy_phy_write(dev, 0x0812, (r27 << 8) | 0xA2); |
|---|
| 1680 | 1655 | udelay(2); |
|---|
| 1681 | 1656 | b43legacy_phy_write(dev, 0x0812, (r27 << 8) | 0xA3); |
|---|
| 1682 | | - b43legacy_voluntary_preempt(); |
|---|
| 1657 | + cond_resched(); |
|---|
| 1683 | 1658 | } else |
|---|
| 1684 | 1659 | b43legacy_phy_write(dev, 0x0015, r27 | 0xEFA0); |
|---|
| 1685 | 1660 | b43legacy_phy_lo_adjust(dev, is_initializing); |
|---|
| .. | .. |
|---|
| 1746 | 1721 | } |
|---|
| 1747 | 1722 | } |
|---|
| 1748 | 1723 | |
|---|
| 1749 | | -/* http://bcm-specs.sipsolutions.net/EstimatePowerOut |
|---|
| 1724 | +/* https://bcm-specs.sipsolutions.net/EstimatePowerOut |
|---|
| 1750 | 1725 | * This function converts a TSSI value to dBm in Q5.2 |
|---|
| 1751 | 1726 | */ |
|---|
| 1752 | 1727 | static s8 b43legacy_phy_estimate_power_out(struct b43legacy_wldev *dev, s8 tssi) |
|---|
| .. | .. |
|---|
| 1772 | 1747 | return dbm; |
|---|
| 1773 | 1748 | } |
|---|
| 1774 | 1749 | |
|---|
| 1775 | | -/* http://bcm-specs.sipsolutions.net/RecalculateTransmissionPower */ |
|---|
| 1750 | +/* https://bcm-specs.sipsolutions.net/RecalculateTransmissionPower */ |
|---|
| 1776 | 1751 | void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev) |
|---|
| 1777 | 1752 | { |
|---|
| 1778 | 1753 | struct b43legacy_phy *phy = &dev->phy; |
|---|