[brcm63xx] resync kernel configuration
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1103-add-gta02-pcb-revision-detect.patch.patch
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
5
6 Add function
7
8 int gta02_get_pcb_revision(void)
9
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:
12
13 b9 b8 b2 b1 b0
14 GPD4 GPD3 GPD0 GPC15 GPC13
15
16 GTA02 A5 and before: 0x000
17 GTA02 A6 : 0x001
18
19 Signed-off-by: Andy Green <andy@openmoko.com>
20 ---
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(-)
24
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)
30 FIQ_HANDLER_END()
31
32
33 +/**
34 + * returns PCB revision information in b9,b8 and b2,b1,b0
35 + * Pre-GTA02 A6 returns 0x000
36 + * GTA02 A6 returns 0x101
37 + * ...
38 + */
39 +
40 +int gta02_get_pcb_revision(void)
41 +{
42 + int n;
43 + int u = 0;
44 + static unsigned long pinlist[] = {
45 + GTA02_PCB_ID1_0,
46 + GTA02_PCB_ID1_1,
47 + GTA02_PCB_ID1_2,
48 + GTA02_PCB_ID2_0,
49 + GTA02_PCB_ID2_1,
50 + };
51 + static int pin_offset[] = {
52 + 0, 1, 2, 8, 9
53 + };
54 +
55 + for (n = 0 ; n < ARRAY_SIZE(pinlist); n++) {
56 + /*
57 + * set the PCB version GPIO to be pulled-down input
58 + * force low briefly first
59 + */
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);
65 +
66 + udelay(10);
67 +
68 + if (s3c2410_gpio_getpin(pinlist[n]))
69 + u |= 1 << pin_offset[n];
70 +
71 + /*
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.
75 + */
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);
80 + }
81 +
82 + return u;
83 +}
84 +
85 +
86 static struct map_desc gta02_iodesc[] __initdata = {
87 {
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);
91 }
92
93 -const struct lis302dl_platform_data lis302_pdata[] = {
94 +struct lis302dl_platform_data lis302_pdata[] = {
95 {
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
102 @@ -97,4 +97,13 @@
103 #define GTA02v3_IRQ_nUSB_FLT IRQ_EINT18 /* v3 + v4 only */
104 #define GTA02v3_IRQ_nGSM_OC IRQ_EINT19 /* v3 + v4 only */
105
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
112 +
113 +int gta02_get_pcb_revision(void);
114 +
115 #endif /* _GTA02_H */
116 --
117 1.5.6.5
118
This page took 0.054109 seconds and 5 git commands to generate.