All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Magnus Damm <magnus.damm@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: Cong Dang <cong.dang.xn@renesas.com>,
	Duy Nguyen <duy.nguyen.rh@renesas.com>,
	Hai Pham <hai.pham.ud@renesas.com>,
	Linh Phung <linh.phung.jy@renesas.com>,
	linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-pm@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 07/15] clk: renesas: rcar-gen4: Add support for FRQCRC1
Date: Mon,  8 Jan 2024 16:33:46 +0100	[thread overview]
Message-ID: <b7ec45c86c2bd17cf3b3de43194c4821b606e483.1704726960.git.geert+renesas@glider.be> (raw)
In-Reply-To: <cover.1704726960.git.geert+renesas@glider.be>

R-Car V4H and V4M have a second Frequency Control Register C.
Add support for this by treating bit field offsets beyond 31 as
referring to the second register.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Tested by enabling CLOCK_ALLOW_WRITE_DEBUGFS and checking the impact of
CPU core clk rate on CPU core speed on R-Car V4M.
---
 drivers/clk/renesas/rcar-gen4-cpg.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/renesas/rcar-gen4-cpg.c b/drivers/clk/renesas/rcar-gen4-cpg.c
index c68d8b987054131b..a2bbdad021ed8e95 100644
--- a/drivers/clk/renesas/rcar-gen4-cpg.c
+++ b/drivers/clk/renesas/rcar-gen4-cpg.c
@@ -179,7 +179,8 @@ static struct clk * __init cpg_pll_clk_register(const char *name,
  */
 #define CPG_FRQCRB			0x00000804
 #define CPG_FRQCRB_KICK			BIT(31)
-#define CPG_FRQCRC			0x00000808
+#define CPG_FRQCRC0			0x00000808
+#define CPG_FRQCRC1			0x000008e0
 
 struct cpg_z_clk {
 	struct clk_hw hw;
@@ -304,7 +305,12 @@ static struct clk * __init cpg_z_clk_register(const char *name,
 	init.parent_names = &parent_name;
 	init.num_parents = 1;
 
-	zclk->reg = reg + CPG_FRQCRC;
+	if (offset < 32) {
+		zclk->reg = reg + CPG_FRQCRC0;
+	} else {
+		zclk->reg = reg + CPG_FRQCRC1;
+		offset -= 32;
+	}
 	zclk->kick_reg = reg + CPG_FRQCRB;
 	zclk->hw.init = &init;
 	zclk->mask = GENMASK(offset + 4, offset);
-- 
2.34.1


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

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Magnus Damm <magnus.damm@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: Cong Dang <cong.dang.xn@renesas.com>,
	Duy Nguyen <duy.nguyen.rh@renesas.com>,
	Hai Pham <hai.pham.ud@renesas.com>,
	Linh Phung <linh.phung.jy@renesas.com>,
	linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-pm@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 07/15] clk: renesas: rcar-gen4: Add support for FRQCRC1
Date: Mon,  8 Jan 2024 16:33:46 +0100	[thread overview]
Message-ID: <b7ec45c86c2bd17cf3b3de43194c4821b606e483.1704726960.git.geert+renesas@glider.be> (raw)
In-Reply-To: <cover.1704726960.git.geert+renesas@glider.be>

R-Car V4H and V4M have a second Frequency Control Register C.
Add support for this by treating bit field offsets beyond 31 as
referring to the second register.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Tested by enabling CLOCK_ALLOW_WRITE_DEBUGFS and checking the impact of
CPU core clk rate on CPU core speed on R-Car V4M.
---
 drivers/clk/renesas/rcar-gen4-cpg.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/renesas/rcar-gen4-cpg.c b/drivers/clk/renesas/rcar-gen4-cpg.c
index c68d8b987054131b..a2bbdad021ed8e95 100644
--- a/drivers/clk/renesas/rcar-gen4-cpg.c
+++ b/drivers/clk/renesas/rcar-gen4-cpg.c
@@ -179,7 +179,8 @@ static struct clk * __init cpg_pll_clk_register(const char *name,
  */
 #define CPG_FRQCRB			0x00000804
 #define CPG_FRQCRB_KICK			BIT(31)
-#define CPG_FRQCRC			0x00000808
+#define CPG_FRQCRC0			0x00000808
+#define CPG_FRQCRC1			0x000008e0
 
 struct cpg_z_clk {
 	struct clk_hw hw;
@@ -304,7 +305,12 @@ static struct clk * __init cpg_z_clk_register(const char *name,
 	init.parent_names = &parent_name;
 	init.num_parents = 1;
 
-	zclk->reg = reg + CPG_FRQCRC;
+	if (offset < 32) {
+		zclk->reg = reg + CPG_FRQCRC0;
+	} else {
+		zclk->reg = reg + CPG_FRQCRC1;
+		offset -= 32;
+	}
 	zclk->kick_reg = reg + CPG_FRQCRB;
 	zclk->hw.init = &init;
 	zclk->mask = GENMASK(offset + 4, offset);
-- 
2.34.1


  parent reply	other threads:[~2024-01-08 15:34 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-08 15:33 [PATCH 00/15] arm64: renesas: Add R-Car V4M and Gray Hawk Single support Geert Uytterhoeven
2024-01-08 15:33 ` Geert Uytterhoeven
2024-01-08 15:33 ` [PATCH 01/15] dt-bindings: clock: renesas,cpg-mssr: Document R-Car V4M support Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-08 17:49   ` Conor Dooley
2024-01-08 17:49     ` Conor Dooley
2024-01-10 11:59   ` Niklas Söderlund
2024-01-10 11:59     ` Niklas Söderlund
2024-01-24 10:27   ` Wolfram Sang
2024-01-24 10:27     ` Wolfram Sang
2024-01-08 15:33 ` [PATCH 02/15] dt-bindings: clock: Add R8A779H0 V4M CPG Core Clock Definitions Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-09 19:21   ` Krzysztof Kozlowski
2024-01-09 19:21     ` Krzysztof Kozlowski
2024-01-15  9:27     ` Geert Uytterhoeven
2024-01-15  9:27       ` Geert Uytterhoeven
2024-01-15 11:39       ` Krzysztof Kozlowski
2024-01-15 11:39         ` Krzysztof Kozlowski
2024-01-24 10:33         ` Wolfram Sang
2024-01-24 10:33           ` Wolfram Sang
2024-01-10 12:02   ` Niklas Söderlund
2024-01-10 12:02     ` Niklas Söderlund
2024-01-08 15:33 ` [PATCH 03/15] dt-bindings: power: renesas,rcar-sysc: Document R-Car V4M support Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-08 17:53   ` Conor Dooley
2024-01-08 17:53     ` Conor Dooley
2024-01-24 10:35     ` Wolfram Sang
2024-01-24 10:35       ` Wolfram Sang
2024-01-10 12:03   ` Niklas Söderlund
2024-01-10 12:03     ` Niklas Söderlund
2024-01-24 10:33   ` Wolfram Sang
2024-01-24 10:33     ` Wolfram Sang
2024-01-08 15:33 ` [PATCH 04/15] dt-bindings: power: Add r8a779h0 SYSC power domain definitions Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-10 12:04   ` Niklas Söderlund
2024-01-10 12:04     ` Niklas Söderlund
2024-01-08 15:33 ` [PATCH 05/15] dt-bindings: reset: renesas,rst: Document R-Car V4M support Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-08 17:55   ` Conor Dooley
2024-01-08 17:55     ` Conor Dooley
2024-01-10 12:05   ` Niklas Söderlund
2024-01-10 12:05     ` Niklas Söderlund
2024-01-24 10:35   ` Wolfram Sang
2024-01-24 10:35     ` Wolfram Sang
2024-01-08 15:33 ` [PATCH 06/15] dt-bindings: soc: renesas: Document R-Car V4M Gray Hawk Single Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-08 17:54   ` Conor Dooley
2024-01-08 17:54     ` Conor Dooley
2024-01-10 12:10   ` Niklas Söderlund
2024-01-10 12:10     ` Niklas Söderlund
2024-01-24 10:38   ` Wolfram Sang
2024-01-24 10:38     ` Wolfram Sang
2024-01-08 15:33 ` Geert Uytterhoeven [this message]
2024-01-08 15:33   ` [PATCH 07/15] clk: renesas: rcar-gen4: Add support for FRQCRC1 Geert Uytterhoeven
2024-01-10 12:13   ` Niklas Söderlund
2024-01-10 12:13     ` Niklas Söderlund
2024-01-24 10:41   ` Wolfram Sang
2024-01-24 10:41     ` Wolfram Sang
2024-01-08 15:33 ` [PATCH 08/15] clk: renesas: cpg-mssr: Add support for R-Car V4M Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-08 15:33 ` [PATCH 09/15] pmdomain: renesas: r8a779h0-sysc: Add r8a779h0 support Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-15 16:38   ` Ulf Hansson
2024-01-15 16:38     ` Ulf Hansson
2024-01-15 16:59     ` Geert Uytterhoeven
2024-01-15 16:59       ` Geert Uytterhoeven
2024-01-08 15:33 ` [PATCH 10/15] soc: renesas: Introduce ARCH_RCAR_GEN4 Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-24 10:48   ` Wolfram Sang
2024-01-24 10:48     ` Wolfram Sang
2024-01-08 15:33 ` [PATCH 11/15] soc: renesas: Identify R-Car V4M Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-24 10:49   ` Wolfram Sang
2024-01-24 10:49     ` Wolfram Sang
2024-01-08 15:33 ` [PATCH 12/15] soc: renesas: rcar-rst: Add support for " Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-24 10:51   ` Wolfram Sang
2024-01-24 10:51     ` Wolfram Sang
2024-01-08 15:33 ` [PATCH 13/15] arm64: dts: renesas: Add Renesas R8A779H0 SoC support Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-08 15:33 ` [PATCH 14/15] arm64: dts: renesas: Add Gray Hawk Single board support Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-24 10:52   ` Wolfram Sang
2024-01-24 10:52     ` Wolfram Sang
2024-01-08 15:33 ` [PATCH 15/15] arm64: defconfig: Enable R8A779H0 SoC Geert Uytterhoeven
2024-01-08 15:33   ` Geert Uytterhoeven
2024-01-24 10:53   ` Wolfram Sang
2024-01-24 10:53     ` Wolfram Sang

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=b7ec45c86c2bd17cf3b3de43194c4821b606e483.1704726960.git.geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=catalin.marinas@arm.com \
    --cc=cong.dang.xn@renesas.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=duy.nguyen.rh@renesas.com \
    --cc=hai.pham.ud@renesas.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linh.phung.jy@renesas.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=will@kernel.org \
    /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.