| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: atphy.c,v 1.5.2.2 2009/05/03 23:45:47 snj Exp $ */ | | 1 | /* $NetBSD: atphy.c,v 1.5.2.2.2.1 2015/11/07 20:36:42 snj Exp $ */ |
2 | /* $OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $ */ | | 2 | /* $OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $ */ |
3 | | | 3 | |
4 | /*- | | 4 | /*- |
5 | * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> | | 5 | * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice unmodified, this list of conditions, and the following | | 12 | * notice unmodified, this list of conditions, and the following |
13 | * disclaimer. | | 13 | * disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -23,27 +23,27 @@ | | | @@ -23,27 +23,27 @@ |
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
28 | * SUCH DAMAGE. | | 28 | * SUCH DAMAGE. |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | /* | | 31 | /* |
32 | * Driver for the Attansic F1 10/100/1000 PHY. | | 32 | * Driver for the Attansic F1 10/100/1000 PHY. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | __KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.5.2.2 2009/05/03 23:45:47 snj Exp $"); | | 36 | __KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.5.2.2.2.1 2015/11/07 20:36:42 snj Exp $"); |
37 | | | 37 | |
38 | #include <sys/param.h> | | 38 | #include <sys/param.h> |
39 | #include <sys/systm.h> | | 39 | #include <sys/systm.h> |
40 | #include <sys/kernel.h> | | 40 | #include <sys/kernel.h> |
41 | #include <sys/device.h> | | 41 | #include <sys/device.h> |
42 | #include <sys/socket.h> | | 42 | #include <sys/socket.h> |
43 | | | 43 | |
44 | #include <net/if.h> | | 44 | #include <net/if.h> |
45 | #include <net/if_media.h> | | 45 | #include <net/if_media.h> |
46 | | | 46 | |
47 | #include <dev/mii/mii.h> | | 47 | #include <dev/mii/mii.h> |
48 | #include <dev/mii/miivar.h> | | 48 | #include <dev/mii/miivar.h> |
49 | #include <dev/mii/miidevs.h> | | 49 | #include <dev/mii/miidevs.h> |
| @@ -192,27 +192,27 @@ atphy_service(struct mii_softc *sc, stru | | | @@ -192,27 +192,27 @@ atphy_service(struct mii_softc *sc, stru |
192 | * XXX | | 192 | * XXX |
193 | * Due to an unknown reason powering down PHY resulted | | 193 | * Due to an unknown reason powering down PHY resulted |
194 | * in unexpected results such as inaccessbility of | | 194 | * in unexpected results such as inaccessbility of |
195 | * hardware of freshly rebooted system. Disable | | 195 | * hardware of freshly rebooted system. Disable |
196 | * powering down PHY until I got more information for | | 196 | * powering down PHY until I got more information for |
197 | * Attansic/Atheros PHY hardwares. | | 197 | * Attansic/Atheros PHY hardwares. |
198 | */ | | 198 | */ |
199 | PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_ISO); | | 199 | PHY_WRITE(sc, MII_BMCR, bmcr | BMCR_ISO); |
200 | goto done; | | 200 | goto done; |
201 | default: | | 201 | default: |
202 | return EINVAL; | | 202 | return EINVAL; |
203 | } | | 203 | } |
204 | | | 204 | |
205 | anar = mii_anar(ife->ifm_media); | | 205 | anar = mii_anar(IFM_SUBTYPE(ife->ifm_media)); |
206 | if (((ife->ifm_media & IFM_GMASK) & IFM_FDX) != 0) { | | 206 | if (((ife->ifm_media & IFM_GMASK) & IFM_FDX) != 0) { |
207 | bmcr |= BMCR_FDX; | | 207 | bmcr |= BMCR_FDX; |
208 | /* Enable pause. */ | | 208 | /* Enable pause. */ |
209 | if (sc->mii_flags & MIIF_DOPAUSE) | | 209 | if (sc->mii_flags & MIIF_DOPAUSE) |
210 | anar |= (3 << 10); | | 210 | anar |= (3 << 10); |
211 | } | | 211 | } |
212 | | | 212 | |
213 | if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | | | 213 | if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | |
214 | EXTSR_1000THDX)) != 0) | | 214 | EXTSR_1000THDX)) != 0) |
215 | PHY_WRITE(sc, MII_100T2CR, 0); | | 215 | PHY_WRITE(sc, MII_100T2CR, 0); |
216 | PHY_WRITE(sc, MII_ANAR, anar); | | 216 | PHY_WRITE(sc, MII_ANAR, anar); |
217 | | | 217 | |
218 | /* | | 218 | /* |