summaryrefslogtreecommitdiff
path: root/board/omap3/beagle/beagle.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-02-22 22:51:25 +0100
committerWolfgang Denk <wd@denx.de>2009-02-22 22:51:25 +0100
commit9d34d0a0c12266d80e7b3ab3cbdafc3d81a01832 (patch)
treee96e91ec782fb30e5eede0de6bcf57716496c6b6 /board/omap3/beagle/beagle.c
parent0b741df241aa5eba6c9e21b4cfcaa3fe5f57753d (diff)
parentaba45c85b22f8c57fc2fedba8e948e06c2e2f5b3 (diff)
downloadu-boot-imx-9d34d0a0c12266d80e7b3ab3cbdafc3d81a01832.zip
u-boot-imx-9d34d0a0c12266d80e7b3ab3cbdafc3d81a01832.tar.gz
u-boot-imx-9d34d0a0c12266d80e7b3ab3cbdafc3d81a01832.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-arm
Diffstat (limited to 'board/omap3/beagle/beagle.c')
-rw-r--r--board/omap3/beagle/beagle.c41
1 files changed, 41 insertions, 0 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;
}