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 <kauschluss@disroot.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
#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,
#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) \
.enable = ccf_clk_enable, \
.disable = ccf_clk_disable, \
.of_xlate = _name##_of_xlate, \
+ .request = samsung_clk_request, \
}
/**