Message ID | 072d74af9fc624490b84a1d001039424e572e827.1719351923.git.marcelo.schmitt@analog.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add support for AD4000 series of ADCs | expand |
On Wed, Jun 26, 2024 at 12:55 AM Marcelo Schmitt <marcelo.schmitt@analog.com> wrote: > > Implement MOSI idle low and MOSI idle high to better support peripherals > that request specific MOSI behavior. > One minor nitpick. Feel free to ignore, if there won't be a re-spin. > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> > --- > drivers/spi/spi-axi-spi-engine.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c > index 0aa31d745734..5a88d31ca758 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_HIGH 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_HIGH; > + if (spi->mode & SPI_MOSI_IDLE_LOW) > + config &= ~SPI_ENGINE_CONFIG_SDO_IDLE_HIGH; > > return config; > } > @@ -646,6 +651,9 @@ static int spi_engine_probe(struct platform_device *pdev) > > host->dev.of_node = pdev->dev.of_node; > host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE; > + if (ADI_AXI_PCORE_VER_MAJOR(version) >= 1 && > + ADI_AXI_PCORE_VER_MINOR(version) >= 3) > + host->mode_bits |= SPI_MOSI_IDLE_LOW | SPI_MOSI_IDLE_HIGH; There's a second space after the assignment. host->mode_bits |=<2 spaces here>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; > -- > 2.43.0 > >
On Tue, 2024-06-25 at 18:54 -0300, 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@analog.com> > --- Acked-by: Nuno Sa <nuno.sa@analog.com>
On 06/26, Alexandru Ardelean wrote: > On Wed, Jun 26, 2024 at 12:55 AM Marcelo Schmitt > <marcelo.schmitt@analog.com> wrote: > > > > Implement MOSI idle low and MOSI idle high to better support peripherals > > that request specific MOSI behavior. > > > > One minor nitpick. > Feel free to ignore, if there won't be a re-spin. > > > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> > > --- > > drivers/spi/spi-axi-spi-engine.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > ... > > @@ -646,6 +651,9 @@ static int spi_engine_probe(struct platform_device *pdev) > > > > host->dev.of_node = pdev->dev.of_node; > > host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE; > > + if (ADI_AXI_PCORE_VER_MAJOR(version) >= 1 && > > + ADI_AXI_PCORE_VER_MINOR(version) >= 3) > > + host->mode_bits |= SPI_MOSI_IDLE_LOW | SPI_MOSI_IDLE_HIGH; > > There's a second space after the assignment. > host->mode_bits |=<2 spaces here>SPI_MOSI_IDLE_LOW | > SPI_MOSI_IDLE_HIGH; ack thanks > > > > 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; > > -- > > 2.43.0 > > > >
On 6/25/24 4:54 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@analog.com> > --- > drivers/spi/spi-axi-spi-engine.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c > index 0aa31d745734..5a88d31ca758 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_HIGH 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_HIGH; > + if (spi->mode & SPI_MOSI_IDLE_LOW) > + config &= ~SPI_ENGINE_CONFIG_SDO_IDLE_HIGH; > > return config; > } > @@ -646,6 +651,9 @@ static int spi_engine_probe(struct platform_device *pdev) > > host->dev.of_node = pdev->dev.of_node; > host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE; > + if (ADI_AXI_PCORE_VER_MAJOR(version) >= 1 && > + ADI_AXI_PCORE_VER_MINOR(version) >= 3) > + host->mode_bits |= 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; The driver already has a section: /* Some features depend of the IP core version. */ if (ADI_AXI_PCORE_VER_MINOR(version) >= 2) { host->mode_bits |= SPI_CS_HIGH; host->setup = spi_engine_setup; } So I would prefer to add the version check there instead. With that change: Reviewed-by: David Lechner <dlechner@baylibre.com>
diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c index 0aa31d745734..5a88d31ca758 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_HIGH 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_HIGH; + if (spi->mode & SPI_MOSI_IDLE_LOW) + config &= ~SPI_ENGINE_CONFIG_SDO_IDLE_HIGH; return config; } @@ -646,6 +651,9 @@ static int spi_engine_probe(struct platform_device *pdev) host->dev.of_node = pdev->dev.of_node; host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE; + if (ADI_AXI_PCORE_VER_MAJOR(version) >= 1 && + ADI_AXI_PCORE_VER_MINOR(version) >= 3) + host->mode_bits |= 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;
Implement MOSI idle low and MOSI idle high to better support peripherals that request specific MOSI behavior. Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> --- drivers/spi/spi-axi-spi-engine.c | 8 ++++++++ 1 file changed, 8 insertions(+)