linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: make of_get_phy_mode parse 'phy-connection-type'
@ 2013-11-13 23:42 Florian Fainelli
  2013-11-14  7:47 ` Grant Likely
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2013-11-13 23:42 UTC (permalink / raw)
  To: grant.likely
  Cc: rob.herring, netdev, devicetree, linux-kernel, Florian Fainelli

Per the ePAPR v1.1 specification, 'phy-connection-type' is the canonical
property name for describing an Ethernet to PHY connection type. Make
sure that of_get_phy_mode() also attempts to parse that property and
update the comments mentioninng 'phy-mode' to also include
'phy-connection-type'.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/of/of_net.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
index 8f9be2e..101a34c 100644
--- a/drivers/of/of_net.c
+++ b/drivers/of/of_net.c
@@ -13,8 +13,8 @@
 
 /**
  * It maps 'enum phy_interface_t' found in include/linux/phy.h
- * into the device tree binding of 'phy-mode', so that Ethernet
- * device driver can get phy interface from device tree.
+ * into the device tree binding of 'phy-mode' or 'phy-connection-type',
+ * so that Ethernet device driver can get phy interface from device tree.
  */
 static const char *phy_modes[] = {
 	[PHY_INTERFACE_MODE_NA]		= "",
@@ -36,8 +36,9 @@ static const char *phy_modes[] = {
  * of_get_phy_mode - Get phy mode for given device_node
  * @np:	Pointer to the given device_node
  *
- * The function gets phy interface string from property 'phy-mode',
- * and return its index in phy_modes table, or errno in error case.
+ * The function gets phy interface string from property 'phy-mode' or
+ * 'phy-connection-type', and return its index in phy_modes table, or errno in
+ * error case.
  */
 int of_get_phy_mode(struct device_node *np)
 {
@@ -45,8 +46,11 @@ int of_get_phy_mode(struct device_node *np)
 	int err, i;
 
 	err = of_property_read_string(np, "phy-mode", &pm);
-	if (err < 0)
-		return err;
+	if (err < 0) {
+		err = of_property_read_string(np, "phy-connection-type", &pm);
+		if (err < 0)
+			return err;
+	}
 
 	for (i = 0; i < ARRAY_SIZE(phy_modes); i++)
 		if (!strcasecmp(pm, phy_modes[i]))
-- 
1.8.3.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] of: make of_get_phy_mode parse 'phy-connection-type'
  2013-11-13 23:42 [PATCH] of: make of_get_phy_mode parse 'phy-connection-type' Florian Fainelli
@ 2013-11-14  7:47 ` Grant Likely
       [not found]   ` < 1384496612-28392-1-git-send-email-f.fainelli@gmail.com>
  2013-11-15  6:23   ` [PATCH v2] " Florian Fainelli
  0 siblings, 2 replies; 6+ messages in thread
From: Grant Likely @ 2013-11-14  7:47 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: rob.herring, netdev, devicetree, linux-kernel, Florian Fainelli

On Wed, 13 Nov 2013 15:42:27 -0800, "Florian Fainelli" <f.fainelli@gmail.com> wrote:
> Per the ePAPR v1.1 specification, 'phy-connection-type' is the canonical
> property name for describing an Ethernet to PHY connection type. Make
> sure that of_get_phy_mode() also attempts to parse that property and
> update the comments mentioninng 'phy-mode' to also include
> 'phy-connection-type'.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/of/of_net.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
> index 8f9be2e..101a34c 100644
> --- a/drivers/of/of_net.c
> +++ b/drivers/of/of_net.c
> @@ -13,8 +13,8 @@
>  
>  /**
>   * It maps 'enum phy_interface_t' found in include/linux/phy.h
> - * into the device tree binding of 'phy-mode', so that Ethernet
> - * device driver can get phy interface from device tree.
> + * into the device tree binding of 'phy-mode' or 'phy-connection-type',
> + * so that Ethernet device driver can get phy interface from device tree.
>   */
>  static const char *phy_modes[] = {
>  	[PHY_INTERFACE_MODE_NA]		= "",
> @@ -36,8 +36,9 @@ static const char *phy_modes[] = {
>   * of_get_phy_mode - Get phy mode for given device_node
>   * @np:	Pointer to the given device_node
>   *
> - * The function gets phy interface string from property 'phy-mode',
> - * and return its index in phy_modes table, or errno in error case.
> + * The function gets phy interface string from property 'phy-mode' or
> + * 'phy-connection-type', and return its index in phy_modes table, or errno in
> + * error case.
>   */
>  int of_get_phy_mode(struct device_node *np)
>  {
> @@ -45,8 +46,11 @@ int of_get_phy_mode(struct device_node *np)
>  	int err, i;
>  
>  	err = of_property_read_string(np, "phy-mode", &pm);
> -	if (err < 0)
> -		return err;
> +	if (err < 0) {
> +		err = of_property_read_string(np, "phy-connection-type", &pm);
> +		if (err < 0)
> +			return err;
> +	}

Nit: The following would actually be better:
 	err = of_property_read_string(np, "phy-mode", &pm);
+	if (err < 0)
+		err = of_property_read_string(np, "phy-connection-type", &pm);
 	if (err < 0)
 		return err;

Otherwise, the patch looks fine. If you test and repost then it can be merged with my:

Acked-by: Grant Likely <grant.likely@linaro.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] of: make of_get_phy_mode parse 'phy-connection-type'
  2013-11-14  7:47 ` Grant Likely
       [not found]   ` < 1384496612-28392-1-git-send-email-f.fainelli@gmail.com>
@ 2013-11-15  6:23   ` Florian Fainelli
  2013-11-16 12:24     ` Grant Likely
  1 sibling, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2013-11-15  6:23 UTC (permalink / raw)
  To: grant.likely; +Cc: rob.herring, devicetree, linux-kernel, Florian Fainelli

Per the ePAPR v1.1 specification, 'phy-connection-type' is the canonical
property name for describing an Ethernet to PHY connection type. Make
sure that of_get_phy_mode() also attempts to parse that property and
update the comments mentioning 'phy-mode' to also include
'phy-connection-type'.

Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes since v2:
- reworked the error condition to look nicer per Grant's suggestion
- added Grant's Acked-by tag
- fixed a typo in the commit message on "mentioning"

 drivers/of/of_net.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
index 8f9be2e..651e249 100644
--- a/drivers/of/of_net.c
+++ b/drivers/of/of_net.c
@@ -13,8 +13,8 @@
 
 /**
  * It maps 'enum phy_interface_t' found in include/linux/phy.h
- * into the device tree binding of 'phy-mode', so that Ethernet
- * device driver can get phy interface from device tree.
+ * into the device tree binding of 'phy-mode' or 'phy-connection-type',
+ * so that Ethernet device driver can get phy interface from device tree.
  */
 static const char *phy_modes[] = {
 	[PHY_INTERFACE_MODE_NA]		= "",
@@ -36,8 +36,9 @@ static const char *phy_modes[] = {
  * of_get_phy_mode - Get phy mode for given device_node
  * @np:	Pointer to the given device_node
  *
- * The function gets phy interface string from property 'phy-mode',
- * and return its index in phy_modes table, or errno in error case.
+ * The function gets phy interface string from property 'phy-mode' or
+ * 'phy-connection-type', and return its index in phy_modes table, or errno in
+ * error case.
  */
 int of_get_phy_mode(struct device_node *np)
 {
@@ -46,6 +47,8 @@ int of_get_phy_mode(struct device_node *np)
 
 	err = of_property_read_string(np, "phy-mode", &pm);
 	if (err < 0)
+		err = of_property_read_string(np, "phy-connection-type", &pm);
+	if (err < 0)
 		return err;
 
 	for (i = 0; i < ARRAY_SIZE(phy_modes); i++)
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] of: make of_get_phy_mode parse 'phy-connection-type'
  2013-11-15  6:23   ` [PATCH v2] " Florian Fainelli
@ 2013-11-16 12:24     ` Grant Likely
  2014-01-26  3:04       ` Florian Fainelli
  0 siblings, 1 reply; 6+ messages in thread
From: Grant Likely @ 2013-11-16 12:24 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: rob.herring, devicetree, linux-kernel, Florian Fainelli

On Fri, 15 Nov 2013 06:23:32 +0000, Florian Fainelli <f.fainelli@gmail.com> wrote:
> Per the ePAPR v1.1 specification, 'phy-connection-type' is the canonical
> property name for describing an Ethernet to PHY connection type. Make
> sure that of_get_phy_mode() also attempts to parse that property and
> update the comments mentioning 'phy-mode' to also include
> 'phy-connection-type'.
> 
> Acked-by: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied, thanks

g.

> ---
> Changes since v2:
> - reworked the error condition to look nicer per Grant's suggestion
> - added Grant's Acked-by tag
> - fixed a typo in the commit message on "mentioning"
> 
>  drivers/of/of_net.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
> index 8f9be2e..651e249 100644
> --- a/drivers/of/of_net.c
> +++ b/drivers/of/of_net.c
> @@ -13,8 +13,8 @@
>  
>  /**
>   * It maps 'enum phy_interface_t' found in include/linux/phy.h
> - * into the device tree binding of 'phy-mode', so that Ethernet
> - * device driver can get phy interface from device tree.
> + * into the device tree binding of 'phy-mode' or 'phy-connection-type',
> + * so that Ethernet device driver can get phy interface from device tree.
>   */
>  static const char *phy_modes[] = {
>  	[PHY_INTERFACE_MODE_NA]		= "",
> @@ -36,8 +36,9 @@ static const char *phy_modes[] = {
>   * of_get_phy_mode - Get phy mode for given device_node
>   * @np:	Pointer to the given device_node
>   *
> - * The function gets phy interface string from property 'phy-mode',
> - * and return its index in phy_modes table, or errno in error case.
> + * The function gets phy interface string from property 'phy-mode' or
> + * 'phy-connection-type', and return its index in phy_modes table, or errno in
> + * error case.
>   */
>  int of_get_phy_mode(struct device_node *np)
>  {
> @@ -46,6 +47,8 @@ int of_get_phy_mode(struct device_node *np)
>  
>  	err = of_property_read_string(np, "phy-mode", &pm);
>  	if (err < 0)
> +		err = of_property_read_string(np, "phy-connection-type", &pm);
> +	if (err < 0)
>  		return err;
>  
>  	for (i = 0; i < ARRAY_SIZE(phy_modes); i++)
> -- 
> 1.8.3.2
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] of: make of_get_phy_mode parse 'phy-connection-type'
  2013-11-16 12:24     ` Grant Likely
@ 2014-01-26  3:04       ` Florian Fainelli
  2014-02-03 14:37         ` Grant Likely
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2014-01-26  3:04 UTC (permalink / raw)
  To: Grant Likely; +Cc: rob.herring, devicetree, linux-kernel

Le 16/11/2013 04:24, Grant Likely a écrit :
> On Fri, 15 Nov 2013 06:23:32 +0000, Florian Fainelli <f.fainelli@gmail.com> wrote:
>> Per the ePAPR v1.1 specification, 'phy-connection-type' is the canonical
>> property name for describing an Ethernet to PHY connection type. Make
>> sure that of_get_phy_mode() also attempts to parse that property and
>> update the comments mentioning 'phy-mode' to also include
>> 'phy-connection-type'.
>>
>> Acked-by: Grant Likely <grant.likely@linaro.org>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>
> Applied, thanks

Grant, where is that patch, and will it be part of a pull request to 3.14?

Thanks!

>
> g.
>
>> ---
>> Changes since v2:
>> - reworked the error condition to look nicer per Grant's suggestion
>> - added Grant's Acked-by tag
>> - fixed a typo in the commit message on "mentioning"
>>
>>   drivers/of/of_net.c | 11 +++++++----
>>   1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c
>> index 8f9be2e..651e249 100644
>> --- a/drivers/of/of_net.c
>> +++ b/drivers/of/of_net.c
>> @@ -13,8 +13,8 @@
>>
>>   /**
>>    * It maps 'enum phy_interface_t' found in include/linux/phy.h
>> - * into the device tree binding of 'phy-mode', so that Ethernet
>> - * device driver can get phy interface from device tree.
>> + * into the device tree binding of 'phy-mode' or 'phy-connection-type',
>> + * so that Ethernet device driver can get phy interface from device tree.
>>    */
>>   static const char *phy_modes[] = {
>>   	[PHY_INTERFACE_MODE_NA]		= "",
>> @@ -36,8 +36,9 @@ static const char *phy_modes[] = {
>>    * of_get_phy_mode - Get phy mode for given device_node
>>    * @np:	Pointer to the given device_node
>>    *
>> - * The function gets phy interface string from property 'phy-mode',
>> - * and return its index in phy_modes table, or errno in error case.
>> + * The function gets phy interface string from property 'phy-mode' or
>> + * 'phy-connection-type', and return its index in phy_modes table, or errno in
>> + * error case.
>>    */
>>   int of_get_phy_mode(struct device_node *np)
>>   {
>> @@ -46,6 +47,8 @@ int of_get_phy_mode(struct device_node *np)
>>
>>   	err = of_property_read_string(np, "phy-mode", &pm);
>>   	if (err < 0)
>> +		err = of_property_read_string(np, "phy-connection-type", &pm);
>> +	if (err < 0)
>>   		return err;
>>
>>   	for (i = 0; i < ARRAY_SIZE(phy_modes); i++)
>> --
>> 1.8.3.2
>>
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] of: make of_get_phy_mode parse 'phy-connection-type'
  2014-01-26  3:04       ` Florian Fainelli
@ 2014-02-03 14:37         ` Grant Likely
  0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2014-02-03 14:37 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: rob.herring, devicetree, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

On Sat, 25 Jan 2014 19:04:49 -0800, Florian Fainelli <f.fainelli@gmail.com> wrote:
> Le 16/11/2013 04:24, Grant Likely a écrit :
> > On Fri, 15 Nov 2013 06:23:32 +0000, Florian Fainelli <f.fainelli@gmail.com> wrote:
> >> Per the ePAPR v1.1 specification, 'phy-connection-type' is the canonical
> >> property name for describing an Ethernet to PHY connection type. Make
> >> sure that of_get_phy_mode() also attempts to parse that property and
> >> update the comments mentioning 'phy-mode' to also include
> >> 'phy-connection-type'.
> >>
> >> Acked-by: Grant Likely <grant.likely@linaro.org>
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> >
> > Applied, thanks
> 
> Grant, where is that patch, and will it be part of a pull request to 3.14?

I accidentally dropped it for v3.14. It will be in 3.15

g.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-03 14:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-13 23:42 [PATCH] of: make of_get_phy_mode parse 'phy-connection-type' Florian Fainelli
2013-11-14  7:47 ` Grant Likely
     [not found]   ` < 1384496612-28392-1-git-send-email-f.fainelli@gmail.com>
2013-11-15  6:23   ` [PATCH v2] " Florian Fainelli
2013-11-16 12:24     ` Grant Likely
2014-01-26  3:04       ` Florian Fainelli
2014-02-03 14:37         ` Grant Likely

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).