Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935193AbaGPTX5 (ORCPT ); Wed, 16 Jul 2014 15:23:57 -0400 Received: from mail-we0-f171.google.com ([74.125.82.171]:63155 "EHLO mail-we0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934984AbaGPTXu (ORCPT ); Wed, 16 Jul 2014 15:23:50 -0400 MIME-Version: 1.0 In-Reply-To: <1405512783-20307-3-git-send-email-grygorii.strashko@ti.com> References: <1405512783-20307-1-git-send-email-grygorii.strashko@ti.com> <1405512783-20307-3-git-send-email-grygorii.strashko@ti.com> From: Prabhakar Lad Date: Wed, 16 Jul 2014 20:23:17 +0100 Message-ID: Subject: Re: [PATCH v2 2/2] net: davinci_mdio: allow to create phys from dt To: Grygorii Strashko Cc: "David S. Miller" , Florian Fainelli , Santosh Shilimkar , netdev , Sekhar Nori , Rob Herring , LKML , "devicetree@vger.kernel.org" , dlos , Mugunthan V N Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 16, 2014 at 1:13 PM, Grygorii Strashko wrote: > This patch allows to create PHYs from DT in case > if they are explicitly defined. The of_mdiobus_register() is > used for such purposes. > > For backward compatibility, call of_mdiobus_register() only in case > if at least one PHY's child is defined in DT, otherwise rollback to > mdiobus_register(). > > Reviewed-by: Santosh Shilimkar > Acked-by: Mugunthan V N > Signed-off-by: Grygorii Strashko Reviewed-by: Lad, Prabhakar Thanks, --Prabhakar Lad > --- > Hi Santosh, > > I haven't changed style for long-comments, because Networking subsystem > requires first line of comment not to be empty: > WARNING:NETWORKING_BLOCK_COMMENT_STYLE: networking block comments don't use an empty /* line, use /* Comment... > > drivers/net/ethernet/ti/davinci_mdio.c | 21 +++++++++++++++++++-- > 1 file changed, 19 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c > index 735dc53..2791f6f 100644 > --- a/drivers/net/ethernet/ti/davinci_mdio.c > +++ b/drivers/net/ethernet/ti/davinci_mdio.c > @@ -38,6 +38,7 @@ > #include > #include > #include > +#include > #include > > /* > @@ -95,6 +96,10 @@ struct davinci_mdio_data { > struct mii_bus *bus; > bool suspended; > unsigned long access_time; /* jiffies */ > + /* Indicates that driver shouldn't modify phy_mask in case > + * if MDIO bus is registered from DT. > + */ > + bool skip_scan; > }; > > static void __davinci_mdio_reset(struct davinci_mdio_data *data) > @@ -144,6 +149,9 @@ static int davinci_mdio_reset(struct mii_bus *bus) > dev_info(data->dev, "davinci mdio revision %d.%d\n", > (ver >> 8) & 0xff, ver & 0xff); > > + if (data->skip_scan) > + return 0; > + > /* get phy mask from the alive register */ > phy_mask = __raw_readl(&data->regs->alive); > if (phy_mask) { > @@ -369,8 +377,17 @@ static int davinci_mdio_probe(struct platform_device *pdev) > goto bail_out; > } > > - /* register the mii bus */ > - ret = mdiobus_register(data->bus); > + /* register the mii bus > + * Create PHYs from DT only in case if PHY child nodes are explicitly > + * defined to support backward compatibility with DTs which assume that > + * Davinci MDIO will always scan the bus for PHYs detection. > + */ > + if (dev->of_node && of_get_child_count(dev->of_node)) { > + data->skip_scan = true; > + ret = of_mdiobus_register(data->bus, dev->of_node); > + } else { > + ret = mdiobus_register(data->bus); > + } > if (ret) > goto bail_out; > > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/