2021-11-01 19:37:04

by Sam Protsenko

[permalink] [raw]
Subject: [PATCH 0/2] clocksource: exynos_mct: Enable MCT on ARM64

This is re-submission of Marek Szyprowski patches, which were sent
earlier [1], but weren't applied for some reason. Those two patches look
helpful and benign:

- [PATCH 1/2]: cleanup MCT irqs setting up
- [PATCH 2/2]: enable MCT on ARM64

I'm mostly interested in [PATCH 2/2], which allows one to test MCT on
Exynos850 (architected timer works fine on Exynos850, but it's nice to
have MCT for wakeup and testing too). But cleanup one seems desirable as
well, so sending both.

[PATCH 2/2] commit message was rewritten to provide new reasoning and
background, as original commit message was related to [1] series.

[1] https://patchwork.kernel.org/project/linux-samsung-soc/cover/[email protected]/

Marek Szyprowski (2):
clocksource: exynos_mct: Refactor resources allocation
arm64: platform: Enable Exynos Multi-Core Timer driver

arch/arm64/Kconfig.platforms | 1 +
drivers/clocksource/exynos_mct.c | 50 +++++++++++++++++++-------------
2 files changed, 31 insertions(+), 20 deletions(-)

--
2.30.2


2021-11-01 19:37:04

by Sam Protsenko

[permalink] [raw]
Subject: [PATCH 1/2] clocksource: exynos_mct: Refactor resources allocation

From: Marek Szyprowski <[email protected]>

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 <[email protected]>
Reviewed-by: Chanwoo Choi <[email protected]>
Tested-by: Chanwoo Choi <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Sam Protsenko <[email protected]>
---
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;

--
2.30.2

2021-11-01 19:37:05

by Sam Protsenko

[permalink] [raw]
Subject: [PATCH 2/2] arm64: platform: Enable Exynos Multi-Core Timer driver

From: Marek Szyprowski <[email protected]>

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 <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Chanwoo Choi <[email protected]>
Tested-by: Chanwoo Choi <[email protected]>
Signed-off-by: Sam Protsenko <[email protected]>
---
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
--
2.30.2

2021-11-16 10:25:33

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: (subset) [PATCH 2/2] arm64: platform: Enable Exynos Multi-Core Timer driver

On Mon, 1 Nov 2021 21:35:31 +0200, Sam Protsenko wrote:
> From: Marek Szyprowski <[email protected]>
>
> 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.
>
> [...]

Applied, thanks!

[2/2] arm64: platform: Enable Exynos Multi-Core Timer driver
commit: ddb0fc6f055d12518b724fd1ee00669e07f03b96

Best regards,
--
Krzysztof Kozlowski <[email protected]>

2021-11-16 16:00:41

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH 1/2] clocksource: exynos_mct: Refactor resources allocation

On 01/11/2021 20:35, Sam Protsenko wrote:
> From: Marek Szyprowski <[email protected]>
>
> 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 <[email protected]>
> Reviewed-by: Chanwoo Choi <[email protected]>
> Tested-by: Chanwoo Choi <[email protected]>
> Reviewed-by: Krzysztof Kozlowski <[email protected]>
> Signed-off-by: Sam Protsenko <[email protected]>
> ---

Applied, thx

[ ... ]

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

2021-11-23 13:29:05

by Sam Protsenko

[permalink] [raw]
Subject: Re: [PATCH 1/2] clocksource: exynos_mct: Refactor resources allocation

On Tue, 16 Nov 2021 at 18:00, Daniel Lezcano <[email protected]> wrote:
>
> On 01/11/2021 20:35, Sam Protsenko wrote:
> > From: Marek Szyprowski <[email protected]>
> >
> > 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 <[email protected]>
> > Reviewed-by: Chanwoo Choi <[email protected]>
> > Tested-by: Chanwoo Choi <[email protected]>
> > Reviewed-by: Krzysztof Kozlowski <[email protected]>
> > Signed-off-by: Sam Protsenko <[email protected]>
> > ---
>
> Applied, thx
>

Hi Daniel,

Can you please let me know the URL for your tree where you applied
this one? I checked [1] and linux-next, but this patch seems nowhere
to be found.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/daniel.lezcano/linux.git/

Thanks!

> [ ... ]
>
> --
> <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
>
> Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog

2021-11-23 13:32:27

by Sam Protsenko

[permalink] [raw]
Subject: Re: (subset) [PATCH 2/2] arm64: platform: Enable Exynos Multi-Core Timer driver

On Tue, 16 Nov 2021 at 12:24, Krzysztof Kozlowski
<[email protected]> wrote:
>
> On Mon, 1 Nov 2021 21:35:31 +0200, Sam Protsenko wrote:
> > From: Marek Szyprowski <[email protected]>
> >
> > 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.
> >
> > [...]
>
> Applied, thanks!
>
> [2/2] arm64: platform: Enable Exynos Multi-Core Timer driver
> commit: ddb0fc6f055d12518b724fd1ee00669e07f03b96
>

Hi Krzysztof,

Can you please let me know where exactly this one is applied? I've
checked your tree and linux-next, but wasn't able to find it.

Thanks!

> Best regards,
> --
> Krzysztof Kozlowski <[email protected]>

2021-11-23 14:33:09

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: (subset) [PATCH 2/2] arm64: platform: Enable Exynos Multi-Core Timer driver

On 23/11/2021 14:32, Sam Protsenko wrote:
> On Tue, 16 Nov 2021 at 12:24, Krzysztof Kozlowski
> <[email protected]> wrote:
>>
>> On Mon, 1 Nov 2021 21:35:31 +0200, Sam Protsenko wrote:
>>> From: Marek Szyprowski <[email protected]>
>>>
>>> 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.
>>>
>>> [...]
>>
>> Applied, thanks!
>>
>> [2/2] arm64: platform: Enable Exynos Multi-Core Timer driver
>> commit: ddb0fc6f055d12518b724fd1ee00669e07f03b96
>>
>
> Hi Krzysztof,
>
> Can you please let me know where exactly this one is applied? I've
> checked your tree and linux-next, but wasn't able to find it.
>


It's in my tree. It should be also in linux-next since it was applied a
week ago. Commit msg seems valid.

Best regards,
Krzysztof

Subject: [tip: timers/core] clocksource/drivers/exynos_mct: Refactor resources allocation

The following commit has been merged into the timers/core branch of tip:

Commit-ID: 7cd925a8823d16de5614d3f0aabea9948747accd
Gitweb: https://git.kernel.org/tip/7cd925a8823d16de5614d3f0aabea9948747accd
Author: Marek Szyprowski <[email protected]>
AuthorDate: Mon, 01 Nov 2021 21:35:30 +02:00
Committer: Daniel Lezcano <[email protected]>
CommitterDate: Tue, 16 Nov 2021 16:12:00 +01:00

clocksource/drivers/exynos_mct: Refactor resources allocation

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 <[email protected]>
Reviewed-by: Chanwoo Choi <[email protected]>
Tested-by: Chanwoo Choi <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Sam Protsenko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Daniel Lezcano <[email protected]>
---
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 5e3e96d..857cf12 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 @@ out_irq:

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;