if_tsec.c (199580) | if_tsec.c (209908) |
---|---|
1/*- | 1/*- |
2 * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski <raj@semihalf.com> 3 * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski <ppk@semihalf.com> | 2 * Copyright (C) 2007-2008 Semihalf, Rafal Jaworowski 3 * Copyright (C) 2006-2007 Semihalf, Piotr Kruszynski |
4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright --- 11 unchanged lines hidden (view full) --- 23 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27/* 28 * Freescale integrated Three-Speed Ethernet Controller (TSEC) driver. 29 */ 30#include <sys/cdefs.h> | 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright --- 11 unchanged lines hidden (view full) --- 23 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27/* 28 * Freescale integrated Three-Speed Ethernet Controller (TSEC) driver. 29 */ 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/tsec/if_tsec.c 199580 2009-11-20 13:28:06Z raj $"); | 31__FBSDID("$FreeBSD: head/sys/dev/tsec/if_tsec.c 209908 2010-07-11 21:08:29Z raj $"); |
32 33#ifdef HAVE_KERNEL_OPTION_HEADERS 34#include "opt_device_polling.h" 35#endif 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/bus.h> --- 1518 unchanged lines hidden (view full) --- 1558int 1559tsec_miibus_readreg(device_t dev, int phy, int reg) 1560{ 1561 struct tsec_softc *sc; 1562 uint32_t timeout; 1563 1564 sc = device_get_softc(dev); 1565 | 32 33#ifdef HAVE_KERNEL_OPTION_HEADERS 34#include "opt_device_polling.h" 35#endif 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/bus.h> --- 1518 unchanged lines hidden (view full) --- 1558int 1559tsec_miibus_readreg(device_t dev, int phy, int reg) 1560{ 1561 struct tsec_softc *sc; 1562 uint32_t timeout; 1563 1564 sc = device_get_softc(dev); 1565 |
1566 if (device_get_unit(dev) != phy) | 1566 if (sc->phyaddr != phy) |
1567 return (0); 1568 1569 sc = tsec0_sc; 1570 1571 TSEC_WRITE(sc, TSEC_REG_MIIMADD, (phy << 8) | reg); 1572 TSEC_WRITE(sc, TSEC_REG_MIIMCOM, 0); 1573 TSEC_WRITE(sc, TSEC_REG_MIIMCOM, TSEC_MIIMCOM_READCYCLE); 1574 --- 11 unchanged lines hidden (view full) --- 1586int 1587tsec_miibus_writereg(device_t dev, int phy, int reg, int value) 1588{ 1589 struct tsec_softc *sc; 1590 uint32_t timeout; 1591 1592 sc = device_get_softc(dev); 1593 | 1567 return (0); 1568 1569 sc = tsec0_sc; 1570 1571 TSEC_WRITE(sc, TSEC_REG_MIIMADD, (phy << 8) | reg); 1572 TSEC_WRITE(sc, TSEC_REG_MIIMCOM, 0); 1573 TSEC_WRITE(sc, TSEC_REG_MIIMCOM, TSEC_MIIMCOM_READCYCLE); 1574 --- 11 unchanged lines hidden (view full) --- 1586int 1587tsec_miibus_writereg(device_t dev, int phy, int reg, int value) 1588{ 1589 struct tsec_softc *sc; 1590 uint32_t timeout; 1591 1592 sc = device_get_softc(dev); 1593 |
1594 if (device_get_unit(dev) != phy) 1595 device_printf(dev, "Trying to write to an alien PHY(%d)\n", 1596 phy); | 1594 if (sc->phyaddr != phy) 1595 return (0); |
1597 1598 sc = tsec0_sc; 1599 1600 TSEC_WRITE(sc, TSEC_REG_MIIMADD, (phy << 8) | reg); 1601 TSEC_WRITE(sc, TSEC_REG_MIIMCON, value); 1602 1603 timeout = TSEC_READ_RETRY; 1604 while (--timeout && (TSEC_READ(sc, TSEC_REG_MIIMIND) & --- 329 unchanged lines hidden --- | 1596 1597 sc = tsec0_sc; 1598 1599 TSEC_WRITE(sc, TSEC_REG_MIIMADD, (phy << 8) | reg); 1600 TSEC_WRITE(sc, TSEC_REG_MIIMCON, value); 1601 1602 timeout = TSEC_READ_RETRY; 1603 while (--timeout && (TSEC_READ(sc, TSEC_REG_MIIMIND) & --- 329 unchanged lines hidden --- |