1
From 252cc1714077fd11d193669870f309843e7522b6 Mon Sep 17 00:00:00 2001
2
From: Robert Nelson <robertcnelson@gmail.com>
3
Date: Wed, 11 Aug 2010 11:41:23 -0500
4
Subject: [PATCH v2 1/3] ARM: OMAP: Beagle: Revision detection
6
Use the gpio 171,172,173 to determine Beagle Revision.
7
B5/B6 Beagle's use the same ES3.0 Silicon as the C1/2/3 Beagle.
9
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
11
arch/arm/mach-omap2/board-omap3beagle.c | 59 +++++++++++++++++++++++++++++++
12
arch/arm/plat-omap/include/plat/board.h | 23 ++++++++++++
13
2 files changed, 82 insertions(+), 0 deletions(-)
15
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
16
index 87969c7..891d8a8 100644
17
--- a/arch/arm/mach-omap2/board-omap3beagle.c
18
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
21
#define NAND_BLOCK_SIZE SZ_128K
23
+static u8 omap3_beagle_version;
25
+u8 get_omap3_beagle_rev(void)
27
+ return omap3_beagle_version;
29
+EXPORT_SYMBOL(get_omap3_beagle_rev);
31
+static void __init omap3_beagle_get_revision(void)
36
+ ret = gpio_request(171, "rev_id_0");
40
+ ret = gpio_request(172, "rev_id_1");
44
+ ret = gpio_request(173, "rev_id_2");
48
+ gpio_direction_input(171);
49
+ gpio_direction_input(172);
50
+ gpio_direction_input(173);
52
+ beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) | (gpio_get_value(173) << 2);
54
+ switch (beagle_rev) {
56
+ printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
57
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
60
+ printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
61
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
64
+ printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
65
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
68
+ printk(KERN_INFO "OMAP3 Beagle Rev: xM\n");
69
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
72
+ printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
73
+ omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
78
+ printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
81
static struct mtd_partition omap3beagle_nand_partitions[] = {
82
/* All the partition sizes are listed in terms of NAND block size */
84
@@ -464,6 +522,7 @@ static struct omap_musb_board_data musb_board_data = {
85
static void __init omap3_beagle_init(void)
87
omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
88
+ omap3_beagle_get_revision();
89
omap3_beagle_i2c_init();
90
platform_add_devices(omap3_beagle_devices,
91
ARRAY_SIZE(omap3_beagle_devices));
92
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h
93
index 3cf4fa2..e55a920 100644
94
--- a/arch/arm/plat-omap/include/plat/board.h
95
+++ b/arch/arm/plat-omap/include/plat/board.h
96
@@ -26,6 +26,22 @@ enum {
97
OMAP3EVM_BOARD_GEN_2, /* EVM Rev >= Rev E */
101
+ * OMAP3 Beagle revision
102
+ * Run time detection of Beagle revision is done by reading GPIO.
104
+ * AXBX = GPIO173, GPIO172, GPIO171: 1 1 1
105
+ * C1_3 = GPIO173, GPIO172, GPIO171: 1 1 0
106
+ * C4 = GPIO173, GPIO172, GPIO171: 1 0 1
107
+ * XM = GPIO173, GPIO172, GPIO171: 0 0 0
110
+ OMAP3BEAGLE_BOARD_AXBX = 0,
111
+ OMAP3BEAGLE_BOARD_C1_3,
112
+ OMAP3BEAGLE_BOARD_C4,
113
+ OMAP3BEAGLE_BOARD_XM,
116
/* Different peripheral ids */
117
#define OMAP_TAG_CLOCK 0x4f01
118
#define OMAP_TAG_LCD 0x4f05
119
@@ -173,4 +189,11 @@ u8 get_omap3_evm_rev(void);
121
#define get_omap3_evm_rev() (-EINVAL)
124
+/* Beagle revision */
125
+#if defined(CONFIG_MACH_OMAP3_BEAGLE)
126
+u8 get_omap3_beagle_rev(void);
128
+#define get_omap3_beagle_rev() (-EINVAL)