Skip to contentSkip to conversation

fpga-manager: altera-ps-spi: preserve nCONFIG state

PATCH In review Anatolij Gustschin 3 participants 3 messages Feb 1, 2018 – Feb 14, 2018 FPGA manager framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fpga-manager: altera-ps-spi: preserve nCONFIG state

If the driver module is loaded when FPGA is configured, the FPGA is reset because nconfig is pulled low (low-active gpio inited with GPIOD_OUT_HIGH activates the signal which means setting its value to low). Init nconfig with GPIOD_OUT_LOW to prevent this.

---
 drivers/fpga/altera-ps-spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/altera-ps-spi.c +1 -1
index c593f33d8db9..6891933d072d 100644
@@ -258,7 +258,7 @@ static int altera_ps_probe(struct spi_device *spi)
 	}
 
 	conf->spi = spi;
-	conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_HIGH);
+	conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_LOW);
 	if (IS_ERR(conf->config)) {
 		dev_err(&spi->dev, "Failed to get config gpio: %ld\n",
 			PTR_ERR(conf->config));
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw

On Thu, Feb 1, 2018 at 4:20 PM, Anatolij Gustschin <[email protected]> wrote:

Hi Anatolij,

Quoted 4 lines

If the driver module is loaded when FPGA is configured, the FPGA is reset because nconfig is pulled low (low-active gpio inited with GPIOD_OUT_HIGH activates the signal which means setting its value to low). Init nconfig with GPIOD_OUT_LOW to prevent this.

Yes, makes sense.

Quoted 2 lines

Thanks,
Alan

Quoted 24 lines
---
 drivers/fpga/altera-ps-spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/altera-ps-spi.c +1 -2
index c593f33d8db9..6891933d072d 100644
@@ -258,7 +258,7 @@ static int altera_ps_probe(struct spi_device *spi)
        }
 
        conf->spi = spi;
-       conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_HIGH);
+       conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_LOW);
        if (IS_ERR(conf->config)) {
                dev_err(&spi->dev, "Failed to get config gpio: %ld\n",
                        PTR_ERR(conf->config));
--

2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-fpga" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Anatolij Gustschin

Hi Anatolij,

Quoted 6 lines · Anatolij Gustschin

If the driver module is loaded when FPGA is configured, the FPGA is reset because nconfig is pulled low (low-active gpio inited with GPIOD_OUT_HIGH activates the signal which means setting its value to low). Init nconfig with GPIOD_OUT_LOW to prevent this.

Quoted 20 lines
---
 drivers/fpga/altera-ps-spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/altera-ps-spi.c +1 -1
index c593f33d8db9..6891933d072d 100644
@@ -258,7 +258,7 @@ static int altera_ps_probe(struct spi_device *spi)
 	}
 
 	conf->spi = spi;
-	conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_HIGH);
+	conf->config = devm_gpiod_get(&spi->dev, "nconfig", GPIOD_OUT_LOW);
 	if (IS_ERR(conf->config)) {
 		dev_err(&spi->dev, "Failed to get config gpio: %ld\n",
 			PTR_ERR(conf->config));
Signature · 1 line
2.11.0

Thanks for your patch,

Moritz