summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2006-06-17 23:24:35 +0000
committerimp <imp@FreeBSD.org>2006-06-17 23:24:35 +0000
commitefe72c3bf7b1ef22b38c79a401825925fa4f4f27 (patch)
treeaa776219758c23da970f49979454401712f92c7a /sys/arm/at91
parentc2756c87a06ab47af0a4fb64ed75ca1aeea0434d (diff)
downloadFreeBSD-src-efe72c3bf7b1ef22b38c79a401825925fa4f4f27.zip
FreeBSD-src-efe72c3bf7b1ef22b38c79a401825925fa4f4f27.tar.gz
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.
Diffstat (limited to 'sys/arm/at91')
-rw-r--r--sys/arm/at91/if_ate.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/arm/at91/if_ate.c b/sys/arm/at91/if_ate.c
index b33d9ac..4320e17 100644
--- a/sys/arm/at91/if_ate.c
+++ b/sys/arm/at91/if_ate.c
@@ -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.
*/
OpenPOWER on IntegriCloud