Re: [PATCH] spi: imx/fsl-lpspi: Convert to GPIO descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
> Cc: Robin Gong <yibin.gong@xxxxxxx>
> Cc: Trent Piepho <tpiepho@xxxxxxxxxx>
> Cc: Clark Wang <xiaoning.wang@xxxxxxx>
> Cc: Shawn Guo <shawnguo@xxxxxxxxxx>
> Cc: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> Cc: Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>
> Cc: Fabio Estevam <festevam@xxxxxxxxx>
> Cc: NXP Linux Team <linux-imx@xxxxxxx>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> ---
>  arch/arm/mach-imx/devices-imx27.h            | 10 +--
>  arch/arm/mach-imx/devices-imx31.h            | 10 +--
>  arch/arm/mach-imx/devices/devices-common.h   |  5 +-
>  arch/arm/mach-imx/devices/platform-spi_imx.c |  9 +-
>  arch/arm/mach-imx/mach-mx27_3ds.c            | 40 ++++++---
>  arch/arm/mach-imx/mach-mx31_3ds.c            | 13 +--
>  arch/arm/mach-imx/mach-mx31lilly.c           | 14 +--
>  arch/arm/mach-imx/mach-mx31lite.c            | 19 +---
>  arch/arm/mach-imx/mach-mx31moboard.c         | 12 +--
>  arch/arm/mach-imx/mach-pca100.c              | 21 +++--
>  arch/arm/mach-imx/mach-pcm037_eet.c          |  7 +-

I'm not sure I'd bother with these. I didn't see board files in use any
more since quite some time. I suggest to delete them instead. (Or break
them by doing the spi driver conversion without adapting them?)

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux