spi: imx: Don't require platform data chipselect array

If the array is not present, assume all chip selects are native.  This
is the standard behavior for SPI masters configured via the device
tree and the behavior of this driver as well when it is configured via
device tree.

This reduces platform data vs DT differences and allows most of the
platform data based boards to remove their chip select arrays.

CC: Shawn Guo <shawnguo@kernel.org>
CC: Sascha Hauer <kernel@pengutronix.de>
CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Mark Brown <broonie@kernel.org>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Trent Piepho 2017-10-31 12:49:06 -07:00 committed by Mark Brown
parent 4e21791e74
commit ffd4db9e10
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 8 additions and 6 deletions

View File

@ -1526,13 +1526,15 @@ static int spi_imx_probe(struct platform_device *pdev)
/* Get number of chip selects, either platform data or OF */ /* Get number of chip selects, either platform data or OF */
if (mxc_platform_info) { if (mxc_platform_info) {
master->num_chipselect = mxc_platform_info->num_chipselect; master->num_chipselect = mxc_platform_info->num_chipselect;
master->cs_gpios = devm_kzalloc(&master->dev, if (mxc_platform_info->chipselect) {
sizeof(int) * master->num_chipselect, GFP_KERNEL); master->cs_gpios = devm_kzalloc(&master->dev,
if (!master->cs_gpios) sizeof(int) * master->num_chipselect, GFP_KERNEL);
return -ENOMEM; if (!master->cs_gpios)
return -ENOMEM;
for (i = 0; i < master->num_chipselect; i++) for (i = 0; i < master->num_chipselect; i++)
master->cs_gpios[i] = mxc_platform_info->chipselect[i]; master->cs_gpios[i] = mxc_platform_info->chipselect[i];
}
} else { } else {
u32 num_cs; u32 num_cs;