diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-01 18:44:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-01 19:11:16 -0400 |
commit | 6c23e5d43313a829fc4d07fa43a1f853f288b45f (patch) | |
tree | b33f3517a211c04456d3c234ae07f4b512e7a841 /drivers/spi | |
parent | 462d26b5d2f17b6258f33c4d1e3310089b006489 (diff) |
spi-imx: fix initial chipselect settings
We can only setup the gpio pins in spi_setup time when we know the
SPI_CS_HIGH setting.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi_imx.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index a8f9bff529e5..b91a5a8f6da6 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -478,12 +478,18 @@ static int spi_imx_transfer(struct spi_device *spi, | |||
478 | 478 | ||
479 | static int spi_imx_setup(struct spi_device *spi) | 479 | static int spi_imx_setup(struct spi_device *spi) |
480 | { | 480 | { |
481 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); | ||
482 | int gpio = spi_imx->chipselect[spi->chip_select]; | ||
483 | |||
481 | if (!spi->bits_per_word) | 484 | if (!spi->bits_per_word) |
482 | spi->bits_per_word = 8; | 485 | spi->bits_per_word = 8; |
483 | 486 | ||
484 | pr_debug("%s: mode %d, %u bpw, %d hz\n", __func__, | 487 | pr_debug("%s: mode %d, %u bpw, %d hz\n", __func__, |
485 | spi->mode, spi->bits_per_word, spi->max_speed_hz); | 488 | spi->mode, spi->bits_per_word, spi->max_speed_hz); |
486 | 489 | ||
490 | if (gpio >= 0) | ||
491 | gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1); | ||
492 | |||
487 | spi_imx_chipselect(spi, BITBANG_CS_INACTIVE); | 493 | spi_imx_chipselect(spi, BITBANG_CS_INACTIVE); |
488 | 494 | ||
489 | return 0; | 495 | return 0; |
@@ -532,7 +538,6 @@ static int __init spi_imx_probe(struct platform_device *pdev) | |||
532 | dev_err(&pdev->dev, "can't get cs gpios"); | 538 | dev_err(&pdev->dev, "can't get cs gpios"); |
533 | goto out_master_put; | 539 | goto out_master_put; |
534 | } | 540 | } |
535 | gpio_direction_output(spi_imx->chipselect[i], 1); | ||
536 | } | 541 | } |
537 | 542 | ||
538 | spi_imx->bitbang.chipselect = spi_imx_chipselect; | 543 | spi_imx->bitbang.chipselect = spi_imx_chipselect; |