diff options
author | Steve Sakoman <steve@sakoman.com> | 2010-08-12 15:13:02 -0700 |
---|---|---|
committer | Sandeep Paulraj <s-paulraj@ti.com> | 2010-09-08 14:50:38 -0400 |
commit | c2d5b341206f44c13f4de3c4bb80916d085dfdea (patch) | |
tree | 12c4d1fee8e289d65f940bea530b0aaa7daf1b44 /board/overo/overo.c | |
parent | 5af324603409908280b9afdc5686351c3ebbd4f4 (diff) | |
download | u-boot-imx-c2d5b341206f44c13f4de3c4bb80916d085dfdea.zip u-boot-imx-c2d5b341206f44c13f4de3c4bb80916d085dfdea.tar.gz u-boot-imx-c2d5b341206f44c13f4de3c4bb80916d085dfdea.tar.bz2 |
ARMV7: OMAP: Add board revision detection for Overo
The latest Overo COM modules encode their revision number on
GPIOs 115, 113, and 112. All boards to date have no pullups on these pins
and hence appear as revision 0.
This patch reads and prints the revision information.
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Diffstat (limited to 'board/overo/overo.c')
-rw-r--r-- | board/overo/overo.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/board/overo/overo.c b/board/overo/overo.c index e85be7d..1c7087b 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -61,6 +61,37 @@ int board_init(void) } /* + * Routine: get_board_revision + * Description: Returns the board revision + */ +int get_board_revision(void) +{ + int revision; + + if (!omap_request_gpio(112) && + !omap_request_gpio(113) && + !omap_request_gpio(115)) { + + omap_set_gpio_direction(112, 1); + omap_set_gpio_direction(113, 1); + omap_set_gpio_direction(115, 1); + + revision = omap_get_gpio_datain(115) << 2 | + omap_get_gpio_datain(113) << 1 | + omap_get_gpio_datain(112); + + omap_free_gpio(112); + omap_free_gpio(113); + omap_free_gpio(115); + } else { + printf("Error: unable to acquire board revision GPIOs\n"); + revision = -1; + } + + return revision; +} + +/* * Routine: misc_init_r * Description: Configure board specific parts */ @@ -73,6 +104,7 @@ int misc_init_r(void) setup_net_chip(); #endif + printf("Board revision: %d\n", get_board_revision()); dieid_num_r(); return 0; |