Changeset View
Changeset View
Standalone View
Standalone View
sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
#include <net/if_arp.h> | #include <net/if_arp.h> | ||||
#include <net/if_dl.h> | #include <net/if_dl.h> | ||||
#include <net/if_llc.h> | #include <net/if_llc.h> | ||||
#include <net/if_media.h> | #include <net/if_media.h> | ||||
#include <net/if_types.h> | #include <net/if_types.h> | ||||
#include <dev/pci/pcivar.h> | #include <dev/pci/pcivar.h> | ||||
#include <dev/pci/pcireg.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_var.h> | ||||
#include <net80211/ieee80211_radiotap.h> | #include <net80211/ieee80211_radiotap.h> | ||||
#include <net80211/ieee80211_regdomain.h> | #include <net80211/ieee80211_regdomain.h> | ||||
#include <net80211/ieee80211_phy.h> | #include <net80211/ieee80211_phy.h> | ||||
#include <net80211/ieee80211_ratectl.h> | #include <net80211/ieee80211_ratectl.h> | ||||
#include <dev/bwn/if_bwnreg.h> | #include <dev/bwn/if_bwnreg.h> | ||||
▲ Show 20 Lines • Show All 6,057 Lines • ▼ Show 20 Lines | if (0 /* FIXME */) { | ||||
bwn_ntab_write(mac, BWN_NTAB16(9, 3), 0x222); | bwn_ntab_write(mac, BWN_NTAB16(9, 3), 0x222); | ||||
bwn_ntab_write(mac, BWN_NTAB16(9, 8), 0x144); | bwn_ntab_write(mac, BWN_NTAB16(9, 8), 0x144); | ||||
bwn_ntab_write(mac, BWN_NTAB16(9, 12), 0x188); | bwn_ntab_write(mac, BWN_NTAB16(9, 12), 0x188); | ||||
} | } | ||||
} else { | } else { | ||||
BWN_PHY_WRITE(mac, BWN_NPHY_GPIO_LOOEN, 0); | BWN_PHY_WRITE(mac, BWN_NPHY_GPIO_LOOEN, 0); | ||||
BWN_PHY_WRITE(mac, BWN_NPHY_GPIO_HIOEN, 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_SETMASK4(mac, BWN_MACCTL, ~BWN_MACCTL_GPOUT_MASK, 0); | ||||
BWN_WRITE_SETMASK2(mac, BWN_GPIO_MASK, ~0, 0xFC00); | BWN_WRITE_SETMASK2(mac, BWN_GPIO_MASK, ~0, 0xFC00); | ||||
BWN_WRITE_SETMASK2(mac, BWN_GPIO_CONTROL, (~0xFC00 & 0xFFFF), | BWN_WRITE_SETMASK2(mac, BWN_GPIO_CONTROL, (~0xFC00 & 0xFFFF), | ||||
0); | 0); | ||||
if (init) { | if (init) { | ||||
BWN_PHY_WRITE(mac, BWN_NPHY_RFCTL_LUT_TRSW_LO1, 0x2D8); | BWN_PHY_WRITE(mac, BWN_NPHY_RFCTL_LUT_TRSW_LO1, 0x2D8); | ||||
Show All 17 Lines | static int bwn_phy_initn(struct bwn_mac *mac) | ||||
bool do_rssi_cal; | bool do_rssi_cal; | ||||
uint16_t clip[2]; | uint16_t clip[2]; | ||||
bool do_cal = false; | bool do_cal = false; | ||||
if ((mac->mac_phy.rev >= 3) && | if ((mac->mac_phy.rev >= 3) && | ||||
(siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA) && | (siba_sprom_get_bf_lo(sc->sc_dev) & BWN_BFL_EXTLNA) && | ||||
(bwn_current_band(mac) == BWN_BAND_2G)) { | (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) || | nphy->use_int_tx_iq_lo_cal = bwn_nphy_ipa(mac) || | ||||
phy->rev >= 7 || | phy->rev >= 7 || | ||||
(phy->rev >= 5 && | (phy->rev >= 5 && | ||||
siba_sprom_get_bf2_hi(sc->sc_dev) & BWN_BFH2_INTERNDET_TXIQCAL); | siba_sprom_get_bf2_hi(sc->sc_dev) & BWN_BFH2_INTERNDET_TXIQCAL); | ||||
nphy->deaf_count = 0; | nphy->deaf_count = 0; | ||||
bwn_nphy_tables_init(mac); | bwn_nphy_tables_init(mac); | ||||
nphy->crsminpwr_adjusted = false; | nphy->crsminpwr_adjusted = false; | ||||
nphy->noisevars_adjusted = false; | nphy->noisevars_adjusted = false; | ||||
▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | static void bwn_chantab_phy_upload(struct bwn_mac *mac, | ||||
BWN_PHY_WRITE(mac, BWN_NPHY_BW6, e->phy_bw6); | BWN_PHY_WRITE(mac, BWN_NPHY_BW6, e->phy_bw6); | ||||
} | } | ||||
/* http://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */ | /* http://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */ | ||||
static void bwn_nphy_pmu_spur_avoid(struct bwn_mac *mac, bool avoid) | static void bwn_nphy_pmu_spur_avoid(struct bwn_mac *mac, bool avoid) | ||||
{ | { | ||||
struct bwn_softc *sc = mac->mac_sc; | 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); | DPRINTF(sc, BWN_DEBUG_RESET, "%s: spuravoid %d\n", __func__, avoid); | ||||
siba_pmu_spuravoid_pllupdate(sc->sc_dev, avoid); | siba_pmu_spuravoid_pllupdate(sc->sc_dev, avoid); | ||||
} | } | ||||
} | |||||
/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */ | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */ | ||||
static void bwn_nphy_channel_setup(struct bwn_mac *mac, | static void bwn_nphy_channel_setup(struct bwn_mac *mac, | ||||
const struct bwn_phy_n_sfo_cfg *e, | const struct bwn_phy_n_sfo_cfg *e, | ||||
struct ieee80211_channel *new_channel) | struct ieee80211_channel *new_channel) | ||||
{ | { | ||||
struct bwn_softc *sc = mac->mac_sc; | struct bwn_softc *sc = mac->mac_sc; | ||||
struct bwn_phy *phy = &mac->mac_phy; | struct bwn_phy *phy = &mac->mac_phy; | ||||
▲ Show 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | if (mac->mac_phy.rev >= 3 || | ||||
(siba_get_pci_subvendor(sc->sc_dev) == PCI_VENDOR_APPLE && | (siba_get_pci_subvendor(sc->sc_dev) == PCI_VENDOR_APPLE && | ||||
(siba_get_revid(sc->sc_dev) == 11 || siba_get_revid(sc->sc_dev) == 12))) { | (siba_get_revid(sc->sc_dev) == 11 || siba_get_revid(sc->sc_dev) == 12))) { | ||||
nphy->txpwrctrl = true; | nphy->txpwrctrl = true; | ||||
nphy->pwg_gain_5ghz = true; | nphy->pwg_gain_5ghz = true; | ||||
} else if (siba_sprom_get_rev(sc->sc_dev) >= 4) { | } else if (siba_sprom_get_rev(sc->sc_dev) >= 4) { | ||||
if (mac->mac_phy.rev >= 2 && | if (mac->mac_phy.rev >= 2 && | ||||
(siba_sprom_get_bf2_lo(sc->sc_dev) & BWN_BFL2_TXPWRCTRL_EN)) { | (siba_sprom_get_bf2_lo(sc->sc_dev) & BWN_BFL2_TXPWRCTRL_EN)) { | ||||
nphy->txpwrctrl = true; | nphy->txpwrctrl = true; | ||||
if (bwn_is_bus_siba(mac) && | if (siba_get_type(sc->sc_dev) == SIBA_TYPE_PCI) { | ||||
(siba_get_type(sc->sc_dev) == SIBA_TYPE_PCI)) { | |||||
if ((siba_get_pci_device(sc->sc_dev) == 0x4328) || | if ((siba_get_pci_device(sc->sc_dev) == 0x4328) || | ||||
(siba_get_pci_device(sc->sc_dev) == 0x432a)) | (siba_get_pci_device(sc->sc_dev) == 0x432a)) | ||||
nphy->pwg_gain_5ghz = true; | nphy->pwg_gain_5ghz = true; | ||||
} | } | ||||
} else if (siba_sprom_get_bf2_lo(sc->sc_dev) & BWN_BFL2_5G_PWRGAIN) { | } else if (siba_sprom_get_bf2_lo(sc->sc_dev) & BWN_BFL2_5G_PWRGAIN) { | ||||
nphy->pwg_gain_5ghz = true; | nphy->pwg_gain_5ghz = true; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines |