aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-omap2-mcspi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-05 19:18:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-05 19:18:13 -0400
commit1325b6550a7b9cda52ee4c0da04fa9f93d2618fc (patch)
tree07c5f64e7c3484a21553378ca3f256a3ce569b85 /drivers/spi/spi-omap2-mcspi.c
parentdc7aafba6bfa1ea5806c6ac402e690682f950f75 (diff)
parentfab6a0410d20ef09238ef54b8726d170578da752 (diff)
Merge tag 'spi-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown: "A quiet release, more bug fixes than anything else. A few things do stand out though: - updates to several drivers to move towards the standard GPIO chip select handling in the core. - DMA support for the SH MSIOF driver. - support for Rockchip SPI controllers (their first mainline submission)" * tag 'spi-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (64 commits) spi: davinci: use spi_device.cs_gpio to store gpio cs per spi device spi: davinci: add support to configure gpio cs through dt spi/pl022: Explicitly truncate large bitmask spi/atmel: Fix pointer to int conversion warnings on 64 bit builds spi: davinci: fix to support more than 2 chip selects spi: topcliff-pch: don't hardcode PCI slot to get DMA device spi: orion: fix incorrect handling of cell-index DT property spi: orion: Fix error return code in orion_spi_probe() spi/rockchip: fix error return code in rockchip_spi_probe() spi/rockchip: remove redundant dev_err call in rockchip_spi_probe() spi/rockchip: remove duplicated include from spi-rockchip.c ARM: dts: fix the chip select gpios definition in the SPI nodes spi: s3c64xx: Update binding documentation spi: s3c64xx: use the generic SPI "cs-gpios" property spi: s3c64xx: Revert "spi: s3c64xx: Added provision for dedicated cs pin" spi: atmel: Use dmaengine_prep_slave_sg() API spi: topcliff-pch: Update error messages for dmaengine_prep_slave_sg() API spi: sh-msiof: Use correct device for DMA mapping with IOMMU spi: sh-msiof: Handle dmaengine_prep_slave_single() failures gracefully spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully ...
Diffstat (limited to 'drivers/spi/spi-omap2-mcspi.c')
-rw-r--r--drivers/spi/spi-omap2-mcspi.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 4dc77df38864..68441fa448de 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -149,6 +149,7 @@ struct omap2_mcspi_cs {
149 void __iomem *base; 149 void __iomem *base;
150 unsigned long phys; 150 unsigned long phys;
151 int word_len; 151 int word_len;
152 u16 mode;
152 struct list_head node; 153 struct list_head node;
153 /* Context save and restore shadow register */ 154 /* Context save and restore shadow register */
154 u32 chconf0, chctrl0; 155 u32 chconf0, chctrl0;
@@ -926,6 +927,8 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
926 927
927 mcspi_write_chconf0(spi, l); 928 mcspi_write_chconf0(spi, l);
928 929
930 cs->mode = spi->mode;
931
929 dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s\n", 932 dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s\n",
930 speed_hz, 933 speed_hz,
931 (spi->mode & SPI_CPHA) ? "trailing" : "leading", 934 (spi->mode & SPI_CPHA) ? "trailing" : "leading",
@@ -998,6 +1001,7 @@ static int omap2_mcspi_setup(struct spi_device *spi)
998 return -ENOMEM; 1001 return -ENOMEM;
999 cs->base = mcspi->base + spi->chip_select * 0x14; 1002 cs->base = mcspi->base + spi->chip_select * 0x14;
1000 cs->phys = mcspi->phys + spi->chip_select * 0x14; 1003 cs->phys = mcspi->phys + spi->chip_select * 0x14;
1004 cs->mode = 0;
1001 cs->chconf0 = 0; 1005 cs->chconf0 = 0;
1002 cs->chctrl0 = 0; 1006 cs->chctrl0 = 0;
1003 spi->controller_state = cs; 1007 spi->controller_state = cs;
@@ -1079,6 +1083,16 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
1079 cs = spi->controller_state; 1083 cs = spi->controller_state;
1080 cd = spi->controller_data; 1084 cd = spi->controller_data;
1081 1085
1086 /*
1087 * The slave driver could have changed spi->mode in which case
1088 * it will be different from cs->mode (the current hardware setup).
1089 * If so, set par_override (even though its not a parity issue) so
1090 * omap2_mcspi_setup_transfer will be called to configure the hardware
1091 * with the correct mode on the first iteration of the loop below.
1092 */
1093 if (spi->mode != cs->mode)
1094 par_override = 1;
1095
1082 omap2_mcspi_set_enable(spi, 0); 1096 omap2_mcspi_set_enable(spi, 0);
1083 list_for_each_entry(t, &m->transfers, transfer_list) { 1097 list_for_each_entry(t, &m->transfers, transfer_list) {
1084 if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) { 1098 if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) {