mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
clk: rockchip: rk3368: add cru regs dump for panic
Add cru regs dump when system panic. It's just for debug. Change-Id: I3aeeeb7f7b9240c917c18bc2d36b082003dc6370 Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
This commit is contained in:
@@ -864,6 +864,18 @@ static const char *const rk3368_critical_clocks[] __initconst = {
|
||||
"pmu_hclk_otg0",
|
||||
};
|
||||
|
||||
static void __iomem *rk3368_cru_base;
|
||||
|
||||
static void rk3368_dump_cru(void)
|
||||
{
|
||||
if (rk3368_cru_base) {
|
||||
pr_warn("CRU:\n");
|
||||
print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET,
|
||||
32, 4, rk3368_cru_base,
|
||||
0x41c, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void __init rk3368_clk_init(struct device_node *np)
|
||||
{
|
||||
struct rockchip_clk_provider *ctx;
|
||||
@@ -906,5 +918,10 @@ static void __init rk3368_clk_init(struct device_node *np)
|
||||
rockchip_register_restart_notifier(ctx, RK3368_GLB_SRST_FST, NULL);
|
||||
|
||||
rockchip_clk_of_add_provider(np, ctx);
|
||||
|
||||
if (!rk_dump_cru) {
|
||||
rk3368_cru_base = reg_base;
|
||||
rk_dump_cru = rk3368_dump_cru;
|
||||
}
|
||||
}
|
||||
CLK_OF_DECLARE(rk3368_cru, "rockchip,rk3368-cru", rk3368_clk_init);
|
||||
|
||||
@@ -733,6 +733,21 @@ void rockchip_clk_protect_critical(const char *const clocks[],
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rockchip_clk_protect_critical);
|
||||
|
||||
void (*rk_dump_cru)(void);
|
||||
EXPORT_SYMBOL(rk_dump_cru);
|
||||
|
||||
static int rk_clk_panic(struct notifier_block *this,
|
||||
unsigned long ev, void *ptr)
|
||||
{
|
||||
if (rk_dump_cru)
|
||||
rk_dump_cru();
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static struct notifier_block rk_clk_panic_block = {
|
||||
.notifier_call = rk_clk_panic,
|
||||
};
|
||||
|
||||
static void __iomem *rst_base;
|
||||
static unsigned int reg_restart;
|
||||
static void (*cb_restart)(void);
|
||||
@@ -765,5 +780,7 @@ rockchip_register_restart_notifier(struct rockchip_clk_provider *ctx,
|
||||
if (ret)
|
||||
pr_err("%s: cannot register restart handler, %d\n",
|
||||
__func__, ret);
|
||||
atomic_notifier_chain_register(&panic_notifier_list,
|
||||
&rk_clk_panic_block);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rockchip_register_restart_notifier);
|
||||
|
||||
@@ -1037,5 +1037,6 @@ static inline void rockchip_register_softrst(struct device_node *np,
|
||||
{
|
||||
}
|
||||
#endif
|
||||
extern void (*rk_dump_cru)(void);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user