linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Cc: Mark Brown <broonie@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	NXP Linux Team <linux-imx@nxp.com>,
	linux-spi <linux-spi@vger.kernel.org>,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] spi-imx: remove num-cs support, set num_chipselect to 4
Date: Fri, 4 Sep 2020 09:35:38 -0300	[thread overview]
Message-ID: <CAOMZO5DGHoG_8X+fbrGCHR4g=sGdEaF7bYrHbC_2T=aUnfTs8g@mail.gmail.com> (raw)
In-Reply-To: <20200903144028.20416-1-matthias.schiffer@ew.tq-group.com>

Hi Matthias,

On Thu, Sep 3, 2020 at 11:40 AM Matthias Schiffer
<matthias.schiffer@ew.tq-group.com> wrote:
>
> 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;

On an imx6q-sabresd, which only has one SPI chip-select via GPIO, this
makes the SPI core to understand that it has 4 chip selects.

From spi_get_gpio_descs() in drivers/spi/spi.c:

ctlr->num_chipselect = max_t(int, nb, ctlr->num_chipselect);

It is 4 now after your patch, it was 3 after 8cdcd8aeee28 ("spi:
imx/fsl-lpspi: Convert to GPIO descriptors") and 1 before such commit.

Couldn't we just remove master->num_chipselect from the spi-imx.c driver?

  reply	other threads:[~2020-09-04 12:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOMZO5DGHoG_8X+fbrGCHR4g=sGdEaF7bYrHbC_2T=aUnfTs8g@mail.gmail.com' \
    --to=festevam@gmail.com \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=matthias.schiffer@ew.tq-group.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).