Forum Discussion
Altera_Forum
Honored Contributor
14 years agoI am reading these registers via SPI, I have not tried it via MDIO.
As the MDIO normally only uses one PHY, I think it is quite tricky to get to the registers of the other two PHYs. The MII-interface is not neccessary to check for connection, as you have a fixed link to your FPGA. Depending on your implementation, it will always be 100M (probably) or 10M, and will always be connected. So you would only need to check the connection status of the other 2 PHYs, and return when one is connected. If you don't care whether a line is connected or not (as is possible for testing), just return any correct value for the link status, e.g.
/* If speed == 10 Mbps */
// link_status |= 0x8;
/* Else speed = 100 Mbps */
link_status |= 0x4;
/* If duplex == Full */
link_status |= 0x1;
return link_status;