[U-Boot] [PATCH 05/7] ARMV7: OMAP: Add board revision detection for Overo

Steve Sakoman steve at sakoman.com
Fri Aug 13 23:40:43 CEST 2010


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 at sakoman.com>
---
 board/overo/overo.c |   32 ++++++++++++++++++++++++++++++++
 board/overo/overo.h |    6 +++---
 2 files changed, 35 insertions(+), 3 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;
diff --git a/board/overo/overo.h b/board/overo/overo.h
index fff43da..a4e49b9 100644
--- a/board/overo/overo.h
+++ b/board/overo/overo.h
@@ -189,11 +189,11 @@ const omap3_sysinfo sysinfo = {
 	MUX_VAL(CP(CAM_XCLKB),		(IDIS | PTD | DIS | M0)) /*CAM_XCLKB*/\
 	MUX_VAL(CP(CAM_WEN),		(IEN  | PTD | DIS | M0)) /*CAM_WEN*/\
 	MUX_VAL(CP(CAM_STROBE),		(IDIS | PTD | DIS | M0)) /*CAM_STROBE*/\
-	MUX_VAL(CP(CSI2_DX0),		(IEN  | PTD | DIS | M0)) /*CSI2_DX0*/\
-	MUX_VAL(CP(CSI2_DY0),		(IEN  | PTD | DIS | M0)) /*CSI2_DY0*/\
+	MUX_VAL(CP(CSI2_DX0),		(IEN  | PTD | EN  | M4)) /*GPIO_112*/\
+	MUX_VAL(CP(CSI2_DY0),		(IEN  | PTD | EN  | M4)) /*GPIO_113*/\
 	MUX_VAL(CP(CSI2_DX1),		(IEN  | PTD | EN  | M4)) /*GPIO_114*/\
 								 /* - PEN_DOWN*/\
-	MUX_VAL(CP(CSI2_DY1),		(IEN  | PTU | EN  | M4)) /*GPIO_115*/\
+	MUX_VAL(CP(CSI2_DY1),		(IEN  | PTD | EN  | M4)) /*GPIO_115*/\
  /*Audio Interface */\
 	MUX_VAL(CP(MCBSP2_FSX),		(IEN  | PTD | DIS | M0)) /*McBSP2_FSX*/\
 	MUX_VAL(CP(MCBSP2_CLKX),	(IEN  | PTD | DIS | M0)) /*McBSP2_CLKX*/\
-- 
1.7.0.4



More information about the U-Boot mailing list