linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS
@ 2020-12-04 19:35 Stephen Boyd
  2020-12-04 19:35 ` [PATCH 1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode Stephen Boyd
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Stephen Boyd @ 2020-12-04 19:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, linux-spi, Benson Leung, linux-arm-msm,
	Enric Balletbo i Serra, Akash Asthana, Simon Glass,
	Gwendal Grignou, Douglas Anderson, Alexandru M Stan

Collected patches from the two series below and associated tags so they
can be merged in one pile through the spi tree. Merry December!

SPI: https://lore.kernel.org/r/20201202214935.1114381-1-swboyd@chromium.org
cros-ec: https://lore.kernel.org/r/20201203011649.1405292-1-swboyd@chromium.org

Cc: Akash Asthana <akashast@codeaurora.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Alexandru M Stan <amstan@chromium.org>

Stephen Boyd (3):
  platform/chrome: cros_ec_spi: Don't overwrite spi::mode
  platform/chrome: cros_ec_spi: Drop bits_per_word assignment
  spi: spi-geni-qcom: Use the new method of gpio CS control

 drivers/platform/chrome/cros_ec_spi.c | 2 --
 drivers/spi/spi-geni-qcom.c           | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)


base-commit: b65054597872ce3aefbc6a666385eabdf9e288da
-- 
https://chromeos.dev


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode
  2020-12-04 19:35 [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS Stephen Boyd
@ 2020-12-04 19:35 ` Stephen Boyd
  2020-12-09 16:41   ` Simon Glass
  2020-12-04 19:35 ` [PATCH 2/3] platform/chrome: cros_ec_spi: Drop bits_per_word assignment Stephen Boyd
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2020-12-04 19:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, linux-spi, Benson Leung, linux-arm-msm,
	Enric Balletbo i Serra, Simon Glass, Gwendal Grignou,
	Douglas Anderson, Alexandru M Stan

There isn't any need to overwrite the mode here in the driver with what
has been detected by the firmware, such as DT or ACPI. In fact, if we
use the SPI CS gpio descriptor feature we will overwrite the mode with
SPI_MODE_0 where it already contains SPI_MODE_0 and more importantly
SPI_CS_HIGH. Clearing the SPI_CS_HIGH bit causes the CS line to toggle
when the device is probed when it shouldn't change, confusing the driver
and making it fail to probe. Drop the assignment and let the spi core
take care of it.

Fixes: a17d94f0b6e1 ("mfd: Add ChromeOS EC SPI driver")
Cc: Simon Glass <sjg@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Alexandru M Stan <amstan@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/platform/chrome/cros_ec_spi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c
index dfa1f816a45f..f9df218fc2bb 100644
--- a/drivers/platform/chrome/cros_ec_spi.c
+++ b/drivers/platform/chrome/cros_ec_spi.c
@@ -742,7 +742,6 @@ static int cros_ec_spi_probe(struct spi_device *spi)
 	int err;
 
 	spi->bits_per_word = 8;
-	spi->mode = SPI_MODE_0;
 	spi->rt = true;
 	err = spi_setup(spi);
 	if (err < 0)
-- 
https://chromeos.dev


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] platform/chrome: cros_ec_spi: Drop bits_per_word assignment
  2020-12-04 19:35 [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS Stephen Boyd
  2020-12-04 19:35 ` [PATCH 1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode Stephen Boyd
@ 2020-12-04 19:35 ` Stephen Boyd
  2020-12-09 16:41   ` Simon Glass
  2020-12-04 19:35 ` [PATCH 3/3] spi: spi-geni-qcom: Use the new method of gpio CS control Stephen Boyd
  2020-12-11 17:51 ` [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2020-12-04 19:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, linux-spi, Benson Leung, linux-arm-msm,
	Enric Balletbo i Serra, Simon Glass, Gwendal Grignou,
	Douglas Anderson, Alexandru M Stan

This is already handed by default in spi_setup() if the bits_per_word is
0, so just drop it to shave off a line.

Cc: Simon Glass <sjg@chromium.org>
Cc: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Alexandru M Stan <amstan@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/platform/chrome/cros_ec_spi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c
index f9df218fc2bb..14c4046fa04d 100644
--- a/drivers/platform/chrome/cros_ec_spi.c
+++ b/drivers/platform/chrome/cros_ec_spi.c
@@ -741,7 +741,6 @@ static int cros_ec_spi_probe(struct spi_device *spi)
 	struct cros_ec_spi *ec_spi;
 	int err;
 
-	spi->bits_per_word = 8;
 	spi->rt = true;
 	err = spi_setup(spi);
 	if (err < 0)
-- 
https://chromeos.dev


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] spi: spi-geni-qcom: Use the new method of gpio CS control
  2020-12-04 19:35 [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS Stephen Boyd
  2020-12-04 19:35 ` [PATCH 1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode Stephen Boyd
  2020-12-04 19:35 ` [PATCH 2/3] platform/chrome: cros_ec_spi: Drop bits_per_word assignment Stephen Boyd
@ 2020-12-04 19:35 ` Stephen Boyd
  2020-12-11 17:51 ` [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2020-12-04 19:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, linux-spi, Benson Leung, linux-arm-msm,
	Enric Balletbo i Serra, Akash Asthana, Bjorn Andersson,
	Douglas Anderson, Alexandru M Stan

Let's set the 'use_gpio_descriptors' field so that we use the new way of
requesting the CS GPIOs in the core. This allows us to avoid having to
configure the CS pins in "output" mode with an 'output-enable' pinctrl
setting.

Cc: Akash Asthana <akashast@codeaurora.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Cc: Alexandru M Stan <amstan@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/spi/spi-geni-qcom.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
index 25810a7eef10..c4c88984abc9 100644
--- a/drivers/spi/spi-geni-qcom.c
+++ b/drivers/spi/spi-geni-qcom.c
@@ -636,6 +636,7 @@ static int spi_geni_probe(struct platform_device *pdev)
 	spi->auto_runtime_pm = true;
 	spi->handle_err = handle_fifo_timeout;
 	spi->set_cs = spi_geni_set_cs;
+	spi->use_gpio_descriptors = true;
 
 	init_completion(&mas->cs_done);
 	init_completion(&mas->cancel_done);
-- 
https://chromeos.dev


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] platform/chrome: cros_ec_spi: Drop bits_per_word assignment
  2020-12-04 19:35 ` [PATCH 2/3] platform/chrome: cros_ec_spi: Drop bits_per_word assignment Stephen Boyd
@ 2020-12-09 16:41   ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2020-12-09 16:41 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mark Brown, lk, linux-spi, Benson Leung, linux-arm-msm,
	Enric Balletbo i Serra, Gwendal Grignou, Douglas Anderson,
	Alexandru M Stan

On Fri, 4 Dec 2020 at 12:35, Stephen Boyd <swboyd@chromium.org> wrote:
>
> This is already handed by default in spi_setup() if the bits_per_word is
> 0, so just drop it to shave off a line.
>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> Tested-by: Douglas Anderson <dianders@chromium.org>
> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Cc: Alexandru M Stan <amstan@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  drivers/platform/chrome/cros_ec_spi.c | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>


>
> diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c
> index f9df218fc2bb..14c4046fa04d 100644
> --- a/drivers/platform/chrome/cros_ec_spi.c
> +++ b/drivers/platform/chrome/cros_ec_spi.c
> @@ -741,7 +741,6 @@ static int cros_ec_spi_probe(struct spi_device *spi)
>         struct cros_ec_spi *ec_spi;
>         int err;
>
> -       spi->bits_per_word = 8;
>         spi->rt = true;
>         err = spi_setup(spi);
>         if (err < 0)
> --
> https://chromeos.dev
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode
  2020-12-04 19:35 ` [PATCH 1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode Stephen Boyd
@ 2020-12-09 16:41   ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2020-12-09 16:41 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Mark Brown, lk, linux-spi, Benson Leung, linux-arm-msm,
	Enric Balletbo i Serra, Gwendal Grignou, Douglas Anderson,
	Alexandru M Stan

On Fri, 4 Dec 2020 at 12:35, Stephen Boyd <swboyd@chromium.org> wrote:
>
> There isn't any need to overwrite the mode here in the driver with what
> has been detected by the firmware, such as DT or ACPI. In fact, if we
> use the SPI CS gpio descriptor feature we will overwrite the mode with
> SPI_MODE_0 where it already contains SPI_MODE_0 and more importantly
> SPI_CS_HIGH. Clearing the SPI_CS_HIGH bit causes the CS line to toggle
> when the device is probed when it shouldn't change, confusing the driver
> and making it fail to probe. Drop the assignment and let the spi core
> take care of it.
>
> Fixes: a17d94f0b6e1 ("mfd: Add ChromeOS EC SPI driver")
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> Tested-by: Douglas Anderson <dianders@chromium.org>
> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Cc: Alexandru M Stan <amstan@chromium.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  drivers/platform/chrome/cros_ec_spi.c | 1 -
>  1 file changed, 1 deletion(-)


Reviewed-by: Simon Glass <sjg@chromium.org>


>
>
> diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c
> index dfa1f816a45f..f9df218fc2bb 100644
> --- a/drivers/platform/chrome/cros_ec_spi.c
> +++ b/drivers/platform/chrome/cros_ec_spi.c
> @@ -742,7 +742,6 @@ static int cros_ec_spi_probe(struct spi_device *spi)
>         int err;
>
>         spi->bits_per_word = 8;
> -       spi->mode = SPI_MODE_0;
>         spi->rt = true;
>         err = spi_setup(spi);
>         if (err < 0)
> --
> https://chromeos.dev
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS
  2020-12-04 19:35 [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS Stephen Boyd
                   ` (2 preceding siblings ...)
  2020-12-04 19:35 ` [PATCH 3/3] spi: spi-geni-qcom: Use the new method of gpio CS control Stephen Boyd
@ 2020-12-11 17:51 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-12-11 17:51 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Benson Leung, Akash Asthana, Simon Glass, linux-kernel,
	linux-spi, Enric Balletbo i Serra, Gwendal Grignou,
	Douglas Anderson, linux-arm-msm, Alexandru M Stan

On Fri, 4 Dec 2020 11:35:37 -0800, Stephen Boyd wrote:
> Collected patches from the two series below and associated tags so they
> can be merged in one pile through the spi tree. Merry December!
> 
> SPI: https://lore.kernel.org/r/20201202214935.1114381-1-swboyd@chromium.org
> cros-ec: https://lore.kernel.org/r/20201203011649.1405292-1-swboyd@chromium.org
> 
> Cc: Akash Asthana <akashast@codeaurora.org>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Cc: Douglas Anderson <dianders@chromium.org>
> Cc: Alexandru M Stan <amstan@chromium.org>
> 
> [...]

Applied to

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

Thanks!

[1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode
      commit: 74639cbf51d7c0304342544a83dfda354a6bd208
[2/3] platform/chrome: cros_ec_spi: Drop bits_per_word assignment
      commit: 7a5172b7990d97ab9ef64e6d9063aa68099ea023
[3/3] spi: spi-geni-qcom: Use the new method of gpio CS control
      commit: 3b25f337929e73232f0aa990cd68a129f53652e2

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-11 19:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 19:35 [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS Stephen Boyd
2020-12-04 19:35 ` [PATCH 1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode Stephen Boyd
2020-12-09 16:41   ` Simon Glass
2020-12-04 19:35 ` [PATCH 2/3] platform/chrome: cros_ec_spi: Drop bits_per_word assignment Stephen Boyd
2020-12-09 16:41   ` Simon Glass
2020-12-04 19:35 ` [PATCH 3/3] spi: spi-geni-qcom: Use the new method of gpio CS control Stephen Boyd
2020-12-11 17:51 ` [PATCH 0/3] spi: spi-geni-qcom: Use gpio descriptors for CS Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).