Deleted Added
full compact
if_gem.c (223649) if_gem.c (223944)
1/*-
2 * Copyright (C) 2001 Eduardo Horvath.
3 * Copyright (c) 2001-2003 Thomas Moestl
4 * Copyright (c) 2007 Marius Strobl <marius@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * from: NetBSD: gem.c,v 1.21 2002/06/01 23:50:58 lukem Exp
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 2001 Eduardo Horvath.
3 * Copyright (c) 2001-2003 Thomas Moestl
4 * Copyright (c) 2007 Marius Strobl <marius@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * from: NetBSD: gem.c,v 1.21 2002/06/01 23:50:58 lukem Exp
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/gem/if_gem.c 223649 2011-06-28 16:44:02Z marius $");
32__FBSDID("$FreeBSD: head/sys/dev/gem/if_gem.c 223944 2011-07-12 08:20:15Z marius $");
33
34/*
35 * Driver for Apple GMAC, Sun ERI and Sun GEM Ethernet controllers
36 */
37
38#if 0
39#define GEM_DEBUG
40#endif

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

621
622#ifdef GEM_DEBUG
623 CTR2(KTR_GEM, "%s: %s", device_get_name(sc->sc_dev), __func__);
624#endif
625 gem_reset_rx(sc);
626 gem_reset_tx(sc);
627
628 /* Do a full reset. */
33
34/*
35 * Driver for Apple GMAC, Sun ERI and Sun GEM Ethernet controllers
36 */
37
38#if 0
39#define GEM_DEBUG
40#endif

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

621
622#ifdef GEM_DEBUG
623 CTR2(KTR_GEM, "%s: %s", device_get_name(sc->sc_dev), __func__);
624#endif
625 gem_reset_rx(sc);
626 gem_reset_tx(sc);
627
628 /* Do a full reset. */
629 GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX);
629 GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX |
630 (sc->sc_variant == GEM_SUN_ERI ? GEM_ERI_CACHE_LINE_SIZE <<
631 GEM_RESET_CLSZ_SHFT : 0));
630 GEM_BANK2_BARRIER(sc, GEM_RESET, 4,
631 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
632 if (!GEM_BANK2_BITWAIT(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX, 0))
633 device_printf(sc->sc_dev, "cannot reset device\n");
634}
635
636static void
637gem_rxdrain(struct gem_softc *sc)

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

711 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
712 if (!GEM_BANK1_BITWAIT(sc, GEM_RX_CONFIG, GEM_RX_CONFIG_RXDMA_EN, 0))
713 device_printf(sc->sc_dev, "cannot disable RX DMA\n");
714
715 /* Wait 5ms extra. */
716 DELAY(5000);
717
718 /* Reset the ERX. */
632 GEM_BANK2_BARRIER(sc, GEM_RESET, 4,
633 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
634 if (!GEM_BANK2_BITWAIT(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX, 0))
635 device_printf(sc->sc_dev, "cannot reset device\n");
636}
637
638static void
639gem_rxdrain(struct gem_softc *sc)

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

713 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
714 if (!GEM_BANK1_BITWAIT(sc, GEM_RX_CONFIG, GEM_RX_CONFIG_RXDMA_EN, 0))
715 device_printf(sc->sc_dev, "cannot disable RX DMA\n");
716
717 /* Wait 5ms extra. */
718 DELAY(5000);
719
720 /* Reset the ERX. */
719 GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_RX);
721 GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_RX |
722 (sc->sc_variant == GEM_SUN_ERI ? GEM_ERI_CACHE_LINE_SIZE <<
723 GEM_RESET_CLSZ_SHFT : 0));
720 GEM_BANK2_BARRIER(sc, GEM_RESET, 4,
721 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
724 GEM_BANK2_BARRIER(sc, GEM_RESET, 4,
725 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
722 if (!GEM_BANK2_BITWAIT(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX,
723 0)) {
726 if (!GEM_BANK2_BITWAIT(sc, GEM_RESET, GEM_RESET_RX, 0)) {
724 device_printf(sc->sc_dev, "cannot reset receiver\n");
725 return (1);
726 }
727
728 /* Finally, reset RX MAC. */
729 GEM_BANK1_WRITE_4(sc, GEM_MAC_RXRESET, 1);
730 GEM_BANK1_BARRIER(sc, GEM_MAC_RXRESET, 4,
731 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);

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

803 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
804 if (!GEM_BANK1_BITWAIT(sc, GEM_TX_CONFIG, GEM_TX_CONFIG_TXDMA_EN, 0))
805 device_printf(sc->sc_dev, "cannot disable TX DMA\n");
806
807 /* Wait 5ms extra. */
808 DELAY(5000);
809
810 /* Finally, reset the ETX. */
727 device_printf(sc->sc_dev, "cannot reset receiver\n");
728 return (1);
729 }
730
731 /* Finally, reset RX MAC. */
732 GEM_BANK1_WRITE_4(sc, GEM_MAC_RXRESET, 1);
733 GEM_BANK1_BARRIER(sc, GEM_MAC_RXRESET, 4,
734 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);

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

806 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
807 if (!GEM_BANK1_BITWAIT(sc, GEM_TX_CONFIG, GEM_TX_CONFIG_TXDMA_EN, 0))
808 device_printf(sc->sc_dev, "cannot disable TX DMA\n");
809
810 /* Wait 5ms extra. */
811 DELAY(5000);
812
813 /* Finally, reset the ETX. */
811 GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_TX);
814 GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_TX |
815 (sc->sc_variant == GEM_SUN_ERI ? GEM_ERI_CACHE_LINE_SIZE <<
816 GEM_RESET_CLSZ_SHFT : 0));
812 GEM_BANK2_BARRIER(sc, GEM_RESET, 4,
813 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
817 GEM_BANK2_BARRIER(sc, GEM_RESET, 4,
818 BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
814 if (!GEM_BANK2_BITWAIT(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX,
815 0)) {
819 if (!GEM_BANK2_BITWAIT(sc, GEM_RESET, GEM_RESET_TX, 0)) {
816 device_printf(sc->sc_dev, "cannot reset transmitter\n");
817 return (1);
818 }
819 return (0);
820}
821
822static int
823gem_disable_rx(struct gem_softc *sc)

--- 1448 unchanged lines hidden ---
820 device_printf(sc->sc_dev, "cannot reset transmitter\n");
821 return (1);
822 }
823 return (0);
824}
825
826static int
827gem_disable_rx(struct gem_softc *sc)

--- 1448 unchanged lines hidden ---