Re: [RFC PATCH v2 25/30] include/dt-bindings: Add sh_intc IRQ - EVT conversion helper
Geert Uytterhoeven <[email protected]>
| Newsgroups | gmane.linux.ports.sh.devel |
|---|---|
| Message-ID | <CAMuHMdWeh2DjSR9-WdDUKJhG_KwDhjUk_e-H3D_gSzVZ16ys9g@mail.gmail.com> |
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. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds