2020-12-03 01:21:42

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 0/2] cros_ec_spi: Work better with CS GPIO descriptors

Two small patches to work better with the new CS GPIO descriptor logic.
The first one fixes a problem found while trying to enable that feature
and the second patch removes a line that I noticed while looking in the
same area.

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

Stephen Boyd (2):
platform/chrome: cros_ec_spi: Don't overwrite spi::mode
platform/chrome: cros_ec_spi: Drop bits_per_word assignment

drivers/platform/chrome/cros_ec_spi.c | 2 --
1 file changed, 2 deletions(-)

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


2020-12-03 01:22:44

by Stephen Boyd

[permalink] [raw]
Subject: [PATCH 1/2] 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: Douglas Anderson <[email protected]>
Cc: Alexandru M Stan <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
---
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

2020-12-03 01:23:17

by Doug Anderson

[permalink] [raw]
Subject: Re: [PATCH 1/2] platform/chrome: cros_ec_spi: Don't overwrite spi::mode

Hi,

On Wed, Dec 2, 2020 at 5:16 PM Stephen Boyd <[email protected]> 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 <[email protected]>
> Cc: Gwendal Grignou <[email protected]>
> Cc: Douglas Anderson <[email protected]>
> Cc: Alexandru M Stan <[email protected]>
> Signed-off-by: Stephen Boyd <[email protected]>
> ---
> drivers/platform/chrome/cros_ec_spi.c | 1 -

Reviewed-by: Douglas Anderson <[email protected]>
Tested-by: Douglas Anderson <[email protected]>

2020-12-04 09:19:46

by Enric Balletbo i Serra

[permalink] [raw]
Subject: Re: [PATCH 1/2] platform/chrome: cros_ec_spi: Don't overwrite spi::mode

Hi Stephen,

Thank you for your patch.

On 3/12/20 2:16, Stephen Boyd 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 <[email protected]>
> Cc: Gwendal Grignou <[email protected]>
> Cc: Douglas Anderson <[email protected]>
> Cc: Alexandru M Stan <[email protected]>
> Signed-off-by: Stephen Boyd <[email protected]>
> ---

Acked-by: Enric Balletbo i Serra <[email protected]>

> 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)
>