From f006a8e343e8e85307771021fe88afb8ea15b1d2 Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Thu, 2 Mar 2017 10:36:45 +0100 Subject: dm: clk: lookup callbak into CCU-like clock devices --- drivers/clk/clk-uclass.c | 7 +++++++ include/clk-uclass.h | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index a6a65b2a66..fe52ee8e69 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -133,6 +133,13 @@ int clk_get_by_output_name(const char *output_name, struct clk *clk) dev_of_offset(dev), "clock-output-names", output_name); + + if (idx < 0 && clk_dev_ops(dev)->lookup) { + clk->dev = dev; + if (clk_dev_ops(dev)->lookup(clk, output_name) == 0) + return clk->id; + } + if (idx < 0) continue; diff --git a/include/clk-uclass.h b/include/clk-uclass.h index 07c1065495..b764d77529 100644 --- a/include/clk-uclass.h +++ b/include/clk-uclass.h @@ -90,6 +90,18 @@ struct clk_ops { * @return zero on success, or -ve error code. */ int (*disable)(struct clk *clk); + /** + * lookup - Find a clock from a human-readable name. + * + * The clock core calls this function as a fallback in implementing + * a client's clk_get_by_output_name() call, if an 'output-names' + * property is not present. + * + * @clock: The clock struct to hold the translation result. + * @name: The clock specifier values from device tree. + * @return zero on success, or a negative error code. + */ + int (*lookup)(struct clk *clock, const char *name); }; #endif -- cgit v1.2.3