OMAP PM debug infrastructure for 2.6.32
Subsystems (5)
cover OMAP PM debug infrastructure for 2.6.32
This series adds the PM debug infrastructure which is currently used in the OMAP PM branch[1].
Applies on v2.6.31-rc5 plus previous PM fixes queue:
[PATCH 00/14] OMAP PM fixes for .31-rc series
Kevin
[1] http://elinux.org/OMAP_Power_Management
Peter 'p2' De Schrijver (8):
OMAP: PM counter infrastructure.
OMAP: PM: Hook into PM counters
OMAP: PM: Add closures to clkdm_for_each and pwrdm_for_each.
OMAP: PM: Add pm-debug counters
OMAP: PM debug: make powerdomains use PM-debug counters
OMAP: PM: Add definitions for ETK pads and observability registers
OMAP3: Debug observability and ETK padconf implementation
OMAP3: Add debug observablity (debobs) Kconfig item
Tero Kristo (2):
OMAP: PM debug: Add PRCM register dump support
OMAP: PM: Added suspend target state control to debugfs for OMAP3
arch/arm/mach-omap2/Makefile | 3 + arch/arm/mach-omap2/clock.c | 2 + arch/arm/mach-omap2/clockdomain.c | 10 +- arch/arm/mach-omap2/debobs.c | 240 ++++++++++++++ arch/arm/mach-omap2/pm-debug.c | 413 ++++++++++++++++++++++++- arch/arm/mach-omap2/pm.h | 11 + arch/arm/mach-omap2/pm24xx.c | 4 +- arch/arm/mach-omap2/pm34xx.c | 38 ++- arch/arm/mach-omap2/powerdomain.c | 110 +++++++- arch/arm/plat-omap/Kconfig | 7 + arch/arm/plat-omap/include/mach/clockdomain.h | 3 +- arch/arm/plat-omap/include/mach/control.h | 47 +++- arch/arm/plat-omap/include/mach/debobs.h | 7 + arch/arm/plat-omap/include/mach/powerdomain.h | 15 +- 14 files changed, 893 insertions(+), 17 deletions(-) create mode 100644 arch/arm/mach-omap2/debobs.c mode change 100644 => 100755 arch/arm/mach-omap2/pm.h create mode 100644 arch/arm/plat-omap/include/mach/debobs.h
A message that is not in the archive (sent off-list or not yet received): 1250182359-18830-1-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org
PATCH 1/10 OMAP: PM counter infrastructure.
From: Peter 'p2' De Schrijver <[email protected]>
This patch provides the infrastructure to count how many times a powerdomain entered a given power state (on, inactive, retention, off). A number of functions are provided which will be called by the chip specific powerdomain and clockdomain code whenever a transition might have happened.
--- arch/arm/mach-omap2/clockdomain.c | 2 + arch/arm/mach-omap2/powerdomain.c | 101 ++++++++++++++++++++++++- arch/arm/plat-omap/include/mach/powerdomain.h | 7 ++ 3 files changed, 108 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clockdomain.c +2 -0
@@ -484,6 +484,8 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) v <<__ffs (clkdm->clktrctrl_mask), clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL); + +pwrdm_clkdm_state_switch (clkdm); }/**
arch/arm/mach-omap2/powerdomain.c +99 -2
124 lines not on this page · raw message
arch/arm/plat-omap/include/mach/powerdomain.h +7 -0
@@ -117,6 +117,8 @@ struct powerdomain {struct list_head node; +int state; +unsigned state_counter[4 ]; };
@@ -164,4 +166,9 @@ bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm);int pwrdm_wait_transition (struct powerdomain *pwrdm); +int pwrdm_state_switch (struct powerdomain *pwrdm); +int pwrdm_clkdm_state_switch (struct clockdomain *clkdm); +int pwrdm_pre_transition (void ); +int pwrdm_post_transition (void ); +#endif
Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/10 OMAP: PM: Hook into PM counters
From: Peter 'p2' De Schrijver <[email protected]>
This patch modifies the clock, clockdomain and OMAP3 specific powerdomain code to call the PM counter infrastructure whenever one or more powerdomains might have changed state.
--- arch/arm/mach-omap2/clock.c | 2 ++ arch/arm/mach-omap2/clockdomain.c | 3 +++ arch/arm/mach-omap2/pm34xx.c | 6 ++++++ 3 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock.c +2 -0
@@ -1041,5 +1041,7 @@ void omap2_clk_disable_unused(struct clk *clk) omap2_clk_disable(clk); }else _omap2_clk_disable (clk); +if (clk->clkdm !=NULL ) +pwrdm_clkdm_state_switch (clk->clkdm); }#endif
arch/arm/mach-omap2/clockdomain.c +3 -0
@@ -574,6 +574,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)omap2_clkdm_wakeup (clkdm);pwrdm_wait_transition (clkdm->pwrdm.ptr); +pwrdm_clkdm_state_switch (clkdm);return 0 ; }
@@ -626,6 +627,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)else omap2_clkdm_sleep (clkdm); +pwrdm_clkdm_state_switch (clkdm); +return 0 ; }
arch/arm/mach-omap2/pm34xx.c +6 -0
@@ -170,6 +170,8 @@ static void omap_sram_idle(void)printk (KERN_ERR "Invalid mpu state in sram_idle\n" );return ; } +pwrdm_pre_transition (); +omap2_gpio_prepare_for_retention ();omap_uart_prepare_idle (0 );omap_uart_prepare_idle (1 );
@@ -182,6 +184,9 @@ static void omap_sram_idle(void)omap_uart_resume_idle (1 );omap_uart_resume_idle (0 );omap2_gpio_resume_after_retention (); + +pwrdm_post_transition (); + }/*
@@ -271,6 +276,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 state)if (sleep_switch) {omap2_clkdm_allow_idle (pwrdm->pwrdm_clkdms[0 ]);pwrdm_wait_transition (pwrdm); +pwrdm_state_switch (pwrdm); } err:
Signature · 1 line
1.6.4
A message that is not in the archive (sent off-list or not yet received): 1250182359-18830-3-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org
PATCH 3/10 OMAP: PM: Add closures to clkdm_for_each and pwrdm_for_each.
From: Peter 'p2' De Schrijver <[email protected]>
Add some infrastructure to easily iterate over clock and power domains.
--- arch/arm/mach-omap2/clockdomain.c | 5 +++-- arch/arm/mach-omap2/pm24xx.c | 4 ++-- arch/arm/mach-omap2/pm34xx.c | 8 ++++---- arch/arm/plat-omap/include/mach/clockdomain.h | 3 ++- arch/arm/plat-omap/include/mach/powerdomain.h | 3 ++- 5 files changed, 13 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clockdomain.c +3 -2
@@ -299,7 +299,8 @@ struct clockdomain *clkdm_lookup(const char *name)* anything else to indicate failure; or -EINVAL if the function pointer * is null. */ -int clkdm_for_each (int (*fn)(struct clockdomain *clkdm)) +int clkdm_for_each (int (*fn)(struct clockdomain *clkdm,void *user), +void *user) {struct clockdomain *clkdm;int ret =0 ;
@@ -309,7 +310,7 @@ int clkdm_for_each(int (*fn)(struct clockdomain *clkdm))mutex_lock (&clkdm_mutex);list_for_each_entry (clkdm, &clkdm_list, node) { - ret = (*fn)(clkdm); + ret = (*fn)(clkdm, user);if (ret)break ; }
arch/arm/mach-omap2/pm24xx.c +2 -2
@@ -333,7 +333,7 @@ static struct platform_suspend_ops omap_pm_ops = { .valid = suspend_valid_only_mem, }; -static int _pm_clkdm_enable_hwsup (struct clockdomain *clkdm) +static int _pm_clkdm_enable_hwsup (struct clockdomain *clkdm,void *unused) {omap2_clkdm_allow_idle (clkdm);return 0 ;
@@ -385,7 +385,7 @@ static void __init prcm_setup_regs(void)omap2_clkdm_sleep (gfx_clkdm);/* Enable clockdomain hardware-supervised control for all clkdms */ -clkdm_for_each (_pm_clkdm_enable_hwsup); +clkdm_for_each (_pm_clkdm_enable_hwsup,NULL );/* Enable clock autoidle for all domains */ cm_write_mod_reg(OMAP24XX_AUTO_CAM |
arch/arm/mach-omap2/pm34xx.c +4 -4
@@ -664,7 +664,7 @@ static void __init prcm_setup_regs(void)omap3_d2d_idle (); } -static int __init pwrdms_setup (struct powerdomain *pwrdm) +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) {struct power_state *pwrst;
@@ -689,7 +689,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm)* supported. Initiate sleep transition for other clockdomains, if * they are not used */ -static int __init clkdms_setup (struct clockdomain *clkdm) +static int __init clkdms_setup (struct clockdomain *clkdm,void *unused) {if (clkdm->flags &CLKDM_CAN_ENABLE_AUTO )omap2_clkdm_allow_idle (clkdm);
@@ -722,13 +722,13 @@ static int __init omap3_pm_init(void) goto err1; } - ret =pwrdm_for_each (pwrdms_setup); + ret =pwrdm_for_each (pwrdms_setup,NULL );if (ret) {printk (KERN_ERR "Failed to setup powerdomains\n" ); goto err2; } - (void )clkdm_for_each (clkdms_setup); + (void )clkdm_for_each (clkdms_setup,NULL ); mpu_pwrdm =pwrdm_lookup ("mpu_pwrdm" );if (mpu_pwrdm ==NULL ) {
arch/arm/plat-omap/include/mach/clockdomain.h +2 -1
@@ -95,7 +95,8 @@ int clkdm_register(struct clockdomain *clkdm);int clkdm_unregister (struct clockdomain *clkdm);struct clockdomain *clkdm_lookup (const char *name); -int clkdm_for_each (int (*fn)(struct clockdomain *clkdm)); +int clkdm_for_each (int (*fn)(struct clockdomain *clkdm,void *user), +void *user);struct powerdomain *clkdm_get_pwrdm (struct clockdomain *clkdm);void omap2_clkdm_allow_idle (struct clockdomain *clkdm);
arch/arm/plat-omap/include/mach/powerdomain.h +2 -1
@@ -128,7 +128,8 @@ int pwrdm_register(struct powerdomain *pwrdm);int pwrdm_unregister (struct powerdomain *pwrdm);struct powerdomain *pwrdm_lookup (const char *name); -int pwrdm_for_each (int (*fn)(struct powerdomain *pwrdm)); +int pwrdm_for_each (int (*fn)(struct powerdomain *pwrdm,void *user), +void *user);int pwrdm_add_clkdm (struct powerdomain *pwrdm,struct clockdomain *clkdm);int pwrdm_del_clkdm (struct powerdomain *pwrdm,struct clockdomain *clkdm);
Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1250182359-18830-4-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org
PATCH 4/10 OMAP: PM: Add pm-debug counters
From: Peter 'p2' De Schrijver <[email protected]>
This patch provides the debugfs entries and a function which will be called by the PM code to register the time spent per domain per state. Also some new fields are added to the powerdomain struct to keep the time information.
NOTE: As of v2.6.29, using getnstimeofday() after drivers are suspended is no longer safe since the timekeeping subsystem is also suspended as part of the suspend process. Instead use sched_clock() which on OMAP returns the 32k SYNC timer in nanoseconds.
Also, do not print out status for meta powerdomains (dpll*)
--- arch/arm/mach-omap2/pm-debug.c | 178 ++++++++++++++++++++++++- arch/arm/mach-omap2/pm.h | 4 + arch/arm/plat-omap/include/mach/powerdomain.h | 5 + 3 files changed, 186 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/pm-debug.c +177 -1
@@ -20,13 +20,15 @@*/ #include <linux/kernel.h> -#include <linux/timer.h> +#include <linux/sched.h> #include <linux/clk.h> #include <linux/err.h> #include <linux/io.h> #include <mach/clock.h> #include <mach/board.h> +#include <mach/powerdomain.h> +#include <mach/clockdomain.h> #include "prm.h" #include "cm.h"
@@ -150,3 +152,177 @@ void omap2_pm_dump(int mode, int resume, unsigned int us)for (i =0 ; i < reg_count; i++)printk (KERN_INFO "%-20s: 0x%08x\n" , regs[i].name, regs[i].val); } + +#ifdef CONFIG_DEBUG_FS +#include <linux/debugfs.h> +#include <linux/seq_file.h> + +struct dentry *pm_dbg_dir; + +static int pm_dbg_init_done; + +enum { +DEBUG_FILE_COUNTERS =0 , +DEBUG_FILE_TIMERS , +}; + +static const char pwrdm_state_names[][4 ] = { +"OFF" , +"RET" , +"INA" , +"ON" +}; + +void pm_dbg_update_time (struct powerdomain *pwrdm,int prev) +{ +s64 t; + +if (!pm_dbg_init_done) +return ; + +/* Update timer for previous state */ + t =sched_clock (); + + pwrdm->state_timer[prev] += t - pwrdm->timer; + + pwrdm->timer = t; +} + +static int clkdm_dbg_show_counter (struct clockdomain *clkdm,void *user) +{ +struct seq_file *s = (struct seq_file *)user; + +if (strcmp (clkdm->name,"emu_clkdm" ) ==0 || +strcmp (clkdm->name,"wkup_clkdm" ) ==0 || +strncmp (clkdm->name,"dpll" ,4 ) ==0 ) +return 0 ; + +seq_printf (s,"%s->%s (%d)" , clkdm->name, + clkdm->pwrdm.ptr->name, +atomic_read (&clkdm->usecount)); +seq_printf (s,"\n" ); + +return 0 ; +} + +static int pwrdm_dbg_show_counter (struct powerdomain *pwrdm,void *user) +{ +struct seq_file *s = (struct seq_file *)user; +int i; + +if (strcmp (pwrdm->name,"emu_pwrdm" ) ==0 || +strcmp (pwrdm->name,"wkup_pwrdm" ) ==0 || +strncmp (pwrdm->name,"dpll" ,4 ) ==0 ) +return 0 ; + +if (pwrdm->state !=pwrdm_read_pwrst (pwrdm)) +printk (KERN_ERR "pwrdm state mismatch(%s) %d != %d\n" , + pwrdm->name, pwrdm->state,pwrdm_read_pwrst (pwrdm)); + +seq_printf (s,"%s (%s)" , pwrdm->name, + pwrdm_state_names[pwrdm->state]); +for (i =0 ; i <4 ; i++) +seq_printf (s,",%s:%d" , pwrdm_state_names[i], + pwrdm->state_counter[i]); + +seq_printf (s,"\n" ); + +return 0 ; +} + +static int pwrdm_dbg_show_timer (struct powerdomain *pwrdm,void *user) +{ +struct seq_file *s = (struct seq_file *)user; +int i; + +if (strcmp (pwrdm->name,"emu_pwrdm" ) ==0 || +strcmp (pwrdm->name,"wkup_pwrdm" ) ==0 || +strncmp (pwrdm->name,"dpll" ,4 ) ==0 ) +return 0 ; + +pwrdm_state_switch (pwrdm); + +seq_printf (s,"%s (%s)" , pwrdm->name, + pwrdm_state_names[pwrdm->state]); + +for (i =0 ; i <4 ; i++) +seq_printf (s,",%s:%lld" , pwrdm_state_names[i], + pwrdm->state_timer[i]); + +seq_printf (s,"\n" ); +return 0 ; +} + +static int pm_dbg_show_counters (struct seq_file *s,void *unused) +{ +pwrdm_for_each (pwrdm_dbg_show_counter, s); +clkdm_for_each (clkdm_dbg_show_counter, s); + +return 0 ; +} + +static int pm_dbg_show_timers (struct seq_file *s,void *unused) +{ +pwrdm_for_each (pwrdm_dbg_show_timer, s); +return 0 ; +} + +static int pm_dbg_open (struct inode *inode,struct file *file) +{ +switch ((int )inode->i_private) { +case DEBUG_FILE_COUNTERS : +return single_open (file, pm_dbg_show_counters, + &inode->i_private); +case DEBUG_FILE_TIMERS : +default : +return single_open (file, pm_dbg_show_timers, + &inode->i_private); + }; +} + +static const struct file_operations debug_fops = { + .open = pm_dbg_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) +{ +int i; +s64 t; + + t =sched_clock (); + +for (i =0 ; i <4 ; i++) + pwrdm->state_timer[i] =0 ; + + pwrdm->timer = t; + +return 0 ; +} + +static int __init pm_dbg_init (void ) +{ +struct dentry *d; + + d =debugfs_create_dir ("pm_debug" ,NULL ); +if (IS_ERR (d)) +return PTR_ERR (d); + + (void )debugfs_create_file ("count" ,S_IRUGO , + d, (void *)DEBUG_FILE_COUNTERS , &debug_fops); + (void )debugfs_create_file ("time" ,S_IRUGO , + d, (void *)DEBUG_FILE_TIMERS , &debug_fops); + +pwrdm_for_each (pwrdms_setup,NULL ); + + pm_dbg_init_done =1 ; + +return 0 ; +} +late_initcall (pm_dbg_init); + +#else +void pm_dbg_update_time (struct powerdomain *pwrdm,int prev) {} +#endif
arch/arm/mach-omap2/pm.h +4 -0
@@ -11,12 +11,16 @@#ifndef __ARCH_ARM_MACH_OMAP2_PM_H#define __ARCH_ARM_MACH_OMAP2_PM_H +#include <mach/powerdomain.h> +#ifdef CONFIG_PM_DEBUG extern void omap2_pm_dump (int mode,int resume,unsigned int us);extern int omap2_pm_debug; +extern void pm_dbg_update_time (struct powerdomain *pwrdm,int prev);#else #define omap2_pm_dump (mode, resume, us) do {} while (0);#define omap2_pm_debug 0 +#define pm_dbg_update_time (pwrdm, prev) do {} while (0);#endif /* CONFIG_PM_DEBUG */ extern void omap24xx_idle_loop_suspend (void );
arch/arm/plat-omap/include/mach/powerdomain.h +5 -0
@@ -119,6 +119,11 @@ struct powerdomain {int state;unsigned state_counter[4 ]; + +#ifdef CONFIG_PM_DEBUG +s64 timer; +s64 state_timer[4 ]; +#endif };
Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/10 OMAP: PM debug: make powerdomains use PM-debug counters
From: Peter 'p2' De Schrijver <[email protected]>
Make the powerdomain code call the new hook for updating the time. Also implement the updated pwrdm_for_each.
--- arch/arm/mach-omap2/powerdomain.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/powerdomain.c +11 -6
@@ -35,6 +35,8 @@#include <mach/powerdomain.h> #include <mach/clockdomain.h> +#include "pm.h" +enum {PWRDM_STATE_NOW =0 ,PWRDM_STATE_PREV ,
@@ -134,19 +136,21 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)if (state != prev) pwrdm->state_counter[state]++; +pm_dbg_update_time (pwrdm, prev); + pwrdm->state = state;return 0 ; } -static int _pwrdm_pre_transition_cb (struct powerdomain *pwrdm) +static int _pwrdm_pre_transition_cb (struct powerdomain *pwrdm,void *unused) {pwrdm_clear_all_prev_pwrst (pwrdm);_pwrdm_state_switch (pwrdm,PWRDM_STATE_NOW );return 0 ; } -static int _pwrdm_post_transition_cb (struct powerdomain *pwrdm) +static int _pwrdm_post_transition_cb (struct powerdomain *pwrdm,void *unused) {_pwrdm_state_switch (pwrdm,PWRDM_STATE_PREV );return 0 ;
@@ -282,7 +286,8 @@ struct powerdomain *pwrdm_lookup(const char *name)* anything else to indicate failure; or -EINVAL if the function * pointer is null. */ -int pwrdm_for_each (int (*fn)(struct powerdomain *pwrdm)) +int pwrdm_for_each (int (*fn)(struct powerdomain *pwrdm,void *user), +void *user) {struct powerdomain *temp_pwrdm;unsigned long flags;
@@ -293,7 +298,7 @@ int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm))read_lock_irqsave (&pwrdm_rwlock, flags);list_for_each_entry (temp_pwrdm, &pwrdm_list, node) { - ret = (*fn)(temp_pwrdm); + ret = (*fn)(temp_pwrdm, user);if (ret)break ; }
@@ -1198,13 +1203,13 @@ int pwrdm_clk_state_switch(struct clk *clk)int pwrdm_pre_transition (void ) { -pwrdm_for_each (_pwrdm_pre_transition_cb); +pwrdm_for_each (_pwrdm_pre_transition_cb,NULL );return 0 ; }int pwrdm_post_transition (void ) { -pwrdm_for_each (_pwrdm_post_transition_cb); +pwrdm_for_each (_pwrdm_post_transition_cb,NULL );return 0 ; }
Signature · 1 line
1.6.4
A message that is not in the archive (sent off-list or not yet received): 1250182359-18830-6-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org
PATCH 6/10 OMAP: PM debug: Add PRCM register dump support
From: Tero Kristo <[email protected]>
Allows dumping out current register contents from the debug filesystem, and also allows user to add arbitrary register save points into code. Current register contents are available under debugfs at:
[debugfs]/pm_debug/registers/current
To add a save point, do following:
Quoted 1 line
From module init (or somewhere before the save call, called only once):
pm_dbg_init_regset(n); // n=1..4, allocates memory for dump area #n
Quoted 1 line
From arbitrary code location:
pm_dbg_regset_save(n); // n=1..4, saves registers to dump area #n
After this, the register dump can be seen under [debugfs]/pm_debug/registers/n
--- arch/arm/mach-omap2/pm-debug.c | 208 ++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 4 + 2 files changed, 212 insertions(+), 0 deletions(-) mode change 100644 => 100755 arch/arm/mach-omap2/pm-debug.c mode change 100644 => 100755 arch/arm/mach-omap2/pm.h
arch/arm/mach-omap2/pm-debug.c +208 -0
@@ -157,6 +157,8 @@ void omap2_pm_dump(int mode, int resume, unsigned int us)#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;
@@ -166,6 +168,159 @@ enum { DEBUG_FILE_TIMERS, }; +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 }, + {"DSS" ,MOD_CM ,OMAP3430_DSS_MOD ,0 ,0x4c }, + {"CAM" ,MOD_CM ,OMAP3430_CAM_MOD ,0 ,0x4c }, + {"PER" ,MOD_CM ,OMAP3430_PER_MOD ,0 ,0x4c }, + {"EMU" ,MOD_CM ,OMAP3430_EMU_MOD ,0x40 ,0x54 }, + {"NEON" ,MOD_CM ,OMAP3430_NEON_MOD ,0x20 ,0x48 }, + {"USB" ,MOD_CM ,OMAP3430ES2_USBHOST_MOD ,0 ,0x4c }, + + {"IVA2" ,MOD_PRM ,OMAP3430_IVA2_MOD ,0x50 ,0xfc }, + {"OCP" ,MOD_PRM ,OCP_MOD ,4 ,0x1c }, + {"MPU" ,MOD_PRM ,MPU_MOD ,0x58 ,0xe8 }, + {"CORE" ,MOD_PRM ,CORE_MOD ,0x58 ,0xf8 }, + {"SGX" ,MOD_PRM ,OMAP3430ES2_SGX_MOD ,0x58 ,0xe8 }, + {"WKUP" ,MOD_PRM ,WKUP_MOD ,0xa0 ,0xb0 }, + {"CCR" ,MOD_PRM ,PLL_MOD ,0x40 ,0x70 }, + {"DSS" ,MOD_PRM ,OMAP3430_DSS_MOD ,0x58 ,0xe8 }, + {"CAM" ,MOD_PRM ,OMAP3430_CAM_MOD ,0x58 ,0xe8 }, + {"PER" ,MOD_PRM ,OMAP3430_PER_MOD ,0x58 ,0xe8 }, + {"EMU" ,MOD_PRM ,OMAP3430_EMU_MOD ,0x58 ,0xe4 }, + {"GLBL" ,MOD_PRM ,OMAP3430_GR_MOD ,0x20 ,0xe4 }, + {"NEON" ,MOD_PRM ,OMAP3430_NEON_MOD ,0x58 ,0xe8 }, + {"USB" ,MOD_PRM ,OMAP3430ES2_USBHOST_MOD ,0x58 ,0xe8 }, + {"" ,0 ,0 ,0 ,0 }, +}; + +#define PM_DBG_MAX_REG_SETS 4 + +static void *pm_dbg_reg_set[PM_DBG_MAX_REG_SETS ]; + +static int pm_dbg_get_regset_size (void ) +{ +static int regset_size; + +if (regset_size ==0 ) { +int i =0 ; + +while (pm_dbg_reg_modules[i].name[0 ] !=0 ) { + regset_size += pm_dbg_reg_modules[i].high + +4 - pm_dbg_reg_modules[i].low; + i++; + } + } +return regset_size; +} + +static int pm_dbg_show_regs (struct seq_file *s,void *unused) +{ +int i, j; +unsigned long val; +int reg_set = (int )s->private; +u32 *ptr; +void *store =NULL ; +int regs; +int linefeed; + +if (reg_set ==0 ) { + store =kmalloc (pm_dbg_get_regset_size (),GFP_KERNEL ); + ptr = store; +pm_dbg_regset_store (ptr); + }else { + ptr = pm_dbg_reg_set[reg_set -1 ]; + } + + i =0 ; + +while (pm_dbg_reg_modules[i].name[0 ] !=0 ) { + regs =0 ; + linefeed =0 ; +if (pm_dbg_reg_modules[i].type ==MOD_CM ) +seq_printf (s,"MOD: CM_%s (%08x)\n" , + pm_dbg_reg_modules[i].name, + (u32)(OMAP3430_CM_BASE + + pm_dbg_reg_modules[i].offset)); +else +seq_printf (s,"MOD: PRM_%s (%08x)\n" , + pm_dbg_reg_modules[i].name, + (u32)(OMAP3430_PRM_BASE + + pm_dbg_reg_modules[i].offset)); + +for (j = pm_dbg_reg_modules[i].low; + j <= pm_dbg_reg_modules[i].high; j +=4 ) { + val = *(ptr++); +if (val !=0 ) { + regs++; +if (linefeed) { +seq_printf (s,"\n" ); + linefeed =0 ; + } +seq_printf (s," %02x => %08lx" , j, val); +if (regs %4 ==0 ) + linefeed =1 ; + } + } +seq_printf (s,"\n" ); + i++; + } + +if (store !=NULL ) +kfree (store); + +return 0 ; +} + +static void pm_dbg_regset_store (u32 *ptr) +{ +int i, j; +u32 val; + + i =0 ; + +while (pm_dbg_reg_modules[i].name[0 ] !=0 ) { +for (j = pm_dbg_reg_modules[i].low; + j <= pm_dbg_reg_modules[i].high; j +=4 ) { +if (pm_dbg_reg_modules[i].type ==MOD_CM ) + val =cm_read_mod_reg ( + pm_dbg_reg_modules[i].offset, j); +else + val =prm_read_mod_reg ( + pm_dbg_reg_modules[i].offset, j); + *(ptr++) = val; + } + i++; + } +} + +int pm_dbg_regset_save (int reg_set) +{ +if (pm_dbg_reg_set[reg_set-1 ] ==NULL ) +return -EINVAL ; + +pm_dbg_regset_store (pm_dbg_reg_set[reg_set-1 ]); + +return 0 ; +} +static const char pwrdm_state_names[][4 ] = {"OFF" ,"RET" ,
@@ -280,6 +435,11 @@ static int pm_dbg_open(struct inode *inode, struct file *file) }; } +static int pm_dbg_reg_open (struct inode *inode,struct file *file) +{ +return single_open (file, pm_dbg_show_regs, inode->i_private); +} +static const struct file_operations debug_fops = { .open = pm_dbg_open, .read = seq_read,
@@ -287,6 +447,37 @@ static const struct file_operations debug_fops = { .release = single_release, }; +static const struct file_operations debug_reg_fops = { + .open = pm_dbg_reg_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +int pm_dbg_regset_init (int reg_set) +{ +char name[2 ]; + +if (reg_set <1 || reg_set >PM_DBG_MAX_REG_SETS || + pm_dbg_reg_set[reg_set-1 ] !=NULL ) +return -EINVAL ; + + pm_dbg_reg_set[reg_set-1 ] = +kmalloc (pm_dbg_get_regset_size (),GFP_KERNEL ); + +if (pm_dbg_reg_set[reg_set-1 ] ==NULL ) +return -ENOMEM ; + +if (pm_dbg_dir !=NULL ) { +sprintf (name,"%d" , reg_set); + + (void )debugfs_create_file (name,S_IRUGO , + pm_dbg_dir, (void *)reg_set, &debug_reg_fops); + } + +return 0 ; +} +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) {int i;
@@ -304,7 +495,9 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)static int __init pm_dbg_init (void ) { +int i;struct dentry *d; +char name[2 ]; d =debugfs_create_dir ("pm_debug" ,NULL );if (IS_ERR (d))
@@ -317,6 +510,21 @@ static int __init pm_dbg_init(void)pwrdm_for_each (pwrdms_setup,NULL ); + pm_dbg_dir =debugfs_create_dir ("registers" , d); +if (IS_ERR (pm_dbg_dir)) +return PTR_ERR (pm_dbg_dir); + + (void )debugfs_create_file ("current" ,S_IRUGO , + pm_dbg_dir, (void *)0 , &debug_reg_fops); + +for (i =0 ; i <PM_DBG_MAX_REG_SETS ; i++) +if (pm_dbg_reg_set[i] !=NULL ) { +sprintf (name,"%d" , i+1 ); + (void )debugfs_create_file (name,S_IRUGO , + pm_dbg_dir, (void *)(i+1 ), &debug_reg_fops); + + } + pm_dbg_init_done =1 ;return 0 ;
arch/arm/mach-omap2/pm.h +4 -0
@@ -17,10 +17,14 @@extern void omap2_pm_dump (int mode,int resume,unsigned int us);extern int omap2_pm_debug;extern void pm_dbg_update_time (struct powerdomain *pwrdm,int prev); +extern int pm_dbg_regset_save (int reg_set); +extern int pm_dbg_regset_init (int reg_set);#else #define omap2_pm_dump (mode, resume, us) do {} while (0);#define omap2_pm_debug 0#define pm_dbg_update_time (pwrdm, prev) do {} while (0); +#define pm_dbg_regset_save (reg_set) do {} while (0); +#define pm_dbg_regset_init (reg_set) do {} while (0);#endif /* CONFIG_PM_DEBUG */ extern void omap24xx_idle_loop_suspend (void );
Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1250182359-18830-7-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org
PATCH 7/10 OMAP: PM: Add definitions for ETK pads and observability registers
From: Peter 'p2' De Schrijver <[email protected]>
--- arch/arm/plat-omap/include/mach/control.h | 47 +++++++++++++++++++++++++++- 1 files changed, 45 insertions(+), 2 deletions(-)
arch/arm/plat-omap/include/mach/control.h +45 -2
@@ -141,8 +141,51 @@#define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc)#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) -#define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02b0) -#define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02b4) +#define OMAP343X_CONTROL_DEBOBS (i) (OMAP2_CONTROL_GENERAL + 0x01B0 \ + + ((i) >> 1) * 4 + (!(i & 1)) * 2) +#define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4) +#define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8) +#define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0) +#define OMAP343X_CONTROL_CORE_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E4) +#define OMAP343X_CONTROL_PER_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E8) +#define OMAP343X_CONTROL_USBHOST_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01EC) +#define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02B0) +#define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02B4) +#define OMAP343X_CONTROL_SRAMLDO4 (OMAP2_CONTROL_GENERAL + 0x02B8) +#define OMAP343X_CONTROL_SRAMLDO5 (OMAP2_CONTROL_GENERAL + 0x02C0) +#define OMAP343X_CONTROL_CSI (OMAP2_CONTROL_GENERAL + 0x02C4) + + +/* 34xx PADCONF register offsets */ +#define OMAP343X_PADCONF_ETK (i) (OMAP2_CONTROL_PADCONFS + 0x5a8 + \ + (i)*2) +#define OMAP343X_PADCONF_ETK_CLK OMAP343X_PADCONF_ETK(0) +#define OMAP343X_PADCONF_ETK_CTL OMAP343X_PADCONF_ETK(1) +#define OMAP343X_PADCONF_ETK_D0 OMAP343X_PADCONF_ETK(2) +#define OMAP343X_PADCONF_ETK_D1 OMAP343X_PADCONF_ETK(3) +#define OMAP343X_PADCONF_ETK_D2 OMAP343X_PADCONF_ETK(4) +#define OMAP343X_PADCONF_ETK_D3 OMAP343X_PADCONF_ETK(5) +#define OMAP343X_PADCONF_ETK_D4 OMAP343X_PADCONF_ETK(6) +#define OMAP343X_PADCONF_ETK_D5 OMAP343X_PADCONF_ETK(7) +#define OMAP343X_PADCONF_ETK_D6 OMAP343X_PADCONF_ETK(8) +#define OMAP343X_PADCONF_ETK_D7 OMAP343X_PADCONF_ETK(9) +#define OMAP343X_PADCONF_ETK_D8 OMAP343X_PADCONF_ETK(10) +#define OMAP343X_PADCONF_ETK_D9 OMAP343X_PADCONF_ETK(11) +#define OMAP343X_PADCONF_ETK_D10 OMAP343X_PADCONF_ETK(12) +#define OMAP343X_PADCONF_ETK_D11 OMAP343X_PADCONF_ETK(13) +#define OMAP343X_PADCONF_ETK_D12 OMAP343X_PADCONF_ETK(14) +#define OMAP343X_PADCONF_ETK_D13 OMAP343X_PADCONF_ETK(15) +#define OMAP343X_PADCONF_ETK_D14 OMAP343X_PADCONF_ETK(16) +#define OMAP343X_PADCONF_ETK_D15 OMAP343X_PADCONF_ETK(17) + +/* 34xx GENERAL_WKUP regist offsets */ +#define OMAP343X_CONTROL_WKUP_DEBOBSMUX (i) (OMAP343X_CONTROL_GENERAL_WKUP + \ + 0x008 + (i)) +#define OMAP343X_CONTROL_WKUP_DEBOBS0 (OMAP343X_CONTROL_GENERAL_WKUP + 0x008) +#define OMAP343X_CONTROL_WKUP_DEBOBS1 (OMAP343X_CONTROL_GENERAL_WKUP + 0x00C) +#define OMAP343X_CONTROL_WKUP_DEBOBS2 (OMAP343X_CONTROL_GENERAL_WKUP + 0x010) +#define OMAP343X_CONTROL_WKUP_DEBOBS3 (OMAP343X_CONTROL_GENERAL_WKUP + 0x014) +#define OMAP343X_CONTROL_WKUP_DEBOBS4 (OMAP343X_CONTROL_GENERAL_WKUP + 0x018)/* 34xx D2D idle-related pins, handled by PM core */ #define OMAP3_PADCONF_SAD2D_MSTANDBY 0x250
Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1250182359-18830-8-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org
PATCH 8/10 OMAP3: Debug observability and ETK padconf implementation
From: Peter 'p2' De Schrijver <[email protected]>
--- arch/arm/mach-omap2/debobs.c | 240 ++++++++++++++++++++++++++++++ arch/arm/plat-omap/include/mach/debobs.h | 7 + 2 files changed, 247 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/debobs.c create mode 100644 arch/arm/plat-omap/include/mach/debobs.h
arch/arm/mach-omap2/debobs.c new file +240 -0
@@ -0,0 +1,240 @@ +/* +* arch/arm/mach-omap2/debobs.c +* +* Handle debobs pads +* +* Copyright (C) 2008 Nokia Corporation +* +* Written by Peter De Schrijver <[email protected]> +* +* This file is subject to the terms and conditions of the GNU General +* Public License. See the file "COPYING" in the main directory of this +* archive for more details. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/debugfs.h> +#include <linux/uaccess.h> +#include <linux/module.h> +#include <linux/gpio.h> + +#include <mach/control.h> +#include <mach/mux.h> +#include <mach/board.h> + +#define ETK_GPIO_BEGIN 12 +#define ETK_GPIO (i) (ETK_GPIO_BEGIN + i) +#define NUM_OF_DEBOBS_PADS 18 + +static int debobs_initialized; + +enum debobs_pad_mode { +GPIO =0 , +OBS =1 , +ETK =2 , +NO_MODE =3 , +}; + +static char *debobs_pad_mode_names[] = { + [GPIO ] ="GPIO" , + [OBS ] ="OBS" , + [ETK ] ="ETK" , +}; + +struct obs { +u16 offset; +u8 value; +u8 mask; +}; + +struct debobs_pad { +enum debobs_pad_mode mode; +struct obs core_obs; +struct obs wakeup_obs; +}; + +static struct debobs_pad debobs_pads[NUM_OF_DEBOBS_PADS ]; + +static int debobs_mode_open (struct inode *inode,struct file *file) +{ + file->private_data = inode->i_private; + +return 0 ; +} + +static ssize_t debobs_mode_read (struct file *file,char __user *user_buf, +size_t count,loff_t *ppos) +{ +char buffer[10 ]; +int size; +int pad_number = (int )file->private_data; +struct debobs_pad *e = &debobs_pads[pad_number]; + + size =snprintf (buffer,sizeof (buffer),"%s\n" , + debobs_pad_mode_names[e->mode]); +return simple_read_from_buffer (user_buf, count, ppos, buffer, size); +} + +static ssize_t debobs_mode_write (struct file *file,const char __user *user_buf, +size_t count,loff_t *ppos) +{ +char buffer[10 ]; +int buf_size, i, pad_number; +u16 muxmode =OMAP34XX_MUX_MODE7 ; + +memset (buffer,0 ,sizeof (buffer)); + buf_size =min (count, (sizeof (buffer)-1 )); + +if (copy_from_user (buffer, user_buf, buf_size)) +return -EFAULT ; + + pad_number = (int )file->private_data; + +for (i =0 ; i <NO_MODE ; i++) { +if (!strnicmp (debobs_pad_mode_names[i], + buffer, +strlen (debobs_pad_mode_names[i]))) { +switch (i) { +case ETK : + muxmode =OMAP34XX_MUX_MODE0 ; +break ; +case GPIO : + muxmode =OMAP34XX_MUX_MODE4 ; +break ; +case OBS : + muxmode =OMAP34XX_MUX_MODE7 ; +break ; + } +omap_ctrl_writew (muxmode, +OMAP343X_PADCONF_ETK (pad_number)); + debobs_pads[pad_number].mode = i; + +return count; + } + } + +return -EINVAL ; +} + +static const struct file_operations debobs_mode_fops = { + .open = debobs_mode_open, + .read = debobs_mode_read, + .write = debobs_mode_write, +}; + +static int debobs_get (void *data,u64 *val) +{ +struct obs *o = data; + + *val = o->value; + +return 0 ; +} + +static int debobs_set (void *data,u64 val) +{ +struct obs *o = data; + + val &=BIT (o->mask) -1 ; + +omap_ctrl_writeb (val, o->offset); + o->value = val; + +return 0 ; +} + +DEFINE_SIMPLE_ATTRIBUTE (debobs_fops, debobs_get, debobs_set,"%llu\n" ); + +static inline int __init _new_debobs_pad (struct debobs_pad *pad,char *name, +int number,struct dentry *root) +{ +struct dentry *d; +struct obs *o; + + d =debugfs_create_dir (name, root); +if (IS_ERR (d)) +return PTR_ERR (d); + +omap_ctrl_writew (OMAP34XX_MUX_MODE4 ,OMAP343X_PADCONF_ETK (number)); +gpio_direction_input (ETK_GPIO (number)); +gpio_export (ETK_GPIO (number),1 ); + (void )debugfs_create_file ("mode" ,S_IRUGO |S_IWUGO , d, + (void *)number, &debobs_mode_fops); + + o = &pad->core_obs; + o->offset =OMAP343X_CONTROL_DEBOBS (number); + o->value =omap_ctrl_readw (o->offset); + o->mask =7 ; + (void )debugfs_create_file ("coreobs" ,S_IRUGO |S_IWUGO , d, o, + &debobs_fops); + + o = &pad->wakeup_obs; + o->offset =OMAP343X_CONTROL_WKUP_DEBOBSMUX (number); + o->value =omap_ctrl_readb (o->offset); + o->mask =5 ; + (void )debugfs_create_file ("wakeupobs" ,S_IRUGO |S_IWUGO , d, o, + &debobs_fops); + +return 0 ; +} + +/* Public functions */ + +void debug_gpio_set (unsigned gpio,int value) +{ +if (!debobs_initialized) +return ; + +WARN_ON (gpio >=NUM_OF_DEBOBS_PADS ); +if (gpio <NUM_OF_DEBOBS_PADS ) +__gpio_set_value (ETK_GPIO (gpio), value); +} + +int debug_gpio_get (unsigned gpio) +{ +if (!debobs_initialized) +return -EINVAL ; + +WARN_ON (gpio >=NUM_OF_DEBOBS_PADS ); +if (gpio <NUM_OF_DEBOBS_PADS ) +return __gpio_get_value (ETK_GPIO (gpio)); + +return -EINVAL ; +} + +int __init init_debobs (void ) +{ +struct dentry *debobs_root; +int i, err; +char name[10 ]; + + debobs_root =debugfs_create_dir ("debobs" ,NULL ); +if (IS_ERR (debobs_root)) +return PTR_ERR (debobs_root); + +for (i =0 ; i <NUM_OF_DEBOBS_PADS ; i++) { +snprintf (name,sizeof (name),"hw_dbg%d" , i); +if (!gpio_request (ETK_GPIO (i), name)) { + err =_new_debobs_pad (&debobs_pads[i], name, i, + debobs_root); + }else +gpio_free (ETK_GPIO (i)); + } + + debobs_initialized =1 ; + +return 0 ; +} + +late_initcall_sync (init_debobs);
arch/arm/plat-omap/include/mach/debobs.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef __DEBOBS_H +#define __DEBOBS_H + +void debug_gpio_set (unsigned gpio,int value); +int debug_gpio_get (unsigned gpio); + +#endif
Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1250182359-18830-9-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org
PATCH 9/10 OMAP3: Add debug observablity (debobs) Kconfig item
From: Peter 'p2' De Schrijver <[email protected]>
--- arch/arm/mach-omap2/Makefile | 3 +++ arch/arm/plat-omap/Kconfig | 7 +++++++ 2 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/Makefile +3 -0
@@ -44,6 +44,9 @@ iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o obj-$(CONFIG_OMAP_IOMMU) += $(iommu-y) +# Debobs +obj-$(CONFIG_OMAP3_DEBOBS) += debobs.o + # Specific board support obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
arch/arm/plat-omap/Kconfig +7 -0
@@ -143,6 +143,13 @@ config OMAP_32K_TIMER endchoice +config OMAP3_DEBOBS + bool "OMAP3 Debug observability support" + depends on ARCH_OMAP3 && DEBUG_FS + default n + help + Use ETK pads for debug observability + config OMAP_32K_TIMER_HZ int "Kernel internal timer frequency for 32KHz timer" range 32 1024
Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1250182359-18830-10-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org
PATCH 10/10 OMAP: PM: Added suspend target state control to debugfs for OMAP3
From: Tero Kristo <[email protected]>
Target state can be read / programmed via files under:
[debugfs]/pm_debug/[pwrdm]/suspend
--- arch/arm/mach-omap2/pm-debug.c | 31 +++++++++++++++++++++++++++++-- arch/arm/mach-omap2/pm.h | 3 +++ arch/arm/mach-omap2/pm34xx.c | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) mode change 100755 => 100644 arch/arm/mach-omap2/pm-debug.c
arch/arm/mach-omap2/pm-debug.c +29 -2
@@ -24,6 +24,7 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/io.h> +#include <linux/module.h> #include <mach/clock.h> #include <mach/board.h>
@@ -478,10 +479,28 @@ int pm_dbg_regset_init(int reg_set)return 0 ; } -static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) +static int pwrdm_suspend_get (void *data,u64 *val) +{ + *val =omap3_pm_get_suspend_state ((struct powerdomain *)data); + +if (*val >=0 ) +return 0 ; +return *val; +} + +static int pwrdm_suspend_set (void *data,u64 val) +{ +return omap3_pm_set_suspend_state ((struct powerdomain *)data, (int )val); +} + +DEFINE_SIMPLE_ATTRIBUTE (pwrdm_suspend_fops, pwrdm_suspend_get, + pwrdm_suspend_set,"%llu\n" ); + +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *dir) {int i;s64 t; +struct dentry *d; t =sched_clock ();
@@ -490,6 +509,14 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) pwrdm->timer = t; +if (strncmp (pwrdm->name,"dpll" ,4 ) ==0 ) +return 0 ; + + d =debugfs_create_dir (pwrdm->name, (struct dentry *)dir); + + (void )debugfs_create_file ("suspend" ,S_IRUGO |S_IWUSR , d, + (void *)pwrdm, &pwrdm_suspend_fops); +return 0 ; }
@@ -508,7 +535,7 @@ static int __init pm_dbg_init(void) (void )debugfs_create_file ("time" ,S_IRUGO , d, (void *)DEBUG_FILE_TIMERS , &debug_fops); -pwrdm_for_each (pwrdms_setup,NULL ); +pwrdm_for_each (pwrdms_setup, (void *)d); pm_dbg_dir =debugfs_create_dir ("registers" , d);if (IS_ERR (pm_dbg_dir))
arch/arm/mach-omap2/pm.h +3 -0
@@ -13,6 +13,9 @@#include <mach/powerdomain.h> +extern int omap3_pm_get_suspend_state (struct powerdomain *pwrdm); +extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state); +#ifdef CONFIG_PM_DEBUG extern void omap2_pm_dump (int mode,int resume,unsigned int us);extern int omap2_pm_debug;
arch/arm/mach-omap2/pm34xx.c +24 -0
@@ -664,6 +664,30 @@ static void __init prcm_setup_regs(void)omap3_d2d_idle (); } +int omap3_pm_get_suspend_state (struct powerdomain *pwrdm) +{ +struct power_state *pwrst; + +list_for_each_entry (pwrst, &pwrst_list, node) { +if (pwrst->pwrdm == pwrdm) +return pwrst->next_state; + } +return -EINVAL ; +} + +int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state) +{ +struct power_state *pwrst; + +list_for_each_entry (pwrst, &pwrst_list, node) { +if (pwrst->pwrdm == pwrdm) { + pwrst->next_state = state; +return 0 ; + } + } +return -EINVAL ; +} +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) {struct power_state *pwrst;
Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1250182359-18830-11-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org
RE: [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3
Kevin,
Quoted 24 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Kevin Hilman
Sent: Thursday, August 13, 2009 11:53 AM
To: linux-arm-kernel-xIg/[email protected]; [email protected]
Cc: [email protected]; Tero Kristo
Subject: [PATCH 10/10] OMAP: PM: Added suspend target state control to
debugfs for OMAP3From: Tero Kristo <[email protected]>
Target state can be read / programmed via files under:
[debugfs]/pm_debug/[pwrdm]/suspendSigned-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/pm-debug.c | 31 +++++++++++++++++++++++++++++-- arch/arm/mach-omap2/pm.h | 3 +++ arch/arm/mach-omap2/pm34xx.c | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) mode change 100755 => 100644 arch/arm/mach-omap2/pm-debug.carch/arm/mach-omap2/pm- renamed from arch/arm/mach-omap2/pm-debug.c +0
-0
Quoted 3 lines
debug.c
old mode 100755
new mode 100644
And here one 755 mode change mistake in 6/10 is fixed... So, you'll need to refresh this aswell I guess...
Regards,
Sergio
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): A24693684029E5489D1D202277BE89444A78398A-EovWT4A8QTWIQmiDNMet8wC/[email protected]
Re: [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3
Quoted 25 lines · Sergio Alberto
Kevin,
Quoted 23 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Kevin Hilman
Sent: Thursday, August 13, 2009 11:53 AM
To: linux-arm-kernel-xIg/[email protected]; [email protected]
Cc: [email protected]; Tero Kristo
Subject: [PATCH 10/10] OMAP: PM: Added suspend target state control to
debugfs for OMAP3From: Tero Kristo <[email protected]>
Target state can be read / programmed via files under:
[debugfs]/pm_debug/[pwrdm]/suspendSigned-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/pm-debug.c | 31 +++++++++++++++++++++++++++++-- arch/arm/mach-omap2/pm.h | 3 +++ arch/arm/mach-omap2/pm34xx.c | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) mode change 100755 => 100644 arch/arm/mach-omap2/pm-debug.c
Quoted 7 lines
Quoted 4 lines
arch/arm/mach-omap2/pm- renamed from arch/arm/mach-omap2/pm-debug.c +0
-0
debug.c
old mode 100755
new mode 100644And here one 755 mode change mistake in 6/10 is fixed... So, you'll need to refresh this aswell I guess...
Thanks, will do.
Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3
In reply to a message not in the archiveQuoted 4 lines · Kevin Hilman
From: Tero Kristo <[email protected]>
Target state can be read / programmed via files under:
[debugfs]/pm_debug/[pwrdm]/suspend
Does this compile when CONFIG_DEBUG_FS is not set?
Tony
Quoted 134 lines
Signed-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/pm-debug.c | 31 +++++++++++++++++++++++++++++-- arch/arm/mach-omap2/pm.h | 3 +++ arch/arm/mach-omap2/pm34xx.c | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) mode change 100755 => 100644 arch/arm/mach-omap2/pm-debug.carch/arm/mach-omap2/pm-debug.c +29
-2@@ -24,6 +24,7 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/io.h> +#include <linux/module.h> #include <mach/clock.h> #include <mach/board.h> @@ -478,10 +479,28 @@ int pm_dbg_regset_init(int reg_set)return 0 ; } -static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) +static int pwrdm_suspend_get (void *data,u64 *val) +{ + *val =omap3_pm_get_suspend_state ((struct powerdomain *)data); + +if (*val >=0 ) +return 0 ; +return *val; +} + +static int pwrdm_suspend_set (void *data,u64 val) +{ +return omap3_pm_set_suspend_state ((struct powerdomain *)data, (int )val); +} + +DEFINE_SIMPLE_ATTRIBUTE (pwrdm_suspend_fops, pwrdm_suspend_get, + pwrdm_suspend_set,"%llu\n" ); + +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *dir) {int i;s64 t; +struct dentry *d; t =sched_clock ();@@ -490,6 +509,14 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) pwrdm->timer = t; +if (strncmp (pwrdm->name,"dpll" ,4 ) ==0 ) +return 0 ; + + d =debugfs_create_dir (pwrdm->name, (struct dentry *)dir); + + (void )debugfs_create_file ("suspend" ,S_IRUGO |S_IWUSR , d, + (void *)pwrdm, &pwrdm_suspend_fops); +return 0 ; }@@ -508,7 +535,7 @@ static int __init pm_dbg_init(void) (void )debugfs_create_file ("time" ,S_IRUGO , d, (void *)DEBUG_FILE_TIMERS , &debug_fops); -pwrdm_for_each (pwrdms_setup,NULL ); +pwrdm_for_each (pwrdms_setup, (void *)d); pm_dbg_dir =debugfs_create_dir ("registers" , d);if (IS_ERR (pm_dbg_dir))arch/arm/mach-omap2/pm.h +3
-0@@ -13,6 +13,9 @@#include <mach/powerdomain.h> +extern int omap3_pm_get_suspend_state (struct powerdomain *pwrdm); +extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state); +#ifdef CONFIG_PM_DEBUG extern void omap2_pm_dump (int mode,int resume,unsigned int us);extern int omap2_pm_debug;arch/arm/mach-omap2/pm34xx.c +24
-0@@ -664,6 +664,30 @@ static void __init prcm_setup_regs(void)omap3_d2d_idle (); } +int omap3_pm_get_suspend_state (struct powerdomain *pwrdm) +{ +struct power_state *pwrst; + +list_for_each_entry (pwrst, &pwrst_list, node) { +if (pwrst->pwrdm == pwrdm) +return pwrst->next_state; + } +return -EINVAL ; +} + +int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state) +{ +struct power_state *pwrst; + +list_for_each_entry (pwrst, &pwrst_list, node) { +if (pwrst->pwrdm == pwrdm) { + pwrst->next_state = state; +return 0 ; + } + } +return -EINVAL ; +} +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) {struct power_state *pwrst;Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3
Quoted 9 lines · Tony Lindgren
Quoted 4 lines · Kevin Hilman
From: Tero Kristo <[email protected]>
Target state can be read / programmed via files under:
[debugfs]/pm_debug/[pwrdm]/suspendDoes this compile when
CONFIG_DEBUG_FSis not set?
Yes. The relevant code is added to a section that is already wrapped by #ifdef CONFIG_DEBUG_FS.
Kevin
Quoted 135 lines
Quoted 135 lines
Signed-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/pm-debug.c | 31 +++++++++++++++++++++++++++++-- arch/arm/mach-omap2/pm.h | 3 +++ arch/arm/mach-omap2/pm34xx.c | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) mode change 100755 => 100644 arch/arm/mach-omap2/pm-debug.carch/arm/mach-omap2/pm-debug.c +29
-2@@ -24,6 +24,7 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/io.h> +#include <linux/module.h> #include <mach/clock.h> #include <mach/board.h> @@ -478,10 +479,28 @@ int pm_dbg_regset_init(int reg_set)return 0 ; } -static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) +static int pwrdm_suspend_get (void *data,u64 *val) +{ + *val =omap3_pm_get_suspend_state ((struct powerdomain *)data); + +if (*val >=0 ) +return 0 ; +return *val; +} + +static int pwrdm_suspend_set (void *data,u64 val) +{ +return omap3_pm_set_suspend_state ((struct powerdomain *)data, (int )val); +} + +DEFINE_SIMPLE_ATTRIBUTE (pwrdm_suspend_fops, pwrdm_suspend_get, + pwrdm_suspend_set,"%llu\n" ); + +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *dir) {int i;s64 t; +struct dentry *d; t =sched_clock ();@@ -490,6 +509,14 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) pwrdm->timer = t; +if (strncmp (pwrdm->name,"dpll" ,4 ) ==0 ) +return 0 ; + + d =debugfs_create_dir (pwrdm->name, (struct dentry *)dir); + + (void )debugfs_create_file ("suspend" ,S_IRUGO |S_IWUSR , d, + (void *)pwrdm, &pwrdm_suspend_fops); +return 0 ; }@@ -508,7 +535,7 @@ static int __init pm_dbg_init(void) (void )debugfs_create_file ("time" ,S_IRUGO , d, (void *)DEBUG_FILE_TIMERS , &debug_fops); -pwrdm_for_each (pwrdms_setup,NULL ); +pwrdm_for_each (pwrdms_setup, (void *)d); pm_dbg_dir =debugfs_create_dir ("registers" , d);if (IS_ERR (pm_dbg_dir))arch/arm/mach-omap2/pm.h +3
-0@@ -13,6 +13,9 @@#include <mach/powerdomain.h> +extern int omap3_pm_get_suspend_state (struct powerdomain *pwrdm); +extern int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state); +#ifdef CONFIG_PM_DEBUG extern void omap2_pm_dump (int mode,int resume,unsigned int us);extern int omap2_pm_debug;arch/arm/mach-omap2/pm34xx.c +24
-0@@ -664,6 +664,30 @@ static void __init prcm_setup_regs(void)omap3_d2d_idle (); } +int omap3_pm_get_suspend_state (struct powerdomain *pwrdm) +{ +struct power_state *pwrst; + +list_for_each_entry (pwrst, &pwrst_list, node) { +if (pwrst->pwrdm == pwrdm) +return pwrst->next_state; + } +return -EINVAL ; +} + +int omap3_pm_set_suspend_state (struct powerdomain *pwrdm,int state) +{ +struct power_state *pwrst; + +list_for_each_entry (pwrst, &pwrst_list, node) { +if (pwrst->pwrdm == pwrdm) { + pwrst->next_state = state; +return 0 ; + } + } +return -EINVAL ; +} +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) {struct power_state *pwrst;Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/10] OMAP3: Add debug observablity (debobs) Kconfig item
In reply to a message not in the archiveQuoted 28 lines · Kevin Hilman
From: Peter 'p2' De Schrijver <[email protected]>
Signed-off-by Peter 'p2' De Schrijver <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/Makefile | 3 +++ arch/arm/plat-omap/Kconfig | 7 +++++++ 2 files changed, 10 insertions(+), 0 deletions(-)arch/arm/mach-omap2/Makefile +3
-0@@ -44,6 +44,9 @@ iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o obj-$(CONFIG_OMAP_IOMMU) += $(iommu-y) +# Debobs +obj-$(CONFIG_OMAP3_DEBOBS) += debobs.o + # Specific board support obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o obj-$(CONFIG_MACH_OMAP_H4) += board-h4.oarch/arm/plat-omap/Kconfig +0
-0
arch/arm/plat-omap/Kconfig config OMAP_32K_TIMER · line 152
Quoted 10 lines
arch/arm/plat-omap/Kconfig +7
-0@@ -143,6 +143,13 @@ config OMAP_32K_TIMER endchoice +config OMAP3_DEBOBS + bool "OMAP3 Debug observability support" + depends on ARCH_OMAP3 && DEBUG_FS + default n + help + Use ETK pads for debug observability +
The code in the previous patch seems to be 34xx specific.
Quoted 10 lines
arch/arm/plat-omap/Kconfig +0
-0config OMAP_32K_TIMER_HZ int "Kernel internal timer frequency for 32KHz timer" range 32 1024Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/10] OMAP3: Debug observability and ETK padconf implementation
In reply to a message not in the archiveQuoted 17 lines · Kevin Hilman
From: Peter 'p2' De Schrijver <[email protected]>
Signed-off-by Peter 'p2' De Schrijver <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/debobs.c | 240 ++++++++++++++++++++++++++++++ arch/arm/plat-omap/include/mach/debobs.h | 7 + 2 files changed, 247 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/debobs.c create mode 100644 arch/arm/plat-omap/include/mach/debobs.harch/arm/mach-omap2/debobs.c new file +0
-0
arch/arm/mach-omap2/debobs.c line 2
Quoted 2 lines
arch/arm/mach-omap2/debobs.c new file +2
-0@@ -0,0 +1,240 @@ +/* +* arch/arm/mach-omap2/debobs.c
Should this name be 34xx-debobs.c?
Quoted 116 lines
arch/arm/mach-omap2/debobs.c new file +116
-0+* +* Handle debobs pads +* +* Copyright (C) 2008 Nokia Corporation +* +* Written by Peter De Schrijver <[email protected]> +* +* This file is subject to the terms and conditions of the GNU General +* Public License. See the file "COPYING" in the main directory of this +* archive for more details. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/debugfs.h> +#include <linux/uaccess.h> +#include <linux/module.h> +#include <linux/gpio.h> + +#include <mach/control.h> +#include <mach/mux.h> +#include <mach/board.h> + +#define ETK_GPIO_BEGIN 12 +#define ETK_GPIO (i) (ETK_GPIO_BEGIN + i) +#define NUM_OF_DEBOBS_PADS 18 + +static int debobs_initialized; + +enum debobs_pad_mode { +GPIO =0 , +OBS =1 , +ETK =2 , +NO_MODE =3 , +}; + +static char *debobs_pad_mode_names[] = { + [GPIO ] ="GPIO" , + [OBS ] ="OBS" , + [ETK ] ="ETK" , +}; + +struct obs { +u16 offset; +u8 value; +u8 mask; +}; + +struct debobs_pad { +enum debobs_pad_mode mode; +struct obs core_obs; +struct obs wakeup_obs; +}; + +static struct debobs_pad debobs_pads[NUM_OF_DEBOBS_PADS ]; + +static int debobs_mode_open (struct inode *inode,struct file *file) +{ + file->private_data = inode->i_private; + +return 0 ; +} + +static ssize_t debobs_mode_read (struct file *file,char __user *user_buf, +size_t count,loff_t *ppos) +{ +char buffer[10 ]; +int size; +int pad_number = (int )file->private_data; +struct debobs_pad *e = &debobs_pads[pad_number]; + + size =snprintf (buffer,sizeof (buffer),"%s\n" , + debobs_pad_mode_names[e->mode]); +return simple_read_from_buffer (user_buf, count, ppos, buffer, size); +} + +static ssize_t debobs_mode_write (struct file *file,const char __user *user_buf, +size_t count,loff_t *ppos) +{ +char buffer[10 ]; +int buf_size, i, pad_number; +u16 muxmode =OMAP34XX_MUX_MODE7 ; + +memset (buffer,0 ,sizeof (buffer)); + buf_size =min (count, (sizeof (buffer)-1 )); + +if (copy_from_user (buffer, user_buf, buf_size)) +return -EFAULT ; + + pad_number = (int )file->private_data; + +for (i =0 ; i <NO_MODE ; i++) { +if (!strnicmp (debobs_pad_mode_names[i], + buffer, +strlen (debobs_pad_mode_names[i]))) { +switch (i) { +case ETK : + muxmode =OMAP34XX_MUX_MODE0 ; +break ; +case GPIO : + muxmode =OMAP34XX_MUX_MODE4 ; +break ; +case OBS : + muxmode =OMAP34XX_MUX_MODE7 ; +break ; + }
arch/arm/mach-omap2/debobs.c line 128
Quoted 10 lines
arch/arm/mach-omap2/debobs.c new file +10
-0+omap_ctrl_writew (muxmode, +OMAP343X_PADCONF_ETK (pad_number)); + debobs_pads[pad_number].mode = i; + +return count; + } + } + +return -EINVAL ; +}
We need to keep processor specific stuff out of generic code in general. Otherwise we'll easily mess up things for the other processors.
Quoted 132 lines
arch/arm/mach-omap2/debobs.c new file +112
-0+ +static const struct file_operations debobs_mode_fops = { + .open = debobs_mode_open, + .read = debobs_mode_read, + .write = debobs_mode_write, +}; + +static int debobs_get (void *data,u64 *val) +{ +struct obs *o = data; + + *val = o->value; + +return 0 ; +} + +static int debobs_set (void *data,u64 val) +{ +struct obs *o = data; + + val &=BIT (o->mask) -1 ; + +omap_ctrl_writeb (val, o->offset); + o->value = val; + +return 0 ; +} + +DEFINE_SIMPLE_ATTRIBUTE (debobs_fops, debobs_get, debobs_set,"%llu\n" ); + +static inline int __init _new_debobs_pad (struct debobs_pad *pad,char *name, +int number,struct dentry *root) +{ +struct dentry *d; +struct obs *o; + + d =debugfs_create_dir (name, root); +if (IS_ERR (d)) +return PTR_ERR (d); + +omap_ctrl_writew (OMAP34XX_MUX_MODE4 ,OMAP343X_PADCONF_ETK (number)); +gpio_direction_input (ETK_GPIO (number)); +gpio_export (ETK_GPIO (number),1 ); + (void )debugfs_create_file ("mode" ,S_IRUGO |S_IWUGO , d, + (void *)number, &debobs_mode_fops); + + o = &pad->core_obs; + o->offset =OMAP343X_CONTROL_DEBOBS (number); + o->value =omap_ctrl_readw (o->offset); + o->mask =7 ; + (void )debugfs_create_file ("coreobs" ,S_IRUGO |S_IWUGO , d, o, + &debobs_fops); + + o = &pad->wakeup_obs; + o->offset =OMAP343X_CONTROL_WKUP_DEBOBSMUX (number); + o->value =omap_ctrl_readb (o->offset); + o->mask =5 ; + (void )debugfs_create_file ("wakeupobs" ,S_IRUGO |S_IWUGO , d, o, + &debobs_fops); + +return 0 ; +} + +/* Public functions */ + +void debug_gpio_set (unsigned gpio,int value) +{ +if (!debobs_initialized) +return ; + +WARN_ON (gpio >=NUM_OF_DEBOBS_PADS ); +if (gpio <NUM_OF_DEBOBS_PADS ) +__gpio_set_value (ETK_GPIO (gpio), value); +} + +int debug_gpio_get (unsigned gpio) +{ +if (!debobs_initialized) +return -EINVAL ; + +WARN_ON (gpio >=NUM_OF_DEBOBS_PADS ); +if (gpio <NUM_OF_DEBOBS_PADS ) +return __gpio_get_value (ETK_GPIO (gpio)); + +return -EINVAL ; +} + +int __init init_debobs (void ) +{ +struct dentry *debobs_root; +int i, err; +char name[10 ]; + + debobs_root =debugfs_create_dir ("debobs" ,NULL ); +if (IS_ERR (debobs_root)) +return PTR_ERR (debobs_root); + +for (i =0 ; i <NUM_OF_DEBOBS_PADS ; i++) { +snprintf (name,sizeof (name),"hw_dbg%d" , i); +if (!gpio_request (ETK_GPIO (i), name)) { + err =_new_debobs_pad (&debobs_pads[i], name, i, + debobs_root); + }else +gpio_free (ETK_GPIO (i)); + } + + debobs_initialized =1 ; + +return 0 ; +} + +late_initcall_sync (init_debobs);arch/arm/plat-omap/include/mach/debobs.h new file +7
-0@@ -0,0 +1,7 @@ +#ifndef __DEBOBS_H +#define __DEBOBS_H + +void debug_gpio_set (unsigned gpio,int value); +int debug_gpio_get (unsigned gpio); + +#endif Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers
In reply to a message not in the archiveQuoted 44 lines
From: Peter 'p2' De Schrijver <[email protected]>
Signed-off-by Peter 'p2' De Schrijver <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/plat-omap/include/mach/control.h | 47 +++++++++++++++++++++++++++- 1 files changed, 45 insertions(+), 2 deletions(-)arch/arm/plat-omap/include/mach/control.h +26
-2@@ -141,8 +141,51 @@#define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc)#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) -#define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02b0) -#define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02b4) +#define OMAP343X_CONTROL_DEBOBS (i) (OMAP2_CONTROL_GENERAL + 0x01B0 \ + + ((i) >> 1) * 4 + (!(i & 1)) * 2) +#define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4) +#define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8) +#define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0) +#define OMAP343X_CONTROL_CORE_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E4) +#define OMAP343X_CONTROL_PER_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E8) +#define OMAP343X_CONTROL_USBHOST_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01EC) +#define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02B0) +#define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02B4) +#define OMAP343X_CONTROL_SRAMLDO4 (OMAP2_CONTROL_GENERAL + 0x02B8) +#define OMAP343X_CONTROL_SRAMLDO5 (OMAP2_CONTROL_GENERAL + 0x02C0) +#define OMAP343X_CONTROL_CSI (OMAP2_CONTROL_GENERAL + 0x02C4) + + +/* 34xx PADCONF register offsets */ +#define OMAP343X_PADCONF_ETK (i) (OMAP2_CONTROL_PADCONFS + 0x5a8 + \ + (i)*2) +#define OMAP343X_PADCONF_ETK_CLK OMAP343X_PADCONF_ETK(0) +#define OMAP343X_PADCONF_ETK_CTL OMAP343X_PADCONF_ETK(1) +#define OMAP343X_PADCONF_ETK_D0 OMAP343X_PADCONF_ETK(2) +#define OMAP343X_PADCONF_ETK_D1 OMAP343X_PADCONF_ETK(3) +#define OMAP343X_PADCONF_ETK_D2 OMAP343X_PADCONF_ETK(4) +#define OMAP343X_PADCONF_ETK_D3 OMAP343X_PADCONF_ETK(5) +#define OMAP343X_PADCONF_ETK_D4 OMAP343X_PADCONF_ETK(6) +#define OMAP343X_PADCONF_ETK_D5 OMAP343X_PADCONF_ETK(7)
arch/arm/plat-omap/include/mach/control.h line 179
Quoted 10 lines
arch/arm/plat-omap/include/mach/control.h +10
-0+#define OMAP343X_PADCONF_ETK_D6 OMAP343X_PADCONF_ETK(8) +#define OMAP343X_PADCONF_ETK_D7 OMAP343X_PADCONF_ETK(9) +#define OMAP343X_PADCONF_ETK_D8 OMAP343X_PADCONF_ETK(10) +#define OMAP343X_PADCONF_ETK_D9 OMAP343X_PADCONF_ETK(11) +#define OMAP343X_PADCONF_ETK_D10 OMAP343X_PADCONF_ETK(12) +#define OMAP343X_PADCONF_ETK_D11 OMAP343X_PADCONF_ETK(13) +#define OMAP343X_PADCONF_ETK_D12 OMAP343X_PADCONF_ETK(14) +#define OMAP343X_PADCONF_ETK_D13 OMAP343X_PADCONF_ETK(15) +#define OMAP343X_PADCONF_ETK_D14 OMAP343X_PADCONF_ETK(16) +#define OMAP343X_PADCONF_ETK_D15 OMAP343X_PADCONF_ETK(17)
I'm not sure if we need to use only these pads. There is an alternative set of pad that bring out the debobs signals.
Quoted 22 lines
arch/arm/plat-omap/include/mach/control.h +9
-0+ +/* 34xx GENERAL_WKUP regist offsets */ +#define OMAP343X_CONTROL_WKUP_DEBOBSMUX (i) (OMAP343X_CONTROL_GENERAL_WKUP + \ + 0x008 + (i)) +#define OMAP343X_CONTROL_WKUP_DEBOBS0 (OMAP343X_CONTROL_GENERAL_WKUP + 0x008) +#define OMAP343X_CONTROL_WKUP_DEBOBS1 (OMAP343X_CONTROL_GENERAL_WKUP + 0x00C) +#define OMAP343X_CONTROL_WKUP_DEBOBS2 (OMAP343X_CONTROL_GENERAL_WKUP + 0x010) +#define OMAP343X_CONTROL_WKUP_DEBOBS3 (OMAP343X_CONTROL_GENERAL_WKUP + 0x014) +#define OMAP343X_CONTROL_WKUP_DEBOBS4 (OMAP343X_CONTROL_GENERAL_WKUP + 0x018)/* 34xx D2D idle-related pins, handled by PM core */ #define OMAP3_PADCONF_SAD2D_MSTANDBY 0x250Signature · 7 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers
Quoted 49 lines · Anand
Quoted 49 lines
From: Peter 'p2' De Schrijver <[email protected]>
Signed-off-by Peter 'p2' De Schrijver <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/plat-omap/include/mach/control.h | 47 +++++++++++++++++++++++++++- 1 files changed, 45 insertions(+), 2 deletions(-)arch/arm/plat-omap/include/mach/control.h +31
-2@@ -141,8 +141,51 @@#define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc)#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) -#define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02b0) -#define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02b4) +#define OMAP343X_CONTROL_DEBOBS (i) (OMAP2_CONTROL_GENERAL + 0x01B0 \ + + ((i) >> 1) * 4 + (!(i & 1)) * 2) +#define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4) +#define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8) +#define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0) +#define OMAP343X_CONTROL_CORE_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E4) +#define OMAP343X_CONTROL_PER_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E8) +#define OMAP343X_CONTROL_USBHOST_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01EC) +#define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02B0) +#define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02B4) +#define OMAP343X_CONTROL_SRAMLDO4 (OMAP2_CONTROL_GENERAL + 0x02B8) +#define OMAP343X_CONTROL_SRAMLDO5 (OMAP2_CONTROL_GENERAL + 0x02C0) +#define OMAP343X_CONTROL_CSI (OMAP2_CONTROL_GENERAL + 0x02C4) + + +/* 34xx PADCONF register offsets */ +#define OMAP343X_PADCONF_ETK (i) (OMAP2_CONTROL_PADCONFS + 0x5a8 + \ + (i)*2) +#define OMAP343X_PADCONF_ETK_CLK OMAP343X_PADCONF_ETK(0) +#define OMAP343X_PADCONF_ETK_CTL OMAP343X_PADCONF_ETK(1) +#define OMAP343X_PADCONF_ETK_D0 OMAP343X_PADCONF_ETK(2) +#define OMAP343X_PADCONF_ETK_D1 OMAP343X_PADCONF_ETK(3) +#define OMAP343X_PADCONF_ETK_D2 OMAP343X_PADCONF_ETK(4) +#define OMAP343X_PADCONF_ETK_D3 OMAP343X_PADCONF_ETK(5) +#define OMAP343X_PADCONF_ETK_D4 OMAP343X_PADCONF_ETK(6) +#define OMAP343X_PADCONF_ETK_D5 OMAP343X_PADCONF_ETK(7) +#define OMAP343X_PADCONF_ETK_D6 OMAP343X_PADCONF_ETK(8) +#define OMAP343X_PADCONF_ETK_D7 OMAP343X_PADCONF_ETK(9) +#define OMAP343X_PADCONF_ETK_D8 OMAP343X_PADCONF_ETK(10) +#define OMAP343X_PADCONF_ETK_D9 OMAP343X_PADCONF_ETK(11) +#define OMAP343X_PADCONF_ETK_D10 OMAP343X_PADCONF_ETK(12)
Quoted 8 lines
arch/arm/plat-omap/include/mach/control.h line 179
Quoted 5 lines
arch/arm/plat-omap/include/mach/control.h +5
-0+#define OMAP343X_PADCONF_ETK_D11 OMAP343X_PADCONF_ETK(13) +#define OMAP343X_PADCONF_ETK_D12 OMAP343X_PADCONF_ETK(14) +#define OMAP343X_PADCONF_ETK_D13 OMAP343X_PADCONF_ETK(15) +#define OMAP343X_PADCONF_ETK_D14 OMAP343X_PADCONF_ETK(16) +#define OMAP343X_PADCONF_ETK_D15 OMAP343X_PADCONF_ETK(17)I'm not sure if we need to use only these pads. There is an alternative set of pad that bring out the debobs signals.
... and they can be added in a separate patch when needed.
Kevin
Re: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
In reply to a message not in the archiveHi,
Quoted 78 lines · Kevin Hilman
From: Tero Kristo <[email protected]>
Allows dumping out current register contents from the debug filesystem, and also allows user to add arbitrary register save points into code. Current register contents are available under debugfs at:
[debugfs]/pm_debug/registers/current
To add a save point, do following:
From module init (or somewhere before the save call, called only once):
pm_dbg_init_regset(n); // n=1..4, allocates memory for dump area #nFrom arbitrary code location:
pm_dbg_regset_save(n); // n=1..4, saves registers to dump area #nAfter this, the register dump can be seen under [debugfs]/pm_debug/registers/n
Signed-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/pm-debug.c | 208 ++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 4 + 2 files changed, 212 insertions(+), 0 deletions(-) mode change 100644 => 100755 arch/arm/mach-omap2/pm-debug.c mode change 100644 => 100755 arch/arm/mach-omap2/pm.harch/arm/mach-omap2/pm-debug.c +34
-0@@ -157,6 +157,8 @@ void omap2_pm_dump(int mode, int resume, unsigned int us)#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;@@ -166,6 +168,159 @@ enum { DEBUG_FILE_TIMERS, }; +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 }, + {"DSS" ,MOD_CM ,OMAP3430_DSS_MOD ,0 ,0x4c }, + {"CAM" ,MOD_CM ,OMAP3430_CAM_MOD ,0 ,0x4c }, + {"PER" ,MOD_CM ,OMAP3430_PER_MOD ,0 ,0x4c }, + {"EMU" ,MOD_CM ,OMAP3430_EMU_MOD ,0x40 ,0x54 }, + {"NEON" ,MOD_CM ,OMAP3430_NEON_MOD ,0x20 ,0x48 }, + {"USB" ,MOD_CM ,OMAP3430ES2_USBHOST_MOD ,0 ,0x4c }, + + {"IVA2" ,MOD_PRM ,OMAP3430_IVA2_MOD ,0x50 ,0xfc }, + {"OCP" ,MOD_PRM ,OCP_MOD ,4 ,0x1c }, + {"MPU" ,MOD_PRM ,MPU_MOD ,0x58 ,0xe8 }, + {"CORE" ,MOD_PRM ,CORE_MOD ,0x58 ,0xf8 }, + {"SGX" ,MOD_PRM ,OMAP3430ES2_SGX_MOD ,0x58 ,0xe8 }, + {"WKUP" ,MOD_PRM ,WKUP_MOD ,0xa0 ,0xb0 },
arch/arm/mach-omap2/pm-debug.c enum { · line 212
Quoted 10 lines
arch/arm/mach-omap2/pm-debug.c +10
-0+ { "CCR", MOD_PRM, PLL_MOD, 0x40, 0x70 }, + { "DSS", MOD_PRM, OMAP3430_DSS_MOD, 0x58, 0xe8 }, + { "CAM", MOD_PRM, OMAP3430_CAM_MOD, 0x58, 0xe8 }, + { "PER", MOD_PRM, OMAP3430_PER_MOD, 0x58, 0xe8 }, + { "EMU", MOD_PRM, OMAP3430_EMU_MOD, 0x58, 0xe4 }, + { "GLBL", MOD_PRM, OMAP3430_GR_MOD, 0x20, 0xe4 }, + { "NEON", MOD_PRM, OMAP3430_NEON_MOD, 0x58, 0xe8 }, + { "USB", MOD_PRM, OMAP3430ES2_USBHOST_MOD, 0x58, 0xe8 }, + { "", 0, 0, 0, 0 }, +};
This seems 34xx specific and might easily confuse things for other processors.
To me it seems you should initialize these registers during init for the processor type.
Regards,
Tony
Quoted 224 lines
arch/arm/mach-omap2/pm-debug.c +164
-0+ +#define PM_DBG_MAX_REG_SETS 4 + +static void *pm_dbg_reg_set[PM_DBG_MAX_REG_SETS ]; + +static int pm_dbg_get_regset_size (void ) +{ +static int regset_size; + +if (regset_size ==0 ) { +int i =0 ; + +while (pm_dbg_reg_modules[i].name[0 ] !=0 ) { + regset_size += pm_dbg_reg_modules[i].high + +4 - pm_dbg_reg_modules[i].low; + i++; + } + } +return regset_size; +} + +static int pm_dbg_show_regs (struct seq_file *s,void *unused) +{ +int i, j; +unsigned long val; +int reg_set = (int )s->private; +u32 *ptr; +void *store =NULL ; +int regs; +int linefeed; + +if (reg_set ==0 ) { + store =kmalloc (pm_dbg_get_regset_size (),GFP_KERNEL ); + ptr = store; +pm_dbg_regset_store (ptr); + }else { + ptr = pm_dbg_reg_set[reg_set -1 ]; + } + + i =0 ; + +while (pm_dbg_reg_modules[i].name[0 ] !=0 ) { + regs =0 ; + linefeed =0 ; +if (pm_dbg_reg_modules[i].type ==MOD_CM ) +seq_printf (s,"MOD: CM_%s (%08x)\n" , + pm_dbg_reg_modules[i].name, + (u32)(OMAP3430_CM_BASE + + pm_dbg_reg_modules[i].offset)); +else +seq_printf (s,"MOD: PRM_%s (%08x)\n" , + pm_dbg_reg_modules[i].name, + (u32)(OMAP3430_PRM_BASE + + pm_dbg_reg_modules[i].offset)); + +for (j = pm_dbg_reg_modules[i].low; + j <= pm_dbg_reg_modules[i].high; j +=4 ) { + val = *(ptr++); +if (val !=0 ) { + regs++; +if (linefeed) { +seq_printf (s,"\n" ); + linefeed =0 ; + } +seq_printf (s," %02x => %08lx" , j, val); +if (regs %4 ==0 ) + linefeed =1 ; + } + } +seq_printf (s,"\n" ); + i++; + } + +if (store !=NULL ) +kfree (store); + +return 0 ; +} + +static void pm_dbg_regset_store (u32 *ptr) +{ +int i, j; +u32 val; + + i =0 ; + +while (pm_dbg_reg_modules[i].name[0 ] !=0 ) { +for (j = pm_dbg_reg_modules[i].low; + j <= pm_dbg_reg_modules[i].high; j +=4 ) { +if (pm_dbg_reg_modules[i].type ==MOD_CM ) + val =cm_read_mod_reg ( + pm_dbg_reg_modules[i].offset, j); +else + val =prm_read_mod_reg ( + pm_dbg_reg_modules[i].offset, j); + *(ptr++) = val; + } + i++; + } +} + +int pm_dbg_regset_save (int reg_set) +{ +if (pm_dbg_reg_set[reg_set-1 ] ==NULL ) +return -EINVAL ; + +pm_dbg_regset_store (pm_dbg_reg_set[reg_set-1 ]); + +return 0 ; +} +static const char pwrdm_state_names[][4 ] = {"OFF" ,"RET" ,@@ -280,6 +435,11 @@ static int pm_dbg_open(struct inode *inode, struct file *file) }; } +static int pm_dbg_reg_open (struct inode *inode,struct file *file) +{ +return single_open (file, pm_dbg_show_regs, inode->i_private); +} +static const struct file_operations debug_fops = { .open = pm_dbg_open, .read = seq_read,@@ -287,6 +447,37 @@ static const struct file_operations debug_fops = { .release = single_release, }; +static const struct file_operations debug_reg_fops = { + .open = pm_dbg_reg_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +int pm_dbg_regset_init (int reg_set) +{ +char name[2 ]; + +if (reg_set <1 || reg_set >PM_DBG_MAX_REG_SETS || + pm_dbg_reg_set[reg_set-1 ] !=NULL ) +return -EINVAL ; + + pm_dbg_reg_set[reg_set-1 ] = +kmalloc (pm_dbg_get_regset_size (),GFP_KERNEL ); + +if (pm_dbg_reg_set[reg_set-1 ] ==NULL ) +return -ENOMEM ; + +if (pm_dbg_dir !=NULL ) { +sprintf (name,"%d" , reg_set); + + (void )debugfs_create_file (name,S_IRUGO , + pm_dbg_dir, (void *)reg_set, &debug_reg_fops); + } + +return 0 ; +} +static int __init pwrdms_setup (struct powerdomain *pwrdm,void *unused) {int i;@@ -304,7 +495,9 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)static int __init pm_dbg_init (void ) { +int i;struct dentry *d; +char name[2 ]; d =debugfs_create_dir ("pm_debug" ,NULL );if (IS_ERR (d))@@ -317,6 +510,21 @@ static int __init pm_dbg_init(void)pwrdm_for_each (pwrdms_setup,NULL ); + pm_dbg_dir =debugfs_create_dir ("registers" , d); +if (IS_ERR (pm_dbg_dir)) +return PTR_ERR (pm_dbg_dir); + + (void )debugfs_create_file ("current" ,S_IRUGO , + pm_dbg_dir, (void *)0 , &debug_reg_fops); + +for (i =0 ; i <PM_DBG_MAX_REG_SETS ; i++) +if (pm_dbg_reg_set[i] !=NULL ) { +sprintf (name,"%d" , i+1 ); + (void )debugfs_create_file (name,S_IRUGO , + pm_dbg_dir, (void *)(i+1 ), &debug_reg_fops); + + } + pm_dbg_init_done =1 ;return 0 ;arch/arm/mach-omap2/pm.h +4
-0@@ -17,10 +17,14 @@extern void omap2_pm_dump (int mode,int resume,unsigned int us);extern int omap2_pm_debug;extern void pm_dbg_update_time (struct powerdomain *pwrdm,int prev); +extern int pm_dbg_regset_save (int reg_set); +extern int pm_dbg_regset_init (int reg_set);#else #define omap2_pm_dump (mode, resume, us) do {} while (0);#define omap2_pm_debug 0#define pm_dbg_update_time (pwrdm, prev) do {} while (0); +#define pm_dbg_regset_save (reg_set) do {} while (0); +#define pm_dbg_regset_init (reg_set) do {} while (0);#endif /* CONFIG_PM_DEBUG */ extern void omap24xx_idle_loop_suspend (void );Signature · 6 lines
1.6.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
In reply to Kevin HilmanKevin,
Quoted 30 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Kevin Hilman
Sent: Thursday, August 13, 2009 11:53 AM
To: [email protected]; [email protected]
Cc: [email protected]; Tero Kristo
Subject: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump supportFrom: Tero Kristo <[email protected]>
Allows dumping out current register contents from the debug filesystem, and
also allows user to add arbitrary register save points into code. Current register contents are available under debugfs at:[debugfs]/pm_debug/registers/current
To add a save point, do following:
From module init (or somewhere before the save call, called only once):
pm_dbg_init_regset(n); // n=1..4, allocates memory for dump area #nFrom arbitrary code location:
pm_dbg_regset_save(n); // n=1..4, saves registers to dump area #nAfter this, the register dump can be seen under [debugfs]/pm_debug/registers/n
Signed-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>
Quoted 7 lines
--- arch/arm/mach-omap2/pm-debug.c | 208 ++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 4 + 2 files changed, 212 insertions(+), 0 deletions(-) mode change 100644 => 100755 arch/arm/mach-omap2/pm-debug.c mode change 100644 => 100755 arch/arm/mach-omap2/pm.h
I guess these 755 mode changes weren't intentional... :)
Regards,
Sergio
A message that is not in the archive (sent off-list or not yet received): A24693684029E5489D1D202277BE89444A78397F-EovWT4A8QTWIQmiDNMet8wC/[email protected]
Re: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
Quoted 40 lines · Sergio Alberto
Kevin,
Quoted 30 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Kevin Hilman
Sent: Thursday, August 13, 2009 11:53 AM
To: linux-arm-kernel-xIg/[email protected]; [email protected]
Cc: [email protected]; Tero Kristo
Subject: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump supportFrom: Tero Kristo <[email protected]>
Allows dumping out current register contents from the debug filesystem, and
also allows user to add arbitrary register save points into code. Current register contents are available under debugfs at:[debugfs]/pm_debug/registers/current
To add a save point, do following:
From module init (or somewhere before the save call, called only once):
pm_dbg_init_regset(n); // n=1..4, allocates memory for dump area #nFrom arbitrary code location:
pm_dbg_regset_save(n); // n=1..4, saves registers to dump area #nAfter this, the register dump can be seen under
[debugfs]/pm_debug/registers/nSigned-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>Quoted 7 lines
--- arch/arm/mach-omap2/pm-debug.c | 208 ++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 4 + 2 files changed, 212 insertions(+), 0 deletions(-) mode change 100644 => 100755 arch/arm/mach-omap2/pm-debug.c mode change 100644 => 100755 arch/arm/mach-omap2/pm.h
Quoted 1 line
I guess these 755 mode changes weren't intentional... :)
Indeed, they were not. Thanks.
Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
Quoted 42 lines · Kevin Hilman
Quoted 40 lines · Sergio Alberto
Kevin,
Quoted 37 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Kevin Hilman
Sent: Thursday, August 13, 2009 11:53 AM
To: linux-arm-kernel-xIg/[email protected]; [email protected]
Cc: [email protected]; Tero Kristo
Subject: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump supportFrom: Tero Kristo <[email protected]>
Allows dumping out current register contents from the debug filesystem, and
also allows user to add arbitrary register save points into code. Current register contents are available under debugfs at:[debugfs]/pm_debug/registers/current
To add a save point, do following:
From module init (or somewhere before the save call, called only once):
pm_dbg_init_regset(n); // n=1..4, allocates memory for dump area #nFrom arbitrary code location:
pm_dbg_regset_save(n); // n=1..4, saves registers to dump area #nAfter this, the register dump can be seen under
[debugfs]/pm_debug/registers/nSigned-off-by Tero Kristo <[email protected]>Signed-off-by Kevin Hilman <[email protected]>--- arch/arm/mach-omap2/pm-debug.c | 208 ++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/pm.h | 4 + 2 files changed, 212 insertions(+), 0 deletions(-) mode change 100644 => 100755 arch/arm/mach-omap2/pm-debug.c mode change 100644 => 100755 arch/arm/mach-omap2/pm.h
Quoted 4 lines
Quoted 1 line
I guess these 755 mode changes weren't intentional... :)
Indeed, they were not. Thanks.
OK, fixed these locally but not worth a repost. These will be updated in the version pushed for pull request when reviewed/accepted.
Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html