Deleted Added
full compact
if_stge.c (213000) if_stge.c (213893)
1/* $NetBSD: if_stge.c,v 1.32 2005/12/11 12:22:49 christos Exp $ */
2
3/*-
4 * Copyright (c) 2001 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.

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

30 */
31
32/*
33 * Device driver for the Sundance Tech. TC9021 10/100/1000
34 * Ethernet controller.
35 */
36
37#include <sys/cdefs.h>
1/* $NetBSD: if_stge.c,v 1.32 2005/12/11 12:22:49 christos Exp $ */
2
3/*-
4 * Copyright (c) 2001 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.

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

30 */
31
32/*
33 * Device driver for the Sundance Tech. TC9021 10/100/1000
34 * Ethernet controller.
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/dev/stge/if_stge.c 213000 2010-09-22 16:48:24Z yongari $");
38__FBSDID("$FreeBSD: head/sys/dev/stge/if_stge.c 213893 2010-10-15 14:52:11Z marius $");
39
40#ifdef HAVE_KERNEL_OPTION_HEADERS
41#include "opt_device_polling.h"
42#endif
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/endian.h>

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

571}
572
573static int
574stge_attach(device_t dev)
575{
576 struct stge_softc *sc;
577 struct ifnet *ifp;
578 uint8_t enaddr[ETHER_ADDR_LEN];
39
40#ifdef HAVE_KERNEL_OPTION_HEADERS
41#include "opt_device_polling.h"
42#endif
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/endian.h>

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

571}
572
573static int
574stge_attach(device_t dev)
575{
576 struct stge_softc *sc;
577 struct ifnet *ifp;
578 uint8_t enaddr[ETHER_ADDR_LEN];
579 int error, i;
579 int error, flags, i;
580 uint16_t cmd;
581 uint32_t val;
582
583 error = 0;
584 sc = device_get_softc(dev);
585 sc->sc_dev = dev;
586
587 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,

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

733
734 /*
735 * Read some important bits from the PhyCtrl register.
736 */
737 sc->sc_PhyCtrl = CSR_READ_1(sc, STGE_PhyCtrl) &
738 (PC_PhyDuplexPolarity | PC_PhyLnkPolarity);
739
740 /* Set up MII bus. */
580 uint16_t cmd;
581 uint32_t val;
582
583 error = 0;
584 sc = device_get_softc(dev);
585 sc->sc_dev = dev;
586
587 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,

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

733
734 /*
735 * Read some important bits from the PhyCtrl register.
736 */
737 sc->sc_PhyCtrl = CSR_READ_1(sc, STGE_PhyCtrl) &
738 (PC_PhyDuplexPolarity | PC_PhyLnkPolarity);
739
740 /* Set up MII bus. */
741 if ((error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, stge_mediachange,
742 stge_mediastatus)) != 0) {
743 device_printf(sc->sc_dev, "no PHY found!\n");
741 flags = 0;
742 if (sc->sc_rev >= 0x40 && sc->sc_rev <= 0x4e)
743 flags |= MIIF_MACPRIV0;
744 error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, stge_mediachange,
745 stge_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY,
746 flags);
747 if (error != 0) {
748 device_printf(sc->sc_dev, "attaching PHYs failed\n");
744 goto fail;
745 }
746
747 ether_ifattach(ifp, enaddr);
748
749 /* VLAN capability setup */
750 ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING;
751 if (sc->sc_rev >= 0x0c)

--- 1994 unchanged lines hidden ---
749 goto fail;
750 }
751
752 ether_ifattach(ifp, enaddr);
753
754 /* VLAN capability setup */
755 ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING;
756 if (sc->sc_rev >= 0x0c)

--- 1994 unchanged lines hidden ---