Mostly taken from the Linux Kernel to ease porting phy handling code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>