All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: do not set up hardware for IRQ_TYPE_NONE
@ 2014-04-23 14:50 Linus Walleij
  2014-04-23 15:08 ` Javier Martinez Canillas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Linus Walleij @ 2014-04-23 14:50 UTC (permalink / raw)
  To: linux-gpio
  Cc: Alexandre Courbot, Linus Walleij, Nishanth Menon, Peter Ujfalusi,
	Ezequiel Garcia, Javier Martinez Canillas, Tony Lindgren,
	Santosh Shilimkar, linux-omap

Some GPIO irqchip drivers exploit the irqdomain mapping
function to set up the IRQ default type in the hardware,
make sure that if we pass IRQ_TYPE_NONE, no hardware setup
whatsoever takes place (this should be the norm) until
later when the IRQ gets utilized.

Cc: Nishanth Menon <nm@ti.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: Javier Martinez Canillas <javier@dowhile0.org>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
TI folks: can you provide a Tested-by tag if this makes your
OMAPs work? I am pretty sure the other platforms will be
unaffected, if they aren't I will switch them over to react
to IRQ_TYPE_DEFAULT.
---
 drivers/gpio/gpiolib.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index ee1819fdcf35..97d173e9aa2d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1409,7 +1409,12 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
 #else
 	irq_set_noprobe(irq);
 #endif
-	irq_set_irq_type(irq, chip->irq_default_type);
+	/*
+	 * No set-up of the hardware will happen if IRQ_TYPE_NONE
+	 * is passed as default type.
+	 */
+	if (chip->irq_default_type != IRQ_TYPE_NONE)
+		irq_set_irq_type(irq, chip->irq_default_type);
 
 	return 0;
 }
@@ -1490,7 +1495,8 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
  * @first_irq: if not dynamically assigned, the base (first) IRQ to
  * allocate gpiochip irqs from
  * @handler: the irq handler to use (often a predefined irq core function)
- * @type: the default type for IRQs on this irqchip
+ * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE
+ * to have the core avoid setting up any default type in the hardware.
  *
  * This function closely associates a certain irqchip with a certain
  * gpiochip, providing an irq domain to translate the local IRQs to
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: do not set up hardware for IRQ_TYPE_NONE
  2014-04-23 14:50 [PATCH] gpio: do not set up hardware for IRQ_TYPE_NONE Linus Walleij
@ 2014-04-23 15:08 ` Javier Martinez Canillas
  2014-04-23 15:11 ` Nishanth Menon
  2014-04-24  7:06 ` Peter Ujfalusi
  2 siblings, 0 replies; 4+ messages in thread
From: Javier Martinez Canillas @ 2014-04-23 15:08 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Linux GPIO List, Alexandre Courbot, Nishanth Menon,
	Peter Ujfalusi, Ezequiel Garcia, Tony Lindgren,
	Santosh Shilimkar, linux-omap

Hello Linus,

On Wed, Apr 23, 2014 at 4:50 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> Some GPIO irqchip drivers exploit the irqdomain mapping
> function to set up the IRQ default type in the hardware,
> make sure that if we pass IRQ_TYPE_NONE, no hardware setup
> whatsoever takes place (this should be the norm) until
> later when the IRQ gets utilized.
>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: linux-omap <linux-omap@vger.kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> TI folks: can you provide a Tested-by tag if this makes your
> OMAPs work? I am pretty sure the other platforms will be
> unaffected, if they aren't I will switch them over to react
> to IRQ_TYPE_DEFAULT.
> ---
>  drivers/gpio/gpiolib.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index ee1819fdcf35..97d173e9aa2d 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1409,7 +1409,12 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
>  #else
>         irq_set_noprobe(irq);
>  #endif
> -       irq_set_irq_type(irq, chip->irq_default_type);
> +       /*
> +        * No set-up of the hardware will happen if IRQ_TYPE_NONE
> +        * is passed as default type.
> +        */
> +       if (chip->irq_default_type != IRQ_TYPE_NONE)
> +               irq_set_irq_type(irq, chip->irq_default_type);
>
>         return 0;
>  }
> @@ -1490,7 +1495,8 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
>   * @first_irq: if not dynamically assigned, the base (first) IRQ to
>   * allocate gpiochip irqs from
>   * @handler: the irq handler to use (often a predefined irq core function)
> - * @type: the default type for IRQs on this irqchip
> + * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE
> + * to have the core avoid setting up any default type in the hardware.
>   *
>   * This function closely associates a certain irqchip with a certain
>   * gpiochip, providing an irq domain to translate the local IRQs to
> --
> 1.9.0
>

I just tested on my DM3730 IGEPv2 board and GPIO are working correctly
(GPIO LED and GPIO IRQ used by the ethernet controller)

Thanks a lot for your help!

Tested-by: Javier Martinez Canillas <javier@dowhile0.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: do not set up hardware for IRQ_TYPE_NONE
  2014-04-23 14:50 [PATCH] gpio: do not set up hardware for IRQ_TYPE_NONE Linus Walleij
  2014-04-23 15:08 ` Javier Martinez Canillas
@ 2014-04-23 15:11 ` Nishanth Menon
  2014-04-24  7:06 ` Peter Ujfalusi
  2 siblings, 0 replies; 4+ messages in thread
From: Nishanth Menon @ 2014-04-23 15:11 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio
  Cc: Alexandre Courbot, Peter Ujfalusi, Ezequiel Garcia,
	Javier Martinez Canillas, Tony Lindgren, Santosh Shilimkar,
	linux-omap

On 04/23/2014 09:50 AM, Linus Walleij wrote:
> Some GPIO irqchip drivers exploit the irqdomain mapping
> function to set up the IRQ default type in the hardware,
> make sure that if we pass IRQ_TYPE_NONE, no hardware setup
> whatsoever takes place (this should be the norm) until
> later when the IRQ gets utilized.
> 
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: linux-omap <linux-omap@vger.kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> TI folks: can you provide a Tested-by tag if this makes your
> OMAPs work? I am pretty sure the other platforms will be
> unaffected, if they aren't I will switch them over to react
> to IRQ_TYPE_DEFAULT.

Tested-by: Nishanth Menon <nm@ti.com>

AM335x-sk (which fails to boot previously), now with this patch:
	http://slexy.org/raw/s20dMOz3ke
Discussion thread: http://marc.info/?t=139817273800014&r=1&w=2

> ---
>  drivers/gpio/gpiolib.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index ee1819fdcf35..97d173e9aa2d 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1409,7 +1409,12 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
>  #else
>  	irq_set_noprobe(irq);
>  #endif
> -	irq_set_irq_type(irq, chip->irq_default_type);
> +	/*
> +	 * No set-up of the hardware will happen if IRQ_TYPE_NONE
> +	 * is passed as default type.
> +	 */
> +	if (chip->irq_default_type != IRQ_TYPE_NONE)
> +		irq_set_irq_type(irq, chip->irq_default_type);
>  
>  	return 0;
>  }
> @@ -1490,7 +1495,8 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
>   * @first_irq: if not dynamically assigned, the base (first) IRQ to
>   * allocate gpiochip irqs from
>   * @handler: the irq handler to use (often a predefined irq core function)
> - * @type: the default type for IRQs on this irqchip
> + * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE
> + * to have the core avoid setting up any default type in the hardware.
>   *
>   * This function closely associates a certain irqchip with a certain
>   * gpiochip, providing an irq domain to translate the local IRQs to
> 

Acked-by: Nishanth Menon <nm@ti.com>

-- 
Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: do not set up hardware for IRQ_TYPE_NONE
  2014-04-23 14:50 [PATCH] gpio: do not set up hardware for IRQ_TYPE_NONE Linus Walleij
  2014-04-23 15:08 ` Javier Martinez Canillas
  2014-04-23 15:11 ` Nishanth Menon
@ 2014-04-24  7:06 ` Peter Ujfalusi
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Ujfalusi @ 2014-04-24  7:06 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio
  Cc: Alexandre Courbot, Nishanth Menon, Ezequiel Garcia,
	Javier Martinez Canillas, Tony Lindgren, Santosh Shilimkar,
	linux-omap

On 04/23/2014 05:50 PM, Linus Walleij wrote:
> Some GPIO irqchip drivers exploit the irqdomain mapping
> function to set up the IRQ default type in the hardware,
> make sure that if we pass IRQ_TYPE_NONE, no hardware setup
> whatsoever takes place (this should be the norm) until
> later when the IRQ gets utilized.
> 
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: linux-omap <linux-omap@vger.kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> TI folks: can you provide a Tested-by tag if this makes your
> OMAPs work? I am pretty sure the other platforms will be
> unaffected, if they aren't I will switch them over to react
> to IRQ_TYPE_DEFAULT.
> ---
>  drivers/gpio/gpiolib.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Thanks:

Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index ee1819fdcf35..97d173e9aa2d 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1409,7 +1409,12 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
>  #else
>  	irq_set_noprobe(irq);
>  #endif
> -	irq_set_irq_type(irq, chip->irq_default_type);
> +	/*
> +	 * No set-up of the hardware will happen if IRQ_TYPE_NONE
> +	 * is passed as default type.
> +	 */
> +	if (chip->irq_default_type != IRQ_TYPE_NONE)
> +		irq_set_irq_type(irq, chip->irq_default_type);
>  
>  	return 0;
>  }
> @@ -1490,7 +1495,8 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
>   * @first_irq: if not dynamically assigned, the base (first) IRQ to
>   * allocate gpiochip irqs from
>   * @handler: the irq handler to use (often a predefined irq core function)
> - * @type: the default type for IRQs on this irqchip
> + * @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE
> + * to have the core avoid setting up any default type in the hardware.
>   *
>   * This function closely associates a certain irqchip with a certain
>   * gpiochip, providing an irq domain to translate the local IRQs to
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-24  7:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-23 14:50 [PATCH] gpio: do not set up hardware for IRQ_TYPE_NONE Linus Walleij
2014-04-23 15:08 ` Javier Martinez Canillas
2014-04-23 15:11 ` Nishanth Menon
2014-04-24  7:06 ` Peter Ujfalusi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.