Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Aug 2012 04:43:31 +0000 (UTC)
From:      Tim Kientzle <kientzle@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239722 - head/sys/arm/ti/cpsw
Message-ID:  <201208270443.q7R4hVoL040319@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kientzle
Date: Mon Aug 27 04:43:30 2012
New Revision: 239722
URL: http://svn.freebsd.org/changeset/base/239722

Log:
  Correctly fetch the MAC address.
  
  Break down the bytes directly into the softc;
  the intermediate buffer isn't needed here.
  Break down the bytes in the correct order.

Modified:
  head/sys/arm/ti/cpsw/if_cpsw.c

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==============================================================================
--- head/sys/arm/ti/cpsw/if_cpsw.c	Mon Aug 27 04:30:53 2012	(r239721)
+++ head/sys/arm/ti/cpsw/if_cpsw.c	Mon Aug 27 04:43:30 2012	(r239722)
@@ -216,13 +216,11 @@ cpsw_attach(device_t dev)
 	struct cpsw_softc *sc;
 	struct mii_softc *miisc;
 	struct ifnet *ifp;
-	uint8_t mac_addr[ETHER_ADDR_LEN];
 	int i, error, phy;
 	uint32_t reg;
 
 	sc = device_get_softc(dev);
 	sc->dev = dev;
-	memcpy(sc->mac_addr, mac_addr, ETHER_ADDR_LEN);
 	sc->node = ofw_bus_get_node(dev);
 
 	/* Get phy address from fdt */
@@ -279,17 +277,17 @@ cpsw_attach(device_t dev)
 	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
 	IFQ_SET_READY(&ifp->if_snd);
 
-	/* Get low part of MAC address from control module (mac_id0_lo) */
-	ti_scm_reg_read_4(0x630, &reg);
-	mac_addr[0] = (reg >>  8) & 0xFF;
-	mac_addr[1] = reg & 0xFF;
-
 	/* Get high part of MAC address from control module (mac_id0_hi) */
 	ti_scm_reg_read_4(0x634, &reg);
-	mac_addr[2] = (reg >> 24) & 0xFF;
-	mac_addr[3] = (reg >> 16) & 0xFF;
-	mac_addr[4] = (reg >>  8) & 0xFF;
-	mac_addr[5] = reg & 0xFF;
+	sc->mac_addr[0] = reg & 0xFF;
+	sc->mac_addr[1] = (reg >>  8) & 0xFF;
+	sc->mac_addr[2] = (reg >> 16) & 0xFF;
+	sc->mac_addr[3] = (reg >> 24) & 0xFF;
+
+	/* Get low part of MAC address from control module (mac_id0_lo) */
+	ti_scm_reg_read_4(0x630, &reg);
+	sc->mac_addr[4] = reg & 0xFF;
+	sc->mac_addr[5] = (reg >>  8) & 0xFF;
 
 	ether_ifattach(ifp, sc->mac_addr);
 	callout_init(&sc->wd_callout, 0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208270443.q7R4hVoL040319>