Re: [RFC PATCH v2 25/30] include/dt-bindings: Add sh_intc IRQ - EVT conversion helper
Krzysztof Kozlowski <[email protected]>
| Newsgroups | gmane.linux.ports.sh.devel |
|---|---|
| Message-ID | <[email protected]> |
On 19/09/2023 15:02, Geert Uytterhoeven wrote: > Hi Krzysztof, > > On Wed, Sep 13, 2023 at 12:50 PM Krzysztof Kozlowski <[email protected]> wrote: >> On 13/09/2023 11:23, Yoshinori Sato wrote: >>> --- /dev/null >>> +++ b/include/dt-bindings/interrupt-controller/sh_intc.h >>> @@ -0,0 +1,7 @@ >>> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >>> + * >>> + * SH3/4 INTC EVT - IRQ conversion >>> + */ >>> + >>> +#define evt2irq(evt) ((evt) >> 5) >>> +#define irq2evt(irq) ((irq) << 5) >> >> No, that's not a binding. Drop entire file. > > The issue is that the hardware documentation does not list interrupt > numbers, but event codes. The latter is a sparse address space. > As the "interrupts" property needs interrupt numbers, we have two > options: > 1. Use hardcoded event codes and evt2irq() in DTS files. > This is the approach Sato-san took, > 2. Use hardcoded interrupt numbers in DTS files. > This would avoids the need for the evt2irq() macro in the DT bindings, > but would make life slightly harder for the DTS writer and > for the casual reader, as the conversion needs to be done in > one's head. > > Note that the documentation for later SoCs that contain both a SuperH > and an ARM CPU core, usually lists both the event code and the interrupt > number, although the latter may be offset by 32 due to the SPI > interrupt base. > > I agree we do not need irq2evt() in DTS, though. Is the macro used by the drivers? I have a feeling that not, so it would not be suitable for the bindings, but rather as a header included in the DTS. Best regards, Krzysztof