diff mbox

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

Message ID 20180201222004.15949-1-agust@denx.de (mailing list archive)
State Accepted
Headers show

Commit Message

Anatolij Gustschin Feb. 1, 2018, 10:20 p.m. UTC
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.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/fpga/altera-ps-spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alan Tull Feb. 12, 2018, 4:02 p.m. UTC | #1
On Thu, Feb 1, 2018 at 4:20 PM, Anatolij Gustschin <agust@denx.de> wrote:

Hi Anatolij,

> 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.

>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Alan Tull <atull@kernel.org>

Thanks,
Alan

> ---
>  drivers/fpga/altera-ps-spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c
> index c593f33d8db9..6891933d072d 100644
> --- a/drivers/fpga/altera-ps-spi.c
> +++ b/drivers/fpga/altera-ps-spi.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-fpga" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Moritz Fischer Feb. 14, 2018, 11:05 p.m. UTC | #2
Hi Anatolij,

On Thu, Feb 01, 2018 at 11:20:04PM +0100, Anatolij Gustschin wrote:
> 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.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Moritz Fischer <mdf@kernel.org>
> ---
>  drivers/fpga/altera-ps-spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c
> index c593f33d8db9..6891933d072d 100644
> --- a/drivers/fpga/altera-ps-spi.c
> +++ b/drivers/fpga/altera-ps-spi.c
> @@ -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
> 

Thanks for your patch,

Moritz
diff mbox

Patch

diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c
index c593f33d8db9..6891933d072d 100644
--- a/drivers/fpga/altera-ps-spi.c
+++ b/drivers/fpga/altera-ps-spi.c
@@ -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));