Have revisited the configuration now that I have the serial cable to play with the .has_enet settings.
.has_enet0 = 1,
.enet0 = {
.has_phy = 1,
.use_internal_phy = 1,
},
[ 0.603705] bcm63xx_enet bcm63xx_enet.0: unable to register mdio bus
[ 0.610447] bcm63xx_enet: probe of bcm63xx_enet.0 failed with error -5
.has_enet0 = 1,
.enet0 = {
.has_phy = 1,
.use_internal_phy = 0,
},
[ 0.602676] bcm63xx_enet bcm63xx_enet.0: unable to register mdio bus
[ 0.609414] bcm63xx_enet: probe of bcm63xx_enet.0 failed with error -5
.has_enet0 = 1,
.enet0 = {
.has_phy = 1,
.phy_id = 0,
},
[ 0.603819] bcm63xx_enet bcm63xx_enet.0: unable to register mdio bus
[ 0.610559] bcm63xx_enet: probe of bcm63xx_enet.0 failed with error -5
.has_enet0 = 1,
.enet0 = {
.has_phy = 1,
.phy_id = 1,
},
[ 0.602599] bcm63xx_enet bcm63xx_enet.0: unable to register mdio bus
[ 0.609338] bcm63xx_enet: probe of bcm63xx_enet.0 failed with error -5
.has_enet1 = 1,
.enet1 = {
.has_phy = 1,
.use_internal_phy = 1,
},
nothing logged
Now, when I was using kernel v4.1.20/23 some of these setting would cause the device to lock up with the power LED red. I am now using kernel v4.4.9 and the lockup doesn't happen, which is somewhat better I suppose.
Like when I tested with danitool, the mdio detection/registration appears to be a/the problem.
bcm63xx_enet bcm63xx_enet.0: unable to register mdio bus
Which is in bcm63xx_enet.c
ret = mdiobus_register(bus);
if (ret) {
dev_err(&pdev->dev, "unable to register mdio bus\n");
goto out_free_mdio;
}
But I haven't found mdiobus_register yet, editor is searching now. Found in mdio_bus.c
The code that actually get executed is __mdiobus_register, seems to be some kind of overload function. It gets as far as the following code, and ends up goto error
for (i = 0; i < PHY_MAX_ADDR; i++) {
if ((bus->phy_mask & (1 << i)) == 0) {
struct phy_device *phydev;
phydev = mdiobus_scan(bus, i);
if (IS_ERR(phydev)) {
err = PTR_ERR(phydev);
goto error;
}
}
}
error:
while (--i >= 0) {
struct phy_device *phydev = bus->phy_map[i];
if (phydev) {
phy_device_remove(phydev);
phy_device_free(phydev);
}
}
device_del(&bus->dev);
return err;
}
Haven't found IS_ERROR code yet. Found err.h, which basically looks like it's just a value comparator. Now PTR_ERR, looking. Seems to be a cast to long.
Added some logging to the above code.
[ 0.579031] bcm63xx-spi bcm6358-spi: at [mem 0xb0000800-0xb0000f0b flags 0x200] (irq 9, FIFOs size 542)
[ 0.591750] libphy: bus->name: bcm63xx_enet MII bus
[ 0.596945] libphy: PHY_MAX_ADDR: 32
[ 0.600595] libphy: i: 0
[ 0.603182] libphy: i: 1
[ 0.609522] libphy: mdiobus_read: -1
[ 0.613142] libphy: get_phy_id: phy_reg MII_PHYSID1: -1
[ 0.618518] libphy: get_phy_device: 1, -5, 0 /*addr, r, phy_id*/
[ 0.622906] libphy: mdiobus_scan: 1, -5
[ 0.626848] libphy: phydev: -5
[ 0.629984] libphy: err: -5
[ 0.632976] bcm63xx_enet bcm63xx_enet.0: unable to register mdio bus
[ 0.639679] bcm63xx_enet: probe of bcm63xx_enet.0 failed with error -5
[ 0.679371] bcm63xx-wdt bcm63xx-wdt: started, timer margin: 30 sec
No nearer to knowing what the error code means or anything.
err:5 is EIO from errno.h
#define EIO 5 /* I/O error */
from mmi.h
/* Generic MII registers. */
#define MII_PHYSID1 0x02 /* PHYS ID 1 */
#define MII_PHYSID2 0x03 /* PHYS ID 2 */
from mdio_bus.c
/**
* mdiobus_read - Convenience function for reading a given MII mgmt register
* @bus: the mii_bus struct
* @addr: the phy address
* @regnum: register number to read
*
* NOTE: MUST NOT be called from interrupt context,
* because the bus read/write functions may wait for an interrupt
* to conclude the operation.
*/
int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum)
{
int retval;
BUG_ON(in_interrupt());
mutex_lock(&bus->mdio_lock);
retval = bus->read(bus, addr, regnum);
mutex_unlock(&bus->mdio_lock);
pr_info("mdiobus_read: %d\n", retval);
return retval;
}
Are the correct values being passed to bus->read, and what does it do? Why does it return -1 and what does that mean?
(Last edited by Xotic750 on 11 May 2016, 03:01)