[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ed4fe3de-726b-4eba-a12a-d2f7b1da26d1@baylibre.com>
Date: Wed, 5 Jun 2024 12:03:38 -0500
From: David Lechner <dlechner@...libre.com>
To: Marcelo Schmitt <marcelo.schmitt@...log.com>, broonie@...nel.org,
lars@...afoo.de, Michael.Hennerich@...log.com, jic23@...nel.org,
robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
nuno.sa@...log.com, marcelo.schmitt1@...il.com
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 4/6] spi: spi-axi-spi-engine: Add support for MOSI idle
configuration
On 6/4/24 5:43 PM, Marcelo Schmitt wrote:
> Implement MOSI idle low and MOSI idle high to better support peripherals
> that request specific MOSI behavior.
>
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
> ---
> drivers/spi/spi-axi-spi-engine.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c
> index 0aa31d745734..549f03069d0e 100644
> --- a/drivers/spi/spi-axi-spi-engine.c
> +++ b/drivers/spi/spi-axi-spi-engine.c
> @@ -41,6 +41,7 @@
> #define SPI_ENGINE_CONFIG_CPHA BIT(0)
> #define SPI_ENGINE_CONFIG_CPOL BIT(1)
> #define SPI_ENGINE_CONFIG_3WIRE BIT(2)
> +#define SPI_ENGINE_CONFIG_SDO_IDLE BIT(3)
>
> #define SPI_ENGINE_INST_TRANSFER 0x0
> #define SPI_ENGINE_INST_ASSERT 0x1
> @@ -132,6 +133,10 @@ static unsigned int spi_engine_get_config(struct spi_device *spi)
> config |= SPI_ENGINE_CONFIG_CPHA;
> if (spi->mode & SPI_3WIRE)
> config |= SPI_ENGINE_CONFIG_3WIRE;
> + if (spi->mode & SPI_MOSI_IDLE_HIGH)
> + config |= SPI_ENGINE_CONFIG_SDO_IDLE;
> + if (spi->mode & SPI_MOSI_IDLE_LOW)
> + config &= ~SPI_ENGINE_CONFIG_SDO_IDLE;
>
> return config;
> }
> @@ -645,7 +650,8 @@ static int spi_engine_probe(struct platform_device *pdev)
> return ret;
>
> host->dev.of_node = pdev->dev.of_node;
> - host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE;
> + host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE | SPI_MOSI_IDLE_LOW
> + | SPI_MOSI_IDLE_HIGH;
> host->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
> host->max_speed_hz = clk_get_rate(spi_engine->ref_clk) / 2;
> host->transfer_one_message = spi_engine_transfer_one_message;
I think we need a version check instead of setting the flags unconditionally
here since older versions of the AXI SPI Engine won't support this feature.
Powered by blists - more mailing lists