mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jan Luebbe <jluebbe@debian.org>
To: barebox@lists.infradead.org
Subject: [PATCH v2 6/6] i2c: gpio: add bus recovery support
Date: Thu, 30 Jul 2015 16:52:11 +0200	[thread overview]
Message-ID: <1438267931-22374-7-git-send-email-jluebbe@debian.org> (raw)
In-Reply-To: <1438267931-22374-1-git-send-email-jluebbe@debian.org>

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
---
 drivers/i2c/busses/i2c-gpio.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index b4a0ecd..9362ed1 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <driver.h>
+#include <malloc.h>
 #include <i2c/i2c.h>
 #include <i2c/i2c-algo-bit.h>
 #include <i2c/i2c-gpio.h>
@@ -187,6 +188,13 @@ static int i2c_gpio_probe(struct device_d *dev)
 	adap->algo_data = bit_data;
 	adap->dev.parent = dev;
 	adap->dev.device_node = dev->device_node;
+	adap->bus_recovery_info = xzalloc(sizeof(*adap->bus_recovery_info));
+	adap->bus_recovery_info->scl_gpio = pdata->scl_pin;
+	adap->bus_recovery_info->sda_gpio = pdata->sda_pin;
+	adap->bus_recovery_info->get_sda = i2c_get_sda_gpio_value;
+	adap->bus_recovery_info->get_scl = i2c_get_scl_gpio_value;
+	adap->bus_recovery_info->set_scl = i2c_set_scl_gpio_value;
+	adap->bus_recovery_info->recover_bus = i2c_generic_scl_recovery;
 
 	adap->nr = dev->id;
 	ret = i2c_bit_add_numbered_bus(adap);
@@ -201,10 +209,12 @@ static int i2c_gpio_probe(struct device_d *dev)
 	return 0;
 
 err_add_bus:
+	free(adap->bus_recovery_info);
 	gpio_free(pdata->scl_pin);
 err_request_scl:
 	gpio_free(pdata->sda_pin);
 err_request_sda:
+	free(priv);
 	return ret;
 }
 
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-07-30 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 14:52 [PATCH v2 0/6] i2c: add bus recovery infrastructure Jan Luebbe
2015-07-30 14:52 ` [PATCH v2 1/6] " Jan Luebbe
2015-07-30 14:52 ` [PATCH v2 2/6] i2c-omap: clear ARDY twice Jan Luebbe
2015-07-30 14:52 ` [PATCH v2 3/6] i2c-omap: add bus recovery support Jan Luebbe
2015-07-30 14:52 ` [PATCH v2 4/6] i2c: algo-bit: fix debug code Jan Luebbe
2015-07-30 14:52 ` [PATCH v2 5/6] i2c: algo-bit: check if the bus is busy Jan Luebbe
2015-07-30 14:52 ` Jan Luebbe [this message]
2015-07-31  7:29 ` [PATCH v2 0/6] i2c: add bus recovery infrastructure Sascha Hauer
2015-08-03  9:20   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438267931-22374-7-git-send-email-jluebbe@debian.org \
    --to=jluebbe@debian.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox