AnsweredAssumed Answered

of_mdiobus_register never failed when PHY id read error

Question asked by lai zhefeng on Apr 5, 2017
Latest reply on May 2, 2017 by lai zhefeng

Hi, guys,

I have encountered a problem about the fec(freescale ethernet controller), it will cause the kernel panic when the ethernet cable repeat attached and detached for several times.

Fortunately, I finally found out the reason: the reset pin of PHY(LAN8720) in our board is connetted to a reset signal generate by a chip(SGM809), so when POR, PHY is reset automatically, in the meanwhile, the reset of PHY is out of software control. If kernel command line contain "console=/dev/null", read PHY id failed, but when "console=/dev/ttyAMA0" everything is fine, the difference between these is that the data output from UART add some delay between PHY reset and PHY id read operation.

It is easy to solve this problem when we know the reason, but what I don't understand is why of_mdiobus_register() takes it is fine when PHY id read failed and go ahead to register the enet device, if this is not a problem, why the attached/detached of enet cable cause the kernel panic?


I found that at Apr 17 2016, a kernel patch change of_mdiobus_register_{device|phy} from return "int" to "void", so I guess in the maintainer's opinion register phy should always success, in the contrast it is the responsible for fec driver to avoid kernel panic when no phy connected(PHY id read faile, etc).