diff options
Diffstat (limited to 'target/linux/s3c24xx/patches/0093-add-gta02-pcb-revision-detect.patch.patch')
-rwxr-xr-x | target/linux/s3c24xx/patches/0093-add-gta02-pcb-revision-detect.patch.patch | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/patches/0093-add-gta02-pcb-revision-detect.patch.patch b/target/linux/s3c24xx/patches/0093-add-gta02-pcb-revision-detect.patch.patch new file mode 100755 index 0000000000..8de4e52503 --- /dev/null +++ b/target/linux/s3c24xx/patches/0093-add-gta02-pcb-revision-detect.patch.patch @@ -0,0 +1,118 @@ +From fffb5d650929cf49a3e3f200bea1d5472de56794 Mon Sep 17 00:00:00 2001 +From: Andy Green <andy@openmoko.com> +Date: Fri, 25 Jul 2008 23:06:02 +0100 +Subject: [PATCH] add-gta02-pcb-revision-detect.patch + +Add function + +int gta02_get_pcb_revision(void) + +which returns state of GTA02 PCB revision pins. It is also called +and logged during boot with KERN_INFO. The results look like: + +b9 b8 b2 b1 b0 + GPD4 GPD3 GPD0 GPC15 GPC13 + + GTA02 A5 and before: 0x000 + GTA02 A6 : 0x001 + +Signed-off-by: Andy Green <andy@openmoko.com> +--- + arch/arm/mach-s3c2440/mach-gta02.c | 55 +++++++++++++++++++++++++++++++++- + include/asm-arm/arch-s3c2410/gta02.h | 9 +++++ + 2 files changed, 63 insertions(+), 1 deletions(-) + +diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c +index 99206ee..a2a63fe 100644 +--- a/arch/arm/mach-s3c2440/mach-gta02.c ++++ b/arch/arm/mach-s3c2440/mach-gta02.c +@@ -320,6 +320,59 @@ FIQ_HANDLER_ENTRY(256, 512) + FIQ_HANDLER_END() + + ++/** ++ * returns PCB revision information in b9,b8 and b2,b1,b0 ++ * Pre-GTA02 A6 returns 0x000 ++ * GTA02 A6 returns 0x101 ++ * ... ++ */ ++ ++int gta02_get_pcb_revision(void) ++{ ++ int n; ++ int u = 0; ++ static unsigned long pinlist[] = { ++ GTA02_PCB_ID1_0, ++ GTA02_PCB_ID1_1, ++ GTA02_PCB_ID1_2, ++ GTA02_PCB_ID2_0, ++ GTA02_PCB_ID2_1, ++ }; ++ static int pin_offset[] = { ++ 0, 1, 2, 8, 9 ++ }; ++ ++ for (n = 0 ; n < ARRAY_SIZE(pinlist); n++) { ++ /* ++ * set the PCB version GPIO to be pulled-down input ++ * force low briefly first ++ */ ++ s3c2410_gpio_cfgpin(pinlist[n], S3C2410_GPIO_OUTPUT); ++ s3c2410_gpio_setpin(pinlist[n], 0); ++ /* misnomer: it is a pullDOWN in 2442 */ ++ s3c2410_gpio_pullup(pinlist[n], 1); ++ s3c2410_gpio_cfgpin(pinlist[n], S3C2410_GPIO_INPUT); ++ ++ udelay(10); ++ ++ if (s3c2410_gpio_getpin(pinlist[n])) ++ u |= 1 << pin_offset[n]; ++ ++ /* ++ * when not being interrogated, all of the revision GPIO ++ * are set to output HIGH without pulldown so no current flows ++ * if they are NC or pulled up. ++ */ ++ s3c2410_gpio_setpin(pinlist[n], 1); ++ s3c2410_gpio_cfgpin(pinlist[n], S3C2410_GPIO_OUTPUT); ++ /* misnomer: it is a pullDOWN in 2442 */ ++ s3c2410_gpio_pullup(pinlist[n], 0); ++ } ++ ++ return u; ++} ++ ++ + static struct map_desc gta02_iodesc[] __initdata = { + { + .virtual = 0xe0000000, +@@ -911,7 +964,7 @@ void gat02_lis302dl_suspend_io(struct lis302dl_info *lis, int resume) + s3c2410_gpio_pullup(pdata->pin_miso, 0); + } + +-const struct lis302dl_platform_data lis302_pdata[] = { ++struct lis302dl_platform_data lis302_pdata[] = { + { + .name = "lis302-1 (top)", + .pin_chip_select= S3C2410_GPD12, +diff --git a/include/asm-arm/arch-s3c2410/gta02.h b/include/asm-arm/arch-s3c2410/gta02.h +index f686a7a..791ea4f 100644 +--- a/include/asm-arm/arch-s3c2410/gta02.h ++++ b/include/asm-arm/arch-s3c2410/gta02.h +@@ -97,4 +97,13 @@ + #define GTA02v3_IRQ_nUSB_FLT IRQ_EINT18 /* v3 + v4 only */ + #define GTA02v3_IRQ_nGSM_OC IRQ_EINT19 /* v3 + v4 only */ + ++/* returns 00 000 on GTA02 A5 and earlier, A6 returns 01 001 */ ++#define GTA02_PCB_ID1_0 S3C2410_GPC13 ++#define GTA02_PCB_ID1_1 S3C2410_GPC15 ++#define GTA02_PCB_ID1_2 S3C2410_GPD0 ++#define GTA02_PCB_ID2_0 S3C2410_GPD3 ++#define GTA02_PCB_ID2_1 S3C2410_GPD4 ++ ++int gta02_get_pcb_revision(void); ++ + #endif /* _GTA02_H */ +-- +1.5.6.3 + |