* [PATCH] i2c-mux-pca954x: Add code to control reset line
@ 2016-11-15 14:46 Andrey Smirnov
2016-11-17 6:43 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Smirnov @ 2016-11-15 14:46 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Most recent device tree binding for that mux support specifying a GPIO
connected to a reset line of that chip. Add code to handle that binding
in order to be able to use the chip on boards that leverage
aforementioned functionality.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/i2c/muxes/i2c-mux-pca954x.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index baeae7b..0d5515b 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -45,6 +45,8 @@
#include <i2c/i2c-algo-bit.h>
#include <i2c/i2c-mux.h>
#include <init.h>
+#include <gpio.h>
+#include <of_gpio.h>
#define PCA954X_MAX_NCHANS 8
@@ -179,6 +181,7 @@ static int pca954x_probe(struct device_d *dev)
int num, force;
struct pca954x *data;
int ret = -ENODEV;
+ int gpio;
data = kzalloc(sizeof(struct pca954x), GFP_KERNEL);
if (!data) {
@@ -188,6 +191,10 @@ static int pca954x_probe(struct device_d *dev)
i2c_set_clientdata(client, data);
+ gpio = of_get_named_gpio(dev->device_node, "reset-gpios", 0);
+ if (gpio_is_valid(gpio))
+ gpio_direction_output(gpio, 1);
+
/* Read the mux register at addr to verify
* that the mux is in fact present.
*/
--
2.5.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c-mux-pca954x: Add code to control reset line
2016-11-15 14:46 [PATCH] i2c-mux-pca954x: Add code to control reset line Andrey Smirnov
@ 2016-11-17 6:43 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2016-11-17 6:43 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Tue, Nov 15, 2016 at 06:46:45AM -0800, Andrey Smirnov wrote:
> Most recent device tree binding for that mux support specifying a GPIO
> connected to a reset line of that chip. Add code to handle that binding
> in order to be able to use the chip on boards that leverage
> aforementioned functionality.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> drivers/i2c/muxes/i2c-mux-pca954x.c | 7 +++++++
> 1 file changed, 7 insertions(+)
Applied, thanks
Sascha
>
> diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
> index baeae7b..0d5515b 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
> @@ -45,6 +45,8 @@
> #include <i2c/i2c-algo-bit.h>
> #include <i2c/i2c-mux.h>
> #include <init.h>
> +#include <gpio.h>
> +#include <of_gpio.h>
>
> #define PCA954X_MAX_NCHANS 8
>
> @@ -179,6 +181,7 @@ static int pca954x_probe(struct device_d *dev)
> int num, force;
> struct pca954x *data;
> int ret = -ENODEV;
> + int gpio;
>
> data = kzalloc(sizeof(struct pca954x), GFP_KERNEL);
> if (!data) {
> @@ -188,6 +191,10 @@ static int pca954x_probe(struct device_d *dev)
>
> i2c_set_clientdata(client, data);
>
> + gpio = of_get_named_gpio(dev->device_node, "reset-gpios", 0);
> + if (gpio_is_valid(gpio))
> + gpio_direction_output(gpio, 1);
> +
> /* Read the mux register at addr to verify
> * that the mux is in fact present.
> */
> --
> 2.5.5
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-17 6:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-15 14:46 [PATCH] i2c-mux-pca954x: Add code to control reset line Andrey Smirnov
2016-11-17 6:43 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox