diff options
author | Landon J. Fuller <landonf@FreeBSD.org> | 2017-12-02 02:21:27 +0000 |
---|---|---|
committer | Landon J. Fuller <landonf@FreeBSD.org> | 2017-12-02 02:21:27 +0000 |
commit | 8d14ca9c99f8c0a1952e13f59476cea65a33b4d5 (patch) | |
tree | cdd6d3da1fca9a908ab1748b3f7065b317ec5c4e /sys/gnu/dev | |
parent | 89c3a53299967f90ef27a41d16379aa683c56743 (diff) |
Introduce bwn(4) support for the bhnd(4) bus.
Currently, bwn(4) relies on the siba_bwn(4) bus driver to provide support
for the on-chip SSB interconnect found in Broadcom's older PCI(e) Wi-Fi
adapters. Non-PCI Wi-Fi adapters, as well as the newer BCMA interconnect
found in post-2009 Broadcom Wi-Fi hardware, are not supported by
siba_bwn(4).
The bhnd(4) bus driver (also used by the FreeBSD/MIPS Broadcom port)
provides a unified kernel interface to a superset of the hardware supported
by siba_bwn; by attaching bwn(4) via bhnd(4), we can support both modern
PCI(e) Wi-Fi devices based on the BCMA backplane interconnect, as well as
Broadcom MIPS WiSoCs that include a D11 MAC core directly attached to their
SSB or BCMA backplane.
This diff introduces opt-in bwn(4) support for bhnd(4) by providing:
- A small bwn(4) driver subclass, if_bwn_bhnd, that attaches via
bhnd(4) instead of siba_bwn(4).
- A bhndb(4)-based PCI host bridge driver, if_bwn_pci, that optionally
probes at a higher priority than the siba_bwn(4) PCI driver.
- A set of compatibility shims that perform translation of bwn(4)'s
siba_bwn function calls into their bhnd(9) API equivalents when bwn(4)
is attached via a bhnd(4) bus parent. When bwn(4) is attached via
siba_bwn(4), all siba_bwn function calls are simply passed through to
their original implementations.
To test bwn(4) with bhnd(4), place the following lines in loader.conf(5):
hw.bwn_pci.preferred="1"
if_bwn_pci_load="YES
bwn_v4_ucode_load="YES"
bwn_v4_lp_ucode_load="YES"
To verify that bwn(4) is using bhnd(4), you can check dmesg:
bwn0: <Broadcom 802.11 MAC/PHY/Radio, rev 15> ... on bhnd0
... or devinfo(8):
pcib2
pci2
bwn_pci0
bhndb0
bhnd0
bwn0
...
bwn(4)/bhnd(4) has been tested for regressions with most chipsets currently
supported by bwn(4), including:
- BCM4312
- BCM4318
- BCM4321
With minimal changes to the DMA code (not included in this commit), I was
also able to test support for newer BCMA devices by bringing up basic
working Wi-Fi on two previously unsupported, BCMA-based N-PHY chipsets:
- BCM43224
- BCM43225
Approved by: adrian (mentor, implicit)
Sponsored by: The FreeBSD Foundation & Plausible Labs
Differential Revision: https://reviews.freebsd.org/D13041
Notes
Notes:
svn path=/head/; revision=326454
Diffstat (limited to 'sys/gnu/dev')
-rw-r--r-- | sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c | 23 | ||||
-rw-r--r-- | sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c | 3 | ||||
-rw-r--r-- | sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c | 3 | ||||
-rw-r--r-- | sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c | 3 | ||||
-rw-r--r-- | sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c | 3 | ||||
-rw-r--r-- | sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c | 3 |
6 files changed, 5 insertions, 33 deletions
diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c index cfc3104993e6..0e1291ea39b3 100644 --- a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c +++ b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c @@ -62,9 +62,6 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcivar.h> #include <dev/pci/pcireg.h> -#include <dev/siba/siba_ids.h> -#include <dev/siba/sibareg.h> -#include <dev/siba/sibavar.h> #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_radiotap.h> @@ -6138,10 +6135,7 @@ static void bwn_nphy_superswitch_init(struct bwn_mac *mac, bool init) BWN_PHY_WRITE(mac, BWN_NPHY_GPIO_LOOEN, 0); BWN_PHY_WRITE(mac, BWN_NPHY_GPIO_HIOEN, 0); - /* XXX handle bhnd bus */ - if (bwn_is_bus_siba(mac)) { - siba_gpio_set(sc->sc_dev, 0xfc00); - } + siba_gpio_set(sc->sc_dev, 0xfc00); BWN_WRITE_SETMASK4(mac, BWN_MACCTL, ~BWN_MACCTL_GPOUT_MASK, 0); BWN_WRITE_SETMASK2(mac, BWN_GPIO_MASK, ~0, 0xFC00); @@ -6175,10 +6169,7 @@ static int bwn_phy_initn(struct bwn_mac *mac) if ((mac->mac_phy.rev >= 3) && (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA) && (bwn_current_band(mac) == BWN_BAND_2G)) { - /* XXX bhnd bus */ - if (bwn_is_bus_siba(mac)) { - siba_cc_set32(sc->sc_dev, SIBA_CC_CHIPCTL, 0x40); - } + siba_cc_set32(sc->sc_dev, SIBA_CC_CHIPCTL, 0x40); } nphy->use_int_tx_iq_lo_cal = bwn_nphy_ipa(mac) || phy->rev >= 7 || @@ -6380,11 +6371,8 @@ static void bwn_nphy_pmu_spur_avoid(struct bwn_mac *mac, bool avoid) { struct bwn_softc *sc = mac->mac_sc; - /* XXX bhnd */ - if (bwn_is_bus_siba(mac)) { - DPRINTF(sc, BWN_DEBUG_RESET, "%s: spuravoid %d\n", __func__, avoid); - siba_pmu_spuravoid_pllupdate(sc->sc_dev, avoid); - } + DPRINTF(sc, BWN_DEBUG_RESET, "%s: spuravoid %d\n", __func__, avoid); + siba_pmu_spuravoid_pllupdate(sc->sc_dev, avoid); } /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */ @@ -6635,8 +6623,7 @@ bwn_nphy_op_prepare_structs(struct bwn_mac *mac) if (mac->mac_phy.rev >= 2 && (siba_sprom_get_bf2_lo(sc->sc_dev) & BWN_BFL2_TXPWRCTRL_EN)) { nphy->txpwrctrl = true; - if (bwn_is_bus_siba(mac) && - (siba_get_type(sc->sc_dev) == SIBA_TYPE_PCI)) { + if (siba_get_type(sc->sc_dev) == SIBA_TYPE_PCI) { if ((siba_get_pci_device(sc->sc_dev) == 0x4328) || (siba_get_pci_device(sc->sc_dev) == 0x432a)) nphy->pwg_gain_5ghz = true; diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c index 5545031656fe..d62911b51511 100644 --- a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c +++ b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c @@ -60,9 +60,6 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcivar.h> #include <dev/pci/pcireg.h> -#include <dev/siba/siba_ids.h> -#include <dev/siba/sibareg.h> -#include <dev/siba/sibavar.h> #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_radiotap.h> diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c index 883989b588c3..2a3725caa632 100644 --- a/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c +++ b/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_tables.c @@ -61,9 +61,6 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcivar.h> #include <dev/pci/pcireg.h> -#include <dev/siba/siba_ids.h> -#include <dev/siba/sibareg.h> -#include <dev/siba/sibavar.h> #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_radiotap.h> diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c b/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c index f22ed1a3d70c..57e912bdf3c4 100644 --- a/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c +++ b/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2055.c @@ -61,9 +61,6 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcivar.h> #include <dev/pci/pcireg.h> -#include <dev/siba/siba_ids.h> -#include <dev/siba/sibareg.h> -#include <dev/siba/sibavar.h> #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_radiotap.h> diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c b/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c index cbb6d9191dca..7407226ea2d9 100644 --- a/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c +++ b/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2056.c @@ -62,9 +62,6 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcivar.h> #include <dev/pci/pcireg.h> -#include <dev/siba/siba_ids.h> -#include <dev/siba/sibareg.h> -#include <dev/siba/sibavar.h> #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_radiotap.h> diff --git a/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c b/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c index 156514f7266c..f9c608dbfa75 100644 --- a/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c +++ b/sys/gnu/dev/bwn/phy_n/if_bwn_radio_2057.c @@ -62,9 +62,6 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcivar.h> #include <dev/pci/pcireg.h> -#include <dev/siba/siba_ids.h> -#include <dev/siba/sibareg.h> -#include <dev/siba/sibavar.h> #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_radiotap.h> |