diff options
author | Wolfgang Denk <wd@denx.de> | 2009-02-22 22:51:32 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-02-22 22:51:32 +0100 |
commit | cea221116aa305dbf43625513a1210b89116262b (patch) | |
tree | f9dbc5ccf72b7003104e6b61e09a82153cbb69aa /board/omap3/beagle/beagle.c | |
parent | 68a41f2e98b6866d679698cf2b5e81b3627a2d75 (diff) | |
parent | 9d34d0a0c12266d80e7b3ab3cbdafc3d81a01832 (diff) | |
download | u-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.c | 41 |
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; } |