summaryrefslogtreecommitdiff
path: root/include/clk.h
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2019-06-24 15:50:44 +0200
committerStefano Babic <sbabic@denx.de>2019-07-19 14:50:30 +0200
commit2796af7368acab27a6f9141cecba78106891f1bf (patch)
tree46dc367d013f9617a3a794ba45a7f86242018184 /include/clk.h
parent4aa78300a025b7e09aa8e902b2178b1870ef1ec5 (diff)
dm: clk: Define clk_get_by_id() for clk operations
This commit adds the clk_get_by_id() function, which is responsible for getting the udevice with matching clk->id. Such approach allows re-usage of inherit DM list relationship for the same class (UCLASS_CLK). As a result - we don't need any other external list - it is just enough to look for UCLASS_CLK related udevices. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'include/clk.h')
-rw-r--r--include/clk.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/clk.h b/include/clk.h
index 7b2ff8ebe6..f8f56d9cf0 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -345,4 +345,15 @@ static inline bool clk_valid(struct clk *clk)
{
return !!clk->dev;
}
+
+/**
+ * clk_get_by_id() - Get the clock by its ID
+ *
+ * @id: The clock ID to search for
+ *
+ * @clkp: A pointer to clock struct that has been found among added clocks
+ * to UCLASS_CLK
+ * @return zero on success, or -ENOENT on error
+ */
+int clk_get_by_id(ulong id, struct clk **clkp);
#endif