linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] w1:omap_hdq: fix regression
@ 2016-07-18 16:10 H. Nikolaus Schaller
  2016-07-18 19:29 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: H. Nikolaus Schaller @ 2016-07-18 16:10 UTC (permalink / raw)
  To: Evgeniy Polyakov, Vignesh R, Greg Kroah-Hartman, Andreas Kemnade,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Jonathan Corbet, Tony Lindgren, NeilBrown, Fabian Frederick,
	Andrew Morton
  Cc: linux-kernel, letux-kernel, H. Nikolaus Schaller

commit <e93762bbf681> ("w1: masters: omap_hdq: add support for 1-wire mode")
did add a statement to clear the hdq_irqstatus flags in hdq_read_byte().

If the hdq reading process is scheduled slowly or interrupts are disabled
for a while the hardware read activity might already be finished on entry
of hdq_read_byte(). And hdq_isr() already has set the hdq_irqstatus to
0x6 (can be seen in debug mode) denoting that both, the TXCOMPLETE
and RXCOMPLETE interrupts occurred in parallel.

This means there is no need to wait and the hdq_read_byte() can just read
the byte from the hdq controller.

By resetting hdq_irqstatus to 0 the read process is forced to be always
waiting again (because the if statement always succeeds) but the hardware
will not issue another RXCOMPLETE interrupt. This results in a false
timeout.

After such a situation the hdq bus hangs.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/w1/masters/omap_hdq.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index a2eec97..bb09de6 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -390,8 +390,6 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
 		goto out;
 	}
 
-	hdq_data->hdq_irqstatus = 0;
-
 	if (!(hdq_data->hdq_irqstatus & OMAP_HDQ_INT_STATUS_RXCOMPLETE)) {
 		hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS,
 			OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO,
-- 
2.7.3

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

* Re: [PATCH] w1:omap_hdq: fix regression
  2016-07-18 16:10 [PATCH] w1:omap_hdq: fix regression H. Nikolaus Schaller
@ 2016-07-18 19:29 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2016-07-18 19:29 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Evgeniy Polyakov, Vignesh R, Greg Kroah-Hartman, Andreas Kemnade,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Jonathan Corbet, Tony Lindgren, NeilBrown, Fabian Frederick,
	linux-kernel, letux-kernel

On Mon, 18 Jul 2016 18:10:37 +0200 "H. Nikolaus Schaller" <hns@goldelico.com> wrote:

> commit <e93762bbf681> ("w1: masters: omap_hdq: add support for 1-wire mode")
> did add a statement to clear the hdq_irqstatus flags in hdq_read_byte().
> 
> If the hdq reading process is scheduled slowly or interrupts are disabled
> for a while the hardware read activity might already be finished on entry
> of hdq_read_byte(). And hdq_isr() already has set the hdq_irqstatus to
> 0x6 (can be seen in debug mode) denoting that both, the TXCOMPLETE
> and RXCOMPLETE interrupts occurred in parallel.
> 
> This means there is no need to wait and the hdq_read_byte() can just read
> the byte from the hdq controller.
> 
> By resetting hdq_irqstatus to 0 the read process is forced to be always
> waiting again (because the if statement always succeeds) but the hardware
> will not issue another RXCOMPLETE interrupt. This results in a false
> timeout.
> 
> After such a situation the hdq bus hangs.
> 
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>

Needs a cc:stable.

I'll assume Greg will be handling this patch.

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

end of thread, other threads:[~2016-07-18 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18 16:10 [PATCH] w1:omap_hdq: fix regression H. Nikolaus Schaller
2016-07-18 19:29 ` Andrew Morton

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).