Deleted Added
full compact
ciphy.c (139749) ciphy.c (150763)
1/*-
2 * Copyright (c) 2004
3 * Bill Paul <wpaul@windriver.com>. 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 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 *
1/*-
2 * Copyright (c) 2004
3 * Bill Paul <wpaul@windriver.com>. 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 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * $FreeBSD: head/sys/dev/mii/ciphy.c 139749 2005-01-06 01:43:34Z imp $
32 * $FreeBSD: head/sys/dev/mii/ciphy.c 150763 2005-09-30 19:39:27Z imp $
33 */
34
35#include <sys/cdefs.h>
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sys/dev/mii/ciphy.c 139749 2005-01-06 01:43:34Z imp $");
36__FBSDID("$FreeBSD: head/sys/dev/mii/ciphy.c 150763 2005-09-30 19:39:27Z imp $");
37
38/*
39 * Driver for the Cicada CS8201 10/100/1000 copper PHY.
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/kernel.h>

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

87DRIVER_MODULE(ciphy, miibus, ciphy_driver, ciphy_devclass, 0, 0);
88
89static int ciphy_service(struct mii_softc *, struct mii_data *, int);
90static void ciphy_status(struct mii_softc *);
91static void ciphy_reset(struct mii_softc *);
92static void ciphy_fixup(struct mii_softc *);
93
94static int
37
38/*
39 * Driver for the Cicada CS8201 10/100/1000 copper PHY.
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/kernel.h>

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

87DRIVER_MODULE(ciphy, miibus, ciphy_driver, ciphy_devclass, 0, 0);
88
89static int ciphy_service(struct mii_softc *, struct mii_data *, int);
90static void ciphy_status(struct mii_softc *);
91static void ciphy_reset(struct mii_softc *);
92static void ciphy_fixup(struct mii_softc *);
93
94static int
95ciphy_probe(dev)
96 device_t dev;
95ciphy_probe(device_t dev)
97{
98 struct mii_attach_args *ma;
99
100 ma = device_get_ivars(dev);
101
102 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_CICADA &&
103 MII_MODEL(ma->mii_id2) == MII_MODEL_CICADA_CS8201) {
104 device_set_desc(dev, MII_STR_CICADA_CS8201);

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

116 device_set_desc(dev, MII_STR_CICADA_CS8201B);
117 return(0);
118 }
119
120 return(ENXIO);
121}
122
123static int
96{
97 struct mii_attach_args *ma;
98
99 ma = device_get_ivars(dev);
100
101 if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_CICADA &&
102 MII_MODEL(ma->mii_id2) == MII_MODEL_CICADA_CS8201) {
103 device_set_desc(dev, MII_STR_CICADA_CS8201);

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

115 device_set_desc(dev, MII_STR_CICADA_CS8201B);
116 return(0);
117 }
118
119 return(ENXIO);
120}
121
122static int
124ciphy_attach(dev)
125 device_t dev;
123ciphy_attach(device_t dev)
126{
127 struct mii_softc *sc;
128 struct mii_attach_args *ma;
129 struct mii_data *mii;
130
131 sc = device_get_softc(dev);
132 ma = device_get_ivars(dev);
133 sc->mii_dev = device_get_parent(dev);

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

152 mii_phy_add_media(sc);
153 printf("\n");
154
155 MIIBUS_MEDIAINIT(sc->mii_dev);
156 return(0);
157}
158
159static int
124{
125 struct mii_softc *sc;
126 struct mii_attach_args *ma;
127 struct mii_data *mii;
128
129 sc = device_get_softc(dev);
130 ma = device_get_ivars(dev);
131 sc->mii_dev = device_get_parent(dev);

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

150 mii_phy_add_media(sc);
151 printf("\n");
152
153 MIIBUS_MEDIAINIT(sc->mii_dev);
154 return(0);
155}
156
157static int
160ciphy_service(sc, mii, cmd)
161 struct mii_softc *sc;
162 struct mii_data *mii;
163 int cmd;
158ciphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
164{
165 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
166 int reg, speed, gig;
167
168 switch (cmd) {
169 case MII_POLLSTAT:
170 /*
171 * If we're not polling our PHY instance, just return.

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

307 cmd == MII_MEDIACHG) {
308 ciphy_fixup(sc);
309 }
310 mii_phy_update(sc, cmd);
311 return (0);
312}
313
314static void
159{
160 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
161 int reg, speed, gig;
162
163 switch (cmd) {
164 case MII_POLLSTAT:
165 /*
166 * If we're not polling our PHY instance, just return.

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

302 cmd == MII_MEDIACHG) {
303 ciphy_fixup(sc);
304 }
305 mii_phy_update(sc, cmd);
306 return (0);
307}
308
309static void
315ciphy_status(sc)
316 struct mii_softc *sc;
310ciphy_status(struct mii_softc *sc)
317{
318 struct mii_data *mii = sc->mii_pdata;
319 int bmsr, bmcr;
320
321 mii->mii_media_status = IFM_AVALID;
322 mii->mii_media_active = IFM_ETHER;
323
324 bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);

--- 109 unchanged lines hidden ---
311{
312 struct mii_data *mii = sc->mii_pdata;
313 int bmsr, bmcr;
314
315 mii->mii_media_status = IFM_AVALID;
316 mii->mii_media_active = IFM_ETHER;
317
318 bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);

--- 109 unchanged lines hidden ---