public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] OMAP PM debug infrastructure for 2.6.32
@ 2009-08-13 16:52 Kevin Hilman
       [not found] ` <1250182359-18830-1-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel, linux-arm; +Cc: linux-omap

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


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 01/10] OMAP: PM counter infrastructure.
       [not found] ` <1250182359-18830-1-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 16:52   ` Kevin Hilman
  2009-08-13 16:52     ` [PATCH 02/10] OMAP: PM: Hook into PM counters Kevin Hilman
  0 siblings, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	Peter 'p2' De Schrijver

From: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

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.

Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
---
 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(-)

diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 0e7d501..26912a9 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -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);
 }
 
 /**
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 983f1cb..a2d9871 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -35,6 +35,11 @@
 #include <mach/powerdomain.h>
 #include <mach/clockdomain.h>
 
+enum {
+	PWRDM_STATE_NOW = 0,
+	PWRDM_STATE_PREV,
+};
+
 /* pwrdm_list contains all registered struct powerdomains */
 static LIST_HEAD(pwrdm_list);
 
@@ -102,6 +107,63 @@ static struct powerdomain *_pwrdm_deps_lookup(struct powerdomain *pwrdm,
 	return pd->pwrdm;
 }
 
+static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)
+{
+
+	int prev;
+	int state;
+
+	if (pwrdm == NULL)
+		return -EINVAL;
+
+	state = pwrdm_read_pwrst(pwrdm);
+
+	switch (flag) {
+	case PWRDM_STATE_NOW:
+		prev = pwrdm->state;
+		break;
+	case PWRDM_STATE_PREV:
+		prev = pwrdm_read_prev_pwrst(pwrdm);
+		if (pwrdm->state != prev)
+			pwrdm->state_counter[prev]++;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	if (state != prev)
+		pwrdm->state_counter[state]++;
+
+	pwrdm->state = state;
+
+	return 0;
+}
+
+static int _pwrdm_pre_transition_cb(struct powerdomain *pwrdm)
+{
+	pwrdm_clear_all_prev_pwrst(pwrdm);
+	_pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW);
+	return 0;
+}
+
+static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm)
+{
+	_pwrdm_state_switch(pwrdm, PWRDM_STATE_PREV);
+	return 0;
+}
+
+static __init void _pwrdm_setup(struct powerdomain *pwrdm)
+{
+	int i;
+
+	for (i = 0; i < 4; i++)
+		pwrdm->state_counter[i] = 0;
+
+	pwrdm_wait_transition(pwrdm);
+	pwrdm->state = pwrdm_read_pwrst(pwrdm);
+	pwrdm->state_counter[pwrdm->state] = 1;
+
+}
 
 /* Public functions */
 
@@ -117,9 +179,12 @@ void pwrdm_init(struct powerdomain **pwrdm_list)
 {
 	struct powerdomain **p = NULL;
 
-	if (pwrdm_list)
-		for (p = pwrdm_list; *p; p++)
+	if (pwrdm_list) {
+		for (p = pwrdm_list; *p; p++) {
 			pwrdm_register(*p);
+			_pwrdm_setup(*p);
+		}
+	}
 }
 
 /**
@@ -1110,4 +1175,36 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm)
 	return 0;
 }
 
+int pwrdm_state_switch(struct powerdomain *pwrdm)
+{
+	return _pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW);
+}
+
+int pwrdm_clkdm_state_switch(struct clockdomain *clkdm)
+{
+	if (clkdm != NULL && clkdm->pwrdm.ptr != NULL) {
+		pwrdm_wait_transition(clkdm->pwrdm.ptr);
+		return pwrdm_state_switch(clkdm->pwrdm.ptr);
+	}
+
+	return -EINVAL;
+}
+int pwrdm_clk_state_switch(struct clk *clk)
+{
+	if (clk != NULL && clk->clkdm != NULL)
+		return pwrdm_clkdm_state_switch(clk->clkdm);
+	return -EINVAL;
+}
+
+int pwrdm_pre_transition(void)
+{
+	pwrdm_for_each(_pwrdm_pre_transition_cb);
+	return 0;
+}
+
+int pwrdm_post_transition(void)
+{
+	pwrdm_for_each(_pwrdm_post_transition_cb);
+	return 0;
+}
 
diff --git a/arch/arm/plat-omap/include/mach/powerdomain.h b/arch/arm/plat-omap/include/mach/powerdomain.h
index 69c9e67..52663fc 100644
--- a/arch/arm/plat-omap/include/mach/powerdomain.h
+++ b/arch/arm/plat-omap/include/mach/powerdomain.h
@@ -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
-- 
1.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 02/10] OMAP: PM: Hook into PM counters
  2009-08-13 16:52   ` [PATCH 01/10] OMAP: PM counter infrastructure Kevin Hilman
@ 2009-08-13 16:52     ` Kevin Hilman
       [not found]       ` <1250182359-18830-3-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel, linux-arm; +Cc: linux-omap, Peter 'p2' De Schrijver

From: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>

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.

Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 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(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index b0665f1..8ccbd23 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -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
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 26912a9..5b0b90b 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -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;
 }
 
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 488d595..f197624 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -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:
-- 
1.6.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 03/10] OMAP: PM: Add closures to clkdm_for_each and pwrdm_for_each.
       [not found]       ` <1250182359-18830-3-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 16:52         ` Kevin Hilman
       [not found]           ` <1250182359-18830-4-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	Peter 'p2' De Schrijver

From: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

Add some infrastructure to easily iterate over clock and power
domains.

Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
---
 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(-)

diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 5b0b90b..4ef7b4f 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -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;
 	}
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 528dbdc..bff5c4e 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -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 |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index f197624..331dfca 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -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) {
diff --git a/arch/arm/plat-omap/include/mach/clockdomain.h b/arch/arm/plat-omap/include/mach/clockdomain.h
index b9d0dd2..99ebd88 100644
--- a/arch/arm/plat-omap/include/mach/clockdomain.h
+++ b/arch/arm/plat-omap/include/mach/clockdomain.h
@@ -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);
diff --git a/arch/arm/plat-omap/include/mach/powerdomain.h b/arch/arm/plat-omap/include/mach/powerdomain.h
index 52663fc..de03f3d 100644
--- a/arch/arm/plat-omap/include/mach/powerdomain.h
+++ b/arch/arm/plat-omap/include/mach/powerdomain.h
@@ -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);
-- 
1.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 04/10] OMAP: PM: Add pm-debug counters
       [not found]           ` <1250182359-18830-4-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 16:52             ` Kevin Hilman
  2009-08-13 16:52               ` [PATCH 05/10] OMAP: PM debug: make powerdomains use PM-debug counters Kevin Hilman
  0 siblings, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	Peter 'p2' De Schrijver, Tero Kristo

From: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

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*)

Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
---
 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(-)

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 6cc375a..9199c17 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -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
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 21201cd..4589db1 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -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);
diff --git a/arch/arm/plat-omap/include/mach/powerdomain.h b/arch/arm/plat-omap/include/mach/powerdomain.h
index de03f3d..6271d85 100644
--- a/arch/arm/plat-omap/include/mach/powerdomain.h
+++ b/arch/arm/plat-omap/include/mach/powerdomain.h
@@ -119,6 +119,11 @@ struct powerdomain {
 
 	int state;
 	unsigned state_counter[4];
+
+#ifdef CONFIG_PM_DEBUG
+	s64 timer;
+	s64 state_timer[4];
+#endif
 };
 
 
-- 
1.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 05/10] OMAP: PM debug: make powerdomains use PM-debug counters
  2009-08-13 16:52             ` [PATCH 04/10] OMAP: PM: Add pm-debug counters Kevin Hilman
@ 2009-08-13 16:52               ` Kevin Hilman
       [not found]                 ` <1250182359-18830-6-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel, linux-arm; +Cc: linux-omap, Peter 'p2' De Schrijver

From: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>

Make the powerdomain code call the new hook for updating the time.
Also implement the updated pwrdm_for_each.

Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/mach-omap2/powerdomain.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index a2d9871..5a6cef3 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -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;
 }
 
-- 
1.6.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
       [not found]                 ` <1250182359-18830-6-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 16:52                   ` Kevin Hilman
       [not found]                     ` <1250182359-18830-7-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-13 18:39                     ` Aguirre Rodriguez, Sergio Alberto
  0 siblings, 2 replies; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Tero Kristo

From: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

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 #n

>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

Signed-off-by: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
---
 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

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
old mode 100644
new mode 100755
index 9199c17..37b883b
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -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;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
old mode 100644
new mode 100755
index 4589db1..8fa8567
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -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);
-- 
1.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers
       [not found]                     ` <1250182359-18830-7-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 16:52                       ` Kevin Hilman
       [not found]                         ` <1250182359-18830-8-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-17  8:03                       ` [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support Tony Lindgren
  1 sibling, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	Peter 'p2' De Schrijver

From: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
---
 arch/arm/plat-omap/include/mach/control.h |   47 +++++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/mach/control.h b/arch/arm/plat-omap/include/mach/control.h
index 8140dbc..81afe26 100644
--- a/arch/arm/plat-omap/include/mach/control.h
+++ b/arch/arm/plat-omap/include/mach/control.h
@@ -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
-- 
1.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 08/10] OMAP3: Debug observability and ETK padconf implementation
       [not found]                         ` <1250182359-18830-8-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 16:52                           ` Kevin Hilman
       [not found]                             ` <1250182359-18830-9-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-15  5:10                           ` [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers Gadiyar, Anand
  1 sibling, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	Peter 'p2' De Schrijver

From: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
---
 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

diff --git a/arch/arm/mach-omap2/debobs.c b/arch/arm/mach-omap2/debobs.c
new file mode 100644
index 0000000..397a599
--- /dev/null
+++ b/arch/arm/mach-omap2/debobs.c
@@ -0,0 +1,240 @@
+/*
+ * arch/arm/mach-omap2/debobs.c
+ *
+ * Handle debobs pads
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ *
+ * Written by Peter De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
+ *
+ * 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);
diff --git a/arch/arm/plat-omap/include/mach/debobs.h b/arch/arm/plat-omap/include/mach/debobs.h
new file mode 100644
index 0000000..67f765d
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/debobs.h
@@ -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
-- 
1.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 09/10] OMAP3: Add debug observablity (debobs) Kconfig item
       [not found]                             ` <1250182359-18830-9-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 16:52                               ` Kevin Hilman
       [not found]                                 ` <1250182359-18830-10-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-17  8:07                               ` [PATCH 08/10] OMAP3: Debug observability and ETK padconf implementation Tony Lindgren
  1 sibling, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA,
	Peter 'p2' De Schrijver

From: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
---
 arch/arm/mach-omap2/Makefile |    3 +++
 arch/arm/plat-omap/Kconfig   |    7 +++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 735bae5..cc515a4 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -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
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index efe85d0..4e90a36 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -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
-- 
1.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3
       [not found]                                 ` <1250182359-18830-10-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 16:52                                   ` Kevin Hilman
       [not found]                                     ` <1250182359-18830-11-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-17  8:08                                   ` [PATCH 09/10] OMAP3: Add debug observablity (debobs) Kconfig item Tony Lindgren
  1 sibling, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 16:52 UTC (permalink / raw)
  To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, Tero Kristo

From: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

Target state can be read / programmed via files under:
  [debugfs]/pm_debug/[pwrdm]/suspend

Signed-off-by: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
---
 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

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
old mode 100755
new mode 100644
index 37b883b..eded6a4
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -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))
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 8fa8567..8400f57 100755
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -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;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 331dfca..26f2aca 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -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;
-- 
1.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* RE: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
  2009-08-13 16:52                   ` [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support Kevin Hilman
       [not found]                     ` <1250182359-18830-7-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 18:39                     ` Aguirre Rodriguez, Sergio Alberto
       [not found]                       ` <A24693684029E5489D1D202277BE89444A78397F-EovWT4A8QTWIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
  1 sibling, 1 reply; 23+ messages in thread
From: Aguirre Rodriguez, Sergio Alberto @ 2009-08-13 18:39 UTC (permalink / raw)
  To: Kevin Hilman, linux-arm-kernel@lists.arm.linux.org.uk,
	linux-arm@vger.kernel.org
  Cc: linux-omap@vger.kernel.org, Tero Kristo

Kevin,

> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of Kevin Hilman
> Sent: Thursday, August 13, 2009 11:53 AM
> To: linux-arm-kernel@lists.arm.linux.org.uk; linux-arm@vger.kernel.org
> Cc: linux-omap@vger.kernel.org; Tero Kristo
> Subject: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
> 
> From: Tero Kristo <tero.kristo@nokia.com>
> 
> 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 #n
> 
> 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
> 
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3
       [not found]                                     ` <1250182359-18830-11-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 18:42                                       ` Aguirre Rodriguez, Sergio Alberto
       [not found]                                         ` <A24693684029E5489D1D202277BE89444A78398A-EovWT4A8QTWIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
  2009-08-17  8:10                                       ` Tony Lindgren
  1 sibling, 1 reply; 23+ messages in thread
From: Aguirre Rodriguez, Sergio Alberto @ 2009-08-13 18:42 UTC (permalink / raw)
  To: Kevin Hilman,
	linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW@public.gmane.org,
	linux-arm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Tero Kristo

Kevin,

> -----Original Message-----
> From: linux-omap-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-omap-
> owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Kevin Hilman
> Sent: Thursday, August 13, 2009 11:53 AM
> To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW@public.gmane.org; linux-arm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Tero Kristo
> Subject: [PATCH 10/10] OMAP: PM: Added suspend target state control to
> debugfs for OMAP3
> 
> From: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> 
> Target state can be read / programmed via files under:
>   [debugfs]/pm_debug/[pwrdm]/suspend
> 
> Signed-off-by: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
> ---
>  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
> 
> diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
       [not found]                       ` <A24693684029E5489D1D202277BE89444A78397F-EovWT4A8QTWIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2009-08-13 21:34                         ` Kevin Hilman
       [not found]                           ` <87eirfe6uo.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 21:34 UTC (permalink / raw)
  To: Aguirre Rodriguez, Sergio Alberto
  Cc: linux-arm-kernel@lists.arm.linux.org.uk,
	linux-arm@vger.kernel.org, linux-omap@vger.kernel.org,
	Tero Kristo

"Aguirre Rodriguez, Sergio Alberto" <saaguirre-l0cyMroinI0@public.gmane.org> writes:

> Kevin,
>
>> -----Original Message-----
>> From: linux-omap-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-omap-
>> owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Kevin Hilman
>> Sent: Thursday, August 13, 2009 11:53 AM
>> To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW@public.gmane.org; linux-arm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Tero Kristo
>> Subject: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
>> 
>> From: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
>> 
>> 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 #n
>> 
>> 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
>> 
>> Signed-off-by: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
>> Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
>> ---
>>  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... :)

Indeed, they were not.  Thanks.

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3
       [not found]                                         ` <A24693684029E5489D1D202277BE89444A78398A-EovWT4A8QTWIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2009-08-13 21:35                                           ` Kevin Hilman
  0 siblings, 0 replies; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 21:35 UTC (permalink / raw)
  To: Aguirre Rodriguez, Sergio Alberto
  Cc: linux-arm-kernel@lists.arm.linux.org.uk,
	linux-arm@vger.kernel.org, linux-omap@vger.kernel.org,
	Tero Kristo

"Aguirre Rodriguez, Sergio Alberto" <saaguirre-l0cyMroinI0@public.gmane.org> writes:

> Kevin,
>
>> -----Original Message-----
>> From: linux-omap-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-omap-
>> owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Kevin Hilman
>> Sent: Thursday, August 13, 2009 11:53 AM
>> To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW@public.gmane.org; linux-arm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Tero Kristo
>> Subject: [PATCH 10/10] OMAP: PM: Added suspend target state control to
>> debugfs for OMAP3
>> 
>> From: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
>> 
>> Target state can be read / programmed via files under:
>>   [debugfs]/pm_debug/[pwrdm]/suspend
>> 
>> Signed-off-by: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
>> Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
>> ---
>>  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
>> 
>> diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-
>> 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...
>

Thanks, will do.

Kevin

--
To unsubscribe from this list: send the line "unsubscribe linux-arm" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
       [not found]                           ` <87eirfe6uo.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
@ 2009-08-13 22:28                             ` Kevin Hilman
  0 siblings, 0 replies; 23+ messages in thread
From: Kevin Hilman @ 2009-08-13 22:28 UTC (permalink / raw)
  To: Aguirre Rodriguez, Sergio Alberto
  Cc: linux-arm-kernel@lists.arm.linux.org.uk,
	linux-arm@vger.kernel.org, linux-omap@vger.kernel.org,
	Tero Kristo

Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org> writes:

> "Aguirre Rodriguez, Sergio Alberto" <saaguirre-l0cyMroinI0@public.gmane.org> writes:
>
>> Kevin,
>>
>>> -----Original Message-----
>>> From: linux-omap-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-omap-
>>> owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Kevin Hilman
>>> Sent: Thursday, August 13, 2009 11:53 AM
>>> To: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW@public.gmane.org; linux-arm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Tero Kristo
>>> Subject: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
>>> 
>>> From: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
>>> 
>>> 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 #n
>>> 
>>> 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
>>> 
>>> Signed-off-by: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
>>> Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
>>> ---
>>>  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... :)
>
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers
       [not found]                         ` <1250182359-18830-8-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-13 16:52                           ` [PATCH 08/10] OMAP3: Debug observability and ETK padconf implementation Kevin Hilman
@ 2009-08-15  5:10                           ` Gadiyar, Anand
  2009-08-18 12:12                             ` Kevin Hilman
  1 sibling, 1 reply; 23+ messages in thread
From: Gadiyar, Anand @ 2009-08-15  5:10 UTC (permalink / raw)
  To: Kevin Hilman,
	linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW@public.gmane.org,
	linux-arm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Peter 'p2' De Schrijver

> From: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> 
> Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
> ---
>  arch/arm/plat-omap/include/mach/control.h |   47 +++++++++++++++++++++++++++-
>  1 files changed, 45 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/include/mach/control.h b/arch/arm/plat-omap/include/mach/control.h
> index 8140dbc..81afe26 100644
> --- a/arch/arm/plat-omap/include/mach/control.h
> +++ b/arch/arm/plat-omap/include/mach/control.h
> @@ -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)

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.


> +
> +/* 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
> -- 
> 1.6.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-omap" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support
       [not found]                     ` <1250182359-18830-7-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-13 16:52                       ` [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers Kevin Hilman
@ 2009-08-17  8:03                       ` Tony Lindgren
  1 sibling, 0 replies; 23+ messages in thread
From: Tony Lindgren @ 2009-08-17  8:03 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tero Kristo

Hi,

* Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org> [090813 19:53]:
> From: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> 
> 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 #n
> 
> 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
> 
> Signed-off-by: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
> ---
>  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
> 
> diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
> old mode 100644
> new mode 100755
> index 9199c17..37b883b
> --- a/arch/arm/mach-omap2/pm-debug.c
> +++ b/arch/arm/mach-omap2/pm-debug.c
> @@ -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 },
> +};

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


> +
> +#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;
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> old mode 100644
> new mode 100755
> index 4589db1..8fa8567
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -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);
> -- 
> 1.6.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 08/10] OMAP3: Debug observability and ETK padconf implementation
       [not found]                             ` <1250182359-18830-9-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-13 16:52                               ` [PATCH 09/10] OMAP3: Add debug observablity (debobs) Kconfig item Kevin Hilman
@ 2009-08-17  8:07                               ` Tony Lindgren
  1 sibling, 0 replies; 23+ messages in thread
From: Tony Lindgren @ 2009-08-17  8:07 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	Peter 'p2' De Schrijver

* Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org> [090813 19:53]:
> From: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> 
> Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
> ---
>  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
> 
> diff --git a/arch/arm/mach-omap2/debobs.c b/arch/arm/mach-omap2/debobs.c
> new file mode 100644
> index 0000000..397a599
> --- /dev/null
> +++ b/arch/arm/mach-omap2/debobs.c
> @@ -0,0 +1,240 @@
> +/*
> + * arch/arm/mach-omap2/debobs.c

Should this name be 34xx-debobs.c?


> + *
> + * Handle debobs pads
> + *
> + * Copyright (C) 2008 Nokia Corporation
> + *
> + * Written by Peter De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> + *
> + * 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;
> +}

We need to keep processor specific stuff out of generic code in general.
Otherwise we'll easily mess up things for the other processors.


> +
> +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);
> diff --git a/arch/arm/plat-omap/include/mach/debobs.h b/arch/arm/plat-omap/include/mach/debobs.h
> new file mode 100644
> index 0000000..67f765d
> --- /dev/null
> +++ b/arch/arm/plat-omap/include/mach/debobs.h
> @@ -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
> -- 
> 1.6.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 09/10] OMAP3: Add debug observablity (debobs) Kconfig item
       [not found]                                 ` <1250182359-18830-10-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-13 16:52                                   ` [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3 Kevin Hilman
@ 2009-08-17  8:08                                   ` Tony Lindgren
  1 sibling, 0 replies; 23+ messages in thread
From: Tony Lindgren @ 2009-08-17  8:08 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	Peter 'p2' De Schrijver

* Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org> [090813 19:53]:
> From: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> 
> Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
> ---
>  arch/arm/mach-omap2/Makefile |    3 +++
>  arch/arm/plat-omap/Kconfig   |    7 +++++++
>  2 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 735bae5..cc515a4 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -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
> diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
> index efe85d0..4e90a36 100644
> --- a/arch/arm/plat-omap/Kconfig
> +++ b/arch/arm/plat-omap/Kconfig
> @@ -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.


>  config OMAP_32K_TIMER_HZ
>         int "Kernel internal timer frequency for 32KHz timer"
>         range 32 1024
> -- 
> 1.6.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3
       [not found]                                     ` <1250182359-18830-11-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
  2009-08-13 18:42                                       ` Aguirre Rodriguez, Sergio Alberto
@ 2009-08-17  8:10                                       ` Tony Lindgren
  2009-08-18 12:43                                         ` Kevin Hilman
  1 sibling, 1 reply; 23+ messages in thread
From: Tony Lindgren @ 2009-08-17  8:10 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: linux-arm-kernel-xIg/pKzrS19vn6HldHNs0ANdhmdF6hFW,
	linux-arm-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tero Kristo

* Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org> [090813 19:54]:
> From: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> 
> 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


> 
> Signed-off-by: Tero Kristo <tero.kristo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
> ---
>  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
> 
> diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
> old mode 100755
> new mode 100644
> index 37b883b..eded6a4
> --- a/arch/arm/mach-omap2/pm-debug.c
> +++ b/arch/arm/mach-omap2/pm-debug.c
> @@ -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))
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index 8fa8567..8400f57 100755
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -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;
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 331dfca..26f2aca 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -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;
> -- 
> 1.6.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers
  2009-08-15  5:10                           ` [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers Gadiyar, Anand
@ 2009-08-18 12:12                             ` Kevin Hilman
  0 siblings, 0 replies; 23+ messages in thread
From: Kevin Hilman @ 2009-08-18 12:12 UTC (permalink / raw)
  To: Gadiyar, Anand
  Cc: linux-arm-kernel@lists.arm.linux.org.uk,
	linux-arm@vger.kernel.org, linux-omap@vger.kernel.org,
	Peter 'p2' De Schrijver

"Gadiyar, Anand" <gadiyar@ti.com> writes:

>> From: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
>> 
>> Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
>> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
>> ---
>>  arch/arm/plat-omap/include/mach/control.h |   47 +++++++++++++++++++++++++++-
>>  1 files changed, 45 insertions(+), 2 deletions(-)
>> 
>> diff --git a/arch/arm/plat-omap/include/mach/control.h b/arch/arm/plat-omap/include/mach/control.h
>> index 8140dbc..81afe26 100644
>> --- a/arch/arm/plat-omap/include/mach/control.h
>> +++ b/arch/arm/plat-omap/include/mach/control.h
>> @@ -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)
>
> 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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3
  2009-08-17  8:10                                       ` Tony Lindgren
@ 2009-08-18 12:43                                         ` Kevin Hilman
  0 siblings, 0 replies; 23+ messages in thread
From: Kevin Hilman @ 2009-08-18 12:43 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-arm-kernel, linux-arm, linux-omap, Tero Kristo

Tony Lindgren <tony@atomide.com> writes:

> * Kevin Hilman <khilman@deeprootsystems.com> [090813 19:54]:
>> From: Tero Kristo <tero.kristo@nokia.com>
>> 
>> Target state can be read / programmed via files under:
>>   [debugfs]/pm_debug/[pwrdm]/suspend
>
>
> Does this compile when CONFIG_DEBUG_FS is not set?
>

Yes.  The relevant code is added to a section that is already
wrapped by #ifdef CONFIG_DEBUG_FS.

Kevin

>
>> 
>> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
>> ---
>>  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
>> 
>> diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
>> old mode 100755
>> new mode 100644
>> index 37b883b..eded6a4
>> --- a/arch/arm/mach-omap2/pm-debug.c
>> +++ b/arch/arm/mach-omap2/pm-debug.c
>> @@ -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))
>> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
>> index 8fa8567..8400f57 100755
>> --- a/arch/arm/mach-omap2/pm.h
>> +++ b/arch/arm/mach-omap2/pm.h
>> @@ -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;
>> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
>> index 331dfca..26f2aca 100644
>> --- a/arch/arm/mach-omap2/pm34xx.c
>> +++ b/arch/arm/mach-omap2/pm34xx.c
>> @@ -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;
>> -- 
>> 1.6.4
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-arm" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2009-08-18 12:43 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-13 16:52 [PATCH 00/10] OMAP PM debug infrastructure for 2.6.32 Kevin Hilman
     [not found] ` <1250182359-18830-1-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 16:52   ` [PATCH 01/10] OMAP: PM counter infrastructure Kevin Hilman
2009-08-13 16:52     ` [PATCH 02/10] OMAP: PM: Hook into PM counters Kevin Hilman
     [not found]       ` <1250182359-18830-3-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 16:52         ` [PATCH 03/10] OMAP: PM: Add closures to clkdm_for_each and pwrdm_for_each Kevin Hilman
     [not found]           ` <1250182359-18830-4-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 16:52             ` [PATCH 04/10] OMAP: PM: Add pm-debug counters Kevin Hilman
2009-08-13 16:52               ` [PATCH 05/10] OMAP: PM debug: make powerdomains use PM-debug counters Kevin Hilman
     [not found]                 ` <1250182359-18830-6-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 16:52                   ` [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support Kevin Hilman
     [not found]                     ` <1250182359-18830-7-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 16:52                       ` [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers Kevin Hilman
     [not found]                         ` <1250182359-18830-8-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 16:52                           ` [PATCH 08/10] OMAP3: Debug observability and ETK padconf implementation Kevin Hilman
     [not found]                             ` <1250182359-18830-9-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 16:52                               ` [PATCH 09/10] OMAP3: Add debug observablity (debobs) Kconfig item Kevin Hilman
     [not found]                                 ` <1250182359-18830-10-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 16:52                                   ` [PATCH 10/10] OMAP: PM: Added suspend target state control to debugfs for OMAP3 Kevin Hilman
     [not found]                                     ` <1250182359-18830-11-git-send-email-khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 18:42                                       ` Aguirre Rodriguez, Sergio Alberto
     [not found]                                         ` <A24693684029E5489D1D202277BE89444A78398A-EovWT4A8QTWIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-08-13 21:35                                           ` Kevin Hilman
2009-08-17  8:10                                       ` Tony Lindgren
2009-08-18 12:43                                         ` Kevin Hilman
2009-08-17  8:08                                   ` [PATCH 09/10] OMAP3: Add debug observablity (debobs) Kconfig item Tony Lindgren
2009-08-17  8:07                               ` [PATCH 08/10] OMAP3: Debug observability and ETK padconf implementation Tony Lindgren
2009-08-15  5:10                           ` [PATCH 07/10] OMAP: PM: Add definitions for ETK pads and observability registers Gadiyar, Anand
2009-08-18 12:12                             ` Kevin Hilman
2009-08-17  8:03                       ` [PATCH 06/10] OMAP: PM debug: Add PRCM register dump support Tony Lindgren
2009-08-13 18:39                     ` Aguirre Rodriguez, Sergio Alberto
     [not found]                       ` <A24693684029E5489D1D202277BE89444A78397F-EovWT4A8QTWIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2009-08-13 21:34                         ` Kevin Hilman
     [not found]                           ` <87eirfe6uo.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2009-08-13 22:28                             ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox