Hi Giuseppe,
Am 11.03.2016 um 14:33 schrieb Giuseppe Cavallaro:
> Initially the phy_bus_name was added to manipulate the
> driver name but It was recently just used to manage the
> fixed-link and then to take some decision at run-time
> inside the main (for example to skip EEE).
> So the patch uses the is_pseudo_fixed_link and removes
> removes the phy_bus_name variable not necessary anymore.
>
> The driver can manage the mdio registration by using phy-handle,
> dwmac-mdio and own parameter e.g. snps,phy-addr.
> This patch takes care about all these possible configurations
> and fixes the mdio registration in case of there is a real
> transceiver or a switch (that needs to be managed by using
> fixed-link).
>
> Signed-off-by: Giuseppe Cavallaro
> Reviewed-by: Andreas Färber
> Tested-by: Frank Schäfer
> Cc: Gabriel Fernandez
> Cc: Dinh Nguyen
> Cc: David S. Miller
> Cc: Phil Reid
> ---
>
> V2: use is_pseudo_fixed_link
> V3: parse device-tree driver parameters to allocate PHY resources considering
> DSA case (+ fixed-link).
>
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +--
> drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 19 +-
> .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 77
>
> include/linux/stmmac.h |2 +-
> 4 files changed, 68 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index c21015b..389d7d0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -271,7 +271,6 @@ static void stmmac_eee_ctrl_timer(unsigned long arg)
> */
> bool stmmac_eee_init(struct stmmac_priv *priv)
> {
> - char *phy_bus_name = priv->plat->phy_bus_name;
> unsigned long flags;
> bool ret = false;
>
> @@ -283,7 +282,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
> goto out;
>
> /* Never init EEE in case of a switch is attached */
> - if (phy_bus_name && (!strcmp(phy_bus_name, "fixed")))
> + if (priv->phydev->is_pseudo_fixed_link)
> goto out;
>
> /* MAC core supports the EEE feature. */
> @@ -820,12 +819,8 @@ static int stmmac_init_phy(struct net_device *dev)
> phydev = of_phy_connect(dev, priv->plat->phy_node,
> &stmmac_adjust_link, 0, interface);
> } else {
> - if (priv->plat->phy_bus_name)
> - snprintf(bus_id, MII_BUS_ID_SIZE, "%s-%x",
> - priv->plat->phy_bus_name, priv->plat->bus_id);
> - else
> - snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x",
> - priv->plat->bus_id);
> + snprintf(bus_id, MII_BUS_ID_SIZE, "stmmac-%x",
> + priv->plat->bus_id);
>
> snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id,
>priv->plat->phy_addr);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> index 0faf163..3f5512f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
> @@ -198,29 +198,12 @@ int stmmac_mdio_register(struct net_device *ndev)
> struct mii_bus *new_bus;
> struct stmmac_priv *priv = netdev_priv(ndev);
> struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
> + struct device_node *mdio_node = priv->plat->mdio_node;
> int addr, found;
> - struct device_node *mdio_node = NULL;
> - struct device_node *child_node = NULL;
>
> if (!mdio_bus_data)
> return 0;
>
> - if (IS_ENABLED(CONFIG_OF)) {
> - for_each_child_of_node(priv->device->of_node, child_node) {
> - if (of_device_is_compatible(child_node,
> - "snps,dwmac-mdio")) {
> - mdio_node = child_node;
> - break;
> - }
> - }
> -
> - if (mdio_node) {
> - netdev_dbg(ndev, "FOUND MDIO subnode\n");
> - } else {
> - netdev_warn(ndev, "No MDIO subnode found\n");
> - }
> - }
> -
> new_bus = mdiobus_alloc();
> if (new_bus == NULL)
> r