]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP2: McSPI: add debugging for setup and transfer functions
authorImre Deak <imre.deak@solidboot.com>
Mon, 19 Jun 2006 17:31:54 +0000 (20:31 +0300)
committerJuha Yrjola <juha.yrjola@solidboot.com>
Mon, 19 Jun 2006 17:31:54 +0000 (20:31 +0300)
Sprinkle dev_dbg's wrapped with VERBOSE to several functions to aid
debugging.

Signed-off-by: Imre Deak <imre.deak@solidboot.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
drivers/spi/omap2_mcspi.c

index 336f5c58a5649282555a6bb18c3a4d5f0ebb45dd..2c7cd54fa85a76ef387a07bd7490a2e7ace9196a 100644 (file)
@@ -210,6 +210,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
                while (c--) {
                        if (tx != NULL) {
                                while (!(__raw_readl(chstat_reg) & OMAP2_MCSPI_CHSTAT_TXS));
+#ifdef VERBOSE
+                               dev_dbg(&spi->dev, "write-%d %02x\n",
+                                               word_len, *tx);
+#endif
                                __raw_writel(*tx, tx_reg);
                        }
                        if (rx != NULL) {
@@ -217,6 +221,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
                                if (c == 0 && tx == NULL)
                                        omap2_mcspi_set_enable(spi, 0);
                                *rx++ = __raw_readl(rx_reg);
+#ifdef VERBOSE
+                               dev_dbg(&spi->dev, "read-%d %02x\n",
+                                               word_len, *(rx - 1));
+#endif
                        }
                }
        } else if (word_len <= 16) {
@@ -229,6 +237,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
                while (c--) {
                        if (tx != NULL) {
                                while (!(__raw_readl(chstat_reg) & OMAP2_MCSPI_CHSTAT_TXS));
+#ifdef VERBOSE
+                               dev_dbg(&spi->dev, "write-%d %04x\n",
+                                               word_len, *tx);
+#endif
                                __raw_writel(*tx++, tx_reg);
                        }
                        if (rx != NULL) {
@@ -236,6 +248,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
                                if (c == 0 && tx == NULL)
                                        omap2_mcspi_set_enable(spi, 0);
                                *rx++ = __raw_readl(rx_reg);
+#ifdef VERBOSE
+                               dev_dbg(&spi->dev, "read-%d %04x\n",
+                                               word_len, *(rx - 1));
+#endif
                        }
                }
        } else if (word_len <= 32) {
@@ -248,6 +264,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
                while (c--) {
                        if (tx != NULL) {
                                while (!(__raw_readl(chstat_reg) & OMAP2_MCSPI_CHSTAT_TXS));
+#ifdef VERBOSE
+                               dev_dbg(&spi->dev, "write-%d %04x\n",
+                                               word_len, *tx);
+#endif
                                __raw_writel(*tx++, tx_reg);
                        }
                        if (rx != NULL) {
@@ -255,6 +275,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
                                if (c == 0 && tx == NULL)
                                        omap2_mcspi_set_enable(spi, 0);
                                *rx++ = __raw_readl(rx_reg);
+#ifdef VERBOSE
+                               dev_dbg(&spi->dev, "read-%d %04x\n",
+                                               word_len, *(rx - 1));
+#endif
                        }
                }
        }
@@ -325,6 +349,11 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
                l |= OMAP2_MCSPI_CHCONF_PHA;
        mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, l);
 
+       dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s inverted\n",
+                       OMAP2_MCSPI_MAX_FREQ / (1 << div),
+                       (spi->mode & SPI_CPHA) ? "odd" : "even",
+                       (spi->mode & SPI_CPOL) ? "" : "not");
+
        return 0;
 }