Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm/gumstix Add support for getting the mac-addr...
details: https://anonhg.NetBSD.org/src/rev/88306f156fa7
branches: trunk
changeset: 781406:88306f156fa7
user: matt <matt%NetBSD.org@localhost>
date: Tue Sep 04 22:58:35 2012 +0000
description:
Add support for getting the mac-address from the device properties.
diffstat:
sys/arch/evbarm/gumstix/if_smsh_gpmc.c | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diffs (62 lines):
diff -r 0429ce49956b -r 88306f156fa7 sys/arch/evbarm/gumstix/if_smsh_gpmc.c
--- a/sys/arch/evbarm/gumstix/if_smsh_gpmc.c Tue Sep 04 22:31:58 2012 +0000
+++ b/sys/arch/evbarm/gumstix/if_smsh_gpmc.c Tue Sep 04 22:58:35 2012 +0000
@@ -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 @@
#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 @@
#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 @@
{
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))
Home |
Main Index |
Thread Index |
Old Index