devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Kocialkowski <contact@paulk.fr>
To: Samuel Holland <samuel@sholland.org>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	Icenowy Zheng <icenowy@aosc.io>,
	Matteo Scordino <matteo.scordino@gmail.com>
Subject: Re: [PATCH v2 2/6] irqchip/sunxi-nmi: Add support for the V3s NMI
Date: Thu, 5 Nov 2020 12:24:18 +0100	[thread overview]
Message-ID: <20201105112418.GA1237@collins> (raw)
In-Reply-To: <85d40081-2dd1-3a0c-15ad-a58ce866700f@sholland.org>

[-- Attachment #1: Type: text/plain, Size: 3301 bytes --]

Hi Samuel,

On Wed 04 Nov 20, 22:14, Samuel Holland wrote:
> On 11/3/20 2:50 PM, Paul Kocialkowski wrote:
> > The V3s/V3 has a NMI IRQ controller, which is mainly used for the AXP209
> > interrupt. In great wisdom, Allwinner decided to invert the enable and
> > pending register offsets, compared to the A20.
> > 
> > As a result, a specific compatible and register description is required
> > for the V3s. This was tested with an AXP209 on a V3 board.
> > 
> > Acked-by: Maxime Ripard <mripard@kernel.org>
> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> >  drivers/irqchip/irq-sunxi-nmi.c | 18 +++++++++++++++++-
> >  1 file changed, 17 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/irqchip/irq-sunxi-nmi.c b/drivers/irqchip/irq-sunxi-nmi.c
> > index a412b5d5d0fa..59e0e4612ef7 100644
> > --- a/drivers/irqchip/irq-sunxi-nmi.c
> > +++ b/drivers/irqchip/irq-sunxi-nmi.c
> > @@ -44,6 +44,10 @@
> >  #define SUN7I_NMI_PENDING	0x04
> >  #define SUN7I_NMI_ENABLE	0x08
> >  
> > +#define SUN8I_V3S_NMI_CTRL	0x00
> > +#define SUN8I_V3S_NMI_ENABLE	0x04
> > +#define SUN8I_V3S_NMI_PENDING	0x08
> > +
> >  #define SUN9I_NMI_CTRL		0x00
> >  #define SUN9I_NMI_ENABLE	0x04
> >  #define SUN9I_NMI_PENDING	0x08
> 
> These two sets of definitions are the same. So it would make sense for
> V3S and sun9i to share a configuration, instead of creating a copy.

Oh but that's true! I initially though it was the same as sun7i, found that it
wasn't but didn't notice about sun9i.

So I think we can just use the sun9i compatible after all.

Thanks!

Paul

> > @@ -79,6 +83,12 @@ static const struct sunxi_sc_nmi_reg_offs sun7i_reg_offs __initconst = {
> >  	.enable	= SUN7I_NMI_ENABLE,
> >  };
> >  
> > +static const struct sunxi_sc_nmi_reg_offs sun8i_v3s_reg_offs __initconst = {
> > +	.ctrl	= SUN8I_V3S_NMI_CTRL,
> > +	.pend	= SUN8I_V3S_NMI_PENDING,
> > +	.enable	= SUN8I_V3S_NMI_ENABLE,
> > +};
> > +
> >  static const struct sunxi_sc_nmi_reg_offs sun9i_reg_offs __initconst = {
> >  	.ctrl	= SUN9I_NMI_CTRL,
> >  	.pend	= SUN9I_NMI_PENDING,
> > @@ -165,7 +175,6 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
> >  	unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
> >  	int ret;
> >  
> > -
> >  	domain = irq_domain_add_linear(node, 1, &irq_generic_chip_ops, NULL);
> >  	if (!domain) {
> >  		pr_err("Could not register interrupt domain.\n");
> > @@ -254,6 +263,13 @@ static int __init sun7i_sc_nmi_irq_init(struct device_node *node,
> >  }
> >  IRQCHIP_DECLARE(sun7i_sc_nmi, "allwinner,sun7i-a20-sc-nmi", sun7i_sc_nmi_irq_init);
> >  
> > +static int __init sun8i_v3s_sc_nmi_irq_init(struct device_node *node,
> > +					    struct device_node *parent)
> > +{
> > +	return sunxi_sc_nmi_irq_init(node, &sun8i_v3s_reg_offs);
> > +}
> > +IRQCHIP_DECLARE(sun8i_v3s_sc_nmi, "allwinner,sun8i-v3s-sc-nmi", sun8i_v3s_sc_nmi_irq_init);
> > +
> >  static int __init sun9i_nmi_irq_init(struct device_node *node,
> >  				     struct device_node *parent)
> >  {
> > 
> 

-- 
Developer of free digital technology and hardware support.

Website: https://www.paulk.fr/
Coding blog: https://code.paulk.fr/
Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-11-05 11:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 20:50 [PATCH v2 0/6] Allwinner V3 SL631 Action Camera Support and Related Fixes Paul Kocialkowski
2020-11-03 20:50 ` [PATCH v2 1/6] dt-bindings: irq: sun7i-nmi: Add binding documentation for the V3s NMI Paul Kocialkowski
2020-11-09 16:16   ` Rob Herring
2020-11-03 20:50 ` [PATCH v2 2/6] irqchip/sunxi-nmi: Add support " Paul Kocialkowski
2020-11-05  4:14   ` Samuel Holland
2020-11-05 11:24     ` Paul Kocialkowski [this message]
2020-11-03 20:50 ` [PATCH v2 3/6] ARM: dts: sun8i-v3s: Add the V3s NMI IRQ controller Paul Kocialkowski
2020-11-03 20:50 ` [PATCH v2 4/6] ARM: dts: sun8i: Cleanup the Pinecube AXP209 node Paul Kocialkowski
2020-11-03 20:50 ` [PATCH v2 5/6] dt-bindings: arm: sunxi: Add SL631 with IMX179 bindings Paul Kocialkowski
2020-11-09 16:17   ` Rob Herring
2020-11-03 20:50 ` [PATCH v2 6/6] ARM: dts: sun8i-v3: Add support for the SL631 Action Camera with IMX179 Paul Kocialkowski

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=20201105112418.GA1237@collins \
    --to=contact@paulk.fr \
    --cc=devicetree@vger.kernel.org \
    --cc=icenowy@aosc.io \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matteo.scordino@gmail.com \
    --cc=mripard@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=samuel@sholland.org \
    --cc=wens@csie.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 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).