Re: [PATCH 1/2] [v4] net: emac: emac gigabit ethernet controller driver

From: Timur Tabi
Date: Fri Apr 22 2016 - 15:45:14 EST


Timur Tabi wrote:


So I've done some more research, and I believe that the internal phy is
not a candidate for phylib, but the external phy (which is a real phy)
might be. There's no MDIO bus to the internal phy.

Does this mean that I will need to enable a PHY driver, and that driver
will control the external phy? If so, then does that mean that I would
delete all to code in my driver that calls emac_phy_read() and
emac_phy_write()? For example, I wouldn't need emac_phy_link_check()
any more?

So I think I have it partially working, but I'm not sure if I'm doing things correctly, and I'd like some help.

The external phy is an Atheros 8031, so I load the at803x driver. I added this code to my driver:

mii_bus = devm_mdiobus_alloc(&pdev->dev);
mii_bus->phy_mask = ~(1 << adpt->hw.phy_addr);
mii_bus->read = emac_mdio_read;
mii_bus->write = emac_mdio_write;
mii_bus->reset = emac_mdio_reset;
mii_bus->parent = &pdev->dev;
mii_bus->priv = hw;

mdiobus_register(mii_bus);

When I call mdiobus_register, I can see that the at803x_probe() probe function is called, so a connection is made.

The problem is that after that point, it appears that the at803x driver is never called again. I tried bring the interface up and down, and connecting and disconnecting an Ethernet cable, but that didn't trigger anything. I would expect the PHY driver to do more than just probe.

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation collaborative project.