linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drivers: qcom: Add BCM vote macro to header
@ 2019-08-05 20:33 Jordan Crouse
  2019-08-07 23:42 ` Stephen Boyd
  2019-08-19 16:50 ` Bjorn Andersson
  0 siblings, 2 replies; 7+ messages in thread
From: Jordan Crouse @ 2019-08-05 20:33 UTC (permalink / raw)
  To: freedreno
  Cc: linux-arm-msm, Michael Turquette, linux-pm, Stephen Boyd,
	linux-kernel, Andy Gross, Georgi Djakov, linux-clk

The macro to generate a Bus Controller Manager (BCM) TCS command is used
by the interconnect driver but might also be interesting to other
drivers that need to construct TCS commands for sub processors so move
it out of the sdm845 specific file and into the header.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
---

Changes in v2:
- Replace a similar BCS_TCS_CMD macro in clk-rpmh.c with the generic one

 drivers/clk/qcom/clk-rpmh.c        | 16 +++-------------
 drivers/interconnect/qcom/sdm845.c | 19 +------------------
 include/soc/qcom/tcs.h             | 21 ++++++++++++++++++++-
 3 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index c3fd632..a32bfae 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/clk-provider.h>
@@ -12,23 +12,13 @@
 #include <linux/platform_device.h>
 #include <soc/qcom/cmd-db.h>
 #include <soc/qcom/rpmh.h>
+#include <soc/qcom/tcs.h>
 
 #include <dt-bindings/clock/qcom,rpmh.h>
 
 #define CLK_RPMH_ARC_EN_OFFSET		0
 #define CLK_RPMH_VRM_EN_OFFSET		4
 
-#define BCM_TCS_CMD_COMMIT_MASK		0x40000000
-#define BCM_TCS_CMD_VALID_SHIFT		29
-#define BCM_TCS_CMD_VOTE_MASK		0x3fff
-#define BCM_TCS_CMD_VOTE_SHIFT		0
-
-#define BCM_TCS_CMD(valid, vote)				\
-	(BCM_TCS_CMD_COMMIT_MASK |				\
-	((valid) << BCM_TCS_CMD_VALID_SHIFT) |			\
-	((vote & BCM_TCS_CMD_VOTE_MASK)				\
-	<< BCM_TCS_CMD_VOTE_SHIFT))
-
 /**
  * struct bcm_db - Auxiliary data pertaining to each Bus Clock Manager(BCM)
  * @unit: divisor used to convert Hz value to an RPMh msg
@@ -269,7 +259,7 @@ static int clk_rpmh_bcm_send_cmd(struct clk_rpmh *c, bool enable)
 	}
 
 	cmd.addr = c->res_addr;
-	cmd.data = BCM_TCS_CMD(enable, cmd_state);
+	cmd.data = BCM_TCS_CMD(1, enable, 0, cmd_state);
 
 	ret = rpmh_write_async(c->dev, RPMH_ACTIVE_ONLY_STATE, &cmd, 1);
 	if (ret) {
diff --git a/drivers/interconnect/qcom/sdm845.c b/drivers/interconnect/qcom/sdm845.c
index 4915b78..2181170 100644
--- a/drivers/interconnect/qcom/sdm845.c
+++ b/drivers/interconnect/qcom/sdm845.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  *
  */
 
@@ -20,23 +20,6 @@
 #include <soc/qcom/rpmh.h>
 #include <soc/qcom/tcs.h>
 
-#define BCM_TCS_CMD_COMMIT_SHFT		30
-#define BCM_TCS_CMD_COMMIT_MASK		0x40000000
-#define BCM_TCS_CMD_VALID_SHFT		29
-#define BCM_TCS_CMD_VALID_MASK		0x20000000
-#define BCM_TCS_CMD_VOTE_X_SHFT		14
-#define BCM_TCS_CMD_VOTE_MASK		0x3fff
-#define BCM_TCS_CMD_VOTE_Y_SHFT		0
-#define BCM_TCS_CMD_VOTE_Y_MASK		0xfffc000
-
-#define BCM_TCS_CMD(commit, valid, vote_x, vote_y)		\
-	(((commit) << BCM_TCS_CMD_COMMIT_SHFT) |		\
-	((valid) << BCM_TCS_CMD_VALID_SHFT) |			\
-	((cpu_to_le32(vote_x) &					\
-	BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_X_SHFT) |	\
-	((cpu_to_le32(vote_y) &					\
-	BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_Y_SHFT))
-
 #define to_qcom_provider(_provider) \
 	container_of(_provider, struct qcom_icc_provider, provider)
 
diff --git a/include/soc/qcom/tcs.h b/include/soc/qcom/tcs.h
index 262876a..dbf3c88 100644
--- a/include/soc/qcom/tcs.h
+++ b/include/soc/qcom/tcs.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
  */
 
 #ifndef __SOC_QCOM_TCS_H__
@@ -53,4 +53,23 @@ struct tcs_request {
 	struct tcs_cmd *cmds;
 };
 
+#define BCM_TCS_CMD_COMMIT_SHFT		30
+#define BCM_TCS_CMD_COMMIT_MASK		0x40000000
+#define BCM_TCS_CMD_VALID_SHFT		29
+#define BCM_TCS_CMD_VALID_MASK		0x20000000
+#define BCM_TCS_CMD_VOTE_X_SHFT		14
+#define BCM_TCS_CMD_VOTE_MASK		0x3fff
+#define BCM_TCS_CMD_VOTE_Y_SHFT		0
+#define BCM_TCS_CMD_VOTE_Y_MASK		0xfffc000
+
+/* Construct a Bus Clock Manager (BCM) specific TCS command */
+#define BCM_TCS_CMD(commit, valid, vote_x, vote_y)		\
+	(((commit) << BCM_TCS_CMD_COMMIT_SHFT) |		\
+	((valid) << BCM_TCS_CMD_VALID_SHFT) |			\
+	((cpu_to_le32(vote_x) &					\
+	BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_X_SHFT) |	\
+	((cpu_to_le32(vote_y) &					\
+	BCM_TCS_CMD_VOTE_MASK) << BCM_TCS_CMD_VOTE_Y_SHFT))
+
+
 #endif /* __SOC_QCOM_TCS_H__ */
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drivers: qcom: Add BCM vote macro to header
  2019-08-05 20:33 [PATCH v2] drivers: qcom: Add BCM vote macro to header Jordan Crouse
@ 2019-08-07 23:42 ` Stephen Boyd
  2019-08-13 18:47   ` Jordan Crouse
  2019-08-19 16:52   ` Bjorn Andersson
  2019-08-19 16:50 ` Bjorn Andersson
  1 sibling, 2 replies; 7+ messages in thread
From: Stephen Boyd @ 2019-08-07 23:42 UTC (permalink / raw)
  To: Jordan Crouse, freedreno
  Cc: linux-arm-msm, Michael Turquette, linux-pm, linux-kernel,
	Andy Gross, Georgi Djakov, linux-clk, Taniya Das

Quoting Jordan Crouse (2019-08-05 13:33:46)
> The macro to generate a Bus Controller Manager (BCM) TCS command is used
> by the interconnect driver but might also be interesting to other
> drivers that need to construct TCS commands for sub processors so move
> it out of the sdm845 specific file and into the header.
> 
> Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> ---

Acked-by: Stephen Boyd <sboyd@kernel.org>

Unless this is supposed to be applied by me?

BTW, I wonder why we need an rpm clk driver much at all nowadays, except
maybe for the XO clk state. The big user, from what I can tell, is the
interconnect driver and we don't use any of the features of the clk
framework besides the API to set a frequency. Maybe it would be better
to just push push the bus frequency logic into interconnect code, then
XO clk is the only thing we need to keep, and it can be a simple on/off
thing.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drivers: qcom: Add BCM vote macro to header
  2019-08-07 23:42 ` Stephen Boyd
@ 2019-08-13 18:47   ` Jordan Crouse
  2019-08-13 20:09     ` Stephen Boyd
  2019-08-19 16:52   ` Bjorn Andersson
  1 sibling, 1 reply; 7+ messages in thread
From: Jordan Crouse @ 2019-08-13 18:47 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: freedreno, linux-arm-msm, Michael Turquette, linux-pm,
	linux-kernel, Andy Gross, Georgi Djakov, linux-clk, Taniya Das

On Wed, Aug 07, 2019 at 04:42:31PM -0700, Stephen Boyd wrote:
> Quoting Jordan Crouse (2019-08-05 13:33:46)
> > The macro to generate a Bus Controller Manager (BCM) TCS command is used
> > by the interconnect driver but might also be interesting to other
> > drivers that need to construct TCS commands for sub processors so move
> > it out of the sdm845 specific file and into the header.
> > 
> > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > ---
> 
> Acked-by: Stephen Boyd <sboyd@kernel.org>
> 
> Unless this is supposed to be applied by me?

I figured this landed in Bjorn's domain, but you guys can fight it out if you
want.

Jordan

> BTW, I wonder why we need an rpm clk driver much at all nowadays, except
> maybe for the XO clk state. The big user, from what I can tell, is the
> interconnect driver and we don't use any of the features of the clk
> framework besides the API to set a frequency. Maybe it would be better
> to just push push the bus frequency logic into interconnect code, then
> XO clk is the only thing we need to keep, and it can be a simple on/off
> thing.
> 

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drivers: qcom: Add BCM vote macro to header
  2019-08-13 18:47   ` Jordan Crouse
@ 2019-08-13 20:09     ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2019-08-13 20:09 UTC (permalink / raw)
  To: Jordan Crouse
  Cc: freedreno, linux-arm-msm, Michael Turquette, linux-pm,
	linux-kernel, Andy Gross, Georgi Djakov, linux-clk, Taniya Das

Quoting Jordan Crouse (2019-08-13 11:47:17)
> On Wed, Aug 07, 2019 at 04:42:31PM -0700, Stephen Boyd wrote:
> > Quoting Jordan Crouse (2019-08-05 13:33:46)
> > > The macro to generate a Bus Controller Manager (BCM) TCS command is used
> > > by the interconnect driver but might also be interesting to other
> > > drivers that need to construct TCS commands for sub processors so move
> > > it out of the sdm845 specific file and into the header.
> > > 
> > > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > > ---
> > 
> > Acked-by: Stephen Boyd <sboyd@kernel.org>
> > 
> > Unless this is supposed to be applied by me?
> 
> I figured this landed in Bjorn's domain, but you guys can fight it out if you
> want.
> 

Ok. I'm happy to avoid the fight!


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drivers: qcom: Add BCM vote macro to header
  2019-08-05 20:33 [PATCH v2] drivers: qcom: Add BCM vote macro to header Jordan Crouse
  2019-08-07 23:42 ` Stephen Boyd
@ 2019-08-19 16:50 ` Bjorn Andersson
  1 sibling, 0 replies; 7+ messages in thread
From: Bjorn Andersson @ 2019-08-19 16:50 UTC (permalink / raw)
  To: Jordan Crouse
  Cc: freedreno, linux-arm-msm, Michael Turquette, linux-pm,
	Stephen Boyd, linux-kernel, Andy Gross, Georgi Djakov, linux-clk

On Mon 05 Aug 13:33 PDT 2019, Jordan Crouse wrote:

> The macro to generate a Bus Controller Manager (BCM) TCS command is used
> by the interconnect driver but might also be interesting to other
> drivers that need to construct TCS commands for sub processors so move
> it out of the sdm845 specific file and into the header.
> 
> Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>

(Discussed with Georgi, he will pick the patch)

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drivers: qcom: Add BCM vote macro to header
  2019-08-07 23:42 ` Stephen Boyd
  2019-08-13 18:47   ` Jordan Crouse
@ 2019-08-19 16:52   ` Bjorn Andersson
  2019-08-19 18:26     ` Stephen Boyd
  1 sibling, 1 reply; 7+ messages in thread
From: Bjorn Andersson @ 2019-08-19 16:52 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Jordan Crouse, freedreno, linux-arm-msm, Michael Turquette,
	linux-pm, linux-kernel, Andy Gross, Georgi Djakov, linux-clk,
	Taniya Das

On Wed 07 Aug 16:42 PDT 2019, Stephen Boyd wrote:

> Quoting Jordan Crouse (2019-08-05 13:33:46)
> > The macro to generate a Bus Controller Manager (BCM) TCS command is used
> > by the interconnect driver but might also be interesting to other
> > drivers that need to construct TCS commands for sub processors so move
> > it out of the sdm845 specific file and into the header.
> > 
> > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > ---
> 
> Acked-by: Stephen Boyd <sboyd@kernel.org>
> 
> Unless this is supposed to be applied by me?
> 
> BTW, I wonder why we need an rpm clk driver much at all nowadays, except
> maybe for the XO clk state. The big user, from what I can tell, is the
> interconnect driver and we don't use any of the features of the clk
> framework besides the API to set a frequency. Maybe it would be better
> to just push push the bus frequency logic into interconnect code, then
> XO clk is the only thing we need to keep, and it can be a simple on/off
> thing.
> 

There's been a number of cases where we'll need to enable the buffered
XOs, but perhaps these are handled by other subsystems these days(?)

If so the one case that remains would be the operation of explicitly
holding CXO enabled during operations such as booting the remoteprocs.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drivers: qcom: Add BCM vote macro to header
  2019-08-19 16:52   ` Bjorn Andersson
@ 2019-08-19 18:26     ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2019-08-19 18:26 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Jordan Crouse, freedreno, linux-arm-msm, Michael Turquette,
	linux-pm, linux-kernel, Andy Gross, Georgi Djakov, linux-clk,
	Taniya Das

Quoting Bjorn Andersson (2019-08-19 09:52:55)
> On Wed 07 Aug 16:42 PDT 2019, Stephen Boyd wrote:
> 
> > Quoting Jordan Crouse (2019-08-05 13:33:46)
> > > The macro to generate a Bus Controller Manager (BCM) TCS command is used
> > > by the interconnect driver but might also be interesting to other
> > > drivers that need to construct TCS commands for sub processors so move
> > > it out of the sdm845 specific file and into the header.
> > > 
> > > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > > ---
> > 
> > Acked-by: Stephen Boyd <sboyd@kernel.org>
> > 
> > Unless this is supposed to be applied by me?
> > 
> > BTW, I wonder why we need an rpm clk driver much at all nowadays, except
> > maybe for the XO clk state. The big user, from what I can tell, is the
> > interconnect driver and we don't use any of the features of the clk
> > framework besides the API to set a frequency. Maybe it would be better
> > to just push push the bus frequency logic into interconnect code, then
> > XO clk is the only thing we need to keep, and it can be a simple on/off
> > thing.
> > 
> 
> There's been a number of cases where we'll need to enable the buffered
> XOs, but perhaps these are handled by other subsystems these days(?)
> 
> If so the one case that remains would be the operation of explicitly
> holding CXO enabled during operations such as booting the remoteprocs.
> 

Yes I think the XO (and the buffers) is the only thing that we really
seem to care about for the clk tree. Otherwise, the sole user is
interconnect code and thus handling it in the rpmh clk driver doesn't
really gain us anything. In fact, it just makes it worse because it ties
the clk tree up with things that could take a while to process on the
RPM side.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-19 18:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05 20:33 [PATCH v2] drivers: qcom: Add BCM vote macro to header Jordan Crouse
2019-08-07 23:42 ` Stephen Boyd
2019-08-13 18:47   ` Jordan Crouse
2019-08-13 20:09     ` Stephen Boyd
2019-08-19 16:52   ` Bjorn Andersson
2019-08-19 18:26     ` Stephen Boyd
2019-08-19 16:50 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).