All of lore.kernel.org
 help / color / mirror / Atom feed
From: j.braam@homeautomationeurope.com (Jurgen Braam)
To: linux-arm-kernel@lists.infradead.org
Subject: i.MX27 SPI tx fifo underrun
Date: Thu, 14 Apr 2011 17:29:57 +0200	[thread overview]
Message-ID: <io73tm$1e5$1@dough.gmane.org> (raw)

Hey Folks,

while trying to write to an at25 eeprom connected via SPI on an i.MX27, 
I ran into a TX FIFO underrun. In spi_imx_isr() the variable 
spi_imx->txfifo gets rather large as a result of an unsigned integer 
underflow, resulting in a feels-like-endless loop.

The following patch fixes the problem in our case:

--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -407,7 +407,7 @@ static void __maybe_unused spi_imx0_4_reset(struct 
spi_imx_data *spi_imx)
  }

  #define MX27_INTREG_RR         (1 << 4)
-#define MX27_INTREG_TEEN       (1 << 9)
+#define MX27_INTREG_TSHFEEN    (1 << 12)
  #define MX27_INTREG_RREN       (1 << 13)

  #define MX27_CSPICTRL_POL      (1 << 5)
@@ -424,7 +424,7 @@ static void __maybe_unused mx27_intctrl(struct 
spi_imx_data *spi_imx, int enable
         unsigned int val = 0;

         if (enable & MXC_INT_TE)
-               val |= MX27_INTREG_TEEN;
+               val |= MX27_INTREG_TSHFEEN;
         if (enable & MXC_INT_RR)
                 val |= MX27_INTREG_RREN;


The i.MX27 manual states you have to wait for a TSHFE interrupt or poll 
the XCH bit. The i.MX31 manual for instance says to wait for a TC 
interrupt or poll XCH. The app flow of both docs never mention waiting 
for the TE interrupt.

Maybe the MX1_INTREG_TEEN and/or MX31_INTREG_TEEN refs need to be 
changed as well? Anybody know if this is true? Comments?

grtz,
   Jurgen

             reply	other threads:[~2011-04-14 15:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14 15:29 Jurgen Braam [this message]
2011-04-14 18:36 ` i.MX27 SPI tx fifo underrun Robert Schwebel
2011-04-14 18:43   ` Wolfram Sang

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='io73tm$1e5$1@dough.gmane.org' \
    --to=j.braam@homeautomationeurope.com \
    --cc=linux-arm-kernel@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 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.