netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH v3] drivers: net: cpsw: Add support to drive gpios for ethernet to be functional
@ 2015-09-07  9:46 Mugunthan V N
  2015-09-08 20:06 ` Tony Lindgren
       [not found] ` <1441619204-15403-1-git-send-email-mugunthanvnm-l0cyMroinI0@public.gmane.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Mugunthan V N @ 2015-09-07  9:46 UTC (permalink / raw)
  To: netdev
  Cc: David S . Miller, Tony Lindgren, Sekhar Nori, linux-omap,
	devicetree, Mugunthan V N

In DRA72x EVM, by default slave 1 is connected to the onboard
phy, but slave 2 pins are also muxed with video input module
which is controlled by pcf857x gpio and currently to select slave
0 to connect to phy gpio hogging is used, but with
omap2plus_defconfig the pcf857x gpio is built as module. So when
using NFS on DRA72x EVM, board doesn't boot as gpio hogging do
not set proper gpio state to connect slave 0 to phy as it is
built as module and you do not see any errors for not setting
gpio and just mentions dhcp reply not got.

To solve this issue, introducing "mode-gpios" in DT when gpio
based muxing is required. This will throw a warning when gpio
get fails and returns probe defer. When gpio-pcf857x module is
installed, cpsw probes again and ethernet becomes functional.
Verified this on DRA72x with pcf as module and ramdisk.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---

Changes from v2:
* Used mode-gpios, so that the driver is generic enough to handle
  multiple gpios

This patch is tested on DRA72x, Logs [1] and pushed a branch [2]

[1]: http://pastebin.ubuntu.com/12306224/
[2]: git://git.ti.com/~mugunthanvnm/ti-linux-kernel/linux.git cpsw-gpio-optional-v3

---
 Documentation/devicetree/bindings/net/cpsw.txt | 7 +++++++
 drivers/net/ethernet/ti/cpsw.c                 | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
index a9df21a..676ecf6 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -30,6 +30,13 @@ Optional properties:
 - dual_emac		: Specifies Switch to act as Dual EMAC
 - syscon		: Phandle to the system control device node, which is
 			  the control module device of the am33x
+- mode-gpios		: Should be added if one/multiple gpio lines are
+			  required to be driven so that cpsw data lines
+			  can be connected to the phy via selective mux.
+			  For example in dra72x-evm, pcf gpio has to be
+			  driven low so that cpsw slave 0 and phy data
+			  lines are connected via mux.
+
 
 Slave Properties:
 Required properties:
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 8fc90f1..c670317 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -29,6 +29,7 @@
 #include <linux/workqueue.h>
 #include <linux/delay.h>
 #include <linux/pm_runtime.h>
+#include <linux/gpio.h>
 #include <linux/of.h>
 #include <linux/of_net.h>
 #include <linux/of_device.h>
@@ -2207,6 +2208,7 @@ static int cpsw_probe(struct platform_device *pdev)
 	void __iomem			*ss_regs;
 	struct resource			*res, *ss_res;
 	const struct of_device_id	*of_id;
+	struct gpio_descs		*mode;
 	u32 slave_offset, sliver_offset, slave_size;
 	int ret = 0, i;
 	int irq;
@@ -2232,6 +2234,13 @@ static int cpsw_probe(struct platform_device *pdev)
 		goto clean_ndev_ret;
 	}
 
+	mode = devm_gpiod_get_array_optional(&pdev->dev, "mode", GPIOD_OUT_LOW);
+	if (IS_ERR(mode)) {
+		ret = PTR_ERR(mode);
+		dev_err(&pdev->dev, "gpio request failed, ret %d\n", ret);
+		goto clean_ndev_ret;
+	}
+
 	/*
 	 * This may be required here for child devices.
 	 */
-- 
2.6.0.rc0.24.gec371ff

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

* Re: [net-next PATCH v3] drivers: net: cpsw: Add support to drive gpios for ethernet to be functional
  2015-09-07  9:46 [net-next PATCH v3] drivers: net: cpsw: Add support to drive gpios for ethernet to be functional Mugunthan V N
@ 2015-09-08 20:06 ` Tony Lindgren
       [not found] ` <1441619204-15403-1-git-send-email-mugunthanvnm-l0cyMroinI0@public.gmane.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2015-09-08 20:06 UTC (permalink / raw)
  To: Mugunthan V N
  Cc: netdev, David S . Miller, Sekhar Nori, linux-omap, devicetree

* Mugunthan V N <mugunthanvnm@ti.com> [150907 02:50]:
> In DRA72x EVM, by default slave 1 is connected to the onboard
> phy, but slave 2 pins are also muxed with video input module
> which is controlled by pcf857x gpio and currently to select slave
> 0 to connect to phy gpio hogging is used, but with
> omap2plus_defconfig the pcf857x gpio is built as module. So when
> using NFS on DRA72x EVM, board doesn't boot as gpio hogging do
> not set proper gpio state to connect slave 0 to phy as it is
> built as module and you do not see any errors for not setting
> gpio and just mentions dhcp reply not got.
> 
> To solve this issue, introducing "mode-gpios" in DT when gpio
> based muxing is required. This will throw a warning when gpio
> get fails and returns probe defer. When gpio-pcf857x module is
> installed, cpsw probes again and ethernet becomes functional.
> Verified this on DRA72x with pcf as module and ramdisk.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
> 
> Changes from v2:
> * Used mode-gpios, so that the driver is generic enough to handle
>   multiple gpios
> 
> This patch is tested on DRA72x, Logs [1] and pushed a branch [2]
> 
> [1]: http://pastebin.ubuntu.com/12306224/
> [2]: git://git.ti.com/~mugunthanvnm/ti-linux-kernel/linux.git cpsw-gpio-optional-v3
> 
> ---
>  Documentation/devicetree/bindings/net/cpsw.txt | 7 +++++++
>  drivers/net/ethernet/ti/cpsw.c                 | 9 +++++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt
> index a9df21a..676ecf6 100644
> --- a/Documentation/devicetree/bindings/net/cpsw.txt
> +++ b/Documentation/devicetree/bindings/net/cpsw.txt
> @@ -30,6 +30,13 @@ Optional properties:
>  - dual_emac		: Specifies Switch to act as Dual EMAC
>  - syscon		: Phandle to the system control device node, which is
>  			  the control module device of the am33x
> +- mode-gpios		: Should be added if one/multiple gpio lines are
> +			  required to be driven so that cpsw data lines
> +			  can be connected to the phy via selective mux.
> +			  For example in dra72x-evm, pcf gpio has to be
> +			  driven low so that cpsw slave 0 and phy data
> +			  lines are connected via mux.
> +
>  
>  Slave Properties:
>  Required properties:
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index 8fc90f1..c670317 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -29,6 +29,7 @@
>  #include <linux/workqueue.h>
>  #include <linux/delay.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/gpio.h>
>  #include <linux/of.h>
>  #include <linux/of_net.h>
>  #include <linux/of_device.h>
> @@ -2207,6 +2208,7 @@ static int cpsw_probe(struct platform_device *pdev)
>  	void __iomem			*ss_regs;
>  	struct resource			*res, *ss_res;
>  	const struct of_device_id	*of_id;
> +	struct gpio_descs		*mode;
>  	u32 slave_offset, sliver_offset, slave_size;
>  	int ret = 0, i;
>  	int irq;
> @@ -2232,6 +2234,13 @@ static int cpsw_probe(struct platform_device *pdev)
>  		goto clean_ndev_ret;
>  	}
>  
> +	mode = devm_gpiod_get_array_optional(&pdev->dev, "mode", GPIOD_OUT_LOW);
> +	if (IS_ERR(mode)) {
> +		ret = PTR_ERR(mode);
> +		dev_err(&pdev->dev, "gpio request failed, ret %d\n", ret);
> +		goto clean_ndev_ret;
> +	}
> +
>  	/*
>  	 * This may be required here for child devices.
>  	 */
> -- 
> 2.6.0.rc0.24.gec371ff
> 

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

* Re: [net-next PATCH v3] drivers: net: cpsw: Add support to drive gpios for ethernet to be functional
       [not found] ` <1441619204-15403-1-git-send-email-mugunthanvnm-l0cyMroinI0@public.gmane.org>
@ 2015-09-15 19:38   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2015-09-15 19:38 UTC (permalink / raw)
  To: mugunthanvnm-l0cyMroinI0
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	nsekhar-l0cyMroinI0, linux-omap-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

From: Mugunthan V N <mugunthanvnm-l0cyMroinI0@public.gmane.org>
Date: Mon, 7 Sep 2015 15:16:44 +0530

> In DRA72x EVM, by default slave 1 is connected to the onboard
> phy, but slave 2 pins are also muxed with video input module
> which is controlled by pcf857x gpio and currently to select slave
> 0 to connect to phy gpio hogging is used, but with
> omap2plus_defconfig the pcf857x gpio is built as module. So when
> using NFS on DRA72x EVM, board doesn't boot as gpio hogging do
> not set proper gpio state to connect slave 0 to phy as it is
> built as module and you do not see any errors for not setting
> gpio and just mentions dhcp reply not got.
> 
> To solve this issue, introducing "mode-gpios" in DT when gpio
> based muxing is required. This will throw a warning when gpio
> get fails and returns probe defer. When gpio-pcf857x module is
> installed, cpsw probes again and ethernet becomes functional.
> Verified this on DRA72x with pcf as module and ramdisk.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm-l0cyMroinI0@public.gmane.org>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-09-15 19:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-07  9:46 [net-next PATCH v3] drivers: net: cpsw: Add support to drive gpios for ethernet to be functional Mugunthan V N
2015-09-08 20:06 ` Tony Lindgren
     [not found] ` <1441619204-15403-1-git-send-email-mugunthanvnm-l0cyMroinI0@public.gmane.org>
2015-09-15 19:38   ` David Miller

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