From owner-p4-projects@FreeBSD.ORG Sat Jun 17 19:48:42 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1674A16A494; Sat, 17 Jun 2006 19:48:42 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D12C016A481 for ; Sat, 17 Jun 2006 19:48:41 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F08B43D6D for ; Sat, 17 Jun 2006 19:48:37 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5HJmbxx096579 for ; Sat, 17 Jun 2006 19:48:37 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5HJmbMC096576 for perforce@freebsd.org; Sat, 17 Jun 2006 19:48:37 GMT (envelope-from imp@freebsd.org) Date: Sat, 17 Jun 2006 19:48:37 GMT Message-Id: <200606171948.k5HJmbMC096576@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 99455 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jun 2006 19:48:42 -0000 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. */