Commit 901f26bc authored by Greg Ungerer's avatar Greg Ungerer Committed by Shawn Guo

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: default avatarGreg Ungerer <gerg@linux-m68k.org>
Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
parent 55edcbb2
...@@ -375,6 +375,8 @@ static struct imx_ssi_platform_data mx31_3ds_ssi_pdata = { ...@@ -375,6 +375,8 @@ static struct imx_ssi_platform_data mx31_3ds_ssi_pdata = {
/* SPI */ /* SPI */
static int spi0_internal_chipselect[] = { static int spi0_internal_chipselect[] = {
MXC_SPI_CS(0),
MXC_SPI_CS(1),
MXC_SPI_CS(2), MXC_SPI_CS(2),
}; };
...@@ -385,6 +387,7 @@ static const struct spi_imx_master spi0_pdata __initconst = { ...@@ -385,6 +387,7 @@ static const struct spi_imx_master spi0_pdata __initconst = {
static int spi1_internal_chipselect[] = { static int spi1_internal_chipselect[] = {
MXC_SPI_CS(0), MXC_SPI_CS(0),
MXC_SPI_CS(1),
MXC_SPI_CS(2), MXC_SPI_CS(2),
}; };
...@@ -398,7 +401,7 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = { ...@@ -398,7 +401,7 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
.modalias = "mc13783", .modalias = "mc13783",
.max_speed_hz = 1000000, .max_speed_hz = 1000000,
.bus_num = 1, .bus_num = 1,
.chip_select = 1, /* SS2 */ .chip_select = 2, /* SS2 */
.platform_data = &mc13783_pdata, .platform_data = &mc13783_pdata,
/* irq number is run-time assigned */ /* irq number is run-time assigned */
.mode = SPI_CS_HIGH, .mode = SPI_CS_HIGH,
...@@ -406,7 +409,7 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = { ...@@ -406,7 +409,7 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
.modalias = "l4f00242t03", .modalias = "l4f00242t03",
.max_speed_hz = 5000000, .max_speed_hz = 5000000,
.bus_num = 0, .bus_num = 0,
.chip_select = 0, /* SS2 */ .chip_select = 2, /* SS2 */
.platform_data = &mx31_3ds_l4f00242t03_pdata, .platform_data = &mx31_3ds_l4f00242t03_pdata,
}, },
}; };
......
...@@ -296,14 +296,14 @@ static struct spi_board_info moboard_spi_board_info[] __initdata = { ...@@ -296,14 +296,14 @@ static struct spi_board_info moboard_spi_board_info[] __initdata = {
/* irq number is run-time assigned */ /* irq number is run-time assigned */
.max_speed_hz = 300000, .max_speed_hz = 300000,
.bus_num = 1, .bus_num = 1,
.chip_select = 0, .chip_select = 1,
.platform_data = &moboard_pmic, .platform_data = &moboard_pmic,
.mode = SPI_CS_HIGH, .mode = SPI_CS_HIGH,
}, },
}; };
static int moboard_spi2_cs[] = { static int moboard_spi2_cs[] = {
MXC_SPI_CS(1), MXC_SPI_CS(0), MXC_SPI_CS(1),
}; };
static const struct spi_imx_master moboard_spi2_pdata __initconst = { static const struct spi_imx_master moboard_spi2_pdata __initconst = {
......
...@@ -50,13 +50,13 @@ static struct spi_board_info pcm037_spi_dev[] = { ...@@ -50,13 +50,13 @@ static struct spi_board_info pcm037_spi_dev[] = {
.modalias = "dac124s085", .modalias = "dac124s085",
.max_speed_hz = 400000, .max_speed_hz = 400000,
.bus_num = 0, .bus_num = 0,
.chip_select = 0, /* Index in pcm037_spi1_cs[] */ .chip_select = 1, /* Index in pcm037_spi1_cs[] */
.mode = SPI_CPHA, .mode = SPI_CPHA,
}, },
}; };
/* Platform Data for MXC CSPI */ /* Platform Data for MXC CSPI */
static int pcm037_spi1_cs[] = {MXC_SPI_CS(1), IOMUX_TO_GPIO(MX31_PIN_KEY_COL7)}; static int pcm037_spi1_cs[] = { MXC_SPI_CS(0), MXC_SPI_CS(1), };
static const struct spi_imx_master pcm037_spi1_pdata __initconst = { static const struct spi_imx_master pcm037_spi1_pdata __initconst = {
.chipselect = pcm037_spi1_cs, .chipselect = pcm037_spi1_cs,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment