Commit 2cd45179 authored by Daniel Mack's avatar Daniel Mack Committed by Mark Brown

spi/omap: fix D0/D1 direction confusion

0384e90b ("spi/mcspi: allow configuration of pin directions") did what
it claimed to do the wrong way around. D0/D1 is configured as output by
*clearing* the bits in the conf registers, hence also breaking the
former default behaviour.

Fix this before that change is merged to mainline.
Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 0384e90b
...@@ -6,9 +6,9 @@ Required properties: ...@@ -6,9 +6,9 @@ Required properties:
- "ti,omap4-spi" for OMAP4+. - "ti,omap4-spi" for OMAP4+.
- ti,spi-num-cs : Number of chipselect supported by the instance. - ti,spi-num-cs : Number of chipselect supported by the instance.
- ti,hwmods: Name of the hwmod associated to the McSPI - ti,hwmods: Name of the hwmod associated to the McSPI
- ti,pindir-d0-in-d1-out: Select the D0 pin as input and D1 as - ti,pindir-d0-out-d1-in: Select the D0 pin as output and D1 as
output. The default is D0 as output and input. The default is D0 as input and
D1 as input. D1 as output.
Example: Example:
......
...@@ -766,7 +766,7 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, ...@@ -766,7 +766,7 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
/* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS /* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS
* REVISIT: this controller could support SPI_3WIRE mode. * REVISIT: this controller could support SPI_3WIRE mode.
*/ */
if (mcspi->pin_dir == MCSPI_PINDIR_D0_OUT_D1_IN) { if (mcspi->pin_dir == MCSPI_PINDIR_D0_IN_D1_OUT) {
l &= ~OMAP2_MCSPI_CHCONF_IS; l &= ~OMAP2_MCSPI_CHCONF_IS;
l &= ~OMAP2_MCSPI_CHCONF_DPE1; l &= ~OMAP2_MCSPI_CHCONF_DPE1;
l |= OMAP2_MCSPI_CHCONF_DPE0; l |= OMAP2_MCSPI_CHCONF_DPE0;
...@@ -1188,8 +1188,8 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) ...@@ -1188,8 +1188,8 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
of_property_read_u32(node, "ti,spi-num-cs", &num_cs); of_property_read_u32(node, "ti,spi-num-cs", &num_cs);
master->num_chipselect = num_cs; master->num_chipselect = num_cs;
master->bus_num = bus_num++; master->bus_num = bus_num++;
if (of_get_property(node, "ti,pindir-d0-in-d1-out", NULL)) if (of_get_property(node, "ti,pindir-d0-out-d1-in", NULL))
mcspi->pin_dir = MCSPI_PINDIR_D0_IN_D1_OUT; mcspi->pin_dir = MCSPI_PINDIR_D0_OUT_D1_IN;
} else { } else {
pdata = pdev->dev.platform_data; pdata = pdev->dev.platform_data;
master->num_chipselect = pdata->num_cs; master->num_chipselect = pdata->num_cs;
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#define OMAP4_MCSPI_REG_OFFSET 0x100 #define OMAP4_MCSPI_REG_OFFSET 0x100
#define MCSPI_PINDIR_D0_OUT_D1_IN 0 #define MCSPI_PINDIR_D0_IN_D1_OUT 0
#define MCSPI_PINDIR_D0_IN_D1_OUT 1 #define MCSPI_PINDIR_D0_OUT_D1_IN 1
struct omap2_mcspi_platform_config { struct omap2_mcspi_platform_config {
unsigned short num_cs; unsigned short num_cs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment