clk: qcom: clk-debug: Add support for debug clock API's

Add support for qcom_clk_dump and qcom_clk_bulk_dump API's
which can be used by the clients to dump the registers
associated with the clock and it's parents.

Change-Id: Iea7f30bb4e789e41dbae41b88514ffd53c136174
Signed-off-by: Jagadeesh Kona <jkona@codeaurora.org>
This commit is contained in:
Jagadeesh Kona 2020-09-10 14:59:46 +05:30 • committed by Gerrit - the friendly Code Review server
commit 893c1f5b78
2 changed files with 50 additions and 1 deletions

View file

@ -10,6 +10,7 @@
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/bitops.h>
#include <linux/clk/qcom.h>
#include <linux/mfd/syscon.h>
#include "clk-regmap.h"
@ -562,3 +563,48 @@ void clk_common_debug_init(struct clk_hw *hw, struct dentry *dentry)
};
/**
* qcom_clk_dump - dump the HW specific registers associated with this clock
* @clk: clock source
* @calltrace: indicates whether calltrace is required
*
* This function attempts to print all the registers associated with the
* clock and it's parents.
*/
void qcom_clk_dump(struct clk *clk, bool calltrace)
{
struct clk_hw *hw;
if (IS_ERR_OR_NULL(clk))
return;
hw = __clk_get_hw(clk);
if (IS_ERR_OR_NULL(hw))
return;
pr_info("Dumping %s Registers:\n", clk_hw_get_name(hw));
WARN_CLK(hw, calltrace, "");
}
EXPORT_SYMBOL(qcom_clk_dump);
/**
* qcom_clk_bulk_dump - dump the HW specific registers associated with clocks
* @clks: the clk_bulk_data table of consumer
* @num_clks: the number of clk_bulk_data
* @calltrace: indicates whether calltrace is required
*
* This function attempts to print all the registers associated with the
* clock and it's parents for all the clocks in the list.
*/
void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks,
bool calltrace)
{
int i;
if (IS_ERR_OR_NULL(clks))
return;
for (i = 0; i < num_clks; i++)
qcom_clk_dump(clks[i].clk, calltrace);
}
EXPORT_SYMBOL(qcom_clk_bulk_dump);

View file

@ -6,7 +6,7 @@
#ifndef __LINUX_CLK_QCOM_H_
#define __LINUX_CLK_QCOM_H_
#include <linux/clk-provider.h>
#include <linux/clk.h>
enum branch_mem_flags {
CLKFLAG_RETAIN_PERIPH,
@ -19,5 +19,8 @@ enum branch_mem_flags {
int qcom_clk_get_voltage(struct clk *clk, unsigned long rate);
int qcom_clk_set_flags(struct clk *clk, unsigned long flags);
void qcom_clk_dump(struct clk *clk, bool calltrace);
void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks,
bool calltrace);
#endif /* __LINUX_CLK_QCOM_H_ */