Date: Sat, 17 Jun 2006 19:48:37 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99455 for review Message-ID: <200606171948.k5HJmbMC096576@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99455 Change 99455 by imp@imp_lighthouse on 2006/06/17 19:48:09 Detect what state the boot loader left the RMII bit before we frob the device. This allows us to let the boot loader cope and to then boot the same kernel on RMII and MII boards. Change #ifdef to if to cope later. Affected files ... .. //depot/projects/arm/src/sys/arm/at91/if_ate.c#51 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#51 (text+ko) ==== @@ -96,6 +96,7 @@ 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 @@ 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_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 @@ * 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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606171948.k5HJmbMC096576>