[U-Boot] [PATCH] dm: clk: Remove simple version of clk_get_by_index()
Michal Simek
michal.simek at xilinx.com
Thu Jul 14 13:24:53 CEST 2016
Simple version of clk_get_by_index() added by:
"dm: clk: Add a simple version of clk_get_by_index()"
(sha1: a4b10c088c4f6ef2e2bba33e8cfea369bcbbce44)
is not sufficient if you use multiple clocks in the system
because clk->id is phandle id which for example fixed-clock
is not able to handle. Use the same implementation as is used
in full version.
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---
Diff for ZynqMP is 773 B based on buildman.
---
drivers/clk/clk-uclass.c | 55 ++++++++++++++++--------------------------------
1 file changed, 18 insertions(+), 37 deletions(-)
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 6e4d67220a16..c6c5ba2f2511 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -21,30 +21,29 @@ static inline struct clk_ops *clk_dev_ops(struct udevice *dev)
#if CONFIG_IS_ENABLED(OF_CONTROL)
#ifdef CONFIG_SPL_BUILD
-int clk_get_by_index(struct udevice *dev, int index, struct clk *clk)
-{
- int ret;
- u32 cell[2];
-
- if (index != 0)
- return -ENOSYS;
- assert(clk);
- ret = uclass_get_device(UCLASS_CLK, 0, &clk->dev);
- if (ret)
- return ret;
- ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset, "clocks",
- cell, 2);
- if (ret)
- return ret;
- clk->id = cell[1];
- return 0;
-}
-
int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
{
return -ENOSYS;
}
#else
+int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
+{
+ int index;
+
+ debug("%s(dev=%p, name=%s, clk=%p)\n", __func__, dev, name, clk);
+
+ index = fdt_find_string(gd->fdt_blob, dev->of_offset, "clock-names",
+ name);
+ if (index < 0) {
+ debug("fdt_find_string() failed: %d\n", index);
+ return index;
+ }
+
+ return clk_get_by_index(dev, index, clk);
+}
+#endif
+#endif
+
static int clk_of_xlate_default(struct clk *clk,
struct fdtdec_phandle_args *args)
{
@@ -102,24 +101,6 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk)
return clk_request(dev_clk, clk);
}
-int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
-{
- int index;
-
- debug("%s(dev=%p, name=%s, clk=%p)\n", __func__, dev, name, clk);
-
- index = fdt_find_string(gd->fdt_blob, dev->of_offset, "clock-names",
- name);
- if (index < 0) {
- debug("fdt_find_string() failed: %d\n", index);
- return index;
- }
-
- return clk_get_by_index(dev, index, clk);
-}
-#endif
-#endif
-
int clk_request(struct udevice *dev, struct clk *clk)
{
struct clk_ops *ops = clk_dev_ops(dev);
--
1.9.1
More information about the U-Boot
mailing list