Skip to content

Commit 699646e

Browse files
committed
Merge branches 'clk-fixes', 'clk-renesas', 'clk-rpi', 'clk-eswin' and 'clk-mediatek' into clk-next
- ESWIN eic700 SoC clk support - Econet EN751221 SoC clock/reset support * clk-fixes: clk: spacemit: ccu_mix: fix inverted condition in ccu_mix_trigger_fc() clk: microchip: mpfs-ccc: fix out of bounds access during output registration clk: qcom: dispcc-sm8450: use RCG2 ops for DPTX1 AUX clock source * clk-renesas: clk: renesas: Add support for RZ/G3L SoC dt-bindings: clock: renesas,rzg2l-cpg: Document RZ/G3L SoC clk: renesas: rzg2l: Re-enable critical module clocks during resume clk: renesas: rzg2l: Add rzg2l_mod_clock_init_mstop_helper() clk: renesas: rzg2l: Add helper for mod clock enable/disable clk: renesas: r9a0{7g04[34],8g045}: Add critical reset entries clk: renesas: rzg2l: Add support for critical resets clk: renesas: r9a09g056: Remove entries for WDT{0,2,3} clk: renesas: r9a06g032: Enable watchdog reset sources clk: renesas: cpg-mssr: Use struct_size() helper clk: renesas: r9a09g047: Add PCIe clocks and reset clk: renesas: r9a09g057: Add PCIe clocks and reset clk: renesas: r9a09g056: Add PCIe clocks and reset clk: renesas: r9a09g047: Add entries for the RSPIs clk: renesas: r9a09g056: Add clock and reset entries for RTC clk: renesas: r9a09g057: Remove entries for WDT{0,2,3} clk: renesas: r9a09g056: Fix ordering of module clocks array clk: renesas: r9a09g057: Fix ordering of module clocks array * clk-rpi: clk: bcm: rpi: Manage clock rate in prepare/unprepare callbacks * clk-eswin: MAINTAINERS: Add entry for ESWIN EIC7700 clock driver clk: eswin: Add eic7700 clock driver clk: divider: Add devm_clk_hw_register_divider_parent_data dt-bindings: clock: eswin: Documentation for eic7700 SoC * clk-mediatek: clk: airoha: Add econet EN751221 clock/reset support to en7523-scu dt-bindings: clock, reset: Add econet EN751221
5 parents cc8f74d + 98266d5 + 6722997 + 858f627 + d8b0345 commit 699646e

32 files changed

Lines changed: 3751 additions & 104 deletions

Documentation/devicetree/bindings/clock/airoha,en7523-scu.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ properties:
3232
- enum:
3333
- airoha,en7523-scu
3434
- airoha,en7581-scu
35+
- econet,en751221-scu
3536

3637
reg:
3738
items:
@@ -67,7 +68,9 @@ allOf:
6768
- if:
6869
properties:
6970
compatible:
70-
const: airoha,en7581-scu
71+
enum:
72+
- airoha,en7581-scu
73+
- econet,en751221-scu
7174
then:
7275
properties:
7376
reg:
@@ -98,3 +101,4 @@ examples:
98101
#reset-cells = <1>;
99102
};
100103
};
104+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/clock/eswin,eic7700-clock.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Eswin EIC7700 SoC clock controller
8+
9+
maintainers:
10+
- Yifeng Huang <huangyifeng@eswincomputing.com>
11+
- Xuyang Dong <dongxuyang@eswincomputing.com>
12+
13+
description:
14+
The clock controller generates and supplies clock to all the modules
15+
for eic7700 SoC.
16+
17+
properties:
18+
compatible:
19+
const: eswin,eic7700-clock
20+
21+
reg:
22+
maxItems: 1
23+
24+
clocks:
25+
items:
26+
- description: External 24MHz oscillator clock
27+
28+
'#clock-cells':
29+
const: 1
30+
31+
required:
32+
- compatible
33+
- reg
34+
- clocks
35+
- '#clock-cells'
36+
37+
additionalProperties: false
38+
39+
examples:
40+
- |
41+
clock-controller@51828000 {
42+
compatible = "eswin,eic7700-clock";
43+
reg = <0x51828000 0x300>;
44+
clocks = <&xtal24m>;
45+
#clock-cells = <1>;
46+
};

Documentation/devicetree/bindings/clock/renesas,rzg2l-cpg.yaml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,30 @@ properties:
2828
- renesas,r9a07g044-cpg # RZ/G2{L,LC}
2929
- renesas,r9a07g054-cpg # RZ/V2L
3030
- renesas,r9a08g045-cpg # RZ/G3S
31+
- renesas,r9a08g046-cpg # RZ/G3L
3132
- renesas,r9a09g011-cpg # RZ/V2M
3233

3334
reg:
3435
maxItems: 1
3536

3637
clocks:
37-
maxItems: 1
38+
minItems: 1
39+
items:
40+
- description: Clock source to CPG can be either from external clock
41+
input (EXCLK) or crystal oscillator (XIN/XOUT).
42+
- description: ETH0 TXC clock input
43+
- description: ETH0 RXC clock input
44+
- description: ETH1 TXC clock input
45+
- description: ETH1 RXC clock input
3846

3947
clock-names:
40-
description:
41-
Clock source to CPG can be either from external clock input (EXCLK) or
42-
crystal oscillator (XIN/XOUT).
43-
const: extal
48+
minItems: 1
49+
items:
50+
- const: extal
51+
- const: eth0_txc_tx_clk
52+
- const: eth0_rxc_rx_clk
53+
- const: eth1_txc_tx_clk
54+
- const: eth1_rxc_rx_clk
4455

4556
'#clock-cells':
4657
description: |
@@ -74,6 +85,25 @@ required:
7485
- '#power-domain-cells'
7586
- '#reset-cells'
7687

88+
allOf:
89+
- if:
90+
properties:
91+
compatible:
92+
contains:
93+
const: renesas,r9a08g046-cpg
94+
then:
95+
properties:
96+
clocks:
97+
minItems: 5
98+
clock-names:
99+
minItems: 5
100+
else:
101+
properties:
102+
clocks:
103+
maxItems: 1
104+
clock-names:
105+
maxItems: 1
106+
77107
additionalProperties: false
78108

79109
examples:

Documentation/devicetree/bindings/mfd/syscon.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ select:
6161
- cirrus,ep7209-syscon2
6262
- cirrus,ep7209-syscon3
6363
- cnxt,cx92755-uc
64+
- econet,en751221-chip-scu
6465
- freecom,fsg-cs2-system-controller
6566
- fsl,imx93-aonmix-ns-syscfg
6667
- fsl,imx93-wakeupmix-syscfg
@@ -173,6 +174,7 @@ properties:
173174
- cirrus,ep7209-syscon2
174175
- cirrus,ep7209-syscon3
175176
- cnxt,cx92755-uc
177+
- econet,en751221-chip-scu
176178
- freecom,fsg-cs2-system-controller
177179
- fsl,imx93-aonmix-ns-syscfg
178180
- fsl,imx93-wakeupmix-syscfg

MAINTAINERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9096,6 +9096,8 @@ F: arch/mips/boot/dts/econet/
90969096
F: arch/mips/econet/
90979097
F: drivers/clocksource/timer-econet-en751221.c
90989098
F: drivers/irqchip/irq-econet-en751221.c
9099+
F: include/dt-bindings/clock/econet,en751221-scu.h
9100+
F: include/dt-bindings/reset/econet,en751221-scu.h
90999101

91009102
ECRYPT FILE SYSTEM
91019103
M: Tyler Hicks <code@tyhicks.com>
@@ -9495,6 +9497,14 @@ T: git https://github.com/eswincomputing/linux-next.git
94959497
F: Documentation/devicetree/bindings/riscv/eswin.yaml
94969498
F: arch/riscv/boot/dts/eswin/
94979499

9500+
ESWIN EIC7700 CLOCK DRIVER
9501+
M: Yifeng Huang <huangyifeng@eswincomputing.com>
9502+
M: Xuyang Dong <dongxuyang@eswincomputing.com>
9503+
S: Maintained
9504+
F: Documentation/devicetree/bindings/clock/eswin,eic7700-clock.yaml
9505+
F: drivers/clk/eswin/
9506+
F: include/dt-bindings/clock/eswin,eic7700-clock.h
9507+
94989508
ET131X NETWORK DRIVER
94999509
M: Mark Einon <mark.einon@gmail.com>
95009510
S: Odd Fixes

drivers/clk/Kconfig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ config COMMON_CLK_CS2000_CP
218218
If you say yes here you get support for the CS2000 clock multiplier.
219219

220220
config COMMON_CLK_EN7523
221-
bool "Clock driver for Airoha EN7523 SoC system clocks"
221+
bool "Clock driver for Airoha/EcoNet SoC system clocks"
222222
depends on OF
223-
depends on ARCH_AIROHA || COMPILE_TEST
223+
depends on ARCH_AIROHA || ECONET || COMPILE_TEST
224224
default ARCH_AIROHA
225225
help
226226
This driver provides the fixed clocks and gates present on Airoha
227-
ARM silicon.
227+
and EcoNet silicon.
228228

229229
config COMMON_CLK_EP93XX
230230
tristate "Clock driver for Cirrus Logic ep93xx SoC"
@@ -504,6 +504,7 @@ source "drivers/clk/analogbits/Kconfig"
504504
source "drivers/clk/aspeed/Kconfig"
505505
source "drivers/clk/baikal-t1/Kconfig"
506506
source "drivers/clk/bcm/Kconfig"
507+
source "drivers/clk/eswin/Kconfig"
507508
source "drivers/clk/hisilicon/Kconfig"
508509
source "drivers/clk/imgtec/Kconfig"
509510
source "drivers/clk/imx/Kconfig"

drivers/clk/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ obj-$(CONFIG_CLK_BAIKAL_T1) += baikal-t1/
120120
obj-y += bcm/
121121
obj-$(CONFIG_ARCH_BERLIN) += berlin/
122122
obj-$(CONFIG_ARCH_DAVINCI) += davinci/
123+
obj-$(CONFIG_COMMON_CLK_ESWIN) += eswin/
123124
obj-$(CONFIG_ARCH_HISI) += hisilicon/
124125
obj-y += imgtec/
125126
obj-y += imx/

drivers/clk/bcm/clk-raspberrypi.c

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,31 @@ static int raspberrypi_fw_dumb_determine_rate(struct clk_hw *hw,
289289
static int raspberrypi_fw_prepare(struct clk_hw *hw)
290290
{
291291
const struct raspberrypi_clk_data *data = clk_hw_to_data(hw);
292+
struct raspberrypi_clk_variant *variant = data->variant;
292293
struct raspberrypi_clk *rpi = data->rpi;
293294
u32 state = RPI_FIRMWARE_STATE_ENABLE_BIT;
294295
int ret;
295296

296297
ret = raspberrypi_clock_property(rpi->firmware, data,
297298
RPI_FIRMWARE_SET_CLOCK_STATE, &state);
298-
if (ret)
299+
if (ret) {
299300
dev_err_ratelimited(rpi->dev,
300301
"Failed to set clock %s state to on: %d\n",
301302
clk_hw_get_name(hw), ret);
303+
return ret;
304+
}
305+
306+
/*
307+
* For clocks marked with 'maximize', restore the rate to the
308+
* maximum after enabling. This compensates for the rate being
309+
* set to minimum during unprepare (see raspberrypi_fw_unprepare).
310+
*/
311+
if (variant->maximize) {
312+
unsigned long min_rate, max_rate;
313+
314+
clk_hw_get_rate_range(hw, &min_rate, &max_rate);
315+
ret = raspberrypi_fw_set_rate(hw, max_rate, 0);
316+
}
302317

303318
return ret;
304319
}
@@ -307,9 +322,27 @@ static void raspberrypi_fw_unprepare(struct clk_hw *hw)
307322
{
308323
const struct raspberrypi_clk_data *data = clk_hw_to_data(hw);
309324
struct raspberrypi_clk *rpi = data->rpi;
325+
unsigned long min_rate, max_rate;
310326
u32 state = 0;
311327
int ret;
312328

329+
clk_hw_get_rate_range(hw, &min_rate, &max_rate);
330+
331+
/*
332+
* Setting the rate in unprepare is a deviation from the usual CCF
333+
* behavior, where unprepare only gates the clock. However, this is
334+
* needed, as RPI_FIRMWARE_SET_CLOCK_STATE doesn't actually power off
335+
* the clock on current firmware versions. Setting the rate to minimum
336+
* before disabling the clock is the only way to achieve meaningful
337+
* power savings.
338+
*
339+
* This is safe because no consumer should rely on the rate of an
340+
* unprepared clock. Any consumer must call clk_prepare() before use,
341+
* at which point the rate is either restored to maximum (for clocks
342+
* with the 'maximize' flag) or re-established by the consumer.
343+
*/
344+
raspberrypi_fw_set_rate(hw, min_rate, 0);
345+
313346
ret = raspberrypi_clock_property(rpi->firmware, data,
314347
RPI_FIRMWARE_SET_CLOCK_STATE, &state);
315348
if (ret)
@@ -387,9 +420,6 @@ static struct clk_hw *raspberrypi_clk_register(struct raspberrypi_clk *rpi,
387420
}
388421
}
389422

390-
if (variant->maximize)
391-
variant->min_rate = max_rate;
392-
393423
if (variant->min_rate) {
394424
unsigned long rate;
395425

0 commit comments

Comments
 (0)