[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
This commit is contained in:
parent
972459a6ca
commit
40dcddfcca
@ -1148,34 +1148,15 @@ 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);
|
||||
|
||||
high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH);
|
||||
|
||||
/*
|
||||
* 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));
|
||||
|
||||
/*
|
||||
* Get the PHY version.
|
||||
*/
|
||||
error = bwn_phy_getinfo(mac, high);
|
||||
if (error)
|
||||
goto fail;
|
||||
|
||||
/* XXX TODO need bhnd */
|
||||
if (bwn_is_bus_siba(mac)) {
|
||||
uint32_t high;
|
||||
|
||||
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) {
|
||||
@ -1188,6 +1169,20 @@ bwn_attach_core(struct bwn_mac *mac)
|
||||
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.
|
||||
*/
|
||||
bwn_reset_core(mac, have_bg);
|
||||
|
||||
/*
|
||||
* Get the PHY version.
|
||||
*/
|
||||
error = bwn_phy_getinfo(mac, have_bg);
|
||||
if (error)
|
||||
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 g_mode)
|
||||
}
|
||||
|
||||
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 tgshigh)
|
||||
|
||||
/* 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;
|
||||
|
Loading…
Reference in New Issue
Block a user