if_vge.c (200972) | if_vge.c (213893) |
---|---|
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> | 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/vge/if_vge.c 200972 2009-12-25 00:23:47Z yongari $"); | 34__FBSDID("$FreeBSD: head/sys/dev/vge/if_vge.c 213893 2010-10-15 14:52:11Z marius $"); |
35 36/* 37 * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver. 38 * 39 * Written by Bill Paul <wpaul@windriver.com> 40 * Senior Networking Software Engineer 41 * Wind River Systems 42 */ --- 320 unchanged lines hidden (view full) --- 363vge_miibus_readreg(device_t dev, int phy, int reg) 364{ 365 struct vge_softc *sc; 366 int i; 367 uint16_t rval = 0; 368 369 sc = device_get_softc(dev); 370 | 35 36/* 37 * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver. 38 * 39 * Written by Bill Paul <wpaul@windriver.com> 40 * Senior Networking Software Engineer 41 * Wind River Systems 42 */ --- 320 unchanged lines hidden (view full) --- 363vge_miibus_readreg(device_t dev, int phy, int reg) 364{ 365 struct vge_softc *sc; 366 int i; 367 uint16_t rval = 0; 368 369 sc = device_get_softc(dev); 370 |
371 if (phy != sc->vge_phyaddr) 372 return (0); 373 | |
374 vge_miipoll_stop(sc); 375 376 /* Specify the register we want to read. */ 377 CSR_WRITE_1(sc, VGE_MIIADDR, reg); 378 379 /* Issue read command. */ 380 CSR_SETBIT_1(sc, VGE_MIICMD, VGE_MIICMD_RCMD); 381 --- 17 unchanged lines hidden (view full) --- 399static int 400vge_miibus_writereg(device_t dev, int phy, int reg, int data) 401{ 402 struct vge_softc *sc; 403 int i, rval = 0; 404 405 sc = device_get_softc(dev); 406 | 371 vge_miipoll_stop(sc); 372 373 /* Specify the register we want to read. */ 374 CSR_WRITE_1(sc, VGE_MIIADDR, reg); 375 376 /* Issue read command. */ 377 CSR_SETBIT_1(sc, VGE_MIICMD, VGE_MIICMD_RCMD); 378 --- 17 unchanged lines hidden (view full) --- 396static int 397vge_miibus_writereg(device_t dev, int phy, int reg, int data) 398{ 399 struct vge_softc *sc; 400 int i, rval = 0; 401 402 sc = device_get_softc(dev); 403 |
407 if (phy != sc->vge_phyaddr) 408 return (0); 409 | |
410 vge_miipoll_stop(sc); 411 412 /* Specify the register we want to write. */ 413 CSR_WRITE_1(sc, VGE_MIIADDR, reg); 414 415 /* Specify the data we want to write. */ 416 CSR_WRITE_2(sc, VGE_MIIDATA, data); 417 --- 668 unchanged lines hidden (view full) --- 1086 ifp = sc->vge_ifp = if_alloc(IFT_ETHER); 1087 if (ifp == NULL) { 1088 device_printf(dev, "can not if_alloc()\n"); 1089 error = ENOSPC; 1090 goto fail; 1091 } 1092 1093 /* Do MII setup */ | 404 vge_miipoll_stop(sc); 405 406 /* Specify the register we want to write. */ 407 CSR_WRITE_1(sc, VGE_MIIADDR, reg); 408 409 /* Specify the data we want to write. */ 410 CSR_WRITE_2(sc, VGE_MIIDATA, data); 411 --- 668 unchanged lines hidden (view full) --- 1080 ifp = sc->vge_ifp = if_alloc(IFT_ETHER); 1081 if (ifp == NULL) { 1082 device_printf(dev, "can not if_alloc()\n"); 1083 error = ENOSPC; 1084 goto fail; 1085 } 1086 1087 /* Do MII setup */ |
1094 if (mii_phy_probe(dev, &sc->vge_miibus, 1095 vge_ifmedia_upd, vge_ifmedia_sts)) { 1096 device_printf(dev, "MII without any phy!\n"); 1097 error = ENXIO; | 1088 error = mii_attach(dev, &sc->vge_miibus, ifp, vge_ifmedia_upd, 1089 vge_ifmedia_sts, BMSR_DEFCAPMASK, sc->vge_phyaddr, MII_OFFSET_ANY, 1090 0); 1091 if (error != 0) { 1092 device_printf(dev, "attaching PHYs failed\n"); |
1098 goto fail; 1099 } 1100 1101 ifp->if_softc = sc; 1102 if_initname(ifp, device_get_name(dev), device_get_unit(dev)); 1103 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 1104 ifp->if_ioctl = vge_ioctl; 1105 ifp->if_capabilities = IFCAP_VLAN_MTU; --- 1782 unchanged lines hidden --- | 1093 goto fail; 1094 } 1095 1096 ifp->if_softc = sc; 1097 if_initname(ifp, device_get_name(dev), device_get_unit(dev)); 1098 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 1099 ifp->if_ioctl = vge_ioctl; 1100 ifp->if_capabilities = IFCAP_VLAN_MTU; --- 1782 unchanged lines hidden --- |