From: Saeed Nowshadi <saeed.nowshadi@xilinx.com>
To: <linux-clk@vger.kernel.org>, <devicetree@vger.kernel.org>
Cc: <mturquette@baylibre.com>, <sboyd@kernel.org>,
<robh+dt@kernel.org>, <git-dev@xilinx.com>,
Saeed Nowshadi <saeed.nowshadi@xilinx.com>,
"Michal Simek" <michal.simek@xilinx.com>
Subject: [PATCH 2/2] clk: si570: Skip NVM to RAM recall operation if an optional property is set
Date: Thu, 4 Feb 2021 19:35:04 -0800 [thread overview]
Message-ID: <1612496104-3437-3-git-send-email-saeed.nowshadi@xilinx.com> (raw)
In-Reply-To: <1612496104-3437-1-git-send-email-saeed.nowshadi@xilinx.com>
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
next prev parent reply other threads:[~2021-02-05 3:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Saeed Nowshadi [this message]
2021-02-11 20:17 ` [PATCH 2/2] clk: si570: Skip NVM to RAM recall operation if an optional property is set Stephen Boyd
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=1612496104-3437-3-git-send-email-saeed.nowshadi@xilinx.com \
--to=saeed.nowshadi@xilinx.com \
--cc=devicetree@vger.kernel.org \
--cc=git-dev@xilinx.com \
--cc=linux-clk@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@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 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).