Skip to content

Commit fc336ae

Browse files
lucaceresolibebarino
authored andcommitted
clk: vc5: fix output disabling when enabling a FOD
On 5P49V6965, when an output is enabled we enable the corresponding FOD. When this happens for the first time, and specifically when writing register VC5_OUT_DIV_CONTROL in vc5_clk_out_prepare(), all other outputs are stopped for a short time and then restarted. According to Renesas support this is intended: "The reason for that is VC6E has synced up all output function". This behaviour can be disabled at least on VersaClock 6E devices, of which only the 5P49V6965 is currently implemented by this driver. This requires writing bit 7 (bypass_sync{1..4}) in register 0x20..0x50. Those registers are named "Unused Factory Reserved Register", and the bits are documented as "Skip VDDO<N> verification", which does not clearly explain the relation to FOD sync. However according to Renesas support as well as my testing setting this bit does prevent disabling of all clock outputs when enabling a FOD. See "VersaClock ® 6E Family Register Descriptions and Programming Guide" (August 30, 2018), Table 116 "Power Up VDD check", page 58: https://www.renesas.com/us/en/document/mau/versaclock-6e-family-register-descriptions-and-programming-guide Signed-off-by: Luca Ceresoli <[email protected]> Reviewed-by: Adam Ford <[email protected]> Link: https://lore.kernel.org/r/[email protected] Fixes: 2bda748 ("clk: vc5: Add support for IDT VersaClock 5P49V6965") Signed-off-by: Stephen Boyd <[email protected]>
1 parent 6efb943 commit fc336ae

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

drivers/clk/clk-versaclock5.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@
6969
#define VC5_FEEDBACK_FRAC_DIV(n) (0x19 + (n))
7070
#define VC5_RC_CONTROL0 0x1e
7171
#define VC5_RC_CONTROL1 0x1f
72-
/* Register 0x20 is factory reserved */
72+
73+
/* These registers are named "Unused Factory Reserved Registers" */
74+
#define VC5_RESERVED_X0(idx) (0x20 + ((idx) * 0x10))
75+
#define VC5_RESERVED_X0_BYPASS_SYNC BIT(7) /* bypass_sync<idx> bit */
7376

7477
/* Output divider control for divider 1,2,3,4 */
7578
#define VC5_OUT_DIV_CONTROL(idx) (0x21 + ((idx) * 0x10))
@@ -87,7 +90,6 @@
8790
#define VC5_OUT_DIV_SKEW_INT(idx, n) (0x2b + ((idx) * 0x10) + (n))
8891
#define VC5_OUT_DIV_INT(idx, n) (0x2d + ((idx) * 0x10) + (n))
8992
#define VC5_OUT_DIV_SKEW_FRAC(idx) (0x2f + ((idx) * 0x10))
90-
/* Registers 0x30, 0x40, 0x50 are factory reserved */
9193

9294
/* Clock control register for clock 1,2 */
9395
#define VC5_CLK_OUTPUT_CFG(idx, n) (0x60 + ((idx) * 0x2) + (n))
@@ -140,6 +142,8 @@
140142
#define VC5_HAS_INTERNAL_XTAL BIT(0)
141143
/* chip has PFD requency doubler */
142144
#define VC5_HAS_PFD_FREQ_DBL BIT(1)
145+
/* chip has bits to disable FOD sync */
146+
#define VC5_HAS_BYPASS_SYNC_BIT BIT(2)
143147

144148
/* Supported IDT VC5 models. */
145149
enum vc5_model {
@@ -581,6 +585,23 @@ static int vc5_clk_out_prepare(struct clk_hw *hw)
581585
unsigned int src;
582586
int ret;
583587

588+
/*
589+
* When enabling a FOD, all currently enabled FODs are briefly
590+
* stopped in order to synchronize all of them. This causes a clock
591+
* disruption to any unrelated chips that might be already using
592+
* other clock outputs. Bypass the sync feature to avoid the issue,
593+
* which is possible on the VersaClock 6E family via reserved
594+
* registers.
595+
*/
596+
if (vc5->chip_info->flags & VC5_HAS_BYPASS_SYNC_BIT) {
597+
ret = regmap_update_bits(vc5->regmap,
598+
VC5_RESERVED_X0(hwdata->num),
599+
VC5_RESERVED_X0_BYPASS_SYNC,
600+
VC5_RESERVED_X0_BYPASS_SYNC);
601+
if (ret)
602+
return ret;
603+
}
604+
584605
/*
585606
* If the input mux is disabled, enable it first and
586607
* select source from matching FOD.
@@ -1166,7 +1187,7 @@ static const struct vc5_chip_info idt_5p49v6965_info = {
11661187
.model = IDT_VC6_5P49V6965,
11671188
.clk_fod_cnt = 4,
11681189
.clk_out_cnt = 5,
1169-
.flags = 0,
1190+
.flags = VC5_HAS_BYPASS_SYNC_BIT,
11701191
};
11711192

11721193
static const struct i2c_device_id vc5_id[] = {

0 commit comments

Comments
 (0)