Skip to content

Commit f9efefd

Browse files
committed
Merge branches 'clk-baikal', 'clk-broadcom', 'clk-vc5' and 'clk-versaclock' into clk-next
- Convert Baikal-T1 CCU driver to platform driver - Split reset support out of primary Baikal-T1 CCU driver - Add some missing clks required for RPiVid Video Decoder on RaspberryPi - Mark PLLC critical on bcm2835 - Support for Renesas VersaClock7 clock generator family * clk-baikal: clk: baikal-t1: Convert to platform device driver clk: baikal-t1: Add DDR/PCIe directly controlled resets support dt-bindings: clk: baikal-t1: Add DDR/PCIe reset IDs clk: baikal-t1: Move reset-controls code into a dedicated module clk: baikal-t1: Add SATA internal ref clock buffer clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent clk: baikal-t1: Fix invalid xGMAC PTP clock divider clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD * clk-broadcom: clk: bcm: rpi: Add support for VEC clock clk: bcm: rpi: Handle pixel clock in firmware clk: bcm: rpi: Add support HEVC clock clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration clk: bcm2835: Round UART input clock up clk: bcm2835: Make peripheral PLLC critical * clk-vc5: clk: vc5: Add support for IDT/Renesas VersaClock 5P49V6975 dt-bindings: clock: vc5: Add 5P49V6975 clk: vc5: Use regmap_{set,clear}_bits() where appropriate clk: vc5: Check IO access results * clk-versaclock: clk: Renesas versaclock7 ccf device driver dt-bindings: Renesas versaclock7 device tree bindings
5 parents b7f257c + c4e0544 + 1777cb6 + d847383 + 48c5e98 commit f9efefd

File tree

19 files changed

+2182
-224
lines changed

19 files changed

+2182
-224
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ properties:
5656
- idt,5p49v5935
5757
- idt,5p49v6901
5858
- idt,5p49v6965
59+
- idt,5p49v6975
5960

6061
reg:
6162
description: I2C device address
@@ -134,6 +135,7 @@ allOf:
134135
enum:
135136
- idt,5p49v5933
136137
- idt,5p49v5935
138+
- idt,5p49v6975
137139
then:
138140
# Devices with builtin crystal + optional external input
139141
properties:
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/clock/renesas,versaclock7.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Renesas Versaclock7 Programmable Clock Device Tree Bindings
8+
9+
maintainers:
10+
- Alex Helms <alexander.helms.jy@renesas.com>
11+
12+
description: |
13+
Renesas Versaclock7 is a family of configurable clock generator and
14+
jitter attenuator ICs with fractional and integer dividers.
15+
16+
properties:
17+
'#clock-cells':
18+
const: 1
19+
20+
compatible:
21+
enum:
22+
- renesas,rc21008a
23+
24+
reg:
25+
maxItems: 1
26+
27+
clocks:
28+
items:
29+
- description: External crystal or oscillator
30+
31+
clock-names:
32+
items:
33+
- const: xin
34+
35+
required:
36+
- '#clock-cells'
37+
- compatible
38+
- reg
39+
- clocks
40+
- clock-names
41+
42+
additionalProperties: false
43+
44+
examples:
45+
- |
46+
vc7_xin: clock {
47+
compatible = "fixed-clock";
48+
#clock-cells = <0>;
49+
clock-frequency = <49152000>;
50+
};
51+
52+
i2c@0 {
53+
reg = <0x0 0x100>;
54+
#address-cells = <1>;
55+
#size-cells = <0>;
56+
57+
vc7: clock-controller@9 {
58+
compatible = "renesas,rc21008a";
59+
reg = <0x9>;
60+
#clock-cells = <1>;
61+
clocks = <&vc7_xin>;
62+
clock-names = "xin";
63+
};
64+
};

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17442,6 +17442,12 @@ S: Maintained
1744217442
F: Documentation/devicetree/bindings/mtd/renesas-nandc.yaml
1744317443
F: drivers/mtd/nand/raw/renesas-nand-controller.c
1744417444

17445+
RENESAS VERSACLOCK 7 CLOCK DRIVER
17446+
M: Alex Helms <alexander.helms.jy@renesas.com>
17447+
S: Maintained
17448+
F: Documentation/devicetree/bindings/clock/renesas,versaclock7.yaml
17449+
F: drivers/clk/clk-versaclock7.c
17450+
1744517451
RESET CONTROLLER FRAMEWORK
1744617452
M: Philipp Zabel <p.zabel@pengutronix.de>
1744717453
S: Maintained

drivers/clk/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,15 @@ config COMMON_CLK_VC5
377377
This driver supports the IDT VersaClock 5 and VersaClock 6
378378
programmable clock generators.
379379

380+
config COMMON_CLK_VC7
381+
tristate "Clock driver for Renesas Versaclock 7 devices"
382+
depends on I2C
383+
depends on OF
384+
select REGMAP_I2C
385+
help
386+
Renesas Versaclock7 is a family of configurable clock generator
387+
and jitter attenuator ICs with fractional and integer dividers.
388+
380389
config COMMON_CLK_STM32MP135
381390
def_bool COMMON_CLK && MACH_STM32MP13
382391
help

drivers/clk/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ obj-$(CONFIG_CLK_TWL6040) += clk-twl6040.o
7373
obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o
7474
obj-$(CONFIG_COMMON_CLK_RS9_PCIE) += clk-renesas-pcie.o
7575
obj-$(CONFIG_COMMON_CLK_VC5) += clk-versaclock5.o
76+
obj-$(CONFIG_COMMON_CLK_VC7) += clk-versaclock7.o
7677
obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
7778
obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o
7879

drivers/clk/baikal-t1/Kconfig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ config CLK_BT1_CCU_PLL
2929

3030
config CLK_BT1_CCU_DIV
3131
bool "Baikal-T1 CCU Dividers support"
32-
select RESET_CONTROLLER
3332
select MFD_SYSCON
3433
default MIPS_BAIKAL_T1
3534
help
@@ -39,4 +38,15 @@ config CLK_BT1_CCU_DIV
3938
either gateable or ungateable. Some of the CCU dividers can be as well
4039
used to reset the domains they're supplying clock to.
4140

41+
config CLK_BT1_CCU_RST
42+
bool "Baikal-T1 CCU Resets support"
43+
select RESET_CONTROLLER
44+
select MFD_SYSCON
45+
default MIPS_BAIKAL_T1
46+
help
47+
Enable this to support the CCU reset blocks responsible for the
48+
AXI-bus and some subsystems reset. These are mainly the
49+
self-deasserted reset controls but there are several lines which
50+
can be directly asserted/de-asserted (PCIe and DDR sub-domains).
51+
4252
endif

drivers/clk/baikal-t1/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-$(CONFIG_CLK_BT1_CCU_PLL) += ccu-pll.o clk-ccu-pll.o
33
obj-$(CONFIG_CLK_BT1_CCU_DIV) += ccu-div.o clk-ccu-div.o
4+
obj-$(CONFIG_CLK_BT1_CCU_RST) += ccu-rst.o

drivers/clk/baikal-t1/ccu-div.c

Lines changed: 65 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
#define CCU_DIV_CTL_CLKDIV_MASK(_width) \
3535
GENMASK((_width) + CCU_DIV_CTL_CLKDIV_FLD - 1, CCU_DIV_CTL_CLKDIV_FLD)
3636
#define CCU_DIV_CTL_LOCK_SHIFTED BIT(27)
37+
#define CCU_DIV_CTL_GATE_REF_BUF BIT(28)
3738
#define CCU_DIV_CTL_LOCK_NORMAL BIT(31)
3839

39-
#define CCU_DIV_RST_DELAY_US 1
4040
#define CCU_DIV_LOCK_CHECK_RETRIES 50
4141

4242
#define CCU_DIV_CLKDIV_MIN 0
@@ -170,6 +170,40 @@ static int ccu_div_gate_is_enabled(struct clk_hw *hw)
170170
return !!(val & CCU_DIV_CTL_EN);
171171
}
172172

173+
static int ccu_div_buf_enable(struct clk_hw *hw)
174+
{
175+
struct ccu_div *div = to_ccu_div(hw);
176+
unsigned long flags;
177+
178+
spin_lock_irqsave(&div->lock, flags);
179+
regmap_update_bits(div->sys_regs, div->reg_ctl,
180+
CCU_DIV_CTL_GATE_REF_BUF, 0);
181+
spin_unlock_irqrestore(&div->lock, flags);
182+
183+
return 0;
184+
}
185+
186+
static void ccu_div_buf_disable(struct clk_hw *hw)
187+
{
188+
struct ccu_div *div = to_ccu_div(hw);
189+
unsigned long flags;
190+
191+
spin_lock_irqsave(&div->lock, flags);
192+
regmap_update_bits(div->sys_regs, div->reg_ctl,
193+
CCU_DIV_CTL_GATE_REF_BUF, CCU_DIV_CTL_GATE_REF_BUF);
194+
spin_unlock_irqrestore(&div->lock, flags);
195+
}
196+
197+
static int ccu_div_buf_is_enabled(struct clk_hw *hw)
198+
{
199+
struct ccu_div *div = to_ccu_div(hw);
200+
u32 val = 0;
201+
202+
regmap_read(div->sys_regs, div->reg_ctl, &val);
203+
204+
return !(val & CCU_DIV_CTL_GATE_REF_BUF);
205+
}
206+
173207
static unsigned long ccu_div_var_recalc_rate(struct clk_hw *hw,
174208
unsigned long parent_rate)
175209
{
@@ -288,24 +322,6 @@ static int ccu_div_fixed_set_rate(struct clk_hw *hw, unsigned long rate,
288322
return 0;
289323
}
290324

291-
int ccu_div_reset_domain(struct ccu_div *div)
292-
{
293-
unsigned long flags;
294-
295-
if (!div || !(div->features & CCU_DIV_RESET_DOMAIN))
296-
return -EINVAL;
297-
298-
spin_lock_irqsave(&div->lock, flags);
299-
regmap_update_bits(div->sys_regs, div->reg_ctl,
300-
CCU_DIV_CTL_RST, CCU_DIV_CTL_RST);
301-
spin_unlock_irqrestore(&div->lock, flags);
302-
303-
/* The next delay must be enough to cover all the resets. */
304-
udelay(CCU_DIV_RST_DELAY_US);
305-
306-
return 0;
307-
}
308-
309325
#ifdef CONFIG_DEBUG_FS
310326

311327
struct ccu_div_dbgfs_bit {
@@ -323,6 +339,7 @@ static const struct ccu_div_dbgfs_bit ccu_div_bits[] = {
323339
CCU_DIV_DBGFS_BIT_ATTR("div_en", CCU_DIV_CTL_EN),
324340
CCU_DIV_DBGFS_BIT_ATTR("div_rst", CCU_DIV_CTL_RST),
325341
CCU_DIV_DBGFS_BIT_ATTR("div_bypass", CCU_DIV_CTL_SET_CLKDIV),
342+
CCU_DIV_DBGFS_BIT_ATTR("div_buf", CCU_DIV_CTL_GATE_REF_BUF),
326343
CCU_DIV_DBGFS_BIT_ATTR("div_lock", CCU_DIV_CTL_LOCK_NORMAL)
327344
};
328345

@@ -441,6 +458,9 @@ static void ccu_div_var_debug_init(struct clk_hw *hw, struct dentry *dentry)
441458
continue;
442459
}
443460

461+
if (!strcmp("div_buf", name))
462+
continue;
463+
444464
bits[didx] = ccu_div_bits[bidx];
445465
bits[didx].div = div;
446466

@@ -477,6 +497,21 @@ static void ccu_div_gate_debug_init(struct clk_hw *hw, struct dentry *dentry)
477497
&ccu_div_dbgfs_fixed_clkdiv_fops);
478498
}
479499

500+
static void ccu_div_buf_debug_init(struct clk_hw *hw, struct dentry *dentry)
501+
{
502+
struct ccu_div *div = to_ccu_div(hw);
503+
struct ccu_div_dbgfs_bit *bit;
504+
505+
bit = kmalloc(sizeof(*bit), GFP_KERNEL);
506+
if (!bit)
507+
return;
508+
509+
*bit = ccu_div_bits[3];
510+
bit->div = div;
511+
debugfs_create_file_unsafe(bit->name, ccu_div_dbgfs_mode, dentry, bit,
512+
&ccu_div_dbgfs_bit_fops);
513+
}
514+
480515
static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry)
481516
{
482517
struct ccu_div *div = to_ccu_div(hw);
@@ -489,6 +524,7 @@ static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry)
489524

490525
#define ccu_div_var_debug_init NULL
491526
#define ccu_div_gate_debug_init NULL
527+
#define ccu_div_buf_debug_init NULL
492528
#define ccu_div_fixed_debug_init NULL
493529

494530
#endif /* !CONFIG_DEBUG_FS */
@@ -520,6 +556,13 @@ static const struct clk_ops ccu_div_gate_ops = {
520556
.debug_init = ccu_div_gate_debug_init
521557
};
522558

559+
static const struct clk_ops ccu_div_buf_ops = {
560+
.enable = ccu_div_buf_enable,
561+
.disable = ccu_div_buf_disable,
562+
.is_enabled = ccu_div_buf_is_enabled,
563+
.debug_init = ccu_div_buf_debug_init
564+
};
565+
523566
static const struct clk_ops ccu_div_fixed_ops = {
524567
.recalc_rate = ccu_div_fixed_recalc_rate,
525568
.round_rate = ccu_div_fixed_round_rate,
@@ -566,6 +609,8 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init)
566609
} else if (div_init->type == CCU_DIV_GATE) {
567610
hw_init.ops = &ccu_div_gate_ops;
568611
div->divider = div_init->divider;
612+
} else if (div_init->type == CCU_DIV_BUF) {
613+
hw_init.ops = &ccu_div_buf_ops;
569614
} else if (div_init->type == CCU_DIV_FIXED) {
570615
hw_init.ops = &ccu_div_fixed_ops;
571616
div->divider = div_init->divider;
@@ -579,6 +624,7 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init)
579624
goto err_free_div;
580625
}
581626
parent_data.fw_name = div_init->parent_name;
627+
parent_data.name = div_init->parent_name;
582628
hw_init.parent_data = &parent_data;
583629
hw_init.num_parents = 1;
584630

drivers/clk/baikal-t1/ccu-div.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,26 @@
1313
#include <linux/bits.h>
1414
#include <linux/of.h>
1515

16+
/*
17+
* CCU Divider private clock IDs
18+
* @CCU_SYS_SATA_CLK: CCU SATA internal clock
19+
* @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock
20+
*/
21+
#define CCU_SYS_SATA_CLK -1
22+
#define CCU_SYS_XGMAC_CLK -2
23+
1624
/*
1725
* CCU Divider private flags
26+
* @CCU_DIV_BASIC: Basic divider clock required by the kernel as early as
27+
* possible.
1828
* @CCU_DIV_SKIP_ONE: Due to some reason divider can't be set to 1.
1929
* It can be 0 though, which is functionally the same.
2030
* @CCU_DIV_SKIP_ONE_TO_THREE: For some reason divider can't be within [1,3].
2131
* It can be either 0 or greater than 3.
2232
* @CCU_DIV_LOCK_SHIFTED: Find lock-bit at non-standard position.
23-
* @CCU_DIV_RESET_DOMAIN: Provide reset clock domain method.
33+
* @CCU_DIV_RESET_DOMAIN: There is a clock domain reset handle.
2434
*/
35+
#define CCU_DIV_BASIC BIT(0)
2536
#define CCU_DIV_SKIP_ONE BIT(1)
2637
#define CCU_DIV_SKIP_ONE_TO_THREE BIT(2)
2738
#define CCU_DIV_LOCK_SHIFTED BIT(3)
@@ -31,11 +42,13 @@
3142
* enum ccu_div_type - CCU Divider types
3243
* @CCU_DIV_VAR: Clocks gate with variable divider.
3344
* @CCU_DIV_GATE: Clocks gate with fixed divider.
45+
* @CCU_DIV_BUF: Clock gate with no divider.
3446
* @CCU_DIV_FIXED: Ungateable clock with fixed divider.
3547
*/
3648
enum ccu_div_type {
3749
CCU_DIV_VAR,
3850
CCU_DIV_GATE,
51+
CCU_DIV_BUF,
3952
CCU_DIV_FIXED
4053
};
4154

@@ -105,6 +118,4 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *init);
105118

106119
void ccu_div_hw_unregister(struct ccu_div *div);
107120

108-
int ccu_div_reset_domain(struct ccu_div *div);
109-
110121
#endif /* __CLK_BT1_CCU_DIV_H__ */

drivers/clk/baikal-t1/ccu-pll.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
#include <linux/bits.h>
1414
#include <linux/of.h>
1515

16+
/*
17+
* CCU PLL private flags
18+
* @CCU_PLL_BASIC: Basic PLL required by the kernel as early as possible.
19+
*/
20+
#define CCU_PLL_BASIC BIT(0)
21+
1622
/*
1723
* struct ccu_pll_init_data - CCU PLL initialization data
1824
* @id: Clock private identifier.
@@ -22,6 +28,7 @@
2228
* @sys_regs: Baikal-T1 System Controller registers map.
2329
* @np: Pointer to the node describing the CCU PLLs.
2430
* @flags: PLL clock flags.
31+
* @features: PLL private features.
2532
*/
2633
struct ccu_pll_init_data {
2734
unsigned int id;
@@ -31,6 +38,7 @@ struct ccu_pll_init_data {
3138
struct regmap *sys_regs;
3239
struct device_node *np;
3340
unsigned long flags;
41+
unsigned long features;
3442
};
3543

3644
/*

0 commit comments

Comments
 (0)