cros_ec_spi: Work better with CS GPIO descriptors
Subsystems (2)
cover 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.
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
Signature · 1 line
https://chromeos.dev
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.
--- drivers/platform/chrome/cros_ec_spi.c | 1 - 1 file changed, 1 deletion(-)
drivers/platform/chrome/cros_ec_spi.c +0 -1
@@ -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
Re: [PATCH 1/2] platform/chrome: cros_ec_spi: Don't overwrite spi::mode
Hi,
Quoted 10 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_0where it already containsSPI_MODE_0and more importantlySPI_CS_HIGH. Clearing theSPI_CS_HIGHbit 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.
Quoted 8 lines
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 -
Re: [PATCH 1/2] platform/chrome: cros_ec_spi: Don't overwrite spi::mode
In reply to Stephen BoydHi Stephen,
Thank you for your patch.
Quoted 9 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_0where it already containsSPI_MODE_0and more importantlySPI_CS_HIGH. Clearing theSPI_CS_HIGHbit 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.
Quoted 7 lines
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]>---
Quoted 16 lines
drivers/platform/chrome/cros_ec_spi.c | 1 - 1 file changed, 1 deletion(-)drivers/platform/chrome/cros_ec_spi.c +0
-1@@ -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 )
PATCH 2/2 platform/chrome: cros_ec_spi: Drop bits_per_word assignment
In reply to Stephen BoydThis 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
@@ -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
Re: [PATCH 2/2] platform/chrome: cros_ec_spi: Drop bits_per_word assignment
Hi,
Quoted 4 lines · Stephen Boyd
This is already handed by default in
spi_setup()if thebits_per_wordis 0, so just drop it to shave off a line.
Quoted 8 lines
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(-)
Re: [PATCH 2/2] platform/chrome: cros_ec_spi: Drop bits_per_word assignment
In reply to Stephen BoydHi Stephen,
Thank you for your patch.
Quoted 8 lines · Stephen Boyd
This is already handed by default in
spi_setup()if thebits_per_wordis 0, so just drop it to shave off a line.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]>
Quoted 17 lines
--- drivers/platform/chrome/cros_ec_spi.c | 1 - 1 file changed, 1 deletion(-)drivers/platform/chrome/cros_ec_spi.c +0
-1@@ -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 )