aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@linux-m68k.org>2017-03-17 01:03:02 -0400
committerShawn Guo <shawnguo@kernel.org>2017-03-20 03:38:56 -0400
commit901f26bce64a96bd9d038fda3604bd0ab1098c3b (patch)
treebbf2c8c94ade99cfd150bf2bef5d028ffc7ac27d
parent55edcbb2db3a41c1520425b84c620286f4e5e394 (diff)
ARM: imx: set correct chip_select in platform setup
Some platform based configuration setup of spi-imx SPI devices does not set the "chip_select" to the actual hardware chip select used. This works because the cs_gpio mapping that is associated with this platform setup maps the chip_select offset used to the appropriate hardware chip select. The spi-imx driver uses the chip_select as an index into the cs_gpio array and ultimately gets the correct hardware chip select for its hardware setup. The motivation is to be able to eventually modify the spi-imx code to use the "chip_select" directly for harwdare setup instead of indirectly via the cs_gpio mapping array. This change only affects platforms using the hardware chip select addressing method for their SPI devices (sometimes called native chip select). The majority of devices using the spi-imx driver use the GPIO addressing method. The change to use the correct "chip_select" is strait forward. But the cs_gpio mapping arrary also needs to be modifed to match that change. In simple terms the cs_gpio mapping should always have the hardware chip select number at its same index offset. There is no functional change with these patches. The three affected platforms should work exactly as before. However I don't have any of these platforms (or access to them) and so I can't test them. So this patch is compile tested only. Signed-off-by: Greg Ungerer <gerg@linux-m68k.org> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
-rw-r--r--arch/arm/mach-imx/mach-mx31_3ds.c7
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c4
-rw-r--r--arch/arm/mach-imx/mach-pcm037_eet.c4
3 files changed, 9 insertions, 6 deletions
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 558e5f8589cb..68c3f0799d5b 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -375,6 +375,8 @@ static struct imx_ssi_platform_data mx31_3ds_ssi_pdata = {
375 375
376/* SPI */ 376/* SPI */
377static int spi0_internal_chipselect[] = { 377static int spi0_internal_chipselect[] = {
378 MXC_SPI_CS(0),
379 MXC_SPI_CS(1),
378 MXC_SPI_CS(2), 380 MXC_SPI_CS(2),
379}; 381};
380 382
@@ -385,6 +387,7 @@ static const struct spi_imx_master spi0_pdata __initconst = {
385 387
386static int spi1_internal_chipselect[] = { 388static int spi1_internal_chipselect[] = {
387 MXC_SPI_CS(0), 389 MXC_SPI_CS(0),
390 MXC_SPI_CS(1),
388 MXC_SPI_CS(2), 391 MXC_SPI_CS(2),
389}; 392};
390 393
@@ -398,7 +401,7 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
398 .modalias = "mc13783", 401 .modalias = "mc13783",
399 .max_speed_hz = 1000000, 402 .max_speed_hz = 1000000,
400 .bus_num = 1, 403 .bus_num = 1,
401 .chip_select = 1, /* SS2 */ 404 .chip_select = 2, /* SS2 */
402 .platform_data = &mc13783_pdata, 405 .platform_data = &mc13783_pdata,
403 /* irq number is run-time assigned */ 406 /* irq number is run-time assigned */
404 .mode = SPI_CS_HIGH, 407 .mode = SPI_CS_HIGH,
@@ -406,7 +409,7 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
406 .modalias = "l4f00242t03", 409 .modalias = "l4f00242t03",
407 .max_speed_hz = 5000000, 410 .max_speed_hz = 5000000,
408 .bus_num = 0, 411 .bus_num = 0,
409 .chip_select = 0, /* SS2 */ 412 .chip_select = 2, /* SS2 */
410 .platform_data = &mx31_3ds_l4f00242t03_pdata, 413 .platform_data = &mx31_3ds_l4f00242t03_pdata,
411 }, 414 },
412}; 415};
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index cc867682520e..bde9a9af6714 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -296,14 +296,14 @@ static struct spi_board_info moboard_spi_board_info[] __initdata = {
296 /* irq number is run-time assigned */ 296 /* irq number is run-time assigned */
297 .max_speed_hz = 300000, 297 .max_speed_hz = 300000,
298 .bus_num = 1, 298 .bus_num = 1,
299 .chip_select = 0, 299 .chip_select = 1,
300 .platform_data = &moboard_pmic, 300 .platform_data = &moboard_pmic,
301 .mode = SPI_CS_HIGH, 301 .mode = SPI_CS_HIGH,
302 }, 302 },
303}; 303};
304 304
305static int moboard_spi2_cs[] = { 305static int moboard_spi2_cs[] = {
306 MXC_SPI_CS(1), 306 MXC_SPI_CS(0), MXC_SPI_CS(1),
307}; 307};
308 308
309static const struct spi_imx_master moboard_spi2_pdata __initconst = { 309static const struct spi_imx_master moboard_spi2_pdata __initconst = {
diff --git a/arch/arm/mach-imx/mach-pcm037_eet.c b/arch/arm/mach-imx/mach-pcm037_eet.c
index 8fd8255068ee..95bd97710494 100644
--- a/arch/arm/mach-imx/mach-pcm037_eet.c
+++ b/arch/arm/mach-imx/mach-pcm037_eet.c
@@ -50,13 +50,13 @@ static struct spi_board_info pcm037_spi_dev[] = {
50 .modalias = "dac124s085", 50 .modalias = "dac124s085",
51 .max_speed_hz = 400000, 51 .max_speed_hz = 400000,
52 .bus_num = 0, 52 .bus_num = 0,
53 .chip_select = 0, /* Index in pcm037_spi1_cs[] */ 53 .chip_select = 1, /* Index in pcm037_spi1_cs[] */
54 .mode = SPI_CPHA, 54 .mode = SPI_CPHA,
55 }, 55 },
56}; 56};
57 57
58/* Platform Data for MXC CSPI */ 58/* Platform Data for MXC CSPI */
59static int pcm037_spi1_cs[] = {MXC_SPI_CS(1), IOMUX_TO_GPIO(MX31_PIN_KEY_COL7)}; 59static int pcm037_spi1_cs[] = { MXC_SPI_CS(0), MXC_SPI_CS(1), };
60 60
61static const struct spi_imx_master pcm037_spi1_pdata __initconst = { 61static const struct spi_imx_master pcm037_spi1_pdata __initconst = {
62 .chipselect = pcm037_spi1_cs, 62 .chipselect = pcm037_spi1_cs,