Re: [PATCH v5 2/3] gpio: loongson: add gpio driver support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux