linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* i.MX27 SPI tx fifo underrun
@ 2011-04-14 15:29 Jurgen Braam
  2011-04-14 18:36 ` Robert Schwebel
  0 siblings, 1 reply; 3+ messages in thread
From: Jurgen Braam @ 2011-04-14 15:29 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* i.MX27 SPI tx fifo underrun
  2011-04-14 15:29 i.MX27 SPI tx fifo underrun Jurgen Braam
@ 2011-04-14 18:36 ` Robert Schwebel
  2011-04-14 18:43   ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Schwebel @ 2011-04-14 18:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 14, 2011 at 05:29:57PM +0200, Jurgen Braam wrote:
> 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

Please add your Signed-off-by: when sending patches.

rsc
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* i.MX27 SPI tx fifo underrun
  2011-04-14 18:36 ` Robert Schwebel
@ 2011-04-14 18:43   ` Wolfram Sang
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2011-04-14 18:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 14, 2011 at 08:36:13PM +0200, Robert Schwebel wrote:
> On Thu, Apr 14, 2011 at 05:29:57PM +0200, Jurgen Braam wrote:
> > 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
> 
> Please add your Signed-off-by: when sending patches.

It was an RFC only.

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110414/6964d77c/attachment.sig>

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

end of thread, other threads:[~2011-04-14 18:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-14 15:29 i.MX27 SPI tx fifo underrun Jurgen Braam
2011-04-14 18:36 ` Robert Schwebel
2011-04-14 18:43   ` 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).