Deleted Added
full compact
if_msk.c (215034) if_msk.c (215297)
1/******************************************************************************
2 *
3 * Name : sky2.c
4 * Project: Gigabit Ethernet Driver for FreeBSD 5.x/6.x
5 * Version: $Revision: 1.23 $
6 * Date : $Date: 2005/12/22 09:04:11 $
7 * Purpose: Main driver source file
8 *

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

94
95/*
96 * Device driver for the Marvell Yukon II Ethernet controller.
97 * Due to lack of documentation, this driver is based on the code from
98 * sk(4) and Marvell's myk(4) driver for FreeBSD 5.x.
99 */
100
101#include <sys/cdefs.h>
1/******************************************************************************
2 *
3 * Name : sky2.c
4 * Project: Gigabit Ethernet Driver for FreeBSD 5.x/6.x
5 * Version: $Revision: 1.23 $
6 * Date : $Date: 2005/12/22 09:04:11 $
7 * Purpose: Main driver source file
8 *

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

94
95/*
96 * Device driver for the Marvell Yukon II Ethernet controller.
97 * Due to lack of documentation, this driver is based on the code from
98 * sk(4) and Marvell's myk(4) driver for FreeBSD 5.x.
99 */
100
101#include <sys/cdefs.h>
102__FBSDID("$FreeBSD: head/sys/dev/msk/if_msk.c 215034 2010-11-09 10:59:09Z brucec $");
102__FBSDID("$FreeBSD: head/sys/dev/msk/if_msk.c 215297 2010-11-14 13:26:10Z marius $");
103
104#include <sys/param.h>
105#include <sys/systm.h>
106#include <sys/bus.h>
107#include <sys/endian.h>
108#include <sys/mbuf.h>
109#include <sys/malloc.h>
110#include <sys/kernel.h>

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

524 break;
525 case IFM_100_TX:
526 gmac |= GM_GPCR_SPEED_100;
527 break;
528 case IFM_10_T:
529 break;
530 }
531
103
104#include <sys/param.h>
105#include <sys/systm.h>
106#include <sys/bus.h>
107#include <sys/endian.h>
108#include <sys/mbuf.h>
109#include <sys/malloc.h>
110#include <sys/kernel.h>

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

524 break;
525 case IFM_100_TX:
526 gmac |= GM_GPCR_SPEED_100;
527 break;
528 case IFM_10_T:
529 break;
530 }
531
532 /* Disable Rx flow control. */
533 if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) == 0)
532 if ((IFM_OPTIONS(mii->mii_media_active) &
533 IFM_ETH_RXPAUSE) == 0)
534 gmac |= GM_GPCR_FC_RX_DIS;
534 gmac |= GM_GPCR_FC_RX_DIS;
535 /* Disable Tx flow control. */
536 if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG1) == 0)
535 if ((IFM_OPTIONS(mii->mii_media_active) &
536 IFM_ETH_TXPAUSE) == 0)
537 gmac |= GM_GPCR_FC_TX_DIS;
538 if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
539 gmac |= GM_GPCR_DUP_FULL;
540 else
541 gmac |= GM_GPCR_FC_RX_DIS | GM_GPCR_FC_TX_DIS;
542 gmac |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA;
543 GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac);
544 /* Read again to ensure writing. */
545 GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
546 gmac = GMC_PAUSE_OFF;
547 if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) {
537 gmac |= GM_GPCR_FC_TX_DIS;
538 if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
539 gmac |= GM_GPCR_DUP_FULL;
540 else
541 gmac |= GM_GPCR_FC_RX_DIS | GM_GPCR_FC_TX_DIS;
542 gmac |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA;
543 GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac);
544 /* Read again to ensure writing. */
545 GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
546 gmac = GMC_PAUSE_OFF;
547 if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) {
548 if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FLAG0) != 0)
548 if ((IFM_OPTIONS(mii->mii_media_active) &
549 IFM_ETH_RXPAUSE) != 0)
549 gmac = GMC_PAUSE_ON;
550 }
551 CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), gmac);
552
553 /* Enable PHY interrupt for FIFO underrun/overflow. */
554 msk_phy_writereg(sc_if, PHY_ADDR_MARV,
555 PHY_MARV_INT_MASK, PHY_M_IS_FIFO_ERROR);
556 } else {

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

1881 if (mmd == NULL) {
1882 device_printf(dev, "failed to allocate memory for "
1883 "ivars of PORT_A\n");
1884 error = ENXIO;
1885 goto fail;
1886 }
1887 mmd->port = MSK_PORT_A;
1888 mmd->pmd = sc->msk_pmd;
550 gmac = GMC_PAUSE_ON;
551 }
552 CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), gmac);
553
554 /* Enable PHY interrupt for FIFO underrun/overflow. */
555 msk_phy_writereg(sc_if, PHY_ADDR_MARV,
556 PHY_MARV_INT_MASK, PHY_M_IS_FIFO_ERROR);
557 } else {

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

1882 if (mmd == NULL) {
1883 device_printf(dev, "failed to allocate memory for "
1884 "ivars of PORT_A\n");
1885 error = ENXIO;
1886 goto fail;
1887 }
1888 mmd->port = MSK_PORT_A;
1889 mmd->pmd = sc->msk_pmd;
1890 mmd->mii_flags |= MIIF_DOPAUSE;
1889 if (sc->msk_pmd == 'L' || sc->msk_pmd == 'S')
1890 mmd->mii_flags |= MIIF_HAVEFIBER;
1891 if (sc->msk_pmd == 'P')
1892 mmd->mii_flags |= MIIF_HAVEFIBER | MIIF_MACPRIV0;
1893 device_set_ivars(sc->msk_devs[MSK_PORT_A], mmd);
1894
1895 if (sc->msk_num_port > 1) {
1896 sc->msk_devs[MSK_PORT_B] = device_add_child(dev, "msk", -1);

--- 2617 unchanged lines hidden ---
1891 if (sc->msk_pmd == 'L' || sc->msk_pmd == 'S')
1892 mmd->mii_flags |= MIIF_HAVEFIBER;
1893 if (sc->msk_pmd == 'P')
1894 mmd->mii_flags |= MIIF_HAVEFIBER | MIIF_MACPRIV0;
1895 device_set_ivars(sc->msk_devs[MSK_PORT_A], mmd);
1896
1897 if (sc->msk_num_port > 1) {
1898 sc->msk_devs[MSK_PORT_B] = device_add_child(dev, "msk", -1);

--- 2617 unchanged lines hidden ---