mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] spi: imx: Remove the use of property "fsl, spi-num-chipselects"
@ 2016-06-24 15:04 Alexander Shiyan
  2016-06-27  6:47 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2016-06-24 15:04 UTC (permalink / raw)
  To: barebox

The "fsl,spi-num-chipselects" property will be marked obsolete soon.
This patch updates the driver to be ready to such changes.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/spi/imx_spi.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
index 99ec228..dc7a8c8 100644
--- a/drivers/spi/imx_spi.c
+++ b/drivers/spi/imx_spi.c
@@ -515,23 +515,16 @@ static __maybe_unused struct spi_imx_devtype_data spi_imx_devtype_data_2_3 = {
 static int imx_spi_dt_probe(struct imx_spi *imx)
 {
 	struct device_node *node = imx->master.dev->device_node;
-	int ret, i;
-	u32 num_cs;
+	int i;
 
 	if (!node)
 		return -ENODEV;
 
-	ret = of_property_read_u32(node, "fsl,spi-num-chipselects", &num_cs);
-	if (ret)
-		return ret;
-
-	imx->master.num_chipselect = num_cs;
-	imx->cs_array = xzalloc(sizeof(u32) * num_cs);
+	imx->master.num_chipselect = of_gpio_named_count(node, "cs-gpios");
+	imx->cs_array = xzalloc(sizeof(u32) * imx->master.num_chipselect);
 
-	for (i = 0; i < num_cs; i++) {
-		int cs_gpio = of_get_named_gpio(node, "cs-gpios", i);
-		imx->cs_array[i] = cs_gpio;
-	}
+	for (i = 0; i < imx->master.num_chipselect; i++)
+		imx->cs_array[i] = of_get_named_gpio(node, "cs-gpios", i);
 
 	return 0;
 }
-- 
2.4.9


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-27  6:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 15:04 [PATCH] spi: imx: Remove the use of property "fsl, spi-num-chipselects" Alexander Shiyan
2016-06-27  6:47 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox