| @@ -1,41 +1,41 @@ | | | @@ -1,41 +1,41 @@ |
1 | /* $NetBSD: if_mvgbe.c,v 1.10 2011/07/30 19:06:57 rjs Exp $ */ | | 1 | /* $NetBSD: if_mvgbe.c,v 1.11 2011/09/01 14:39:03 jakllsch Exp $ */ |
2 | /* | | 2 | /* |
3 | * Copyright (c) 2007, 2008 KIYOHARA Takashi | | 3 | * Copyright (c) 2007, 2008 KIYOHARA Takashi |
4 | * All rights reserved. | | 4 | * All rights reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | | 18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | | 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
23 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | | 23 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
24 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 24 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 | * POSSIBILITY OF SUCH DAMAGE. | | 25 | * POSSIBILITY OF SUCH DAMAGE. |
26 | */ | | 26 | */ |
27 | #include <sys/cdefs.h> | | 27 | #include <sys/cdefs.h> |
28 | __KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.10 2011/07/30 19:06:57 rjs Exp $"); | | 28 | __KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.11 2011/09/01 14:39:03 jakllsch Exp $"); |
29 | | | 29 | |
30 | #include "rnd.h" | | 30 | #include "rnd.h" |
31 | | | 31 | |
32 | #include <sys/param.h> | | 32 | #include <sys/param.h> |
33 | #include <sys/bus.h> | | 33 | #include <sys/bus.h> |
34 | #include <sys/device.h> | | 34 | #include <sys/device.h> |
35 | #include <sys/endian.h> | | 35 | #include <sys/endian.h> |
36 | #include <sys/errno.h> | | 36 | #include <sys/errno.h> |
37 | #include <sys/kmem.h> | | 37 | #include <sys/kmem.h> |
38 | #include <sys/mutex.h> | | 38 | #include <sys/mutex.h> |
39 | #include <sys/sockio.h> | | 39 | #include <sys/sockio.h> |
40 | | | 40 | |
41 | #include <dev/marvell/marvellreg.h> | | 41 | #include <dev/marvell/marvellreg.h> |
| @@ -970,26 +970,27 @@ mvgbe_init(struct ifnet *ifp) | | | @@ -970,26 +970,27 @@ mvgbe_init(struct ifnet *ifp) |
970 | | | 970 | |
971 | /* Init TX/RX descriptors */ | | 971 | /* Init TX/RX descriptors */ |
972 | if (mvgbe_init_tx_ring(sc) == ENOBUFS) { | | 972 | if (mvgbe_init_tx_ring(sc) == ENOBUFS) { |
973 | aprint_error_ifnet(ifp, | | 973 | aprint_error_ifnet(ifp, |
974 | "initialization failed: no memory for tx buffers\n"); | | 974 | "initialization failed: no memory for tx buffers\n"); |
975 | return ENOBUFS; | | 975 | return ENOBUFS; |
976 | } | | 976 | } |
977 | if (mvgbe_init_rx_ring(sc) == ENOBUFS) { | | 977 | if (mvgbe_init_rx_ring(sc) == ENOBUFS) { |
978 | aprint_error_ifnet(ifp, | | 978 | aprint_error_ifnet(ifp, |
979 | "initialization failed: no memory for rx buffers\n"); | | 979 | "initialization failed: no memory for rx buffers\n"); |
980 | return ENOBUFS; | | 980 | return ENOBUFS; |
981 | } | | 981 | } |
982 | | | 982 | |
| | | 983 | MVGBE_WRITE(sc, MVGBE_MTU, 0); /* hw reset value is wrong */ |
983 | MVGBE_WRITE(sc, MVGBE_PSC, | | 984 | MVGBE_WRITE(sc, MVGBE_PSC, |
984 | MVGBE_PSC_ANFC | /* Enable Auto-Neg Flow Ctrl */ | | 985 | MVGBE_PSC_ANFC | /* Enable Auto-Neg Flow Ctrl */ |
985 | MVGBE_PSC_RESERVED | /* Must be set to 1 */ | | 986 | MVGBE_PSC_RESERVED | /* Must be set to 1 */ |
986 | MVGBE_PSC_FLFAIL | /* Do NOT Force Link Fail */ | | 987 | MVGBE_PSC_FLFAIL | /* Do NOT Force Link Fail */ |
987 | MVGBE_PSC_MRU(MVGBE_PSC_MRU_9022) | /* we want 9k */ | | 988 | MVGBE_PSC_MRU(MVGBE_PSC_MRU_9022) | /* we want 9k */ |
988 | MVGBE_PSC_SETFULLDX); /* Set_FullDx */ | | 989 | MVGBE_PSC_SETFULLDX); /* Set_FullDx */ |
989 | /* XXXX: mvgbe(4) always use RGMII. */ | | 990 | /* XXXX: mvgbe(4) always use RGMII. */ |
990 | MVGBE_WRITE(sc, MVGBE_PSC1, | | 991 | MVGBE_WRITE(sc, MVGBE_PSC1, |
991 | MVGBE_READ(sc, MVGBE_PSC1) | MVGBE_PSC1_RGMIIEN); | | 992 | MVGBE_READ(sc, MVGBE_PSC1) | MVGBE_PSC1_RGMIIEN); |
992 | /* XXXX: Also always Weighted Round-Robin Priority Mode */ | | 993 | /* XXXX: Also always Weighted Round-Robin Priority Mode */ |
993 | MVGBE_WRITE(sc, MVGBE_TQFPC, MVGBE_TQFPC_EN(0)); | | 994 | MVGBE_WRITE(sc, MVGBE_TQFPC, MVGBE_TQFPC_EN(0)); |
994 | | | 995 | |
995 | MVGBE_WRITE(sc, MVGBE_CRDP(0), MVGBE_RX_RING_ADDR(sc, 0)); | | 996 | MVGBE_WRITE(sc, MVGBE_CRDP(0), MVGBE_RX_RING_ADDR(sc, 0)); |