net: fec: Ensure clocks are enabled while using mdio bus
net: fec: Ensure clocks are enabled while using mdio bus

When a switch is attached to the mdio bus, the mdio bus can be used
while the interface is not open. If the IPG clock is not enabled, MDIO
reads/writes will simply time out.

Add support for runtime PM to control this clock. Enable/disable this
clock using runtime PM, with open()/close() and mdio read()/write()
function triggering runtime PM operations. Since PM is optional, the
IPG clock is enabled at probe and is no longer modified by
fec_enet_clk_enable(), thus if PM is not enabled in the kernel, it is
guaranteed the clock is running when MDIO operations are performed.

Signed-off-by: Andrew Lunn <02e0a999c50b1f88df7a8f5a04e1b76b35ea6a88@lunn.ch>
Signed-off-by: Lucas Stach <48c9e973d8f86eb0cdae200124c5925db7587c4e@pengutronix.de>
Cc: b3cc311ecf91e7c5c184946246e38d36003af74d@linaro.org
Cc: 679188261afeb60eb822cd934fd7b46a48ddd743@freescale.com
Cc: 912cf7eb7d8018e2943586ae6657d21fd4e38239@linaro.org
Tested-by: Fabio Estevam <679188261afeb60eb822cd934fd7b46a48ddd743@freescale.com>
Tested-by: Tyler Baker <b3cc311ecf91e7c5c184946246e38d36003af74d@linaro.org>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs