| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | |
|---|
| 3 | 4 | Broadcom B43 wireless driver |
|---|
| .. | .. |
|---|
| 15 | 16 | Some parts of the code in this file are derived from the ipw2200 |
|---|
| 16 | 17 | driver Copyright(c) 2003 - 2004 Intel Corporation. |
|---|
| 17 | 18 | |
|---|
| 18 | | - This program is free software; you can redistribute it and/or modify |
|---|
| 19 | | - it under the terms of the GNU General Public License as published by |
|---|
| 20 | | - the Free Software Foundation; either version 2 of the License, or |
|---|
| 21 | | - (at your option) any later version. |
|---|
| 22 | | - |
|---|
| 23 | | - This program is distributed in the hope that it will be useful, |
|---|
| 24 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 25 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 26 | | - GNU General Public License for more details. |
|---|
| 27 | | - |
|---|
| 28 | | - You should have received a copy of the GNU General Public License |
|---|
| 29 | | - along with this program; see the file COPYING. If not, write to |
|---|
| 30 | | - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, |
|---|
| 31 | | - Boston, MA 02110-1301, USA. |
|---|
| 32 | 19 | |
|---|
| 33 | 20 | */ |
|---|
| 34 | 21 | |
|---|
| .. | .. |
|---|
| 485 | 472 | val = swab32(val); |
|---|
| 486 | 473 | |
|---|
| 487 | 474 | b43_write32(dev, B43_MMIO_RAM_CONTROL, offset); |
|---|
| 488 | | - mmiowb(); |
|---|
| 489 | 475 | b43_write32(dev, B43_MMIO_RAM_DATA, val); |
|---|
| 490 | 476 | } |
|---|
| 491 | 477 | |
|---|
| .. | .. |
|---|
| 656 | 642 | /* The hardware guarantees us an atomic write, if we |
|---|
| 657 | 643 | * write the low register first. */ |
|---|
| 658 | 644 | b43_write32(dev, B43_MMIO_REV3PLUS_TSF_LOW, low); |
|---|
| 659 | | - mmiowb(); |
|---|
| 660 | 645 | b43_write32(dev, B43_MMIO_REV3PLUS_TSF_HIGH, high); |
|---|
| 661 | | - mmiowb(); |
|---|
| 662 | 646 | } |
|---|
| 663 | 647 | |
|---|
| 664 | 648 | void b43_tsf_write(struct b43_wldev *dev, u64 tsf) |
|---|
| .. | .. |
|---|
| 750 | 734 | } |
|---|
| 751 | 735 | |
|---|
| 752 | 736 | /* DummyTransmission function, as documented on |
|---|
| 753 | | - * http://bcm-v4.sipsolutions.net/802.11/DummyTransmission |
|---|
| 737 | + * https://bcm-v4.sipsolutions.net/802.11/DummyTransmission |
|---|
| 754 | 738 | */ |
|---|
| 755 | 739 | void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on) |
|---|
| 756 | 740 | { |
|---|
| .. | .. |
|---|
| 797 | 781 | b43_write16(dev, B43_MMIO_XMTSEL, 0x0826); |
|---|
| 798 | 782 | b43_write16(dev, B43_MMIO_TXE0_CTL, 0x0000); |
|---|
| 799 | 783 | |
|---|
| 800 | | - if (!pa_on && phy->type == B43_PHYTYPE_N) |
|---|
| 784 | + if (!pa_on && phy->type == B43_PHYTYPE_N) { |
|---|
| 801 | 785 | ; /*b43_nphy_pa_override(dev, false) */ |
|---|
| 786 | + } |
|---|
| 802 | 787 | |
|---|
| 803 | 788 | switch (phy->type) { |
|---|
| 804 | 789 | case B43_PHYTYPE_N: |
|---|
| .. | .. |
|---|
| 1214 | 1199 | } |
|---|
| 1215 | 1200 | } |
|---|
| 1216 | 1201 | |
|---|
| 1217 | | -/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacCorePllReset */ |
|---|
| 1202 | +/* https://bcm-v4.sipsolutions.net/802.11/PHY/BmacCorePllReset */ |
|---|
| 1218 | 1203 | void b43_wireless_core_phy_pll_reset(struct b43_wldev *dev) |
|---|
| 1219 | 1204 | { |
|---|
| 1220 | 1205 | struct bcma_drv_cc *bcma_cc __maybe_unused; |
|---|
| .. | .. |
|---|
| 1822 | 1807 | if (b43_bus_host_is_sdio(dev->dev)) { |
|---|
| 1823 | 1808 | /* wl->mutex is enough. */ |
|---|
| 1824 | 1809 | b43_do_beacon_update_trigger_work(dev); |
|---|
| 1825 | | - mmiowb(); |
|---|
| 1826 | 1810 | } else { |
|---|
| 1827 | 1811 | spin_lock_irq(&wl->hardirq_lock); |
|---|
| 1828 | 1812 | b43_do_beacon_update_trigger_work(dev); |
|---|
| 1829 | | - mmiowb(); |
|---|
| 1830 | 1813 | spin_unlock_irq(&wl->hardirq_lock); |
|---|
| 1831 | 1814 | } |
|---|
| 1832 | 1815 | } |
|---|
| .. | .. |
|---|
| 1891 | 1874 | switch (reason) { |
|---|
| 1892 | 1875 | default: |
|---|
| 1893 | 1876 | b43dbg(dev->wl, "The panic reason is unknown.\n"); |
|---|
| 1894 | | - /* fallthrough */ |
|---|
| 1877 | + fallthrough; |
|---|
| 1895 | 1878 | case B43_FWPANIC_DIE: |
|---|
| 1896 | 1879 | /* Do not restart the controller or firmware. |
|---|
| 1897 | 1880 | * The device is nonfunctional from now on. |
|---|
| .. | .. |
|---|
| 2031 | 2014 | handle_irq_beacon(dev); |
|---|
| 2032 | 2015 | if (reason & B43_IRQ_PMQ) |
|---|
| 2033 | 2016 | handle_irq_pmq(dev); |
|---|
| 2034 | | - if (reason & B43_IRQ_TXFIFO_FLUSH_OK) |
|---|
| 2017 | + if (reason & B43_IRQ_TXFIFO_FLUSH_OK) { |
|---|
| 2035 | 2018 | ;/* TODO */ |
|---|
| 2019 | + } |
|---|
| 2036 | 2020 | if (reason & B43_IRQ_NOISESAMPLE_OK) |
|---|
| 2037 | 2021 | handle_irq_noise(dev); |
|---|
| 2038 | 2022 | |
|---|
| .. | .. |
|---|
| 2078 | 2062 | |
|---|
| 2079 | 2063 | mutex_lock(&dev->wl->mutex); |
|---|
| 2080 | 2064 | b43_do_interrupt_thread(dev); |
|---|
| 2081 | | - mmiowb(); |
|---|
| 2082 | 2065 | mutex_unlock(&dev->wl->mutex); |
|---|
| 2083 | 2066 | |
|---|
| 2084 | 2067 | return IRQ_HANDLED; |
|---|
| .. | .. |
|---|
| 2143 | 2126 | |
|---|
| 2144 | 2127 | spin_lock(&dev->wl->hardirq_lock); |
|---|
| 2145 | 2128 | ret = b43_do_interrupt(dev); |
|---|
| 2146 | | - mmiowb(); |
|---|
| 2147 | 2129 | spin_unlock(&dev->wl->hardirq_lock); |
|---|
| 2148 | 2130 | |
|---|
| 2149 | 2131 | return ret; |
|---|
| .. | .. |
|---|
| 2184 | 2166 | { |
|---|
| 2185 | 2167 | const char text[] = |
|---|
| 2186 | 2168 | "You must go to " \ |
|---|
| 2187 | | - "http://wireless.kernel.org/en/users/Drivers/b43#devicefirmware " \ |
|---|
| 2169 | + "https://wireless.wiki.kernel.org/en/users/Drivers/b43#devicefirmware " \ |
|---|
| 2188 | 2170 | "and download the correct firmware for this driver version. " \ |
|---|
| 2189 | 2171 | "Please carefully read all instructions on this website.\n"; |
|---|
| 2190 | 2172 | |
|---|
| .. | .. |
|---|
| 2286 | 2268 | size = be32_to_cpu(hdr->size); |
|---|
| 2287 | 2269 | if (size != ctx->blob->size - sizeof(struct b43_fw_header)) |
|---|
| 2288 | 2270 | goto err_format; |
|---|
| 2289 | | - /* fallthrough */ |
|---|
| 2271 | + fallthrough; |
|---|
| 2290 | 2272 | case B43_FW_TYPE_IV: |
|---|
| 2291 | 2273 | if (hdr->ver != 1) |
|---|
| 2292 | 2274 | goto err_format; |
|---|
| .. | .. |
|---|
| 2310 | 2292 | return -EPROTO; |
|---|
| 2311 | 2293 | } |
|---|
| 2312 | 2294 | |
|---|
| 2313 | | -/* http://bcm-v4.sipsolutions.net/802.11/Init/Firmware */ |
|---|
| 2295 | +/* https://bcm-v4.sipsolutions.net/802.11/Init/Firmware */ |
|---|
| 2314 | 2296 | static int b43_try_request_fw(struct b43_request_fw_context *ctx) |
|---|
| 2315 | 2297 | { |
|---|
| 2316 | 2298 | struct b43_wldev *dev = ctx->dev; |
|---|
| .. | .. |
|---|
| 2610 | 2592 | |
|---|
| 2611 | 2593 | err = ieee80211_register_hw(wl->hw); |
|---|
| 2612 | 2594 | if (err) |
|---|
| 2613 | | - goto err_one_core_detach; |
|---|
| 2614 | | - wl->hw_registred = true; |
|---|
| 2595 | + goto out; |
|---|
| 2596 | + wl->hw_registered = true; |
|---|
| 2615 | 2597 | b43_leds_register(wl->current_dev); |
|---|
| 2616 | 2598 | |
|---|
| 2617 | 2599 | /* Register HW RNG driver */ |
|---|
| 2618 | 2600 | b43_rng_init(wl); |
|---|
| 2619 | | - |
|---|
| 2620 | | - goto out; |
|---|
| 2621 | | - |
|---|
| 2622 | | -err_one_core_detach: |
|---|
| 2623 | | - b43_one_core_detach(dev->dev); |
|---|
| 2624 | 2601 | |
|---|
| 2625 | 2602 | out: |
|---|
| 2626 | 2603 | kfree(ctx); |
|---|
| .. | .. |
|---|
| 2868 | 2845 | } |
|---|
| 2869 | 2846 | |
|---|
| 2870 | 2847 | /* Initialize the GPIOs |
|---|
| 2871 | | - * http://bcm-specs.sipsolutions.net/GPIO |
|---|
| 2848 | + * https://bcm-specs.sipsolutions.net/GPIO |
|---|
| 2872 | 2849 | */ |
|---|
| 2873 | 2850 | |
|---|
| 2874 | 2851 | #ifdef CONFIG_B43_SSB |
|---|
| .. | .. |
|---|
| 2996 | 2973 | } |
|---|
| 2997 | 2974 | } |
|---|
| 2998 | 2975 | |
|---|
| 2999 | | -/* http://bcm-specs.sipsolutions.net/SuspendMAC */ |
|---|
| 2976 | +/* https://bcm-specs.sipsolutions.net/SuspendMAC */ |
|---|
| 3000 | 2977 | void b43_mac_suspend(struct b43_wldev *dev) |
|---|
| 3001 | 2978 | { |
|---|
| 3002 | 2979 | int i; |
|---|
| .. | .. |
|---|
| 3029 | 3006 | dev->mac_suspended++; |
|---|
| 3030 | 3007 | } |
|---|
| 3031 | 3008 | |
|---|
| 3032 | | -/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */ |
|---|
| 3009 | +/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/MacPhyClkSet */ |
|---|
| 3033 | 3010 | void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on) |
|---|
| 3034 | 3011 | { |
|---|
| 3035 | 3012 | u32 tmp; |
|---|
| .. | .. |
|---|
| 3203 | 3180 | b43_rate_memory_write(dev, B43_OFDM_RATE_36MB, 1); |
|---|
| 3204 | 3181 | b43_rate_memory_write(dev, B43_OFDM_RATE_48MB, 1); |
|---|
| 3205 | 3182 | b43_rate_memory_write(dev, B43_OFDM_RATE_54MB, 1); |
|---|
| 3206 | | - /* fallthrough */ |
|---|
| 3183 | + fallthrough; |
|---|
| 3207 | 3184 | case B43_PHYTYPE_B: |
|---|
| 3208 | 3185 | b43_rate_memory_write(dev, B43_CCK_RATE_1MB, 0); |
|---|
| 3209 | 3186 | b43_rate_memory_write(dev, B43_CCK_RATE_2MB, 0); |
|---|
| .. | .. |
|---|
| 3256 | 3233 | } |
|---|
| 3257 | 3234 | |
|---|
| 3258 | 3235 | /* Initialize the chip |
|---|
| 3259 | | - * http://bcm-specs.sipsolutions.net/ChipInit |
|---|
| 3236 | + * https://bcm-specs.sipsolutions.net/ChipInit |
|---|
| 3260 | 3237 | */ |
|---|
| 3261 | 3238 | static int b43_chip_init(struct b43_wldev *dev) |
|---|
| 3262 | 3239 | { |
|---|
| .. | .. |
|---|
| 3625 | 3602 | else |
|---|
| 3626 | 3603 | err = b43_dma_tx(dev, skb); |
|---|
| 3627 | 3604 | if (err == -ENOSPC) { |
|---|
| 3628 | | - wl->tx_queue_stopped[queue_num] = 1; |
|---|
| 3605 | + wl->tx_queue_stopped[queue_num] = true; |
|---|
| 3629 | 3606 | ieee80211_stop_queue(wl->hw, queue_num); |
|---|
| 3630 | 3607 | skb_queue_head(&wl->tx_queue[queue_num], skb); |
|---|
| 3631 | 3608 | break; |
|---|
| .. | .. |
|---|
| 3636 | 3613 | } |
|---|
| 3637 | 3614 | |
|---|
| 3638 | 3615 | if (!err) |
|---|
| 3639 | | - wl->tx_queue_stopped[queue_num] = 0; |
|---|
| 3616 | + wl->tx_queue_stopped[queue_num] = false; |
|---|
| 3640 | 3617 | } |
|---|
| 3641 | 3618 | |
|---|
| 3642 | 3619 | #if B43_DEBUG |
|---|
| .. | .. |
|---|
| 5354 | 5331 | /* There are 14e4:4321 PCI devs with 2.4 GHz BCM4321 (N-PHY) */ |
|---|
| 5355 | 5332 | if (dev->phy.type != B43_PHYTYPE_G) |
|---|
| 5356 | 5333 | break; |
|---|
| 5357 | | - /* fall through */ |
|---|
| 5334 | + fallthrough; |
|---|
| 5358 | 5335 | case 0x4313: /* BCM4311 */ |
|---|
| 5359 | 5336 | case 0x431a: /* BCM4318 */ |
|---|
| 5360 | 5337 | case 0x432a: /* BCM4321 */ |
|---|
| .. | .. |
|---|
| 5493 | 5470 | static void b43_one_core_detach(struct b43_bus_dev *dev) |
|---|
| 5494 | 5471 | { |
|---|
| 5495 | 5472 | struct b43_wldev *wldev; |
|---|
| 5496 | | - struct b43_wl *wl; |
|---|
| 5497 | 5473 | |
|---|
| 5498 | 5474 | /* Do not cancel ieee80211-workqueue based work here. |
|---|
| 5499 | 5475 | * See comment in b43_remove(). */ |
|---|
| 5500 | 5476 | |
|---|
| 5501 | 5477 | wldev = b43_bus_get_wldev(dev); |
|---|
| 5502 | | - wl = wldev->wl; |
|---|
| 5503 | 5478 | b43_debugfs_remove_device(wldev); |
|---|
| 5504 | 5479 | b43_wireless_core_detach(wldev); |
|---|
| 5505 | 5480 | list_del(&wldev->list); |
|---|
| .. | .. |
|---|
| 5610 | 5585 | |
|---|
| 5611 | 5586 | wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); |
|---|
| 5612 | 5587 | |
|---|
| 5613 | | - wl->hw_registred = false; |
|---|
| 5588 | + wl->hw_registered = false; |
|---|
| 5614 | 5589 | hw->max_rates = 2; |
|---|
| 5615 | 5590 | SET_IEEE80211_DEV(hw, dev->dev); |
|---|
| 5616 | 5591 | if (is_valid_ether_addr(sprom->et1mac)) |
|---|
| .. | .. |
|---|
| 5630 | 5605 | /* Initialize queues and flags. */ |
|---|
| 5631 | 5606 | for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) { |
|---|
| 5632 | 5607 | skb_queue_head_init(&wl->tx_queue[queue_num]); |
|---|
| 5633 | | - wl->tx_queue_stopped[queue_num] = 0; |
|---|
| 5608 | + wl->tx_queue_stopped[queue_num] = false; |
|---|
| 5634 | 5609 | } |
|---|
| 5635 | 5610 | |
|---|
| 5636 | 5611 | snprintf(chip_name, ARRAY_SIZE(chip_name), |
|---|
| .. | .. |
|---|
| 5693 | 5668 | B43_WARN_ON(!wl); |
|---|
| 5694 | 5669 | if (!wldev->fw.ucode.data) |
|---|
| 5695 | 5670 | return; /* NULL if firmware never loaded */ |
|---|
| 5696 | | - if (wl->current_dev == wldev && wl->hw_registred) { |
|---|
| 5671 | + if (wl->current_dev == wldev && wl->hw_registered) { |
|---|
| 5697 | 5672 | b43_leds_stop(wldev); |
|---|
| 5698 | 5673 | ieee80211_unregister_hw(wl->hw); |
|---|
| 5699 | 5674 | } |
|---|
| .. | .. |
|---|
| 5776 | 5751 | B43_WARN_ON(!wl); |
|---|
| 5777 | 5752 | if (!wldev->fw.ucode.data) |
|---|
| 5778 | 5753 | return; /* NULL if firmware never loaded */ |
|---|
| 5779 | | - if (wl->current_dev == wldev && wl->hw_registred) { |
|---|
| 5754 | + if (wl->current_dev == wldev && wl->hw_registered) { |
|---|
| 5780 | 5755 | b43_leds_stop(wldev); |
|---|
| 5781 | 5756 | ieee80211_unregister_hw(wl->hw); |
|---|
| 5782 | 5757 | } |
|---|