[PATCH 4.2.y-ckt 042/273] spi: atmel: fix gpio chip-select in case of non-DT platform

From: Kamal Mostafa
Date: Mon Mar 07 2016 - 19:45:33 EST


4.2.8-ckt5 -stable review patch. If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Cyrille Pitchen <cyrille.pitchen@xxxxxxxxx>

commit 70f340df24518d36eeaefb6652d492f250115c19 upstream.

The non-DT platform that uses this driver (actually the AVR32) was taking a bad
branch for determining if the IP would use gpio for CS.
Adding the presence of DT as a condition fixes this issue.

Fixes: 4820303480a1 ("spi: atmel: add support for the internal chip-select of the spi controller")
Reported-by: Mans Rullgard <mans@xxxxxxxxx>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@xxxxxxxxx>
[nicolas.ferre@xxxxxxxxx: extract from ml discussion]
Signed-off-by: Nicolas Ferre <nicolas.ferre@xxxxxxxxx>
Tested-by: Mans Rullgard <mans@xxxxxxxxx>
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
Signed-off-by: Kamal Mostafa <kamal@xxxxxxxxxxxxx>
---
drivers/spi/spi-atmel.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index a89ea0d..da85f8eb 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1581,6 +1581,7 @@ static int atmel_spi_probe(struct platform_device *pdev)

as->use_cs_gpios = true;
if (atmel_spi_is_v2(as) &&
+ pdev->dev.of_node &&
!of_get_property(pdev->dev.of_node, "cs-gpios", NULL)) {
as->use_cs_gpios = false;
master->num_chipselect = 4;
--
2.7.0