About ethernet phy settings in dts files

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About ethernet phy settings in dts files

1,628 Views
cyndent
Contributor I

Hi

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,
                     fep->phy_interface);
        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))
                continue;
            if (dev_id--)
                continue;
            strlcpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE);
            break;
        }

Labels (2)
0 Kudos
2 Replies

1,086 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Mingyang Liu,

My apologies for the delay. Are you still experiencing issues?

The phy_write function is used on the fec driver and not the device tree, as the device tree is only a description of the hardware available to the kernel and valid configurations for it.

The phy_write is used to write to the phy’s control registers, which I believe is generally done using the mdio protocol.

I hope this helps!

Regards,

0 Kudos

1,086 Views
cyndent
Contributor I

Hi,gusarambula

   I'm still blocking at this issue, but i find reboot will make two ethernet phy working well, and i think the question is the difference between warm reset and cold reset. After cold reset the mdio can not detect the second ethernet phy. And i have no ideas about what to do next as the kernel code is too diffcult for me to read....Can you give some advices about this? Thanks!

0 Kudos