Skip to content

Commit

Permalink
Merge remote-tracking branch 'spi/topic/core' into spi-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Brown committed Dec 12, 2016
2 parents b14a8a8 + 8eee6b9 commit 0523266
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,15 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
if (spi->mode & SPI_CS_HIGH)
enable = !enable;

if (gpio_is_valid(spi->cs_gpio))
if (gpio_is_valid(spi->cs_gpio)) {
gpio_set_value(spi->cs_gpio, !enable);
else if (spi->master->set_cs)
/* Some SPI masters need both GPIO CS & slave_select */
if ((spi->master->flags & SPI_MASTER_GPIO_SS) &&
spi->master->set_cs)
spi->master->set_cs(spi, !enable);
} else if (spi->master->set_cs) {
spi->master->set_cs(spi, !enable);
}
}

#ifdef CONFIG_HAS_DMA
Expand Down
1 change: 1 addition & 0 deletions include/linux/spi/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ struct spi_master {
#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */
#define SPI_MASTER_MUST_RX BIT(3) /* requires rx */
#define SPI_MASTER_MUST_TX BIT(4) /* requires tx */
#define SPI_MASTER_GPIO_SS BIT(5) /* GPIO CS must select slave */

/*
* on some hardware transfer / message size may be constrained
Expand Down

0 comments on commit 0523266

Please sign in to comment.