From patchwork Mon Dec 10 10:23:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 153252 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3395263ljp; Mon, 10 Dec 2018 02:23:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/UZsOhjVJn7I+i2c7ryQ1OW60ZUvGKEa1QGlUDJH+KxBGNj/qio5eS6xP7OOHYJDo/i1x/Z X-Received: by 2002:a62:fb07:: with SMTP id x7mr11734672pfm.71.1544437402634; Mon, 10 Dec 2018 02:23:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544437402; cv=none; d=google.com; s=arc-20160816; b=Pvz/Eb/ieFSOPag0HAkdBbzecK3wtyBF5stg0KAEyv3G/8J2yJa/5y2L0LlCKZ23lr iMAKdU6qjjIzgdcU0GWZZUCb57MvIpl2mfv100lgYz0aYGb4eOkxil2v7iuP5qNdI/Y2 tPrupmNU0L+zkwXvkVPojkoRP1G3iHNbRy5Hf0LX4MCWc1kasRxo9oPaAtsZJ1SvdbjV ZUqLZ6IY2vX2JG0MmKGWZ/blHleERay62/fqx3EuUlhcPje8yVAnZFtyMgWXIynlYZMF TxmiXRSbUFFyi82+Z2KIWiWomN9pFtcY6WySYs1pN9hOc7LQoCIN5NC8bu3wVbhrq/F4 Jtcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1U/Akwho1DZJNINiBcRb/GlKX5Bkx4IZu/rr43WS9yo=; b=BmoNyEjCB3jguPVcZ56Li+7pGT8cZ3TU03W0aNAkVL/UWOxuCSPvvuoRL2tnEMMctI 0GpV39FRqh7kFCEYI00k0GlvIAL5sop0j3SsVjsgoU2LYHGpL1HklW5WlwGLiXPk7OmD ytkzjYG6T2C8Lm2+eFtPFuQqfWOf4aSFWkyzWjdw5gzUtCqSfWL/oIu/JWoDhK3z5uTT xaigAcpacY3oSRbja7EoWM+HRwVT81lNIUiZ94uhh1Uz2QY1SAZp4BhYMdyt2WQshBQm fnDQTh1hW4pr1Z8t4YvyO9V4rfdeMwYwSgetTVDqvQfuz+sXN3C33xW1MjPsKhpmcmEx qclQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XFnvTzf3; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n30si9389533pgb.406.2018.12.10.02.23.22; Mon, 10 Dec 2018 02:23:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=@linaro.org header.s=google header.b=XFnvTzf3; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727158AbeLJKXV (ORCPT + 6 others); Mon, 10 Dec 2018 05:23:21 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40353 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727116AbeLJKXS (ORCPT ); Mon, 10 Dec 2018 05:23:18 -0500 Received: by mail-wr1-f65.google.com with SMTP id p4so9844426wrt.7 for ; Mon, 10 Dec 2018 02:23:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1U/Akwho1DZJNINiBcRb/GlKX5Bkx4IZu/rr43WS9yo=; b=XFnvTzf3n6/EloQ2lQISSe9HFxQTNcsFS8nR+0lBOtx/RTIvrIKN/unT409luQoHDg PEy2eMc39+pmCZhfm8BS/N3Tv1xt9pDDMmLcd62wfSCJgHS770F9fAyXdwTOEpzV198H OBjCwdcW5USPSQtG664gQ51gjqE/QObph4O08= 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:mime-version:content-transfer-encoding; bh=1U/Akwho1DZJNINiBcRb/GlKX5Bkx4IZu/rr43WS9yo=; b=qBmbBoXpLtH0WqDAoHkjoVyFTBTk3gu4qSU643HBDyjZPp9S1nUWBuqQiS9QdI9k7w Yk/+97sC4ayYsh1T8saJrO/zgZQZXc9lmgMFtoxdb/NMkTp6qcWFzOOsWxA71F4tA8jz g3DvBIe8KEHay9Qq3yLImn1nCsPmehI83PCNF2wGtD8KMb88902/dUxbdfMN3lfeWI0J HdWLABd1CDS4V/cu24is1ewEuQ3gnyVbV/9oTQOyybn58xfiCV/9QekbMEoB7Bl/8p6g aUFbhTfJuOghymwdDTSYHXwo7TfytETKv1DgeMEs6vKgM5Da4tqgr4acgKOBWV9MW7Ms RNhQ== X-Gm-Message-State: AA+aEWZnTtIjkTmwUYApWTLayK09ty2eutUxZLdg7O/UzoHZufJvI+Lt cYBCm2wdCWp40tN8ynevyoEwAg== X-Received: by 2002:adf:8c09:: with SMTP id z9mr9378346wra.301.1544437397282; Mon, 10 Dec 2018 02:23:17 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id r64sm12266664wmg.5.2018.12.10.02.23.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Dec 2018 02:23:16 -0800 (PST) From: Srinivas Kandagatla To: marc.zyngier@arm.com Cc: sudeep.holla@arm.com, tglx@linutronix.de, jason@lakedaemon.net, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, rnayak@codeaurora.org, sboyd@kernel.org, bjorn.andersson@linaro.org, nicolas.dechesne@linaro.org, ctatlor97@gmail.com, vkoul@kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v4 2/4] irqchip/gic: common: add support to device tree based quirks Date: Mon, 10 Dec 2018 10:23:07 +0000 Message-Id: <20181210102309.8207-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181210102309.8207-1-srinivas.kandagatla@linaro.org> References: <20181210102309.8207-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This patch adds support to device tree based quirks based on device tree compatible string. Signed-off-by: Srinivas Kandagatla --- drivers/irqchip/irq-gic-common.c | 12 ++++++++++++ drivers/irqchip/irq-gic-common.h | 3 +++ drivers/irqchip/irq-gic-v3.c | 5 +++++ 3 files changed, 20 insertions(+) -- 2.19.2 diff --git a/drivers/irqchip/irq-gic-common.c b/drivers/irqchip/irq-gic-common.c index 01e673c680cd..3c93c6f4d1f1 100644 --- a/drivers/irqchip/irq-gic-common.c +++ b/drivers/irqchip/irq-gic-common.c @@ -36,6 +36,18 @@ void gic_set_kvm_info(const struct gic_kvm_info *info) gic_kvm_info = info; } +void gic_enable_of_quirks(const struct device_node *np, + const struct gic_quirk *quirks, void *data) +{ + for (; quirks->desc; quirks++) { + if (!of_device_is_compatible(np, quirks->compatible)) + continue; + if (quirks->init(data)) + pr_info("GIC: enabling workaround for %s\n", + quirks->desc); + } +} + void gic_enable_quirks(u32 iidr, const struct gic_quirk *quirks, void *data) { diff --git a/drivers/irqchip/irq-gic-common.h b/drivers/irqchip/irq-gic-common.h index 3919cd7c5285..97e58fb6c232 100644 --- a/drivers/irqchip/irq-gic-common.h +++ b/drivers/irqchip/irq-gic-common.h @@ -23,6 +23,7 @@ struct gic_quirk { const char *desc; + const char *compatible; bool (*init)(void *data); u32 iidr; u32 mask; @@ -35,6 +36,8 @@ void gic_dist_config(void __iomem *base, int gic_irqs, void gic_cpu_config(void __iomem *base, void (*sync_access)(void)); void gic_enable_quirks(u32 iidr, const struct gic_quirk *quirks, void *data); +void gic_enable_of_quirks(const struct device_node *np, + const struct gic_quirk *quirks, void *data); void gic_set_kvm_info(const struct gic_kvm_info *info); diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 29e9d47be97d..c95796fa4de6 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -1271,6 +1271,9 @@ static void __init gic_of_setup_kvm_info(struct device_node *node) gic_set_kvm_info(&gic_v3_kvm_info); } +static const struct gic_quirk gic_quirks[] = { +}; + static int __init gic_of_init(struct device_node *node, struct device_node *parent) { void __iomem *dist_base; @@ -1318,6 +1321,8 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare if (of_property_read_u64(node, "redistributor-stride", &redist_stride)) redist_stride = 0; + gic_enable_of_quirks(node, gic_quirks, &gic_data); + err = gic_init_bases(dist_base, rdist_regs, nr_redist_regions, redist_stride, &node->fwnode); if (err)