RE: [PATCH] PM debug support for 34xx
Any comments to this? I have already a new version available of this stuff where I have integrated the suspend / next state control to this also, and the file structure modified a bit. Should this be split into several patches for easier handling or something? It is getting rather big already (as a patch.) -Tero -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ext Tero Kristo Sent: 12 September, 2008 14:49 To: linux-omap@vger.kernel.org Subject: [PATCH] PM debug support for 34xx This patch adds a few files to the debug file system for PM debugging purposes. Enabled with kernel config options CONFIG_PM_DEBUG and CONFIG_DEBUG_FS. Data available in debug filesystem after this patch: - State enter counters for power domains (OFF, RET, ON) - State timers for the above (in ns) - PM register dumps with programmable save points - Current power domain states - Interface to set_pwrdm_state() Signed-off-by: Tero Kristo [EMAIL PROTECTED] --- arch/arm/mach-omap2/clock.c |2 + arch/arm/mach-omap2/clockdomain.c | 27 ++ arch/arm/mach-omap2/pm-debug.c| 406 + arch/arm/mach-omap2/pm.c |2 + arch/arm/mach-omap2/pm.h | 33 ++- arch/arm/mach-omap2/pm34xx.c |6 +- arch/arm/mach-omap2/powerdomain.c | 69 + arch/arm/plat-omap/include/mach/powerdomain.h |7 +- 8 files changed, 548 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 88c8ef4..a5fc5b0 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -39,6 +39,7 @@ #include cm.h #include cm-regbits-24xx.h #include cm-regbits-34xx.h +#include pm.h #define MAX_CLOCK_ENABLE_WAIT 10 @@ -1025,5 +1026,6 @@ void omap2_clk_disable_unused(struct clk *clk) printk(KERN_INFO Disabling unused clock \%s\\n, clk-name); _omap2_clk_disable(clk); + pm_dbg_clk_state_switch(clk); } #endif diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index fa62f14..9670ed1 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c @@ -36,6 +36,8 @@ #include mach/powerdomain.h #include mach/clockdomain.h +#include pm.h + /* clkdm_list contains all registered struct clockdomains */ static LIST_HEAD(clkdm_list); @@ -567,6 +569,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) else omap2_clkdm_wakeup(clkdm); + pm_dbg_clkdm_state_switch(clkdm); + return 0; } @@ -618,6 +622,29 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) else omap2_clkdm_sleep(clkdm); + pm_dbg_clkdm_state_switch(clkdm); + + return 0; +} + +#if defined(CONFIG_PM_DEBUG) defined(CONFIG_DEBUG_FS) #include +linux/debugfs.h #include linux/seq_file.h int +clkdm_dbg_show_counters(struct seq_file *s, void *unused) { + struct clockdomain *clkdm; + + list_for_each_entry(clkdm, clkdm_list, node) { + if (strcmp(clkdm-name, emu_clkdm) == 0 || + strcmp(clkdm-name, wkup_clkdm) == 0) + continue; + seq_printf(s, %s-%s (%d), clkdm-name, + clkdm-pwrdm.ptr-name, + atomic_read(clkdm-usecount)); + seq_printf(s, \n); + } + return 0; } +#endif diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index b00f5f4..380a2a0 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -30,6 +30,9 @@ #include mach/clock.h #include mach/board.h +#include mach/powerdomain.h +#include mach/clockdomain.h +#include mach/common.h #include prm.h #include cm.h #include pm.h @@ -153,4 +156,407 @@ void omap2_pm_dump(int mode, int resume, unsigned int us) printk(%-20s: 0x%08x\n, regs[i].name, regs[i].val); } +#ifdef CONFIG_DEBUG_FS +#include linux/debugfs.h +#include linux/seq_file.h + +static void pm_dbg_regset_store(u32 *ptr); + +struct dentry *pm_dbg_dir; + +static int pm_dbg_init_done; + +enum { + PM_DBG_STATE_NOW = 0, + PM_DBG_STATE_PREV, +}; + +struct pm_module_def { + char name[8]; /* Name of the module */ + short type; /* CM or PRM */ + unsigned short offset; + int low; /* First register address on this module */ + int high; /* Last register address on this module */ }; + +#define MOD_CM 0 +#define MOD_PRM 1 + +static const struct pm_module_def pm_dbg_reg_modules[] = { + { IVA2, MOD_CM, OMAP3430_IVA2_MOD, 0, 0x4c }, + { OCP, MOD_CM, OCP_MOD, 0, 0x10 }, + { MPU, MOD_CM, MPU_MOD, 4, 0x4c }, + { CORE, MOD_CM, CORE_MOD, 0, 0x4c }, + { SGX, MOD_CM, OMAP3430ES2_SGX_MOD, 0, 0x4c }, + { WKUP, MOD_CM, WKUP_MOD, 0, 0x40 }, + { CCR, MOD_CM, PLL_MOD, 0, 0x70 }, +
Re: [PATCH] PM debug support for 34xx
[EMAIL PROTECTED] writes: Any comments to this? I have already a new version available of this stuff where I have integrated the suspend / next state control to this also, and the file structure modified a bit. Could you mind sending your updated version? This one no longer applies cleanly to HEAD. I would like to give it a test run, then I'll give you some more feedback. Should this be split into several patches for easier handling or something? It is getting rather big already (as a patch.) For me, it's OK as a single patch for now. Kevin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ext Tero Kristo Sent: 12 September, 2008 14:49 To: linux-omap@vger.kernel.org Subject: [PATCH] PM debug support for 34xx This patch adds a few files to the debug file system for PM debugging purposes. Enabled with kernel config options CONFIG_PM_DEBUG and CONFIG_DEBUG_FS. Data available in debug filesystem after this patch: - State enter counters for power domains (OFF, RET, ON) - State timers for the above (in ns) - PM register dumps with programmable save points - Current power domain states - Interface to set_pwrdm_state() Signed-off-by: Tero Kristo [EMAIL PROTECTED] --- arch/arm/mach-omap2/clock.c |2 + arch/arm/mach-omap2/clockdomain.c | 27 ++ arch/arm/mach-omap2/pm-debug.c| 406 + arch/arm/mach-omap2/pm.c |2 + arch/arm/mach-omap2/pm.h | 33 ++- arch/arm/mach-omap2/pm34xx.c |6 +- arch/arm/mach-omap2/powerdomain.c | 69 + arch/arm/plat-omap/include/mach/powerdomain.h |7 +- 8 files changed, 548 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 88c8ef4..a5fc5b0 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -39,6 +39,7 @@ #include cm.h #include cm-regbits-24xx.h #include cm-regbits-34xx.h +#include pm.h #define MAX_CLOCK_ENABLE_WAIT10 @@ -1025,5 +1026,6 @@ void omap2_clk_disable_unused(struct clk *clk) printk(KERN_INFO Disabling unused clock \%s\\n, clk-name); _omap2_clk_disable(clk); + pm_dbg_clk_state_switch(clk); } #endif diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index fa62f14..9670ed1 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c @@ -36,6 +36,8 @@ #include mach/powerdomain.h #include mach/clockdomain.h +#include pm.h + /* clkdm_list contains all registered struct clockdomains */ static LIST_HEAD(clkdm_list); @@ -567,6 +569,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) else omap2_clkdm_wakeup(clkdm); + pm_dbg_clkdm_state_switch(clkdm); + return 0; } @@ -618,6 +622,29 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) else omap2_clkdm_sleep(clkdm); + pm_dbg_clkdm_state_switch(clkdm); + + return 0; +} + +#if defined(CONFIG_PM_DEBUG) defined(CONFIG_DEBUG_FS) #include +linux/debugfs.h #include linux/seq_file.h int +clkdm_dbg_show_counters(struct seq_file *s, void *unused) { + struct clockdomain *clkdm; + + list_for_each_entry(clkdm, clkdm_list, node) { + if (strcmp(clkdm-name, emu_clkdm) == 0 || + strcmp(clkdm-name, wkup_clkdm) == 0) + continue; + seq_printf(s, %s-%s (%d), clkdm-name, +clkdm-pwrdm.ptr-name, +atomic_read(clkdm-usecount)); + seq_printf(s, \n); + } + return 0; } +#endif diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index b00f5f4..380a2a0 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -30,6 +30,9 @@ #include mach/clock.h #include mach/board.h +#include mach/powerdomain.h +#include mach/clockdomain.h +#include mach/common.h #include prm.h #include cm.h #include pm.h @@ -153,4 +156,407 @@ void omap2_pm_dump(int mode, int resume, unsigned int us) printk(%-20s: 0x%08x\n, regs[i].name, regs[i].val); } +#ifdef CONFIG_DEBUG_FS +#include linux/debugfs.h +#include linux/seq_file.h + +static void pm_dbg_regset_store(u32 *ptr); + +struct dentry *pm_dbg_dir; + +static int pm_dbg_init_done; + +enum { + PM_DBG_STATE_NOW = 0, + PM_DBG_STATE_PREV, +}; + +struct pm_module_def { + char name[8]; /* Name of the module */ + short type; /* CM or PRM */ + unsigned short offset; + int low; /* First register address on this module */ + int high; /* Last register address on this module */ }; + +#define MOD_CM 0 +#define MOD_PRM 1 + +static const struct pm_module_def pm_dbg_reg_modules[] = { + { IVA2, MOD_CM, OMAP3430_IVA2_MOD, 0, 0x4c }, + { OCP, MOD_CM, OCP_MOD, 0, 0x10 }, + { MPU,