diff mbox

[v1] spi: pxa2xx: Don't touch CS pin until we have a transfer pending

Message ID 20170727154933.14143-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Commit d35f2dc9a2a84f4985d8b16b47040fd6291788ad
Headers show

Commit Message

Andy Shevchenko July 27, 2017, 3:49 p.m. UTC
GPIO descriptors, when being requested, may configure pin at the same
time. In case of SPI chip select we shouldn't do any assumptions of the
state of pin since we don't know yet what chip is connected there and if
it uses high or low active state. So, leave the state of pin as is until
transfer will start.

Fixes: 99f499cd6504 ("spi: pxa2xx: Add support for GPIO descriptor chip selects")
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
  Note, while it has Fixes tag, it relies on 676a4e3bab44 to be reverted for newest kernel.
  Revert had been sent earlier today.

 drivers/spi/spi-pxa2xx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mika Westerberg July 28, 2017, 10:51 a.m. UTC | #1
On Thu, Jul 27, 2017 at 06:49:33PM +0300, Andy Shevchenko wrote:
> GPIO descriptors, when being requested, may configure pin at the same
> time. In case of SPI chip select we shouldn't do any assumptions of the
> state of pin since we don't know yet what chip is connected there and if
> it uses high or low active state. So, leave the state of pin as is until
> transfer will start.
> 
> Fixes: 99f499cd6504 ("spi: pxa2xx: Add support for GPIO descriptor chip selects")
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Yes, I think this is the right thing to do,

Acked-by: Mika Westeberg <mika.westerberg@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 38d053682892..6e5af88b7c6f 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1769,8 +1769,7 @@  static int pxa2xx_spi_probe(struct platform_device *pdev)
 		for (i = 0; i < master->num_chipselect; i++) {
 			struct gpio_desc *gpiod;
 
-			gpiod = devm_gpiod_get_index(dev, "cs", i,
-						     GPIOD_OUT_HIGH);
+			gpiod = devm_gpiod_get_index(dev, "cs", i, GPIOD_ASIS);
 			if (IS_ERR(gpiod)) {
 				/* Means use native chip select */
 				if (PTR_ERR(gpiod) == -ENOENT)