[PATCH v4 1/6] clk: actions: Introduce dummy get/set_rate callbacks
Sean Anderson
seanga2 at gmail.com
Sat Jan 15 18:44:08 CET 2022
On 11/28/21 6:32 AM, Amit Singh Tomar wrote:
> From: Amit Singh Tomar <amittomer25 at gmail.com>
>
> This commit introduces get/set_rate callbacks, these are dummy at
> the moment, and can be used to get/set clock for various devices
> based on the clk id.
>
> Signed-off-by: Amit Singh Tomar <amittomer25 at gmail.com>
> ---
> Changes since v3:
> * No changes.
> Changes since v2:
> * No changes.
> Changes since previous version:
> * Removed premature initialization to avoid
> compiler warnings.
> ---
> drivers/clk/owl/clk_owl.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/clk/owl/clk_owl.c b/drivers/clk/owl/clk_owl.c
> index 96ab7fed1f37..f78e5fa3f08d 100644
> --- a/drivers/clk/owl/clk_owl.c
> +++ b/drivers/clk/owl/clk_owl.c
> @@ -128,6 +128,30 @@ int owl_clk_disable(struct clk *clk)
> return 0;
> }
>
> +static ulong owl_clk_get_rate(struct clk *clk)
> +{
> + ulong rate;
> +
> + switch (clk->id) {
> + default:
> + return -ENOENT;
-ENOSYS please
> + }
> +
> + return rate;
> +}
> +
> +static ulong owl_clk_set_rate(struct clk *clk, ulong rate)
> +{
> + ulong new_rate;
> +
> + switch (clk->id) {
> + default:
> + return -ENOENT;
ditto
> + }
> +
> + return new_rate;
> +}
> +
> static int owl_clk_probe(struct udevice *dev)
> {
> struct owl_clk_priv *priv = dev_get_priv(dev);
> @@ -145,6 +169,8 @@ static int owl_clk_probe(struct udevice *dev)
> static const struct clk_ops owl_clk_ops = {
> .enable = owl_clk_enable,
> .disable = owl_clk_disable,
> + .get_rate = owl_clk_get_rate,
> + .set_rate = owl_clk_set_rate,
> };
>
> static const struct udevice_id owl_clk_ids[] = {
>
With that fixed,
Reviewed-by: Sean Anderson <seanga2 at gmail.com>
More information about the U-Boot
mailing list