mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
spi: spi-gpio: Add support for MOSI idle state configuration
Implement MOSI idle low and MOSI idle high to better support peripherals that request specific MOSI behavior. Acked-by: Nuno Sa <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://patch.msgid.link/629c55a10005ba26825c3a6a19184372ef81b3e1.1720810545.git.marcelo.schmitt@analog.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
320f669309
commit
927d382c7e
@ -236,6 +236,14 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void spi_gpio_set_mosi_idle(struct spi_device *spi)
|
||||||
|
{
|
||||||
|
struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
|
||||||
|
|
||||||
|
gpiod_set_value_cansleep(spi_gpio->mosi,
|
||||||
|
!!(spi->mode & SPI_MOSI_IDLE_HIGH));
|
||||||
|
}
|
||||||
|
|
||||||
static int spi_gpio_setup(struct spi_device *spi)
|
static int spi_gpio_setup(struct spi_device *spi)
|
||||||
{
|
{
|
||||||
struct gpio_desc *cs;
|
struct gpio_desc *cs;
|
||||||
@ -389,7 +397,8 @@ static int spi_gpio_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
host->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
|
host->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
|
||||||
host->mode_bits = SPI_3WIRE | SPI_3WIRE_HIZ | SPI_CPHA | SPI_CPOL |
|
host->mode_bits = SPI_3WIRE | SPI_3WIRE_HIZ | SPI_CPHA | SPI_CPOL |
|
||||||
SPI_CS_HIGH | SPI_LSB_FIRST;
|
SPI_CS_HIGH | SPI_LSB_FIRST | SPI_MOSI_IDLE_LOW |
|
||||||
|
SPI_MOSI_IDLE_HIGH;
|
||||||
if (!spi_gpio->mosi) {
|
if (!spi_gpio->mosi) {
|
||||||
/* HW configuration without MOSI pin
|
/* HW configuration without MOSI pin
|
||||||
*
|
*
|
||||||
@ -414,6 +423,7 @@ static int spi_gpio_probe(struct platform_device *pdev)
|
|||||||
host->flags |= SPI_CONTROLLER_GPIO_SS;
|
host->flags |= SPI_CONTROLLER_GPIO_SS;
|
||||||
bb->chipselect = spi_gpio_chipselect;
|
bb->chipselect = spi_gpio_chipselect;
|
||||||
bb->set_line_direction = spi_gpio_set_direction;
|
bb->set_line_direction = spi_gpio_set_direction;
|
||||||
|
bb->set_mosi_idle = spi_gpio_set_mosi_idle;
|
||||||
|
|
||||||
if (host->flags & SPI_CONTROLLER_NO_TX) {
|
if (host->flags & SPI_CONTROLLER_NO_TX) {
|
||||||
bb->txrx_word[SPI_MODE_0] = spi_gpio_spec_txrx_word_mode0;
|
bb->txrx_word[SPI_MODE_0] = spi_gpio_spec_txrx_word_mode0;
|
||||||
|
Loading…
Reference in New Issue
Block a user