From patchwork Mon Nov 12 17:16:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 1729201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id C6F8A3FCAE for ; Mon, 12 Nov 2012 17:18:14 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TXxcc-0006go-0x; Mon, 12 Nov 2012 17:16:30 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TXxcY-0006fg-HA for linux-arm-kernel@lists.infradead.org; Mon, 12 Nov 2012 17:16:27 +0000 Received: by mail-pb0-f49.google.com with SMTP id un15so1198171pbc.36 for ; Mon, 12 Nov 2012 09:16:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=dk6Gl+P3wKbLgzfyKl/+zd7FJFDAgV7Z9guDMoFpvmU=; b=GLBiUc3Wqq0ZQKFQvWV4Dogjz/P88zdsSJo1wVfzno3jTfFQrlQ8Uc+IEQKZ9yGr01 ox/Gycvuy8lg98F7Fr3hdWDsqjFA/udFgVSsgnFEmsAX+GtgbdHVUQ/1kiiFp1WV6rUr 7MojouT5oGPLF1SUPTvAAylpDsJL1QYvFhkW9pT+tBxPPv/RFGPshotohr+gDU0vdYgH TmPWWm9PbWmGEtF5gAUsWCD14sMEl5UToPRVdOcRSB7IxUrWuJJKraDLuVdxJ2ygyNI0 r4aYnJdMeyKQ8Es5z4S6D3gLBqjrYD/KXIEQMQe9SAkhsB2Gag00rQIO6gagZIlm4zNJ 9K9A== Received: by 10.68.251.130 with SMTP id zk2mr59526951pbc.19.1352740582981; Mon, 12 Nov 2012 09:16:22 -0800 (PST) Received: from localhost ([122.167.230.46]) by mx.google.com with ESMTPS id ou5sm2863435pbb.33.2012.11.12.09.16.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Nov 2012 09:16:22 -0800 (PST) From: Viresh Kumar To: arm@kernel.org, olof@lixom.net, arnd@arndb.de Subject: [PATCH] fixup! ARM: SPEAr3xx: shirq: simplify and move the shared irq multiplexor to DT Date: Mon, 12 Nov 2012 22:46:15 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <71bbb1faf3cd048953dcf24ef9ce6d9dd37fe8e1.1352608333.git.viresh.kumar@linaro.org> References: <71bbb1faf3cd048953dcf24ef9ce6d9dd37fe8e1.1352608333.git.viresh.kumar@linaro.org> X-Gm-Message-State: ALoCoQnH6GeNGAEjSENOC5SIS+ey7HLqtU+xUa+uRAeLgz/JEDtEC8IEst9ivVGM2pVirO+5tHKK X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121112_121626_860067_954F285C X-CRM114-Status: GOOD ( 16.09 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: sr@denx.de, Viresh Kumar , devicetree-discuss@lists.ozlabs.org, spear-devel@list.st.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Signed-off-by: Viresh Kumar --- Hi Arnd, This is the fixup of the major issues you pointed out. Please go ahead and apply this series. I will then move all this out of plat. arch/arm/mach-spear3xx/spear3xx.c | 6 +-- arch/arm/plat-spear/include/plat/shirq.h | 6 ++- arch/arm/plat-spear/shirq.c | 70 ++++++++++++++------------------ 3 files changed, 39 insertions(+), 43 deletions(-) diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c index 781aec9..f1aaf5b 100644 --- a/arch/arm/mach-spear3xx/spear3xx.c +++ b/arch/arm/mach-spear3xx/spear3xx.c @@ -122,9 +122,9 @@ struct sys_timer spear3xx_timer = { static const struct of_device_id vic_of_match[] __initconst = { { .compatible = "arm,pl190-vic", .data = vic_of_init, }, - { .compatible = "st,spear300-shirq", .data = spear3xx_shirq_of_init, }, - { .compatible = "st,spear310-shirq", .data = spear3xx_shirq_of_init, }, - { .compatible = "st,spear320-shirq", .data = spear3xx_shirq_of_init, }, + { .compatible = "st,spear300-shirq", .data = spear300_shirq_of_init, }, + { .compatible = "st,spear310-shirq", .data = spear310_shirq_of_init, }, + { .compatible = "st,spear320-shirq", .data = spear320_shirq_of_init, }, { /* Sentinel */ } }; diff --git a/arch/arm/plat-spear/include/plat/shirq.h b/arch/arm/plat-spear/include/plat/shirq.h index 1215afe..c51b355 100644 --- a/arch/arm/plat-spear/include/plat/shirq.h +++ b/arch/arm/plat-spear/include/plat/shirq.h @@ -56,7 +56,11 @@ struct spear_shirq { struct shirq_regs regs; }; -int __init spear3xx_shirq_of_init(struct device_node *np, +int __init spear300_shirq_of_init(struct device_node *np, + struct device_node *parent); +int __init spear310_shirq_of_init(struct device_node *np, + struct device_node *parent); +int __init spear320_shirq_of_init(struct device_node *np, struct device_node *parent); #endif /* __PLAT_SHIRQ_H */ diff --git a/arch/arm/plat-spear/shirq.c b/arch/arm/plat-spear/shirq.c index 3912646..955c724 100644 --- a/arch/arm/plat-spear/shirq.c +++ b/arch/arm/plat-spear/shirq.c @@ -246,10 +246,17 @@ static void __init spear_shirq_register(struct spear_shirq *shirq) } static int __init shirq_init(struct spear_shirq **shirq_blocks, int block_nr, - void __iomem *base, struct device_node *np) + struct device_node *np) { int i, irq_base, hwirq = 0, irq_nr = 0; static struct irq_domain *shirq_domain; + void __iomem *base; + + base = of_iomap(np, 0); + if (!base) { + pr_err("%s: failed to map shirq registers\n", __func__); + return -ENXIO; + } for (i = 0; i < block_nr; i++) irq_nr += shirq_blocks[i]->irq_nr; @@ -257,15 +264,14 @@ static int __init shirq_init(struct spear_shirq **shirq_blocks, int block_nr, irq_base = irq_alloc_descs(-1, 0, irq_nr, 0); if (IS_ERR_VALUE(irq_base)) { pr_err("%s: irq desc alloc failed\n", __func__); - return -ENXIO; + goto err_unmap; } shirq_domain = irq_domain_add_legacy(np, irq_nr, irq_base, 0, &irq_domain_simple_ops, NULL); if (WARN_ON(!shirq_domain)) { pr_warn("%s: irq domain init failed\n", __func__); - irq_free_descs(irq_base, irq_nr); - return -ENXIO; + goto err_free_desc; } for (i = 0; i < block_nr; i++) { @@ -279,45 +285,31 @@ static int __init shirq_init(struct spear_shirq **shirq_blocks, int block_nr, } return 0; + +err_free_desc: + irq_free_descs(irq_base, irq_nr); +err_unmap: + iounmap(base); + return -ENXIO; } -int __init spear3xx_shirq_of_init(struct device_node *np, +int __init spear300_shirq_of_init(struct device_node *np, struct device_node *parent) { - struct spear_shirq **shirq_blocks; - void __iomem *base; - int block_nr, ret; - - base = of_iomap(np, 0); - if (!base) { - pr_err("%s: failed to map shirq registers\n", __func__); - return -ENXIO; - } - - if (of_device_is_compatible(np, "st,spear300-shirq")) { - shirq_blocks = spear300_shirq_blocks; - block_nr = ARRAY_SIZE(spear300_shirq_blocks); - } else if (of_device_is_compatible(np, "st,spear310-shirq")) { - shirq_blocks = spear310_shirq_blocks; - block_nr = ARRAY_SIZE(spear310_shirq_blocks); - } else if (of_device_is_compatible(np, "st,spear320-shirq")) { - shirq_blocks = spear320_shirq_blocks; - block_nr = ARRAY_SIZE(spear320_shirq_blocks); - } else { - pr_err("%s: unknown platform\n", __func__); - ret = -EINVAL; - goto unmap; - } - - ret = shirq_init(shirq_blocks, block_nr, base, np); - if (ret) { - pr_err("%s: shirq initialization failed\n", __func__); - goto unmap; - } + return shirq_init(spear300_shirq_blocks, + ARRAY_SIZE(spear300_shirq_blocks), np); +} - return ret; +int __init spear310_shirq_of_init(struct device_node *np, + struct device_node *parent) +{ + return shirq_init(spear310_shirq_blocks, + ARRAY_SIZE(spear310_shirq_blocks), np); +} -unmap: - iounmap(base); - return ret; +int __init spear320_shirq_of_init(struct device_node *np, + struct device_node *parent) +{ + return shirq_init(spear320_shirq_blocks, + ARRAY_SIZE(spear320_shirq_blocks), np); }