diff options
author | Andy Green <andy@openmoko.com> | 2008-11-19 17:09:32 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-19 17:09:32 +0000 |
commit | 1b608a5f6d7cc60c64f654d27b8557a8a69997c9 (patch) | |
tree | 18350821bc60388ed9635d9ae5b7d34b842aad64 /arch/arm/plat-s3c24xx | |
parent | 24afca6cf30a4f6e5c95e673bf10f78d16a27a73 (diff) |
debug-suspend-dump-gpio-states-add-GPA.patch
Add support for GPA[] GPIO bus since we have some NCs
but they seem to output-only IO cells so no matter
Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'arch/arm/plat-s3c24xx')
-rw-r--r-- | arch/arm/plat-s3c24xx/gpio.c | 423 |
1 files changed, 422 insertions, 1 deletions
diff --git a/arch/arm/plat-s3c24xx/gpio.c b/arch/arm/plat-s3c24xx/gpio.c index 4a899c279eb..82e71d8c5b6 100644 --- a/arch/arm/plat-s3c24xx/gpio.c +++ b/arch/arm/plat-s3c24xx/gpio.c @@ -31,7 +31,8 @@ #include <mach/hardware.h> #include <asm/irq.h> -#include <mach/regs-gpio.h> +#include <asm/arch/regs-gpio.h> +#include <asm/arch/regs-gpioj.h> void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function) { @@ -215,3 +216,423 @@ int s3c2410_gpio_irq2pin(unsigned int irq) } EXPORT_SYMBOL(s3c2410_gpio_irq2pin); + +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 void pretty_dump_a(u32 cfg, u32 state, + const char ** function_names, + const char * prefix, + int count) +{ + int n; + const char *tag_type = NULL, + *tag_state = NULL, + * level0 = "0", + * level1 = "1"; + + for (n = 0; n < count; n++) { + switch ((cfg >> n) & 1) { + case 0: + tag_type = "OUTPUT "; + break; + default: + if (function_names) { + if (function_names[n]) + tag_type = function_names[n]; + else + tag_type = "*** ILLEGAL CFG *** "; + } else + tag_type = "(function) "; + break; + } + if ((state >> n) & 1) + tag_state = level1; + else + tag_state = level0; + + printk(KERN_INFO"%s%02d: %s %s\n", prefix, n, tag_type, + tag_state); + } + printk(KERN_INFO"\n"); +} + +static const char * funcs_a[] = { + "ADDR0 ", + "ADDR16 ", + "ADDR17 ", + "ADDR18 ", + "ADDR19 ", + "ADDR20 ", + "ADDR21 ", + "ADDR22 ", + "ADDR23 ", + "ADDR24 ", + "ADDR25 ", + "ADDR26 ", + "nGCS[1] ", + "nGCS[2] ", + "nGCS[3] ", + "nGCS[4] ", + "nGCS[5] ", + "CLE ", + "ALE ", + "nFWE ", + "nFRE ", + "nRSTOUT ", + "nFCE ", + NULL, + NULL +}; + + +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_a(__raw_readl(S3C2410_GPACON), + __raw_readl(S3C2410_GPADAT), + funcs_a, "GPA", 25); + 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); + |