Skip to content

Commit 8fb59ce

Browse files
committed
Merge branches 'clk-nvidia', 'clk-rockchip', 'clk-at91' and 'clk-vc5' into clk-next
- Support the SD/OE pin on IDT VersaClock 5 and 6 clock generators * clk-nvidia: clk: tegra: fix old-style declaration clk: tegra: Remove CLK_IS_CRITICAL flag from fuse clock soc/tegra: fuse: Enable fuse clock on suspend for Tegra124 soc/tegra: fuse: Add runtime PM support soc/tegra: fuse: Clear fuse->clk on driver probe failure soc/tegra: pmc: Prevent racing with cpuilde driver soc/tegra: bpmp: Remove unused including <linux/version.h> * clk-rockchip: clk: rockchip: make rk3308 ddrphy4x clock critical clk: rockchip: drop GRF dependency for rk3328/rk3036 pll types dt-bindings: clk: Convert rockchip,rk3399-cru to DT schema clk: rockchip: Add support for hclk_sfc on rk3036 clk: rockchip: rk3036: fix up the sclk_sfc parent error clk: rockchip: add dt-binding clkid for hclk_sfc on rk3036 * clk-at91: clk: at91: clk-generated: Limit the requested rate to our range * clk-vc5: clk: vc5: Add properties for configuring SD/OE behavior clk: vc5: Use dev_err_probe dt-bindings: clk: vc5: Add properties for configuring the SD/OE pin
5 parents 1faa7cb + 2711544 + 1d07010 + af7651e + d83e561 commit 8fb59ce

File tree

21 files changed

+279
-106
lines changed

21 files changed

+279
-106
lines changed

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ description: |
3030
3 -- OUT3
3131
4 -- OUT4
3232
33+
The idt,shutdown and idt,output-enable-active properties control the
34+
SH (en_global_shutdown) and SP bits of the Primary Source and Shutdown
35+
Register, respectively. Their behavior is summarized by the following
36+
table:
37+
38+
SH SP Output when the SD/OE pin is Low/High
39+
== == =====================================
40+
0 0 Active/Inactive
41+
0 1 Inactive/Active
42+
1 0 Active/Shutdown
43+
1 1 Inactive/Shutdown
44+
45+
The case where SH and SP are both 1 is likely not very interesting.
46+
3347
maintainers:
3448
- Luca Ceresoli <[email protected]>
3549

@@ -64,6 +78,26 @@ properties:
6478
maximum: 22760
6579
description: Optional load capacitor for XTAL1 and XTAL2
6680

81+
idt,shutdown:
82+
$ref: /schemas/types.yaml#/definitions/uint32
83+
enum: [0, 1]
84+
description: |
85+
If 1, this enables the shutdown functionality: the chip will be
86+
shut down if the SD/OE pin is driven high. If 0, this disables the
87+
shutdown functionality: the chip will never be shut down based on
88+
the value of the SD/OE pin. This property corresponds to the SH
89+
bit of the Primary Source and Shutdown Register.
90+
91+
idt,output-enable-active:
92+
$ref: /schemas/types.yaml#/definitions/uint32
93+
enum: [0, 1]
94+
description: |
95+
If 1, this enables output when the SD/OE pin is high, and disables
96+
output when the SD/OE pin is low. If 0, this disables output when
97+
the SD/OE pin is high, and enables output when the SD/OE pin is
98+
low. This corresponds to the SP bit of the Primary Source and
99+
Shutdown Register.
100+
67101
patternProperties:
68102
"^OUT[1-4]$":
69103
type: object
@@ -90,6 +124,8 @@ required:
90124
- compatible
91125
- reg
92126
- '#clock-cells'
127+
- idt,shutdown
128+
- idt,output-enable-active
93129

94130
allOf:
95131
- if:
@@ -139,6 +175,10 @@ examples:
139175
clocks = <&ref25m>;
140176
clock-names = "xin";
141177
178+
/* Set the SD/OE pin's settings */
179+
idt,shutdown = <0>;
180+
idt,output-enable-active = <0>;
181+
142182
OUT1 {
143183
idt,mode = <VC5_CMOSD>;
144184
idt,voltage-microvolt = <1800000>;

Documentation/devicetree/bindings/clock/rockchip,rk3399-cru.txt

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/clock/rockchip,rk3399-cru.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Rockchip RK3399 Clock and Reset Unit
8+
9+
maintainers:
10+
- Xing Zheng <[email protected]>
11+
- Heiko Stuebner <[email protected]>
12+
13+
description: |
14+
The RK3399 clock controller generates and supplies clock to various
15+
controllers within the SoC and also implements a reset controller for SoC
16+
peripherals.
17+
Each clock is assigned an identifier and client nodes can use this identifier
18+
to specify the clock which they consume. All available clocks are defined as
19+
preprocessor macros in the dt-bindings/clock/rk3399-cru.h headers and can be
20+
used in device tree sources. Similar macros exist for the reset sources in
21+
these files.
22+
There are several clocks that are generated outside the SoC. It is expected
23+
that they are defined using standard clock bindings with following
24+
clock-output-names:
25+
- "xin24m" - crystal input - required,
26+
- "xin32k" - rtc clock - optional,
27+
- "clkin_gmac" - external GMAC clock - optional,
28+
- "clkin_i2s" - external I2S clock - optional,
29+
- "pclkin_cif" - external ISP clock - optional,
30+
- "clk_usbphy0_480m" - output clock of the pll in the usbphy0
31+
- "clk_usbphy1_480m" - output clock of the pll in the usbphy1
32+
33+
properties:
34+
compatible:
35+
enum:
36+
- rockchip,rk3399-pmucru
37+
- rockchip,rk3399-cru
38+
39+
reg:
40+
maxItems: 1
41+
42+
"#clock-cells":
43+
const: 1
44+
45+
"#reset-cells":
46+
const: 1
47+
48+
clocks:
49+
minItems: 1
50+
51+
assigned-clocks:
52+
minItems: 1
53+
maxItems: 64
54+
55+
assigned-clock-parents:
56+
minItems: 1
57+
maxItems: 64
58+
59+
assigned-clock-rates:
60+
minItems: 1
61+
maxItems: 64
62+
63+
rockchip,grf:
64+
$ref: /schemas/types.yaml#/definitions/phandle
65+
description: >
66+
phandle to the syscon managing the "general register files". It is used
67+
for GRF muxes, if missing any muxes present in the GRF will not be
68+
available.
69+
70+
required:
71+
- compatible
72+
- reg
73+
- "#clock-cells"
74+
- "#reset-cells"
75+
76+
additionalProperties: false
77+
78+
examples:
79+
- |
80+
pmucru: pmu-clock-controller@ff750000 {
81+
compatible = "rockchip,rk3399-pmucru";
82+
reg = <0xff750000 0x1000>;
83+
#clock-cells = <1>;
84+
#reset-cells = <1>;
85+
};
86+
- |
87+
cru: clock-controller@ff760000 {
88+
compatible = "rockchip,rk3399-cru";
89+
reg = <0xff760000 0x1000>;
90+
#clock-cells = <1>;
91+
#reset-cells = <1>;
92+
};

arch/arm/mach-tegra/pm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ static const struct platform_suspend_ops tegra_suspend_ops = {
403403
.enter = tegra_suspend_enter,
404404
};
405405

406-
void __init tegra_init_suspend(void)
406+
void tegra_pm_init_suspend(void)
407407
{
408408
enum tegra_suspend_mode mode = tegra_pmc_get_suspend_mode();
409409

arch/arm/mach-tegra/pm.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,4 @@ void tegra30_sleep_core_init(void);
2525

2626
extern void (*tegra_tear_down_cpu)(void);
2727

28-
#ifdef CONFIG_PM_SLEEP
29-
void tegra_init_suspend(void);
30-
#else
31-
static inline void tegra_init_suspend(void) {}
32-
#endif
33-
3428
#endif /* _MACH_TEGRA_PM_H_ */

arch/arm/mach-tegra/tegra.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ static void __init tegra_dt_init(void)
8484

8585
static void __init tegra_dt_init_late(void)
8686
{
87-
tegra_init_suspend();
88-
8987
if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) &&
9088
of_machine_is_compatible("compal,paz00"))
9189
tegra_paz00_wifikill_init();

drivers/clk/at91/clk-generated.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
128128
int i;
129129
u32 div;
130130

131+
/* do not look for a rate that is outside of our range */
132+
if (gck->range.max && req->rate > gck->range.max)
133+
req->rate = gck->range.max;
134+
if (gck->range.min && req->rate < gck->range.min)
135+
req->rate = gck->range.min;
136+
131137
for (i = 0; i < clk_hw_get_num_parents(hw); i++) {
132138
if (gck->chg_pid == i)
133139
continue;

drivers/clk/clk-versaclock5.c

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@ static const struct of_device_id clk_vc5_of_match[];
907907

908908
static int vc5_probe(struct i2c_client *client, const struct i2c_device_id *id)
909909
{
910+
unsigned int oe, sd, src_mask = 0, src_val = 0;
910911
struct vc5_driver_data *vc5;
911912
struct clk_init_data init;
912913
const char *parent_names[2];
@@ -930,11 +931,33 @@ static int vc5_probe(struct i2c_client *client, const struct i2c_device_id *id)
930931
return -EPROBE_DEFER;
931932

932933
vc5->regmap = devm_regmap_init_i2c(client, &vc5_regmap_config);
933-
if (IS_ERR(vc5->regmap)) {
934-
dev_err(&client->dev, "failed to allocate register map\n");
935-
return PTR_ERR(vc5->regmap);
934+
if (IS_ERR(vc5->regmap))
935+
return dev_err_probe(&client->dev, PTR_ERR(vc5->regmap),
936+
"failed to allocate register map\n");
937+
938+
ret = of_property_read_u32(client->dev.of_node, "idt,shutdown", &sd);
939+
if (!ret) {
940+
src_mask |= VC5_PRIM_SRC_SHDN_EN_GBL_SHDN;
941+
if (sd)
942+
src_val |= VC5_PRIM_SRC_SHDN_EN_GBL_SHDN;
943+
} else if (ret != -EINVAL) {
944+
return dev_err_probe(&client->dev, ret,
945+
"could not read idt,shutdown\n");
936946
}
937947

948+
ret = of_property_read_u32(client->dev.of_node,
949+
"idt,output-enable-active", &oe);
950+
if (!ret) {
951+
src_mask |= VC5_PRIM_SRC_SHDN_SP;
952+
if (oe)
953+
src_val |= VC5_PRIM_SRC_SHDN_SP;
954+
} else if (ret != -EINVAL) {
955+
return dev_err_probe(&client->dev, ret,
956+
"could not read idt,output-enable-active\n");
957+
}
958+
959+
regmap_update_bits(vc5->regmap, VC5_PRIM_SRC_SHDN, src_mask, src_val);
960+
938961
/* Register clock input mux */
939962
memset(&init, 0, sizeof(init));
940963

@@ -957,10 +980,9 @@ static int vc5_probe(struct i2c_client *client, const struct i2c_device_id *id)
957980
__clk_get_name(vc5->pin_clkin);
958981
}
959982

960-
if (!init.num_parents) {
961-
dev_err(&client->dev, "no input clock specified!\n");
962-
return -EINVAL;
963-
}
983+
if (!init.num_parents)
984+
return dev_err_probe(&client->dev, -EINVAL,
985+
"no input clock specified!\n");
964986

965987
/* Configure Optional Loading Capacitance for external XTAL */
966988
if (!(vc5->chip_info->flags & VC5_HAS_INTERNAL_XTAL)) {
@@ -1099,14 +1121,16 @@ static int vc5_probe(struct i2c_client *client, const struct i2c_device_id *id)
10991121

11001122
ret = of_clk_add_hw_provider(client->dev.of_node, vc5_of_clk_get, vc5);
11011123
if (ret) {
1102-
dev_err(&client->dev, "unable to add clk provider\n");
1124+
dev_err_probe(&client->dev, ret,
1125+
"unable to add clk provider\n");
11031126
goto err_clk;
11041127
}
11051128

11061129
return 0;
11071130

11081131
err_clk_register:
1109-
dev_err(&client->dev, "unable to register %s\n", init.name);
1132+
dev_err_probe(&client->dev, ret,
1133+
"unable to register %s\n", init.name);
11101134
kfree(init.name); /* clock framework made a copy of the name */
11111135
err_clk:
11121136
if (vc5->chip_info->flags & VC5_HAS_INTERNAL_XTAL)

drivers/clk/rockchip/clk-pll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,
940940
switch (pll_type) {
941941
case pll_rk3036:
942942
case pll_rk3328:
943-
if (!pll->rate_table || IS_ERR(ctx->grf))
943+
if (!pll->rate_table)
944944
init.ops = &rockchip_rk3036_pll_clk_norate_ops;
945945
else
946946
init.ops = &rockchip_rk3036_pll_clk_ops;

drivers/clk/rockchip/clk-rk3036.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ PNAME(mux_pll_src_3plls_p) = { "apll", "dpll", "gpll" };
121121
PNAME(mux_timer_p) = { "xin24m", "pclk_peri_src" };
122122

123123
PNAME(mux_pll_src_apll_dpll_gpll_usb480m_p) = { "apll", "dpll", "gpll", "usb480m" };
124+
PNAME(mux_pll_src_dmyapll_dpll_gpll_xin24_p) = { "dummy_apll", "dpll", "gpll", "xin24m" };
124125

125126
PNAME(mux_mmc_src_p) = { "apll", "dpll", "gpll", "xin24m" };
126127
PNAME(mux_i2s_pre_p) = { "i2s_src", "i2s_frac", "ext_i2s", "xin12m" };
@@ -340,7 +341,7 @@ static struct rockchip_clk_branch rk3036_clk_branches[] __initdata = {
340341
RK2928_CLKSEL_CON(16), 8, 2, MFLAGS, 10, 5, DFLAGS,
341342
RK2928_CLKGATE_CON(10), 4, GFLAGS),
342343

343-
COMPOSITE(SCLK_SFC, "sclk_sfc", mux_pll_src_apll_dpll_gpll_usb480m_p, 0,
344+
COMPOSITE(SCLK_SFC, "sclk_sfc", mux_pll_src_dmyapll_dpll_gpll_xin24_p, 0,
344345
RK2928_CLKSEL_CON(16), 0, 2, MFLAGS, 2, 5, DFLAGS,
345346
RK2928_CLKGATE_CON(10), 5, GFLAGS),
346347

@@ -403,7 +404,7 @@ static struct rockchip_clk_branch rk3036_clk_branches[] __initdata = {
403404
GATE(HCLK_OTG0, "hclk_otg0", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 13, GFLAGS),
404405
GATE(HCLK_OTG1, "hclk_otg1", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(7), 3, GFLAGS),
405406
GATE(HCLK_I2S, "hclk_i2s", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 2, GFLAGS),
406-
GATE(0, "hclk_sfc", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(3), 14, GFLAGS),
407+
GATE(HCLK_SFC, "hclk_sfc", "hclk_peri", 0, RK2928_CLKGATE_CON(3), 14, GFLAGS),
407408
GATE(HCLK_MAC, "hclk_mac", "hclk_peri", 0, RK2928_CLKGATE_CON(3), 5, GFLAGS),
408409

409410
/* pclk_peri gates */

0 commit comments

Comments
 (0)