Deleted Added
full compact
if_re.c (186389) if_re.c (187417)
1/*-
2 * Copyright (c) 1997, 1998-2003
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) 1997, 1998-2003
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/re/if_re.c 186389 2008-12-22 00:46:22Z yongari $");
34__FBSDID("$FreeBSD: head/sys/dev/re/if_re.c 187417 2009-01-19 02:31:27Z yongari $");
35
36/*
37 * RealTek 8139C+/8169/8169S/8110S/8168/8111/8101E PCI NIC driver
38 *
39 * Written by Bill Paul <wpaul@windriver.com>
40 * Senior Networking Software Engineer
41 * Wind River Systems
42 */

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

413
414 if (reg == RL_GMEDIASTAT) {
415 rval = CSR_READ_1(sc, RL_GMEDIASTAT);
416 return (rval);
417 }
418
419 CSR_WRITE_4(sc, RL_PHYAR, reg << 16);
420
35
36/*
37 * RealTek 8139C+/8169/8169S/8110S/8168/8111/8101E PCI NIC driver
38 *
39 * Written by Bill Paul <wpaul@windriver.com>
40 * Senior Networking Software Engineer
41 * Wind River Systems
42 */

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

413
414 if (reg == RL_GMEDIASTAT) {
415 rval = CSR_READ_1(sc, RL_GMEDIASTAT);
416 return (rval);
417 }
418
419 CSR_WRITE_4(sc, RL_PHYAR, reg << 16);
420
421 for (i = 0; i < RL_TIMEOUT; i++) {
421 for (i = 0; i < RL_PHY_TIMEOUT; i++) {
422 rval = CSR_READ_4(sc, RL_PHYAR);
423 if (rval & RL_PHYAR_BUSY)
424 break;
425 DELAY(100);
426 }
427
422 rval = CSR_READ_4(sc, RL_PHYAR);
423 if (rval & RL_PHYAR_BUSY)
424 break;
425 DELAY(100);
426 }
427
428 if (i == RL_TIMEOUT) {
428 if (i == RL_PHY_TIMEOUT) {
429 device_printf(sc->rl_dev, "PHY read failed\n");
430 return (0);
431 }
432
433 return (rval & RL_PHYAR_PHYDATA);
434}
435
436static int
437re_gmii_writereg(device_t dev, int phy, int reg, int data)
438{
439 struct rl_softc *sc;
440 u_int32_t rval;
441 int i;
442
443 sc = device_get_softc(dev);
444
445 CSR_WRITE_4(sc, RL_PHYAR, (reg << 16) |
446 (data & RL_PHYAR_PHYDATA) | RL_PHYAR_BUSY);
447
429 device_printf(sc->rl_dev, "PHY read failed\n");
430 return (0);
431 }
432
433 return (rval & RL_PHYAR_PHYDATA);
434}
435
436static int
437re_gmii_writereg(device_t dev, int phy, int reg, int data)
438{
439 struct rl_softc *sc;
440 u_int32_t rval;
441 int i;
442
443 sc = device_get_softc(dev);
444
445 CSR_WRITE_4(sc, RL_PHYAR, (reg << 16) |
446 (data & RL_PHYAR_PHYDATA) | RL_PHYAR_BUSY);
447
448 for (i = 0; i < RL_TIMEOUT; i++) {
448 for (i = 0; i < RL_PHY_TIMEOUT; i++) {
449 rval = CSR_READ_4(sc, RL_PHYAR);
450 if (!(rval & RL_PHYAR_BUSY))
451 break;
452 DELAY(100);
453 }
454
449 rval = CSR_READ_4(sc, RL_PHYAR);
450 if (!(rval & RL_PHYAR_BUSY))
451 break;
452 DELAY(100);
453 }
454
455 if (i == RL_TIMEOUT) {
455 if (i == RL_PHY_TIMEOUT) {
456 device_printf(sc->rl_dev, "PHY write failed\n");
457 return (0);
458 }
459
460 return (0);
461}
462
463static int

--- 2664 unchanged lines hidden ---
456 device_printf(sc->rl_dev, "PHY write failed\n");
457 return (0);
458 }
459
460 return (0);
461}
462
463static int

--- 2664 unchanged lines hidden ---