Deleted Added
full compact
if_stge.c (213893) if_stge.c (215297)
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 213893 2010-10-15 14:52:11Z marius $");
38__FBSDID("$FreeBSD: head/sys/dev/stge/if_stge.c 215297 2010-11-14 13:26:10Z 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>

--- 686 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. */
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>

--- 686 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 flags = 0;
741 flags = MIIF_DOPAUSE;
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");
749 goto fail;

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

1519 if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)
1520 sc->sc_link = 1;
1521 } else
1522 sc->sc_link = 0;
1523
1524 sc->sc_MACCtrl = 0;
1525 if (((mii->mii_media_active & IFM_GMASK) & IFM_FDX) != 0)
1526 sc->sc_MACCtrl |= MC_DuplexSelect;
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");
749 goto fail;

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

1519 if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)
1520 sc->sc_link = 1;
1521 } else
1522 sc->sc_link = 0;
1523
1524 sc->sc_MACCtrl = 0;
1525 if (((mii->mii_media_active & IFM_GMASK) & IFM_FDX) != 0)
1526 sc->sc_MACCtrl |= MC_DuplexSelect;
1527 if (((mii->mii_media_active & IFM_GMASK) & IFM_FLAG0) != 0)
1527 if (((mii->mii_media_active & IFM_GMASK) & IFM_ETH_RXPAUSE) != 0)
1528 sc->sc_MACCtrl |= MC_RxFlowControlEnable;
1528 sc->sc_MACCtrl |= MC_RxFlowControlEnable;
1529 if (((mii->mii_media_active & IFM_GMASK) & IFM_FLAG1) != 0)
1529 if (((mii->mii_media_active & IFM_GMASK) & IFM_ETH_TXPAUSE) != 0)
1530 sc->sc_MACCtrl |= MC_TxFlowControlEnable;
1531 /*
1532 * Update STGE_MACCtrl register depending on link status.
1533 * (duplex, flow control etc)
1534 */
1535 v = ac = CSR_READ_4(sc, STGE_MACCtrl) & MC_MASK;
1536 v &= ~(MC_DuplexSelect|MC_RxFlowControlEnable|MC_TxFlowControlEnable);
1537 v |= sc->sc_MACCtrl;

--- 1213 unchanged lines hidden ---
1530 sc->sc_MACCtrl |= MC_TxFlowControlEnable;
1531 /*
1532 * Update STGE_MACCtrl register depending on link status.
1533 * (duplex, flow control etc)
1534 */
1535 v = ac = CSR_READ_4(sc, STGE_MACCtrl) & MC_MASK;
1536 v &= ~(MC_DuplexSelect|MC_RxFlowControlEnable|MC_TxFlowControlEnable);
1537 v |= sc->sc_MACCtrl;

--- 1213 unchanged lines hidden ---