Commit 893c48cf authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Greg Kroah-Hartman

i2c: rcar: fix MNR interrupt handling

commit dd318b0d upstream.

Sometimes the MNR and MST interrupts happen simultaneously  (stop  automatically
follows NACK, according to the manuals) and in such case the ID_NACK flag  isn't
set since the MST interrupt handling precedes MNR and all interrupts are cleared
and disabled then, so that MNR interrupt is never noticed -- this causes NACK'ed
transfers to be falsely reported as successful. Exchanging MNR and  MST handlers
fixes this issue, however the MNR bit  somehow  gets set again even after  being
explicitly cleared, so I decided to completely suppress handling of all disabled
interrupts (which is a good thing anyway)...
Signed-off-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2fb2af14
...@@ -372,18 +372,15 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr) ...@@ -372,18 +372,15 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
msr = rcar_i2c_read(priv, ICMSR); msr = rcar_i2c_read(priv, ICMSR);
/* Only handle interrupts that are currently enabled */
msr &= rcar_i2c_read(priv, ICMIER);
/* Arbitration lost */ /* Arbitration lost */
if (msr & MAL) { if (msr & MAL) {
rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST)); rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST));
goto out; goto out;
} }
/* Stop */
if (msr & MST) {
rcar_i2c_flags_set(priv, ID_DONE);
goto out;
}
/* Nack */ /* Nack */
if (msr & MNR) { if (msr & MNR) {
/* go to stop phase */ /* go to stop phase */
...@@ -393,6 +390,12 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr) ...@@ -393,6 +390,12 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
goto out; goto out;
} }
/* Stop */
if (msr & MST) {
rcar_i2c_flags_set(priv, ID_DONE);
goto out;
}
if (rcar_i2c_is_recv(priv)) if (rcar_i2c_is_recv(priv))
rcar_i2c_flags_set(priv, rcar_i2c_irq_recv(priv, msr)); rcar_i2c_flags_set(priv, rcar_i2c_irq_recv(priv, msr));
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment