clk: define LOG_CATEGORY for generic and ccf clocks

Define LOG_CATEGORY to allow filtering with log command
for generic clock and CCF clocks.

This patch also change existing printf, debug and pr_ macro
to log_ or dev_ macro.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
Patrick Delaunay 2021-11-19 15:12:07 +01:00 committed by Sean Anderson
parent 572c446e98
commit 560e1e0050
8 changed files with 39 additions and 12 deletions

View File

@ -4,9 +4,12 @@
* Copyright 2019 NXP * Copyright 2019 NXP
*/ */
#define LOG_CATEGORY UCLASS_CLK
#include <common.h> #include <common.h>
#include <clk.h> #include <clk.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <log.h>
#include <malloc.h> #include <malloc.h>
#include <asm/io.h> #include <asm/io.h>
#include <dm/device.h> #include <dm/device.h>

View File

@ -9,14 +9,18 @@
* *
*/ */
#define LOG_CATEGORY UCLASS_CLK
#include <common.h> #include <common.h>
#include <asm/io.h> #include <asm/io.h>
#include <malloc.h> #include <malloc.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <log.h>
#include <dm/device.h> #include <dm/device.h>
#include <dm/devres.h> #include <dm/devres.h>
#include <dm/uclass.h> #include <dm/uclass.h>
#include <dm/lists.h> #include <dm/lists.h>
#include <dm/device_compat.h>
#include <dm/device-internal.h> #include <dm/device-internal.h>
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/clk-provider.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 (clk_divider_flags & CLK_DIVIDER_HIWORD_MASK) {
if (width + shift > 16) { 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); return ERR_PTR(-EINVAL);
} }
} }

View File

@ -5,10 +5,14 @@
* *
* Copyright (C) 2011 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> * Copyright (C) 2011 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
*/ */
#define LOG_CATEGORY UCLASS_CLK
#include <common.h> #include <common.h>
#include <clk.h> #include <clk.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <div64.h> #include <div64.h>
#include <log.h>
#include <malloc.h> #include <malloc.h>
#include <dm/device.h> #include <dm/device.h>
#include <dm/devres.h> #include <dm/devres.h>

View File

@ -7,12 +7,16 @@
* Gated clock implementation * Gated clock implementation
*/ */
#define LOG_CATEGORY UCLASS_CLK
#include <common.h> #include <common.h>
#include <clk.h> #include <clk.h>
#include <log.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <malloc.h> #include <malloc.h>
#include <asm/io.h> #include <asm/io.h>
#include <dm/device.h> #include <dm/device.h>
#include <dm/device_compat.h>
#include <dm/devres.h> #include <dm/devres.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
@ -124,7 +128,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
if (clk_gate_flags & CLK_GATE_HIWORD_MASK) { if (clk_gate_flags & CLK_GATE_HIWORD_MASK) {
if (bit_idx > 15) { 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); return ERR_PTR(-EINVAL);
} }
} }

View File

@ -21,12 +21,16 @@
* clock. * clock.
*/ */
#define LOG_CATEGORY UCLASS_CLK
#include <common.h> #include <common.h>
#include <clk.h> #include <clk.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <log.h>
#include <malloc.h> #include <malloc.h>
#include <asm/io.h> #include <asm/io.h>
#include <dm/device.h> #include <dm/device.h>
#include <dm/device_compat.h>
#include <dm/devres.h> #include <dm/devres.h>
#include <dm/uclass.h> #include <dm/uclass.h>
#include <linux/bitops.h> #include <linux/bitops.h>
@ -124,7 +128,7 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent)
index = clk_fetch_parent_index(clk, parent); index = clk_fetch_parent_index(clk, parent);
if (index < 0) { if (index < 0) {
printf("Could not fetch index\n"); log_err("Could not fetch index\n");
return index; return index;
} }
@ -170,7 +174,7 @@ struct clk *clk_hw_register_mux_table(struct device *dev, const char *name,
if (clk_mux_flags & CLK_MUX_HIWORD_MASK) { if (clk_mux_flags & CLK_MUX_HIWORD_MASK) {
width = fls(mask) - ffs(mask) + 1; width = fls(mask) - ffs(mask) + 1;
if (width + shift > 16) { 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); return ERR_PTR(-EINVAL);
} }
} }

View File

@ -4,6 +4,8 @@
* Lukasz Majewski, DENX Software Engineering, lukma@denx.de * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
*/ */
#define LOG_CATEGORY UCLASS_CLK
#include <common.h> #include <common.h>
#include <clk.h> #include <clk.h>
#include <clk-uclass.h> #include <clk-uclass.h>
@ -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); ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);
if (ret) { if (ret) {
printf("%s: failed to get %s device (parent of %s)\n", log_err("%s: failed to get %s device (parent of %s)\n",
__func__, parent_name, name); __func__, parent_name, name);
} else { } else {
debug("%s: name: %s parent: %s [0x%p]\n", __func__, name, log_debug("%s: name: %s parent: %s [0x%p]\n", __func__, name,
parent->name, parent); parent->name, parent);
} }
drv = lists_driver_lookup_name(drv_name); drv = lists_driver_lookup_name(drv_name);
if (!drv) { if (!drv) {
printf("%s: %s is not a valid driver name\n", log_err("%s: %s is not a valid driver name\n",
__func__, drv_name); __func__, drv_name);
return -ENOENT; return -ENOENT;
} }
ret = device_bind(parent, drv, name, NULL, ofnode_null(), &clk->dev); ret = device_bind(parent, drv, name, NULL, ofnode_null(), &clk->dev);
if (ret) { if (ret) {
printf("%s: CLK: %s driver bind error [%d]!\n", __func__, name, log_err("%s: CLK: %s driver bind error [%d]!\n", __func__, name,
ret); ret);
return ret; return ret;
} }

View File

@ -5,10 +5,13 @@
* Author: Anup Patel <anup.patel@wdc.com> * Author: Anup Patel <anup.patel@wdc.com>
*/ */
#define LOG_CATEGORY UCLASS_CLK
#include <common.h> #include <common.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <div64.h> #include <div64.h>
#include <dm.h> #include <dm.h>
#include <log.h>
#include <linux/err.h> #include <linux/err.h>
struct clk_fixed_factor { struct clk_fixed_factor {

View File

@ -3,9 +3,12 @@
* Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com> * Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com>
*/ */
#define LOG_CATEGORY UCLASS_CLK
#include <common.h> #include <common.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <dm.h> #include <dm.h>
#include <log.h>
#include <dm/device-internal.h> #include <dm/device-internal.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>