Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Sascha Hauer and committed by
Linus Torvalds
6c23e5d4 462d26b5

+6 -1
+6 -1
drivers/spi/spi_imx.c
··· 478 478 479 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 484 if (!spi->bits_per_word) 482 485 spi->bits_per_word = 8; 483 486 484 487 pr_debug("%s: mode %d, %u bpw, %d hz\n", __func__, 485 488 spi->mode, spi->bits_per_word, spi->max_speed_hz); 489 + 490 + if (gpio >= 0) 491 + gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1); 486 492 487 493 spi_imx_chipselect(spi, BITBANG_CS_INACTIVE); 488 494 ··· 538 532 dev_err(&pdev->dev, "can't get cs gpios"); 539 533 goto out_master_put; 540 534 } 541 - gpio_direction_output(spi_imx->chipselect[i], 1); 542 535 } 543 536 544 537 spi_imx->bitbang.chipselect = spi_imx_chipselect;