Module Name: src Committed By: matt Date: Tue Sep 4 22:58:35 UTC 2012
Modified Files: src/sys/arch/evbarm/gumstix: if_smsh_gpmc.c Log Message: Add support for getting the mac-address from the device properties. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c diff -u src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c:1.2 src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c:1.3 --- src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c:1.2 Tue Sep 4 00:19:48 2012 +++ src/sys/arch/evbarm/gumstix/if_smsh_gpmc.c Tue Sep 4 22:58:35 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_smsh_gpmc.c,v 1.2 2012/09/04 00:19:48 matt Exp $ */ +/* $NetBSD: if_smsh_gpmc.c,v 1.3 2012/09/04 22:58:35 matt Exp $ */ /* * Copyright (c) 2010 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_smsh_gpmc.c,v 1.2 2012/09/04 00:19:48 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_smsh_gpmc.c,v 1.3 2012/09/04 22:58:35 matt Exp $"); + +#include "locators.h" #include <sys/param.h> #include <sys/device.h> @@ -34,8 +36,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_smsh_gpmc #include <sys/bus.h> #include <sys/systm.h> -#include <arm/omap/omap2_gpmcvar.h> - #include <net/if.h> #include <net/if_ether.h> #include <net/if_media.h> @@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_smsh_gpmc #include <dev/ic/lan9118var.h> #include <dev/ic/lan9118reg.h> -#include "locators.h" +#include <arm/omap/omap2_gpmcvar.h> static int smsh_gpmc_match(device_t, struct cfdata *, void *); @@ -90,10 +90,23 @@ smsh_gpmc_attach(device_t parent, device { struct lan9118_softc *sc = device_private(self); struct gpmc_attach_args *gpmc = aux; + prop_dictionary_t dict = device_properties(self); void *ih; sc->sc_dev = self; + /* + * Prefer the Ethernet address in device properties. + */ + prop_data_t ea = prop_dictionary_get(dict, "mac-address"); + if (ea != NULL) { + KASSERT(prop_object_type(ea) == PROP_TYPE_DATA); + KASSERT(prop_data_size(ea) == ETHER_ADDR_LEN); + memcpy(sc->sc_enaddr, prop_data_data_nocopy(ea), + ETHER_ADDR_LEN); + sc->sc_flags |= LAN9118_FLAGS_NO_EEPROM; + } + /* Map i/o space. */ if (bus_space_map(gpmc->gpmc_iot, gpmc->gpmc_addr, LAN9118_IOSIZE, 0, &sc->sc_ioh))