From patchwork Mon Dec 10 13:56:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 153267 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3588551ljp; Mon, 10 Dec 2018 05:56:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/V3yS89T5pkemnQ31BKAXdK5kGPqpC/lP3dSZofYUtYA3a/Cgncu6AtFbn/vMO1yb8A+zcw X-Received: by 2002:a17:902:142:: with SMTP id 60mr12590252plb.330.1544450207977; Mon, 10 Dec 2018 05:56:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544450207; cv=none; d=google.com; s=arc-20160816; b=MKFpHKDzaMjbhENzH5DFQCGzSH2zK7oBt1MLkd0qG5S2wrGRuwP/27fAY93QjxftIP YNk8hndkv3Dh/v1G81Jxk0I9zNlls1HsAk5c2ECFSBTGo9DZ9R8xtd/jshyz7qicJ/yc GIj6lfn8iJuzlARRSHxDINv9Rsagv3bqxW1mQgi/K/guchwBhC27f/pKAobxAv8pwMSA GQL0sTksG8P+G6kquEdL+QBFu6xBhUVnvT4JUsTXOOzB3d19kzj8JgESNavuNdD4+vEt HD1bELm51BtpSZueK2/Kuvtl5L5i3JKBqBUeqNsyBFnBBaa9FXAeU54XpJke1IKvrkXw 1U9A== 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=aP1EI+I5RgUtlWmE62M6UqtQRQysaLb2DRE3LkFnZds=; b=OM0M1yyCpjGKlv+QhCvAN7pNemyv1W1q3TRQHDInUgQX9Zzhk0mf6ce8JeoiYjWioS G3KCEM7OAyAZfHGvZixnMhU81xhzNO9YyMjb1rEcoreAXar8r1LiG8ldtIVZAH7IQsrT A1a6zsegGRc1LurUTjBhR7quBTI99yBZhYFw26kMbxli36WHVw+7EhEnJIpFecqpgkKw yzr0D47CUmzqWyiUWxgLehbPOC/Ko2dxof0kKhYcuhPz9q7od/738ZK9E07LcgwsXtIv qumeBjHEQs39kMtolnZwcxby28ixABehbzOZtzxY/CFdn7ePFGAyJNcJ7SGMBVi8zQD0 H5jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B09g4Xy8; 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 m1si9640858pgm.194.2018.12.10.05.56.47; Mon, 10 Dec 2018 05:56:47 -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=B09g4Xy8; 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 S1727615AbeLJN4m (ORCPT + 6 others); Mon, 10 Dec 2018 08:56:42 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54358 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727576AbeLJN4l (ORCPT ); Mon, 10 Dec 2018 08:56:41 -0500 Received: by mail-wm1-f65.google.com with SMTP id a62so3595848wmh.4 for ; Mon, 10 Dec 2018 05:56:40 -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=aP1EI+I5RgUtlWmE62M6UqtQRQysaLb2DRE3LkFnZds=; b=B09g4Xy82FcFY6jgXrd63y5ie+XkYuOwdxpt0/5QZadsPOp8zF+TIejqW9g4Fq11IV SbJgQic/R6nq0OCQCFH3w2poa+aYVltPDPvkGLQknZv1UY+pZ2SpMN1gbFpo4ZRJcsC9 HlP5jVVDKVTv54kxY6rWkPY8wk/Xa2JWkeRqM= 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=aP1EI+I5RgUtlWmE62M6UqtQRQysaLb2DRE3LkFnZds=; b=P6USOH10IdxNXaWWCvR2BDvBcOM5+z4rM136LDy6vLB636anHOAv3UFAORNMF0EQCt 9FAPeCLLjQHqQhgVLv4wbMly9lyt+W8KDZr9cvR9F74YYO4jMC9r6biBMvIL6x93jGnE sWjNcF5Xu06WasQd+K5lJbqpB0U5tvCyuD0BIUbGxXUcCZK1pOMl93/C0XFJqdNHSYNF TCvdq1qVi7kmJAmh4sFQh6dRP4XhB8lhLai2Vw6AzuqnthzRWaFtv1nJi1YS0LsfEwWL tpHGdFlmOaEOBATsW1WdrBXQssRcBREJ+fvRCkxyVUDbtvF/g+UXCoB8EVAqqUVcj/XE lrPA== X-Gm-Message-State: AA+aEWY7Lp09m6hdVtysH/6VtUm9IyYNofh3az6aedoWD6jqfn0V1xHu dYOnO9JXdRqAgiQLPI3MvPkBcA== X-Received: by 2002:a1c:8302:: with SMTP id f2mr11351091wmd.9.1544450199431; Mon, 10 Dec 2018 05:56:39 -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 c14sm8612506wme.13.2018.12.10.05.56.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Dec 2018 05:56:38 -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 v5 2/4] irqchip/gic: common: add support to device tree based quirks Date: Mon, 10 Dec 2018 13:56:31 +0000 Message-Id: <20181210135633.30283-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181210135633.30283-1-srinivas.kandagatla@linaro.org> References: <20181210135633.30283-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 | 7 +++++++ 3 files changed, 22 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..df1ff3b5836a 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -1271,6 +1271,11 @@ 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 +1323,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)