2021-01-30 16:30:30

by Rasmus Villemoes

[permalink] [raw]
Subject: [PATCH] spi: fsl: invert spisel_boot signal on MPC8309

Commit 7a2da5d7960a ("spi: fsl: Fix driver breakage when SPI_CS_HIGH
is not set in spi->mode") broke our MPC8309 board by effectively
inverting the boolean value passed to fsl_spi_cs_control. The
SPISEL_BOOT signal is used as chipselect, but it's not a gpio, so
we cannot rely on gpiolib handling the polarity.

Adapt to the new world order by inverting the logic here. This does
assume that the slave sitting at the SPISEL_BOOT is active low, but
should that ever turn out not to be the case, one can create a stub
gpiochip driver controlling a single gpio (or rather, a single "spo",
special-purpose output).

Fixes: 7a2da5d7960a ("spi: fsl: Fix driver breakage when SPI_CS_HIGH is not set in spi->mode")
Cc: [email protected]
Signed-off-by: Rasmus Villemoes <[email protected]>
---
drivers/spi/spi-fsl-spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index 6d8e0a05a535..e4a8d203f940 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -695,7 +695,7 @@ static void fsl_spi_cs_control(struct spi_device *spi, bool on)

if (WARN_ON_ONCE(!pinfo->immr_spi_cs))
return;
- iowrite32be(on ? SPI_BOOT_SEL_BIT : 0, pinfo->immr_spi_cs);
+ iowrite32be(on ? 0 : SPI_BOOT_SEL_BIT, pinfo->immr_spi_cs);
}
}

--
2.23.0


2021-02-01 16:52:25

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] spi: fsl: invert spisel_boot signal on MPC8309

On Sat, 30 Jan 2021 15:35:45 +0100, Rasmus Villemoes wrote:
> Commit 7a2da5d7960a ("spi: fsl: Fix driver breakage when SPI_CS_HIGH
> is not set in spi->mode") broke our MPC8309 board by effectively
> inverting the boolean value passed to fsl_spi_cs_control. The
> SPISEL_BOOT signal is used as chipselect, but it's not a gpio, so
> we cannot rely on gpiolib handling the polarity.
>
> Adapt to the new world order by inverting the logic here. This does
> assume that the slave sitting at the SPISEL_BOOT is active low, but
> should that ever turn out not to be the case, one can create a stub
> gpiochip driver controlling a single gpio (or rather, a single "spo",
> special-purpose output).

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: fsl: invert spisel_boot signal on MPC8309
commit: 9d2aa6dbf87af89c13cac2d1b4cccad83fb14a7e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark