diff mbox

spi_sh_msiof: Fixed data sampling on the correct edge

Message ID 95F51F4B902CAC40AF459205F6322F0171E8D4959B@BMK019S01.emtrion.local (mailing list archive)
State Accepted
Headers show

Commit Message

Pietrek, Markus Jan. 21, 2010, 9:26 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/spi/spi_sh_msiof.c b/drivers/spi/spi_sh_msiof.c
index 51e5e1d..a9fec2f 100644
--- a/drivers/spi/spi_sh_msiof.c
+++ b/drivers/spi/spi_sh_msiof.c
@@ -173,13 +173,11 @@  static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,
        int edge;

        /*
-        * CPOL CPHA     TSCKIZ RSCKIZ TEDG REDG(!)
-        *    0    0         10     10    1    0
-        *    0    1         10     10    0    1
-        *    1    0         11     11    0    1
-        *    1    1         11     11    1    0
-        *
-        * (!) Note: REDG is inverted recommended data sheet setting
+        * CPOL CPHA     TSCKIZ RSCKIZ TEDG REDG
+        *    0    0         10     10    1    1
+        *    0    1         10     10    0    0
+        *    1    0         11     11    0    0
+        *    1    1         11     11    1    1
         */

        sh_msiof_write(p, FCTR, 0);
@@ -193,7 +191,7 @@  static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,
        edge = cpol ? cpha : !cpha;

        tmp |= edge << 27; /* TEDG */
-       tmp |= !edge << 26; /* REDG */
+       tmp |= edge << 26; /* REDG */
        tmp |= (tx_hi_z ? 2 : 0) << 22; /* TXDIZ */
        sh_msiof_write(p, CTR, tmp);
 }
@@ -280,6 +278,9 @@  static void sh_msiof_spi_read_fifo_8(struct sh_msiof_spi_priv *p,

        for (k = 0; k < words; k++)
                buf_8[k] = sh_msiof_read(p, RFDR) >> fs;
+
+       for (k = 0; k < words; k++)
+               pr_err(" %02x\n", buf_8[k]);
 }

 static void sh_msiof_spi_read_fifo_16(struct sh_msiof_spi_priv *p,