| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: rlphy.c,v 1.26 2010/11/14 13:40:36 mlelstv Exp $ */ | | 1 | /* $NetBSD: rlphy.c,v 1.27 2011/01/20 14:26:11 pooka Exp $ */ |
2 | /* $OpenBSD: rlphy.c,v 1.20 2005/07/31 05:27:30 pvalchev Exp $ */ | | 2 | /* $OpenBSD: rlphy.c,v 1.20 2005/07/31 05:27:30 pvalchev Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 1998, 1999 Jason L. Wright (jason@thought.net) | | 5 | * Copyright (c) 1998, 1999 Jason L. Wright (jason@thought.net) |
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, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -28,27 +28,27 @@ | | | @@ -28,27 +28,27 @@ |
28 | */ | | 28 | */ |
29 | | | 29 | |
30 | /* | | 30 | /* |
31 | * Driver for the internal PHY found on RTL8139 based nics, based | | 31 | * Driver for the internal PHY found on RTL8139 based nics, based |
32 | * on drivers for the 'exphy' (Internal 3Com phys) and 'nsphy' | | 32 | * on drivers for the 'exphy' (Internal 3Com phys) and 'nsphy' |
33 | * (National Semiconductor DP83840). | | 33 | * (National Semiconductor DP83840). |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | /* | | 36 | /* |
37 | * Ported to NetBSD by Juan Romero Pardines <xtraeme@NetBSD.org> | | 37 | * Ported to NetBSD by Juan Romero Pardines <xtraeme@NetBSD.org> |
38 | */ | | 38 | */ |
39 | | | 39 | |
40 | #include <sys/cdefs.h> | | 40 | #include <sys/cdefs.h> |
41 | __KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.26 2010/11/14 13:40:36 mlelstv Exp $"); | | 41 | __KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.27 2011/01/20 14:26:11 pooka Exp $"); |
42 | | | 42 | |
43 | #include <sys/param.h> | | 43 | #include <sys/param.h> |
44 | #include <sys/systm.h> | | 44 | #include <sys/systm.h> |
45 | #include <sys/kernel.h> | | 45 | #include <sys/kernel.h> |
46 | #include <sys/device.h> | | 46 | #include <sys/device.h> |
47 | #include <sys/socket.h> | | 47 | #include <sys/socket.h> |
48 | #include <sys/errno.h> | | 48 | #include <sys/errno.h> |
49 | | | 49 | |
50 | #include <net/if.h> | | 50 | #include <net/if.h> |
51 | #include <net/if_media.h> | | 51 | #include <net/if_media.h> |
52 | | | 52 | |
53 | #include <dev/mii/mii.h> | | 53 | #include <dev/mii/mii.h> |
54 | #include <dev/mii/miivar.h> | | 54 | #include <dev/mii/miivar.h> |
| @@ -80,26 +80,30 @@ static const struct mii_phydesc rlphys[] | | | @@ -80,26 +80,30 @@ static const struct mii_phydesc rlphys[] |
80 | { MII_OUI_yyREALTEK, MII_MODEL_yyREALTEK_RTL8201L, | | 80 | { MII_OUI_yyREALTEK, MII_MODEL_yyREALTEK_RTL8201L, |
81 | MII_STR_yyREALTEK_RTL8201L }, | | 81 | MII_STR_yyREALTEK_RTL8201L }, |
82 | { MII_OUI_ICPLUS, MII_MODEL_ICPLUS_IP101, | | 82 | { MII_OUI_ICPLUS, MII_MODEL_ICPLUS_IP101, |
83 | MII_STR_ICPLUS_IP101 }, | | 83 | MII_STR_ICPLUS_IP101 }, |
84 | | | 84 | |
85 | { 0, 0, | | 85 | { 0, 0, |
86 | NULL }, | | 86 | NULL }, |
87 | }; | | 87 | }; |
88 | | | 88 | |
89 | int | | 89 | int |
90 | rlphymatch(device_t parent, cfdata_t match, void *aux) | | 90 | rlphymatch(device_t parent, cfdata_t match, void *aux) |
91 | { | | 91 | { |
92 | struct mii_attach_args *ma = aux; | | 92 | struct mii_attach_args *ma = aux; |
| | | 93 | struct mii_data *mii = ma->mii_data; |
| | | 94 | |
| | | 95 | if (mii->mii_instance != 0) |
| | | 96 | return 0; |
93 | | | 97 | |
94 | if (mii_phy_match(ma, rlphys) != NULL) | | 98 | if (mii_phy_match(ma, rlphys) != NULL) |
95 | return (10); | | 99 | return (10); |
96 | | | 100 | |
97 | if (MII_OUI(ma->mii_id1, ma->mii_id2) != 0 || | | 101 | if (MII_OUI(ma->mii_id1, ma->mii_id2) != 0 || |
98 | MII_MODEL(ma->mii_id2) != 0) | | 102 | MII_MODEL(ma->mii_id2) != 0) |
99 | return 0; | | 103 | return 0; |
100 | | | 104 | |
101 | if (!device_is_a(parent, "rtk") && !device_is_a(parent, "re")) | | 105 | if (!device_is_a(parent, "rtk") && !device_is_a(parent, "re")) |
102 | return 0; | | 106 | return 0; |
103 | | | 107 | |
104 | /* | | 108 | /* |
105 | * A "real" phy should get preference, but on the 8139 there | | 109 | * A "real" phy should get preference, but on the 8139 there |