PERFORCE change 175768 for review

Rafal Jaworowski raj at FreeBSD.org
Wed Mar 17 17:42:44 UTC 2010


http://p4web.freebsd.org/chv.cgi?CH=175768

Change 175768 by raj at raj_fdt on 2010/03/17 17:42:16

	Teach tsec(4) to obtain its PHY address from the device tree.

Affected files ...

.. //depot/projects/fdt/sys/dev/tsec/if_tsec.c#3 edit
.. //depot/projects/fdt/sys/dev/tsec/if_tsec.h#3 edit
.. //depot/projects/fdt/sys/dev/tsec/if_tsec_fdt.c#3 edit

Differences ...

==== //depot/projects/fdt/sys/dev/tsec/if_tsec.c#3 (text+ko) ====

@@ -1563,7 +1563,7 @@
 
 	sc = device_get_softc(dev);
 
-	if (device_get_unit(dev) != phy)
+	if (sc->phyaddr != phy)
 		return (0);
 
 	sc = tsec0_sc;
@@ -1591,9 +1591,8 @@
 
 	sc = device_get_softc(dev);
 
-	if (device_get_unit(dev) != phy)
-		device_printf(dev, "Trying to write to an alien PHY(%d)\n",
-		    phy);
+	if (sc->phyaddr != phy)
+		return (0);
 
 	sc = tsec0_sc;
 

==== //depot/projects/fdt/sys/dev/tsec/if_tsec.h#3 (text+ko) ====

@@ -131,6 +131,8 @@
 
 	/* currently received frame */
 	struct mbuf	*frame;
+
+	int		phyaddr;
 };
 
 /* interface to get/put generic objects */

==== //depot/projects/fdt/sys/dev/tsec/if_tsec_fdt.c#3 (text+ko) ====

@@ -50,6 +50,7 @@
 #include <net/if_media.h>
 #include <net/if_arp.h>
 
+#include <dev/fdt/fdt_common.h>
 #include <dev/mii/mii.h>
 #include <dev/mii/miivar.h>
 #include <dev/ofw/ofw_bus.h>
@@ -160,6 +161,10 @@
 	if (device_get_unit(dev) == 0)
 		tsec0_sc = sc;
 
+	/* Get phy address from fdt */
+	if (fdt_get_phyaddr(sc->node, &sc->phyaddr) != 0)
+		return (ENXIO);
+
 	/* Init timer */
 	callout_init(&sc->tsec_callout, 1);
 


More information about the p4-projects mailing list