spi: spi-imx: fix off-by-one in mx51 CPU mode burst length
[linux-2.6-microblaze.git] / drivers / spi / spi-imx.c
index 833a1bb..c3e5cee 100644 (file)
@@ -668,8 +668,8 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
                                ctrl |= (MX51_ECSPI_CTRL_MAX_BURST * BITS_PER_BYTE - 1)
                                                << MX51_ECSPI_CTRL_BL_OFFSET;
                        else
-                               ctrl |= spi_imx->count / DIV_ROUND_UP(spi_imx->bits_per_word,
-                                               BITS_PER_BYTE) * spi_imx->bits_per_word
+                               ctrl |= (spi_imx->count / DIV_ROUND_UP(spi_imx->bits_per_word,
+                                               BITS_PER_BYTE) * spi_imx->bits_per_word - 1)
                                                << MX51_ECSPI_CTRL_BL_OFFSET;
                }
        }