summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Behme <dirk.behme@googlemail.com>2009-02-12 18:55:41 +0100
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2009-02-22 18:29:10 +0100
commitf956fd0338f4990793a10f767929ba4963665261 (patch)
tree44f670831d2fde5ea6104dbbd283390b825ce8bf
parent288f3cd912918b97919d13b6f7fb13fbddf74d68 (diff)
downloadu-boot-imx-f956fd0338f4990793a10f767929ba4963665261.zip
u-boot-imx-f956fd0338f4990793a10f767929ba4963665261.tar.gz
u-boot-imx-f956fd0338f4990793a10f767929ba4963665261.tar.bz2
OMAP3: Beagle: Add board revision detection
With BeagleBoard revision C some HW changes are introduced (e.g. PinMUX) which might need different software handling. For this, GPIO pin 171 (GPIO module 6, offset 11) can be used to check for board revision. If this pin is low, we have a rev C board. Else it must be a revision Ax or Bx board. To handle board differences you can call function beagle_get_revision(). E.g.: if (beagle_get_revision()) { /* do special revision C stuff here */ } Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
-rw-r--r--board/omap3/beagle/beagle.c41
-rw-r--r--board/omap3/beagle/beagle.h2
-rw-r--r--include/asm-arm/arch-omap3/omap3.h3
3 files changed, 45 insertions, 1 deletions
diff --git a/board/omap3/beagle/beagle.c b/board/omap3/beagle/beagle.c
index ecdea09..7377058 100644
--- a/board/omap3/beagle/beagle.c
+++ b/board/omap3/beagle/beagle.c
@@ -36,6 +36,8 @@
#include <asm/mach-types.h>
#include "beagle.h"
+static int beagle_revision_c;
+
/******************************************************************************
* Routine: board_init
* Description: Early hardware init.
@@ -54,6 +56,43 @@ int board_init(void)
}
/******************************************************************************
+ * Routine: beagle_get_revision
+ * Description: Return 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;
+}
+
+/******************************************************************************
+ * 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.
+ *****************************************************************************/
+void beagle_identify(void)
+{
+ gpio_t *gpio6_base = (gpio_t *)OMAP34XX_GPIO6_BASE;
+
+ /* Configure GPIO 171 as input */
+ writel(readl(&gpio6_base->oe) | GPIO11, &gpio6_base->oe);
+
+ /* Get value of GPIO 171 */
+ beagle_revision_c = readl(&gpio6_base->datain) & BOARD_REVISION_MASK;
+
+ printf("Board revision ");
+ if (beagle_revision_c) {
+ printf("Ax/Bx\n");
+ beagle_revision_c = 0;
+ } else {
+ printf("C\n");
+ beagle_revision_c = 1;
+ }
+}
+
+/******************************************************************************
* Routine: misc_init_r
* Description: Configure board specific parts
*****************************************************************************/
@@ -75,6 +114,8 @@ int misc_init_r(void)
writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);
+ beagle_identify();
+
return 0;
}
diff --git a/board/omap3/beagle/beagle.h b/board/omap3/beagle/beagle.h
index 6511ffa..3f2a4dc 100644
--- a/board/omap3/beagle/beagle.h
+++ b/board/omap3/beagle/beagle.h
@@ -36,6 +36,8 @@ const omap3_sysinfo sysinfo = {
#endif
};
+#define BOARD_REVISION_MASK (0x1 << 11)
+
/*
* IEN - Input Enable
* IDIS - Input Disable
diff --git a/include/asm-arm/arch-omap3/omap3.h b/include/asm-arm/arch-omap3/omap3.h
index 7473656..0ddbd66 100644
--- a/include/asm-arm/arch-omap3/omap3.h
+++ b/include/asm-arm/arch-omap3/omap3.h
@@ -97,7 +97,8 @@ typedef struct s32ktimer {
typedef struct gpio {
unsigned char res1[0x34];
unsigned int oe; /* 0x34 */
- unsigned char res2[0x58];
+ unsigned int datain; /* 0x38 */
+ unsigned char res2[0x54];
unsigned int cleardataout; /* 0x90 */
unsigned int setdataout; /* 0x94 */
} gpio_t;