Deleted Added
full compact
tlphy.c (213384) tlphy.c (213893)
1/* $NetBSD: tlphy.c,v 1.18 1999/05/14 11:40:28 drochner Exp $ */
2
3/*-
4 * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,

--- 41 unchanged lines hidden (view full) ---

50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */
56
57#include <sys/cdefs.h>
1/* $NetBSD: tlphy.c,v 1.18 1999/05/14 11:40:28 drochner Exp $ */
2
3/*-
4 * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,

--- 41 unchanged lines hidden (view full) ---

50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */
56
57#include <sys/cdefs.h>
58__FBSDID("$FreeBSD: head/sys/dev/mii/tlphy.c 213384 2010-10-03 17:00:57Z marius $");
58__FBSDID("$FreeBSD: head/sys/dev/mii/tlphy.c 213893 2010-10-15 14:52:11Z marius $");
59
60/*
61 * Driver for Texas Instruments's ThunderLAN PHYs
62 */
63
64#include <sys/param.h>
65#include <sys/systm.h>
66#include <sys/kernel.h>

--- 72 unchanged lines hidden (view full) ---

139 int capmask, devs, i;
140
141 sc = device_get_softc(dev);
142 ma = device_get_ivars(dev);
143 sc->sc_mii.mii_dev = device_get_parent(dev);
144 mii = device_get_softc(sc->sc_mii.mii_dev);
145 LIST_INSERT_HEAD(&mii->mii_phys, &sc->sc_mii, mii_list);
146
59
60/*
61 * Driver for Texas Instruments's ThunderLAN PHYs
62 */
63
64#include <sys/param.h>
65#include <sys/systm.h>
66#include <sys/kernel.h>

--- 72 unchanged lines hidden (view full) ---

139 int capmask, devs, i;
140
141 sc = device_get_softc(dev);
142 ma = device_get_ivars(dev);
143 sc->sc_mii.mii_dev = device_get_parent(dev);
144 mii = device_get_softc(sc->sc_mii.mii_dev);
145 LIST_INSERT_HEAD(&mii->mii_phys, &sc->sc_mii, mii_list);
146
147 sc->sc_mii.mii_flags = miibus_get_flags(dev);
147 sc->sc_mii.mii_inst = mii->mii_instance;
148 sc->sc_mii.mii_phy = ma->mii_phyno;
149 sc->sc_mii.mii_service = tlphy_service;
150 sc->sc_mii.mii_pdata = mii;
151
148 sc->sc_mii.mii_inst = mii->mii_instance;
149 sc->sc_mii.mii_phy = ma->mii_phyno;
150 sc->sc_mii.mii_service = tlphy_service;
151 sc->sc_mii.mii_pdata = mii;
152
152 capmask = 0xFFFFFFFF;
153 capmask = BMSR_DEFCAPMASK;
153 if (mii->mii_instance &&
154 device_get_children(sc->sc_mii.mii_dev, &devlist, &devs) == 0) {
155 for (i = 0; i < devs; i++) {
156 if (strcmp(device_get_name(devlist[i]), "tlphy")) {
157 other = device_get_softc(devlist[i]);
158 capmask &= ~other->mii_capabilities;
159 break;
160 }

--- 8 unchanged lines hidden (view full) ---

169 /*
170 * Note that if we're on a device that also supports 100baseTX,
171 * we are not going to want to use the built-in 10baseT port,
172 * since there will be another PHY on the MII wired up to the
173 * UTP connector. The parent indicates this to us by specifying
174 * the TLPHY_MEDIA_NO_10_T bit.
175 */
176 sc->sc_mii.mii_capabilities =
154 if (mii->mii_instance &&
155 device_get_children(sc->sc_mii.mii_dev, &devlist, &devs) == 0) {
156 for (i = 0; i < devs; i++) {
157 if (strcmp(device_get_name(devlist[i]), "tlphy")) {
158 other = device_get_softc(devlist[i]);
159 capmask &= ~other->mii_capabilities;
160 break;
161 }

--- 8 unchanged lines hidden (view full) ---

170 /*
171 * Note that if we're on a device that also supports 100baseTX,
172 * we are not going to want to use the built-in 10baseT port,
173 * since there will be another PHY on the MII wired up to the
174 * UTP connector. The parent indicates this to us by specifying
175 * the TLPHY_MEDIA_NO_10_T bit.
176 */
177 sc->sc_mii.mii_capabilities =
177 PHY_READ(&sc->sc_mii, MII_BMSR) & capmask /*ma->mii_capmask*/;
178 PHY_READ(&sc->sc_mii, MII_BMSR) & capmask;
178
179#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
180
181 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->sc_mii.mii_inst),
182 BMCR_ISO);
183
184 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP,
185 sc->sc_mii.mii_inst), BMCR_LOOP);

--- 205 unchanged lines hidden ---
179
180#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
181
182 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->sc_mii.mii_inst),
183 BMCR_ISO);
184
185 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP,
186 sc->sc_mii.mii_inst), BMCR_LOOP);

--- 205 unchanged lines hidden ---