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,8 +629,17 @@ static int mtk_spi_probe(struct platform_device *pdev) ...@@ -629,8 +629,17 @@ static int mtk_spi_probe(struct platform_device *pdev)
goto err_put_master; goto err_put_master;
} }
if (!master->cs_gpios && master->num_chipselect > 1) {
dev_err(&pdev->dev,
"cs_gpios not specified and num_chipselect > 1\n");
ret = -EINVAL;
goto err_put_master;
}
if (master->cs_gpios) {
for (i = 0; i < master->num_chipselect; i++) { for (i = 0; i < master->num_chipselect; i++) {
ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i], ret = devm_gpio_request(&pdev->dev,
master->cs_gpios[i],
dev_name(&pdev->dev)); dev_name(&pdev->dev));
if (ret) { if (ret) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
...@@ -639,6 +648,7 @@ static int mtk_spi_probe(struct platform_device *pdev) ...@@ -639,6 +648,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
} }
} }
} }
}
return 0; return 0;
......
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