All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-04-12 13:29 ` Peter Griffin
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Griffin @ 2016-04-12 13:29 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, wsa
  Cc: peter.griffin, lee.jones, linux-i2c, Frederic Pillon

>From I2C specification:

http://www.nxp.com/documents/user_manual/UM10204.pdf

Rev. 03 section 3.1.16 titled "Bus clear". When the i2c device held the
SDA line low, the master should send 9 clocks pulses to try to recover.

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
---
 drivers/i2c/busses/i2c-st.c | 56 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
index 6ee7715..37b0b34 100644
--- a/drivers/i2c/busses/i2c-st.c
+++ b/drivers/i2c/busses/i2c-st.c
@@ -337,10 +337,51 @@ static void st_i2c_hw_config(struct st_i2c_dev *i2c_dev)
 	writel_relaxed(val, i2c_dev->base + SSC_NOISE_SUPP_WIDTH_DATAOUT);
 }
 
+/*
+ * i2c bus recovery routines
+ * get_scl and set_scl must be defined to avoid the recover_bus field of
+ * i2c_bus_recovery_info to be overriden with NULL during the
+ * i2c_add_adapter call
+ */
+
+static int st_i2c_get_scl(struct i2c_adapter *adap)
+{
+	return 0;
+}
+
+static void st_i2c_set_scl(struct i2c_adapter *adap, int val)
+{
+}
+
+static int st_i2c_recover_bus(struct i2c_adapter *i2c_adap)
+{
+	struct st_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap);
+	u32 ctl;
+
+	dev_err(i2c_dev->dev, "Trying to recover bus\n");
+
+	/* Disable interrupts */
+	writel_relaxed(0, i2c_dev->base + SSC_IEN);
+
+	st_i2c_hw_config(i2c_dev);
+
+	ctl = SSC_CTL_EN | SSC_CTL_MS |	SSC_CTL_EN_RX_FIFO | SSC_CTL_EN_TX_FIFO;
+	st_i2c_set_bits(i2c_dev->base + SSC_CTL, ctl);
+
+	st_i2c_clr_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
+	usleep_range(8000, 10000);
+
+	writel_relaxed(0, i2c_dev->base + SSC_TBUF);
+	usleep_range(2000, 4000);
+	st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
+
+	return 0;
+}
+
 static int st_i2c_wait_free_bus(struct st_i2c_dev *i2c_dev)
 {
 	u32 sta;
-	int i;
+	int i, ret;
 
 	for (i = 0; i < 10; i++) {
 		sta = readl_relaxed(i2c_dev->base + SSC_STA);
@@ -352,6 +393,12 @@ static int st_i2c_wait_free_bus(struct st_i2c_dev *i2c_dev)
 
 	dev_err(i2c_dev->dev, "bus not free (status = 0x%08x)\n", sta);
 
+	ret = i2c_recover_bus(&i2c_dev->adap);
+	if (ret) {
+		dev_err(i2c_dev->dev, "Failed to recover the bus (%d)\n", ret);
+		return ret;
+	}
+
 	return -EBUSY;
 }
 
@@ -744,6 +791,12 @@ static struct i2c_algorithm st_i2c_algo = {
 	.functionality = st_i2c_func,
 };
 
+static struct i2c_bus_recovery_info st_i2c_recovery_info = {
+	.recover_bus = st_i2c_recover_bus,
+	.get_scl =  st_i2c_get_scl,
+	.set_scl =  st_i2c_set_scl,
+};
+
 static int st_i2c_of_get_deglitch(struct device_node *np,
 		struct st_i2c_dev *i2c_dev)
 {
@@ -826,6 +879,7 @@ static int st_i2c_probe(struct platform_device *pdev)
 	adap->timeout = 2 * HZ;
 	adap->retries = 0;
 	adap->algo = &st_i2c_algo;
+	adap->bus_recovery_info = &st_i2c_recovery_info;
 	adap->dev.parent = &pdev->dev;
 	adap->dev.of_node = pdev->dev.of_node;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-04-12 13:29 ` Peter Griffin
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Griffin @ 2016-04-12 13:29 UTC (permalink / raw)
  To: linux-arm-kernel

>From I2C specification:

http://www.nxp.com/documents/user_manual/UM10204.pdf

Rev. 03 section 3.1.16 titled "Bus clear". When the i2c device held the
SDA line low, the master should send 9 clocks pulses to try to recover.

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
---
 drivers/i2c/busses/i2c-st.c | 56 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
index 6ee7715..37b0b34 100644
--- a/drivers/i2c/busses/i2c-st.c
+++ b/drivers/i2c/busses/i2c-st.c
@@ -337,10 +337,51 @@ static void st_i2c_hw_config(struct st_i2c_dev *i2c_dev)
 	writel_relaxed(val, i2c_dev->base + SSC_NOISE_SUPP_WIDTH_DATAOUT);
 }
 
+/*
+ * i2c bus recovery routines
+ * get_scl and set_scl must be defined to avoid the recover_bus field of
+ * i2c_bus_recovery_info to be overriden with NULL during the
+ * i2c_add_adapter call
+ */
+
+static int st_i2c_get_scl(struct i2c_adapter *adap)
+{
+	return 0;
+}
+
+static void st_i2c_set_scl(struct i2c_adapter *adap, int val)
+{
+}
+
+static int st_i2c_recover_bus(struct i2c_adapter *i2c_adap)
+{
+	struct st_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap);
+	u32 ctl;
+
+	dev_err(i2c_dev->dev, "Trying to recover bus\n");
+
+	/* Disable interrupts */
+	writel_relaxed(0, i2c_dev->base + SSC_IEN);
+
+	st_i2c_hw_config(i2c_dev);
+
+	ctl = SSC_CTL_EN | SSC_CTL_MS |	SSC_CTL_EN_RX_FIFO | SSC_CTL_EN_TX_FIFO;
+	st_i2c_set_bits(i2c_dev->base + SSC_CTL, ctl);
+
+	st_i2c_clr_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
+	usleep_range(8000, 10000);
+
+	writel_relaxed(0, i2c_dev->base + SSC_TBUF);
+	usleep_range(2000, 4000);
+	st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
+
+	return 0;
+}
+
 static int st_i2c_wait_free_bus(struct st_i2c_dev *i2c_dev)
 {
 	u32 sta;
-	int i;
+	int i, ret;
 
 	for (i = 0; i < 10; i++) {
 		sta = readl_relaxed(i2c_dev->base + SSC_STA);
@@ -352,6 +393,12 @@ static int st_i2c_wait_free_bus(struct st_i2c_dev *i2c_dev)
 
 	dev_err(i2c_dev->dev, "bus not free (status = 0x%08x)\n", sta);
 
+	ret = i2c_recover_bus(&i2c_dev->adap);
+	if (ret) {
+		dev_err(i2c_dev->dev, "Failed to recover the bus (%d)\n", ret);
+		return ret;
+	}
+
 	return -EBUSY;
 }
 
@@ -744,6 +791,12 @@ static struct i2c_algorithm st_i2c_algo = {
 	.functionality = st_i2c_func,
 };
 
+static struct i2c_bus_recovery_info st_i2c_recovery_info = {
+	.recover_bus = st_i2c_recover_bus,
+	.get_scl =  st_i2c_get_scl,
+	.set_scl =  st_i2c_set_scl,
+};
+
 static int st_i2c_of_get_deglitch(struct device_node *np,
 		struct st_i2c_dev *i2c_dev)
 {
@@ -826,6 +879,7 @@ static int st_i2c_probe(struct platform_device *pdev)
 	adap->timeout = 2 * HZ;
 	adap->retries = 0;
 	adap->algo = &st_i2c_algo;
+	adap->bus_recovery_info = &st_i2c_recovery_info;
 	adap->dev.parent = &pdev->dev;
 	adap->dev.of_node = pdev->dev.of_node;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
  2016-04-12 13:29 ` Peter Griffin
@ 2016-04-24 21:10   ` Wolfram Sang
  -1 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2016-04-24 21:10 UTC (permalink / raw)
  To: Peter Griffin
  Cc: linux-arm-kernel, linux-kernel, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, lee.jones, linux-i2c,
	Frederic Pillon

[-- Attachment #1: Type: text/plain, Size: 2016 bytes --]

> +/*
> + * i2c bus recovery routines
> + * get_scl and set_scl must be defined to avoid the recover_bus field of
> + * i2c_bus_recovery_info to be overriden with NULL during the
> + * i2c_add_adapter call
> + */

Oh, that shouldn't be like this. Can you try this patch and remove the
empty functions please?

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 4979728f7fb2de..604936955807e5 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1595,10 +1595,12 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 
 			bri->get_scl = get_scl_gpio_value;
 			bri->set_scl = set_scl_gpio_value;
-		} else if (!bri->set_scl || !bri->get_scl) {
+		} else if (bri->recover_bus == i2c_generic_scl_recovery) {
 			/* Generic SCL recovery */
-			dev_err(&adap->dev, "No {get|set}_gpio() found, not using recovery\n");
-			adap->bus_recovery_info = NULL;
+			if (!bri->set_scl || !bri->get_scl) {
+				dev_err(&adap->dev, "No {get|set}_scl() found, not using recovery\n");
+				adap->bus_recovery_info = NULL;
+			}
 		}
 	}
 

> +static int st_i2c_recover_bus(struct i2c_adapter *i2c_adap)
> +{

Can you describe what the function does? It is not clear to me that it
generates 9 scl pulses.

> +	struct st_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap);
> +	u32 ctl;
> +
> +	dev_err(i2c_dev->dev, "Trying to recover bus\n");

This is not an error. Either dev_dbg or drop it, I'd say.

> +
> +	/* Disable interrupts */
> +	writel_relaxed(0, i2c_dev->base + SSC_IEN);
> +
> +	st_i2c_hw_config(i2c_dev);
> +
> +	ctl = SSC_CTL_EN | SSC_CTL_MS |	SSC_CTL_EN_RX_FIFO | SSC_CTL_EN_TX_FIFO;
> +	st_i2c_set_bits(i2c_dev->base + SSC_CTL, ctl);
> +
> +	st_i2c_clr_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
> +	usleep_range(8000, 10000);
> +
> +	writel_relaxed(0, i2c_dev->base + SSC_TBUF);
> +	usleep_range(2000, 4000);
> +	st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
> +
> +	return 0;
> +}

Thanks,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-04-24 21:10   ` Wolfram Sang
  0 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2016-04-24 21:10 UTC (permalink / raw)
  To: linux-arm-kernel

> +/*
> + * i2c bus recovery routines
> + * get_scl and set_scl must be defined to avoid the recover_bus field of
> + * i2c_bus_recovery_info to be overriden with NULL during the
> + * i2c_add_adapter call
> + */

Oh, that shouldn't be like this. Can you try this patch and remove the
empty functions please?

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 4979728f7fb2de..604936955807e5 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1595,10 +1595,12 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 
 			bri->get_scl = get_scl_gpio_value;
 			bri->set_scl = set_scl_gpio_value;
-		} else if (!bri->set_scl || !bri->get_scl) {
+		} else if (bri->recover_bus == i2c_generic_scl_recovery) {
 			/* Generic SCL recovery */
-			dev_err(&adap->dev, "No {get|set}_gpio() found, not using recovery\n");
-			adap->bus_recovery_info = NULL;
+			if (!bri->set_scl || !bri->get_scl) {
+				dev_err(&adap->dev, "No {get|set}_scl() found, not using recovery\n");
+				adap->bus_recovery_info = NULL;
+			}
 		}
 	}
 

> +static int st_i2c_recover_bus(struct i2c_adapter *i2c_adap)
> +{

Can you describe what the function does? It is not clear to me that it
generates 9 scl pulses.

> +	struct st_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap);
> +	u32 ctl;
> +
> +	dev_err(i2c_dev->dev, "Trying to recover bus\n");

This is not an error. Either dev_dbg or drop it, I'd say.

> +
> +	/* Disable interrupts */
> +	writel_relaxed(0, i2c_dev->base + SSC_IEN);
> +
> +	st_i2c_hw_config(i2c_dev);
> +
> +	ctl = SSC_CTL_EN | SSC_CTL_MS |	SSC_CTL_EN_RX_FIFO | SSC_CTL_EN_TX_FIFO;
> +	st_i2c_set_bits(i2c_dev->base + SSC_CTL, ctl);
> +
> +	st_i2c_clr_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
> +	usleep_range(8000, 10000);
> +
> +	writel_relaxed(0, i2c_dev->base + SSC_TBUF);
> +	usleep_range(2000, 4000);
> +	st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
> +
> +	return 0;
> +}

Thanks,

   Wolfram

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160424/93bda987/attachment.sig>

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
  2016-04-24 21:10   ` Wolfram Sang
  (?)
@ 2016-04-28 13:30     ` Maxime Coquelin
  -1 siblings, 0 replies; 20+ messages in thread
From: Maxime Coquelin @ 2016-04-28 13:30 UTC (permalink / raw)
  To: Wolfram Sang, Peter Griffin
  Cc: linux-arm-kernel, linux-kernel, srinivas.kandagatla,
	patrice.chotard, lee.jones, linux-i2c, Frederic Pillon

Hi Wolfram,

On 04/24/2016 11:10 PM, Wolfram Sang wrote:
>> +/*
>> + * i2c bus recovery routines
>> + * get_scl and set_scl must be defined to avoid the recover_bus field of
>> + * i2c_bus_recovery_info to be overriden with NULL during the
>> + * i2c_add_adapter call
>> + */
> Oh, that shouldn't be like this. Can you try this patch and remove the
> empty functions please?
>
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 4979728f7fb2de..604936955807e5 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -1595,10 +1595,12 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>   
>   			bri->get_scl = get_scl_gpio_value;
>   			bri->set_scl = set_scl_gpio_value;
> -		} else if (!bri->set_scl || !bri->get_scl) {
> +		} else if (bri->recover_bus == i2c_generic_scl_recovery) {
>   			/* Generic SCL recovery */
> -			dev_err(&adap->dev, "No {get|set}_gpio() found, not using recovery\n");
> -			adap->bus_recovery_info = NULL;
> +			if (!bri->set_scl || !bri->get_scl) {
> +				dev_err(&adap->dev, "No {get|set}_scl() found, not using recovery\n");
> +				adap->bus_recovery_info = NULL;
> +			}
>   		}
>   	}
>   
>
>> +static int st_i2c_recover_bus(struct i2c_adapter *i2c_adap)
>> +{
> Can you describe what the function does? It is not clear to me that it
> generates 9 scl pulses.
I agree, it would need some comments.
This IP is dual-role, it can do either SPI or I2C.
The trick is to switch to SPI mode, 9 bits words and write a 0,
so that 9 clock pulses are generated.

This is easier to manage than switching to GPIO mode,
as we don't need to provide the gpio handles in DT, and no need to 
put/get the pinctrl handle.

Regards,
Maxime

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-04-28 13:30     ` Maxime Coquelin
  0 siblings, 0 replies; 20+ messages in thread
From: Maxime Coquelin @ 2016-04-28 13:30 UTC (permalink / raw)
  To: Wolfram Sang, Peter Griffin
  Cc: linux-arm-kernel, linux-kernel, srinivas.kandagatla,
	patrice.chotard, lee.jones, linux-i2c, Frederic Pillon

Hi Wolfram,

On 04/24/2016 11:10 PM, Wolfram Sang wrote:
>> +/*
>> + * i2c bus recovery routines
>> + * get_scl and set_scl must be defined to avoid the recover_bus field of
>> + * i2c_bus_recovery_info to be overriden with NULL during the
>> + * i2c_add_adapter call
>> + */
> Oh, that shouldn't be like this. Can you try this patch and remove the
> empty functions please?
>
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 4979728f7fb2de..604936955807e5 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -1595,10 +1595,12 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>   
>   			bri->get_scl = get_scl_gpio_value;
>   			bri->set_scl = set_scl_gpio_value;
> -		} else if (!bri->set_scl || !bri->get_scl) {
> +		} else if (bri->recover_bus == i2c_generic_scl_recovery) {
>   			/* Generic SCL recovery */
> -			dev_err(&adap->dev, "No {get|set}_gpio() found, not using recovery\n");
> -			adap->bus_recovery_info = NULL;
> +			if (!bri->set_scl || !bri->get_scl) {
> +				dev_err(&adap->dev, "No {get|set}_scl() found, not using recovery\n");
> +				adap->bus_recovery_info = NULL;
> +			}
>   		}
>   	}
>   
>
>> +static int st_i2c_recover_bus(struct i2c_adapter *i2c_adap)
>> +{
> Can you describe what the function does? It is not clear to me that it
> generates 9 scl pulses.
I agree, it would need some comments.
This IP is dual-role, it can do either SPI or I2C.
The trick is to switch to SPI mode, 9 bits words and write a 0,
so that 9 clock pulses are generated.

This is easier to manage than switching to GPIO mode,
as we don't need to provide the gpio handles in DT, and no need to 
put/get the pinctrl handle.

Regards,
Maxime

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-04-28 13:30     ` Maxime Coquelin
  0 siblings, 0 replies; 20+ messages in thread
From: Maxime Coquelin @ 2016-04-28 13:30 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Wolfram,

On 04/24/2016 11:10 PM, Wolfram Sang wrote:
>> +/*
>> + * i2c bus recovery routines
>> + * get_scl and set_scl must be defined to avoid the recover_bus field of
>> + * i2c_bus_recovery_info to be overriden with NULL during the
>> + * i2c_add_adapter call
>> + */
> Oh, that shouldn't be like this. Can you try this patch and remove the
> empty functions please?
>
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 4979728f7fb2de..604936955807e5 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -1595,10 +1595,12 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>   
>   			bri->get_scl = get_scl_gpio_value;
>   			bri->set_scl = set_scl_gpio_value;
> -		} else if (!bri->set_scl || !bri->get_scl) {
> +		} else if (bri->recover_bus == i2c_generic_scl_recovery) {
>   			/* Generic SCL recovery */
> -			dev_err(&adap->dev, "No {get|set}_gpio() found, not using recovery\n");
> -			adap->bus_recovery_info = NULL;
> +			if (!bri->set_scl || !bri->get_scl) {
> +				dev_err(&adap->dev, "No {get|set}_scl() found, not using recovery\n");
> +				adap->bus_recovery_info = NULL;
> +			}
>   		}
>   	}
>   
>
>> +static int st_i2c_recover_bus(struct i2c_adapter *i2c_adap)
>> +{
> Can you describe what the function does? It is not clear to me that it
> generates 9 scl pulses.
I agree, it would need some comments.
This IP is dual-role, it can do either SPI or I2C.
The trick is to switch to SPI mode, 9 bits words and write a 0,
so that 9 clock pulses are generated.

This is easier to manage than switching to GPIO mode,
as we don't need to provide the gpio handles in DT, and no need to 
put/get the pinctrl handle.

Regards,
Maxime

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
  2016-04-28 13:30     ` Maxime Coquelin
@ 2016-04-28 14:57       ` Wolfram Sang
  -1 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2016-04-28 14:57 UTC (permalink / raw)
  To: Maxime Coquelin
  Cc: Peter Griffin, linux-arm-kernel, linux-kernel,
	srinivas.kandagatla, patrice.chotard, lee.jones, linux-i2c,
	Frederic Pillon

[-- Attachment #1: Type: text/plain, Size: 181 bytes --]


> The trick is to switch to SPI mode, 9 bits words and write a 0,
> so that 9 clock pulses are generated.

Heh. As long as it works :) But as you said, it really needs a comment.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-04-28 14:57       ` Wolfram Sang
  0 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2016-04-28 14:57 UTC (permalink / raw)
  To: linux-arm-kernel


> The trick is to switch to SPI mode, 9 bits words and write a 0,
> so that 9 clock pulses are generated.

Heh. As long as it works :) But as you said, it really needs a comment.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160428/f5187d0c/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
  2016-04-28 14:57       ` Wolfram Sang
  (?)
@ 2016-04-29 11:26         ` Maxime Coquelin
  -1 siblings, 0 replies; 20+ messages in thread
From: Maxime Coquelin @ 2016-04-29 11:26 UTC (permalink / raw)
  To: Wolfram Sang, Peter Griffin
  Cc: linux-arm-kernel, linux-kernel, srinivas.kandagatla,
	patrice.chotard, lee.jones, linux-i2c, Frederic Pillon



On 04/28/2016 04:57 PM, Wolfram Sang wrote:
>> The trick is to switch to SPI mode, 9 bits words and write a 0,
>> so that 9 clock pulses are generated.
> Heh. As long as it works :) But as you said, it really needs a comment.
>
:)
I didn't faced the problem myself, but it looks good with an oscilloscope,
and a customer reported it to work.

Peter, will you resend with adding the explanations I provided as comment?

Thanks in advance,
Maxime

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-04-29 11:26         ` Maxime Coquelin
  0 siblings, 0 replies; 20+ messages in thread
From: Maxime Coquelin @ 2016-04-29 11:26 UTC (permalink / raw)
  To: Wolfram Sang, Peter Griffin
  Cc: linux-arm-kernel, linux-kernel, srinivas.kandagatla,
	patrice.chotard, lee.jones, linux-i2c, Frederic Pillon



On 04/28/2016 04:57 PM, Wolfram Sang wrote:
>> The trick is to switch to SPI mode, 9 bits words and write a 0,
>> so that 9 clock pulses are generated.
> Heh. As long as it works :) But as you said, it really needs a comment.
>
:)
I didn't faced the problem myself, but it looks good with an oscilloscope,
and a customer reported it to work.

Peter, will you resend with adding the explanations I provided as comment?

Thanks in advance,
Maxime

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-04-29 11:26         ` Maxime Coquelin
  0 siblings, 0 replies; 20+ messages in thread
From: Maxime Coquelin @ 2016-04-29 11:26 UTC (permalink / raw)
  To: linux-arm-kernel



On 04/28/2016 04:57 PM, Wolfram Sang wrote:
>> The trick is to switch to SPI mode, 9 bits words and write a 0,
>> so that 9 clock pulses are generated.
> Heh. As long as it works :) But as you said, it really needs a comment.
>
:)
I didn't faced the problem myself, but it looks good with an oscilloscope,
and a customer reported it to work.

Peter, will you resend with adding the explanations I provided as comment?

Thanks in advance,
Maxime

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
  2016-04-29 11:26         ` Maxime Coquelin
@ 2016-04-29 14:03           ` Peter Griffin
  -1 siblings, 0 replies; 20+ messages in thread
From: Peter Griffin @ 2016-04-29 14:03 UTC (permalink / raw)
  To: Maxime Coquelin
  Cc: Wolfram Sang, linux-arm-kernel, linux-kernel,
	srinivas.kandagatla, patrice.chotard, lee.jones, linux-i2c,
	Frederic Pillon

Hi Maxime,

On Fri, 29 Apr 2016, Maxime Coquelin wrote:

> 
> 
> On 04/28/2016 04:57 PM, Wolfram Sang wrote:
> >>The trick is to switch to SPI mode, 9 bits words and write a 0,
> >>so that 9 clock pulses are generated.
> >Heh. As long as it works :) But as you said, it really needs a comment.
> >
> :)
> I didn't faced the problem myself, but it looks good with an oscilloscope,
> and a customer reported it to work.
> 
> Peter, will you resend with adding the explanations I provided as comment?
>
Yes I'll send a v2 with your comment added.

Peter

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-04-29 14:03           ` Peter Griffin
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Griffin @ 2016-04-29 14:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Maxime,

On Fri, 29 Apr 2016, Maxime Coquelin wrote:

> 
> 
> On 04/28/2016 04:57 PM, Wolfram Sang wrote:
> >>The trick is to switch to SPI mode, 9 bits words and write a 0,
> >>so that 9 clock pulses are generated.
> >Heh. As long as it works :) But as you said, it really needs a comment.
> >
> :)
> I didn't faced the problem myself, but it looks good with an oscilloscope,
> and a customer reported it to work.
> 
> Peter, will you resend with adding the explanations I provided as comment?
>
Yes I'll send a v2 with your comment added.

Peter

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
  2016-04-29 14:03           ` Peter Griffin
@ 2016-05-11 15:01             ` Wolfram Sang
  -1 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2016-05-11 15:01 UTC (permalink / raw)
  To: Peter Griffin
  Cc: Maxime Coquelin, linux-arm-kernel, linux-kernel,
	srinivas.kandagatla, patrice.chotard, lee.jones, linux-i2c,
	Frederic Pillon

[-- Attachment #1: Type: text/plain, Size: 58 bytes --]

> Yes I'll send a v2 with your comment added.

Any news?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-05-11 15:01             ` Wolfram Sang
  0 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2016-05-11 15:01 UTC (permalink / raw)
  To: linux-arm-kernel

> Yes I'll send a v2 with your comment added.

Any news?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160511/35636bd2/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
  2016-05-11 15:01             ` Wolfram Sang
@ 2016-05-11 15:26               ` Peter Griffin
  -1 siblings, 0 replies; 20+ messages in thread
From: Peter Griffin @ 2016-05-11 15:26 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Maxime Coquelin, linux-arm-kernel, linux-kernel,
	srinivas.kandagatla, patrice.chotard, lee.jones, linux-i2c,
	Frederic Pillon

Hi Wolfram,

On Wed, 11 May 2016, Wolfram Sang wrote:

> > Yes I'll send a v2 with your comment added.
> 
> Any news?
>
Sorry, I will re-send it in a few minutes.

Peter. 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-05-11 15:26               ` Peter Griffin
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Griffin @ 2016-05-11 15:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Wolfram,

On Wed, 11 May 2016, Wolfram Sang wrote:

> > Yes I'll send a v2 with your comment added.
> 
> Any news?
>
Sorry, I will re-send it in a few minutes.

Peter. 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
  2016-04-24 21:10   ` Wolfram Sang
@ 2016-05-11 16:22     ` Peter Griffin
  -1 siblings, 0 replies; 20+ messages in thread
From: Peter Griffin @ 2016-05-11 16:22 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-arm-kernel, linux-kernel, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, lee.jones, linux-i2c,
	Frederic Pillon

Hi Wolfram,

On Sun, 24 Apr 2016, Wolfram Sang wrote:

> > +/*
> > + * i2c bus recovery routines
> > + * get_scl and set_scl must be defined to avoid the recover_bus field of
> > + * i2c_bus_recovery_info to be overriden with NULL during the
> > + * i2c_add_adapter call
> > + */
> 
> Oh, that shouldn't be like this. Can you try this patch and remove the
> empty functions please?

That works, so will need to be applied along with my v2 which I just sent.

regards,

Peter.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
@ 2016-05-11 16:22     ` Peter Griffin
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Griffin @ 2016-05-11 16:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Wolfram,

On Sun, 24 Apr 2016, Wolfram Sang wrote:

> > +/*
> > + * i2c bus recovery routines
> > + * get_scl and set_scl must be defined to avoid the recover_bus field of
> > + * i2c_bus_recovery_info to be overriden with NULL during the
> > + * i2c_add_adapter call
> > + */
> 
> Oh, that shouldn't be like this. Can you try this patch and remove the
> empty functions please?

That works, so will need to be applied along with my v2 which I just sent.

regards,

Peter.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-05-11 16:23 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12 13:29 [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks Peter Griffin
2016-04-12 13:29 ` Peter Griffin
2016-04-24 21:10 ` Wolfram Sang
2016-04-24 21:10   ` Wolfram Sang
2016-04-28 13:30   ` Maxime Coquelin
2016-04-28 13:30     ` Maxime Coquelin
2016-04-28 13:30     ` Maxime Coquelin
2016-04-28 14:57     ` Wolfram Sang
2016-04-28 14:57       ` Wolfram Sang
2016-04-29 11:26       ` Maxime Coquelin
2016-04-29 11:26         ` Maxime Coquelin
2016-04-29 11:26         ` Maxime Coquelin
2016-04-29 14:03         ` Peter Griffin
2016-04-29 14:03           ` Peter Griffin
2016-05-11 15:01           ` Wolfram Sang
2016-05-11 15:01             ` Wolfram Sang
2016-05-11 15:26             ` Peter Griffin
2016-05-11 15:26               ` Peter Griffin
2016-05-11 16:22   ` Peter Griffin
2016-05-11 16:22     ` Peter Griffin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.