svn commit: r300563 - head/sys/dev/bwn
Adrian Chadd
adrian at FreeBSD.org
Tue May 24 04:59:03 UTC 2016
Author: adrian
Date: Tue May 24 04:58:58 2016
New Revision: 300563
URL: https://svnweb.freebsd.org/changeset/base/300563
Log:
[bwn] begin separating out the attach path from the SIBA specific bits.
* convert phy_getinfo() to take a "gmode" flag, rather than the siba
TGSHIGH flags and then check for 2GHz. This should ensure that
gmode is set correctly even on DUALPHY NICs.
* move the siba_powerup() call and the TGSHIGH decoding into a
call to bwn_is_bus_siba(), and return an error if it's called
on anything else. We don't yet do anything else, but when we do..
Tested:
* BCM4322, 11a STA
Modified:
head/sys/dev/bwn/if_bwn.c
Modified: head/sys/dev/bwn/if_bwn.c
==============================================================================
--- head/sys/dev/bwn/if_bwn.c Tue May 24 04:55:00 2016 (r300562)
+++ head/sys/dev/bwn/if_bwn.c Tue May 24 04:58:58 2016 (r300563)
@@ -1148,46 +1148,41 @@ bwn_attach_core(struct bwn_mac *mac)
{
struct bwn_softc *sc = mac->mac_sc;
int error, have_bg = 0, have_a = 0;
- uint32_t high;
KASSERT(siba_get_revid(sc->sc_dev) >= 5,
("unsupported revision %d", siba_get_revid(sc->sc_dev)));
- siba_powerup(sc->sc_dev, 0);
+ if (bwn_is_bus_siba(mac)) {
+ uint32_t high;
- high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH);
+ siba_powerup(sc->sc_dev, 0);
+ high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH);
+ have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0;
+ have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0;
+ if (high & BWN_TGSHIGH_DUALPHY) {
+ have_bg = 1;
+ have_a = 1;
+ }
+ } else {
+ device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__);
+ error = ENXIO;
+ goto fail;
+ }
/*
* Guess at whether it has A-PHY or G-PHY.
* This is just used for resetting the core to probe things;
* we will re-guess once it's all up and working.
- *
- * XXX TODO: there's the TGSHIGH DUALPHY flag based on
- * the PHY revision.
*/
- bwn_reset_core(mac, !!(high & BWN_TGSHIGH_HAVE_2GHZ));
+ bwn_reset_core(mac, have_bg);
/*
* Get the PHY version.
*/
- error = bwn_phy_getinfo(mac, high);
+ error = bwn_phy_getinfo(mac, have_bg);
if (error)
goto fail;
- /* XXX TODO need bhnd */
- if (bwn_is_bus_siba(mac)) {
- have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0;
- have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0;
- if (high & BWN_TGSHIGH_DUALPHY) {
- have_bg = 1;
- have_a = 1;
- }
- } else {
- device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__);
- error = ENXIO;
- goto fail;
- }
-
#if 0
device_printf(sc->sc_dev, "%s: high=0x%08x, have_a=%d, have_bg=%d,"
" deviceid=0x%04x, siba_deviceid=0x%04x\n",
@@ -1379,7 +1374,7 @@ bwn_reset_core(struct bwn_mac *mac, int
}
static int
-bwn_phy_getinfo(struct bwn_mac *mac, int tgshigh)
+bwn_phy_getinfo(struct bwn_mac *mac, int gmode)
{
struct bwn_phy *phy = &mac->mac_phy;
struct bwn_softc *sc = mac->mac_sc;
@@ -1387,7 +1382,7 @@ bwn_phy_getinfo(struct bwn_mac *mac, int
/* PHY */
tmp = BWN_READ_2(mac, BWN_PHYVER);
- phy->gmode = !! (tgshigh & BWN_TGSHIGH_HAVE_2GHZ);
+ phy->gmode = gmode;
phy->rf_on = 1;
phy->analog = (tmp & BWN_PHYVER_ANALOG) >> 12;
phy->type = (tmp & BWN_PHYVER_TYPE) >> 8;
More information about the svn-src-all
mailing list