aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorTakashi Yoshii <takasi-y@ops.dti.ne.jp>2013-12-01 13:19:15 -0500
committerMark Brown <broonie@linaro.org>2013-12-02 07:54:25 -0500
commit50a7799829835120950520231797642e19d4152f (patch)
tree72fa18b45bbcb69301b5955b3538d005788dbf99 /drivers/spi
parent5c32d29f13e9f7b94e0e82bf3ed7a1cf6b0c0dd3 (diff)
spi: spi-sh-msiof: set hi/low Active for HW CS
Set hardware CS(CS control function on MSIOF <-> GPIO CS) polarity according to SPI_CS_HIGH flag on spi->mode. Signed-off-by: Takashi Yoshii <takasi-y@ops.dti.ne.jp> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-sh-msiof.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index d96b047afcd2..a0c3e54b0003 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -169,7 +169,7 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
169 169
170static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p, 170static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,
171 u32 cpol, u32 cpha, 171 u32 cpol, u32 cpha,
172 u32 tx_hi_z, u32 lsb_first) 172 u32 tx_hi_z, u32 lsb_first, u32 cs_high)
173{ 173{
174 u32 tmp; 174 u32 tmp;
175 int edge; 175 int edge;
@@ -182,8 +182,12 @@ static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,
182 * 1 1 11 11 1 1 182 * 1 1 11 11 1 1
183 */ 183 */
184 sh_msiof_write(p, FCTR, 0); 184 sh_msiof_write(p, FCTR, 0);
185 sh_msiof_write(p, TMDR1, 0xe2000005 | (lsb_first << 24)); 185
186 sh_msiof_write(p, RMDR1, 0x22000005 | (lsb_first << 24)); 186 tmp = 0;
187 tmp |= !cs_high << 25;
188 tmp |= lsb_first << 24;
189 sh_msiof_write(p, TMDR1, 0xe0000005 | tmp);
190 sh_msiof_write(p, RMDR1, 0x20000005 | tmp);
187 191
188 tmp = 0xa0000000; 192 tmp = 0xa0000000;
189 tmp |= cpol << 30; /* TSCKIZ */ 193 tmp |= cpol << 30; /* TSCKIZ */
@@ -417,7 +421,8 @@ static void sh_msiof_spi_chipselect(struct spi_device *spi, int is_on)
417 sh_msiof_spi_set_pin_regs(p, !!(spi->mode & SPI_CPOL), 421 sh_msiof_spi_set_pin_regs(p, !!(spi->mode & SPI_CPOL),
418 !!(spi->mode & SPI_CPHA), 422 !!(spi->mode & SPI_CPHA),
419 !!(spi->mode & SPI_3WIRE), 423 !!(spi->mode & SPI_3WIRE),
420 !!(spi->mode & SPI_LSB_FIRST)); 424 !!(spi->mode & SPI_LSB_FIRST),
425 !!(spi->mode & SPI_CS_HIGH));
421 } 426 }
422 427
423 /* use spi->controller data for CS (same strategy as spi_gpio) */ 428 /* use spi->controller data for CS (same strategy as spi_gpio) */