linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] clk: cs2000: tidyup missing settings
@ 2017-04-18  2:17 Kuninori Morimoto
  2017-04-18  2:18 ` [PATCH 1/3] clk: cs2000: enable clock skipping mode Kuninori Morimoto
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2017-04-18  2:17 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, linux-renesas-soc, linux-kernel, linux-clk


Hi Stephen

These are missing settings for current cs2000.
it is working without these settings, thus, not urgent.
But, necessary for correct/safety operation.

Kuninori Morimoto (3):
  clk: cs2000: enable clock skipping mode
  clk: cs2000: tidyup DEVICE_CFG2 settings
  clk: cs2000: select 12.20 High Accuracy on LFRatioCfg

 drivers/clk/clk-cs2000-cp.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

-- 
1.9.1

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

* [PATCH 1/3] clk: cs2000: enable clock skipping mode
  2017-04-18  2:17 [PATCH 0/3] clk: cs2000: tidyup missing settings Kuninori Morimoto
@ 2017-04-18  2:18 ` Kuninori Morimoto
  2017-04-18  2:19 ` [PATCH 2/3] clk: cs2000: tidyup DEVICE_CFG2 settings Kuninori Morimoto
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2017-04-18  2:18 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-renesas-soc, linux-kernel, linux-clk


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

CLK_IN skipping mode allows the PLL to maintain lock even when the
CLK_IN signal has missing pulses for up to 20 ms (t CS) at a time.
This patch enables it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/clk/clk-cs2000-cp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c
index 4df38c5..a8fa6bd 100644
--- a/drivers/clk/clk-cs2000-cp.c
+++ b/drivers/clk/clk-cs2000-cp.c
@@ -54,6 +54,7 @@
 #define ENDEV2		(0x1)
 
 /* FUNC_CFG1 */
+#define CLKSKIPEN	(1 << 7)
 #define REFCLKDIV(x)	(((x) & 0x3) << 3)
 #define REFCLKDIV_MASK	REFCLKDIV(0x3)
 
@@ -122,6 +123,11 @@ static int cs2000_enable_dev_config(struct cs2000_priv *priv, bool enable)
 	if (ret < 0)
 		return ret;
 
+	ret = cs2000_bset(priv, FUNC_CFG1, CLKSKIPEN,
+			  enable ? CLKSKIPEN : 0);
+	if (ret < 0)
+		return ret;
+
 	return 0;
 }
 
-- 
1.9.1

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

* [PATCH 2/3] clk: cs2000: tidyup DEVICE_CFG2 settings
  2017-04-18  2:17 [PATCH 0/3] clk: cs2000: tidyup missing settings Kuninori Morimoto
  2017-04-18  2:18 ` [PATCH 1/3] clk: cs2000: enable clock skipping mode Kuninori Morimoto
@ 2017-04-18  2:19 ` Kuninori Morimoto
  2017-04-18  2:20 ` [PATCH 3/3] clk: cs2000: select 12.20 High Accuracy on LFRatioCfg Kuninori Morimoto
  2017-04-19 17:19 ` [PATCH 0/3] clk: cs2000: tidyup missing settings Stephen Boyd
  3 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2017-04-18  2:19 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-renesas-soc, linux-kernel, linux-clk


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

DEVICE_CFG2 can select ratio from user defined ratio and LOCKCLK is
for it. But current driver sets fixed 0 value. This patch fixes it.
Note is that current cs2000 driver is using/supporting only ratio0
(= ch0) now.

DEVICE_CFG2 can select STATIC/DYNAMIC ratio mode, and current cs2000
driver is selecting STATIC mode, but it was not understandable on
current code. This patch also solve this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/clk/clk-cs2000-cp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c
index a8fa6bd..f3ab0ca 100644
--- a/drivers/clk/clk-cs2000-cp.c
+++ b/drivers/clk/clk-cs2000-cp.c
@@ -48,7 +48,9 @@
 #define AUTORMOD	(1 << 3)
 #define LOCKCLK(x)	(((x) & 0x3) << 1)
 #define LOCKCLK_MASK	LOCKCLK(0x3)
-#define FRACNSRC	(1 << 0)
+#define FRACNSRC_MASK	(1 << 0)
+#define FRACNSRC_STATIC		(0 << 0)
+#define FRACNSRC_DYNAMIC	(1 << 1)
 
 /* GLOBAL_CFG */
 #define ENDEV2		(0x1)
@@ -267,8 +269,8 @@ static int cs2000_ratio_select(struct cs2000_priv *priv, int ch)
 		return ret;
 
 	ret = cs2000_bset(priv, DEVICE_CFG2,
-			  (AUTORMOD | LOCKCLK_MASK | FRACNSRC),
-			  0);
+			  (AUTORMOD | LOCKCLK_MASK | FRACNSRC_MASK),
+			  (LOCKCLK(ch) | FRACNSRC_STATIC));
 	if (ret < 0)
 		return ret;
 
-- 
1.9.1

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

* [PATCH 3/3] clk: cs2000: select 12.20 High Accuracy on LFRatioCfg
  2017-04-18  2:17 [PATCH 0/3] clk: cs2000: tidyup missing settings Kuninori Morimoto
  2017-04-18  2:18 ` [PATCH 1/3] clk: cs2000: enable clock skipping mode Kuninori Morimoto
  2017-04-18  2:19 ` [PATCH 2/3] clk: cs2000: tidyup DEVICE_CFG2 settings Kuninori Morimoto
@ 2017-04-18  2:20 ` Kuninori Morimoto
  2017-04-19 17:19 ` [PATCH 0/3] clk: cs2000: tidyup missing settings Stephen Boyd
  3 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2017-04-18  2:20 UTC (permalink / raw)
  To: Stephen Boyd, Michael Turquette
  Cc: linux-renesas-soc, linux-kernel, linux-clk


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

cs2000 can select Static/Dynamic ratio based Frequency Synthesizer
Mode, it can select 20.12 High Multiplier interpret for 32-bit
User Defined Ratio if Dynamic ratio mode. Otherwise it should select
12.20 High Accuracy mode.
Current cs2000 is supporting Static ratio mode only, so it should
select 12.20 High Accuracy mode, not 20.12 High Multiplier mode.
This patch fixes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/clk/clk-cs2000-cp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c
index f3ab0ca..c54baed 100644
--- a/drivers/clk/clk-cs2000-cp.c
+++ b/drivers/clk/clk-cs2000-cp.c
@@ -60,6 +60,11 @@
 #define REFCLKDIV(x)	(((x) & 0x3) << 3)
 #define REFCLKDIV_MASK	REFCLKDIV(0x3)
 
+/* FUNC_CFG2 */
+#define LFRATIO_MASK	(1 << 3)
+#define LFRATIO_20_12	(0 << 3)
+#define LFRATIO_12_20	(1 << 3)
+
 #define CH_SIZE_ERR(ch)		((ch < 0) || (ch >= CH_MAX))
 #define hw_to_priv(_hw)		container_of(_hw, struct cs2000_priv, hw)
 #define priv_to_client(priv)	(priv->client)
@@ -130,6 +135,12 @@ static int cs2000_enable_dev_config(struct cs2000_priv *priv, bool enable)
 	if (ret < 0)
 		return ret;
 
+	/* FIXME: for Static ratio mode */
+	ret = cs2000_bset(priv, FUNC_CFG2, LFRATIO_MASK,
+			  LFRATIO_12_20);
+	if (ret < 0)
+		return ret;
+
 	return 0;
 }
 
-- 
1.9.1

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

* Re: [PATCH 0/3] clk: cs2000: tidyup missing settings
  2017-04-18  2:17 [PATCH 0/3] clk: cs2000: tidyup missing settings Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2017-04-18  2:20 ` [PATCH 3/3] clk: cs2000: select 12.20 High Accuracy on LFRatioCfg Kuninori Morimoto
@ 2017-04-19 17:19 ` Stephen Boyd
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2017-04-19 17:19 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Michael Turquette, linux-renesas-soc, linux-kernel, linux-clk

On 04/18, Kuninori Morimoto wrote:
> 
> Hi Stephen
> 
> These are missing settings for current cs2000.
> it is working without these settings, thus, not urgent.
> But, necessary for correct/safety operation.

Thanks. Applied all to clk-next. 

> 
> Kuninori Morimoto (3):
>   clk: cs2000: enable clock skipping mode
>   clk: cs2000: tidyup DEVICE_CFG2 settings
>   clk: cs2000: select 12.20 High Accuracy on LFRatioCfg
> 
>  drivers/clk/clk-cs2000-cp.c | 25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> -- 
> 1.9.1
> 

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

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

end of thread, other threads:[~2017-04-19 17:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18  2:17 [PATCH 0/3] clk: cs2000: tidyup missing settings Kuninori Morimoto
2017-04-18  2:18 ` [PATCH 1/3] clk: cs2000: enable clock skipping mode Kuninori Morimoto
2017-04-18  2:19 ` [PATCH 2/3] clk: cs2000: tidyup DEVICE_CFG2 settings Kuninori Morimoto
2017-04-18  2:20 ` [PATCH 3/3] clk: cs2000: select 12.20 High Accuracy on LFRatioCfg Kuninori Morimoto
2017-04-19 17:19 ` [PATCH 0/3] clk: cs2000: tidyup missing settings Stephen Boyd

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).