aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanimir Varbanov <svarbanov@mm-sol.com>2011-09-21 18:31:33 +0300
committerIliyan Malchev <malchev@google.com>2011-09-29 12:14:07 -0700
commit05f51a976d4a82c3e55376d13fe5ebe7a1c10e28 (patch)
tree684e92b4cb35d41e0c7596a40e094ffe74782651
parentba148f5b8cfc541a140835ff2a0d44e35f27d9da (diff)
downloadkernel_samsung_tuna-05f51a976d4a82c3e55376d13fe5ebe7a1c10e28.zip
kernel_samsung_tuna-05f51a976d4a82c3e55376d13fe5ebe7a1c10e28.tar.gz
kernel_samsung_tuna-05f51a976d4a82c3e55376d13fe5ebe7a1c10e28.tar.bz2
OMAP: mcspi: Extend device config structure with swap_datalines param
This change in the mcspi driver extend the omap2_mcspi_device_config structure with one more board config parameter. This parameter could be useful on some hardware with swapped data lines. Now the user can swap the SOMI <-> SIMO data lines to satisfy your hw requirements. Change-Id: I67a8981498b9417601d00acc319bd57c5be6bf0f Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
-rw-r--r--arch/arm/plat-omap/include/plat/mcspi.h2
-rw-r--r--drivers/spi/omap2_mcspi.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/arch/arm/plat-omap/include/plat/mcspi.h b/arch/arm/plat-omap/include/plat/mcspi.h
index 3d51b18..091caa1 100644
--- a/arch/arm/plat-omap/include/plat/mcspi.h
+++ b/arch/arm/plat-omap/include/plat/mcspi.h
@@ -21,6 +21,8 @@ struct omap2_mcspi_device_config {
/* Do we want one channel enabled at the same time? */
unsigned single_channel:1;
+ /* Swap data lines */
+ unsigned swap_datalines;
};
#endif
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index 969cdd2..d54389c 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -650,6 +650,7 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
struct spi_transfer *t)
{
struct omap2_mcspi_cs *cs = spi->controller_state;
+ struct omap2_mcspi_device_config *cd = spi->controller_data;
struct omap2_mcspi *mcspi;
struct spi_master *spi_cntrl;
u32 l = 0, div = 0;
@@ -675,8 +676,13 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
/* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS
* REVISIT: this controller could support SPI_3WIRE mode.
*/
- l &= ~(OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1);
- l |= OMAP2_MCSPI_CHCONF_DPE0;
+ if (cd->swap_datalines) {
+ l &= ~OMAP2_MCSPI_CHCONF_DPE0;
+ l |= OMAP2_MCSPI_CHCONF_IS | OMAP2_MCSPI_CHCONF_DPE1;
+ } else {
+ l &= ~(OMAP2_MCSPI_CHCONF_IS | OMAP2_MCSPI_CHCONF_DPE1);
+ l |= OMAP2_MCSPI_CHCONF_DPE0;
+ }
/* wordlength */
l &= ~OMAP2_MCSPI_CHCONF_WL_MASK;