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: 149069 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp674437lji; Wed, 17 Oct 2018 06:42:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV63p7G399sn8UsEeu1uneAW4nPGSnD3jXtwUAMoiCwhs3Dx3wCalq4vLWqxY9HUKbTdhvSAZ X-Received: by 2002:a63:f501:: with SMTP id w1-v6mr23370372pgh.336.1539783762812; Wed, 17 Oct 2018 06:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539783762; cv=none; d=google.com; s=arc-20160816; b=KKolPasicWvwy5D7ej0kHCRrxACugCRYOUpngWyoukrnMqhb+0daHB9degfnI4U/L8 tYG7nTBPbuG/qk4MGAKcNw0ro6SwVgqiU/0skXejZs+/TVznQ+mH1m0qdCGOqYREYxh2 2hYbv9JWhTv8foyIKuchCOdadfXQCytnFTCL2R20phs4K3LL4FMH/NCAhP8N/970oQZ4 SfsBcapI3JGHgEwtltIWay3fwrDsouujWumWSrMbV6O9p6cYVXXiXeY3h7j4HMBD4C9/ q0XPIdI4pHyji43BMLytM9pEW23S4m5USdwwaeZsFo4XDAsz4ToWEB+sc5BxLdfhs5BL xCFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=oel99Mp9meQQ4+STkZabHx/+KTVTtlGBaiezJPYNJsY=; b=uC/BVQY1Y7lWeQcwyi/wL+O4MLA27D8cqdHUEcLQafslsh1txbBXByYE0Pp55U5A86 DieNccUjxbKNjMw8mL7gML3vf/m2MzgNtSrHJrjg0VKfQkRCaeLfwli6P16hRkRQnx5m nhbNbAGqg/S0KFN0FC5uLQWsiRuXdllFPSQWbtbXFXDlLYtFzuGZrsmzGacTHwG1bx3z IKsZVdu3vt4Edzq/tEZVugJcPXeN5/BdpTGFe/jsOzZZvvX+KHIsxIQlmc+5wsx9sF40 07wKKMMtUe3n00Wq15D+ZWAaQLD2aVrmEF9NLhR+d0JSHTDkFVJDjQf16xtQDS7QNeu+ /oZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kQqw06VZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1-v6si7296708plb.292.2018.10.17.06.42.35; Wed, 17 Oct 2018 06:42:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kQqw06VZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727579AbeJQViI (ORCPT + 32 others); Wed, 17 Oct 2018 17:38:08 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:37386 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726727AbeJQVhy (ORCPT ); Wed, 17 Oct 2018 17:37:54 -0400 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 Cc: Marek Szyprowski , Will Deacon , Catalin Marinas , Marc Zyngier , Thomas Gleixner , Daniel Lezcano , Krzysztof Kozlowski , Chanwoo Choi , Bartlomiej Zolnierkiewicz , Inki Dae 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 WfqmhaltaZk1Hf6ZGmbhf885h4qahjMENQVtMLFYEQoluqyEtJyn7z4Pz+fh+/A8BCKdRgOJ dG0Oo9Oq1HJMjNrHNiZDw6KcyjOeWhHVZekQUitNJYCa//lNSFm9wVT5YhlKTU114hTnmRNS s301GGWZGhRQbe8WcGrTvYVR3ZwZoZZWx9EYCd1qbQU012zEaPfcAEb/mJzE6e7G+/QTWzOg vdzRePyWOCqFUafnMrqw6GRx2p+VDiy7FN57OF0lMIB5mQmICEiegzMFy7gJiAkp+QZAS+8a 4AsvgP3GNnTPWiqeQPhGE4AVQy92LYMAjj7bxH0WRoZD03cT5mN/MhMaPZ+AjxHyJQKHx3by ZGQ87GlvR3yMkseh4YFtx5GQUfCL3Szg047Bls7hbYcgROQl2PY035cFyQEM1s0U7250BZps rwDPMrjstOE8H4Gzzx+j/EABgMWWKpwvSgDsqXFgvBUJR50fhPx2B2C5vXInDZIS+KhIyis0 dLsNu4cpA9Db4hKWgcP1wK8ZBDB6VpPKsOFa5q6CVWlYvTZVcSdLw4HtP09sOdccYH3m9ggg CSDfL3EcGlNKhapcNk8zAiCByP0l+SFOpVSSosrLZ3RZSTq9mmFHQBCBygMkTdYupZRMVeUw mQyTzej2ugJCFGgAjTfro8nYzx8zBvHr/aGxlHuw8pc5A9movigraGl37Yv42xBx1c//vc16 4qSlPuhgokuBLMw6GsSrOcnGosK4a63uxLh1k+eGi7NVvw4JLE8u1L4F58cV/5J6YtI9CaFc 6ZClYlRtDr7wW3+5q84e2Xe6t/us+WstsShNGEblKJumCj+F6FjVf3G8cCzjAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDLMWRmVeSWpSXmKPExsVy+t/xa7p6NsejDToalCw2zljPavF+WQ+j xfUvz1kt5n2WtZh0fwKLxfnzG9gtNj2+xmpxedccNosZ5/cxWaw9cpfd4u+df2wWmzdNZbZ4 +fEEiwOvx5p5axg9Nq3qZPO4c20Pm8e7c+fYPTYvqffo27KK0ePzJrkA9igum5TUnMyy1CJ9 uwSujB/v17MV9EpUtFyYxdTAeF24i5GTQ0LAROJl+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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/clocksource/exynos_mct.c | 49 +++++++++++++++++++------------- 1 file changed, 30 insertions(+), 19 deletions(-) -- 2.17.1 Reviewed-by: Chanwoo Choi Tested-by: Chanwoo Choi 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;