summaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@kernel.org>2018-06-01 10:26:06 -0700
committerStephen Boyd <sboyd@kernel.org>2018-06-01 10:26:06 -0700
commit533dfd6050356b5c341ec058058c94301e837f45 (patch)
treed95a0a3079504c5ce3b1d1eb830fd0d7e5e3ae0c /drivers/clk
parent60cc43fc888428bb2f18f08997432d426a243338 (diff)
parent1d646229f28d2c413572905f03f71af33b903cc5 (diff)
downloadlinux-533dfd6050356b5c341ec058058c94301e837f45.tar.bz2
Merge tag 'v4.18-rockchip-clk-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into clk-rockchip
Pull rockchip clk driver updates from Heiko Stuebner: Conversion to match_string helper of open-coded string comparison and removal of the initial devicetree-based gate-clocks, which were deprecated since 2014. * tag 'v4.18-rockchip-clk-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip: clk: rockchip: remove deprecated gate-clk code and dt-binding clk: rockchip: use match_string() helper
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/rockchip/Makefile1
-rw-r--r--drivers/clk/rockchip/clk-rockchip.c98
-rw-r--r--drivers/clk/rockchip/clk.c16
3 files changed, 5 insertions, 110 deletions
diff --git a/drivers/clk/rockchip/Makefile b/drivers/clk/rockchip/Makefile
index 59b8d320960a..98e7b9429b83 100644
--- a/drivers/clk/rockchip/Makefile
+++ b/drivers/clk/rockchip/Makefile
@@ -3,7 +3,6 @@
# Rockchip Clock specific Makefile
#
-obj-y += clk-rockchip.o
obj-y += clk.o
obj-y += clk-pll.o
obj-y += clk-cpu.o
diff --git a/drivers/clk/rockchip/clk-rockchip.c b/drivers/clk/rockchip/clk-rockchip.c
deleted file mode 100644
index 2c9bb81144c9..000000000000
--- a/drivers/clk/rockchip/clk-rockchip.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2013 MundoReader S.L.
- * Author: Heiko Stuebner <heiko@sntech.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <linux/clk-provider.h>
-#include <linux/clkdev.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-
-static DEFINE_SPINLOCK(clk_lock);
-
-/*
- * Gate clocks
- */
-
-static void __init rk2928_gate_clk_init(struct device_node *node)
-{
- struct clk_onecell_data *clk_data;
- const char *clk_parent;
- const char *clk_name;
- void __iomem *reg;
- void __iomem *reg_idx;
- int flags;
- int qty;
- int reg_bit;
- int clkflags = CLK_SET_RATE_PARENT;
- int i;
-
- qty = of_property_count_strings(node, "clock-output-names");
- if (qty < 0) {
- pr_err("%s: error in clock-output-names %d\n", __func__, qty);
- return;
- }
-
- if (qty == 0) {
- pr_info("%s: nothing to do\n", __func__);
- return;
- }
-
- reg = of_iomap(node, 0);
- if (!reg)
- return;
-
- clk_data = kzalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);
- if (!clk_data) {
- iounmap(reg);
- return;
- }
-
- clk_data->clks = kzalloc(qty * sizeof(struct clk *), GFP_KERNEL);
- if (!clk_data->clks) {
- kfree(clk_data);
- iounmap(reg);
- return;
- }
-
- flags = CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE;
-
- for (i = 0; i < qty; i++) {
- of_property_read_string_index(node, "clock-output-names",
- i, &clk_name);
-
- /* ignore empty slots */
- if (!strcmp("reserved", clk_name))
- continue;
-
- clk_parent = of_clk_get_parent_name(node, i);
-
- /* keep all gates untouched for now */
- clkflags |= CLK_IGNORE_UNUSED;
-
- reg_idx = reg + (4 * (i / 16));
- reg_bit = (i % 16);
-
- clk_data->clks[i] = clk_register_gate(NULL, clk_name,
- clk_parent, clkflags,
- reg_idx, reg_bit,
- flags,
- &clk_lock);
- WARN_ON(IS_ERR(clk_data->clks[i]));
- }
-
- clk_data->clk_num = qty;
-
- of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
-}
-CLK_OF_DECLARE(rk2928_gate, "rockchip,rk2928-gate-clk", rk2928_gate_clk_init);
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 3cd8ad59e0b7..326b3fa44f5d 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -274,18 +274,10 @@ static struct clk *rockchip_clk_register_frac_branch(
struct clk_mux *frac_mux = &frac->mux;
struct clk_init_data init;
struct clk *mux_clk;
- int i, ret;
-
- frac->mux_frac_idx = -1;
- for (i = 0; i < child->num_parents; i++) {
- if (!strcmp(name, child->parent_names[i])) {
- pr_debug("%s: found fractional parent in mux at pos %d\n",
- __func__, i);
- frac->mux_frac_idx = i;
- break;
- }
- }
+ int ret;
+ frac->mux_frac_idx = match_string(child->parent_names,
+ child->num_parents, name);
frac->mux_ops = &clk_mux_ops;
frac->clk_nb.notifier_call = rockchip_clk_frac_notifier_cb;
@@ -312,6 +304,8 @@ static struct clk *rockchip_clk_register_frac_branch(
/* notifier on the fraction divider to catch rate changes */
if (frac->mux_frac_idx >= 0) {
+ pr_debug("%s: found fractional parent in mux at pos %d\n",
+ __func__, frac->mux_frac_idx);
ret = clk_notifier_register(clk, &frac->clk_nb);
if (ret)
pr_err("%s: failed to register clock notifier for %s\n",