Skip to content

Commit d9d4944

Browse files
saeedn-xilinxbebarino
authored andcommitted
clk: si570: Skip NVM to RAM recall operation if an optional property is set
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 <[email protected]> Signed-off-by: Saeed Nowshadi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 3dff4be commit d9d4944

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/clk/clk-si570.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (C) 2010, 2011 Ericsson AB.
66
* Copyright (C) 2011 Guenter Roeck.
7-
* Copyright (C) 2011 - 2013 Xilinx Inc.
7+
* Copyright (C) 2011 - 2021 Xilinx Inc.
88
*
99
* Author: Guenter Roeck <[email protected]>
1010
* Sören Brinkmann <[email protected]>
@@ -123,14 +123,18 @@ static int si570_get_divs(struct clk_si570 *data, u64 *rfreq,
123123
* si570_get_defaults() - Get default values
124124
* @data: Driver data structure
125125
* @fout: Factory frequency output
126+
* @skip_recall: If true, don't recall NVM into RAM
126127
* Returns 0 on success, negative errno otherwise.
127128
*/
128-
static int si570_get_defaults(struct clk_si570 *data, u64 fout)
129+
static int si570_get_defaults(struct clk_si570 *data, u64 fout,
130+
bool skip_recall)
129131
{
130132
int err;
131133
u64 fdco;
132134

133-
regmap_write(data->regmap, SI570_REG_CONTROL, SI570_CNTRL_RECALL);
135+
if (!skip_recall)
136+
regmap_write(data->regmap, SI570_REG_CONTROL,
137+
SI570_CNTRL_RECALL);
134138

135139
err = si570_get_divs(data, &data->rfreq, &data->n1, &data->hs_div);
136140
if (err)
@@ -400,6 +404,7 @@ static int si570_probe(struct i2c_client *client,
400404
struct clk_si570 *data;
401405
struct clk_init_data init;
402406
u32 initial_fout, factory_fout, stability;
407+
bool skip_recall;
403408
int err;
404409
enum clk_si570_variant variant = id->driver_data;
405410

@@ -441,14 +446,17 @@ static int si570_probe(struct i2c_client *client,
441446
return err;
442447
}
443448

449+
skip_recall = of_property_read_bool(client->dev.of_node,
450+
"silabs,skip-recall");
451+
444452
data->regmap = devm_regmap_init_i2c(client, &si570_regmap_config);
445453
if (IS_ERR(data->regmap)) {
446454
dev_err(&client->dev, "failed to allocate register map\n");
447455
return PTR_ERR(data->regmap);
448456
}
449457

450458
i2c_set_clientdata(client, data);
451-
err = si570_get_defaults(data, factory_fout);
459+
err = si570_get_defaults(data, factory_fout, skip_recall);
452460
if (err)
453461
return err;
454462

0 commit comments

Comments
 (0)