linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi-imx: remove num-cs support, set num_chipselect to 4
@ 2020-09-03 14:40 Matthias Schiffer
  2020-09-04 12:35 ` Fabio Estevam
  0 siblings, 1 reply; 10+ messages in thread
From: Matthias Schiffer @ 2020-09-03 14:40 UTC (permalink / raw)
  To: Mark Brown, Shawn Guo, Sascha Hauer
  Cc: Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	linux-spi, linux-arm-kernel, linux-kernel, Matthias Schiffer

The num-cs property is not considered useful, and no in-tree Device
Trees define it for spi-imx.

The default value to be used when no cs-gpios are defined is set to 4 to
give access to all native CS pins of modern i.MX SoCs (i.MX6 and newer).

In older SoCs, the number of CS pins varies (for example the i.MX27 has 3
CS pins on CSPI1 and CSPI2, and only a single CS on CSPI3). Attempting
to use the nonexisting CS pin would be an easy to notice DT
misconfiguration; making the driver catch this doesn't seem worthwhile.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
---
 drivers/spi/spi-imx.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 197f60632072..aece8482739b 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -1581,7 +1581,6 @@ static int spi_imx_probe(struct platform_device *pdev)
 	const struct spi_imx_devtype_data *devtype_data = of_id ? of_id->data :
 		(struct spi_imx_devtype_data *)pdev->id_entry->driver_data;
 	bool slave_mode;
-	u32 val;
 
 	slave_mode = devtype_data->has_slavemode &&
 			of_property_read_bool(np, "spi-slave");
@@ -1605,6 +1604,7 @@ static int spi_imx_probe(struct platform_device *pdev)
 	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
 	master->bus_num = np ? -1 : pdev->id;
 	master->use_gpio_descriptors = true;
+	master->num_chipselect = 4;
 
 	spi_imx = spi_master_get_devdata(master);
 	spi_imx->bitbang.master = master;
@@ -1613,17 +1613,6 @@ static int spi_imx_probe(struct platform_device *pdev)
 
 	spi_imx->devtype_data = devtype_data;
 
-	/*
-	 * Get number of chip selects from device properties. This can be
-	 * coming from device tree or boardfiles, if it is not defined,
-	 * a default value of 3 chip selects will be used, as all the legacy
-	 * board files have <= 3 chip selects.
-	 */
-	if (!device_property_read_u32(&pdev->dev, "num-cs", &val))
-		master->num_chipselect = val;
-	else
-		master->num_chipselect = 3;
-
 	spi_imx->bitbang.setup_transfer = spi_imx_setupxfer;
 	spi_imx->bitbang.txrx_bufs = spi_imx_transfer;
 	spi_imx->bitbang.master->setup = spi_imx_setup;
-- 
2.17.1


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

end of thread, other threads:[~2020-09-13 14:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03 14:40 [PATCH] spi-imx: remove num-cs support, set num_chipselect to 4 Matthias Schiffer
2020-09-04 12:35 ` Fabio Estevam
2020-09-04 13:02   ` (EXT) " Matthias Schiffer
2020-09-04 13:57     ` Fabio Estevam
2020-09-04 14:34       ` (EXT) " Matthias Schiffer
2020-09-04 15:04         ` Mark Brown
2020-09-04 15:42           ` Fabio Estevam
2020-09-07  7:40             ` (EXT) " Matthias Schiffer
2020-09-13 14:15               ` Fabio Estevam
2020-09-04 13:10   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).