[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ecfa135b7b83a31bed821ec0740ab3cf1d39da15.camel@ew.tq-group.com>
Date: Thu, 03 Sep 2020 11:22:20 +0200
From: Matthias Schiffer <matthias.schiffer@...tq-group.com>
To: Mark Brown <broonie@...nel.org>, Rob Herring <robh+dt@...nel.org>
Cc: Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
linux-spi@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: spi-imx: correct interpretation of num-cs DT property?
Hi,
I've recently had a discussion about the correct way for an SPI driver
to handle the num-cs property: https://lkml.org/lkml/2020/8/25/184
Since 8cdcd8aeee281 ("spi: imx/fsl-lpspi: Convert to GPIO
descriptors"), the logic of the spi-imx driver is somewhat confusing:
If fewer than 3 cs-gpios are defined, and no explicit num-cs property
exists, the driver will set num_chipselect to 3 by default, instead of
the number of cs-gpios entries.
To avoid having to specify num-cs when the number cs-gpios would
suffice, I suggested to modify the logic to the following:
- If num-cs is set, use that
- If num-cs is unset, use the number of cs-gpios
- If num-cs is unset and no cs-gpios are defined, use a driver-provided
default (which is 3 for spi-imx; this matches the number of native CS
pins in older implementations of this SPI controller; i.MX6 and newer
support up to 4)
Also, would it make sense to add num-cs to all DTS files for boards
that actually use fewer than 3 CS pins?
At the moment, the num-cs property is not explicitly documented for the
spi-imx driver, although the driver understands it. I also suggested to
add this to the docs, which Fabio didn't deem a good idea (I don't
quite understand the reasoning here - isn't num-cs generally a useful
property to have?)
Kind regards,
Matthias
Powered by blists - more mailing lists