All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-sh@vger.kernel.org, glaubitz@physik.fu-berlin.de
Subject: Re: [RFC PATCH v2 14/30] drivers/irqchip: Add SH7751 Internal INTC drivers.
Date: Sun, 01 Oct 2023 00:14:55 +0900	[thread overview]
Message-ID: <87h6nbu1zk.wl-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <CAMuHMdVaaVxM77OcNVC3pkJ2Qs02OGA83kXEO9ExJcjsK261fw@mail.gmail.com>

On Mon, 25 Sep 2023 16:38:37 +0900,
Geert Uytterhoeven wrote:
> 
> Hi Sato-san,
> 
> On Fri, Sep 22, 2023 at 12:12 PM Yoshinori Sato
> <ysato@users.sourceforge.jp> wrote:
> > On Tue, 19 Sep 2023 20:50:14 +0900,
> > Geert Uytterhoeven wrote:
> > > On Wed, Sep 13, 2023 at 11:24 AM Yoshinori Sato
> > > <ysato@users.sourceforge.jp> wrote:
> > > > Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
> > >
> > > Thanks for your patch!
> > >
> > > > --- a/drivers/irqchip/Kconfig
> > > > +++ b/drivers/irqchip/Kconfig
> > > > @@ -679,4 +679,13 @@ config SUNPLUS_SP7021_INTC
> > > >           chained controller, routing all interrupt source in P-Chip to
> > > >           the primary controller on C-Chip.
> > > >
> > > > +config RENESAS_SH7751_INTC
> > > > +        bool "Renesas SH7751 Interrupt Controller"
> > > > +       depends on SH_DEVICE_TREE
> > >
> > > "|| COMPILE_TEST"?
> > >
> > > > +       select IRQ_DOMAIN
> > > > +       select IRQ_DOMAIN_HIERARCHY
> > > > +       help
> > > > +         Support for the Renesas SH7751 On-chip interrupt controller.
> > > > +         And external interrupt encoder for some targets.
> > >
> > > Inconsistent indentation
> > >
> > > > --- /dev/null
> > > > +++ b/drivers/irqchip/irq-renesas-sh7751.c
> > >
> > > > +/* INTEVT to IPR mapping */
> > > > +static const struct iprmap {
> > > > +       int intevt;
> > >
> > > irq, as you're storing the irq number not the event number?
> > >
> > > > +       int off;
> > > > +       int bit;
> > >
> > > All unsigned int ...
> > >
> > > > +} iprmaps[] = {
> > > > +#define IPRDEF(e, o, b) { .intevt = evt2irq(e), .off = o, .bit = b }
> > > > +       IPRDEF(0x240, IPRD, IPR_B12),   /* IRL0 */
> > > > +       IPRDEF(0x2a0, IPRD, IPR_B8),    /* IRL1 */
> > > > +       IPRDEF(0x300, IPRD, IPR_B4),    /* IRL2 */
> > > > +       IPRDEF(0x360, IPRD, IPR_B0),    /* IRL3 */
> > > > +       IPRDEF(0x400, IPRA, IPR_B12),   /* TMU0 */
> > > > +       IPRDEF(0x420, IPRA, IPR_B8),    /* TMU1 */
> > > > +       IPRDEF(0x440, IPRA, IPR_B4),    /* TMU2 TNUI */
> > > > +       IPRDEF(0x460, IPRA, IPR_B4),    /* TMU2 TICPI */
> > > > +       IPRDEF(0x480, IPRA, IPR_B0),    /* RTC ATI */
> > > > +       IPRDEF(0x4a0, IPRA, IPR_B0),    /* RTC PRI */
> > > > +       IPRDEF(0x4c0, IPRA, IPR_B0),    /* RTC CUI */
> > > > +       IPRDEF(0x4e0, IPRB, IPR_B4),    /* SCI ERI */
> > > > +       IPRDEF(0x500, IPRB, IPR_B4),    /* SCI RXI */
> > > > +       IPRDEF(0x520, IPRB, IPR_B4),    /* SCI TXI */
> > > > +       IPRDEF(0x540, IPRB, IPR_B4),    /* SCI TEI */
> > > > +       IPRDEF(0x560, IPRB, IPR_B12),   /* WDT */
> > > > +       IPRDEF(0x580, IPRB, IPR_B8),    /* REF RCMI */
> > > > +       IPRDEF(0x5a0, IPRB, IPR_B4),    /* REF ROVI */
> > > > +       IPRDEF(0x600, IPRC, IPR_B0),    /* H-UDI */
> > > > +       IPRDEF(0x620, IPRC, IPR_B12),   /* GPIO */
> > > > +       IPRDEF(0x640, IPRC, IPR_B8),    /* DMAC DMTE0 */
> > > > +       IPRDEF(0x660, IPRC, IPR_B8),    /* DMAC DMTE1 */
> > > > +       IPRDEF(0x680, IPRC, IPR_B8),    /* DMAC DMTE2 */
> > > > +       IPRDEF(0x6a0, IPRC, IPR_B8),    /* DMAC DMTE3 */
> > > > +       IPRDEF(0x6c0, IPRC, IPR_B8),    /* DMAC DMAE */
> > > > +       IPRDEF(0x700, IPRC, IPR_B4),    /* SCIF ERI */
> > > > +       IPRDEF(0x720, IPRC, IPR_B4),    /* SCIF RXI */
> > > > +       IPRDEF(0x740, IPRC, IPR_B4),    /* SCIF BRI */
> > > > +       IPRDEF(0x760, IPRC, IPR_B4),    /* SCIF TXI */
> > > > +       IPRDEF(0x780, IPRC, IPR_B8),    /* DMAC DMTE4 */
> > > > +       IPRDEF(0x7a0, IPRC, IPR_B8),    /* DMAC DMTE5 */
> > > > +       IPRDEF(0x7c0, IPRC, IPR_B8),    /* DMAC DMTE6 */
> > > > +       IPRDEF(0x7e0, IPRC, IPR_B8),    /* DMAC DMTE7 */
> > > > +       IPRDEF(0xa00, INTPRI00, IPR_B0),        /* PCIC PCISERR */
> > > > +       IPRDEF(0xa20, INTPRI00, IPR_B4),        /* PCIC PCIDMA3 */
> > > > +       IPRDEF(0xa40, INTPRI00, IPR_B4),        /* PCIC PCIDMA2 */
> > > > +       IPRDEF(0xa60, INTPRI00, IPR_B4),        /* PCIC PCIDMA1 */
> > > > +       IPRDEF(0xa80, INTPRI00, IPR_B4),        /* PCIC PCIDMA0 */
> > > > +       IPRDEF(0xaa0, INTPRI00, IPR_B4),        /* PCIC PCIPWON */
> > > > +       IPRDEF(0xac0, INTPRI00, IPR_B4),        /* PCIC PCIPWDWN */
> > > > +       IPRDEF(0xae0, INTPRI00, IPR_B4),        /* PCIC PCIERR */
> > > > +       IPRDEF(0xb00, INTPRI00, IPR_B8),        /* TMU3 */
> > > > +       IPRDEF(0xb80, INTPRI00, IPR_B12),       /* TMU4 */
> > >
> > > Probably the same or a very similar interrupt controller is present
> > > on other SoCs? Then the comments don't make much sense, as the actual
> > > interrupt mapping is specified in the DTS anyway.
> >
> > This interrupt controller design is quite old, so there doesn't seem to be
> > any SoC with a similar design.
> 
> OK.
> 
> > Since the SH interrupt controllers have almost the same design,
> > I think this driver can be used for other devices besides the SH7751.
> 
> Wait, this contradicts your sentence above?

I'm referring to other SH3/4 CPUs.
The only difference is the correspondence between registers and
interrupt sources, so it can be used universally not only for the
SH7751 but also for the other SH3 and 4.
I don't think it fits the philosophy of dt to embed information about
each CPU in the code and switch it with compatible.

> > I think a good way to write IPR mapping is to use dts.
> 
> If there is one thing we learned from putting full clock controller and PM
> Domain hierarchies in DT, it is that that turned out to be very fragile.
> It is hard not to make mistakes in the description, and easy to miss
> a critical aspect of the hardware that needs changes later.
> So that's why it's better to differentiate through the compatible value,
> instead of through (lots of) properties: you can always fix the driver,
> while DT is a stable ABI.

I tried defining it like this.
I think this format is easy to maintain.

renesas,ipr-map = IPRDEF(0x240, IPRD, IPR_B12),	/* IRL0 */
		  IPRDEF(0x2a0, IPRD, IPR_B8),	/* IRL1 */
		  IPRDEF(0x300, IPRD, IPR_B4),	/* IRL2 */
		  IPRDEF(0x360, IPRD, IPR_B0),	/* IRL3 

> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> 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

-- 
Yosinori Sato

  reply	other threads:[~2023-09-30 15:15 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13  9:23 [RFC PATCH v2 00/30] Device Tree support for SH7751 based board Yoshinori Sato
2023-09-13  9:23 ` [RFC PATCH v2 01/30] arch/sh: head_32.S passing FDT address to initialize function Yoshinori Sato
2023-09-18 15:16   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 02/30] arch/sh: boards/Kconfig unified OF supported targets Yoshinori Sato
2023-09-18 15:05   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 03/30] arch/sh: Disable SH specific drivers in OF enabled Yoshinori Sato
2023-09-18 15:14   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 04/30] include: sh_intc.h Add stub function "intc_finalize" Yoshinori Sato
2023-09-18 15:16   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 05/30] arch/sh: setup.c update DeviceTree support Yoshinori Sato
2023-09-13  9:23 ` [RFC PATCH v2 06/30] drivers/pci: SH7751 PCI Host bridge header Yoshinori Sato
2023-09-18 19:16   ` Bjorn Helgaas
2023-09-13  9:23 ` [RFC PATCH v2 07/30] drivers/pci: SH7751 PCI Host bridge controller driver Yoshinori Sato
2023-09-18 15:32   ` Geert Uytterhoeven
2023-09-20 12:15     ` Yoshinori Sato
2023-09-18 19:30   ` Bjorn Helgaas
2023-09-13  9:23 ` [RFC PATCH v2 08/30] drivers/pci: Add SH7751 Host bridge controller Yoshinori Sato
2023-09-18 15:34   ` Geert Uytterhoeven
2023-09-18 19:33   ` Bjorn Helgaas
2023-10-12  7:16   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 09/30] Documentation/devicetree: Add renesas,sh7751-pci binding document Yoshinori Sato
2023-09-13 10:42   ` Krzysztof Kozlowski
2023-09-18 15:41   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 10/30] drivers/clk: SH7750 / SH7751 CPG Driver Yoshinori Sato
2023-09-13 10:43   ` Krzysztof Kozlowski
2023-09-18 16:05   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 11/30] drivers/clk: SuperH generai clock divider helper Yoshinori Sato
2023-09-18 18:59   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 12/30] drivers/clk: Add SH7750 CPG drivers entry Yoshinori Sato
2023-09-18 19:05   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 13/30] Documentation/devicetree: Add renesas,sh7751-cpg binding document Yoshinori Sato
2023-09-13 10:44   ` Krzysztof Kozlowski
2023-09-18 19:21   ` Geert Uytterhoeven
2023-10-03  9:16   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 14/30] drivers/irqchip: Add SH7751 Internal INTC drivers Yoshinori Sato
2023-09-19 11:50   ` Geert Uytterhoeven
2023-09-22 10:12     ` Yoshinori Sato
2023-09-25  7:38       ` Geert Uytterhoeven
2023-09-30 15:14         ` Yoshinori Sato [this message]
2023-09-13  9:23 ` [RFC PATCH v2 15/30] Documentation/devicetree: Add renesas,sh7751-intc binding document Yoshinori Sato
2023-09-13 10:44   ` Krzysztof Kozlowski
2023-09-19 11:56   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 16/30] drivers/irqchip: SH7751 IRL external encoder with enable gate Yoshinori Sato
2023-09-19 12:10   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 17/30] Documentation/devicetree: Add renesas,sh7751-irl-ext binding document Yoshinori Sato
2023-09-13 10:45   ` Krzysztof Kozlowski
2023-09-19 12:08   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 18/30] drivers/clocksource: sh_tmu clocks property support Yoshinori Sato
2023-09-19 12:15   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 19/30] drivers/tty: sh-sci fix SH4 OF support Yoshinori Sato
2023-09-19 12:25   ` Geert Uytterhoeven
2023-10-02 12:56     ` Yoshinori Sato
2023-09-13  9:23 ` [RFC PATCH v2 20/30] drivers/mfd: sm501 add some properties Yoshinori Sato
2023-09-20 12:25   ` Lee Jones
2023-09-13  9:23 ` [RFC PATCH v2 21/30] Documentation/devicetree: sm501fb add properies Yoshinori Sato
2023-09-13 10:45   ` Krzysztof Kozlowski
2023-09-13  9:23 ` [RFC PATCH v2 22/30] arch/sh: Add dtbs target support Yoshinori Sato
2023-09-19 12:28   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 23/30] arch/sh: Add SH7751 SoC Internal periphreal devicetree Yoshinori Sato
2023-09-13 10:49   ` Krzysztof Kozlowski
2023-09-19 12:41   ` Geert Uytterhoeven
2023-09-19 13:11   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 24/30] include/dt-bindings: Add SH7750 CPG header Yoshinori Sato
2023-09-13 10:46   ` Krzysztof Kozlowski
2023-09-19 12:43     ` Geert Uytterhoeven
2023-09-20 11:52       ` Krzysztof Kozlowski
2023-09-19 12:46   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 25/30] include/dt-bindings: Add sh_intc IRQ - EVT conversion helper Yoshinori Sato
2023-09-13 10:47   ` Krzysztof Kozlowski
2023-09-19 13:02     ` Geert Uytterhoeven
2023-09-20 11:51       ` Krzysztof Kozlowski
2023-09-20 12:30         ` Geert Uytterhoeven
2023-09-19 13:05   ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 26/30] arch/sh: RTS7751R2D Plus DeviceTree Yoshinori Sato
2023-09-13 10:49   ` Krzysztof Kozlowski
2023-09-15 15:43   ` Geert Uytterhoeven
2023-09-19 13:25   ` Geert Uytterhoeven
2023-10-02 13:21     ` Yoshinori Sato
2023-10-02 13:51       ` Geert Uytterhoeven
2023-09-13  9:23 ` [RFC PATCH v2 27/30] arch/sh: LANDISK DeviceTree Yoshinori Sato
2023-09-13  9:23 ` [RFC PATCH v2 28/30] arch/sh: USL-5P DeviceTree Yoshinori Sato
2023-09-13  9:23 ` [RFC PATCH v2 29/30] arch/sh: RTS7751R2D Plus OF defconfig Yoshinori Sato
2023-09-13  9:23 ` [RFC PATCH v2 30/30] arch/sh: LANDISK " Yoshinori Sato

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=87h6nbu1zk.wl-ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=geert@linux-m68k.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-sh@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.