diff mbox series

[U-Boot,1/1] net: mvneta: Add GPIO configuration support

Message ID 1543941563-50898-1-git-send-email-aditya@kobol.io
State Accepted
Commit 18bfc8fa84cd6d748c134b6265786f7d8226f86c
Delegated to: Joe Hershberger
Headers show
Series [U-Boot,1/1] net: mvneta: Add GPIO configuration support | expand

Commit Message

Aditya Prayoga Dec. 4, 2018, 4:39 p.m. UTC
This patch add GPIO configuration support in mvneta driver.
Driver will handle PHY reset. GPIO pins should be set in device tree.

Ported from mvpp2x
[https://patchwork.ozlabs.org/patch/799654/]

Initial discussion to port the changes into mvneta
[https://patchwork.ozlabs.org/patch/1005765/]

Signed-off-by: Aditya Prayoga <aditya@kobol.io>
---
 drivers/net/mvneta.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Dennis Gilmore Dec. 4, 2018, 9:41 p.m. UTC | #1
Tested-By: Dennis Gilmore <dgilmore@redhat.com>

El mié, 05-12-2018 a las 00:39 +0800, Aditya Prayoga escribió:
> This patch add GPIO configuration support in mvneta driver.
> Driver will handle PHY reset. GPIO pins should be set in device tree.
> 
> Ported from mvpp2x
> [https://patchwork.ozlabs.org/patch/799654/]
> 
> Initial discussion to port the changes into mvneta
> [https://patchwork.ozlabs.org/patch/1005765/]
> 
> Signed-off-by: Aditya Prayoga <aditya@kobol.io>
> ---
>  drivers/net/mvneta.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
> index 8cb04b5..333be8f 100644
> --- a/drivers/net/mvneta.c
> +++ b/drivers/net/mvneta.c
> @@ -27,6 +27,7 @@
>  #include <asm/arch/soc.h>
>  #include <linux/compat.h>
>  #include <linux/mbus.h>
> +#include <asm-generic/gpio.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -274,6 +275,9 @@ struct mvneta_port {
>  	int init;
>  	int phyaddr;
>  	struct phy_device *phydev;
> +#ifdef CONFIG_DM_GPIO
> +	struct gpio_desc phy_reset_gpio;
> +#endif
>  	struct mii_dev *bus;
>  };
>  
> @@ -1749,6 +1753,17 @@ static int mvneta_probe(struct udevice *dev)
>  	if (ret)
>  		return ret;
>  
> +#ifdef CONFIG_DM_GPIO
> +	gpio_request_by_name(dev, "phy-reset-gpios", 0,
> +			     &pp->phy_reset_gpio, GPIOD_IS_OUT);
> +
> +	if (dm_gpio_is_valid(&pp->phy_reset_gpio)) {
> +		dm_gpio_set_value(&pp->phy_reset_gpio, 1);
> +		mdelay(10);
> +		dm_gpio_set_value(&pp->phy_reset_gpio, 0);
> +	}
> +#endif
> +
>  	return board_network_enable(bus);
>  }
>
Stefan Roese Dec. 5, 2018, 6:56 a.m. UTC | #2
On 04.12.18 17:39, Aditya Prayoga wrote:
> This patch add GPIO configuration support in mvneta driver.
> Driver will handle PHY reset. GPIO pins should be set in device tree.
> 
> Ported from mvpp2x
> [https://patchwork.ozlabs.org/patch/799654/]
> 
> Initial discussion to port the changes into mvneta
> [https://patchwork.ozlabs.org/patch/1005765/]
> 
> Signed-off-by: Aditya Prayoga <aditya@kobol.io>
> ---
>   drivers/net/mvneta.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
> index 8cb04b5..333be8f 100644
> --- a/drivers/net/mvneta.c
> +++ b/drivers/net/mvneta.c
> @@ -27,6 +27,7 @@
>   #include <asm/arch/soc.h>
>   #include <linux/compat.h>
>   #include <linux/mbus.h>
> +#include <asm-generic/gpio.h>
>   
>   DECLARE_GLOBAL_DATA_PTR;
>   
> @@ -274,6 +275,9 @@ struct mvneta_port {
>   	int init;
>   	int phyaddr;
>   	struct phy_device *phydev;
> +#ifdef CONFIG_DM_GPIO
> +	struct gpio_desc phy_reset_gpio;
> +#endif
>   	struct mii_dev *bus;
>   };
>   
> @@ -1749,6 +1753,17 @@ static int mvneta_probe(struct udevice *dev)
>   	if (ret)
>   		return ret;
>   
> +#ifdef CONFIG_DM_GPIO
> +	gpio_request_by_name(dev, "phy-reset-gpios", 0,
> +			     &pp->phy_reset_gpio, GPIOD_IS_OUT);
> +
> +	if (dm_gpio_is_valid(&pp->phy_reset_gpio)) {
> +		dm_gpio_set_value(&pp->phy_reset_gpio, 1);
> +		mdelay(10);
> +		dm_gpio_set_value(&pp->phy_reset_gpio, 0);
> +	}
> +#endif
> +
>   	return board_network_enable(bus);
>   }
>   
> 

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Joe Hershberger Jan. 22, 2019, 10:03 p.m. UTC | #3
On Tue, Dec 4, 2018 at 10:39 AM Aditya Prayoga <aditya@kobol.io> wrote:
>
> This patch add GPIO configuration support in mvneta driver.
> Driver will handle PHY reset. GPIO pins should be set in device tree.
>
> Ported from mvpp2x
> [https://patchwork.ozlabs.org/patch/799654/]
>
> Initial discussion to port the changes into mvneta
> [https://patchwork.ozlabs.org/patch/1005765/]
>
> Signed-off-by: Aditya Prayoga <aditya@kobol.io>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger Jan. 24, 2019, 5:38 p.m. UTC | #4
Hi Aditya,

https://patchwork.ozlabs.org/patch/1007736/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index 8cb04b5..333be8f 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -27,6 +27,7 @@ 
 #include <asm/arch/soc.h>
 #include <linux/compat.h>
 #include <linux/mbus.h>
+#include <asm-generic/gpio.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -274,6 +275,9 @@  struct mvneta_port {
 	int init;
 	int phyaddr;
 	struct phy_device *phydev;
+#ifdef CONFIG_DM_GPIO
+	struct gpio_desc phy_reset_gpio;
+#endif
 	struct mii_dev *bus;
 };
 
@@ -1749,6 +1753,17 @@  static int mvneta_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+#ifdef CONFIG_DM_GPIO
+	gpio_request_by_name(dev, "phy-reset-gpios", 0,
+			     &pp->phy_reset_gpio, GPIOD_IS_OUT);
+
+	if (dm_gpio_is_valid(&pp->phy_reset_gpio)) {
+		dm_gpio_set_value(&pp->phy_reset_gpio, 1);
+		mdelay(10);
+		dm_gpio_set_value(&pp->phy_reset_gpio, 0);
+	}
+#endif
+
 	return board_network_enable(bus);
 }