From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eddie Huang Subject: [PATCH v3 2/4] irqchip: mtk-sysirq: Get irq number from register resource size Date: Fri, 26 Dec 2014 16:26:55 +0800 Message-ID: <1419582417-4448-3-git-send-email-eddie.huang@mediatek.com> References: <1419582417-4448-1-git-send-email-eddie.huang@mediatek.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1419582417-4448-1-git-send-email-eddie.huang@mediatek.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Matthias Brugger , Rob Herring , Jason Cooper Cc: Mark Rutland , devicetree@vger.kernel.org, srv_heupstream@mediatek.com, Pawel Moll , Ian Campbell , marc.zyngier@arm.com, Catalin Marinas , Mark Brown , Will Deacon , linux-kernel@vger.kernel.org, Robert Richter , Sascha Hauer , Kumar Gala , Olof Johansson , "Joe.C" , Thomas Gleixner , Eddie Huang , peter.maydell@linaro.org, linux-arm-kernel@lists.infradead.org, yh.chen@mediatek.com List-Id: devicetree@vger.kernel.org From: Yingjoe Chen 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 Signed-off-by: Eddie Huang --- 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..fadd865 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; + struct resource res; + int ret, size, intpol_num; 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; -- 1.8.1.1 ************* Email Confidentiality Notice ******************** The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!