1 From b8d251412bc4c420f33920c2d9492076fc7b9624 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Sun, 13 Apr 2008 07:25:52 +0100
4 Subject: [PATCH] add-gta02-pcb-revision-detect.patch
8 int gta02_get_pcb_revision(void)
10 which returns state of GTA02 PCB revision pins. It is also called
11 and logged during boot with KERN_INFO. The results look like:
14 GPD4 GPD3 GPD0 GPC15 GPC13
16 GTA02 A5 and before: 0x000
19 Signed-off-by: Andy Green <andy@openmoko.com>
21 arch/arm/mach-s3c2440/mach-gta02.c | 55 +++++++++++++++++++++++++++++++++-
22 include/asm-arm/arch-s3c2410/gta02.h | 9 +++++
23 2 files changed, 63 insertions(+), 1 deletions(-)
25 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
26 index 99206ee..a2a63fe 100644
27 --- a/arch/arm/mach-s3c2440/mach-gta02.c
28 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
29 @@ -320,6 +320,59 @@ FIQ_HANDLER_ENTRY(256, 512)
34 + * returns PCB revision information in b9,b8 and b2,b1,b0
35 + * Pre-GTA02 A6 returns 0x000
36 + * GTA02 A6 returns 0x101
40 +int gta02_get_pcb_revision(void)
44 + static unsigned long pinlist[] = {
51 + static int pin_offset[] = {
55 + for (n = 0 ; n < ARRAY_SIZE(pinlist); n++) {
57 + * set the PCB version GPIO to be pulled-down input
58 + * force low briefly first
60 + s3c2410_gpio_cfgpin(pinlist[n], S3C2410_GPIO_OUTPUT);
61 + s3c2410_gpio_setpin(pinlist[n], 0);
62 + /* misnomer: it is a pullDOWN in 2442 */
63 + s3c2410_gpio_pullup(pinlist[n], 1);
64 + s3c2410_gpio_cfgpin(pinlist[n], S3C2410_GPIO_INPUT);
68 + if (s3c2410_gpio_getpin(pinlist[n]))
69 + u |= 1 << pin_offset[n];
72 + * when not being interrogated, all of the revision GPIO
73 + * are set to output HIGH without pulldown so no current flows
74 + * if they are NC or pulled up.
76 + s3c2410_gpio_setpin(pinlist[n], 1);
77 + s3c2410_gpio_cfgpin(pinlist[n], S3C2410_GPIO_OUTPUT);
78 + /* misnomer: it is a pullDOWN in 2442 */
79 + s3c2410_gpio_pullup(pinlist[n], 0);
86 static struct map_desc gta02_iodesc[] __initdata = {
88 .virtual = 0xe0000000,
89 @@ -911,7 +964,7 @@ void gat02_lis302dl_suspend_io(struct lis302dl_info *lis, int resume)
90 s3c2410_gpio_pullup(pdata->pin_miso, 0);
93 -const struct lis302dl_platform_data lis302_pdata[] = {
94 +struct lis302dl_platform_data lis302_pdata[] = {
96 .name = "lis302-1 (top)",
97 .pin_chip_select= S3C2410_GPD12,
98 diff --git a/include/asm-arm/arch-s3c2410/gta02.h b/include/asm-arm/arch-s3c2410/gta02.h
99 index f686a7a..791ea4f 100644
100 --- a/include/asm-arm/arch-s3c2410/gta02.h
101 +++ b/include/asm-arm/arch-s3c2410/gta02.h
103 #define GTA02v3_IRQ_nUSB_FLT IRQ_EINT18 /* v3 + v4 only */
104 #define GTA02v3_IRQ_nGSM_OC IRQ_EINT19 /* v3 + v4 only */
106 +/* returns 00 000 on GTA02 A5 and earlier, A6 returns 01 001 */
107 +#define GTA02_PCB_ID1_0 S3C2410_GPC13
108 +#define GTA02_PCB_ID1_1 S3C2410_GPC15
109 +#define GTA02_PCB_ID1_2 S3C2410_GPD0
110 +#define GTA02_PCB_ID2_0 S3C2410_GPD3
111 +#define GTA02_PCB_ID2_1 S3C2410_GPD4
113 +int gta02_get_pcb_revision(void);
115 #endif /* _GTA02_H */