These functions do nothing but one single writel call and are only
called in once.  And the names really aren't accurate or clear, since
they don't enable or disble SPI.  Rather they set the bit that
controls the state of CS at the end of transfer.  It easier to follow
the code to just set this bit with a writel() along with all the other
bits.

Signed-off-by: Trent Piepho <tpie...@gmail.com>
Cc: Marek Vasut <ma...@denx.de>
Cc: Fabio Estevam <fabio.este...@freescale.com>
Cc: Shawn Guo <shawn....@linaro.org>
---
 drivers/spi/spi-mxs.c |   24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 9334167..7eb4bc9 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -157,22 +157,6 @@ static void mxs_spi_set_cs(struct mxs_spi *spi, unsigned 
cs)
        writel(select, ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET);
 }
 
-static inline void mxs_spi_enable(struct mxs_spi *spi)
-{
-       struct mxs_ssp *ssp = &spi->ssp;
-
-       writel(BM_SSP_CTRL0_IGNORE_CRC,
-               ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR);
-}
-
-static inline void mxs_spi_disable(struct mxs_spi *spi)
-{
-       struct mxs_ssp *ssp = &spi->ssp;
-
-       writel(BM_SSP_CTRL0_IGNORE_CRC,
-               ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET);
-}
-
 static int mxs_ssp_wait(struct mxs_spi *spi, int offset, int mask, bool set)
 {
        const unsigned long timeout = jiffies + msecs_to_jiffies(SSP_TIMEOUT);
@@ -346,14 +330,16 @@ static int mxs_spi_txrx_pio(struct mxs_spi *spi, int cs,
 {
        struct mxs_ssp *ssp = &spi->ssp;
 
-       if (*first)
-               mxs_spi_enable(spi);
+       /* Clear this now, set it on last transfer if needed */
+       writel(BM_SSP_CTRL0_IGNORE_CRC,
+              ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR);
 
        mxs_spi_set_cs(spi, cs);
 
        while (len--) {
                if (*last && len == 0)
-                       mxs_spi_disable(spi);
+                       writel(BM_SSP_CTRL0_IGNORE_CRC,
+                              ssp->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET);
 
                if (ssp->devid == IMX23_SSP) {
                        writel(BM_SSP_CTRL0_XFER_COUNT,
-- 
1.7.10.4


------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to