summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKaustabh Chakraborty <[email protected]>2025-10-17 20:51:32 +0530
committerMinkyu Kang <[email protected]>2025-11-12 13:56:12 +0900
commit4bee54fbfa9e5be4bb17435dc809b0002566f986 (patch)
treec1a75d26b964753dc9c2b87364c6b3003cbe9976 /drivers
parent526a257fdba7c1a8288b6454b1551a35b0ec5723 (diff)
clk: exynos: add function for Samsung CMU ops->request
The request function performs a simple check if the clock with the provided ID is present or not. This is done with a simple call to clk_get_by_id(). A non-zero return value indicates that the requested clock is not available. In some cases, clk->dev points to the clock bank device instead of the clock device. This pointer is therefore overwritten in order to reference to the correct device instance. Signed-off-by: Kaustabh Chakraborty <[email protected]> Signed-off-by: Minkyu Kang <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/exynos/clk.c13
-rw-r--r--drivers/clk/exynos/clk.h4
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/clk/exynos/clk.c b/drivers/clk/exynos/clk.c
index a3832981f90..a2c9f4851da 100644
--- a/drivers/clk/exynos/clk.c
+++ b/drivers/clk/exynos/clk.c
@@ -10,6 +10,19 @@
#include <dm.h>
#include "clk.h"
+int samsung_clk_request(struct clk *clk)
+{
+ struct clk *c;
+ int ret;
+
+ ret = clk_get_by_id(clk->id, &c);
+ if (ret)
+ return ret;
+
+ clk->dev = c->dev;
+ return 0;
+}
+
static void
samsung_clk_register_fixed_rate(struct udevice *dev, void __iomem *base,
unsigned int cmu_id,
diff --git a/drivers/clk/exynos/clk.h b/drivers/clk/exynos/clk.h
index e53dcc6a821..c25b7cb59d4 100644
--- a/drivers/clk/exynos/clk.h
+++ b/drivers/clk/exynos/clk.h
@@ -9,10 +9,13 @@
#ifndef __EXYNOS_CLK_H
#define __EXYNOS_CLK_H
+#include <clk.h>
#include <errno.h>
#include <linux/clk-provider.h>
#include "clk-pll.h"
+int samsung_clk_request(struct clk *clk);
+
#define _SAMSUNG_CLK_OPS(_name, _cmu) \
static int _name##_of_xlate(struct clk *clk, \
struct ofnode_phandle_args *args) \
@@ -37,6 +40,7 @@ static const struct clk_ops _name##_clk_ops = { \
.enable = ccf_clk_enable, \
.disable = ccf_clk_disable, \
.of_xlate = _name##_of_xlate, \
+ .request = samsung_clk_request, \
}
/**