This source file includes following definitions.
- ax88190_media_init
- ax88190_media_fini
- ax88190_mediachange
- ax88190_mediastatus
- ax88190_init_card
- ax88190_stop_card
- ax88190_mii_bitbang_read
- ax88190_mii_bitbang_write
- ax88190_mii_readreg
- ax88190_mii_writereg
- ax88190_mii_statchg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 #include <sys/param.h>
41 #include <sys/systm.h>
42 #include <sys/device.h>
43 #include <sys/socket.h>
44
45 #include <net/if.h>
46 #include <net/if_dl.h>
47 #include <net/if_types.h>
48 #include <net/if_media.h>
49
50 #ifdef INET
51 #include <netinet/in.h>
52 #include <netinet/in_systm.h>
53 #include <netinet/in_var.h>
54 #include <netinet/ip.h>
55 #include <netinet/if_ether.h>
56 #endif
57
58 #include <machine/bus.h>
59
60 #include <dev/mii/miivar.h>
61 #include <dev/mii/mii.h>
62 #include <dev/mii/mii_bitbang.h>
63
64 #include <dev/ic/dp8390reg.h>
65 #include <dev/ic/dp8390var.h>
66
67 #include <dev/ic/ne2000reg.h>
68 #include <dev/ic/ne2000var.h>
69
70 #include <dev/ic/ax88190reg.h>
71 #include <dev/ic/ax88190var.h>
72
73 int ax88190_mii_readreg(struct device *, int, int);
74 void ax88190_mii_writereg(struct device *, int, int, int);
75 void ax88190_mii_statchg(struct device *);
76
77
78
79
80 u_int32_t ax88190_mii_bitbang_read(struct device *);
81 void ax88190_mii_bitbang_write(struct device *, u_int32_t);
82
83 const struct mii_bitbang_ops ax88190_mii_bitbang_ops = {
84 ax88190_mii_bitbang_read,
85 ax88190_mii_bitbang_write,
86 {
87 AX88190_MEMR_MDO,
88 AX88190_MEMR_MDI,
89 AX88190_MEMR_MDC,
90 0,
91 AX88190_MEMR_MDIR,
92 }
93 };
94
95 void
96 ax88190_media_init(struct dp8390_softc *sc)
97 {
98 struct ifnet *ifp = &sc->sc_arpcom.ac_if;
99
100 sc->sc_mii.mii_ifp = ifp;
101 sc->sc_mii.mii_readreg = ax88190_mii_readreg;
102 sc->sc_mii.mii_writereg = ax88190_mii_writereg;
103 sc->sc_mii.mii_statchg = ax88190_mii_statchg;
104 ifmedia_init(&sc->sc_mii.mii_media, 0, dp8390_mediachange,
105 dp8390_mediastatus);
106
107 mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
108 MII_OFFSET_ANY, 0);
109
110 if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
111 ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0,
112 NULL);
113 ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE);
114 } else
115 ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
116 }
117
118 void
119 ax88190_media_fini(struct dp8390_softc *sc)
120 {
121 mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
122 }
123
124 int
125 ax88190_mediachange(struct dp8390_softc *sc)
126 {
127 mii_mediachg(&sc->sc_mii);
128 return (0);
129 }
130
131 void
132 ax88190_mediastatus(struct dp8390_softc *sc, struct ifmediareq *ifmr)
133 {
134 mii_pollstat(&sc->sc_mii);
135 ifmr->ifm_status = sc->sc_mii.mii_media_status;
136 ifmr->ifm_active = sc->sc_mii.mii_media_active;
137 }
138
139 void
140 ax88190_init_card(struct dp8390_softc *sc)
141 {
142 mii_mediachg(&sc->sc_mii);
143 }
144
145 void
146 ax88190_stop_card(struct dp8390_softc *sc)
147 {
148 mii_down(&sc->sc_mii);
149 }
150
151 u_int32_t
152 ax88190_mii_bitbang_read(self)
153 struct device *self;
154 {
155 struct ne2000_softc *sc = (void *)self;
156
157 return (bus_space_read_1(sc->sc_asict, sc->sc_asich, AX88190_MEMR));
158 }
159
160 void
161 ax88190_mii_bitbang_write(self, val)
162 struct device *self;
163 u_int32_t val;
164 {
165 struct ne2000_softc *sc = (void *)self;
166
167 bus_space_write_1(sc->sc_asict, sc->sc_asich, AX88190_MEMR, val);
168 }
169
170 int
171 ax88190_mii_readreg(self, phy, reg)
172 struct device *self;
173 int phy, reg;
174 {
175 return (mii_bitbang_readreg(self, &ax88190_mii_bitbang_ops, phy, reg));
176 }
177
178 void
179 ax88190_mii_writereg(self, phy, reg, val)
180 struct device *self;
181 int phy, reg, val;
182 {
183 mii_bitbang_writereg(self, &ax88190_mii_bitbang_ops, phy, reg, val);
184 }
185
186 void
187 ax88190_mii_statchg(self)
188 struct device *self;
189 {
190
191 }