summaryrefslogtreecommitdiff
path: root/board/omap3/beagle/beagle.c
diff options
context:
space:
mode:
authorTom Rix <Tom.Rix@windriver.com>2009-06-03 01:53:57 -0500
committerWolfgang Denk <wd@denx.de>2009-06-12 20:45:47 +0200
commit718763c4745fd3d987a5576d2a67325e9444f9d4 (patch)
treebe7ec76057843d54fbe390b2ab083cb5820d40cf /board/omap3/beagle/beagle.c
parent7caa13fdd2d3dc957b4e0a228810a3a4a8ba499b (diff)
downloadu-boot-imx-718763c4745fd3d987a5576d2a67325e9444f9d4.zip
u-boot-imx-718763c4745fd3d987a5576d2a67325e9444f9d4.tar.gz
u-boot-imx-718763c4745fd3d987a5576d2a67325e9444f9d4.tar.bz2
Beagle Convert the board version detection to use the OMAP3 GPIO interface.
There is no new functionality in the change. This change is a conversion from the using raw register access to using the OMAP3 GPIO API described in doc/README.omap3. Signed-off-by: Tom Rix <Tom.Rix@windriver.com> Acked-by: Dirk Behme <dirk.behme@googlemail.com>
Diffstat (limited to 'board/omap3/beagle/beagle.c')
-rw-r--r--board/omap3/beagle/beagle.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/board/omap3/beagle/beagle.c b/board/omap3/beagle/beagle.c
index 7eb70ee..d268e18 100644
--- a/board/omap3/beagle/beagle.c
+++ b/board/omap3/beagle/beagle.c
@@ -33,6 +33,7 @@
#include <asm/io.h>
#include <asm/arch/mux.h>
#include <asm/arch/sys_proto.h>
+#include <asm/arch/gpio.h>
#include <asm/mach-types.h>
#include "beagle.h"
@@ -57,7 +58,7 @@ int board_init(void)
/*
* Routine: beagle_get_revision
- * Description: Return revision of the BeagleBoard this code is running on.
+ * 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.
*/
@@ -74,22 +75,25 @@ int beagle_get_revision(void)
*/
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;
+ 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;
+ }
printf("Board revision ");
- if (beagle_revision_c) {
- printf("Ax/Bx\n");
- beagle_revision_c = 0;
- } else {
+ if (beagle_revision_c)
printf("C\n");
- beagle_revision_c = 1;
- }
+ else
+ printf("Ax/Bx\n");
}
/*