AnsweredAssumed Answered

About ethernet phy settings in dts files

Question asked by Mingyang Liu on Oct 31, 2018
Latest reply on Nov 28, 2018 by Mingyang Liu


I'm working on a dula ethernet board. official kernel can not make both ethernet work. and i have search the forum for infomation try the lastest kernel but it's still the same.

I want to ask about phy init in dts file


if (dev && dev->interface == PHY_INTERFACE_MODE_MII) {
phy_write(dev, 0x1f, 0x8110);
phy_write(dev, 0x16, 0x201);
} else if (dev && dev->interface == PHY_INTERFACE_MODE_RMII) {
phy_write(dev, 0x1f, 0x8190);
phy_write(dev, 0x16, 0x202);


where do phy_write write things to?if i have two phy, how do it write to both phy accord to dev?

when booting,it will print

fec 2188000.ethernet eth1: Unable to connect to phy

and the code in fec_main.c is

    if (fep->phy_node) {
        phy_dev = of_phy_connect(ndev, fep->phy_node,
                     &fec_enet_adjust_link, 0,
        if (!phy_dev) {
            netdev_err(ndev, "Unable to connect to phy\n");
            return -ENODEV;
    } else {
        /* check for attached phy */
        for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) {
            if (!mdiobus_is_registered_device(fep->mii_bus, phy_id))
            if (dev_id--)
            strlcpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);