aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatthias Brugger <matthias.bgg@gmail.com>2013-01-24 07:40:41 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-26 04:00:04 -0500
commit5cbc7ca987fb3f293203dc14a6c53b91b7c978a5 (patch)
tree39e1e84db700dae73cbbe73b4b5fb342a39c2848 /drivers
parent18dd6199fa4527229cede5784244b6eb37a21d62 (diff)
spi: spi-omap2-mcspi.c: Toggle CS after each word
This patch allows the board code to define SPI devices which needs to toggle the chip select after every word send. This is needed to get a better resolution reading e.g. an ADC data stream. Apart from that, as in the normal code CS is controlled by software, a transfer is done much faster. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi-omap2-mcspi.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 31f6e842ea86..12789fcfa980 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -927,6 +927,7 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
927 927
928 struct spi_device *spi; 928 struct spi_device *spi;
929 struct spi_transfer *t = NULL; 929 struct spi_transfer *t = NULL;
930 struct spi_master *master;
930 int cs_active = 0; 931 int cs_active = 0;
931 struct omap2_mcspi_cs *cs; 932 struct omap2_mcspi_cs *cs;
932 struct omap2_mcspi_device_config *cd; 933 struct omap2_mcspi_device_config *cd;
@@ -935,6 +936,7 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
935 u32 chconf; 936 u32 chconf;
936 937
937 spi = m->spi; 938 spi = m->spi;
939 master = spi->master;
938 cs = spi->controller_state; 940 cs = spi->controller_state;
939 cd = spi->controller_data; 941 cd = spi->controller_data;
940 942
@@ -952,6 +954,14 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
952 if (!t->speed_hz && !t->bits_per_word) 954 if (!t->speed_hz && !t->bits_per_word)
953 par_override = 0; 955 par_override = 0;
954 } 956 }
957 if (cd && cd->cs_per_word) {
958 chconf = mcspi->ctx.modulctrl;
959 chconf &= ~OMAP2_MCSPI_MODULCTRL_SINGLE;
960 mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, chconf);
961 mcspi->ctx.modulctrl =
962 mcspi_read_cs_reg(spi, OMAP2_MCSPI_MODULCTRL);
963 }
964
955 965
956 if (!cs_active) { 966 if (!cs_active) {
957 omap2_mcspi_force_cs(spi, 1); 967 omap2_mcspi_force_cs(spi, 1);
@@ -1013,6 +1023,14 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
1013 if (cs_active) 1023 if (cs_active)
1014 omap2_mcspi_force_cs(spi, 0); 1024 omap2_mcspi_force_cs(spi, 0);
1015 1025
1026 if (cd && cd->cs_per_word) {
1027 chconf = mcspi->ctx.modulctrl;
1028 chconf |= OMAP2_MCSPI_MODULCTRL_SINGLE;
1029 mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, chconf);
1030 mcspi->ctx.modulctrl =
1031 mcspi_read_cs_reg(spi, OMAP2_MCSPI_MODULCTRL);
1032 }
1033
1016 omap2_mcspi_set_enable(spi, 0); 1034 omap2_mcspi_set_enable(spi, 0);
1017 1035
1018 m->status = status; 1036 m->status = status;