Received: by 10.223.176.46 with SMTP id f43csp153117wra; Fri, 19 Jan 2018 15:20:02 -0800 (PST) X-Google-Smtp-Source: AH8x227At7CDI2sl4mZDFRAwh34zHADoBDwLeJslBnsXM4RKHIxKsT7TzaLww4aA3m0GOcimL7XY X-Received: by 2002:a17:902:bf4b:: with SMTP id u11-v6mr48779pls.427.1516404002442; Fri, 19 Jan 2018 15:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516404002; cv=none; d=google.com; s=arc-20160816; b=zowWMkn7kFrl/DrorOlh5EkkFK0qbhyw+cjdBWztivyXllDxvKKBDvQ4UFqzPC4LL7 2VyJHxDy7bq5gnCFatFpE6254Yo0QyVV9iQBhGK9G8m8zjiBjbFeoVG0RRNJiqTwyh3/ VIAQDq6O56DyX2QTupvIi0zpy++NX5X/d94q+VqvYfsvGhuRp0E2cnPqnlyGYpSicWqr s8NHjRIA1q5qd/TnHhqPQspJR5kklzkBgC/UXfdtp8QO6vtGp5yijNEX19fgODrCgb9r HRJssV3dfWMIy+l5si+l9NNqOD2IKAwvkZjS/Fjkvh+aMzlYi2v+ym8flSqAW0TgfMxB ViGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=NaYkGE3W2DvjkInDpLikojvMfCwiYLrYD0MeATv7its=; b=JYqCTwvrvMD3ZUg6EZ5nc+JiQW29YCAxkud0xTkLN0EWOflERCMCteBz4XFfsDe9Om lscx1R5IvvnTwWIA9aKU5I06ENFJNOQCR1IypXKS2A2JatB79oTprzlxY0Fla+nIrll+ USgDUADf3vpDmftVOQ9NgPxBlOSEgXu9UyjQSo/9w8unwZ4bjTq3UOIuT8xX54vIPuKW 6no+34LwCzY+ykd9QeIflQAGhaq2f6jnmt8CYQpIZXtUe7WW2NXH1xd4k477E7txOA3/ zuFoN6U3QkJvczRxtUSY0j1l/3kCqGDbr0v0kjq3+iQLck4ukB7MDasq3B41ORqY0Nn4 Yn3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m14si9091563pgs.302.2018.01.19.15.19.47; Fri, 19 Jan 2018 15:20:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932659AbeASXSj (ORCPT + 99 others); Fri, 19 Jan 2018 18:18:39 -0500 Received: from hermes.aosc.io ([199.195.250.187]:48350 "EHLO hermes.aosc.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932527AbeASXSY (ORCPT ); Fri, 19 Jan 2018 18:18:24 -0500 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id EBF0B56068; Fri, 19 Jan 2018 23:18:18 +0000 (UTC) From: Icenowy Zheng To: Maxime Ripard , Chen-Yu Tsai , Russell King , Daniel Lezcano , Marc Zyngier , Linus Walleij Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-sunxi@googlegroups.com, Icenowy Zheng Subject: [RFC PATCH 3/9] irqchip/sun4i: add support for suniv interrupt controller Date: Sat, 20 Jan 2018 07:17:29 +0800 Message-Id: <20180119231735.61504-4-icenowy@aosc.io> In-Reply-To: <20180119231735.61504-1-icenowy@aosc.io> References: <20180119231735.61504-1-icenowy@aosc.io> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new F-series SoCs (suniv) from Allwinner use an stripped version of the interrupt controller in A10/A13. Add support for it in irq-sun4i driver. Signed-off-by: Icenowy Zheng --- drivers/irqchip/irq-sun4i.c | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-sun4i.c b/drivers/irqchip/irq-sun4i.c index e3e5b9132b75..64ae41379802 100644 --- a/drivers/irqchip/irq-sun4i.c +++ b/drivers/irqchip/irq-sun4i.c @@ -23,13 +23,26 @@ #include +enum sun4i_irq_type { + sun4i_ic, + suniv_ic +}; + +static enum sun4i_irq_type sun4i_irq_type; +static int sun4i_irq_enable_reg_offset; +static int sun4i_irq_mask_reg_offset; + #define SUN4I_IRQ_VECTOR_REG 0x00 #define SUN4I_IRQ_PROTECTION_REG 0x08 #define SUN4I_IRQ_NMI_CTRL_REG 0x0c #define SUN4I_IRQ_PENDING_REG(x) (0x10 + 0x4 * x) #define SUN4I_IRQ_FIQ_PENDING_REG(x) (0x20 + 0x4 * x) -#define SUN4I_IRQ_ENABLE_REG(x) (0x40 + 0x4 * x) -#define SUN4I_IRQ_MASK_REG(x) (0x50 + 0x4 * x) +#define SUN4I_IRQ_ENABLE_REG_OFFSET 0x40 +#define SUN4I_IRQ_MASK_REG_OFFSET 0x50 +#define SUNIV_IRQ_ENABLE_REG_OFFSET 0x20 +#define SUNIV_IRQ_MASK_REG_OFFSET 0x30 +#define SUN4I_IRQ_ENABLE_REG(x) (sun4i_irq_enable_reg_offset + 0x4 * x) +#define SUN4I_IRQ_MASK_REG(x) (sun4i_irq_mask_reg_offset + 0x4 * x) static void __iomem *sun4i_irq_base; static struct irq_domain *sun4i_irq_domain; @@ -115,8 +128,9 @@ static int __init sun4i_of_init(struct device_node *node, writel(0xffffffff, sun4i_irq_base + SUN4I_IRQ_PENDING_REG(1)); writel(0xffffffff, sun4i_irq_base + SUN4I_IRQ_PENDING_REG(2)); - /* Enable protection mode */ - writel(0x01, sun4i_irq_base + SUN4I_IRQ_PROTECTION_REG); + /* Enable protection mode (not available in suniv) */ + if (sun4i_irq_type == sun4i_ic) + writel(0x01, sun4i_irq_base + SUN4I_IRQ_PROTECTION_REG); /* Configure the external interrupt source type */ writel(0x00, sun4i_irq_base + SUN4I_IRQ_NMI_CTRL_REG); @@ -130,7 +144,26 @@ static int __init sun4i_of_init(struct device_node *node, return 0; } -IRQCHIP_DECLARE(allwinner_sun4i_ic, "allwinner,sun4i-a10-ic", sun4i_of_init); + +static int __init sun4i_ic_of_init(struct device_node *node, + struct device_node *parent) +{ + sun4i_irq_type = sun4i_ic; + sun4i_irq_enable_reg_offset = SUN4I_IRQ_ENABLE_REG_OFFSET; + sun4i_irq_mask_reg_offset = SUN4I_IRQ_MASK_REG_OFFSET; + sun4i_of_init(node, parent); +} +IRQCHIP_DECLARE(allwinner_sun4i_ic, "allwinner,sun4i-a10-ic", sun4i_ic_of_init); + +static int __init suniv_ic_of_init(struct device_node *node, + struct device_node *parent) +{ + sun4i_irq_type = suniv_ic; + sun4i_irq_enable_reg_offset = SUNIV_IRQ_ENABLE_REG_OFFSET; + sun4i_irq_mask_reg_offset = SUNIV_IRQ_MASK_REG_OFFSET; + sun4i_of_init(node, parent); +} +IRQCHIP_DECLARE(allwinner_suniv_ic, "allwinner,suniv-ic", suniv_ic_of_init); static void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs) { -- 2.14.2