* [PATCH 1/2] pinctrl: mcp23s08: Add optional reset GPIO
@ 2021-06-10 13:24 Andreas Kaessens
2021-06-10 13:24 ` [PATCH 2/2] dt-bindings: pinctrl: mcp23s08: add documentation for reset-gpios Andreas Kaessens
2021-06-11 23:59 ` [PATCH 1/2] pinctrl: mcp23s08: Add optional reset GPIO Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Andreas Kaessens @ 2021-06-10 13:24 UTC (permalink / raw)
To: linus.walleij, robh+dt, linux-gpio, devicetree, linux-kernel
Cc: linux-kernel, Andreas Kaessens, Darian Biastoch
The MCP23x port expander RESET# line can be connected to a host GPIO.
The optional reset-gpio must be set to LOW if the reset is asserted
at probing time.
On page 5 in the datasheet [0] the "Device Active After Reset high"
time is specified at 0 µs. Therefore no waiting is needed after the
reset transition.
[0] https://ww1.microchip.com/downloads/en/DeviceDoc/20001952C.pdf
Signed-off-by: Andreas Kaessens <akaessens@gmail.com>
Signed-off-by: Darian Biastoch <d.biastoch@gmail.com>
---
drivers/pinctrl/pinctrl-mcp23s08.c | 3 +++
drivers/pinctrl/pinctrl-mcp23s08.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index 799d596a1a4b..8ab254170d99 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -9,6 +9,7 @@
#include <linux/module.h>
#include <linux/export.h>
#include <linux/gpio/driver.h>
+#include <linux/gpio/consumer.h>
#include <linux/slab.h>
#include <asm/byteorder.h>
#include <linux/interrupt.h>
@@ -558,6 +559,8 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
mcp->chip.parent = dev;
mcp->chip.owner = THIS_MODULE;
+ mcp->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+
/* verify MCP_IOCON.SEQOP = 0, so sequential reads work,
* and MCP_IOCON.HAEN = 1, so we work with all chips.
*/
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.h b/drivers/pinctrl/pinctrl-mcp23s08.h
index 90dc27081a3c..b8d15939e0c2 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.h
+++ b/drivers/pinctrl/pinctrl-mcp23s08.h
@@ -43,6 +43,7 @@ struct mcp23s08 {
struct pinctrl_dev *pctldev;
struct pinctrl_desc pinctrl_desc;
+ struct gpio_desc *reset_gpio;
};
extern const struct regmap_config mcp23x08_regmap;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] dt-bindings: pinctrl: mcp23s08: add documentation for reset-gpios
2021-06-10 13:24 [PATCH 1/2] pinctrl: mcp23s08: Add optional reset GPIO Andreas Kaessens
@ 2021-06-10 13:24 ` Andreas Kaessens
2021-06-11 23:59 ` [PATCH 1/2] pinctrl: mcp23s08: Add optional reset GPIO Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Kaessens @ 2021-06-10 13:24 UTC (permalink / raw)
To: linus.walleij, robh+dt, linux-gpio, devicetree, linux-kernel
Cc: linux-kernel, Andreas Kaessens, Darian Biastoch
The reset-gpios property is added to the optional dt-bindings and
also an example for it's usage.
Signed-off-by: Andreas Kaessens <akaessens@gmail.com>
Signed-off-by: Darian Biastoch <d.biastoch@gmail.com>
---
Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
index 6ec3c8d79f49..2fa5edac7a35 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mcp23s08.txt
@@ -49,6 +49,7 @@ Optional properties:
- interrupt-controller: Marks the device node as a interrupt controller.
- drive-open-drain: Sets the ODR flag in the IOCON register. This configures
the IRQ output as open drain active low.
+- reset-gpios: Corresponds to the active-low RESET# pin for the chip
Optional device specific properties:
- microchip,irq-mirror: Sets the mirror flag in the IOCON register. Devices
@@ -135,6 +136,7 @@ gpio21: gpio@21 {
microchip,irq-mirror;
pinctrl-names = "default";
pinctrl-0 = <&i2cgpio0irq>, <&gpio21pullups>;
+ reset-gpios = <&gpio6 15 GPIO_ACTIVE_LOW>;
gpio21pullups: pinmux {
pins = "gpio0", "gpio1", "gpio2", "gpio3",
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] pinctrl: mcp23s08: Add optional reset GPIO
2021-06-10 13:24 [PATCH 1/2] pinctrl: mcp23s08: Add optional reset GPIO Andreas Kaessens
2021-06-10 13:24 ` [PATCH 2/2] dt-bindings: pinctrl: mcp23s08: add documentation for reset-gpios Andreas Kaessens
@ 2021-06-11 23:59 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2021-06-11 23:59 UTC (permalink / raw)
To: Andreas Kaessens
Cc: Rob Herring, open list:GPIO SUBSYSTEM,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
linux-kernel, linux-kernel, Darian Biastoch
On Thu, Jun 10, 2021 at 3:24 PM Andreas Kaessens <akaessens@gmail.com> wrote:
> The MCP23x port expander RESET# line can be connected to a host GPIO.
> The optional reset-gpio must be set to LOW if the reset is asserted
> at probing time.
>
> On page 5 in the datasheet [0] the "Device Active After Reset high"
> time is specified at 0 µs. Therefore no waiting is needed after the
> reset transition.
>
> [0] https://ww1.microchip.com/downloads/en/DeviceDoc/20001952C.pdf
>
> Signed-off-by: Andreas Kaessens <akaessens@gmail.com>
> Signed-off-by: Darian Biastoch <d.biastoch@gmail.com>
Both patches applied, thanks!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-11 23:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-10 13:24 [PATCH 1/2] pinctrl: mcp23s08: Add optional reset GPIO Andreas Kaessens
2021-06-10 13:24 ` [PATCH 2/2] dt-bindings: pinctrl: mcp23s08: add documentation for reset-gpios Andreas Kaessens
2021-06-11 23:59 ` [PATCH 1/2] pinctrl: mcp23s08: Add optional reset GPIO Linus Walleij
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).