xref: /freebsd/sys/dev/mii/ciphy.c (revision df57947f083046d50552e99b91074927d2458708)
1098ca2bdSWarner Losh /*-
2*df57947fSPedro F. Giffuni  * SPDX-License-Identifier: BSD-4-Clause
3*df57947fSPedro F. Giffuni  *
4a07bd003SBill Paul  * Copyright (c) 2004
5a07bd003SBill Paul  *	Bill Paul <wpaul@windriver.com>.  All rights reserved.
6a07bd003SBill Paul  *
7a07bd003SBill Paul  * Redistribution and use in source and binary forms, with or without
8a07bd003SBill Paul  * modification, are permitted provided that the following conditions
9a07bd003SBill Paul  * are met:
10a07bd003SBill Paul  * 1. Redistributions of source code must retain the above copyright
11a07bd003SBill Paul  *    notice, this list of conditions and the following disclaimer.
12a07bd003SBill Paul  * 2. Redistributions in binary form must reproduce the above copyright
13a07bd003SBill Paul  *    notice, this list of conditions and the following disclaimer in the
14a07bd003SBill Paul  *    documentation and/or other materials provided with the distribution.
15a07bd003SBill Paul  * 3. All advertising materials mentioning features or use of this software
16a07bd003SBill Paul  *    must display the following acknowledgement:
17a07bd003SBill Paul  *	This product includes software developed by Bill Paul.
18a07bd003SBill Paul  * 4. Neither the name of the author nor the names of any co-contributors
19a07bd003SBill Paul  *    may be used to endorse or promote products derived from this software
20a07bd003SBill Paul  *    without specific prior written permission.
21a07bd003SBill Paul  *
22a07bd003SBill Paul  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
23a07bd003SBill Paul  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24a07bd003SBill Paul  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25a07bd003SBill Paul  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
26a07bd003SBill Paul  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27a07bd003SBill Paul  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28a07bd003SBill Paul  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29a07bd003SBill Paul  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30a07bd003SBill Paul  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31a07bd003SBill Paul  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32a07bd003SBill Paul  * THE POSSIBILITY OF SUCH DAMAGE.
33a07bd003SBill Paul  */
34a07bd003SBill Paul 
35a07bd003SBill Paul #include <sys/cdefs.h>
36a07bd003SBill Paul __FBSDID("$FreeBSD$");
37a07bd003SBill Paul 
38a07bd003SBill Paul /*
39324eb733SRafal Jaworowski  * Driver for the Cicada/Vitesse CS/VSC8xxx 10/100/1000 copper PHY.
40a07bd003SBill Paul  */
41a07bd003SBill Paul 
42a07bd003SBill Paul #include <sys/param.h>
43a07bd003SBill Paul #include <sys/systm.h>
44a07bd003SBill Paul #include <sys/kernel.h>
45a07bd003SBill Paul #include <sys/module.h>
46a07bd003SBill Paul #include <sys/socket.h>
47a07bd003SBill Paul #include <sys/bus.h>
48a07bd003SBill Paul 
49a07bd003SBill Paul #include <net/if.h>
50a07bd003SBill Paul #include <net/if_arp.h>
51a07bd003SBill Paul #include <net/if_media.h>
52a07bd003SBill Paul 
53a07bd003SBill Paul #include <dev/mii/mii.h>
54a07bd003SBill Paul #include <dev/mii/miivar.h>
55a07bd003SBill Paul #include "miidevs.h"
56a07bd003SBill Paul 
57a07bd003SBill Paul #include <dev/mii/ciphyreg.h>
58a07bd003SBill Paul 
59a07bd003SBill Paul #include "miibus_if.h"
60a07bd003SBill Paul 
61a07bd003SBill Paul #include <machine/bus.h>
628e5d93dbSMarius Strobl 
63a07bd003SBill Paul static int ciphy_probe(device_t);
64a07bd003SBill Paul static int ciphy_attach(device_t);
65a07bd003SBill Paul 
66a07bd003SBill Paul static device_method_t ciphy_methods[] = {
67a07bd003SBill Paul 	/* device interface */
68a07bd003SBill Paul 	DEVMETHOD(device_probe,		ciphy_probe),
69a07bd003SBill Paul 	DEVMETHOD(device_attach,	ciphy_attach),
70a07bd003SBill Paul 	DEVMETHOD(device_detach,	mii_phy_detach),
71a07bd003SBill Paul 	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
72604f5f1fSMarius Strobl 	DEVMETHOD_END
73a07bd003SBill Paul };
74a07bd003SBill Paul 
75a07bd003SBill Paul static devclass_t ciphy_devclass;
76a07bd003SBill Paul 
77a07bd003SBill Paul static driver_t ciphy_driver = {
78a07bd003SBill Paul 	"ciphy",
79a07bd003SBill Paul 	ciphy_methods,
80a07bd003SBill Paul 	sizeof(struct mii_softc)
81a07bd003SBill Paul };
82a07bd003SBill Paul 
83a07bd003SBill Paul DRIVER_MODULE(ciphy, miibus, ciphy_driver, ciphy_devclass, 0, 0);
84a07bd003SBill Paul 
85a07bd003SBill Paul static int	ciphy_service(struct mii_softc *, struct mii_data *, int);
86a07bd003SBill Paul static void	ciphy_status(struct mii_softc *);
87a07bd003SBill Paul static void	ciphy_reset(struct mii_softc *);
88a07bd003SBill Paul static void	ciphy_fixup(struct mii_softc *);
89a07bd003SBill Paul 
90a35b9333SMarius Strobl static const struct mii_phydesc ciphys[] = {
913fcb7a53SMarius Strobl 	MII_PHY_DESC(xxCICADA, CS8201),
923fcb7a53SMarius Strobl 	MII_PHY_DESC(xxCICADA, CS8201A),
933fcb7a53SMarius Strobl 	MII_PHY_DESC(xxCICADA, CS8201B),
943fcb7a53SMarius Strobl 	MII_PHY_DESC(xxCICADA, CS8204),
953fcb7a53SMarius Strobl 	MII_PHY_DESC(xxCICADA, VSC8211),
969994219bSRafal Jaworowski 	MII_PHY_DESC(xxCICADA, VSC8221),
973fcb7a53SMarius Strobl 	MII_PHY_DESC(xxCICADA, CS8244),
983fcb7a53SMarius Strobl 	MII_PHY_DESC(xxVITESSE, VSC8601),
999994219bSRafal Jaworowski 	MII_PHY_DESC(xxVITESSE, VSC8641),
100a35b9333SMarius Strobl 	MII_PHY_END
101a35b9333SMarius Strobl };
102a35b9333SMarius Strobl 
1033fcb7a53SMarius Strobl static const struct mii_phy_funcs ciphy_funcs = {
1043fcb7a53SMarius Strobl 	ciphy_service,
1053fcb7a53SMarius Strobl 	ciphy_status,
1063fcb7a53SMarius Strobl 	ciphy_reset
1073fcb7a53SMarius Strobl };
1083fcb7a53SMarius Strobl 
109a07bd003SBill Paul static int
1107d830ac9SWarner Losh ciphy_probe(device_t dev)
111a07bd003SBill Paul {
112a07bd003SBill Paul 
113a35b9333SMarius Strobl 	return (mii_phy_dev_probe(dev, ciphys, BUS_PROBE_DEFAULT));
114a07bd003SBill Paul }
115a07bd003SBill Paul 
116a07bd003SBill Paul static int
1177d830ac9SWarner Losh ciphy_attach(device_t dev)
118a07bd003SBill Paul {
119a07bd003SBill Paul 
1203fcb7a53SMarius Strobl 	mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE,
1213fcb7a53SMarius Strobl 	    &ciphy_funcs, 1);
122a07bd003SBill Paul 	return (0);
123a07bd003SBill Paul }
124a07bd003SBill Paul 
125a07bd003SBill Paul static int
1267d830ac9SWarner Losh ciphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
127a07bd003SBill Paul {
128a07bd003SBill Paul 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
129a07bd003SBill Paul 	int reg, speed, gig;
130a07bd003SBill Paul 
131a07bd003SBill Paul 	switch (cmd) {
132a07bd003SBill Paul 	case MII_POLLSTAT:
133a07bd003SBill Paul 		break;
134a07bd003SBill Paul 
135a07bd003SBill Paul 	case MII_MEDIACHG:
136a07bd003SBill Paul 		ciphy_fixup(sc);	/* XXX hardware bug work-around */
137a07bd003SBill Paul 
138a07bd003SBill Paul 		switch (IFM_SUBTYPE(ife->ifm_media)) {
139a07bd003SBill Paul 		case IFM_AUTO:
140a07bd003SBill Paul #ifdef foo
141a07bd003SBill Paul 			/*
142a07bd003SBill Paul 			 * If we're already in auto mode, just return.
143a07bd003SBill Paul 			 */
144a07bd003SBill Paul 			if (PHY_READ(sc, CIPHY_MII_BMCR) & CIPHY_BMCR_AUTOEN)
145a07bd003SBill Paul 				return (0);
146a07bd003SBill Paul #endif
147a07bd003SBill Paul 			(void)mii_phy_auto(sc);
148a07bd003SBill Paul 			break;
149a07bd003SBill Paul 		case IFM_1000_T:
150a07bd003SBill Paul 			speed = CIPHY_S1000;
151a07bd003SBill Paul 			goto setit;
152a07bd003SBill Paul 		case IFM_100_TX:
153a07bd003SBill Paul 			speed = CIPHY_S100;
154a07bd003SBill Paul 			goto setit;
155a07bd003SBill Paul 		case IFM_10_T:
156a07bd003SBill Paul 			speed = CIPHY_S10;
157a07bd003SBill Paul setit:
15887a303dcSMarius Strobl 			if ((ife->ifm_media & IFM_FDX) != 0) {
159a07bd003SBill Paul 				speed |= CIPHY_BMCR_FDX;
160a07bd003SBill Paul 				gig = CIPHY_1000CTL_AFD;
16187a303dcSMarius Strobl 			} else
162a07bd003SBill Paul 				gig = CIPHY_1000CTL_AHD;
163a07bd003SBill Paul 
16487a303dcSMarius Strobl 			if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) {
165efd4fc3fSMarius Strobl 				gig |= CIPHY_1000CTL_MSE;
166efd4fc3fSMarius Strobl 				if ((ife->ifm_media & IFM_ETH_MASTER) != 0)
167efd4fc3fSMarius Strobl 					gig |= CIPHY_1000CTL_MSC;
16887a303dcSMarius Strobl 				speed |=
16987a303dcSMarius Strobl 				    CIPHY_BMCR_AUTOEN | CIPHY_BMCR_STARTNEG;
17087a303dcSMarius Strobl 			} else
17187a303dcSMarius Strobl 				gig = 0;
172a07bd003SBill Paul 			PHY_WRITE(sc, CIPHY_MII_1000CTL, gig);
17387a303dcSMarius Strobl 			PHY_WRITE(sc, CIPHY_MII_BMCR, speed);
17487a303dcSMarius Strobl 			PHY_WRITE(sc, CIPHY_MII_ANAR, CIPHY_SEL_TYPE);
175a07bd003SBill Paul 			break;
176a07bd003SBill Paul 		case IFM_NONE:
177a07bd003SBill Paul 			PHY_WRITE(sc, MII_BMCR, BMCR_ISO | BMCR_PDOWN);
178a07bd003SBill Paul 			break;
179a07bd003SBill Paul 		default:
180a07bd003SBill Paul 			return (EINVAL);
181a07bd003SBill Paul 		}
182a07bd003SBill Paul 		break;
183a07bd003SBill Paul 
184a07bd003SBill Paul 	case MII_TICK:
185a07bd003SBill Paul 		/*
186a07bd003SBill Paul 		 * Only used for autonegotiation.
187a07bd003SBill Paul 		 */
188a07bd003SBill Paul 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
189a07bd003SBill Paul 			break;
190a07bd003SBill Paul 
191a07bd003SBill Paul 		/*
192a07bd003SBill Paul 		 * Check to see if we have link.  If we do, we don't
193a07bd003SBill Paul 		 * need to restart the autonegotiation process.  Read
194a07bd003SBill Paul 		 * the BMSR twice in case it's latched.
195a07bd003SBill Paul 		 */
196a07bd003SBill Paul 		reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
197a07bd003SBill Paul 		if (reg & BMSR_LINK)
198a07bd003SBill Paul 			break;
199a07bd003SBill Paul 
200138b38ffSPyun YongHyeon 		/* Announce link loss right after it happens. */
201138b38ffSPyun YongHyeon 		if (++sc->mii_ticks == 0)
202138b38ffSPyun YongHyeon 			break;
203a07bd003SBill Paul 		/*
204eb10e723SPyun YongHyeon 		 * Only retry autonegotiation every mii_anegticks seconds.
205a07bd003SBill Paul 		 */
206eb10e723SPyun YongHyeon 		if (sc->mii_ticks <= sc->mii_anegticks)
207a07bd003SBill Paul 			break;
208a07bd003SBill Paul 
209a07bd003SBill Paul 		sc->mii_ticks = 0;
210a07bd003SBill Paul 		mii_phy_auto(sc);
21193798224SPyun YongHyeon 		break;
212a07bd003SBill Paul 	}
213a07bd003SBill Paul 
214a07bd003SBill Paul 	/* Update the media status. */
2153fcb7a53SMarius Strobl 	PHY_STATUS(sc);
216a07bd003SBill Paul 
217a07bd003SBill Paul 	/*
218a07bd003SBill Paul 	 * Callback if something changed. Note that we need to poke
219a07bd003SBill Paul 	 * apply fixups for certain PHY revs.
220a07bd003SBill Paul 	 */
221a07bd003SBill Paul 	if (sc->mii_media_active != mii->mii_media_active ||
222a07bd003SBill Paul 	    sc->mii_media_status != mii->mii_media_status ||
223a07bd003SBill Paul 	    cmd == MII_MEDIACHG) {
224a07bd003SBill Paul 		ciphy_fixup(sc);
225a07bd003SBill Paul 	}
226a07bd003SBill Paul 	mii_phy_update(sc, cmd);
227a07bd003SBill Paul 	return (0);
228a07bd003SBill Paul }
229a07bd003SBill Paul 
230a07bd003SBill Paul static void
2317d830ac9SWarner Losh ciphy_status(struct mii_softc *sc)
232a07bd003SBill Paul {
233a07bd003SBill Paul 	struct mii_data *mii = sc->mii_pdata;
234a07bd003SBill Paul 	int bmsr, bmcr;
235a07bd003SBill Paul 
236a07bd003SBill Paul 	mii->mii_media_status = IFM_AVALID;
237a07bd003SBill Paul 	mii->mii_media_active = IFM_ETHER;
238a07bd003SBill Paul 
239a07bd003SBill Paul 	bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
240a07bd003SBill Paul 
241a07bd003SBill Paul 	if (bmsr & BMSR_LINK)
242a07bd003SBill Paul 		mii->mii_media_status |= IFM_ACTIVE;
243a07bd003SBill Paul 
244a07bd003SBill Paul 	bmcr = PHY_READ(sc, CIPHY_MII_BMCR);
245a07bd003SBill Paul 
246a07bd003SBill Paul 	if (bmcr & CIPHY_BMCR_LOOP)
247a07bd003SBill Paul 		mii->mii_media_active |= IFM_LOOP;
248a07bd003SBill Paul 
249a07bd003SBill Paul 	if (bmcr & CIPHY_BMCR_AUTOEN) {
250a07bd003SBill Paul 		if ((bmsr & CIPHY_BMSR_ACOMP) == 0) {
251a07bd003SBill Paul 			/* Erg, still trying, I guess... */
252a07bd003SBill Paul 			mii->mii_media_active |= IFM_NONE;
253a07bd003SBill Paul 			return;
254a07bd003SBill Paul 		}
255a07bd003SBill Paul 	}
256a07bd003SBill Paul 
257a07bd003SBill Paul 	bmsr = PHY_READ(sc, CIPHY_MII_AUXCSR);
258a07bd003SBill Paul 	switch (bmsr & CIPHY_AUXCSR_SPEED) {
259a07bd003SBill Paul 	case CIPHY_SPEED10:
260a07bd003SBill Paul 		mii->mii_media_active |= IFM_10_T;
261a07bd003SBill Paul 		break;
262a07bd003SBill Paul 	case CIPHY_SPEED100:
263a07bd003SBill Paul 		mii->mii_media_active |= IFM_100_TX;
264a07bd003SBill Paul 		break;
265a07bd003SBill Paul 	case CIPHY_SPEED1000:
266a07bd003SBill Paul 		mii->mii_media_active |= IFM_1000_T;
267a07bd003SBill Paul 		break;
268a07bd003SBill Paul 	default:
269a07bd003SBill Paul 		device_printf(sc->mii_dev, "unknown PHY speed %x\n",
270a07bd003SBill Paul 		    bmsr & CIPHY_AUXCSR_SPEED);
271a07bd003SBill Paul 		break;
272a07bd003SBill Paul 	}
273a07bd003SBill Paul 
274a07bd003SBill Paul 	if (bmsr & CIPHY_AUXCSR_FDX)
2753fcb7a53SMarius Strobl 		mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc);
276f350b4e7SPyun YongHyeon 	else
277f350b4e7SPyun YongHyeon 		mii->mii_media_active |= IFM_HDX;
278efd4fc3fSMarius Strobl 
279efd4fc3fSMarius Strobl 	if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) &&
280efd4fc3fSMarius Strobl 	   (PHY_READ(sc, CIPHY_MII_1000STS) & CIPHY_1000STS_MSR) != 0)
281efd4fc3fSMarius Strobl 		mii->mii_media_active |= IFM_ETH_MASTER;
282a07bd003SBill Paul }
283a07bd003SBill Paul 
284a07bd003SBill Paul static void
285a07bd003SBill Paul ciphy_reset(struct mii_softc *sc)
286a07bd003SBill Paul {
287028ccec4SMarius Strobl 
288a07bd003SBill Paul 	mii_phy_reset(sc);
289a07bd003SBill Paul 	DELAY(1000);
290a07bd003SBill Paul }
291a07bd003SBill Paul 
292a07bd003SBill Paul #define PHY_SETBIT(x, y, z) \
293a07bd003SBill Paul 	PHY_WRITE(x, y, (PHY_READ(x, y) | (z)))
294a07bd003SBill Paul #define PHY_CLRBIT(x, y, z) \
295a07bd003SBill Paul 	PHY_WRITE(x, y, (PHY_READ(x, y) & ~(z)))
296a07bd003SBill Paul 
297a07bd003SBill Paul static void
298a07bd003SBill Paul ciphy_fixup(struct mii_softc *sc)
299a07bd003SBill Paul {
300a07bd003SBill Paul 	uint16_t		model;
301a07bd003SBill Paul 	uint16_t		status, speed;
3029f6cc3adSPyun YongHyeon 	uint16_t		val;
303a07bd003SBill Paul 
304a07bd003SBill Paul 	model = MII_MODEL(PHY_READ(sc, CIPHY_MII_PHYIDR2));
305a07bd003SBill Paul 	status = PHY_READ(sc, CIPHY_MII_AUXCSR);
306a07bd003SBill Paul 	speed = status & CIPHY_AUXCSR_SPEED;
307a07bd003SBill Paul 
3087e310d2dSGleb Smirnoff 	if (mii_phy_mac_match(sc, "nfe")) {
3099f6cc3adSPyun YongHyeon 		/* need to set for 2.5V RGMII for NVIDIA adapters */
3109f6cc3adSPyun YongHyeon 		val = PHY_READ(sc, CIPHY_MII_ECTL1);
3119f6cc3adSPyun YongHyeon 		val &= ~(CIPHY_ECTL1_IOVOL | CIPHY_ECTL1_INTSEL);
3129f6cc3adSPyun YongHyeon 		val |= (CIPHY_IOVOL_2500MV | CIPHY_INTSEL_RGMII);
3139f6cc3adSPyun YongHyeon 		PHY_WRITE(sc, CIPHY_MII_ECTL1, val);
3149f6cc3adSPyun YongHyeon 		/* From Linux. */
3159f6cc3adSPyun YongHyeon 		val = PHY_READ(sc, CIPHY_MII_AUXCSR);
3169f6cc3adSPyun YongHyeon 		val |= CIPHY_AUXCSR_MDPPS;
3179f6cc3adSPyun YongHyeon 		PHY_WRITE(sc, CIPHY_MII_AUXCSR, val);
3189f6cc3adSPyun YongHyeon 		val = PHY_READ(sc, CIPHY_MII_10BTCSR);
3199f6cc3adSPyun YongHyeon 		val |= CIPHY_10BTCSR_ECHO;
3209f6cc3adSPyun YongHyeon 		PHY_WRITE(sc, CIPHY_MII_10BTCSR, val);
3219f6cc3adSPyun YongHyeon 	}
3229f6cc3adSPyun YongHyeon 
323a07bd003SBill Paul 	switch (model) {
3243fcb7a53SMarius Strobl 	case MII_MODEL_xxCICADA_CS8204:
3253fcb7a53SMarius Strobl 	case MII_MODEL_xxCICADA_CS8201:
326a07bd003SBill Paul 
327a07bd003SBill Paul 		/* Turn off "aux mode" (whatever that means) */
328a07bd003SBill Paul 		PHY_SETBIT(sc, CIPHY_MII_AUXCSR, CIPHY_AUXCSR_MDPPS);
329a07bd003SBill Paul 
330a07bd003SBill Paul 		/*
331a07bd003SBill Paul 		 * Work around speed polling bug in VT3119/VT3216
332a07bd003SBill Paul 		 * when using MII in full duplex mode.
333a07bd003SBill Paul 		 */
334a07bd003SBill Paul 		if ((speed == CIPHY_SPEED10 || speed == CIPHY_SPEED100) &&
335a07bd003SBill Paul 		    (status & CIPHY_AUXCSR_FDX)) {
336a07bd003SBill Paul 			PHY_SETBIT(sc, CIPHY_MII_10BTCSR, CIPHY_10BTCSR_ECHO);
337a07bd003SBill Paul 		} else {
338a07bd003SBill Paul 			PHY_CLRBIT(sc, CIPHY_MII_10BTCSR, CIPHY_10BTCSR_ECHO);
339a07bd003SBill Paul 		}
340a07bd003SBill Paul 
341a07bd003SBill Paul 		/* Enable link/activity LED blink. */
342a07bd003SBill Paul 		PHY_SETBIT(sc, CIPHY_MII_LED, CIPHY_LED_LINKACTBLINK);
343a07bd003SBill Paul 
344a07bd003SBill Paul 		break;
345a07bd003SBill Paul 
3463fcb7a53SMarius Strobl 	case MII_MODEL_xxCICADA_CS8201A:
3473fcb7a53SMarius Strobl 	case MII_MODEL_xxCICADA_CS8201B:
348a07bd003SBill Paul 
349a07bd003SBill Paul 		/*
350a07bd003SBill Paul 		 * Work around speed polling bug in VT3119/VT3216
351a07bd003SBill Paul 		 * when using MII in full duplex mode.
352a07bd003SBill Paul 		 */
353a07bd003SBill Paul 		if ((speed == CIPHY_SPEED10 || speed == CIPHY_SPEED100) &&
354a07bd003SBill Paul 		    (status & CIPHY_AUXCSR_FDX)) {
355a07bd003SBill Paul 			PHY_SETBIT(sc, CIPHY_MII_10BTCSR, CIPHY_10BTCSR_ECHO);
356a07bd003SBill Paul 		} else {
357a07bd003SBill Paul 			PHY_CLRBIT(sc, CIPHY_MII_10BTCSR, CIPHY_10BTCSR_ECHO);
358a07bd003SBill Paul 		}
359a07bd003SBill Paul 
360a07bd003SBill Paul 		break;
3613fcb7a53SMarius Strobl 	case MII_MODEL_xxCICADA_VSC8211:
3629994219bSRafal Jaworowski 	case MII_MODEL_xxCICADA_VSC8221:
3633fcb7a53SMarius Strobl 	case MII_MODEL_xxCICADA_CS8244:
3643fcb7a53SMarius Strobl 	case MII_MODEL_xxVITESSE_VSC8601:
3659994219bSRafal Jaworowski 	case MII_MODEL_xxVITESSE_VSC8641:
3669f6cc3adSPyun YongHyeon 		break;
367a07bd003SBill Paul 	default:
368a07bd003SBill Paul 		device_printf(sc->mii_dev, "unknown CICADA PHY model %x\n",
369a07bd003SBill Paul 		    model);
370a07bd003SBill Paul 		break;
371a07bd003SBill Paul 	}
372a07bd003SBill Paul }
373