devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] clk: si570: Skip recall NVM into RAM operation
@ 2021-02-05  3:35 Saeed Nowshadi
  2021-02-05  3:35 ` [PATCH 1/2] dt-bindings: clock: si570: Add 'silabs,skip-recall' property Saeed Nowshadi
  2021-02-05  3:35 ` [PATCH 2/2] clk: si570: Skip NVM to RAM recall operation if an optional property is set Saeed Nowshadi
  0 siblings, 2 replies; 6+ messages in thread
From: Saeed Nowshadi @ 2021-02-05  3:35 UTC (permalink / raw)
  To: linux-clk, devicetree; +Cc: mturquette, sboyd, robh+dt, git-dev, Saeed Nowshadi

Silicon Labs' si570 clock driver re-initializes the register space from
non-volatile memory by issuing a 'recall NVM to RAM' operation during
probe(). This operation causes the device to re-calibrate the frequency of
clock out. If the clock is being used while this operation is occurring, a
pause/glitch could be detected on the clock out.  For use cases that the
clock frequency needs to remain consistent from power on, a device tree
optional property is added so the recall operation could be skipped.

Saeed Nowshadi (2):
  dt-bindings: clock: si570: Add 'silabs,skip-recall' property
  clk: si570: Skip NVM to RAM recall operation if an optional property
    is set

 Documentation/devicetree/bindings/clock/silabs,si570.txt |  2 ++
 drivers/clk/clk-si570.c                                  | 16 ++++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

-- 
2.7.4


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

* [PATCH 1/2] dt-bindings: clock: si570: Add 'silabs,skip-recall' property
  2021-02-05  3:35 [PATCH 0/2] clk: si570: Skip recall NVM into RAM operation Saeed Nowshadi
@ 2021-02-05  3:35 ` Saeed Nowshadi
  2021-02-11  0:01   ` Rob Herring
  2021-02-11 20:16   ` Stephen Boyd
  2021-02-05  3:35 ` [PATCH 2/2] clk: si570: Skip NVM to RAM recall operation if an optional property is set Saeed Nowshadi
  1 sibling, 2 replies; 6+ messages in thread
From: Saeed Nowshadi @ 2021-02-05  3:35 UTC (permalink / raw)
  To: linux-clk, devicetree
  Cc: mturquette, sboyd, robh+dt, git-dev, Saeed Nowshadi, Michal Simek

Add an optional property so the driver can skip calling the NVM->RAM
recall operation during probe().

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
---
 Documentation/devicetree/bindings/clock/silabs,si570.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/silabs,si570.txt b/Documentation/devicetree/bindings/clock/silabs,si570.txt
index 901935e..5dda17d 100644
--- a/Documentation/devicetree/bindings/clock/silabs,si570.txt
+++ b/Documentation/devicetree/bindings/clock/silabs,si570.txt
@@ -28,6 +28,8 @@ Optional properties:
  - clock-frequency: Output frequency to generate. This defines the output
 		    frequency set during boot. It can be reprogrammed during
 		    runtime through the common clock framework.
+ - silabs,skip-recall: Do not perform NVM->RAM recall operation. It will rely
+		       on hardware loading of RAM from NVM at power on.
 
 Example:
 	si570: clock-generator@5d {
-- 
2.7.4


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

* [PATCH 2/2] clk: si570: Skip NVM to RAM recall operation if an optional property is set
  2021-02-05  3:35 [PATCH 0/2] clk: si570: Skip recall NVM into RAM operation Saeed Nowshadi
  2021-02-05  3:35 ` [PATCH 1/2] dt-bindings: clock: si570: Add 'silabs,skip-recall' property Saeed Nowshadi
@ 2021-02-05  3:35 ` Saeed Nowshadi
  2021-02-11 20:17   ` Stephen Boyd
  1 sibling, 1 reply; 6+ messages in thread
From: Saeed Nowshadi @ 2021-02-05  3:35 UTC (permalink / raw)
  To: linux-clk, devicetree
  Cc: mturquette, sboyd, robh+dt, git-dev, Saeed Nowshadi, Michal Simek

Recalling NVM data into RAM during probe() initiates a re-calibration of
the clock. If the clock is already in-use, the recall operation can cause
a glitch on the frequency out. At power on, the factory data are loaded
from NVM into RAM by default. If the clock frequency has been changed
since power on, the recall operation can be used to re-initialize the clock
to factory setting.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
---
 drivers/clk/clk-si570.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-si570.c b/drivers/clk/clk-si570.c
index 34b2560..eea5012 100644
--- a/drivers/clk/clk-si570.c
+++ b/drivers/clk/clk-si570.c
@@ -4,7 +4,7 @@
  *
  * Copyright (C) 2010, 2011 Ericsson AB.
  * Copyright (C) 2011 Guenter Roeck.
- * Copyright (C) 2011 - 2013 Xilinx Inc.
+ * Copyright (C) 2011 - 2021 Xilinx Inc.
  *
  * Author: Guenter Roeck <guenter.roeck@ericsson.com>
  *	   Sören Brinkmann <soren.brinkmann@xilinx.com>
@@ -123,14 +123,18 @@ static int si570_get_divs(struct clk_si570 *data, u64 *rfreq,
  * si570_get_defaults() - Get default values
  * @data:	Driver data structure
  * @fout:	Factory frequency output
+ * @skip_recall:	If true, don't recall NVM into RAM
  * Returns 0 on success, negative errno otherwise.
  */
-static int si570_get_defaults(struct clk_si570 *data, u64 fout)
+static int si570_get_defaults(struct clk_si570 *data, u64 fout,
+			      bool skip_recall)
 {
 	int err;
 	u64 fdco;
 
-	regmap_write(data->regmap, SI570_REG_CONTROL, SI570_CNTRL_RECALL);
+	if (!skip_recall)
+		regmap_write(data->regmap, SI570_REG_CONTROL,
+			     SI570_CNTRL_RECALL);
 
 	err = si570_get_divs(data, &data->rfreq, &data->n1, &data->hs_div);
 	if (err)
@@ -400,6 +404,7 @@ static int si570_probe(struct i2c_client *client,
 	struct clk_si570 *data;
 	struct clk_init_data init;
 	u32 initial_fout, factory_fout, stability;
+	bool skip_recall;
 	int err;
 	enum clk_si570_variant variant = id->driver_data;
 
@@ -441,6 +446,9 @@ static int si570_probe(struct i2c_client *client,
 		return err;
 	}
 
+	skip_recall = of_property_read_bool(client->dev.of_node,
+					    "silabs,skip-recall");
+
 	data->regmap = devm_regmap_init_i2c(client, &si570_regmap_config);
 	if (IS_ERR(data->regmap)) {
 		dev_err(&client->dev, "failed to allocate register map\n");
@@ -448,7 +456,7 @@ static int si570_probe(struct i2c_client *client,
 	}
 
 	i2c_set_clientdata(client, data);
-	err = si570_get_defaults(data, factory_fout);
+	err = si570_get_defaults(data, factory_fout, skip_recall);
 	if (err)
 		return err;
 
-- 
2.7.4


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

* Re: [PATCH 1/2] dt-bindings: clock: si570: Add 'silabs,skip-recall' property
  2021-02-05  3:35 ` [PATCH 1/2] dt-bindings: clock: si570: Add 'silabs,skip-recall' property Saeed Nowshadi
@ 2021-02-11  0:01   ` Rob Herring
  2021-02-11 20:16   ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring @ 2021-02-11  0:01 UTC (permalink / raw)
  To: Saeed Nowshadi
  Cc: devicetree, Michal Simek, robh+dt, sboyd, mturquette, git-dev,
	linux-clk

On Thu, 04 Feb 2021 19:35:03 -0800, Saeed Nowshadi wrote:
> Add an optional property so the driver can skip calling the NVM->RAM
> recall operation during probe().
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
> ---
>  Documentation/devicetree/bindings/clock/silabs,si570.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 1/2] dt-bindings: clock: si570: Add 'silabs,skip-recall' property
  2021-02-05  3:35 ` [PATCH 1/2] dt-bindings: clock: si570: Add 'silabs,skip-recall' property Saeed Nowshadi
  2021-02-11  0:01   ` Rob Herring
@ 2021-02-11 20:16   ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2021-02-11 20:16 UTC (permalink / raw)
  To: Saeed Nowshadi, devicetree, linux-clk
  Cc: mturquette, robh+dt, git-dev, Saeed Nowshadi, Michal Simek

Quoting Saeed Nowshadi (2021-02-04 19:35:03)
> Add an optional property so the driver can skip calling the NVM->RAM
> recall operation during probe().
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
> ---

Applied to clk-next

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

* Re: [PATCH 2/2] clk: si570: Skip NVM to RAM recall operation if an optional property is set
  2021-02-05  3:35 ` [PATCH 2/2] clk: si570: Skip NVM to RAM recall operation if an optional property is set Saeed Nowshadi
@ 2021-02-11 20:17   ` Stephen Boyd
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2021-02-11 20:17 UTC (permalink / raw)
  To: Saeed Nowshadi, devicetree, linux-clk
  Cc: mturquette, robh+dt, git-dev, Saeed Nowshadi, Michal Simek

Quoting Saeed Nowshadi (2021-02-04 19:35:04)
> Recalling NVM data into RAM during probe() initiates a re-calibration of
> the clock. If the clock is already in-use, the recall operation can cause
> a glitch on the frequency out. At power on, the factory data are loaded
> from NVM into RAM by default. If the clock frequency has been changed
> since power on, the recall operation can be used to re-initialize the clock
> to factory setting.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
> ---

Applied to clk-next

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

end of thread, other threads:[~2021-02-11 20:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-05  3:35 [PATCH 0/2] clk: si570: Skip recall NVM into RAM operation Saeed Nowshadi
2021-02-05  3:35 ` [PATCH 1/2] dt-bindings: clock: si570: Add 'silabs,skip-recall' property Saeed Nowshadi
2021-02-11  0:01   ` Rob Herring
2021-02-11 20:16   ` Stephen Boyd
2021-02-05  3:35 ` [PATCH 2/2] clk: si570: Skip NVM to RAM recall operation if an optional property is set Saeed Nowshadi
2021-02-11 20:17   ` 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).