Commit 4d920471 authored by Mark Brown's avatar Mark Brown

Merge branch 'fix/mediatek' of...

Merge branch 'fix/mediatek' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-mtk
parents 4c3dbd35 98c8dccf
...@@ -407,7 +407,7 @@ static int mtk_spi_setup(struct spi_device *spi) ...@@ -407,7 +407,7 @@ static int mtk_spi_setup(struct spi_device *spi)
if (!spi->controller_data) if (!spi->controller_data)
spi->controller_data = (void *)&mtk_default_chip_info; spi->controller_data = (void *)&mtk_default_chip_info;
if (mdata->dev_comp->need_pad_sel) if (mdata->dev_comp->need_pad_sel && gpio_is_valid(spi->cs_gpio))
gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
return 0; return 0;
...@@ -629,13 +629,23 @@ static int mtk_spi_probe(struct platform_device *pdev) ...@@ -629,13 +629,23 @@ static int mtk_spi_probe(struct platform_device *pdev)
goto err_put_master; goto err_put_master;
} }
for (i = 0; i < master->num_chipselect; i++) { if (!master->cs_gpios && master->num_chipselect > 1) {
ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i], dev_err(&pdev->dev,
dev_name(&pdev->dev)); "cs_gpios not specified and num_chipselect > 1\n");
if (ret) { ret = -EINVAL;
dev_err(&pdev->dev, goto err_put_master;
"can't get CS GPIO %i\n", i); }
goto err_put_master;
if (master->cs_gpios) {
for (i = 0; i < master->num_chipselect; i++) {
ret = devm_gpio_request(&pdev->dev,
master->cs_gpios[i],
dev_name(&pdev->dev));
if (ret) {
dev_err(&pdev->dev,
"can't get CS GPIO %i\n", i);
goto err_put_master;
}
} }
} }
} }
......
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