Skip to content

Commit 792d682

Browse files
committed
Merge branches 'clk-cleanup', 'clk-bindings', 'clk-renesas', 'clk-versa' and 'clk-amlogic' into clk-next
- Support for Versa 5P49V60 clks * clk-cleanup: clk: rs9: Drop unused pin_xin field clk: sprd: Add dependency for SPRD_UMS512_CLK clk: ralink: fix 'mt7621_gate_is_enabled()' function dt-bindings: clock: remove stih416 bindings drivers/clk: Remove "select SRCU" * clk-bindings: dt-bindings: clock: qcom,sm8450-camcc: constrain required-opps dt-bindings: clock: imx8m-clock: correct i.MX8MQ node name * clk-renesas: clk: renesas: rcar-gen3: Disable R-Car H3 ES1.* clk: renesas: r8a779g0: Add CAN-FD clocks clk: renesas: r8a779g0: Tidy up DMAC name on SYS-DMAC clk: renesas: r8a779a0: Tidy up DMAC name on SYS-DMAC clk: renesas: r8a779g0: Add custom clock for PLL2 clk: renesas: cpg-mssr: Remove superfluous check in resume code clk: renesas: r9a06g032: Handle h2mode setting based on USBF presence clk: renesas: cpg-mssr: Fix use after free if cpg_mssr_common_init() failed clk: renesas: r9a07g044: Add clock and reset entries for CRU clk: renesas: r9a09g011: Add SDHI/eMMC clock and reset entries clk: renesas: r9a09g011: Add USB clock and reset entries clk: renesas: r9a09g011: Add TIM clock and reset entries clk: renesas: r8a779g0: Add display related clocks clk: renesas: rcar-gen4: Restore PLL enum sort order clk: renesas: r8a779g0: Fix OSC predividers clk: renesas: r9a09g011: Add PWM clock and reset entries * clk-versa: dt-bindings: clock: versaclock5: Document 5P49V60 compatible string clk: vc5: Add support for 5P49V60 clk: vc5: Use `clamp()` to restrict PLL range * clk-amlogic: clk: meson: clk-cpu-dyndiv: switch from .round_rate to .determine_rate clk: meson: sclk-div: switch from .round_rate to .determine_rate clk: meson: dualdiv: switch from .round_rate to .determine_rate clk: meson: mpll: Switch from .round_rate to .determine_rate
5 parents d065155 + 2c3aa5b + 3ef6d9b + def7079 + df43ce4 commit 792d682

20 files changed

+388
-226
lines changed

Documentation/devicetree/bindings/clock/idt,versaclock5.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ properties:
5454
- idt,5p49v5925
5555
- idt,5p49v5933
5656
- idt,5p49v5935
57+
- idt,5p49v60
5758
- idt,5p49v6901
5859
- idt,5p49v6965
5960
- idt,5p49v6975

Documentation/devicetree/bindings/clock/imx8m-clock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ examples:
108108
};
109109
110110
- |
111-
clock-controller@30390000 {
111+
clock-controller@30380000 {
112112
compatible = "fsl,imx8mq-ccm";
113113
reg = <0x30380000 0x10000>;
114114
#clock-cells = <1>;

Documentation/devicetree/bindings/clock/qcom,sm8450-camcc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ properties:
3232
A phandle and PM domain specifier for the MMCX power domain.
3333

3434
required-opps:
35+
maxItems: 1
3536
description:
3637
A phandle to an OPP node describing required MMCX performance point.
3738

drivers/clk/clk-versaclock5.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,8 @@
122122
#define VC5_GLOBAL_REGISTER 0x76
123123
#define VC5_GLOBAL_REGISTER_GLOBAL_RESET BIT(5)
124124

125-
/* PLL/VCO runs between 2.5 GHz and 3.0 GHz */
125+
/* The minimum VCO frequency is 2.5 GHz. The maximum is variant specific. */
126126
#define VC5_PLL_VCO_MIN 2500000000UL
127-
#define VC5_PLL_VCO_MAX 3000000000UL
128127

129128
/* VC5 Input mux settings */
130129
#define VC5_MUX_IN_XIN BIT(0)
@@ -150,6 +149,7 @@ enum vc5_model {
150149
IDT_VC5_5P49V5925,
151150
IDT_VC5_5P49V5933,
152151
IDT_VC5_5P49V5935,
152+
IDT_VC6_5P49V60,
153153
IDT_VC6_5P49V6901,
154154
IDT_VC6_5P49V6965,
155155
IDT_VC6_5P49V6975,
@@ -161,6 +161,7 @@ struct vc5_chip_info {
161161
const unsigned int clk_fod_cnt;
162162
const unsigned int clk_out_cnt;
163163
const u32 flags;
164+
const unsigned long vco_max;
164165
};
165166

166167
struct vc5_driver_data;
@@ -446,13 +447,11 @@ static long vc5_pll_round_rate(struct clk_hw *hw, unsigned long rate,
446447
unsigned long *parent_rate)
447448
{
448449
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
450+
struct vc5_driver_data *vc5 = hwdata->vc5;
449451
u32 div_int;
450452
u64 div_frc;
451453

452-
if (rate < VC5_PLL_VCO_MIN)
453-
rate = VC5_PLL_VCO_MIN;
454-
if (rate > VC5_PLL_VCO_MAX)
455-
rate = VC5_PLL_VCO_MAX;
454+
rate = clamp(rate, VC5_PLL_VCO_MIN, vc5->chip_info->vco_max);
456455

457456
/* Determine integer part, which is 12 bit wide */
458457
div_int = rate / *parent_rate;
@@ -1212,55 +1211,71 @@ static const struct vc5_chip_info idt_5p49v5923_info = {
12121211
.clk_fod_cnt = 2,
12131212
.clk_out_cnt = 3,
12141213
.flags = 0,
1214+
.vco_max = 3000000000UL,
12151215
};
12161216

12171217
static const struct vc5_chip_info idt_5p49v5925_info = {
12181218
.model = IDT_VC5_5P49V5925,
12191219
.clk_fod_cnt = 4,
12201220
.clk_out_cnt = 5,
12211221
.flags = 0,
1222+
.vco_max = 3000000000UL,
12221223
};
12231224

12241225
static const struct vc5_chip_info idt_5p49v5933_info = {
12251226
.model = IDT_VC5_5P49V5933,
12261227
.clk_fod_cnt = 2,
12271228
.clk_out_cnt = 3,
12281229
.flags = VC5_HAS_INTERNAL_XTAL,
1230+
.vco_max = 3000000000UL,
12291231
};
12301232

12311233
static const struct vc5_chip_info idt_5p49v5935_info = {
12321234
.model = IDT_VC5_5P49V5935,
12331235
.clk_fod_cnt = 4,
12341236
.clk_out_cnt = 5,
12351237
.flags = VC5_HAS_INTERNAL_XTAL,
1238+
.vco_max = 3000000000UL,
1239+
};
1240+
1241+
static const struct vc5_chip_info idt_5p49v60_info = {
1242+
.model = IDT_VC6_5P49V60,
1243+
.clk_fod_cnt = 4,
1244+
.clk_out_cnt = 5,
1245+
.flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT,
1246+
.vco_max = 2700000000UL,
12361247
};
12371248

12381249
static const struct vc5_chip_info idt_5p49v6901_info = {
12391250
.model = IDT_VC6_5P49V6901,
12401251
.clk_fod_cnt = 4,
12411252
.clk_out_cnt = 5,
12421253
.flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT,
1254+
.vco_max = 3000000000UL,
12431255
};
12441256

12451257
static const struct vc5_chip_info idt_5p49v6965_info = {
12461258
.model = IDT_VC6_5P49V6965,
12471259
.clk_fod_cnt = 4,
12481260
.clk_out_cnt = 5,
12491261
.flags = VC5_HAS_BYPASS_SYNC_BIT,
1262+
.vco_max = 3000000000UL,
12501263
};
12511264

12521265
static const struct vc5_chip_info idt_5p49v6975_info = {
12531266
.model = IDT_VC6_5P49V6975,
12541267
.clk_fod_cnt = 4,
12551268
.clk_out_cnt = 5,
12561269
.flags = VC5_HAS_BYPASS_SYNC_BIT | VC5_HAS_INTERNAL_XTAL,
1270+
.vco_max = 3000000000UL,
12571271
};
12581272

12591273
static const struct i2c_device_id vc5_id[] = {
12601274
{ "5p49v5923", .driver_data = IDT_VC5_5P49V5923 },
12611275
{ "5p49v5925", .driver_data = IDT_VC5_5P49V5925 },
12621276
{ "5p49v5933", .driver_data = IDT_VC5_5P49V5933 },
12631277
{ "5p49v5935", .driver_data = IDT_VC5_5P49V5935 },
1278+
{ "5p49v60", .driver_data = IDT_VC6_5P49V60 },
12641279
{ "5p49v6901", .driver_data = IDT_VC6_5P49V6901 },
12651280
{ "5p49v6965", .driver_data = IDT_VC6_5P49V6965 },
12661281
{ "5p49v6975", .driver_data = IDT_VC6_5P49V6975 },
@@ -1273,6 +1288,7 @@ static const struct of_device_id clk_vc5_of_match[] = {
12731288
{ .compatible = "idt,5p49v5925", .data = &idt_5p49v5925_info },
12741289
{ .compatible = "idt,5p49v5933", .data = &idt_5p49v5933_info },
12751290
{ .compatible = "idt,5p49v5935", .data = &idt_5p49v5935_info },
1291+
{ .compatible = "idt,5p49v60", .data = &idt_5p49v60_info },
12761292
{ .compatible = "idt,5p49v6901", .data = &idt_5p49v6901_info },
12771293
{ .compatible = "idt,5p49v6965", .data = &idt_5p49v6965_info },
12781294
{ .compatible = "idt,5p49v6975", .data = &idt_5p49v6975_info },

drivers/clk/meson/clk-cpu-dyndiv.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ static unsigned long meson_clk_cpu_dyndiv_recalc_rate(struct clk_hw *hw,
2727
NULL, 0, data->div.width);
2828
}
2929

30-
static long meson_clk_cpu_dyndiv_round_rate(struct clk_hw *hw,
31-
unsigned long rate,
32-
unsigned long *prate)
30+
static int meson_clk_cpu_dyndiv_determine_rate(struct clk_hw *hw,
31+
struct clk_rate_request *req)
3332
{
3433
struct clk_regmap *clk = to_clk_regmap(hw);
3534
struct meson_clk_cpu_dyndiv_data *data = meson_clk_cpu_dyndiv_data(clk);
3635

37-
return divider_round_rate(hw, rate, prate, NULL, data->div.width, 0);
36+
return divider_determine_rate(hw, req, NULL, data->div.width, 0);
3837
}
3938

4039
static int meson_clk_cpu_dyndiv_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -63,7 +62,7 @@ static int meson_clk_cpu_dyndiv_set_rate(struct clk_hw *hw, unsigned long rate,
6362

6463
const struct clk_ops meson_clk_cpu_dyndiv_ops = {
6564
.recalc_rate = meson_clk_cpu_dyndiv_recalc_rate,
66-
.round_rate = meson_clk_cpu_dyndiv_round_rate,
65+
.determine_rate = meson_clk_cpu_dyndiv_determine_rate,
6766
.set_rate = meson_clk_cpu_dyndiv_set_rate,
6867
};
6968
EXPORT_SYMBOL_GPL(meson_clk_cpu_dyndiv_ops);

drivers/clk/meson/clk-dualdiv.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,23 @@ __dualdiv_get_setting(unsigned long rate, unsigned long parent_rate,
8686
return (struct meson_clk_dualdiv_param *)&table[best_i];
8787
}
8888

89-
static long meson_clk_dualdiv_round_rate(struct clk_hw *hw, unsigned long rate,
90-
unsigned long *parent_rate)
89+
static int meson_clk_dualdiv_determine_rate(struct clk_hw *hw,
90+
struct clk_rate_request *req)
9191
{
9292
struct clk_regmap *clk = to_clk_regmap(hw);
9393
struct meson_clk_dualdiv_data *dualdiv = meson_clk_dualdiv_data(clk);
94-
const struct meson_clk_dualdiv_param *setting =
95-
__dualdiv_get_setting(rate, *parent_rate, dualdiv);
94+
const struct meson_clk_dualdiv_param *setting;
9695

97-
if (!setting)
98-
return meson_clk_dualdiv_recalc_rate(hw, *parent_rate);
96+
setting = __dualdiv_get_setting(req->rate, req->best_parent_rate,
97+
dualdiv);
98+
if (setting)
99+
req->rate = __dualdiv_param_to_rate(req->best_parent_rate,
100+
setting);
101+
else
102+
req->rate = meson_clk_dualdiv_recalc_rate(hw,
103+
req->best_parent_rate);
99104

100-
return __dualdiv_param_to_rate(*parent_rate, setting);
105+
return 0;
101106
}
102107

103108
static int meson_clk_dualdiv_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -122,7 +127,7 @@ static int meson_clk_dualdiv_set_rate(struct clk_hw *hw, unsigned long rate,
122127

123128
const struct clk_ops meson_clk_dualdiv_ops = {
124129
.recalc_rate = meson_clk_dualdiv_recalc_rate,
125-
.round_rate = meson_clk_dualdiv_round_rate,
130+
.determine_rate = meson_clk_dualdiv_determine_rate,
126131
.set_rate = meson_clk_dualdiv_set_rate,
127132
};
128133
EXPORT_SYMBOL_GPL(meson_clk_dualdiv_ops);

drivers/clk/meson/clk-mpll.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,22 @@ static unsigned long mpll_recalc_rate(struct clk_hw *hw,
8787
return rate < 0 ? 0 : rate;
8888
}
8989

90-
static long mpll_round_rate(struct clk_hw *hw,
91-
unsigned long rate,
92-
unsigned long *parent_rate)
90+
static int mpll_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
9391
{
9492
struct clk_regmap *clk = to_clk_regmap(hw);
9593
struct meson_clk_mpll_data *mpll = meson_clk_mpll_data(clk);
9694
unsigned int sdm, n2;
95+
long rate;
96+
97+
params_from_rate(req->rate, req->best_parent_rate, &sdm, &n2,
98+
mpll->flags);
9799

98-
params_from_rate(rate, *parent_rate, &sdm, &n2, mpll->flags);
99-
return rate_from_params(*parent_rate, sdm, n2);
100+
rate = rate_from_params(req->best_parent_rate, sdm, n2);
101+
if (rate < 0)
102+
return rate;
103+
104+
req->rate = rate;
105+
return 0;
100106
}
101107

102108
static int mpll_set_rate(struct clk_hw *hw,
@@ -157,13 +163,13 @@ static int mpll_init(struct clk_hw *hw)
157163

158164
const struct clk_ops meson_clk_mpll_ro_ops = {
159165
.recalc_rate = mpll_recalc_rate,
160-
.round_rate = mpll_round_rate,
166+
.determine_rate = mpll_determine_rate,
161167
};
162168
EXPORT_SYMBOL_GPL(meson_clk_mpll_ro_ops);
163169

164170
const struct clk_ops meson_clk_mpll_ops = {
165171
.recalc_rate = mpll_recalc_rate,
166-
.round_rate = mpll_round_rate,
172+
.determine_rate = mpll_determine_rate,
167173
.set_rate = mpll_set_rate,
168174
.init = mpll_init,
169175
};

drivers/clk/meson/sclk-div.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,17 @@ static int sclk_div_bestdiv(struct clk_hw *hw, unsigned long rate,
9696
return bestdiv;
9797
}
9898

99-
static long sclk_div_round_rate(struct clk_hw *hw, unsigned long rate,
100-
unsigned long *prate)
99+
static int sclk_div_determine_rate(struct clk_hw *hw,
100+
struct clk_rate_request *req)
101101
{
102102
struct clk_regmap *clk = to_clk_regmap(hw);
103103
struct meson_sclk_div_data *sclk = meson_sclk_div_data(clk);
104104
int div;
105105

106-
div = sclk_div_bestdiv(hw, rate, prate, sclk);
106+
div = sclk_div_bestdiv(hw, req->rate, &req->best_parent_rate, sclk);
107+
req->rate = DIV_ROUND_UP_ULL((u64)req->best_parent_rate, div);
107108

108-
return DIV_ROUND_UP_ULL((u64)*prate, div);
109+
return 0;
109110
}
110111

111112
static void sclk_apply_ratio(struct clk_regmap *clk,
@@ -237,7 +238,7 @@ static int sclk_div_init(struct clk_hw *hw)
237238

238239
const struct clk_ops meson_sclk_div_ops = {
239240
.recalc_rate = sclk_div_recalc_rate,
240-
.round_rate = sclk_div_round_rate,
241+
.determine_rate = sclk_div_determine_rate,
241242
.set_rate = sclk_div_set_rate,
242243
.enable = sclk_div_enable,
243244
.disable = sclk_div_disable,

drivers/clk/renesas/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ config CLK_RENESAS
2222
select CLK_R8A7791 if ARCH_R8A7791 || ARCH_R8A7793
2323
select CLK_R8A7792 if ARCH_R8A7792
2424
select CLK_R8A7794 if ARCH_R8A7794
25-
select CLK_R8A7795 if ARCH_R8A77950 || ARCH_R8A77951
25+
select CLK_R8A7795 if ARCH_R8A77951
2626
select CLK_R8A77960 if ARCH_R8A77960
2727
select CLK_R8A77961 if ARCH_R8A77961
2828
select CLK_R8A77965 if ARCH_R8A77965

0 commit comments

Comments
 (0)