Sat Sep 6 18:19:54 2014 UTC ()
Initialize ec_mii


(matt)
diff -r1.5 -r1.6 src/sys/arch/arm/allwinner/awin_eth.c

cvs diff -r1.5 -r1.6 src/sys/arch/arm/allwinner/Attic/awin_eth.c (expand / switch to unified diff)

--- src/sys/arch/arm/allwinner/Attic/awin_eth.c 2014/08/10 16:44:33 1.5
+++ src/sys/arch/arm/allwinner/Attic/awin_eth.c 2014/09/06 18:19:54 1.6
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE. 27 * POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30#include "locators.h" 30#include "locators.h"
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33 33
34__KERNEL_RCSID(1, "$NetBSD: awin_eth.c,v 1.5 2014/08/10 16:44:33 tls Exp $"); 34__KERNEL_RCSID(1, "$NetBSD: awin_eth.c,v 1.6 2014/09/06 18:19:54 matt Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/bus.h> 37#include <sys/bus.h>
38#include <sys/device.h> 38#include <sys/device.h>
39#include <sys/intr.h> 39#include <sys/intr.h>
40#include <sys/ioctl.h> 40#include <sys/ioctl.h>
41#include <sys/mutex.h> 41#include <sys/mutex.h>
42#include <sys/rnd.h> 42#include <sys/rnd.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44 44
45#include <net/if.h> 45#include <net/if.h>
46#include <net/if_ether.h> 46#include <net/if_ether.h>
47#include <net/if_media.h> 47#include <net/if_media.h>
@@ -162,26 +162,27 @@ static void @@ -162,26 +162,27 @@ static void
162awin_eth_attach(device_t parent, device_t self, void *aux) 162awin_eth_attach(device_t parent, device_t self, void *aux)
163{ 163{
164 cfdata_t cf = device_cfdata(self); 164 cfdata_t cf = device_cfdata(self);
165 struct awin_eth_softc * const sc = device_private(self); 165 struct awin_eth_softc * const sc = device_private(self);
166 struct awinio_attach_args * const aio = aux; 166 struct awinio_attach_args * const aio = aux;
167 const struct awin_locators * const loc = &aio->aio_loc; 167 const struct awin_locators * const loc = &aio->aio_loc;
168 const struct awin_gpio_pinset * const pinset = 168 const struct awin_gpio_pinset * const pinset =
169 &awin_eth_pinsets[cf->cf_flags & 1]; 169 &awin_eth_pinsets[cf->cf_flags & 1];
170 struct ifnet * const ifp = &sc->sc_ec.ec_if; 170 struct ifnet * const ifp = &sc->sc_ec.ec_if;
171 struct mii_data * const mii = &sc->sc_mii; 171 struct mii_data * const mii = &sc->sc_mii;
172 char enaddr[ETHER_ADDR_LEN]; 172 char enaddr[ETHER_ADDR_LEN];
173 173
174 sc->sc_dev = self; 174 sc->sc_dev = self;
 175 sc->sc_ec.ec_mii = mii;
175 176
176 awin_gpio_pinset_acquire(pinset); 177 awin_gpio_pinset_acquire(pinset);
177 awin_reg_set_clear(aio->aio_core_bst, aio->aio_ccm_bsh, 178 awin_reg_set_clear(aio->aio_core_bst, aio->aio_ccm_bsh,
178 AWIN_AHB_GATING0_REG, AWIN_AHB_GATING0_EMAC, 0); 179 AWIN_AHB_GATING0_REG, AWIN_AHB_GATING0_EMAC, 0);
179 /* 180 /*
180 * Give 13KB of SRAM to EMAC 181 * Give 13KB of SRAM to EMAC
181 */ 182 */
182 awin_reg_set_clear(aio->aio_core_bst, aio->aio_core_bsh, 183 awin_reg_set_clear(aio->aio_core_bst, aio->aio_core_bsh,
183 AWIN_SRAM_OFFSET + AWIN_SRAM_CTL1_REG, 184 AWIN_SRAM_OFFSET + AWIN_SRAM_CTL1_REG,
184 __SHIFTIN(AWIN_SRAM_CTL1_A3_A4_EMAC, AWIN_SRAM_CTL1_A3_A4), 185 __SHIFTIN(AWIN_SRAM_CTL1_A3_A4_EMAC, AWIN_SRAM_CTL1_A3_A4),
185 AWIN_SRAM_CTL1_A3_A4); 186 AWIN_SRAM_CTL1_A3_A4);
186 187
187 mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_NET); 188 mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_NET);