LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: tip-bot for Yingjoe Chen <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, tglx@linutronix.de,
	ijc+devicetree@hellion.org.uk, jason@lakedaemon.net,
	pawel.moll@arm.com, peter.maydell@linaro.org, robh+dt@kernel.org,
	eddie.huang@mediatek.com, matthias.bgg@gmail.com,
	marc.zyngier@arm.com, broonie@linaro.org, olof@lixom.net,
	srv_heupstream@mediatek.com, rrichter@cavium.com,
	galak@codeaurora.org, mingo@kernel.org, kernel@pengutronix.de,
	mark.rutland@arm.com, yingjoe.chen@mediatek.com, hpa@zytor.com,
	will.deacon@arm.com, linux-kernel@vger.kernel.org,
	catalin.marinas@arm.com
Subject: [tip:irq/core] irqchip: mtk-sysirq: Get irq number from register resource size
Date: Mon, 26 Jan 2015 02:43:47 -0800	[thread overview]
Message-ID: <tip-cdb647a772e9def47594ff8ce7acf47f4d257b2e@git.kernel.org> (raw)
In-Reply-To: <1421054073-43468-3-git-send-email-eddie.huang@mediatek.com>

Commit-ID:  cdb647a772e9def47594ff8ce7acf47f4d257b2e
Gitweb:     http://git.kernel.org/tip/cdb647a772e9def47594ff8ce7acf47f4d257b2e
Author:     Yingjoe Chen <yingjoe.chen@mediatek.com>
AuthorDate: Mon, 12 Jan 2015 17:14:31 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 26 Jan 2015 11:38:22 +0100

irqchip: mtk-sysirq: Get irq number from register resource size

Originally mtk-sysirq hardcoded supported irq number to 224. This
was fine since all SoCs before support the same number of irqs for
intpol.

However MT8173 intpol support 32 more irq pins, changes to get
irq number from register resource size to suppor MT8173 properly.

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
Cc: <srv_heupstream@mediatek.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Olof  Johansson <olof@lixom.net>
Cc: Robert Richter <rrichter@cavium.com>
Cc: Mark Brown <broonie@linaro.org>
Cc: <linux-arm-kernel@lists.infradead.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: <marc.zyngier@arm.com>
Cc: <peter.maydell@linaro.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Jason Cooper <jason@lakedaemon.net>
Link: http://lkml.kernel.org/r/1421054073-43468-3-git-send-email-eddie.huang@mediatek.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/irqchip/irq-mtk-sysirq.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/irqchip/irq-mtk-sysirq.c b/drivers/irqchip/irq-mtk-sysirq.c
index 0b0d2c0..eaf0a71 100644
--- a/drivers/irqchip/irq-mtk-sysirq.c
+++ b/drivers/irqchip/irq-mtk-sysirq.c
@@ -23,8 +23,6 @@
 
 #include "irqchip.h"
 
-#define MT6577_SYS_INTPOL_NUM	(224)
-
 struct mtk_sysirq_chip_data {
 	spinlock_t lock;
 	void __iomem *intpol_base;
@@ -124,7 +122,8 @@ static int __init mtk_sysirq_of_init(struct device_node *node,
 {
 	struct irq_domain *domain, *domain_parent;
 	struct mtk_sysirq_chip_data *chip_data;
-	int ret = 0;
+	int ret, size, intpol_num;
+	struct resource res;
 
 	domain_parent = irq_find_host(parent);
 	if (!domain_parent) {
@@ -132,19 +131,24 @@ static int __init mtk_sysirq_of_init(struct device_node *node,
 		return -EINVAL;
 	}
 
+	ret = of_address_to_resource(node, 0, &res);
+	if (ret)
+		return ret;
+
 	chip_data = kzalloc(sizeof(*chip_data), GFP_KERNEL);
 	if (!chip_data)
 		return -ENOMEM;
 
-	chip_data->intpol_base = of_io_request_and_map(node, 0, "intpol");
-	if (IS_ERR(chip_data->intpol_base)) {
+	size = resource_size(&res);
+	intpol_num = size * 8;
+	chip_data->intpol_base = ioremap(res.start, size);
+	if (!chip_data->intpol_base) {
 		pr_err("mtk_sysirq: unable to map sysirq register\n");
 		ret = PTR_ERR(chip_data->intpol_base);
 		goto out_free;
 	}
 
-	domain = irq_domain_add_hierarchy(domain_parent, 0,
-					  MT6577_SYS_INTPOL_NUM, node,
+	domain = irq_domain_add_hierarchy(domain_parent, 0, intpol_num, node,
 					  &sysirq_domain_ops, chip_data);
 	if (!domain) {
 		ret = -ENOMEM;

  parent reply	other threads:[~2015-01-26 10:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1421054073-43468-1-git-send-email-eddie.huang@mediatek.com>
     [not found] ` <1421054073-43468-3-git-send-email-eddie.huang@mediatek.com>
2015-01-13 13:12   ` [PATCH v4 2/4] " Matthias Brugger
2015-01-22 12:24     ` Matthias Brugger
2015-01-24 17:26       ` Thomas Gleixner
2015-01-26 10:43   ` tip-bot for Yingjoe Chen [this message]
2015-01-26 14:27 ` [PATCH v4 0/4] Add basic support for Mediatek MT8173 SoC Matthias Brugger
2015-01-26 15:34   ` Thomas Gleixner
2015-01-27 23:52     ` Matthias Brugger

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=tip-cdb647a772e9def47594ff8ce7acf47f4d257b2e@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=broonie@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=eddie.huang@mediatek.com \
    --cc=galak@codeaurora.org \
    --cc=hpa@zytor.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jason@lakedaemon.net \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mingo@kernel.org \
    --cc=olof@lixom.net \
    --cc=pawel.moll@arm.com \
    --cc=peter.maydell@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=rrichter@cavium.com \
    --cc=srv_heupstream@mediatek.com \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    --cc=yingjoe.chen@mediatek.com \
    --subject='Re: [tip:irq/core] irqchip: mtk-sysirq: Get irq number from register resource size' \
    /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

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).