r4103 - branches/src/target/kernel/2.6.24.x/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Sun Feb 24 06:48:09 CET 2008


Author: werner
Date: 2008-02-24 06:48:05 +0100 (Sun, 24 Feb 2008)
New Revision: 4103

Added:
   branches/src/target/kernel/2.6.24.x/patches/dump-gpio.patch
Modified:
   branches/src/target/kernel/2.6.24.x/patches/series
Log:
debug-suspend-dump-gpio-states.patch

From: Andy Green <andy at openmoko.com>

We don't actually have much idea what our GPIO states are in suspend.

This patch dumps them right just before we actually suspend the CPU
after the drivers have all made any changes they have in mind for
lower power operation.

Signed-off-by: Andy Green <andy at openmoko.com>

---

 arch/arm/plat-s3c24xx/gpio.c |  352 ++++++++++++++++++++++++++++++++++++++++++
 kernel/power/main.c          |    7 +
 2 files changed, 359 insertions(+), 0 deletions(-)



Added: branches/src/target/kernel/2.6.24.x/patches/dump-gpio.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/dump-gpio.patch	2008-02-22 12:01:09 UTC (rev 4102)
+++ branches/src/target/kernel/2.6.24.x/patches/dump-gpio.patch	2008-02-24 05:48:05 UTC (rev 4103)
@@ -0,0 +1,392 @@
+Index: linux-2.6.24/arch/arm/plat-s3c24xx/gpio.c
+===================================================================
+--- linux-2.6.24.orig/arch/arm/plat-s3c24xx/gpio.c
++++ linux-2.6.24/arch/arm/plat-s3c24xx/gpio.c
+@@ -32,6 +32,8 @@
+ #include <asm/io.h>
+ 
+ #include <asm/arch/regs-gpio.h>
++/* dirty? */
++#include <asm/arch/regs-gpioj.h>
+ 
+ void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function)
+ {
+@@ -186,3 +188,353 @@ int s3c2410_gpio_getirq(unsigned int pin
+ }
+ 
+ EXPORT_SYMBOL(s3c2410_gpio_getirq);
++
++static void pretty_dump(u32 cfg, u32 state, u32 pull,
++			const char ** function_names_2,
++			const char ** function_names_3,
++			const char * prefix,
++			int count)
++{
++	int n;
++	const char *tag_type = NULL,
++		   *tag_state = NULL,
++		   *tag_pulldown = NULL,
++		   * level0 = "0",
++		   * level1 = "1";
++
++	for (n = 0; n < count; n++) {
++		switch ((cfg >> (2 * n)) & 3) {
++		case 0:
++			tag_type = "input      ";
++			break;
++		case 1:
++			tag_type = "OUTPUT     ";
++			break;
++		case 2:
++			if (function_names_2) {
++				if (function_names_2[n])
++					tag_type = function_names_2[n];
++				else
++					tag_type = "*** ILLEGAL CFG (2) *** ";
++			} else
++				tag_type = "(function) ";
++			break;
++		default:
++			if (function_names_3) {
++				if (function_names_3[n])
++					tag_type = function_names_3[n];
++				else
++					tag_type = "*** ILLEGAL CFG (3) *** ";
++			} else
++				tag_type = "(function) ";
++			break;
++		}
++		if ((state >> n) & 1)
++			tag_state = level1;
++		else
++			tag_state = level0;
++
++		if (((pull >> n) & 1))
++			tag_pulldown = "";
++		else
++			tag_pulldown = "(pulldown)";
++
++		printk(KERN_INFO"%s%02d: %s %s %s\n", prefix, n, tag_type,
++						      tag_state, tag_pulldown);
++	}
++	printk(KERN_INFO"\n");
++}
++
++static const char * funcs_b2[] = {
++	"TOUT0      ",
++	"TOUT1      ",
++	"TOUT2      ",
++	"TOUT3      ",
++	"TCLK[0]    ",
++	"nXBACK     ",
++	"nXBREQ     ",
++	"nXDACK1    ",
++	"nXDREQ1    ",
++	"nXDACK0    ",
++	"nXDREQ0    ",
++};
++static const char * funcs_b3[] = {
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++};
++
++static const char * funcs_c2[] = {
++	"LEND       ",
++	"VCLK       ",
++	"VLINE      ",
++	"VFRAME     ",
++	"VM         ",
++	"LCD_LPCOE  ",
++	"LCD_LPCREV ",
++	"LCD_LPCREVB",
++	"VD[0]      ",
++	"VD[1]      ",
++	"VD[2]      ",
++	"VD[3]      ",
++	"VD[4]      ",
++	"VD[5]      ",
++	"VD[6]      ",
++	"VD[7]      ",
++};
++static const char * funcs_c3[] = {
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	"I2SSDI     ",
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++};
++
++static const char * funcs_d2[] = {
++	"VD[8]      ",
++	"VD[9]      ",
++	"VD[10]     ",
++	"VD[11]     ",
++	"VD[12]     ",
++	"VD[13]     ",
++	"VD[14]     ",
++	"VD[15]     ",
++	"VD[16]     ",
++	"VD[17]     ",
++	"VD[18]     ",
++	"VD[19]     ",
++	"VD[20]     ",
++	"VD[21]     ",
++	"VD[22]     ",
++	"VD[23]     ",
++};
++static const char * funcs_d3[] = {
++	"nSPICS1    ",
++	"SPICLK1    ",
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	"SPIMISO1   ",
++	"SPIMOSI1   ",
++	"SPICLK1    ",
++	NULL,
++	NULL,
++	NULL,
++	"nSS1       ",
++	"nSS0       ",
++};
++
++static const char * funcs_e2[] = {
++	"I2SLRCK    ",
++	"I2SSCLK    ",
++	"CDCLK      ",
++	"I2SDI      ",
++	"I2SDO      ",
++	"SDCLK      ",
++	"SDCMD      ",
++	"SDDAT0     ",
++	"SDDAT1     ",
++	"SDDAT2     ",
++	"SDDAT3     ",
++	"SPIMISO0   ",
++	"SPIMOSI0   ",
++	"SPICLK0    ",
++	"IICSCL     ",
++	"IICSDA     ",
++};
++static const char * funcs_e3[] = {
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++};
++
++static const char * funcs_f2[] = {
++	"EINT[0]    ",
++	"EINT[1]    ",
++	"EINT[2]    ",
++	"EINT[3]    ",
++	"EINT[4]    ",
++	"EINT[5]    ",
++	"EINT[6]    ",
++	"EINT[7]    ",
++};
++static const char * funcs_f3[] = {
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++};
++
++
++static const char * funcs_g2[] = {
++	"EINT[8]    ",
++	"EINT[9]    ",
++	"EINT[10]   ",
++	"EINT[11]   ",
++	"EINT[12]   ",
++	"EINT[13]   ",
++	"EINT[14]   ",
++	"EINT[15]   ",
++	"EINT[16]   ",
++	"EINT[17]   ",
++	"EINT[18]   ",
++	"EINT[19]   ",
++	"EINT[20]   ",
++	"EINT[21]   ",
++	"EINT[22]   ",
++	"EINT[23]   ",
++};
++static const char * funcs_g3[] = {
++	NULL,
++	NULL,
++	"nSS0       ",
++	"nSS1       ",
++	"LCD_PWRDN  ",
++	"SPIMISO1   ",
++	"SPIMOSI1   ",
++	"SPICLK1    ",
++	NULL,
++	"nRTS1      ",
++	"nCTS1      ",
++	"TCLK[1]    ",
++	"nSPICS0    ",
++	NULL,
++	NULL,
++	NULL,
++};
++
++static const char * funcs_h2[] = {
++	"nCTS0      ",
++	"nRTS0      ",
++	"TXD[0]     ",
++	"RXD[0]     ",
++	"TXD[1]     ",
++	"RXD[1]     ",
++	"TXD[2]     ",
++	"RXD[2]     ",
++	"UEXTCLK    ",
++	"CLKOUT0    ",
++	"CLKOUT1    ",
++};
++static const char * funcs_h3[] = {
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	"nRTS1      ",
++	"nCTS1      ",
++	NULL,
++	"nSPICS0    ",
++	NULL,
++};
++
++static const char * funcs_j2[] = {
++	"CAMDATA[0] ",
++	"CAMDATA[1] ",
++	"CAMDATA[2] ",
++	"CAMDATA[3] ",
++	"CAMDATA[4] ",
++	"CAMDATA[5] ",
++	"CAMDATA[6] ",
++	"CAMDATA[7] ",
++	"CAMPCLK    ",
++	"CAMVSYNC   ",
++	"CAMHREF    ",
++	"CAMCLKOUT  ",
++	"CAMRESET   ",
++};
++static const char * funcs_j3[] = {
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++	NULL,
++};
++
++/* used to dump GPIO states at suspend */
++void s3c24xx_dump_gpio_states(void)
++{
++	pretty_dump(__raw_readl(S3C2410_GPBCON),
++		    __raw_readl(S3C2410_GPBDAT),
++		    __raw_readl(S3C2410_GPBUP),
++		    funcs_b2, funcs_b3, "GPB", 11);
++	pretty_dump(__raw_readl(S3C2410_GPCCON),
++		    __raw_readl(S3C2410_GPCDAT),
++		    __raw_readl(S3C2410_GPCUP),
++		    funcs_c2, funcs_c3, "GPC", 16);
++	pretty_dump(__raw_readl(S3C2410_GPDCON),
++		    __raw_readl(S3C2410_GPDDAT),
++		    __raw_readl(S3C2410_GPDUP),
++		    funcs_d2, funcs_d3, "GPD", 16);
++	pretty_dump(__raw_readl(S3C2410_GPECON),
++		    __raw_readl(S3C2410_GPEDAT),
++		    __raw_readl(S3C2410_GPEUP),
++		    funcs_e2, funcs_e3, "GPE", 16);
++	pretty_dump(__raw_readl(S3C2410_GPFCON),
++		    __raw_readl(S3C2410_GPFDAT),
++		    __raw_readl(S3C2410_GPFUP),
++		    funcs_f2, funcs_f3, "GPF", 8);
++	pretty_dump(__raw_readl(S3C2410_GPGCON),
++		    __raw_readl(S3C2410_GPGDAT),
++		    __raw_readl(S3C2410_GPGUP),
++		    funcs_g2, funcs_g3, "GPG", 16);
++	pretty_dump(__raw_readl(S3C2410_GPHCON),
++		    __raw_readl(S3C2410_GPHDAT),
++		    __raw_readl(S3C2410_GPHUP),
++		    funcs_h2, funcs_h3, "GPH", 11);
++	pretty_dump(__raw_readl(S3C2440_GPJCON),
++		    __raw_readl(S3C2440_GPJDAT),
++		    __raw_readl(S3C2440_GPJUP),
++		    funcs_j2, funcs_j3, "GPJ", 13);
++
++}
++EXPORT_SYMBOL(s3c24xx_dump_gpio_states);
+Index: linux-2.6.24/kernel/power/main.c
+===================================================================
+--- linux-2.6.24.orig/kernel/power/main.c
++++ linux-2.6.24/kernel/power/main.c
+@@ -152,6 +152,9 @@ static int suspend_enter(suspend_state_t
+ int suspend_devices_and_enter(suspend_state_t state)
+ {
+ 	int error;
++	/* dirty but just for debug */
++	void s3c24xx_dump_gpio_states(void);
++
+ 
+ 	if (!suspend_ops)
+ 		return -ENOSYS;
+@@ -172,6 +175,10 @@ int suspend_devices_and_enter(suspend_st
+ 		if (error)
+ 			goto Resume_devices;
+ 	}
++
++	/* dirty but just for debug */
++	s3c24xx_dump_gpio_states();
++
+ 	error = disable_nonboot_cpus();
+ 	if (!error)
+ 		suspend_enter(state);

Modified: branches/src/target/kernel/2.6.24.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/series	2008-02-22 12:01:09 UTC (rev 4102)
+++ branches/src/target/kernel/2.6.24.x/patches/series	2008-02-24 05:48:05 UTC (rev 4103)
@@ -102,6 +102,9 @@
 # temporary work-around. awaiting decision on correct fix from upstream.
 gta01-dehang-printk.patch
 
+# debugging support
+#dump-gpio.patch
+
 # leapfrogged from upstream
 kexec-atags.patch
 





More information about the commitlog mailing list