linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinbo Zhu <zhuyinbo@loongson.cn>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	WANG Xuerui <kernel@xen0n.name>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Juxin Gao <gaojuxin@loongson.cn>, Bibo Mao <maobibo@loongson.cn>,
	Yanteng Si <siyanteng@loongson.cn>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, loongarch@lists.linux.dev,
	linux-mips@vger.kernel.org, Arnaud Patard <apatard@mandriva.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	Jianmin Lv <lvjianmin@loongson.cn>,
	Hongchen Zhang <zhanghongchen@loongson.cn>,
	Liu Peibao <liupeibao@loongson.cn>,
	zhuyinbo@loongson.cn
Subject: Re: [PATCH v5 2/3] gpio: loongson: add gpio driver support
Date: Tue, 20 Dec 2022 11:27:00 +0800	[thread overview]
Message-ID: <5dd652c7-f215-0c1f-84c5-fd1e1913b86e@loongson.cn> (raw)
In-Reply-To: <CACRpkda0VerZhVGMJJjMYyAWdobvSLj4=eWxBjh+5ubmxvFcjQ@mail.gmail.com>



在 2022/12/13 下午5:36, Linus Walleij 写道:
> On Mon, Dec 12, 2022 at 9:13 AM Yinbo Zhu <zhuyinbo@loongson.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)"
> 


  reply	other threads:[~2022-12-20  3:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 12:38 [PATCH v5 1/3] gpio: loongson2ef: move driver to original location Yinbo Zhu
2022-11-21 12:38 ` [PATCH v5 2/3] gpio: loongson: add gpio driver support Yinbo Zhu
2022-11-21 13:24   ` Linus Walleij
2022-11-23  8:02     ` Yinbo Zhu
2022-11-23 22:05       ` Linus Walleij
2022-11-24  2:22         ` Yinbo Zhu
2022-11-24  8:54           ` Linus Walleij
2022-12-12  8:12             ` Yinbo Zhu
2022-12-13  9:36               ` Linus Walleij
2022-12-20  3:27                 ` Yinbo Zhu [this message]
2022-12-12  8:34         ` Yinbo Zhu
2022-12-13  9:45           ` Linus Walleij
2022-11-21 12:38 ` [PATCH v5 3/3] dt-bindings: gpio: add loongson gpio Yinbo Zhu
2022-11-21 13:30 ` [PATCH v5 1/3] gpio: loongson2ef: move driver to original location Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5dd652c7-f215-0c1f-84c5-fd1e1913b86e@loongson.cn \
    --to=zhuyinbo@loongson.cn \
    --cc=apatard@mandriva.com \
    --cc=brgl@bgdev.pl \
    --cc=chenhuacai@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gaojuxin@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kernel@xen0n.name \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=liupeibao@loongson.cn \
    --cc=loongarch@lists.linux.dev \
    --cc=lvjianmin@loongson.cn \
    --cc=maobibo@loongson.cn \
    --cc=robh+dt@kernel.org \
    --cc=siyanteng@loongson.cn \
    --cc=tsbogend@alpha.franken.de \
    --cc=zhanghongchen@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).