Skip to content

Commit 407c04d

Browse files
committed
Merge branches 'clk-microchip', 'clk-si', 'clk-mtk', 'clk-at91' and 'clk-st' into clk-next
- Clock configuration on Microchip PolarFire SoCs - Free allocations on probe error in Mediatek clk driver - Modernize Mediatek clk driver by consolidating code * clk-microchip: clk: microchip: Add driver for Microchip PolarFire SoC dt-bindings: clk: microchip: Add Microchip PolarFire host binding * clk-si: clk-si5341: replace snprintf in show functions with sysfs_emit clk: si5341: fix reported clk_rate when output divider is 2 * clk-mtk: (32 commits) clk: mediatek: Warn if clk IDs are duplicated clk: mediatek: mt8195: Implement remove functions clk: mediatek: mt8195: Implement error handling in probe functions clk: mediatek: mt8195: Hook up mtk_clk_simple_remove() clk: mediatek: Unregister clks in mtk_clk_simple_probe() error path clk: mediatek: mtk: Implement error handling in register APIs clk: mediatek: pll: Implement error handling in register API clk: mediatek: mux: Implement error handling in register API clk: mediatek: mux: Reverse check for existing clk to reduce nesting level clk: mediatek: gate: Implement error handling in register API clk: mediatek: cpumux: Implement error handling in register API clk: mediatek: mtk: Clean up included headers clk: mediatek: Add mtk_clk_simple_remove() clk: mediatek: Implement mtk_clk_unregister_composites() API clk: mediatek: Implement mtk_clk_unregister_divider_clks() API clk: mediatek: Implement mtk_clk_unregister_factors() API clk: mediatek: Implement mtk_clk_unregister_fixed_clks() API clk: mediatek: pll: Clean up included headers clk: mediatek: pll: Implement unregister API clk: mediatek: pll: Split definitions into separate header file ... * clk-at91: clk: at91: clk-master: remove dead code clk: at91: sama7g5: fix parents of PDMCs' GCLK clk: at91: sama7g5: Allow MCK1 to be exported and referenced in DT clk: at91: allow setting PMC_AUDIOPINCK clock parents via DT * clk-st: clk: stm32mp1: Add parent_data to ETHRX clock clk: stm32mp1: Split ETHCK_K into separate MUX and GATE clock
6 parents 754e0b0 + 635e5e7 + 982c595 + d54bb86 + 34f7497 + e9ed1ef commit 407c04d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1516
-460
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/clock/microchip,mpfs.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Microchip PolarFire Clock Control Module Binding
8+
9+
maintainers:
10+
- Daire McNamara <daire.mcnamara@microchip.com>
11+
12+
description: |
13+
Microchip PolarFire clock control (CLKCFG) is an integrated clock controller,
14+
which gates and enables all peripheral clocks.
15+
16+
This device tree binding describes 33 gate clocks. Clocks are referenced by
17+
user nodes by the CLKCFG node phandle and the clock index in the group, from
18+
0 to 32.
19+
20+
properties:
21+
compatible:
22+
const: microchip,mpfs-clkcfg
23+
24+
reg:
25+
maxItems: 1
26+
27+
clocks:
28+
maxItems: 1
29+
30+
'#clock-cells':
31+
const: 1
32+
description: |
33+
The clock consumer should specify the desired clock by having the clock
34+
ID in its "clocks" phandle cell. See include/dt-bindings/clock/microchip,mpfs-clock.h
35+
for the full list of PolarFire clock IDs.
36+
37+
required:
38+
- compatible
39+
- reg
40+
- clocks
41+
- '#clock-cells'
42+
43+
additionalProperties: false
44+
45+
examples:
46+
# Clock Config node:
47+
- |
48+
#include <dt-bindings/clock/microchip,mpfs-clock.h>
49+
soc {
50+
#address-cells = <2>;
51+
#size-cells = <2>;
52+
clkcfg: clock-controller@20002000 {
53+
compatible = "microchip,mpfs-clkcfg";
54+
reg = <0x0 0x20002000 0x0 0x1000>;
55+
clocks = <&ref>;
56+
#clock-cells = <1>;
57+
};
58+
};

drivers/clk/Kconfig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,6 @@ config COMMON_CLK_PXA
330330
help
331331
Support for the Marvell PXA SoC.
332332

333-
config COMMON_CLK_PIC32
334-
def_bool COMMON_CLK && MACH_PIC32
335-
336333
config COMMON_CLK_OXNAS
337334
bool "Clock driver for the OXNAS SoC Family"
338335
depends on ARCH_OXNAS || COMPILE_TEST
@@ -407,6 +404,7 @@ source "drivers/clk/keystone/Kconfig"
407404
source "drivers/clk/mediatek/Kconfig"
408405
source "drivers/clk/meson/Kconfig"
409406
source "drivers/clk/mstar/Kconfig"
407+
source "drivers/clk/microchip/Kconfig"
410408
source "drivers/clk/mvebu/Kconfig"
411409
source "drivers/clk/pistachio/Kconfig"
412410
source "drivers/clk/qcom/Kconfig"

drivers/clk/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ obj-$(CONFIG_ARCH_KEYSTONE) += keystone/
9191
obj-$(CONFIG_MACH_LOONGSON32) += loongson1/
9292
obj-y += mediatek/
9393
obj-$(CONFIG_ARCH_MESON) += meson/
94-
obj-$(CONFIG_MACH_PIC32) += microchip/
94+
obj-y += microchip/
9595
ifeq ($(CONFIG_COMMON_CLK), y)
9696
obj-$(CONFIG_ARCH_MMP) += mmp/
9797
endif

drivers/clk/at91/at91rm9200.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
143143
parent_names,
144144
&at91rm9200_master_layout,
145145
&rm9200_mck_characteristics,
146-
&rm9200_mck_lock, CLK_SET_RATE_GATE,
147-
INT_MIN);
146+
&rm9200_mck_lock);
148147
if (IS_ERR(hw))
149148
goto err_free;
150149

drivers/clk/at91/at91sam9260.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
419419
parent_names,
420420
&at91rm9200_master_layout,
421421
data->mck_characteristics,
422-
&at91sam9260_mck_lock,
423-
CLK_SET_RATE_GATE, INT_MIN);
422+
&at91sam9260_mck_lock);
424423
if (IS_ERR(hw))
425424
goto err_free;
426425

drivers/clk/at91/at91sam9g45.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
154154
parent_names,
155155
&at91rm9200_master_layout,
156156
&mck_characteristics,
157-
&at91sam9g45_mck_lock,
158-
CLK_SET_RATE_GATE, INT_MIN);
157+
&at91sam9g45_mck_lock);
159158
if (IS_ERR(hw))
160159
goto err_free;
161160

drivers/clk/at91/at91sam9n12.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
181181
parent_names,
182182
&at91sam9x5_master_layout,
183183
&mck_characteristics,
184-
&at91sam9n12_mck_lock,
185-
CLK_SET_RATE_GATE, INT_MIN);
184+
&at91sam9n12_mck_lock);
186185
if (IS_ERR(hw))
187186
goto err_free;
188187

drivers/clk/at91/at91sam9rl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
123123
parent_names,
124124
&at91rm9200_master_layout,
125125
&sam9rl_mck_characteristics,
126-
&sam9rl_mck_lock, CLK_SET_RATE_GATE,
127-
INT_MIN);
126+
&sam9rl_mck_lock);
128127
if (IS_ERR(hw))
129128
goto err_free;
130129

drivers/clk/at91/at91sam9x5.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
201201
hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
202202
parent_names,
203203
&at91sam9x5_master_layout,
204-
&mck_characteristics, &mck_lock,
205-
CLK_SET_RATE_GATE, INT_MIN);
204+
&mck_characteristics, &mck_lock);
206205
if (IS_ERR(hw))
207206
goto err_free;
208207

drivers/clk/at91/clk-master.c

Lines changed: 6 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -374,85 +374,6 @@ static void clk_sama7g5_master_best_diff(struct clk_rate_request *req,
374374
}
375375
}
376376

377-
static int clk_master_pres_determine_rate(struct clk_hw *hw,
378-
struct clk_rate_request *req)
379-
{
380-
struct clk_master *master = to_clk_master(hw);
381-
struct clk_rate_request req_parent = *req;
382-
const struct clk_master_characteristics *characteristics =
383-
master->characteristics;
384-
struct clk_hw *parent;
385-
long best_rate = LONG_MIN, best_diff = LONG_MIN;
386-
u32 pres;
387-
int i;
388-
389-
if (master->chg_pid < 0)
390-
return -EOPNOTSUPP;
391-
392-
parent = clk_hw_get_parent_by_index(hw, master->chg_pid);
393-
if (!parent)
394-
return -EOPNOTSUPP;
395-
396-
for (i = 0; i <= MASTER_PRES_MAX; i++) {
397-
if (characteristics->have_div3_pres && i == MASTER_PRES_MAX)
398-
pres = 3;
399-
else
400-
pres = 1 << i;
401-
402-
req_parent.rate = req->rate * pres;
403-
if (__clk_determine_rate(parent, &req_parent))
404-
continue;
405-
406-
clk_sama7g5_master_best_diff(req, parent, req_parent.rate,
407-
&best_diff, &best_rate, pres);
408-
if (!best_diff)
409-
break;
410-
}
411-
412-
return 0;
413-
}
414-
415-
static int clk_master_pres_set_rate(struct clk_hw *hw, unsigned long rate,
416-
unsigned long parent_rate)
417-
{
418-
struct clk_master *master = to_clk_master(hw);
419-
unsigned long flags;
420-
unsigned int pres, mckr, tmp;
421-
int ret;
422-
423-
pres = DIV_ROUND_CLOSEST(parent_rate, rate);
424-
if (pres > MASTER_PRES_MAX)
425-
return -EINVAL;
426-
427-
else if (pres == 3)
428-
pres = MASTER_PRES_MAX;
429-
else if (pres)
430-
pres = ffs(pres) - 1;
431-
432-
spin_lock_irqsave(master->lock, flags);
433-
ret = regmap_read(master->regmap, master->layout->offset, &mckr);
434-
if (ret)
435-
goto unlock;
436-
437-
mckr &= master->layout->mask;
438-
tmp = (mckr >> master->layout->pres_shift) & MASTER_PRES_MASK;
439-
if (pres == tmp)
440-
goto unlock;
441-
442-
mckr &= ~(MASTER_PRES_MASK << master->layout->pres_shift);
443-
mckr |= (pres << master->layout->pres_shift);
444-
ret = regmap_write(master->regmap, master->layout->offset, mckr);
445-
if (ret)
446-
goto unlock;
447-
448-
while (!clk_master_ready(master))
449-
cpu_relax();
450-
unlock:
451-
spin_unlock_irqrestore(master->lock, flags);
452-
453-
return ret;
454-
}
455-
456377
static unsigned long clk_master_pres_recalc_rate(struct clk_hw *hw,
457378
unsigned long parent_rate)
458379
{
@@ -539,13 +460,6 @@ static void clk_master_pres_restore_context(struct clk_hw *hw)
539460
pr_warn("MCKR PRES was not configured properly by firmware!\n");
540461
}
541462

542-
static void clk_master_pres_restore_context_chg(struct clk_hw *hw)
543-
{
544-
struct clk_master *master = to_clk_master(hw);
545-
546-
clk_master_pres_set_rate(hw, master->pms.rate, master->pms.parent_rate);
547-
}
548-
549463
static const struct clk_ops master_pres_ops = {
550464
.prepare = clk_master_prepare,
551465
.is_prepared = clk_master_is_prepared,
@@ -555,25 +469,13 @@ static const struct clk_ops master_pres_ops = {
555469
.restore_context = clk_master_pres_restore_context,
556470
};
557471

558-
static const struct clk_ops master_pres_ops_chg = {
559-
.prepare = clk_master_prepare,
560-
.is_prepared = clk_master_is_prepared,
561-
.determine_rate = clk_master_pres_determine_rate,
562-
.recalc_rate = clk_master_pres_recalc_rate,
563-
.get_parent = clk_master_pres_get_parent,
564-
.set_rate = clk_master_pres_set_rate,
565-
.save_context = clk_master_pres_save_context,
566-
.restore_context = clk_master_pres_restore_context_chg,
567-
};
568-
569472
static struct clk_hw * __init
570473
at91_clk_register_master_internal(struct regmap *regmap,
571474
const char *name, int num_parents,
572475
const char **parent_names,
573476
const struct clk_master_layout *layout,
574477
const struct clk_master_characteristics *characteristics,
575-
const struct clk_ops *ops, spinlock_t *lock, u32 flags,
576-
int chg_pid)
478+
const struct clk_ops *ops, spinlock_t *lock, u32 flags)
577479
{
578480
struct clk_master *master;
579481
struct clk_init_data init;
@@ -599,7 +501,6 @@ at91_clk_register_master_internal(struct regmap *regmap,
599501
master->layout = layout;
600502
master->characteristics = characteristics;
601503
master->regmap = regmap;
602-
master->chg_pid = chg_pid;
603504
master->lock = lock;
604505

605506
if (ops == &master_div_ops_chg) {
@@ -628,19 +529,13 @@ at91_clk_register_master_pres(struct regmap *regmap,
628529
const char **parent_names,
629530
const struct clk_master_layout *layout,
630531
const struct clk_master_characteristics *characteristics,
631-
spinlock_t *lock, u32 flags, int chg_pid)
532+
spinlock_t *lock)
632533
{
633-
const struct clk_ops *ops;
634-
635-
if (flags & CLK_SET_RATE_GATE)
636-
ops = &master_pres_ops;
637-
else
638-
ops = &master_pres_ops_chg;
639-
640534
return at91_clk_register_master_internal(regmap, name, num_parents,
641535
parent_names, layout,
642-
characteristics, ops,
643-
lock, flags, chg_pid);
536+
characteristics,
537+
&master_pres_ops,
538+
lock, CLK_SET_RATE_GATE);
644539
}
645540

646541
struct clk_hw * __init
@@ -661,7 +556,7 @@ at91_clk_register_master_div(struct regmap *regmap,
661556
hw = at91_clk_register_master_internal(regmap, name, 1,
662557
&parent_name, layout,
663558
characteristics, ops,
664-
lock, flags, -EINVAL);
559+
lock, flags);
665560

666561
if (!IS_ERR(hw) && safe_div) {
667562
master_div = to_clk_master(hw);

0 commit comments

Comments
 (0)