From patchwork Wed Oct 17 13:41:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10645649 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 3233E15E2 for ; Wed, 17 Oct 2018 13:46:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D0FA2B077 for ; Wed, 17 Oct 2018 13:46:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F80E2B0A7; Wed, 17 Oct 2018 13:46:34 +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 5E0752B077 for ; Wed, 17 Oct 2018 13:46:33 +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=OW08EOHnVvrxaKaORxv20FbSix0ZzRyh9KTnhd6vsnM=; b=sL/8ggmzX2OP4kH3t3j/slys4L UKDxRmEHUDDA+8XZasLTPNfmp0ScszwMmnpecDqtBKfc4YvRCqv4H3JeA+R8684rTA1puciK8C1AK lomc44vuTXPey8YUyWI742LDL+6aFQofrA1IIDEN8uz47yTaqAQr6v+j7tseuXHpTdQZeVWEEju+2 WTrj/e8Cy3Aq008w4Gi7S7IewT1WunA9JrMQ0W+zTibIKM69hx7l4PRqKFP6itv+8tVjowUp+Ad0G XCnuHmHvtb4qAXDhdRWVQPJnwXjrD5/HdZv5i+WofZl87KsLI7dkWba8YRbBsGJeDidS4MksRTZVP nDc1Mt9g==; 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 1gCm9U-0008G7-Ih; Wed, 17 Oct 2018 13:46:20 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCm5b-0005IE-PN for linux-arm-kernel@lists.infradead.org; Wed, 17 Oct 2018 13:42:24 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181017134208euoutp02d4a410fdf8256252a1865accb1ba45c9~eaSR9I68r1192811928euoutp02o; Wed, 17 Oct 2018 13:42:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181017134208euoutp02d4a410fdf8256252a1865accb1ba45c9~eaSR9I68r1192811928euoutp02o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539783728; bh=oel99Mp9meQQ4+STkZabHx/+KTVTtlGBaiezJPYNJsY=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=kQqw06VZBtPPZCP663Qs5jxm9kqRAeG0pi26bcNe061EGneUTsgli8NT50+hX2xSt N/GIpnz0/7sajk6KlQwSgtp6uvySPZ2WEVxyAFV/DYD5h6OHllKt8IRG5/TE8o5Jke 6vHk/456+GM9m8iEdgBere9FLXIszAKqeJYfl7pw= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181017134207eucas1p105a6fc6c211349ed1f213f0ac74092c1~eaSRZ34r21606816068eucas1p1b; Wed, 17 Oct 2018 13:42:07 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 6E.4E.04441.F2C37CB5; Wed, 17 Oct 2018 14:42:07 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181017134206eucas1p1ebc76569f706675d41f2d2183349f1f3~eaSQn7isL1609216092eucas1p1A; Wed, 17 Oct 2018 13:42:06 +0000 (GMT) X-AuditID: cbfec7f2-a1ae89c000001159-96-5bc73c2f86cb Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id AE.12.04128.E2C37CB5; Wed, 17 Oct 2018 14:42:06 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGQ001A0WQ1IZ80@eusync4.samsung.com>; Wed, 17 Oct 2018 14:42:06 +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 v3 3/6] clocksource: exynos_mct: Refactor resources allocation Date: Wed, 17 Oct 2018 15:41:56 +0200 Message-id: <20181017134159.9656-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181017134159.9656-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWRb0gTcRjH/e1ud7fV4tgsf2kWDgoqnBlFl5oYBB2BaL1IbC905eG/bcrO WfqmhaltaZk1Hf6Z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9EpUtFyYxdTAeF24i5GTQ0LAROJl+2nmLkYuDiGBJYwS6w83s0M4TUwSUyY+ YASpYhMwlOh628UGYosIZEvM39vNDmIzCyxhlrh53wHEFhbwk5hx8xBYnEVAVaKhcQtYL6+A jcSTbVOZILbJS6zecABoGwcHp4CtxNr+KpCwEFDJy89zmSYw8ixgZFjFKJJaWpybnltspFec mFtcmpeul5yfu4kRGIbbjv3csoOx613wIUYBDkYlHt4dYseihVgTy4orcw8xSnAwK4nwVike jxbiTUmsrEotyo8vKs1JLT7EKM3BoiTOe96gMkpIID2xJDU7NbUgtQgmy8TBKdXAyCrz44Dq 3ESDm8+fW6xbGey3LkVkd+y7Ap/NKRLaTB+OT9tWGJahM2f3LraSzUlvwxbMPhN4qjHZ9uKc +i3+DUkSG8NO/oq3+hEXeuQ6s0rerOxcgxvMt1nzD5j5qMap8riFveOYKW3Ts5T38/nL9at2 2WpEF3v6J71OmKD7p8L12M2Zd4RVlFiKMxINtZiLihMBsgbrDD8CAAA= X-CMS-MailID: 20181017134206eucas1p1ebc76569f706675d41f2d2183349f1f3 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181017134206eucas1p1ebc76569f706675d41f2d2183349f1f3 References: <20181017134159.9656-1-m.szyprowski@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181017_064219_958719_196249B2 X-CRM114-Status: GOOD ( 17.76 ) 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: 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 --- drivers/clocksource/exynos_mct.c | 49 +++++++++++++++++++------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 49413900b24c..02ad55db390b 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 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,14 @@ 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); + ret = exynos4_timer_resources(np); + if (ret) + return ret; - /* - * 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, of_iomap(np, 0)); + ret = exynos4_timer_interrupts(np, int_type); if (ret) return ret;