Deleted Added
full compact
inphy.c (215905) inphy.c (221407)
1/*-
2 * Copyright (c) 2001 Jonathan Lemon
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Jonathan Lemon
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/mii/inphy.c 215905 2010-11-26 21:41:42Z marius $");
32__FBSDID("$FreeBSD: head/sys/dev/mii/inphy.c 221407 2011-05-03 19:51:29Z marius $");
33
34/*
35 * driver for Intel 82553 and 82555 PHYs
36 */
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/kernel.h>

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

75
76DRIVER_MODULE(inphy, miibus, inphy_driver, inphy_devclass, 0, 0);
77
78static int inphy_service(struct mii_softc *, struct mii_data *, int);
79static void inphy_status(struct mii_softc *);
80static void inphy_reset(struct mii_softc *);
81
82static const struct mii_phydesc inphys[] = {
33
34/*
35 * driver for Intel 82553 and 82555 PHYs
36 */
37
38#include <sys/param.h>
39#include <sys/systm.h>
40#include <sys/kernel.h>

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

75
76DRIVER_MODULE(inphy, miibus, inphy_driver, inphy_devclass, 0, 0);
77
78static int inphy_service(struct mii_softc *, struct mii_data *, int);
79static void inphy_status(struct mii_softc *);
80static void inphy_reset(struct mii_softc *);
81
82static const struct mii_phydesc inphys[] = {
83 MII_PHY_DESC(INTEL, I82553C),
84 MII_PHY_DESC(INTEL, I82555),
85 MII_PHY_DESC(INTEL, I82562EM),
86 MII_PHY_DESC(INTEL, I82562ET),
87 MII_PHY_DESC(xxINTEL, I82553AB),
83 MII_PHY_DESC(xxINTEL, I82553),
84 MII_PHY_DESC(yyINTEL, I82553),
85 MII_PHY_DESC(yyINTEL, I82555),
86 MII_PHY_DESC(yyINTEL, I82562EM),
87 MII_PHY_DESC(yyINTEL, I82562ET),
88 MII_PHY_END
89};
90
88 MII_PHY_END
89};
90
91static const struct mii_phy_funcs inphy_funcs = {
92 inphy_service,
93 inphy_status,
94 inphy_reset
95};
96
91static int
92inphy_probe(device_t dev)
93{
94
95 return (mii_phy_dev_probe(dev, inphys, BUS_PROBE_DEFAULT));
96}
97
98static int
99inphy_attach(device_t dev)
100{
97static int
98inphy_probe(device_t dev)
99{
100
101 return (mii_phy_dev_probe(dev, inphys, BUS_PROBE_DEFAULT));
102}
103
104static int
105inphy_attach(device_t dev)
106{
101 struct mii_softc *sc;
102 struct mii_attach_args *ma;
103 struct mii_data *mii;
104
107
105 sc = device_get_softc(dev);
106 ma = device_get_ivars(dev);
107 sc->mii_dev = device_get_parent(dev);
108 mii = ma->mii_data;
109 LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
110
111 sc->mii_flags = miibus_get_flags(dev);
112 sc->mii_inst = mii->mii_instance++;
113 sc->mii_phy = ma->mii_phyno;
114 sc->mii_service = inphy_service;
115 sc->mii_pdata = mii;
116
117 sc->mii_flags |= MIIF_NOMANPAUSE;
118
119 ifmedia_add(&mii->mii_media,
120 IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
121 MII_MEDIA_100_TX, NULL);
122
123 inphy_reset(sc);
124
125 sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
126 device_printf(dev, " ");
127 mii_phy_add_media(sc);
128 printf("\n");
129
130 MIIBUS_MEDIAINIT(sc->mii_dev);
131
108 mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &inphy_funcs, 1);
132 return (0);
133}
134
135static int
136inphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
137{
138
139 switch (cmd) {

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

152
153 case MII_TICK:
154 if (mii_phy_tick(sc) == EJUSTRETURN)
155 return (0);
156 break;
157 }
158
159 /* Update the media status. */
109 return (0);
110}
111
112static int
113inphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
114{
115
116 switch (cmd) {

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

129
130 case MII_TICK:
131 if (mii_phy_tick(sc) == EJUSTRETURN)
132 return (0);
133 break;
134 }
135
136 /* Update the media status. */
160 inphy_status(sc);
137 PHY_STATUS(sc);
161
162 /* Callback if something changed. */
163 mii_phy_update(sc, cmd);
164 return (0);
165}
166
167static void
168inphy_status(struct mii_softc *sc)

--- 52 unchanged lines hidden ---
138
139 /* Callback if something changed. */
140 mii_phy_update(sc, cmd);
141 return (0);
142}
143
144static void
145inphy_status(struct mii_softc *sc)

--- 52 unchanged lines hidden ---