aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/u-boot/u-boot-git/beagleboard/revision-detection.patch
blob: c2a41bfcc77396b4c2fa49f910e0b6cfe67d9f5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
Delivered-To: koen@beagleboard.org
Received: by 10.216.36.75 with SMTP id v53cs217947wea;
        Fri, 8 Jan 2010 07:38:03 -0800 (PST)
Received: by 10.141.214.24 with SMTP id r24mr6834000rvq.27.1262965082475;
        Fri, 08 Jan 2010 07:38:02 -0800 (PST)
Return-Path: <3UlFHSwYPCzYcZSkaeTWSYdWTgSjV.gjYTWSYdWTgSjVYggYdWYjgmhk.Uge@listserv.bounces.google.com>
Received: from mail-pw0-f72.google.com (mail-pw0-f72.google.com [209.85.160.72])
        by mx.google.com with ESMTP id 31si42836225pzk.96.2010.01.08.07.38.00;
        Fri, 08 Jan 2010 07:38:01 -0800 (PST)
Received-SPF: pass (google.com: domain of 3UlFHSwYPCzYcZSkaeTWSYdWTgSjV.gjYTWSYdWTgSjVYggYdWYjgmhk.Uge@listserv.bounces.google.com designates 209.85.160.72 as permitted sender) client-ip=209.85.160.72;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of 3UlFHSwYPCzYcZSkaeTWSYdWTgSjV.gjYTWSYdWTgSjVYggYdWYjgmhk.Uge@listserv.bounces.google.com designates 209.85.160.72 as permitted sender) smtp.mail=3UlFHSwYPCzYcZSkaeTWSYdWTgSjV.gjYTWSYdWTgSjVYggYdWYjgmhk.Uge@listserv.bounces.google.com; dkim=pass (test mode) header.i=@googlegroups.com
Received: by pwj4 with SMTP id 4sf2565182pwj.11
        for <multiple recipients>; Fri, 08 Jan 2010 07:38:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlegroups.com; s=beta;
        h=domainkey-signature:received:x-beenthere:received:received:received
         :received:received-spf:received:mime-version:received:date
         :message-id:subject:from:to:x-original-authentication-results
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:x-thread-url:x-message-url:sender
         :list-unsubscribe:list-subscribe:content-type;
        bh=XdDWC3Pjbe6mfVpRg0Nyb4elMKzFUcLRQ+7/Tb3fHMQ=;
        b=NiM6Z+/ubLFaxomCEKnZjYyFgB7ZbE4xWWwqF6i/H8BQiedPp1rBmQSdQ2EH4qDFgm
         D3DR5jXVjtOALhgh/9cxU/S46ltiM5rtGnwtcjgV+Gv9r5/sfqhze9c81t7bzIo+bpqn
         cg8yNHOFjwkPSWdSidIhKnZJGQRj/ZIgxJxCw=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=googlegroups.com; s=beta;
        h=x-beenthere:received-spf:mime-version:date:message-id:subject:from
         :to:x-original-authentication-results:x-original-sender:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :x-thread-url:x-message-url:sender:list-unsubscribe:list-subscribe
         :content-type;
        b=0jHA96QBedAxJl8vWrKHetbULCj+FIcyXTmI01rlbnfXOm8WuPhJDLyj7Qo34LiQXE
         dYkeQ2RNv3L03nbVuPezNfUKHuKLONUQKVvAfxRDset7eLpsYuKQZADZ+loSfkeVlwDW
         ai/7Z937On5tliSGUDPp+73oUNfje1ReYx+dc=
Received: by 10.115.87.31 with SMTP id p31mr3273178wal.7.1262965074762;
        Fri, 08 Jan 2010 07:37:54 -0800 (PST)
X-BeenThere: beagleboard@googlegroups.com
Received: by 10.115.116.23 with SMTP id t23ls485636wam.1.p; Fri, 08 Jan 2010 
	07:37:51 -0800 (PST)
Received: by 10.114.3.19 with SMTP id 19mr7028808wac.17.1262965071286;
        Fri, 08 Jan 2010 07:37:51 -0800 (PST)
Received: by 10.114.3.19 with SMTP id 19mr7028807wac.17.1262965071261;
        Fri, 08 Jan 2010 07:37:51 -0800 (PST)
Return-Path: <khasim@beagleboard.org>
Received: from mail-px0-f174.google.com (mail-px0-f174.google.com [209.85.216.174])
        by gmr-mx.google.com with ESMTP id 16si3405423pxi.11.2010.01.08.07.37.51;
        Fri, 08 Jan 2010 07:37:51 -0800 (PST)
Received-SPF: neutral (google.com: 209.85.216.174 is neither permitted nor denied by best guess record for domain of khasim@beagleboard.org) client-ip=209.85.216.174;
Received: by mail-px0-f174.google.com with SMTP id 4so2127527pxi.33
        for <beagleboard@googlegroups.com>; Fri, 08 Jan 2010 07:37:51 -0800 (PST)
MIME-Version: 1.0
Received: by 10.142.66.15 with SMTP id o15mr4287776wfa.145.1262965071051; Fri, 
	08 Jan 2010 07:37:51 -0800 (PST)
Date: Fri, 8 Jan 2010 21:07:50 +0530
Message-ID: <a8ca84ad1001080737r2312270ao80aa04ce60cc780@mail.gmail.com>
Subject: [beagleboard] TI:OMAP: [PATCH 1/4] OMAP3 Beagle Update revision 
	detection
From: Khasim Syed Mohammed <khasim@beagleboard.org>
To: u-boot@lists.denx.de, beagleboard@googlegroups.com
X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 
	209.85.216.174 is neither permitted nor denied by best guess record for 
	domain of khasim@beagleboard.org) smtp.mail=khasim@beagleboard.org
X-Original-Sender: khasim@beagleboard.org
Reply-To: beagleboard@googlegroups.com
Precedence: list
Mailing-list: list beagleboard@googlegroups.com; contact beagleboard+owners@googlegroups.com
List-ID: <beagleboard.googlegroups.com>
List-Post: <http://groups.google.com/group/beagleboard/post?hl=>, 
	<mailto:beagleboard@googlegroups.com>
List-Help: <http://groups.google.com/support/?hl=>, <mailto:beagleboard+help@googlegroups.com>
List-Archive: <http://groups.google.com/group/beagleboard?hl=>
X-Thread-Url: http://groups.google.com/group/beagleboard/t/1d4ac362a651981d
X-Message-Url: http://groups.google.com/group/beagleboard/msg/8a2d1aa3c9c40beb
Sender: beagleboard@googlegroups.com
List-Unsubscribe: <http://groups.google.com/group/beagleboard/subscribe?hl=>, 
	<mailto:beagleboard+unsubscribe@googlegroups.com>
List-Subscribe: <http://groups.google.com/group/beagleboard/subscribe?hl=>, 
	<mailto:beagleboard+subscribe@googlegroups.com>
Content-Type: multipart/mixed; boundary=0016e64cc3d4779e0f047ca8f8bb

--0016e64cc3d4779e0f047ca8f8bb
Content-Type: text/plain; charset=ISO-8859-1

From 15fbe5ff9ee2fd2f8da4c16805d6c7ccf7244bae Mon Sep 17 00:00:00 2001
From: Syed Mohammed Khasim <khasim@ti.com>
Date: Fri, 8 Jan 2010 20:13:47 +0530
Subject: [PATCH] OMAP3 Beagle Update revision detection

New BeagleBoard revision C4 uses a new ID. Update revision detection.

Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
Signed-off-by: Syed Mohammed Khasim <khasim@ti.com>
---
 board/ti/beagle/beagle.c |   65 ++++++++++++++++++++++++++++-----------------
 board/ti/beagle/beagle.h |    8 ++++-
 2 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 32d501e..0def5a6 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -38,7 +38,7 @@
 #include <asm/mach-types.h>
 #include "beagle.h"

-static int beagle_revision_c;
+static int beagle_revision;

 /*
  * Routine: board_init
@@ -60,41 +60,57 @@ int board_init(void)
 /*
  * Routine: beagle_get_revision
  * Description: Return the revision of the BeagleBoard this code is running on.
- *              If it is a revision Ax/Bx board, this function returns 0,
- *              on a revision C board you will get a 1.
  */
 int beagle_get_revision(void)
 {
-	return beagle_revision_c;
+	return beagle_revision;
 }

 /*
  * Routine: beagle_identify
- * Description: Detect if we are running on a Beagle revision Ax/Bx or
- *              Cx. This can be done by GPIO_171. If this is low, we are
- *              running on a revision C board.
+ * Description: Detect if we are running on a Beagle revision Ax/Bx,
+ *		C1/2/3, C4 or D. This can be done by reading
+ *		the level of GPIO173, GPIO172 and GPIO171. This should
+ *		result in
+ *		GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx
+ *		GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3
+ *		GPIO173, GPIO172, GPIO171: 1 0 1 => C4
+ *		GPIO173, GPIO172, GPIO171: 0 0 0 => D
  */
 void beagle_identify(void)
 {
-	beagle_revision_c = 0;
-	if (!omap_request_gpio(171)) {
-		unsigned int val;
-
-		omap_set_gpio_direction(171, 1);
-		val = omap_get_gpio_datain(171);
-		omap_free_gpio(171);
-
-		if (val)
-			beagle_revision_c = 0;
-		else
-			beagle_revision_c = 1;
-	}
+	omap_request_gpio(171);
+	omap_request_gpio(172);
+	omap_request_gpio(173);
+	omap_set_gpio_direction(171, 1);
+	omap_set_gpio_direction(172, 1);
+	omap_set_gpio_direction(173, 1);
+
+	beagle_revision = omap_get_gpio_datain(173) << 2 |
+			  omap_get_gpio_datain(172) << 1 |
+			  omap_get_gpio_datain(171);
+	omap_free_gpio(171);
+	omap_free_gpio(172);
+	omap_free_gpio(173);

 	printf("Board revision ");
-	if (beagle_revision_c)
-		printf("C\n");
-	else
+
+	switch (beagle_revision) {
+	case REVISION_AXBX:
 		printf("Ax/Bx\n");
+		break;
+	case REVISION_CX:
+		printf("C1/C2/C3\n");
+		break;
+	case REVISION_C4:
+		printf("C4\n");
+		break;
+	case REVISION_D:
+		printf("D\n");
+		break;
+	default:
+		printf("unknown 0x%02x\n", beagle_revision);
+	}
 }

 /*
@@ -137,7 +153,6 @@ void set_muxconf_regs(void)
 {
 	MUX_BEAGLE();

-	if (beagle_revision_c) {
+	if (beagle_revision != REVISION_AXBX)
 		MUX_BEAGLE_C();
-	}
 }
diff --git a/board/ti/beagle/beagle.h b/board/ti/beagle/beagle.h
index 7fe6275..b1720c9 100644
--- a/board/ti/beagle/beagle.h
+++ b/board/ti/beagle/beagle.h
@@ -33,7 +33,11 @@ const omap3_sysinfo sysinfo = {
 #endif
 };

-#define BOARD_REVISION_MASK	(0x1 << 11)
+/* BeagleBoard revisions */
+#define REVISION_AXBX 	0x7
+#define REVISION_CX 	0x6
+#define REVISION_C4 	0x5
+#define REVISION_D 	0x0

 /*
  * IEN  - Input Enable
@@ -264,7 +268,7 @@ const omap3_sysinfo sysinfo = {
 	MUX_VAL(CP(HDQ_SIO),		(IDIS | PTU | EN  | M4)) /*GPIO_170*/\
 	MUX_VAL(CP(MCSPI1_CLK),		(IEN  | PTU | EN  | M4)) /*GPIO_171*/\
 	MUX_VAL(CP(MCSPI1_SIMO),	(IEN  | PTU | EN  | M4)) /*GPIO_172*/\
-	MUX_VAL(CP(MCSPI1_SOMI),	(IEN  | PTD | DIS | M0)) /*McSPI1_SOMI*/\
+	MUX_VAL(CP(MCSPI1_SOMI),	(IEN  | PTU | EN  | M4)) /*GPIO_173*/\
 	MUX_VAL(CP(MCSPI1_CS0),		(IEN  | PTD | EN  | M0)) /*McSPI1_CS0*/\
 	MUX_VAL(CP(MCSPI1_CS1),		(IDIS | PTD | EN  | M0)) /*McSPI1_CS1*/\
 	MUX_VAL(CP(MCSPI1_CS2),		(IDIS | PTD | DIS | M4)) /*GPIO_176*/\
-- 
1.5.6.3

--0016e64cc3d4779e0f047ca8f8bb
Content-Type: text/plain; charset=ISO-8859-1

-- 
You received this message because you are subscribed to the Google Groups "Beagle Board" group.
To post to this group, send email to beagleboard@googlegroups.com.
To unsubscribe from this group, send email to beagleboard+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/beagleboard?hl=en.



--0016e64cc3d4779e0f047ca8f8bb--