[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5dd652c7-f215-0c1f-84c5-fd1e1913b86e@loongson.cn>
Date: Tue, 20 Dec 2022 11:27:00 +0800
From: Yinbo Zhu <zhuyinbo@...ngson.cn>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Bartosz Golaszewski <brgl@...ev.pl>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
WANG Xuerui <kernel@...0n.name>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Juxin Gao <gaojuxin@...ngson.cn>,
Bibo Mao <maobibo@...ngson.cn>,
Yanteng Si <siyanteng@...ngson.cn>, linux-gpio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
loongarch@...ts.linux.dev, linux-mips@...r.kernel.org,
Arnaud Patard <apatard@...driva.com>,
Huacai Chen <chenhuacai@...nel.org>,
Jianmin Lv <lvjianmin@...ngson.cn>,
Hongchen Zhang <zhanghongchen@...ngson.cn>,
Liu Peibao <liupeibao@...ngson.cn>, zhuyinbo@...ngson.cn
Subject: Re: [PATCH v5 2/3] gpio: loongson: add gpio driver support
在 2022/12/13 下午5:36, Linus Walleij 写道:
> On Mon, Dec 12, 2022 at 9:13 AM Yinbo Zhu <zhuyinbo@...ngson.cn> wrote:
>
>> mask_irq/unmask_irq/irq_ack/ function always be called by
>> handle_level_irq/handle_edge_irq in current irq domain. and the
>> handle_level_irq/handle_edge_irq will be called by handle_irq_desc that
>> ask know which irq is.
>>
>> when a peripheral need to use a gpio irq that gpio irq driver need know
>> irq status and call irq desc->irq_handler.
>>
>> so I don't got it about which case it is unnecessary to know which irq.
>
> Sorry I don't understand what you are asking, can you elaborate?
>
> Do you mean that you don't know which driver will not call ->to_irq()
> on the gpiochip? That would be any driver that takes an IRQ directly in
> the device tree:
>
> gpio: gpio {
> interrupt-controller;
> #interrupt-cells = <2>;
> ....
> };
>
> device {
> interrupts = <&gpio 14 IRQ_TYPE_LEVEL_HIGH>;
> ....
> };
>
> This case will only call the irqchip callbacks and will never call
> the .to_irq() on the gpio_chip.
I mean that if the current domain is a valid doamin, every interrupt
must have an interrupt status.
If there is no interrupt status, no one can cover the interrupt,
and no one will call 14 irq's desc->handle_irq (handle_level_irq)
and Loongson-2 gpio doesn't have irq status register, so Loongson-2
gpio irqchip shouldn't be implemented.
>
>>> You find an example of a hierarchical GPIO irqchip using the
>>> GPIOLIB_IRQCHIP in drivers/gpio/gpio-ixp4xx.c.
>>
>> Loongson-2 gpio irq hardware only a enable register, and when a gpio irq
>> happen, then will has a such flow: "cpuintc -> liointc -> gpioinc ->
>> generic_handle_domain_irq -> handle_level_irq ->
>> peripheral-action(action->handler)"
>>
>> generic_handle_domain_irq need rely on specific hwirq that ask gpio irq
>> hardware has a status register but Loongson-2 gpio irq hardware doesn't
>> have it.
>>
>> so I still think it wasn't appropriate that for loongson-2 gpio driver
>> add a irq chip.
>
> generic_handle_domain_irq() is of no concern, what matters is if
> your interrupt is hierarchical or not, the callback in the GPIO chip
> can be a simple remapping of the numberspace followed by
> a call to the parent callbacks.
>
> Yours,
> Linus Walleij
Hi
I think gpio irq domain should be a normal irq domain that like other
irq domain. that need a function A to call virq desc handler in gpio irq
domain. if no use generic_handler_domain_irq or similar interface,
that will no one to call irq_desc->irq_handler.
"cpuintc -> liointc -> gpioinc -> generic_handle_domain_irq ->
handle_level_irq -> peripheral-action(action->handler)"
>
Powered by blists - more mailing lists