Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1658526imu; Sun, 18 Nov 2018 06:20:46 -0800 (PST) X-Google-Smtp-Source: AJdET5fu9snbCJeEMXyPQIPiYOcuoNFIRbqKD5KwNQMU6RqNhzj0clDU8KBmyoLLcuueN8akFqQR X-Received: by 2002:a63:7219:: with SMTP id n25mr16889721pgc.324.1542550846364; Sun, 18 Nov 2018 06:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542550846; cv=none; d=google.com; s=arc-20160816; b=o8WBvYn7bBKxU9Eyw8+/wqtT4m/kAFOTc9FW56n5yqhCwrUO3x+PvDapM3Rp5wB/QM hTD/IMP9h5W5p4Rhq90hW47TRdeeabA/ACUSNeJom9AG+jpKWaTdss+VmVt6+JEoe/RZ sX/Ee1RJ72LtZ6VyUKE+C1Bvfw1dfPhj3/OaSNNEknLlesYyP2tipc9N1d3aqcNNEWDa 8lZ+25b1kBn2i0TWvdjUAraVGlAJF9ei7a24i7hSbML9WmQ/aAFyZjMP9+XtSZGBOcY/ ScPvZRm8kI+X+JOPStuClpNvCr9xULmvkVoLTY5J4aaMO1obcuaEu5Q2uNr5GwxIK6I+ qzTw== 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:dkim-signature; bh=+vPiJ34sistKUFrl1dOh2ZO+lpuKceW8b1URIfA7u8g=; b=X7nPSqj3g2L/0pizg3kYReVfaziFqJ4zUi5kgxzyQCBRSR5Y4KiCo76vwJBh9KU9oF y93yg5dlIHJk8J9XRxwGn/NxVPvgiv+N/d8L89cOZGHjOkaTr8IYL4Qlwpqlr49Ti6+8 VKeSwY61fNTGJ9z8Ribd6tIWQekf2YtP8y1lLjr0Li/Ov2ml4fQfKNZSpucY0oRHWYGV YkfJu3EMnsUuMKZFY+wgnliH2ct6IrudTT1vXs9m4gPVh9vX60CBdwXgEIAjk6OimdHZ NLVR8uSEfSIK+xEg1jwb986ugK0tM0MpUmJ/OgrvIKG5PMr+fQNG7IeWQGKsSA8W/dTX ywew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c48ly9tc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si40468862plc.370.2018.11.18.06.20.31; Sun, 18 Nov 2018 06:20:46 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c48ly9tc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727702AbeKSAiz (ORCPT + 99 others); Sun, 18 Nov 2018 19:38:55 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37213 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727551AbeKSAiy (ORCPT ); Sun, 18 Nov 2018 19:38:54 -0500 Received: by mail-wr1-f66.google.com with SMTP id j10so15080637wru.4; Sun, 18 Nov 2018 06:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+vPiJ34sistKUFrl1dOh2ZO+lpuKceW8b1URIfA7u8g=; b=c48ly9tcTnkrb9ZH9XaCf6bJwzGg1xmusR/bMNnY1CTRJhume3qzRce9XZR27Z0CDV 2r+4bRBcppclPfZ+JLjLE2hd7jdBJuAn7mXhYNyvgsuGmiLHjo20dgmukKOtQT9r6pzR lrZdWodmBj25QDD7OkjQHKNXasSM3pnbRsX+uZxHSqF9OV19cPkAxAkFSZsgtbOHWyBI m861MZ49VHYd8F9ADqlPpUglDdl2+EWMfsWLgc6hfi4uBbbfNrHL5WAuwjpXmVzE+xcu V6mk/rMhQbFSnsh0KzEl0Pdtgu3fmrCTYgDdMlYJaTW3kUW51kZqlyY7HReNUsy+jcsm R7uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+vPiJ34sistKUFrl1dOh2ZO+lpuKceW8b1URIfA7u8g=; b=juuB9KrLq6LRW5+LLwZ6Hsu5vOW8QD6hGIgjVOu5GZImjDGY2kzSnYIEXxwHVTNc8G /WR3zPAJgbGE3tP91xkp/i17FafxqiEEmDp4gEA/4+XnlHb5+BP7mY12lGmw9eBWb+NX kCeqUBFb7m/Vin8lH0YjOisdItwtl+ZAaBijlyDryDNO/oyu1USN1sZ7is7eRGm3OJlF ALSZopfcJ4DRulBBjNIJLlYwFZUL+o9gm9Yv2xO+CGxNZ1epB98su4fXIhYBsh3uryqF Csej3KBFJ+ofTgUaYScNu0AASun+gPRd+vrqP7EPB6DCU8VbfBQPjMeXar9LppKtEN/i +vYg== X-Gm-Message-State: AA+aEWYvR8uw4zHgw7kbC9+5ANAR1oyp5nzgviGGS82g7F7fMUNhlQJD 3fiJUjpmSOUgzJQXQUM/Jchus2wSymQ= X-Received: by 2002:a5d:454f:: with SMTP id p15mr3431013wrr.39.1542550706269; Sun, 18 Nov 2018 06:18:26 -0800 (PST) Received: from ThinkPad.home ([185.219.176.209]) by smtp.gmail.com with ESMTPSA id d4sm29814412wrp.89.2018.11.18.06.18.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Nov 2018 06:18:25 -0800 (PST) From: Mesih Kilinc To: 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 Cc: Mesih Kilinc , Maxime Ripard , Chen-Yu Tsai , Russell King , Daniel Lezcano , Marc Zyngier , Linus Walleij , Icenowy Zheng , Rob Herring , Julian Calaby Subject: [RFC PATCH v2 05/14] irqchip/sun4i: add support for suniv interrupt controller Date: Sun, 18 Nov 2018 17:17:04 +0300 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: 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 Signed-off-by: Mesih Kilinc --- drivers/irqchip/irq-sun4i.c | 47 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-sun4i.c b/drivers/irqchip/irq-sun4i.c index e3e5b91..2abf662 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,30 @@ 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); + + return 0; +} +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); + + return 0; +} +IRQCHIP_DECLARE(allwinner_suniv_ic, "allwinner,suniv-f1c100s-ic", suniv_ic_of_init); static void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs) { -- 2.7.4