1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00

Carefully note the RMII bit in the config register at attach time.

The boot loader is supposed to leave this bit set to the right value
for the board.  If this bit was set at attach time, use it to init the
config register correctly.

Note: this means the boot loader has to properly initialize it.
This commit is contained in:
Warner Losh 2006-06-17 23:24:35 +00:00
parent 0ca5ce8fee
commit aee1351504
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159708

View File

@ -96,6 +96,7 @@ struct ate_softc
int txcur; /* current tx map pointer */
bus_addr_t rx_desc_phys;
eth_rx_desc_t *rx_descs;
int use_rmii;
struct ifmib_iso_8802_3 mibdata; /* stuff for network mgmt */
};
@ -174,6 +175,8 @@ ate_attach(device_t dev)
if (err)
goto out;
sc->use_rmii = (RD4(sc, ETH_CFG) & ETH_CFG_RMII) == ETH_CFG_RMII;
/* calling atestop before ifp is set is OK */
atestop(sc);
ATE_LOCK_INIT(sc);
@ -182,6 +185,7 @@ ate_attach(device_t dev)
ate_get_mac(sc, eaddr);
ate_set_mac(sc, eaddr);
sc->ifp = ifp = if_alloc(IFT_ETHER);
if (mii_phy_probe(dev, &sc->miibus, ate_ifmedia_upd, ate_ifmedia_sts)) {
device_printf(dev, "Cannot find my PHY.\n");
@ -693,11 +697,11 @@ ateinit_locked(void *xsc)
* to this chip. Select the right one based on a compile-time
* option.
*/
#ifdef ATE_USE_RMII
WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_RMII);
#else
WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_RMII);
#endif
if (sc->use_rmii)
WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) | ETH_CFG_RMII);
else
WR4(sc, ETH_CFG, RD4(sc, ETH_CFG) & ~ETH_CFG_RMII);
/*
* Turn on the multicast hash, and write 0's to it.
*/