From patchwork Mon Nov 1 19:35:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12597131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEC89C433EF for ; Mon, 1 Nov 2021 19:35:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF13060FC4 for ; Mon, 1 Nov 2021 19:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbhKATiO (ORCPT ); Mon, 1 Nov 2021 15:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbhKATiJ (ORCPT ); Mon, 1 Nov 2021 15:38:09 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2AA3C061767 for ; Mon, 1 Nov 2021 12:35:35 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id f8so46352185edy.4 for ; Mon, 01 Nov 2021 12:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wrNTYnU5dJFmytnZGsgc4/jUdnhKUI+zJ+eIyY+oL2E=; b=rnJus9960Pg11/s7R96Y5kDBk2JWNu5m9t/hd9pG2GmTIF8McsTZCBAP0xyEpYtrLF 1rpMUgAvicPPP+LFJdYvs6oh5JAU8fruueXFBttNRffG4f0R2mQnBDnhLgaYcvPQALDM Kr+gCYHC7zB/HLdry02QMo39np614hlKoCXLDSBQTye8nhGroN8h/wIJ2GKgG+WjsiOj V0NI50gL+T5vwNppI962yvOI9OwRjua1f8iguGpEhmzj4tkEf8AAOEX4hMiHEjXuzkhZ szacIxt5tZCqUY/5y8qiVYsJPZEebzLHzvw3FrKvRzKx+6aMXBYD0y8e2zArnknusIoS D9PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wrNTYnU5dJFmytnZGsgc4/jUdnhKUI+zJ+eIyY+oL2E=; b=pDvJ9nBg4O/ZONdy5XOJSVsfKHY/7l4V91RokqsBV7/RKTaodDGVQbip5zBOldcwfj JGL7UuseT3JOh7VP+suF4NotXOY19CxG/g18jvk+h5RUov2TBaNqRJ3ak2rkPZd19ccO sthnmoEs78doh7jz58M5KixGgwHGOGOEglsbhz2y47MXaQil+KNZFeweaKavylA/8hQx bln9tJ7J4AdzO7nZL9fo+DPGILCeQq7o6bczY/AhcIhQwLcadtj1w8/crVj8b31sx7qX XU3lZDJ0UjrcLhf241wELDEGknk//Kk0aZt0wXuFwLTsFQB1yJwmjGO23+FrT7FShx+M Pl7g== X-Gm-Message-State: AOAM532RDPntdMjdXCMEYH81v41uJ81HaRRiTTEfgPZ+mGUhxgd+ylXx 1bdd+BnQaHGZ8zvVoMsrJmxWww== X-Google-Smtp-Source: ABdhPJzNlTjfMObhgw4jZTyMJ+GtHPE5TorD33wLu6FC0OwZlKsSw0OsCM6bLUBGF6xNnnN3t1CVnA== X-Received: by 2002:a17:906:6849:: with SMTP id a9mr34358753ejs.370.1635795334570; Mon, 01 Nov 2021 12:35:34 -0700 (PDT) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id i6sm7163043ejd.57.2021.11.01.12.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 12:35:34 -0700 (PDT) From: Sam Protsenko To: Catalin Marinas , Will Deacon , Daniel Lezcano , Thomas Gleixner , Krzysztof Kozlowski Cc: Marek Szyprowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 1/2] clocksource: exynos_mct: Refactor resources allocation Date: Mon, 1 Nov 2021 21:35:30 +0200 Message-Id: <20211101193531.15078-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211101193531.15078-1-semen.protsenko@linaro.org> References: <20211101193531.15078-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Marek Szyprowski 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 Signed-off-by: Sam Protsenko --- 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 5e3e96d3d1b9..857cf12ebe57 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -504,11 +504,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__); @@ -519,9 +522,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) { @@ -581,24 +602,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; From patchwork Mon Nov 1 19:35:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12597129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB72FC433F5 for ; Mon, 1 Nov 2021 19:35:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D426360187 for ; Mon, 1 Nov 2021 19:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbhKATiO (ORCPT ); Mon, 1 Nov 2021 15:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbhKATiL (ORCPT ); Mon, 1 Nov 2021 15:38:11 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B057BC0613B9 for ; Mon, 1 Nov 2021 12:35:37 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id w15so68044515edc.9 for ; Mon, 01 Nov 2021 12:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jJg2E2PZjjgu+8s1D3x+r4IQ/mozouniDkUsuWAbOxQ=; b=wYtr7iadpvUwY/TMc/2Q8HPKNi/z9n/VMDQEK0Cc0nvTIe6jwIoif8ptsdeuAl/DiK FMpHQTB7+3bVpB5IMWJX0E/5LhqTOKkScZNwI2LRBC6TqF+zu6ADbTs/KqtanEue8QlK QarqGB1wZ1333V4wqsg8ycyG1l9IA1vYl19vR+TLdxSCIZ8ZfP91hFgcvTgCpww4HVTq f9yXnnI/9TsrXIJE4Ov50FwA13Q3/LXji5XdIFmqFM6NFwzruO+TIa1BElDZVLhXgg6X HK1ArYqwcb3qB1U48C60BlGGYQN2Xrnnba1Y8RJKgEwLsdN+fhxJOUPvN3Lt7zl17vAi Xw7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jJg2E2PZjjgu+8s1D3x+r4IQ/mozouniDkUsuWAbOxQ=; b=umZkwvacAy3YVZ8PmRlbkUfwr1d17X7JjMlcTzFf8wDuhDfifQVurP2oW5NMh7x2LC JMoFtQhRAfeulPFA2MM3Zp1qltJicDYRwBTlAe85Hbp2d5a6s/hwwc1M0xpzDoPyHUaf n6UC8B5AtfhQO3EdGt3DCvz4gXZYdORZPKA3oDcGgjuWIkKAzfYHNA2NlqiP5NAif/aW NdZ8eoVyGn08z9MxVDL3to47REYrHzL9ffRIUVuTyi1JJT4kPR4RTE7OPqrgKHNljvRa 0QjMoRMJ8iBld7QMM0JTq7xVyWDUJgEtJQCTgHmdUUSHz+5M5khO+NpN65emb1RdHkf3 yLgg== X-Gm-Message-State: AOAM5312kDQ0L4N+NrLthX1vzhfTeD8if4nRqdLcf4Cw1FulnqDzMQf/ Ez6liRV5RHjjnt/Xbctpx7m79Q== X-Google-Smtp-Source: ABdhPJxDe2EhUvzms0LEnj7lbftyQ/puvq2iCIoQ3jxubRDZpjngPJln0CQPd8jLz24nRtLkaC7PzQ== X-Received: by 2002:a17:906:1749:: with SMTP id d9mr38637143eje.178.1635795336283; Mon, 01 Nov 2021 12:35:36 -0700 (PDT) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id pw14sm2336124ejb.108.2021.11.01.12.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 12:35:35 -0700 (PDT) From: Sam Protsenko To: Catalin Marinas , Will Deacon , Daniel Lezcano , Thomas Gleixner , Krzysztof Kozlowski Cc: Marek Szyprowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 2/2] arm64: platform: Enable Exynos Multi-Core Timer driver Date: Mon, 1 Nov 2021 21:35:31 +0200 Message-Id: <20211101193531.15078-3-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211101193531.15078-1-semen.protsenko@linaro.org> References: <20211101193531.15078-1-semen.protsenko@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Marek Szyprowski Some ARM64 Exynos SoCs have MCT timer block, e.g. Exynos850 and Exynos5433. CLKSRC_EXYNOS_MCT option is not visible unless COMPILE_TEST is enabled. Select CLKSRC_EXYNOS_MCT option for ARM64 ARCH_EXYNOS like it's done in arch/arm/mach-exynos/Kconfig, to enable MCT timer support for ARM64 Exynos SoCs. Even though ARM architected timer is available on all ARM64 SoCs, and used for managing timer hardware and clock source events, MCT timer still can be used as a wakeup source, as stated in commitae460fd9164b ("clocksource/drivers/exynos_mct: Prioritise Arm arch timer on arm64"). It's also nice to be able to test available MCT IP-core. Signed-off-by: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski Reviewed-by: Chanwoo Choi Tested-by: Chanwoo Choi Signed-off-by: Sam Protsenko --- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 1aa8b7073218..91f5e9568122 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -89,6 +89,7 @@ config ARCH_BRCMSTB config ARCH_EXYNOS bool "ARMv8 based Samsung Exynos SoC family" select COMMON_CLK_SAMSUNG + select CLKSRC_EXYNOS_MCT select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS select EXYNOS_PMU select PINCTRL