Deleted Added
sdiff udiff text old ( 164827 ) new ( 164830 )
full compact
1/*-
2 * Copyright (c) 2004
3 * Bill Paul <wpaul@windriver.com>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/dev/mii/ciphy.c 164830 2006-12-02 19:36:25Z marius $");
35
36/*
37 * Driver for the Cicada CS8201 10/100/1000 copper PHY.
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/module.h>
44#include <sys/socket.h>
45#include <sys/bus.h>
46
47#include <net/if.h>
48#include <net/if_arp.h>
49#include <net/if_media.h>
50
51#include <dev/mii/mii.h>
52#include <dev/mii/miivar.h>
53#include "miidevs.h"
54

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

259 */
260 reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
261 if (reg & BMSR_LINK)
262 break;
263
264 /*
265 * Only retry autonegotiation every 5 seconds.
266 */
267 if (++sc->mii_ticks <= MII_ANEGTICKS)
268 break;
269
270 sc->mii_ticks = 0;
271 mii_phy_auto(sc);
272 return (0);
273 }
274
275 /* Update the media status. */

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

329 default:
330 device_printf(sc->mii_dev, "unknown PHY speed %x\n",
331 bmsr & CIPHY_AUXCSR_SPEED);
332 break;
333 }
334
335 if (bmsr & CIPHY_AUXCSR_FDX)
336 mii->mii_media_active |= IFM_FDX;
337}
338
339static void
340ciphy_reset(struct mii_softc *sc)
341{
342
343 mii_phy_reset(sc);
344 DELAY(1000);
345}
346
347#define PHY_SETBIT(x, y, z) \
348 PHY_WRITE(x, y, (PHY_READ(x, y) | (z)))
349#define PHY_CLRBIT(x, y, z) \
350 PHY_WRITE(x, y, (PHY_READ(x, y) & ~(z)))
351
352static void

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

396 }
397
398 break;
399 default:
400 device_printf(sc->mii_dev, "unknown CICADA PHY model %x\n",
401 model);
402 break;
403 }
404}