net: fec: fix MDIO bus assignement for dual fec SoC's
authorStefan Agner <stefan@agner.ch>
Tue, 13 Jan 2015 23:20:21 +0000 (00:20 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Jan 2015 05:27:10 +0000 (00:27 -0500)
commit3d125f9c91c599a77ac3cb8f05113a6c8df99cbe
tree2c026971de57cfa183b42494a5d4eb409c003d79
parent900e183301b54f8ca17a86d9835e9569090d182a
net: fec: fix MDIO bus assignement for dual fec SoC's

On i.MX28, the MDIO bus is shared between the two FEC instances.
The driver makes sure that the second FEC uses the MDIO bus of the
first FEC. This is done conditionally if FEC_QUIRK_ENET_MAC is set.
However, in newer designs, such as Vybrid or i.MX6SX, each FEC MAC
has its own MDIO bus. Simply removing the quirk FEC_QUIRK_ENET_MAC
is not an option since other logic, triggered by this quirk, is
still needed.

Furthermore, there are board designs which use the same MDIO bus
for both PHY's even though the second bus would be available on the
SoC side. Such layout are popular since it saves pins on SoC side.
Due to the above quirk, those boards currently do work fine. The
boards in the mainline tree with such a layout are:
- Freescale Vybrid Tower with TWR-SER2 (vf610-twr.dts)
- Freescale i.MX6 SoloX SDB Board (imx6sx-sdb.dts)

This patch adds a new quirk FEC_QUIRK_SINGLE_MDIO for i.MX28, which
makes sure that the MDIO bus of the first FEC is used in any case.

However, the boards above do have a SoC with a MDIO bus for each FEC
instance. But the PHY's are not connected in a 1:1 configuration. A
proper device tree description is needed to allow the driver to
figure out where to find its PHY. This patch fixes that shortcoming
by adding a MDIO bus child node to the first FEC instance, along
with the two PHY's on that bus, and making use of the phy-handle
property to add a reference to the PHY's.

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/arm/boot/dts/imx6sx-sdb.dts
arch/arm/boot/dts/vf610-twr.dts
drivers/net/ethernet/freescale/fec.h
drivers/net/ethernet/freescale/fec_main.c