diff mbox series

spi: rspi: Add configuration for LSB/MSB

Message ID 1554282541-8952-1-git-send-email-na-hoan@jinso.co.jp (mailing list archive)
State New, archived
Headers show
Series spi: rspi: Add configuration for LSB/MSB | expand

Commit Message

グェン・アン・ホァン April 3, 2019, 9:09 a.m. UTC
From: Hoan Nguyen An <na-hoan@jinso.co.jp>

SPI controllers can support LSB or MSB depending on
the structure of the message that Slave requires,
Add support.

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
---
 drivers/spi/spi-rspi.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Geert Uytterhoeven Feb. 18, 2020, 10:56 a.m. UTC | #1
Hi Hoan-san,

On Wed, Apr 3, 2019 at 11:09 AM Nguyen An Hoan <na-hoan@jinso.co.jp> wrote:
> From: Hoan Nguyen An <na-hoan@jinso.co.jp>
>
> SPI controllers can support LSB or MSB depending on
> the structure of the message that Slave requires,
> Add support.
>
> Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>

Thanks for your patch!

> --- a/drivers/spi/spi-rspi.c
> +++ b/drivers/spi/spi-rspi.c
> @@ -950,6 +950,8 @@ static int rspi_prepare_message(struct spi_controller *ctlr,
>                 rspi->spcmd |= SPCMD_CPOL;
>         if (spi->mode & SPI_CPHA)
>                 rspi->spcmd |= SPCMD_CPHA;
> +       if (spi->mode & SPI_LSB_FIRST)
> +               rspi->spcmd |= SPCMD_LSBF;
>
>         /* CMOS output mode and MOSI signal from previous transfer */
>         rspi->sppcr = 0;

Unfortunately this is not sufficient.  The driver should also inform the
SPI core that it supports this flag. Will fix.

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox series

Patch

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 3be8fbe..7ae5f09 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -950,6 +950,8 @@  static int rspi_prepare_message(struct spi_controller *ctlr,
 		rspi->spcmd |= SPCMD_CPOL;
 	if (spi->mode & SPI_CPHA)
 		rspi->spcmd |= SPCMD_CPHA;
+	if (spi->mode & SPI_LSB_FIRST)
+		rspi->spcmd |= SPCMD_LSBF;
 
 	/* CMOS output mode and MOSI signal from previous transfer */
 	rspi->sppcr = 0;