Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jul 2019 14:58:29 +0000 (UTC)
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350415 - head/sys/dev/mii
Message-ID:  <201907291458.x6TEwTu1094245@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: br
Date: Mon Jul 29 14:58:29 2019
New Revision: 350415
URL: https://svnweb.freebsd.org/changeset/base/350415

Log:
  Find the correct node of PHY chip using "phy-handle" property of
  ethernet MAC node.
  
  This fixes operation on Terasic DE10-Pro (Intel Stratix 10 GX/SX
  FPGA Development Kit).
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/dev/mii/micphy.c

Modified: head/sys/dev/mii/micphy.c
==============================================================================
--- head/sys/dev/mii/micphy.c	Mon Jul 29 13:21:31 2019	(r350414)
+++ head/sys/dev/mii/micphy.c	Mon Jul 29 14:58:29 2019	(r350415)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
+ * Copyright (c) 2014,2019 Ruslan Bukin <br@bsdpad.com>
  * All rights reserved.
  *
  * This software was developed by SRI International and the University of
@@ -32,7 +32,7 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * Micrel KSZ9021 Gigabit Ethernet Transceiver
+ * Micrel KSZ8081/KSZ9021/KSZ9031 Gigabit Ethernet Transceiver
  */
 
 #include <sys/param.h>
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/ofw/openfirm.h>
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
+#include <dev/mii/mii_fdt.h>
 
 #define	MII_KSZPHY_EXTREG			0x0b
 #define	 KSZPHY_EXTREG_WRITE			(1 << 15)
@@ -251,6 +252,7 @@ micphy_probe(device_t dev)
 static int
 micphy_attach(device_t dev)
 {
+	mii_fdt_phy_config_t *cfg;
 	struct mii_softc *sc;
 	phandle_t node;
 	device_t miibus;
@@ -271,10 +273,12 @@ micphy_attach(device_t dev)
 	if ((node = ofw_bus_get_node(parent)) == -1)
 		return (ENXIO);
 
+	cfg = mii_fdt_get_config(dev);
+
 	if (sc->mii_mpd_model == MII_MODEL_MICREL_KSZ9031)
-		ksz9031_load_values(sc, node);
+		ksz9031_load_values(sc, cfg->phynode);
 	else
-		ksz9021_load_values(sc, node);
+		ksz9021_load_values(sc, cfg->phynode);
 
 	return (0);
 }



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