diff options
author | Tom Rini <trini@konsulko.com> | 2021-12-15 14:51:44 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-12-15 14:51:44 -0500 |
commit | 5b20efeafec0ebe0ee5742c611e4f2153346797a (patch) | |
tree | 2ad78099a2ce53f471be5cecdbe7fb2efa4f7b6d | |
parent | e09ca91cfa66fadb3b3e51f5bd9d15b1dfcc12d2 (diff) | |
parent | 560e1e005093b1d62c53391d68960237294e7f89 (diff) | |
download | u-boot-WIP/15Dec2021.zip u-boot-WIP/15Dec2021.tar.gz u-boot-WIP/15Dec2021.tar.bz2 |
Merge tag 'clk-2022.01-rc3' of https://source.denx.de/u-boot/custodians/u-boot-clkWIP/15Dec2021
Clock patches for v2022.01-rc3
This adds better logging support for many CCF drivers, and clarifies some
documentation regarding clk_get_rate.
-rw-r--r-- | drivers/clk/clk-composite.c | 9 | ||||
-rw-r--r-- | drivers/clk/clk-divider.c | 6 | ||||
-rw-r--r-- | drivers/clk/clk-fixed-factor.c | 13 | ||||
-rw-r--r-- | drivers/clk/clk-gate.c | 15 | ||||
-rw-r--r-- | drivers/clk/clk-mux.c | 13 | ||||
-rw-r--r-- | drivers/clk/clk-uclass.c | 2 | ||||
-rw-r--r-- | drivers/clk/clk.c | 20 | ||||
-rw-r--r-- | drivers/clk/clk_fixed_factor.c | 3 | ||||
-rw-r--r-- | drivers/clk/clk_fixed_rate.c | 3 | ||||
-rw-r--r-- | include/clk.h | 3 |
10 files changed, 59 insertions, 28 deletions
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index bb5351e..6eb2b81 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -4,14 +4,17 @@ * Copyright 2019 NXP */ +#define LOG_CATEGORY UCLASS_CLK + #include <common.h> -#include <asm/io.h> -#include <malloc.h> +#include <clk.h> #include <clk-uclass.h> +#include <log.h> +#include <malloc.h> +#include <asm/io.h> #include <dm/device.h> #include <dm/devres.h> #include <linux/clk-provider.h> -#include <clk.h> #include <linux/err.h> #include "clk.h" diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 9df50a5..7e8e62f 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -9,14 +9,18 @@ * */ +#define LOG_CATEGORY UCLASS_CLK + #include <common.h> #include <asm/io.h> #include <malloc.h> #include <clk-uclass.h> +#include <log.h> #include <dm/device.h> #include <dm/devres.h> #include <dm/uclass.h> #include <dm/lists.h> +#include <dm/device_compat.h> #include <dm/device-internal.h> #include <linux/bug.h> #include <linux/clk-provider.h> @@ -190,7 +194,7 @@ static struct clk *_register_divider(struct device *dev, const char *name, if (clk_divider_flags & CLK_DIVIDER_HIWORD_MASK) { if (width + shift > 16) { - pr_warn("divider value exceeds LOWORD field\n"); + dev_warn(dev, "divider value exceeds LOWORD field\n"); return ERR_PTR(-EINVAL); } } diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index 8d9823b..2a44678 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -5,17 +5,22 @@ * * Copyright (C) 2011 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> */ + +#define LOG_CATEGORY UCLASS_CLK + #include <common.h> -#include <malloc.h> +#include <clk.h> #include <clk-uclass.h> +#include <div64.h> +#include <log.h> +#include <malloc.h> #include <dm/device.h> #include <dm/devres.h> #include <linux/clk-provider.h> -#include <div64.h> -#include <clk.h> -#include "clk.h" #include <linux/err.h> +#include "clk.h" + #define UBOOT_DM_CLK_IMX_FIXED_FACTOR "ccf_clk_fixed_factor" static ulong clk_factor_recalc_rate(struct clk *clk) diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index 006d3b6..aa40daf 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -7,18 +7,23 @@ * Gated clock implementation */ +#define LOG_CATEGORY UCLASS_CLK + #include <common.h> -#include <asm/io.h> -#include <malloc.h> +#include <clk.h> +#include <log.h> #include <clk-uclass.h> +#include <malloc.h> +#include <asm/io.h> #include <dm/device.h> +#include <dm/device_compat.h> #include <dm/devres.h> #include <linux/bitops.h> #include <linux/clk-provider.h> -#include <clk.h> -#include "clk.h" #include <linux/err.h> +#include "clk.h" + #define UBOOT_DM_CLK_GATE "clk_gate" /** @@ -123,7 +128,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name, if (clk_gate_flags & CLK_GATE_HIWORD_MASK) { if (bit_idx > 15) { - pr_err("gate bit exceeds LOWORD field\n"); + dev_err(dev, "gate bit exceeds LOWORD field\n"); return ERR_PTR(-EINVAL); } } diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index f1becd2..b49946f 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -21,17 +21,22 @@ * clock. */ +#define LOG_CATEGORY UCLASS_CLK + #include <common.h> #include <clk.h> #include <clk-uclass.h> +#include <log.h> +#include <malloc.h> +#include <asm/io.h> #include <dm/device.h> +#include <dm/device_compat.h> #include <dm/devres.h> #include <dm/uclass.h> #include <linux/bitops.h> -#include <malloc.h> -#include <asm/io.h> #include <linux/clk-provider.h> #include <linux/err.h> + #include "clk.h" #define UBOOT_DM_CLK_CCF_MUX "ccf_clk_mux" @@ -123,7 +128,7 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent) index = clk_fetch_parent_index(clk, parent); if (index < 0) { - printf("Could not fetch index\n"); + log_err("Could not fetch index\n"); return index; } @@ -169,7 +174,7 @@ struct clk *clk_hw_register_mux_table(struct device *dev, const char *name, if (clk_mux_flags & CLK_MUX_HIWORD_MASK) { width = fls(mask) - ffs(mask) + 1; if (width + shift > 16) { - pr_err("mux value exceeds LOWORD field\n"); + dev_err(dev, "mux value exceeds LOWORD field\n"); return ERR_PTR(-EINVAL); } } diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 493018b..f2d2642 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -16,6 +16,7 @@ #include <errno.h> #include <log.h> #include <malloc.h> +#include <asm/global_data.h> #include <dm/device_compat.h> #include <dm/device-internal.h> #include <dm/devres.h> @@ -23,7 +24,6 @@ #include <linux/bug.h> #include <linux/clk-provider.h> #include <linux/err.h> -#include <asm/global_data.h> static inline const struct clk_ops *clk_dev_ops(struct udevice *dev) { diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 1efb7fe..eff0fa1 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -4,14 +4,16 @@ * Lukasz Majewski, DENX Software Engineering, lukma@denx.de */ +#define LOG_CATEGORY UCLASS_CLK + #include <common.h> +#include <clk.h> #include <clk-uclass.h> #include <log.h> #include <dm/device.h> #include <dm/uclass.h> #include <dm/lists.h> #include <dm/device-internal.h> -#include <clk.h> int clk_register(struct clk *clk, const char *drv_name, const char *name, const char *parent_name) @@ -22,24 +24,24 @@ int clk_register(struct clk *clk, const char *drv_name, ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent); if (ret) { - printf("%s: failed to get %s device (parent of %s)\n", - __func__, parent_name, name); + log_err("%s: failed to get %s device (parent of %s)\n", + __func__, parent_name, name); } else { - debug("%s: name: %s parent: %s [0x%p]\n", __func__, name, - parent->name, parent); + log_debug("%s: name: %s parent: %s [0x%p]\n", __func__, name, + parent->name, parent); } drv = lists_driver_lookup_name(drv_name); if (!drv) { - printf("%s: %s is not a valid driver name\n", - __func__, drv_name); + log_err("%s: %s is not a valid driver name\n", + __func__, drv_name); return -ENOENT; } ret = device_bind(parent, drv, name, NULL, ofnode_null(), &clk->dev); if (ret) { - printf("%s: CLK: %s driver bind error [%d]!\n", __func__, name, - ret); + log_err("%s: CLK: %s driver bind error [%d]!\n", __func__, name, + ret); return ret; } diff --git a/drivers/clk/clk_fixed_factor.c b/drivers/clk/clk_fixed_factor.c index 41b0d9c..6c1139e 100644 --- a/drivers/clk/clk_fixed_factor.c +++ b/drivers/clk/clk_fixed_factor.c @@ -5,10 +5,13 @@ * Author: Anup Patel <anup.patel@wdc.com> */ +#define LOG_CATEGORY UCLASS_CLK + #include <common.h> #include <clk-uclass.h> #include <div64.h> #include <dm.h> +#include <log.h> #include <linux/err.h> struct clk_fixed_factor { diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c index c5a2a42..b5e78c7 100644 --- a/drivers/clk/clk_fixed_rate.c +++ b/drivers/clk/clk_fixed_rate.c @@ -3,9 +3,12 @@ * Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com> */ +#define LOG_CATEGORY UCLASS_CLK + #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <log.h> #include <dm/device-internal.h> #include <linux/clk-provider.h> diff --git a/include/clk.h b/include/clk.h index a928879..df5255e 100644 --- a/include/clk.h +++ b/include/clk.h @@ -389,7 +389,8 @@ int clk_free(struct clk *clk); * * @clk: A clock struct that was previously successfully requested by * clk_request/get_by_*(). - * @return clock rate in Hz, or -ve error code. + * @return clock rate in Hz on success, 0 for invalid clock, or -ve error code + * for other errors. */ ulong clk_get_rate(struct clk *clk); |