Skip to contentSkip to conversation

spi: spi-geni-qcom: Use gpio descriptors for CS

PATCH Applied Stephen Boyd 4 participants 8 messages Dec 4, 2020 – Dec 29, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover spi: spi-geni-qcom: Use gpio descriptors for CS

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/[email protected]
cros-ec: https://lore.kernel.org/r/[email protected]

Cc Akash Asthana <[email protected]>
Cc Simon Glass <[email protected]>
Cc Gwendal Grignou <[email protected]>
Cc Douglas Anderson <[email protected]>
Cc Alexandru M Stan <[email protected]>

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

Signature · 1 line
https://chromeos.dev
#1 lore raw

PATCH 1/3 platform/chrome: cros_ec_spi: Don't overwrite spi::mode

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 <[email protected]>
Cc Gwendal Grignou <[email protected]>
Cc Alexandru M Stan <[email protected]>
---
 drivers/platform/chrome/cros_ec_spi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/platform/chrome/cros_ec_spi.c +0 -1
index dfa1f816a45f..f9df218fc2bb 100644
@@ -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)
Signature · 1 line
https://chromeos.dev
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode

Quoted 18 lines · Stephen Boyd

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 <[email protected]>
Cc Gwendal Grignou <[email protected]>
Cc Alexandru M Stan <[email protected]>
Quoted 3 lines
---
 drivers/platform/chrome/cros_ec_spi.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 17 lines
drivers/platform/chrome/cros_ec_spi.c +0 -2
index dfa1f816a45f..f9df218fc2bb 100644
@@ -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

#3 lore raw

PATCH 2/3 platform/chrome: cros_ec_spi: Drop bits_per_word assignment

In reply to Stephen Boyd

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.

---
 drivers/platform/chrome/cros_ec_spi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/platform/chrome/cros_ec_spi.c +0 -1
index f9df218fc2bb..14c4046fa04d 100644
@@ -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)
Signature · 1 line
https://chromeos.dev
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] platform/chrome: cros_ec_spi: Drop bits_per_word assignment

Quoted 11 lines · Stephen Boyd

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.

Quoted 3 lines
---
 drivers/platform/chrome/cros_ec_spi.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 16 lines
drivers/platform/chrome/cros_ec_spi.c +0 -2
index f9df218fc2bb..14c4046fa04d 100644
@@ -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

#5 lore raw

PATCH 3/3 spi: spi-geni-qcom: Use the new method of gpio CS control

In reply to Stephen Boyd

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 <[email protected]>
Cc Bjorn Andersson <[email protected]>
Cc Alexandru M Stan <[email protected]>
---
 drivers/spi/spi-geni-qcom.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/spi-geni-qcom.c +1 -0
index 25810a7eef10..c4c88984abc9 100644
@@ -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);
Signature · 1 line
https://chromeos.dev
maintainer
#6 lore raw
In reply to Stephen Boyd
Quoted 6 lines · Stephen Boyd

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/[email protected]
cros-ec: https://lore.kernel.org/r/[email protected]

Quoted 7 lines
Cc Akash Asthana <[email protected]>
Cc Simon Glass <[email protected]>
Cc Gwendal Grignou <[email protected]>
Cc Douglas Anderson <[email protected]>
Cc Alexandru M Stan <[email protected]>

[...]

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

#7 lore raw
In reply to Stephen Boyd
This series was applied to qcom/linux.git (refs/heads/for-next):

Hello:

This series was applied to qcom/linux.git (refs/heads/for-next):

Quoted 6 lines · On Fri, 4 Dec 2020 11:35:37 -0800 you 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/[email protected]
cros-ec: https://lore.kernel.org/r/[email protected]

Quoted 7 lines
Cc Akash Asthana <[email protected]>
Cc Simon Glass <[email protected]>
Cc Gwendal Grignou <[email protected]>
Cc Douglas Anderson <[email protected]>
Cc Alexandru M Stan <[email protected]>

[...]

Here is the summary with links:
- [1/3] platform/chrome: cros_ec_spi: Don't overwrite spi::mode

    https://git.kernel.org/qcom/c/74639cbf51d7
  - [2/3] platform/chrome: cros_ec_spi: Drop bits_per_word assignment
    https://git.kernel.org/qcom/c/7a5172b7990d
  - [3/3] spi: spi-geni-qcom: Use the new method of gpio CS control
    https://git.kernel.org/qcom/c/3b25f337929e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html