]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
ZOOM2 detect the version of the zoom2 board at runtime.
authorTom Rix <Tom.Rix@windriver.com>
Wed, 3 Jun 2009 01:53:56 +0000 (20:53 -0500)
committerWolfgang Denk <wd@denx.de>
Fri, 12 Jun 2009 18:45:47 +0000 (20:45 +0200)
There are currently 3 versions of the zoom2 board.
The production board, that is currently being released.
The beta board, similar in form to the production board but not released.
The alpha board, a set of PCBs with a very limited circulation.

GPIO 94 is used to determine the version of the board. If GPIO 94 is clear,
the board is a production board, otherwise it is a beta board.

The alpha board will likely be mistaken for a beta board.  An alpha board
was unavailible for testing.

This has been tested on the beta and production boards.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
board/omap3/zoom2/zoom2.c
board/omap3/zoom2/zoom2.h

index e5c248de7115875ab133278417882a6693e5db7e..08fdafb64470946d0bc2de6553cee521c6e54b73 100644 (file)
@@ -33,6 +33,7 @@
 #include <status_led.h>
 #endif
 #include <asm/io.h>
+#include <asm/arch/gpio.h>
 #include <asm/arch/mem.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/sys_proto.h>
@@ -60,6 +61,60 @@ static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
        0x1D0904C4, 0
 };
 
+/* Used to track the revision of the board */
+static zoom2_revision revision = ZOOM2_REVISION_UNKNOWN;
+
+/*
+ * Routine: zoom2_get_revision
+ * Description: Return the revision of the Zoom2 this code is running on.
+ */
+zoom2_revision zoom2_get_revision(void)
+{
+       return revision;
+}
+
+/*
+ * Routine: zoom2_identify
+ * Description: Detect which version of Zoom2 we are running on.
+ */
+void zoom2_identify(void)
+{
+       /*
+        * To check for production board vs beta board,
+        * check if gpio 94 is clear.
+        *
+        * No way yet to check for alpha board identity.
+        * Alpha boards were produced in very limited quantities
+        * and they are not commonly used.  They are mentioned here
+        * only for completeness.
+        */
+       if (!omap_request_gpio(94)) {
+               unsigned int val;
+
+               omap_set_gpio_direction(94, 1);
+               val = omap_get_gpio_datain(94);
+               omap_free_gpio(94);
+
+               if (val)
+                       revision = ZOOM2_REVISION_BETA;
+               else
+                       revision = ZOOM2_REVISION_PRODUCTION;
+       }
+
+       printf("Board revision ");
+       switch (revision) {
+       case ZOOM2_REVISION_PRODUCTION:
+               printf("Production\n");
+               break;
+       case ZOOM2_REVISION_BETA:
+               printf("Beta\n");
+               break;
+       default:
+               printf("Unknown\n");
+               break;
+       }
+}
+
 /*
  * Routine: board_init
  * Description: Early hardware init.
@@ -96,10 +151,11 @@ int board_init (void)
  * Routine: misc_init_r
  * Description: Configure zoom board specific configurations
  */
-int misc_init_r (void)
+int misc_init_r(void)
 {
-       power_init_r ();
-       dieid_num_r ();
+       zoom2_identify();
+       power_init_r();
+       dieid_num_r();
        return 0;
 }
 
index cae8a7a7fc476b335fc67880b3179807d86c80ac..a21d1d68991daedc2d9031c5ae637e26b0d4cb51 100644 (file)
@@ -32,6 +32,15 @@ const omap3_sysinfo sysinfo = {
        "NAND",
 };
 
+typedef enum {
+       ZOOM2_REVISION_UNKNOWN = 0,
+       ZOOM2_REVISION_ALPHA,
+       ZOOM2_REVISION_BETA,
+       ZOOM2_REVISION_PRODUCTION
+} zoom2_revision;
+
+zoom2_revision zoom2_get_revision(void);
+
 /*
  * IEN - Input Enable
  * IDIS        - Input Disable