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
This commit is contained in:
br 2019-07-29 14:58:29 +00:00
parent 65ea01a683
commit a8f7c3a4b2

View File

@ -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);
}