}
/*-------------------------------------------------------------------------*/
- if (cs_gpio == -EPROBE_DEFER)
- return cs_gpio;
++ +static int atmel_spi_gpio_cs(struct platform_device *pdev)
++ +{
++ + struct spi_master *master = platform_get_drvdata(pdev);
++ + struct atmel_spi *as = spi_master_get_devdata(master);
++ + struct device_node *np = master->dev.of_node;
++ + int i;
++ + int ret = 0;
++ + int nb = 0;
++ +
++ + if (!as->use_cs_gpios)
++ + return 0;
++ +
++ + if (!np)
++ + return 0;
++ +
++ + nb = of_gpio_named_count(np, "cs-gpios");
++ + for (i = 0; i < nb; i++) {
++ + int cs_gpio = of_get_named_gpio(pdev->dev.of_node,
++ + "cs-gpios", i);
++ +
- if (gpio_is_valid(cs_gpio)) {
- ret = devm_gpio_request(&pdev->dev, cs_gpio,
- dev_name(&pdev->dev));
- if (ret)
- return ret;
- }
+++ + if (cs_gpio == -EPROBE_DEFER)
+++ + return cs_gpio;
++ +
+++ + if (gpio_is_valid(cs_gpio)) {
+++ + ret = devm_gpio_request(&pdev->dev, cs_gpio,
+++ + dev_name(&pdev->dev));
+++ + if (ret)
+++ + return ret;
+++ + }
++ + }
++ +
++ + return 0;
++ +}
static int atmel_spi_probe(struct platform_device *pdev)
{