]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] ARM: OMAP: omap2_mcspi: fix for channel configuration and CS
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>
Fri, 26 May 2006 23:27:32 +0000 (16:27 -0700)
committerTony Lindgren <tony@atomide.com>
Fri, 26 May 2006 23:27:32 +0000 (16:27 -0700)
Fix for channel reconfiguration case: once the EPOL, POL or PHA has been
configured to 1, further configuration on the channel can't change it to 0.

The first CS enable is not needed. The CS will be enabled right before
the transfer anyway, if it's not active.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/spi/omap2_mcspi.c

index c98da7e8bc8a0b68da3db6fecba80ec2bdcddd40..ceb86a80542cd9891faa0b3ea79963f8cf992cb9 100644 (file)
@@ -307,12 +307,18 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
        l |= (word_len - 1) << 7;
        if (!(spi->mode & SPI_CS_HIGH))
                l |= OMAP2_MCSPI_CHCONF_EPOL;
+       else
+               l &= ~OMAP2_MCSPI_CHCONF_EPOL;
        l &= ~OMAP2_MCSPI_CHCONF_CLKD_MASK;
        l |= div << 2;
        if (spi->mode & SPI_CPOL)
                l |= OMAP2_MCSPI_CHCONF_POL;
+       else
+               l &= ~OMAP2_MCSPI_CHCONF_POL;
        if (spi->mode & SPI_CPHA)
                l |= OMAP2_MCSPI_CHCONF_PHA;
+       else
+               l &= ~OMAP2_MCSPI_CHCONF_PHA;
        mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, l);
 
        return 0;
@@ -349,7 +355,7 @@ static void omap2_mcspi_work(unsigned long arg)
                struct spi_message              *m;
                struct spi_device               *spi;
                struct spi_transfer             *t = NULL;
-               int                             cs_active;
+               int                             cs_active = 0;
                struct omap2_mcspi_device_config *conf;
                struct omap2_mcspi_cs           *cs;
                int                             par_override = 0;
@@ -365,9 +371,6 @@ static void omap2_mcspi_work(unsigned long arg)
                conf = (struct omap2_mcspi_device_config *) spi->controller_data;
                cs = (struct omap2_mcspi_cs *) spi->controller_state;
 
-               omap2_mcspi_force_cs(spi, 1);
-               cs_active = 1;
-
                list_for_each_entry(t, &m->transfers, transfer_list) {
                        if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) {
                                status = -EINVAL;