]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ARM: imx: Update spi_imx platform data to reflect current state
authorTrent Piepho <tpiepho@impinj.com>
Mon, 2 Apr 2018 20:06:05 +0000 (13:06 -0700)
committerShawn Guo <shawnguo@kernel.org>
Wed, 18 Apr 2018 03:11:23 +0000 (11:11 +0800)
The docs for the spi_imx platform data still refer to a -32 offset used to
specify a native chip select.  This was removed in commit 602c8f4485cd
("spi: imx: fix use of native chip-selects with devicetree") and no
longer works as documented.  Update documentation.

The macro MXC_SPI_CS() is no longer is needed.

If a board uses all native chip selects, then it's not necessary to
specify a chip select array at all, as all native is the default (this is
how device-tree configured SPI masters work too).  Most of the spi-imx
platform data users have their chip select arrays removed by this patch.

This patch also fixes a bug in mx31moboard introduced in the '602 commit.
When that board was updated in commit 901f26bce64a ("ARM: imx: set
correct chip_select in platform setup") to reflect the SPI change, only
SPI bus 2 was updated and SPI bus 1 was left with non-sequential chip
selects.  The mc13783 spi device on bus 1 had its chip select updated as
if it were on bus 2.

CC: Sascha Hauer <kernel@pengutronix.de>
CC: Fabio Estevam <fabio.estevam@nxp.com>
Acked-by: Greg Ungerer <gerg@linux-m68k.org>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
arch/arm/mach-imx/mach-mx31_3ds.c
arch/arm/mach-imx/mach-mx31lilly.c
arch/arm/mach-imx/mach-mx31lite.c
arch/arm/mach-imx/mach-mx31moboard.c
arch/arm/mach-imx/mach-pcm037_eet.c
include/linux/platform_data/spi-imx.h

index 68c3f0799d5bbab62ce2cb9b94788014e6998800..9d87f1dcf7bbc8cea73b30e571ec131793b41b9c 100644 (file)
@@ -374,26 +374,12 @@ static struct imx_ssi_platform_data mx31_3ds_ssi_pdata = {
 };
 
 /* SPI */
-static int spi0_internal_chipselect[] = {
-       MXC_SPI_CS(0),
-       MXC_SPI_CS(1),
-       MXC_SPI_CS(2),
-};
-
 static const struct spi_imx_master spi0_pdata __initconst = {
-       .chipselect     = spi0_internal_chipselect,
-       .num_chipselect = ARRAY_SIZE(spi0_internal_chipselect),
-};
-
-static int spi1_internal_chipselect[] = {
-       MXC_SPI_CS(0),
-       MXC_SPI_CS(1),
-       MXC_SPI_CS(2),
+       .num_chipselect = 3,
 };
 
 static const struct spi_imx_master spi1_pdata __initconst = {
-       .chipselect     = spi1_internal_chipselect,
-       .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect),
+       .num_chipselect = 3,
 };
 
 static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
index 6fd463642954a404e60cfb9526e2041360008260..8bf52819d4d9885cdf842a4d1b0b4ab2f6526846 100644 (file)
@@ -226,20 +226,12 @@ static void __init lilly1131_usb_init(void)
 
 /* SPI */
 
-static int spi_internal_chipselect[] = {
-       MXC_SPI_CS(0),
-       MXC_SPI_CS(1),
-       MXC_SPI_CS(2),
-};
-
 static const struct spi_imx_master spi0_pdata __initconst = {
-       .chipselect = spi_internal_chipselect,
-       .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
+       .num_chipselect = 3,
 };
 
 static const struct spi_imx_master spi1_pdata __initconst = {
-       .chipselect = spi_internal_chipselect,
-       .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
+       .num_chipselect = 3,
 };
 
 static struct mc13xxx_platform_data mc13783_pdata __initdata = {
index a3250bc7f1148fc59c11f3c378051ad950dc253b..a3cbba6c955bd0168b9e18c8bf92987e5a053653 100644 (file)
@@ -83,15 +83,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
 };
 
 /* SPI */
-static int spi0_internal_chipselect[] = {
-       MXC_SPI_CS(0),
-       MXC_SPI_CS(1),
-       MXC_SPI_CS(2),
-};
-
 static const struct spi_imx_master spi0_pdata __initconst = {
-       .chipselect     = spi0_internal_chipselect,
-       .num_chipselect = ARRAY_SIZE(spi0_internal_chipselect),
+       .num_chipselect = 3,
 };
 
 static const struct mxc_nand_platform_data
@@ -133,13 +126,8 @@ static struct platform_device smsc911x_device = {
  * The MC13783 is the only hard-wired SPI device on the module.
  */
 
-static int spi1_internal_chipselect[] = {
-       MXC_SPI_CS(0),
-};
-
 static const struct spi_imx_master spi1_pdata __initconst = {
-       .chipselect     = spi1_internal_chipselect,
-       .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect),
+       .num_chipselect = 1,
 };
 
 static struct mc13xxx_platform_data mc13783_pdata __initdata = {
index 7716f83aecdda1d5f6a35677d40d9446b5d8a0cf..643a3d74970364985366e613ecc2ca9dc6773adc 100644 (file)
@@ -152,14 +152,8 @@ static const struct imxi2c_platform_data moboard_i2c1_data __initconst = {
        .bitrate = 100000,
 };
 
-static int moboard_spi1_cs[] = {
-       MXC_SPI_CS(0),
-       MXC_SPI_CS(2),
-};
-
 static const struct spi_imx_master moboard_spi1_pdata __initconst = {
-       .chipselect     = moboard_spi1_cs,
-       .num_chipselect = ARRAY_SIZE(moboard_spi1_cs),
+       .num_chipselect = 3,
 };
 
 static struct regulator_consumer_supply sdhc_consumers[] = {
@@ -296,19 +290,14 @@ static struct spi_board_info moboard_spi_board_info[] __initdata = {
                /* irq number is run-time assigned */
                .max_speed_hz = 300000,
                .bus_num = 1,
-               .chip_select = 1,
+               .chip_select = 0,
                .platform_data = &moboard_pmic,
                .mode = SPI_CS_HIGH,
        },
 };
 
-static int moboard_spi2_cs[] = {
-       MXC_SPI_CS(0), MXC_SPI_CS(1),
-};
-
 static const struct spi_imx_master moboard_spi2_pdata __initconst = {
-       .chipselect     = moboard_spi2_cs,
-       .num_chipselect = ARRAY_SIZE(moboard_spi2_cs),
+       .num_chipselect = 2,
 };
 
 #define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)
index 95bd97710494e4e0041ad36c82ef0e0eaa220003..15bc956d466b1ea43b16053d205f278f2d0387f7 100644 (file)
@@ -56,11 +56,8 @@ static struct spi_board_info pcm037_spi_dev[] = {
 };
 
 /* Platform Data for MXC CSPI */
-static int pcm037_spi1_cs[] = { MXC_SPI_CS(0), MXC_SPI_CS(1), };
-
 static const struct spi_imx_master pcm037_spi1_pdata __initconst = {
-       .chipselect = pcm037_spi1_cs,
-       .num_chipselect = ARRAY_SIZE(pcm037_spi1_cs),
+       .num_chipselect = 2,
 };
 
 /* GPIO-keys input device */
index 6f012fefa1a231b5517981353ea2b892fd668863..328f670d10bd731b81e0a2bf3edecc819cfb3d26 100644 (file)
@@ -5,24 +5,29 @@
 
 /*
  * struct spi_imx_master - device.platform_data for SPI controller devices.
- * @chipselect: Array of chipselects for this master. Numbers >= 0 mean gpio
- *              pins, numbers < 0 mean internal CSPI chipselects according
- *              to MXC_SPI_CS(). Normally you want to use gpio based chip
- *              selects as the CSPI module tries to be intelligent about
- *              when to assert the chipselect: The CSPI module deasserts the
- *              chipselect once it runs out of input data. The other problem
- *              is that it is not possible to mix between high active and low
- *              active chipselects on one single bus using the internal
- *              chipselects. Unfortunately Freescale decided to put some
+ * @chipselect: Array of chipselects for this master or NULL.  Numbers >= 0
+ *              mean GPIO pins, -ENOENT means internal CSPI chipselect
+ *              matching the position in the array.  E.g., if chipselect[1] =
+ *              -ENOENT then a SPI slave using chip select 1 will use the
+ *              native SS1 line of the CSPI.  Omitting the array will use
+ *              all native chip selects.
+
+ *              Normally you want to use gpio based chip selects as the CSPI
+ *              module tries to be intelligent about when to assert the
+ *              chipselect:  The CSPI module deasserts the chipselect once it
+ *              runs out of input data.  The other problem is that it is not
+ *              possible to mix between high active and low active chipselects
+ *              on one single bus using the internal chipselects.
+ *              Unfortunately, on some SoCs, Freescale decided to put some
  *              chipselects on dedicated pins which are not usable as gpios,
  *              so we have to support the internal chipselects.
- * @num_chipselect: ARRAY_SIZE(chipselect)
+ *
+ * @num_chipselect: If @chipselect is specified, ARRAY_SIZE(chipselect),
+ *                  otherwise the number of native chip selects.
  */
 struct spi_imx_master {
        int     *chipselect;
        int     num_chipselect;
 };
 
-#define MXC_SPI_CS(no) ((no) - 32)
-
 #endif /* __MACH_SPI_H_*/