All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: <krzk@kernel.org>, <tglx@linutronix.de>, <daniel.lezcano@linaro.org>
Cc: <kernel@axis.com>,
	Vincent Whitchurch <vincent.whitchurch@axis.com>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-samsung-soc@vger.kernel.org>, <alim.akhtar@samsung.com>,
	<devicetree@vger.kernel.org>, <robh+dt@kernel.org>
Subject: [PATCH v3 2/4] clocksource/drivers/exynos_mct: Support frc-shared property
Date: Thu, 7 Apr 2022 09:44:30 +0200	[thread overview]
Message-ID: <20220407074432.424578-3-vincent.whitchurch@axis.com> (raw)
In-Reply-To: <20220407074432.424578-1-vincent.whitchurch@axis.com>

When the FRC is shared with another main processor, the other processor
is assumed to have started it and this processor should not write to the
global registers.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---

Notes:
    v3:
    - Split FRC sharing handling from local timer indices handling
    - Remove addition of global variable.

 drivers/clocksource/exynos_mct.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index f29c812b70c9..12023831dedf 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -233,9 +233,16 @@ static cycles_t exynos4_read_current_timer(void)
 }
 #endif
 
-static int __init exynos4_clocksource_init(void)
+static int __init exynos4_clocksource_init(bool frc_shared)
 {
-	exynos4_mct_frc_start();
+	/*
+	 * When the frc is shared, the main processer should have already
+	 * turned it on and we shouldn't be writing to TCON.
+	 */
+	if (frc_shared)
+		mct_frc.resume = NULL;
+	else
+		exynos4_mct_frc_start();
 
 #if defined(CONFIG_ARM)
 	exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer;
@@ -605,6 +612,7 @@ static int __init exynos4_timer_interrupts(struct device_node *np,
 
 static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
 {
+	bool frc_shared = of_property_read_bool(np, "samsung,frc-shared");
 	int ret;
 
 	ret = exynos4_timer_resources(np);
@@ -615,10 +623,17 @@ static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
 	if (ret)
 		return ret;
 
-	ret = exynos4_clocksource_init();
+	ret = exynos4_clocksource_init(frc_shared);
 	if (ret)
 		return ret;
 
+	/*
+	 * When the FRC is shared with a main processor, this secondary
+	 * processor cannot use the global comparator.
+	 */
+	if (frc_shared)
+		return ret;
+
 	return exynos4_clockevent_init();
 }
 
-- 
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: <krzk@kernel.org>, <tglx@linutronix.de>, <daniel.lezcano@linaro.org>
Cc: <kernel@axis.com>,
	Vincent Whitchurch <vincent.whitchurch@axis.com>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-samsung-soc@vger.kernel.org>, <alim.akhtar@samsung.com>,
	<devicetree@vger.kernel.org>, <robh+dt@kernel.org>
Subject: [PATCH v3 2/4] clocksource/drivers/exynos_mct: Support frc-shared property
Date: Thu, 7 Apr 2022 09:44:30 +0200	[thread overview]
Message-ID: <20220407074432.424578-3-vincent.whitchurch@axis.com> (raw)
In-Reply-To: <20220407074432.424578-1-vincent.whitchurch@axis.com>

When the FRC is shared with another main processor, the other processor
is assumed to have started it and this processor should not write to the
global registers.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---

Notes:
    v3:
    - Split FRC sharing handling from local timer indices handling
    - Remove addition of global variable.

 drivers/clocksource/exynos_mct.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index f29c812b70c9..12023831dedf 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -233,9 +233,16 @@ static cycles_t exynos4_read_current_timer(void)
 }
 #endif
 
-static int __init exynos4_clocksource_init(void)
+static int __init exynos4_clocksource_init(bool frc_shared)
 {
-	exynos4_mct_frc_start();
+	/*
+	 * When the frc is shared, the main processer should have already
+	 * turned it on and we shouldn't be writing to TCON.
+	 */
+	if (frc_shared)
+		mct_frc.resume = NULL;
+	else
+		exynos4_mct_frc_start();
 
 #if defined(CONFIG_ARM)
 	exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer;
@@ -605,6 +612,7 @@ static int __init exynos4_timer_interrupts(struct device_node *np,
 
 static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
 {
+	bool frc_shared = of_property_read_bool(np, "samsung,frc-shared");
 	int ret;
 
 	ret = exynos4_timer_resources(np);
@@ -615,10 +623,17 @@ static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
 	if (ret)
 		return ret;
 
-	ret = exynos4_clocksource_init();
+	ret = exynos4_clocksource_init(frc_shared);
 	if (ret)
 		return ret;
 
+	/*
+	 * When the FRC is shared with a main processor, this secondary
+	 * processor cannot use the global comparator.
+	 */
+	if (frc_shared)
+		return ret;
+
 	return exynos4_clockevent_init();
 }
 
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-04-07  7:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07  7:44 [PATCH v3 0/4] clocksource: Add MCT support for ARTPEC-8 Vincent Whitchurch
2022-04-07  7:44 ` Vincent Whitchurch
2022-04-07  7:44 ` [PATCH v3 1/4] dt-bindings: timer: exynos4210-mct: Add ARTPEC-8 MCT support Vincent Whitchurch
2022-04-07  7:44   ` Vincent Whitchurch
2022-04-07 15:04   ` Rob Herring
2022-04-07 15:04     ` Rob Herring
2022-04-08  6:58     ` Vincent Whitchurch
2022-04-08  6:58       ` Vincent Whitchurch
2022-04-08  7:16   ` Krzysztof Kozlowski
2022-04-08  7:16     ` Krzysztof Kozlowski
2022-04-07  7:44 ` Vincent Whitchurch [this message]
2022-04-07  7:44   ` [PATCH v3 2/4] clocksource/drivers/exynos_mct: Support frc-shared property Vincent Whitchurch
2022-04-08  7:17   ` Krzysztof Kozlowski
2022-04-08  7:17     ` Krzysztof Kozlowski
2022-04-07  7:44 ` [PATCH v3 3/4] clocksource/drivers/exynos_mct: Support local-timers property Vincent Whitchurch
2022-04-07  7:44   ` Vincent Whitchurch
2022-04-08  8:02   ` Krzysztof Kozlowski
2022-04-08  8:02     ` Krzysztof Kozlowski
2022-04-07  7:44 ` [PATCH v3 4/4] clocksource/drivers/exynos_mct: Enable building on ARTPEC Vincent Whitchurch
2022-04-07  7:44   ` Vincent Whitchurch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220407074432.424578-3-vincent.whitchurch@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=alim.akhtar@samsung.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@axis.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.