1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2019 DENX Software Engineering
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
8 #include <clk-uclass.h>
10 #include <dm/uclass.h>
12 #include <dm/device-internal.h>
15 int clk_register(struct clk *clk, const char *drv_name,
16 const char *name, const char *parent_name)
18 struct udevice *parent;
22 ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);
24 printf("%s: UCLASS parent: 0x%p\n", __func__, parent);
26 debug("%s: name: %s parent: %s [0x%p]\n", __func__, name, parent->name,
29 drv = lists_driver_lookup_name(drv_name);
31 printf("%s: %s is not a valid driver name\n",
36 ret = device_bind(parent, drv, name, NULL, -1, &clk->dev);
38 printf("%s: CLK: %s driver bind error [%d]!\n", __func__, name,
43 clk->enable_count = 0;
44 /* Store back pointer to clk from udevice */
45 clk->dev->uclass_priv = clk;
50 ulong clk_generic_get_rate(struct clk *clk)
52 return clk_get_parent_rate(clk);
55 const char *clk_hw_get_name(const struct clk *hw)
60 bool clk_dev_binded(struct clk *clk)
62 if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))