devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Santosh Shilimkar <santosh.shilimkar@ti.com>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org
Cc: prabhakar.csengg@gmail.com, Sekhar Nori <nsekhar@ti.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	davinci-linux-open-source@linux.davincidsp.com
Subject: Re: [PATCH 2/2] net: davinci_mdio: allow to create phys from dt
Date: Thu, 10 Jul 2014 16:15:25 +0300	[thread overview]
Message-ID: <53BE91ED.9020305@ti.com> (raw)
In-Reply-To: <53BD5066.4000500@ti.com>

On 07/09/2014 05:23 PM, Santosh Shilimkar wrote:
> On Wednesday 09 July 2014 09:10 AM, 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().
>>
>> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
>> ---
>>   drivers/net/ethernet/ti/davinci_mdio.c |   18 ++++++++++++++++--
>>   1 file changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
>> index 735dc53..22d3dab 100644
>> --- a/drivers/net/ethernet/ti/davinci_mdio.c
>> +++ b/drivers/net/ethernet/ti/davinci_mdio.c
>> @@ -38,6 +38,7 @@
>>   #include <linux/davinci_emac.h>
>>   #include <linux/of.h>
>>   #include <linux/of_device.h>
>> +#include <linux/of_mdio.h>
>>   #include <linux/pinctrl/consumer.h>
>>   
>>   /*
>> @@ -95,6 +96,7 @@ 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;
> The vairiable name is not too intutive so probably add a little
> bit description on what are you skipping with it.


Now the Davinci MDIO driver updates mii_bus->phy_mask from
its reset routine to limit number of phy addresses to be scanned.

The MDIO bus scanning has to be skipped at all in case of DT MDIO registration.
And of_mdiobus_register() maintain mii_bus->phy_mask by itself,
thus driver shouldn't touch it.

I'll add above comment. Is it ok?


> 
>>   };
>>   
>>   static void __davinci_mdio_reset(struct davinci_mdio_data *data)
>> @@ -144,6 +146,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 +374,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.
>> +	 */
> multi line comment is not as per coding style. Please fix that.
> Patch as such looks good to me so with those minor fixes, feel
> free to append my review tag.

will fix it.

> 
> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> 
>> +	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;
>>   
>>
> 

  reply	other threads:[~2014-07-10 13:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09 13:10 [PATCH 0/2] net: davinci_mdio: reuse for keystone2 arch Grygorii Strashko
2014-07-09 13:10 ` [PATCH 1/2] " Grygorii Strashko
2014-07-09 14:20   ` Santosh Shilimkar
2014-07-09 23:52   ` David Miller
2014-07-10 12:58     ` Grygorii Strashko
     [not found]       ` <53BE8DF7.9090303-l0cyMroinI0@public.gmane.org>
2014-07-10 19:39         ` David Miller
     [not found]           ` <20140710.123900.1696373067218564684.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2014-07-11 10:24             ` Grygorii Strashko
     [not found]   ` <1404911451-9921-2-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-07-11  5:03     ` Mugunthan V N
2014-07-09 13:10 ` [PATCH 2/2] net: davinci_mdio: allow to create phys from dt Grygorii Strashko
     [not found]   ` <1404911451-9921-3-git-send-email-grygorii.strashko-l0cyMroinI0@public.gmane.org>
2014-07-09 14:23     ` Santosh Shilimkar
2014-07-10 13:15       ` Grygorii Strashko [this message]
2014-07-11  5:05     ` Mugunthan V N

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53BE91ED.9020305@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=davem@davemloft.net \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=santosh.shilimkar@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).