summaryrefslogtreecommitdiff
path: root/board/omap3/beagle/beagle.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-02-22 22:51:32 +0100
committerWolfgang Denk <wd@denx.de>2009-02-22 22:51:32 +0100
commitcea221116aa305dbf43625513a1210b89116262b (patch)
treef9dbc5ccf72b7003104e6b61e09a82153cbb69aa /board/omap3/beagle/beagle.c
parent68a41f2e98b6866d679698cf2b5e81b3627a2d75 (diff)
parent9d34d0a0c12266d80e7b3ab3cbdafc3d81a01832 (diff)
downloadu-boot-imx-cea221116aa305dbf43625513a1210b89116262b.zip
u-boot-imx-cea221116aa305dbf43625513a1210b89116262b.tar.gz
u-boot-imx-cea221116aa305dbf43625513a1210b89116262b.tar.bz2
Merge branch 'master' of /home/wd/git/u-boot/custodians
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;
}