* [PATCH V2 RESEND 0/2] net: dsa: ksz: Add reset GPIO handling
@ 2018-12-10 13:43 Marek Vasut
2018-12-10 13:43 ` [PATCH V2 RESEND 1/2] net: dsa: ksz: Add optional reset GPIO to Microchip KSZ switch binding Marek Vasut
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Marek Vasut @ 2018-12-10 13:43 UTC (permalink / raw)
To: netdev
Cc: f.fainelli, vivien.didelot, andrew, Woojung.Huh, UNGLinuxDriver,
devicetree, Marek Vasut
Add code to handle optional reset GPIO in the KSZ switch driver and a
matching DT property adjustments.
Marek Vasut (2):
net: dsa: ksz: Add optional reset GPIO to Microchip KSZ switch binding
net: dsa: ksz: Add reset GPIO handling
.../devicetree/bindings/net/dsa/ksz.txt | 4 ++++
drivers/net/dsa/microchip/ksz_common.c | 17 +++++++++++++++++
drivers/net/dsa/microchip/ksz_priv.h | 2 ++
3 files changed, 23 insertions(+)
--
2.18.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH V2 RESEND 1/2] net: dsa: ksz: Add optional reset GPIO to Microchip KSZ switch binding
2018-12-10 13:43 [PATCH V2 RESEND 0/2] net: dsa: ksz: Add reset GPIO handling Marek Vasut
@ 2018-12-10 13:43 ` Marek Vasut
2018-12-10 14:38 ` Andrew Lunn
2018-12-10 13:43 ` [PATCH V2 RESEND 2/2] net: dsa: ksz: Add reset GPIO handling Marek Vasut
2018-12-10 20:08 ` [PATCH V2 RESEND 0/2] " David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2018-12-10 13:43 UTC (permalink / raw)
To: netdev
Cc: f.fainelli, vivien.didelot, andrew, Woojung.Huh, UNGLinuxDriver,
devicetree, Marek Vasut, David S . Miller
Add optional reset GPIO, as such a signal is available on the KSZ switches.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Woojung Huh <Woojung.Huh@microchip.com>
Cc: David S. Miller <davem@davemloft.net>
---
V2: No change
---
Documentation/devicetree/bindings/net/dsa/ksz.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/dsa/ksz.txt b/Documentation/devicetree/bindings/net/dsa/ksz.txt
index ac145b885e955..0f407fb371ce1 100644
--- a/Documentation/devicetree/bindings/net/dsa/ksz.txt
+++ b/Documentation/devicetree/bindings/net/dsa/ksz.txt
@@ -8,6 +8,10 @@ Required properties:
- "microchip,ksz9477"
- "microchip,ksz9897"
+Optional properties:
+
+- reset-gpios : Should be a gpio specifier for a reset line
+
See Documentation/devicetree/bindings/net/dsa/dsa.txt for a list of additional
required and optional properties.
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 RESEND 2/2] net: dsa: ksz: Add reset GPIO handling
2018-12-10 13:43 [PATCH V2 RESEND 0/2] net: dsa: ksz: Add reset GPIO handling Marek Vasut
2018-12-10 13:43 ` [PATCH V2 RESEND 1/2] net: dsa: ksz: Add optional reset GPIO to Microchip KSZ switch binding Marek Vasut
@ 2018-12-10 13:43 ` Marek Vasut
2018-12-10 14:39 ` Andrew Lunn
2018-12-10 20:08 ` [PATCH V2 RESEND 0/2] " David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2018-12-10 13:43 UTC (permalink / raw)
To: netdev
Cc: f.fainelli, vivien.didelot, andrew, Woojung.Huh, UNGLinuxDriver,
devicetree, Marek Vasut, Woojung Huh, David S . Miller,
Tristram Ha
Add code to handle optional reset GPIO in the KSZ switch driver. The switch
has a reset GPIO line which can be controlled by the CPU, so make sure it is
configured correctly in such setups.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: Woojung Huh <woojung.huh@microchip.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Tristram Ha <Tristram.Ha@microchip.com>
---
V2: Switch to devm_gpiod_get_optional()
---
drivers/net/dsa/microchip/ksz_common.c | 17 +++++++++++++++++
drivers/net/dsa/microchip/ksz_priv.h | 2 ++
2 files changed, 19 insertions(+)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 9705808c3af7a..3b12e2dcff31b 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -8,12 +8,14 @@
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_data/microchip-ksz.h>
#include <linux/phy.h>
#include <linux/etherdevice.h>
#include <linux/if_bridge.h>
+#include <linux/of_gpio.h>
#include <linux/of_net.h>
#include <net/dsa.h>
#include <net/switchdev.h>
@@ -294,6 +296,17 @@ int ksz_switch_register(struct ksz_device *dev,
if (dev->pdata)
dev->chip_id = dev->pdata->chip_id;
+ dev->reset_gpio = devm_gpiod_get_optional(dev->dev, "reset",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(dev->reset_gpio))
+ return PTR_ERR(dev->reset_gpio);
+
+ if (dev->reset_gpio) {
+ gpiod_set_value(dev->reset_gpio, 1);
+ mdelay(10);
+ gpiod_set_value(dev->reset_gpio, 0);
+ }
+
mutex_init(&dev->reg_mutex);
mutex_init(&dev->stats_mutex);
mutex_init(&dev->alu_mutex);
@@ -329,6 +342,10 @@ void ksz_switch_remove(struct ksz_device *dev)
{
dev->dev_ops->exit(dev);
dsa_unregister_switch(dev->ds);
+
+ if (dev->reset_gpio)
+ gpiod_set_value(dev->reset_gpio, 1);
+
}
EXPORT_SYMBOL(ksz_switch_remove);
diff --git a/drivers/net/dsa/microchip/ksz_priv.h b/drivers/net/dsa/microchip/ksz_priv.h
index a38ff0841ed4e..60b49010904bf 100644
--- a/drivers/net/dsa/microchip/ksz_priv.h
+++ b/drivers/net/dsa/microchip/ksz_priv.h
@@ -59,6 +59,8 @@ struct ksz_device {
void *priv;
+ struct gpio_desc *reset_gpio; /* Optional reset GPIO */
+
/* chip specific data */
u32 chip_id;
int num_vlans;
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2 RESEND 1/2] net: dsa: ksz: Add optional reset GPIO to Microchip KSZ switch binding
2018-12-10 13:43 ` [PATCH V2 RESEND 1/2] net: dsa: ksz: Add optional reset GPIO to Microchip KSZ switch binding Marek Vasut
@ 2018-12-10 14:38 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2018-12-10 14:38 UTC (permalink / raw)
To: Marek Vasut
Cc: netdev, f.fainelli, vivien.didelot, Woojung.Huh, UNGLinuxDriver,
devicetree, David S . Miller
On Mon, Dec 10, 2018 at 02:43:05PM +0100, Marek Vasut wrote:
> Add optional reset GPIO, as such a signal is available on the KSZ switches.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
Hi Marek
Thanks for creating the patchset.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 RESEND 2/2] net: dsa: ksz: Add reset GPIO handling
2018-12-10 13:43 ` [PATCH V2 RESEND 2/2] net: dsa: ksz: Add reset GPIO handling Marek Vasut
@ 2018-12-10 14:39 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2018-12-10 14:39 UTC (permalink / raw)
To: Marek Vasut
Cc: netdev, f.fainelli, vivien.didelot, Woojung.Huh, UNGLinuxDriver,
devicetree, David S . Miller, Tristram Ha
On Mon, Dec 10, 2018 at 02:43:06PM +0100, Marek Vasut wrote:
> Add code to handle optional reset GPIO in the KSZ switch driver. The switch
> has a reset GPIO line which can be controlled by the CPU, so make sure it is
> configured correctly in such setups.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 RESEND 0/2] net: dsa: ksz: Add reset GPIO handling
2018-12-10 13:43 [PATCH V2 RESEND 0/2] net: dsa: ksz: Add reset GPIO handling Marek Vasut
2018-12-10 13:43 ` [PATCH V2 RESEND 1/2] net: dsa: ksz: Add optional reset GPIO to Microchip KSZ switch binding Marek Vasut
2018-12-10 13:43 ` [PATCH V2 RESEND 2/2] net: dsa: ksz: Add reset GPIO handling Marek Vasut
@ 2018-12-10 20:08 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-12-10 20:08 UTC (permalink / raw)
To: marex
Cc: netdev, f.fainelli, vivien.didelot, andrew, Woojung.Huh,
UNGLinuxDriver, devicetree
From: Marek Vasut <marex@denx.de>
Date: Mon, 10 Dec 2018 14:43:04 +0100
> Add code to handle optional reset GPIO in the KSZ switch driver and a
> matching DT property adjustments.
Series applied to net-next.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-12-10 20:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-10 13:43 [PATCH V2 RESEND 0/2] net: dsa: ksz: Add reset GPIO handling Marek Vasut
2018-12-10 13:43 ` [PATCH V2 RESEND 1/2] net: dsa: ksz: Add optional reset GPIO to Microchip KSZ switch binding Marek Vasut
2018-12-10 14:38 ` Andrew Lunn
2018-12-10 13:43 ` [PATCH V2 RESEND 2/2] net: dsa: ksz: Add reset GPIO handling Marek Vasut
2018-12-10 14:39 ` Andrew Lunn
2018-12-10 20:08 ` [PATCH V2 RESEND 0/2] " 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).