提交 5b385a45 编写于 作者: T Tero Kristo

clk: ti: add support for clkctrl aliases

hwmod core still depends on certain clocks being found by name, so we
need to add support for adding clkctrl clock aliases. This patch can
be reverted when no longer needed by hwmod core code.
Signed-off-by: NTero Kristo <t-kristo@ti.com>
上级 ddfb183e
...@@ -108,18 +108,70 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[]) ...@@ -108,18 +108,70 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
struct device_node *node; struct device_node *node;
struct clk *clk; struct clk *clk;
struct of_phandle_args clkspec; struct of_phandle_args clkspec;
char buf[64];
char *ptr;
char *tags[2];
int i;
int num_args;
int ret;
static bool clkctrl_nodes_missing;
static bool has_clkctrl_data;
for (c = oclks; c->node_name != NULL; c++) { for (c = oclks; c->node_name != NULL; c++) {
node = of_find_node_by_name(NULL, c->node_name); strcpy(buf, c->node_name);
ptr = buf;
for (i = 0; i < 2; i++)
tags[i] = NULL;
num_args = 0;
while (*ptr) {
if (*ptr == ':') {
if (num_args >= 2) {
pr_warn("Bad number of tags on %s\n",
c->node_name);
return;
}
tags[num_args++] = ptr + 1;
*ptr = 0;
}
ptr++;
}
if (num_args && clkctrl_nodes_missing)
continue;
node = of_find_node_by_name(NULL, buf);
if (num_args)
node = of_find_node_by_name(node, "clk");
clkspec.np = node; clkspec.np = node;
clkspec.args_count = num_args;
for (i = 0; i < num_args; i++) {
ret = kstrtoint(tags[i], i ? 10 : 16, clkspec.args + i);
if (ret) {
pr_warn("Bad tag in %s at %d: %s\n",
c->node_name, i, tags[i]);
return;
}
}
clk = of_clk_get_from_provider(&clkspec); clk = of_clk_get_from_provider(&clkspec);
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
c->lk.clk = clk; c->lk.clk = clk;
clkdev_add(&c->lk); clkdev_add(&c->lk);
} else { } else {
pr_warn("failed to lookup clock node %s\n", if (num_args && !has_clkctrl_data) {
c->node_name); if (of_find_compatible_node(NULL, NULL,
"ti,clkctrl")) {
has_clkctrl_data = true;
} else {
clkctrl_nodes_missing = true;
pr_warn("missing clkctrl nodes, please update your dts.\n");
continue;
}
}
pr_warn("failed to lookup clock node %s, ret=%ld\n",
c->node_name, PTR_ERR(clk));
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册