Commit c4f2279e authored by Imre Deak's avatar Imre Deak Committed by Juha Yrjola

ARM: OMAP2: McSPI: add debugging for setup and transfer functions

Sprinkle dev_dbg's wrapped with VERBOSE to several functions to aid
debugging.
Signed-off-by: default avatarImre Deak <imre.deak@solidboot.com>
Signed-off-by: default avatarJuha Yrjola <juha.yrjola@solidboot.com>
parent 2a5d6f35
...@@ -210,6 +210,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer) ...@@ -210,6 +210,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
while (c--) { while (c--) {
if (tx != NULL) { if (tx != NULL) {
while (!(__raw_readl(chstat_reg) & OMAP2_MCSPI_CHSTAT_TXS)); 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); __raw_writel(*tx, tx_reg);
} }
if (rx != NULL) { if (rx != NULL) {
...@@ -217,6 +221,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer) ...@@ -217,6 +221,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
if (c == 0 && tx == NULL) if (c == 0 && tx == NULL)
omap2_mcspi_set_enable(spi, 0); omap2_mcspi_set_enable(spi, 0);
*rx++ = __raw_readl(rx_reg); *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) { } else if (word_len <= 16) {
...@@ -229,6 +237,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer) ...@@ -229,6 +237,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
while (c--) { while (c--) {
if (tx != NULL) { if (tx != NULL) {
while (!(__raw_readl(chstat_reg) & OMAP2_MCSPI_CHSTAT_TXS)); 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); __raw_writel(*tx++, tx_reg);
} }
if (rx != NULL) { if (rx != NULL) {
...@@ -236,6 +248,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer) ...@@ -236,6 +248,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
if (c == 0 && tx == NULL) if (c == 0 && tx == NULL)
omap2_mcspi_set_enable(spi, 0); omap2_mcspi_set_enable(spi, 0);
*rx++ = __raw_readl(rx_reg); *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) { } else if (word_len <= 32) {
...@@ -248,6 +264,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer) ...@@ -248,6 +264,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
while (c--) { while (c--) {
if (tx != NULL) { if (tx != NULL) {
while (!(__raw_readl(chstat_reg) & OMAP2_MCSPI_CHSTAT_TXS)); 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); __raw_writel(*tx++, tx_reg);
} }
if (rx != NULL) { if (rx != NULL) {
...@@ -255,6 +275,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer) ...@@ -255,6 +275,10 @@ static void omap2_mcspi_txrx(struct spi_device *spi, struct spi_transfer *xfer)
if (c == 0 && tx == NULL) if (c == 0 && tx == NULL)
omap2_mcspi_set_enable(spi, 0); omap2_mcspi_set_enable(spi, 0);
*rx++ = __raw_readl(rx_reg); *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, ...@@ -325,6 +349,11 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
l |= OMAP2_MCSPI_CHCONF_PHA; l |= OMAP2_MCSPI_CHCONF_PHA;
mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, l); 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment