From patchwork Thu Oct 18 09:57:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10646947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 882CD17D4 for ; Thu, 18 Oct 2018 10:00:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C7BE28803 for ; Thu, 18 Oct 2018 10:00:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FCDE28895; Thu, 18 Oct 2018 10:00:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB81828803 for ; Thu, 18 Oct 2018 10:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-reply-to:Message-id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=QNab8280c2coYa0nJAZ6kj7FB9RqK+/QmNjmRv8kMjA=; b=SHykt+QabmA4MqVNaVXTYfVrqe VS3VYmit4yzJCu5sIYKpcqvwy7d4ClJnmk+65P5xXBlDBzbthlJIl0q9Dz/Kkz3tRRE5SHVmHbBGZ b1vcoLhGrPBtCsx42iezU8OkY77LXcnM/SWMsRa5dIWBmxW20fyaoAakF6/b6S7b8zy338ocp5/FK PQL4pVVvEmPAY6eKHVlepxe+8fRxOsTpBsclVktWjYP9w4nBZ+/itPg9aTrjnjjgzYxpP7QRdZq02 KrtDTVKleDJIxdPQVLs+TbWcku2kXA0xf3qiu2WFVl3lvZ0XBbas3restT6sQvnm4iN8+jquowCGF lCQIDhHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gD55n-0006DW-Io; Thu, 18 Oct 2018 09:59:47 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gD53Z-0005BD-OH for linux-arm-kernel@lists.infradead.org; Thu, 18 Oct 2018 09:57:33 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181018095718euoutp016bd5895d743845253d7ac83a534641e4~eq3RMLqty0160201602euoutp01e; Thu, 18 Oct 2018 09:57:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181018095718euoutp016bd5895d743845253d7ac83a534641e4~eq3RMLqty0160201602euoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539856638; bh=h+DAgBMdXW66D9M3iwDYly4siSxPNHVl5qlT4WELpzU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=V5zlImZNTBoF+5jKjEMp5FDCDd6LAvSutQu31bA9QQZGzNEJGBwReABn2gqZgK1TH d1pAltluS1FUVCgqmTJW78et/NyL0iJrsLFHmoiUGJkyCnx8XmAc0Nwnx9AwDolk4a n1+DbKkZ3JuoxeGa27MCVSeKbRt1wc21JPw3LBB0= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181018095718eucas1p2b97a0fec37fbcae0686cce9e833d94d3~eq3QxUv492884828848eucas1p2X; Thu, 18 Oct 2018 09:57:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id DB.63.04441.DF858CB5; Thu, 18 Oct 2018 10:57:17 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181018095717eucas1p2c89f6e71642e6db62676e1af5514529f~eq3QCyEdV0201302013eucas1p2p; Thu, 18 Oct 2018 09:57:17 +0000 (GMT) X-AuditID: cbfec7f2-a1ae89c000001159-6a-5bc858fdcc2f Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id CB.C2.04128.DF858CB5; Thu, 18 Oct 2018 10:57:17 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGS00GLZGZA2H50@eusync3.samsung.com>; Thu, 18 Oct 2018 10:57:17 +0100 (BST) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/6] clocksource: exynos_mct: Refactor resources allocation Date: Thu, 18 Oct 2018 11:57:05 +0200 Message-id: <20181018095708.1527-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181018095708.1527-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGIsWRmVeSWpSXmKPExsWy7djP87p/I05EG2y+ZWKxccZ6Vov3y3oY La5/ec5qMe+zrMWk+xNYLM6f38B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7MstUjfLoEr49zZbvaCXxIVz24+Z29g3CXSxcjJISFgIrHtxVOWLkYuDiGBJYwSh3a/Z4Vw mpgkrrxZyw5SxSZgKNH1tosNxBYRyJaYv7ebHaSIWeAks8Slx+9YQBLCAn4Sp65A2CwCqhLH W6Yyg9i8AjYS/euPsEKsk5dYveEAWJxTwFbizHyIeiGgmu4/69knMPIsYGRYxSiSWlqcm55b bKRXnJhbXJqXrpecn7uJERiU24793LKDsetd8CFGAQ5GJR7eB6nHo4VYE8uKK3MPMUpwMCuJ 8FabnYgW4k1JrKxKLcqPLyrNSS0+xCjNwaIkznveoDJKSCA9sSQ1OzW1ILUIJsvEwSnVwJia z3lCdseNX5/3P6o8f+KKX1fzjXutZxP0rTfPj1u0+0PGiwnn1Ti/f2Lu/hSic+5bfNSSXqY9 IYVlMXmHJwp4pn2yEWm+6rByaWXalu6b6u/uv1RabbSKUbifJSL6y7W985ctPvWkTfRLQfhK h2q2yozbihIP16wQswkudVOU33zKNSH3WpYSS3FGoqEWc1FxIgA8uj/eRgIAAA== X-CMS-MailID: 20181018095717eucas1p2c89f6e71642e6db62676e1af5514529f X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181018095717eucas1p2c89f6e71642e6db62676e1af5514529f References: <20181018095708.1527-1-m.szyprowski@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181018_025729_981304_C8CAFEEC X-CRM114-Status: GOOD ( 16.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Bartlomiej Zolnierkiewicz , Marc Zyngier , Catalin Marinas , Daniel Lezcano , Will Deacon , Krzysztof Kozlowski , Inki Dae , Chanwoo Choi , Thomas Gleixner , Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Move interrupts allocation from exynos4_timer_resources() into separate function together with the interrupt number parsing code from mct_init_dt(), so the code for managing interrupts is kept together. While touching exynos4_timer_resources() function, move of_iomap() to it. No functional changes. Signed-off-by: Marek Szyprowski Reviewed-by: Chanwoo Choi Tested-by: Chanwoo Choi Reviewed-by: Krzysztof Kozlowski --- drivers/clocksource/exynos_mct.c | 50 +++++++++++++++++++------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 49413900b24c..4c886ff2941a 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -502,11 +502,14 @@ static int exynos4_mct_dying_cpu(unsigned int cpu) return 0; } -static int __init exynos4_timer_resources(struct device_node *np, void __iomem *base) +static int __init exynos4_timer_resources(struct device_node *np) { - int err, cpu; struct clk *mct_clk, *tick_clk; + reg_base = of_iomap(np, 0); + if (!reg_base) + panic("%s: unable to ioremap mct address space\n", __func__); + tick_clk = of_clk_get_by_name(np, "fin_pll"); if (IS_ERR(tick_clk)) panic("%s: unable to determine tick clock rate\n", __func__); @@ -517,9 +520,27 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem * panic("%s: unable to retrieve mct clock instance\n", __func__); clk_prepare_enable(mct_clk); - reg_base = base; - if (!reg_base) - panic("%s: unable to ioremap mct address space\n", __func__); + return 0; +} + +static int __init exynos4_timer_interrupts(struct device_node *np, + unsigned int int_type) +{ + int nr_irqs, i, err, cpu; + + mct_int_type = int_type; + + /* This driver uses only one global timer interrupt */ + mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ); + + /* + * Find out the number of local irqs specified. The local + * timer irqs are specified after the four global timer + * irqs are specified. + */ + nr_irqs = of_irq_count(np); + for (i = MCT_L0_IRQ; i < nr_irqs; i++) + mct_irqs[i] = irq_of_parse_and_map(np, i); if (mct_int_type == MCT_INT_PPI) { @@ -579,24 +600,13 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem * static int __init mct_init_dt(struct device_node *np, unsigned int int_type) { - u32 nr_irqs, i; int ret; - mct_int_type = int_type; - - /* This driver uses only one global timer interrupt */ - mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ); - - /* - * Find out the number of local irqs specified. The local - * timer irqs are specified after the four global timer - * irqs are specified. - */ - nr_irqs = of_irq_count(np); - for (i = MCT_L0_IRQ; i < nr_irqs; i++) - mct_irqs[i] = irq_of_parse_and_map(np, i); + ret = exynos4_timer_resources(np); + if (ret) + return ret; - ret = exynos4_timer_resources(np, of_iomap(np, 0)); + ret = exynos4_timer_interrupts(np, int_type); if (ret) return ret;