On Tue, May 19, 2015 at 3:56 PM, Robert Nelson <[email protected]> wrote:
> On Tue, May 19, 2015 at 3:48 PM, Fernando Derkoski <[email protected]> wrote:
>> Hi, first thank you for the response, here is the output where the network
>> did not work:
>>
>> root@beaglebone:~# dmesg | grep mdio
>> [    1.040419] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
>> [    1.040439] davinci_mdio 4a101000.mdio: detected phy mask fffffffb
>> [    1.047217] libphy: 4a101000.mdio: probed
>> [    1.047246] davinci_mdio 4a101000.mdio: phy[2]: device 4a101000.mdio:02,
>> driver SMSC LAN8710/LAN8720
>
> Humm, that is odd, it corrected for [phy mask fffffffb] with 
> [4a101000.mdio:02]
>
> But it should have been phy[4]... [4a101000.mdio:04]
>
> The math conversion in the phy search patch is:
>
> phy_mask = fffffffb
>
> for (i = 0; i < PHY_MAX_ADDR; i++) {
>       if ((phy_mask & (1 << i)) == 0) {
>               addr = (u32) i;
>               break;
>        }
> }

This looks like a fun rabbit hole:

From: http://www.ti.com/lit/ug/spruh73l/spruh73l.pdf

Table 14-252. MDIOALIVE Register Field Descriptions

"The alive bits are only meant to be used to give an indication of the
presence or not of a PHY with the corresponding address."

Whereas in the kernel:

/* get phy mask from the alive register */
phy_mask = __raw_readl(&data->regs->alive);
if (phy_mask) {
   /* restrict mdio bus to live phys only */
   dev_info(data->dev, "detected phy mask %x\n", ~phy_mask);
   phy_mask = ~phy_mask;
} else {
    /* desperately scan all phys */
   dev_warn(data->dev, "no live phy, scanning all\n");
   phy_mask = 0;
}
data->bus->phy_mask = phy_mask;

We "assume" phy_mask to be 100% correct. Maybe we should just force
the dt value of phy_id always into phy_mask?

Regards,

-- 
Robert Nelson
https://rcn-ee.com/

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to