* [PATCH] gpio: uniphier: set legitimate irq trigger type in .to_irq hook
@ 2018-06-14 5:27 Masahiro Yamada
2018-06-14 5:39 ` Masahiro Yamada
2018-06-14 14:20 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2018-06-14 5:27 UTC (permalink / raw)
To: linux-gpio, Linus Walleij
Cc: Masami Hiramatsu, Jassi Brar, Katsuhiro Suzuki, Masahiro Yamada,
linux-arm-kernel, linux-kernel
If a GPIO chip is a part of a hierarchy IRQ domain, there is no
way to specify the trigger type when gpio(d)_to_irq() allocates an
interrupt on-the-fly.
Currently, uniphier_gpio_to_irq() sets IRQ_TYPE_NONE, but it causes
an error in the .alloc() hook of the parent domain.
(drivers/irq/irq-uniphier-aidet.c)
Even if we change irq-uniphier-aidet.c to accept the NONE type,
GIC complains about it since commit 83a86fbb5b56 ("irqchip/gic:
Loudly complain about the use of IRQ_TYPE_NONE").
Instead, use IRQ_TYPE_LEVEL_HIGH as a temporary value when an irq
is allocated. irq_set_irq_type() will override it when the irq is
really requested.
Fixes: dbe776c2ca54 ("gpio: uniphier: add UniPhier GPIO controller driver")
Reported-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
---
drivers/gpio/gpio-uniphier.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c
index d3cf950..58faeb1 100644
--- a/drivers/gpio/gpio-uniphier.c
+++ b/drivers/gpio/gpio-uniphier.c
@@ -181,7 +181,11 @@ static int uniphier_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
fwspec.fwnode = of_node_to_fwnode(chip->parent->of_node);
fwspec.param_count = 2;
fwspec.param[0] = offset - UNIPHIER_GPIO_IRQ_OFFSET;
- fwspec.param[1] = IRQ_TYPE_NONE;
+ /*
+ * IRQ_TYPE_NONE is rejected by the parent irq domain. Set LEVEL_HIGH
+ * temporarily. Anyway, ->irq_set_type() will override it later.
+ */
+ fwspec.param[1] = IRQ_TYPE_LEVEL_HIGH;
return irq_create_fwspec_mapping(&fwspec);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: uniphier: set legitimate irq trigger type in .to_irq hook
2018-06-14 5:27 [PATCH] gpio: uniphier: set legitimate irq trigger type in .to_irq hook Masahiro Yamada
@ 2018-06-14 5:39 ` Masahiro Yamada
2018-06-14 14:20 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2018-06-14 5:39 UTC (permalink / raw)
To: linux-gpio, Linus Walleij
Cc: Masami Hiramatsu, Jassi Brar, Katsuhiro Suzuki, Masahiro Yamada,
linux-arm-kernel, Linux Kernel Mailing List, Marc Zyngier
2018-06-14 14:27 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> If a GPIO chip is a part of a hierarchy IRQ domain, there is no
> way to specify the trigger type when gpio(d)_to_irq() allocates an
> interrupt on-the-fly.
>
> Currently, uniphier_gpio_to_irq() sets IRQ_TYPE_NONE, but it causes
> an error in the .alloc() hook of the parent domain.
> (drivers/irq/irq-uniphier-aidet.c)
>
> Even if we change irq-uniphier-aidet.c to accept the NONE type,
> GIC complains about it since commit 83a86fbb5b56 ("irqchip/gic:
> Loudly complain about the use of IRQ_TYPE_NONE").
>
> Instead, use IRQ_TYPE_LEVEL_HIGH as a temporary value when an irq
> is allocated. irq_set_irq_type() will override it when the irq is
> really requested.
>
> Fixes: dbe776c2ca54 ("gpio: uniphier: add UniPhier GPIO controller driver")
> Reported-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
> ---
BTW, gpio-xgene-sb.c is also suspicious.
https://github.com/torvalds/linux/blob/v4.17/drivers/gpio/gpio-xgene-sb.c#L136
I do not have that hardware, but GIC will complain about NONE type
if gpio(d)_to_irq() is used.
Commit 83a86fbb5b56 ("irqchip/gic: Loudly complain about the use of
IRQ_TYPE_NONE")
only mentions DT cases.
It is unclear how to take care of GPIO-originated IRQs.
> drivers/gpio/gpio-uniphier.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c
> index d3cf950..58faeb1 100644
> --- a/drivers/gpio/gpio-uniphier.c
> +++ b/drivers/gpio/gpio-uniphier.c
> @@ -181,7 +181,11 @@ static int uniphier_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
> fwspec.fwnode = of_node_to_fwnode(chip->parent->of_node);
> fwspec.param_count = 2;
> fwspec.param[0] = offset - UNIPHIER_GPIO_IRQ_OFFSET;
> - fwspec.param[1] = IRQ_TYPE_NONE;
> + /*
> + * IRQ_TYPE_NONE is rejected by the parent irq domain. Set LEVEL_HIGH
> + * temporarily. Anyway, ->irq_set_type() will override it later.
> + */
> + fwspec.param[1] = IRQ_TYPE_LEVEL_HIGH;
>
> return irq_create_fwspec_mapping(&fwspec);
> }
> --
> 2.7.4
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: uniphier: set legitimate irq trigger type in .to_irq hook
2018-06-14 5:27 [PATCH] gpio: uniphier: set legitimate irq trigger type in .to_irq hook Masahiro Yamada
2018-06-14 5:39 ` Masahiro Yamada
@ 2018-06-14 14:20 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2018-06-14 14:20 UTC (permalink / raw)
To: Masahiro Yamada
Cc: open list:GPIO SUBSYSTEM, Masami Hiramatsu, Jassi Brar,
Katsuhiro Suzuki, Linux ARM, linux-kernel
On Thu, Jun 14, 2018 at 7:27 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> If a GPIO chip is a part of a hierarchy IRQ domain, there is no
> way to specify the trigger type when gpio(d)_to_irq() allocates an
> interrupt on-the-fly.
>
> Currently, uniphier_gpio_to_irq() sets IRQ_TYPE_NONE, but it causes
> an error in the .alloc() hook of the parent domain.
> (drivers/irq/irq-uniphier-aidet.c)
>
> Even if we change irq-uniphier-aidet.c to accept the NONE type,
> GIC complains about it since commit 83a86fbb5b56 ("irqchip/gic:
> Loudly complain about the use of IRQ_TYPE_NONE").
>
> Instead, use IRQ_TYPE_LEVEL_HIGH as a temporary value when an irq
> is allocated. irq_set_irq_type() will override it when the irq is
> really requested.
>
> Fixes: dbe776c2ca54 ("gpio: uniphier: add UniPhier GPIO controller driver")
> Reported-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Patch applied for fixes!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-14 14:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14 5:27 [PATCH] gpio: uniphier: set legitimate irq trigger type in .to_irq hook Masahiro Yamada
2018-06-14 5:39 ` Masahiro Yamada
2018-06-14 14:20 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).