From: Shawn Guo <shawnguo@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Mark Brown" <broonie@kernel.org>,
linux-spi@vger.kernel.org,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Robin Gong" <yibin.gong@nxp.com>,
"Trent Piepho" <tpiepho@impinj.com>,
"Clark Wang" <xiaoning.wang@nxp.com>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"NXP Linux Team" <linux-imx@nxp.com>
Subject: Re: [PATCH] spi: imx/fsl-lpspi: Convert to GPIO descriptors
Date: Mon, 13 Jul 2020 09:53:09 +0800 [thread overview]
Message-ID: <20200713015308.GS21277@dragon> (raw)
In-Reply-To: <20200625200252.207614-1-linus.walleij@linaro.org>
On Thu, Jun 25, 2020 at 10:02:52PM +0200, Linus Walleij wrote:
> This converts the two Freescale i.MX SPI drivers
> Freescale i.MX (CONFIG_SPI_IMX) and Freescale i.MX LPSPI
> (CONFIG_SPI_FSL_LPSPI) to use GPIO descriptors handled in
> the SPI core for GPIO chip selects whether defined in
> the device tree or a board file.
>
> The reason why both are converted at the same time is
> that they were both using the same platform data and
> platform device population helpers when using
> board files intertwining the code so this gives a cleaner
> cut.
>
> The platform device creation was passing a platform data
> container from each boardfile down to the driver using
> struct spi_imx_master from <linux/platform_data/spi-imx.h>,
> but this was only conveying the number of chipselects and
> an int * array of the chipselect GPIO numbers.
>
> The imx27 and imx31 platforms had code passing the
> now-unused platform data when creating the platform devices,
> this has been repurposed to pass around GPIO descriptor
> tables. The platform data struct that was just passing an
> array of integers and number of chip selects for the GPIO
> lines has been removed.
>
> The number of chipselects used to be passed from the board
> file, because this number also limits the number of native
> chipselects that the platform can use. To deal with this we
> just augment the i.MX (CONFIG_SPI_IMX) driver to support 3
> chipselects if the platform does not define "num-cs" as a
> device property (such as from the device tree). This covers
> all the legacy boards as these use <= 3 native chip selects
> (or GPIO lines, and in that case the number of chip selects
> is determined by the core from the number of available
> GPIO lines). Any new boards should use device tree, so
> this is a reasonable simplification to cover all old
> boards.
>
> The LPSPI driver never assigned the number of chipselects
> and thus always fall back to the core default of 1 chip
> select if no GPIOs are defined in the device tree.
>
> The Freescale i.MX driver was already partly utilizing
> the SPI core to obtain the GPIO numbers from the device tree,
> so this completes the transtion to let the core handle all
> of it.
>
> All board files and the core i.MX boardfile registration
> code is augmented to account for these changes.
>
> This has been compile-tested with the imx_v4_v5_defconfig
> and the imx_v6_v7_defconfig.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Cc: Robin Gong <yibin.gong@nxp.com>
> Cc: Trent Piepho <tpiepho@impinj.com>
> Cc: Clark Wang <xiaoning.wang@nxp.com>
> Cc: Shawn Guo <shawnguo@kernel.org>
Acked-by: Shawn Guo <shawnguo@kernel.org>
prev parent reply other threads:[~2020-07-13 1:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 20:02 [PATCH] spi: imx/fsl-lpspi: Convert to GPIO descriptors Linus Walleij
2020-06-26 5:59 ` Uwe Kleine-König
2020-06-26 20:36 ` Linus Walleij
2020-07-13 1:53 ` Shawn Guo [this message]
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=20200713015308.GS21277@dragon \
--to=shawnguo@kernel.org \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-imx@nxp.com \
--cc=linux-spi@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=tpiepho@impinj.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=xiaoning.wang@nxp.com \
--cc=yibin.gong@nxp.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.