| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: amlogic_gmac.c,v 1.1 2015/03/04 12:37:16 jmcneill Exp $ */ | | 1 | /* $NetBSD: amlogic_gmac.c,v 1.2 2015/03/04 18:40:06 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013, 2014, 2015 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2013, 2014, 2015 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Matt Thomas of 3am Software Foundry and Martin Husemann. | | 8 | * by Matt Thomas of 3am Software Foundry and Martin Husemann. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -23,27 +23,27 @@ | | | @@ -23,27 +23,27 @@ |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include "locators.h" | | 32 | #include "locators.h" |
33 | | | 33 | |
34 | #include <sys/cdefs.h> | | 34 | #include <sys/cdefs.h> |
35 | | | 35 | |
36 | __KERNEL_RCSID(1, "$NetBSD: amlogic_gmac.c,v 1.1 2015/03/04 12:37:16 jmcneill Exp $"); | | 36 | __KERNEL_RCSID(1, "$NetBSD: amlogic_gmac.c,v 1.2 2015/03/04 18:40:06 jmcneill Exp $"); |
37 | | | 37 | |
38 | #include <sys/param.h> | | 38 | #include <sys/param.h> |
39 | #include <sys/bus.h> | | 39 | #include <sys/bus.h> |
40 | #include <sys/device.h> | | 40 | #include <sys/device.h> |
41 | #include <sys/intr.h> | | 41 | #include <sys/intr.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | | | 43 | |
44 | #include <arm/amlogic/amlogic_reg.h> | | 44 | #include <arm/amlogic/amlogic_reg.h> |
45 | #include <arm/amlogic/amlogic_var.h> | | 45 | #include <arm/amlogic/amlogic_var.h> |
46 | | | 46 | |
47 | #include <net/if.h> | | 47 | #include <net/if.h> |
48 | #include <net/if_ether.h> | | 48 | #include <net/if_ether.h> |
49 | #include <net/if_media.h> | | 49 | #include <net/if_media.h> |
| @@ -82,27 +82,27 @@ amlogic_gmac_attach(device_t parent, dev | | | @@ -82,27 +82,27 @@ amlogic_gmac_attach(device_t parent, dev |
82 | sc->sc_core.sc_bst = aio->aio_core_bst; | | 82 | sc->sc_core.sc_bst = aio->aio_core_bst; |
83 | sc->sc_core.sc_dmat = aio->aio_dmat; | | 83 | sc->sc_core.sc_dmat = aio->aio_dmat; |
84 | bus_space_subregion(aio->aio_core_bst, aio->aio_bsh, | | 84 | bus_space_subregion(aio->aio_core_bst, aio->aio_bsh, |
85 | loc->loc_offset, loc->loc_size, &sc->sc_core.sc_bsh); | | 85 | loc->loc_offset, loc->loc_size, &sc->sc_core.sc_bsh); |
86 | | | 86 | |
87 | aprint_naive("\n"); | | 87 | aprint_naive("\n"); |
88 | aprint_normal(": Gigabit Ethernet Controller\n"); | | 88 | aprint_normal(": Gigabit Ethernet Controller\n"); |
89 | | | 89 | |
90 | amlogic_eth_init(); | | 90 | amlogic_eth_init(); |
91 | | | 91 | |
92 | /* | | 92 | /* |
93 | * Interrupt handler | | 93 | * Interrupt handler |
94 | */ | | 94 | */ |
95 | sc->sc_ih = intr_establish(loc->loc_intr, IPL_NET, IST_LEVEL, | | 95 | sc->sc_ih = intr_establish(loc->loc_intr, IPL_NET, IST_EDGE, |
96 | amlogic_gmac_intr, sc); | | 96 | amlogic_gmac_intr, sc); |
97 | if (sc->sc_ih == NULL) { | | 97 | if (sc->sc_ih == NULL) { |
98 | aprint_error_dev(self, "failed to establish interrupt %d\n", | | 98 | aprint_error_dev(self, "failed to establish interrupt %d\n", |
99 | loc->loc_intr); | | 99 | loc->loc_intr); |
100 | return; | | 100 | return; |
101 | } | | 101 | } |
102 | aprint_normal_dev(self, "interrupting on irq %d\n", | | 102 | aprint_normal_dev(self, "interrupting on irq %d\n", |
103 | loc->loc_intr); | | 103 | loc->loc_intr); |
104 | | | 104 | |
105 | dwc_gmac_attach(&sc->sc_core, GMAC_MII_CLK_100_150M_DIV62); | | 105 | dwc_gmac_attach(&sc->sc_core, GMAC_MII_CLK_100_150M_DIV62); |
106 | } | | 106 | } |
107 | | | 107 | |
108 | static int | | 108 | static int |