* [PATCH] i2c: designware: prevent early stop on TX FIFO empty
@ 2014-11-07 12:10 Andrew Jackson
2014-11-19 9:21 ` Wolfram Sang
2014-11-21 7:05 ` Wolfram Sang
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Jackson @ 2014-11-07 12:10 UTC (permalink / raw)
To: Wolfram Sang, Andrew Morton, Baruch Siach, Du, Wenkai,
Shinya Kuribayashi, Romain Baeriswyl, linux-i2c, linux-kernel
Cc: Liviu Dudau, linux-arm-kernel
If the Designware core is configured with IC_EMPTYFIFO_HOLD_MASTER_EN
set to zero, allowing the TX FIFO to become empty causes a STOP
condition to be generated on the I2C bus. If the transmit FIFO
threshold is set too high, an erroneous STOP condition can be
generated on long transfers - particularly where the interrupt
latency is extended.
Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
---
drivers/i2c/busses/i2c-designware-core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 3c20e4b..e070edd 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -363,7 +363,7 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
}
/* Configure Tx/Rx FIFO threshold levels */
- dw_writel(dev, dev->tx_fifo_depth - 1, DW_IC_TX_TL);
+ dw_writel(dev, dev->tx_fifo_depth / 2, DW_IC_TX_TL);
dw_writel(dev, 0, DW_IC_RX_TL);
/* configure the i2c master */
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: designware: prevent early stop on TX FIFO empty
2014-11-07 12:10 [PATCH] i2c: designware: prevent early stop on TX FIFO empty Andrew Jackson
@ 2014-11-19 9:21 ` Wolfram Sang
2014-11-19 13:35 ` Baruch Siach
2014-11-19 14:18 ` Mika Westerberg
2014-11-21 7:05 ` Wolfram Sang
1 sibling, 2 replies; 5+ messages in thread
From: Wolfram Sang @ 2014-11-19 9:21 UTC (permalink / raw)
To: Andrew Jackson
Cc: Andrew Morton, Baruch Siach, Du, Wenkai, Shinya Kuribayashi,
Romain Baeriswyl, linux-i2c, linux-kernel, Liviu Dudau,
linux-arm-kernel, Mika Westerberg
[-- Attachment #1: Type: text/plain, Size: 1338 bytes --]
On Fri, Nov 07, 2014 at 12:10:44PM +0000, Andrew Jackson wrote:
> If the Designware core is configured with IC_EMPTYFIFO_HOLD_MASTER_EN
> set to zero, allowing the TX FIFO to become empty causes a STOP
> condition to be generated on the I2C bus. If the transmit FIFO
> threshold is set too high, an erroneous STOP condition can be
> generated on long transfers - particularly where the interrupt
> latency is extended.
>
> Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
> Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
So, what do other designware users think of this change (nice CC list
BTW, Andrew). Adding Mika, too.
> ---
> drivers/i2c/busses/i2c-designware-core.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
> index 3c20e4b..e070edd 100644
> --- a/drivers/i2c/busses/i2c-designware-core.c
> +++ b/drivers/i2c/busses/i2c-designware-core.c
> @@ -363,7 +363,7 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
> }
>
> /* Configure Tx/Rx FIFO threshold levels */
> - dw_writel(dev, dev->tx_fifo_depth - 1, DW_IC_TX_TL);
> + dw_writel(dev, dev->tx_fifo_depth / 2, DW_IC_TX_TL);
> dw_writel(dev, 0, DW_IC_RX_TL);
>
> /* configure the i2c master */
> --
> 1.7.1
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: designware: prevent early stop on TX FIFO empty
2014-11-19 9:21 ` Wolfram Sang
@ 2014-11-19 13:35 ` Baruch Siach
2014-11-19 14:18 ` Mika Westerberg
1 sibling, 0 replies; 5+ messages in thread
From: Baruch Siach @ 2014-11-19 13:35 UTC (permalink / raw)
To: Wolfram Sang
Cc: Andrew Jackson, Andrew Morton, Du, Wenkai, Shinya Kuribayashi,
Romain Baeriswyl, linux-i2c, linux-kernel, Liviu Dudau,
linux-arm-kernel, Mika Westerberg
Hi Wolfram,
On Wed, Nov 19, 2014 at 10:21:22AM +0100, Wolfram Sang wrote:
> On Fri, Nov 07, 2014 at 12:10:44PM +0000, Andrew Jackson wrote:
> > If the Designware core is configured with IC_EMPTYFIFO_HOLD_MASTER_EN
> > set to zero, allowing the TX FIFO to become empty causes a STOP
> > condition to be generated on the I2C bus. If the transmit FIFO
> > threshold is set too high, an erroneous STOP condition can be
> > generated on long transfers - particularly where the interrupt
> > latency is extended.
> >
> > Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
> > Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
>
> So, what do other designware users think of this change (nice CC list
> BTW, Andrew). Adding Mika, too.
I don't have access to this hardware anymore so I can't test. As far as I
remember the spec this change should be OK.
baruch
> > drivers/i2c/busses/i2c-designware-core.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
> > index 3c20e4b..e070edd 100644
> > --- a/drivers/i2c/busses/i2c-designware-core.c
> > +++ b/drivers/i2c/busses/i2c-designware-core.c
> > @@ -363,7 +363,7 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
> > }
> >
> > /* Configure Tx/Rx FIFO threshold levels */
> > - dw_writel(dev, dev->tx_fifo_depth - 1, DW_IC_TX_TL);
> > + dw_writel(dev, dev->tx_fifo_depth / 2, DW_IC_TX_TL);
> > dw_writel(dev, 0, DW_IC_RX_TL);
> >
> > /* configure the i2c master */
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: designware: prevent early stop on TX FIFO empty
2014-11-19 9:21 ` Wolfram Sang
2014-11-19 13:35 ` Baruch Siach
@ 2014-11-19 14:18 ` Mika Westerberg
1 sibling, 0 replies; 5+ messages in thread
From: Mika Westerberg @ 2014-11-19 14:18 UTC (permalink / raw)
To: Wolfram Sang
Cc: Andrew Jackson, Andrew Morton, Baruch Siach, Du, Wenkai,
Shinya Kuribayashi, Romain Baeriswyl, linux-i2c, linux-kernel,
Liviu Dudau, linux-arm-kernel
On Wed, Nov 19, 2014 at 10:21:22AM +0100, Wolfram Sang wrote:
> On Fri, Nov 07, 2014 at 12:10:44PM +0000, Andrew Jackson wrote:
> > If the Designware core is configured with IC_EMPTYFIFO_HOLD_MASTER_EN
> > set to zero, allowing the TX FIFO to become empty causes a STOP
> > condition to be generated on the I2C bus. If the transmit FIFO
> > threshold is set too high, an erroneous STOP condition can be
> > generated on long transfers - particularly where the interrupt
> > latency is extended.
Makes sense to give some slack so that the interrupt handler is still
able to fill the FIFO.
> >
> > Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
> > Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
>
> So, what do other designware users think of this change (nice CC list
> BTW, Andrew). Adding Mika, too.
I quickly tested this on Haswell machine with touch screen connected to
the I2C bus and it still works fine, so
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: designware: prevent early stop on TX FIFO empty
2014-11-07 12:10 [PATCH] i2c: designware: prevent early stop on TX FIFO empty Andrew Jackson
2014-11-19 9:21 ` Wolfram Sang
@ 2014-11-21 7:05 ` Wolfram Sang
1 sibling, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2014-11-21 7:05 UTC (permalink / raw)
To: Andrew Jackson
Cc: Andrew Morton, Baruch Siach, Du, Wenkai, Shinya Kuribayashi,
Romain Baeriswyl, linux-i2c, linux-kernel, Liviu Dudau,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 577 bytes --]
On Fri, Nov 07, 2014 at 12:10:44PM +0000, Andrew Jackson wrote:
> If the Designware core is configured with IC_EMPTYFIFO_HOLD_MASTER_EN
> set to zero, allowing the TX FIFO to become empty causes a STOP
> condition to be generated on the I2C bus. If the transmit FIFO
> threshold is set too high, an erroneous STOP condition can be
> generated on long transfers - particularly where the interrupt
> latency is extended.
>
> Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
> Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Applied to for-current, thanks!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-21 7:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-07 12:10 [PATCH] i2c: designware: prevent early stop on TX FIFO empty Andrew Jackson
2014-11-19 9:21 ` Wolfram Sang
2014-11-19 13:35 ` Baruch Siach
2014-11-19 14:18 ` Mika Westerberg
2014-11-21 7:05 ` Wolfram Sang
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).