diff mbox series

spi: spi-gpio: fix SPI_CS_HIGH capability

Message ID E1gwqlS-00053l-QU@rmk-PC.armlinux.org.uk (mailing list archive)
State New, archived
Headers show
Series spi: spi-gpio: fix SPI_CS_HIGH capability | expand

Commit Message

Russell King (Oracle) Feb. 21, 2019, 3:59 p.m. UTC
spi-gpio is capable of dealing with active-high chip-selects.
Unfortunately, commit 4b859db2c606 ("spi: spi-gpio: add SPI_3WIRE
support") broke this by setting master->mode_bits, which overrides
the setting in the spi-bitbang code.  Fix this.

Fixes: 4b859db2c606 ("spi: spi-gpio: add SPI_3WIRE support")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
Patch against 4.20

 drivers/spi/spi-gpio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Fabio Estevam Feb. 21, 2019, 4:14 p.m. UTC | #1
On Thu, Feb 21, 2019 at 1:00 PM Russell King <rmk+kernel@armlinux.org.uk> wrote:
>
> spi-gpio is capable of dealing with active-high chip-selects.
> Unfortunately, commit 4b859db2c606 ("spi: spi-gpio: add SPI_3WIRE
> support") broke this by setting master->mode_bits, which overrides
> the setting in the spi-bitbang code.  Fix this.
>
> Fixes: 4b859db2c606 ("spi: spi-gpio: add SPI_3WIRE support")
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
> Patch against 4.20

Adding Jonathan who sent a similar fix recently:
https://patchwork.kernel.org/patch/10804855/
Jonathan Neuschäfer Feb. 21, 2019, 7:21 p.m. UTC | #2
On Thu, Feb 21, 2019 at 01:14:04PM -0300, Fabio Estevam wrote:
> On Thu, Feb 21, 2019 at 1:00 PM Russell King <rmk+kernel@armlinux.org.uk> wrote:
> >
> > spi-gpio is capable of dealing with active-high chip-selects.
> > Unfortunately, commit 4b859db2c606 ("spi: spi-gpio: add SPI_3WIRE
> > support") broke this by setting master->mode_bits, which overrides
> > the setting in the spi-bitbang code.  Fix this.
> >
> > Fixes: 4b859db2c606 ("spi: spi-gpio: add SPI_3WIRE support")
> > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> > ---
> > Patch against 4.20
> 
> Adding Jonathan who sent a similar fix recently:
> https://patchwork.kernel.org/patch/10804855/

Hello Russel,

your patch looks better, and I think Mark Brown has already applied it.

Thanks.
diff mbox series

Patch

diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 45973ee3ae11..2d7cfe3c7732 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -410,7 +410,7 @@  static int spi_gpio_probe(struct platform_device *pdev)
 		return status;
 
 	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
-	master->mode_bits = SPI_3WIRE | SPI_CPHA | SPI_CPOL;
+	master->mode_bits = SPI_3WIRE | SPI_CPHA | SPI_CPOL | SPI_CS_HIGH;
 	master->flags = master_flags;
 	master->bus_num = pdev->id;
 	/* The master needs to think there is a chipselect even if not connected */
@@ -437,7 +437,6 @@  static int spi_gpio_probe(struct platform_device *pdev)
 		spi_gpio->bitbang.txrx_word[SPI_MODE_3] = spi_gpio_spec_txrx_word_mode3;
 	}
 	spi_gpio->bitbang.setup_transfer = spi_bitbang_setup_transfer;
-	spi_gpio->bitbang.flags = SPI_CS_HIGH;
 
 	status = spi_bitbang_start(&spi_gpio->bitbang);
 	if (status)