* [U-Boot] Zoom2, Beagle board revision detection.
@ 2009-05-29 14:58 Tom Rix
2009-05-29 14:58 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Tom Rix
2009-05-31 16:23 ` [U-Boot] Zoom2, Beagle board revision detection Dirk Behme
0 siblings, 2 replies; 9+ messages in thread
From: Tom Rix @ 2009-05-29 14:58 UTC (permalink / raw)
To: u-boot
This is against the arm/next branch
Zoom2 has two meaningful board revisions : production and beta. This change
will allow the board differences to be handled at runtime.
The Zoom2 change is based on how the Beagle Board does its board revision
but since it is newer, it uses the OMAP3 GPIO API that was recently added.
This was run tested on Zoom2 beta and production boards.
Since I was taking a close look at the Beagle code, I updated it to also
use the OMAP3 GPIO API.
This was run tested on a Beagle B7 board. A version C board was not
available for testing. It would be good if someone verified the Beagle change
with a versioin C board.
Tom
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface.
2009-05-29 14:58 [U-Boot] Zoom2, Beagle board revision detection Tom Rix
@ 2009-05-29 14:58 ` Tom Rix
2009-05-29 14:58 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Tom Rix
2009-06-03 18:29 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Jean-Christophe PLAGNIOL-VILLARD
2009-05-31 16:23 ` [U-Boot] Zoom2, Beagle board revision detection Dirk Behme
1 sibling, 2 replies; 9+ messages in thread
From: Tom Rix @ 2009-05-29 14:58 UTC (permalink / raw)
To: u-boot
Using the example for reading a gpio, shows the problem.
NULL should be the gpio number.
Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
---
doc/README.omap3 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/doc/README.omap3 b/doc/README.omap3
index e05e816..66e781d 100644
--- a/doc/README.omap3
+++ b/doc/README.omap3
@@ -106,7 +106,7 @@ To clear a bit :
To read a bit :
if (!omap_request_gpio(N)) {
- omap_set_gpio_direction(NULL, 1);
+ omap_set_gpio_direction(N, 1);
val = omap_get_gpio_datain(N);
omap_free_gpio(N);
}
--
1.6.0.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime.
2009-05-29 14:58 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Tom Rix
@ 2009-05-29 14:58 ` Tom Rix
2009-05-29 14:58 ` [U-Boot] [PATCH 3/3] Beagle Convert the board version detection to use the OMAP3 GPIO interface Tom Rix
2009-06-01 16:22 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Jean-Christophe PLAGNIOL-VILLARD
2009-06-03 18:29 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 2 replies; 9+ messages in thread
From: Tom Rix @ 2009-05-29 14:58 UTC (permalink / raw)
To: u-boot
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>
---
board/omap3/zoom2/zoom2.c | 48 ++++++++++++++++++++++++++++++++++++++++++--
board/omap3/zoom2/zoom2.h | 6 +++++
2 files changed, 51 insertions(+), 3 deletions(-)
diff --git a/board/omap3/zoom2/zoom2.c b/board/omap3/zoom2/zoom2.c
index e5c248d..06e644f 100644
--- a/board/omap3/zoom2/zoom2.c
+++ b/board/omap3/zoom2/zoom2.c
@@ -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,46 @@ static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
0x1D0904C4, 0
};
+/* Used to track the revision of the board */
+int zoom2_revision = ZOOM2_REVISION_UNKNOWN;
+
+/*
+ * 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)
+ zoom2_revision = ZOOM2_REVISION_BETA;
+ else
+ zoom2_revision = ZOOM2_REVISION_PRODUCTION;
+ }
+
+ printf("Board revision ");
+ if (ZOOM2_REVISION_PRODUCTION == zoom2_revision)
+ printf("Production\n");
+ else if (ZOOM2_REVISION_BETA == zoom2_revision)
+ printf("Beta\n");
+ else
+ printf("Unknown\n");
+}
+
/*
* Routine: board_init
* Description: Early hardware init.
@@ -96,10 +137,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;
}
diff --git a/board/omap3/zoom2/zoom2.h b/board/omap3/zoom2/zoom2.h
index cae8a7a..7f15260 100644
--- a/board/omap3/zoom2/zoom2.h
+++ b/board/omap3/zoom2/zoom2.h
@@ -32,6 +32,12 @@ const omap3_sysinfo sysinfo = {
"NAND",
};
+#define ZOOM2_REVISION_UNKNOWN 0
+#define ZOOM2_REVISION_ALPHA 1
+#define ZOOM2_REVISION_BETA 2
+#define ZOOM2_REVISION_PRODUCTION 3
+extern int zoom2_revision;
+
/*
* IEN - Input Enable
* IDIS - Input Disable
--
1.6.0.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* [U-Boot] [PATCH 3/3] Beagle Convert the board version detection to use the OMAP3 GPIO interface.
2009-05-29 14:58 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Tom Rix
@ 2009-05-29 14:58 ` Tom Rix
2009-06-01 16:22 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 9+ messages in thread
From: Tom Rix @ 2009-05-29 14:58 UTC (permalink / raw)
To: u-boot
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>
---
board/omap3/beagle/beagle.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/board/omap3/beagle/beagle.c b/board/omap3/beagle/beagle.c
index 7eb70ee..022cd42 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"
@@ -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");
}
/*
--
1.6.0.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime.
2009-05-29 14:58 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Tom Rix
2009-05-29 14:58 ` [U-Boot] [PATCH 3/3] Beagle Convert the board version detection to use the OMAP3 GPIO interface Tom Rix
@ 2009-06-01 16:22 ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-03 2:07 ` Tom
1 sibling, 1 reply; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-06-01 16:22 UTC (permalink / raw)
To: u-boot
On 09:58 Fri 29 May , Tom Rix wrote:
> 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>
> ---
> board/omap3/zoom2/zoom2.c | 48 ++++++++++++++++++++++++++++++++++++++++++--
> board/omap3/zoom2/zoom2.h | 6 +++++
> 2 files changed, 51 insertions(+), 3 deletions(-)
>
> diff --git a/board/omap3/zoom2/zoom2.c b/board/omap3/zoom2/zoom2.c
> index e5c248d..06e644f 100644
> --- a/board/omap3/zoom2/zoom2.c
> +++ b/board/omap3/zoom2/zoom2.c
> @@ -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,46 @@ static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
> 0x1D0904C4, 0
> };
>
> +/* Used to track the revision of the board */
> +int zoom2_revision = ZOOM2_REVISION_UNKNOWN;
add static and as the beagle provide a function to get the current version
> +
> +/*
> + * 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)
> + zoom2_revision = ZOOM2_REVISION_BETA;
> + else
> + zoom2_revision = ZOOM2_REVISION_PRODUCTION;
> + }
> +
> + printf("Board revision ");
> + if (ZOOM2_REVISION_PRODUCTION == zoom2_revision)
> + printf("Production\n");
> + else if (ZOOM2_REVISION_BETA == zoom2_revision)
> + printf("Beta\n");
> + else
> + printf("Unknown\n");
please use switch
> +}
> +
> /*
> * Routine: board_init
> * Description: Early hardware init.
> @@ -96,10 +137,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;
> }
>
> diff --git a/board/omap3/zoom2/zoom2.h b/board/omap3/zoom2/zoom2.h
> index cae8a7a..7f15260 100644
> --- a/board/omap3/zoom2/zoom2.h
> +++ b/board/omap3/zoom2/zoom2.h
> @@ -32,6 +32,12 @@ const omap3_sysinfo sysinfo = {
> "NAND",
> };
>
> +#define ZOOM2_REVISION_UNKNOWN 0
> +#define ZOOM2_REVISION_ALPHA 1
> +#define ZOOM2_REVISION_BETA 2
> +#define ZOOM2_REVISION_PRODUCTION 3
please use an emum
Best Regards,
J.
^ permalink raw reply [flat|nested] 9+ messages in thread* [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime.
2009-06-01 16:22 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Jean-Christophe PLAGNIOL-VILLARD
@ 2009-06-03 2:07 ` Tom
0 siblings, 0 replies; 9+ messages in thread
From: Tom @ 2009-06-03 2:07 UTC (permalink / raw)
To: u-boot
Jean-Christophe,
I have resubmitted the board revision patches based on your comments.
Tom
Jean-Christophe PLAGNIOL-VILLARD wrote:
>>
>> +/* Used to track the revision of the board */
>> +int zoom2_revision = ZOOM2_REVISION_UNKNOWN;
>>
> add static and as the beagle provide a function to get the current version
>
Ok see
+/* Used to track the revision of the board */
+static ZOOM2_REVISION zoom2_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 zoom2_revision;
+}
>> + printf("Board revision ");
>> + if (ZOOM2_REVISION_PRODUCTION == zoom2_revision)
>> + printf("Production\n");
>> + else if (ZOOM2_REVISION_BETA == zoom2_revision)
>> + printf("Beta\n");
>> + else
>> + printf("Unknown\n");
>>
> please use switch
>
Ok see
+ printf("Board revision ");
+ switch (zoom2_revision) {
+ case (ZOOM2_REVISION_PRODUCTION):
+ printf("Production\n");
+ break;
+ case (ZOOM2_REVISION_BETA):
+ printf("Beta\n");
+ break;
+ default:
+ printf("Unknown\n");
+ break;
+ }
+}
>>
>> +#define ZOOM2_REVISION_UNKNOWN 0
>> +#define ZOOM2_REVISION_ALPHA 1
>> +#define ZOOM2_REVISION_BETA 2
>> +#define ZOOM2_REVISION_PRODUCTION 3
>>
> please use an emum
>
>
Ok see
+typedef enum {
+ ZOOM2_REVISION_UNKNOWN = 0,
+ ZOOM2_REVISION_ALPHA,
+ ZOOM2_REVISION_BETA,
+ ZOOM2_REVISION_PRODUCTION
+}
I also made a slight change to the beagle.c in patch 3/3 comment here
/*
* 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.
*/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface.
2009-05-29 14:58 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Tom Rix
2009-05-29 14:58 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Tom Rix
@ 2009-06-03 18:29 ` Jean-Christophe PLAGNIOL-VILLARD
1 sibling, 0 replies; 9+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-06-03 18:29 UTC (permalink / raw)
To: u-boot
On 09:58 Fri 29 May , Tom Rix wrote:
> Using the example for reading a gpio, shows the problem.
> NULL should be the gpio number.
>
> Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
> ---
applied to arm/next
Best Regards,
J.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] Zoom2, Beagle board revision detection.
2009-05-29 14:58 [U-Boot] Zoom2, Beagle board revision detection Tom Rix
2009-05-29 14:58 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Tom Rix
@ 2009-05-31 16:23 ` Dirk Behme
1 sibling, 0 replies; 9+ messages in thread
From: Dirk Behme @ 2009-05-31 16:23 UTC (permalink / raw)
To: u-boot
Tom Rix wrote:
> This is against the arm/next branch
>
> Zoom2 has two meaningful board revisions : production and beta. This change
> will allow the board differences to be handled at runtime.
>
> The Zoom2 change is based on how the Beagle Board does its board revision
> but since it is newer, it uses the OMAP3 GPIO API that was recently added.
>
> This was run tested on Zoom2 beta and production boards.
>
> Since I was taking a close look at the Beagle code, I updated it to also
> use the OMAP3 GPIO API.
>
> This was run tested on a Beagle B7 board. A version C board was not
> available for testing. It would be good if someone verified the Beagle change
> with a versioin C board.
Recent u-boot-arm next + the 5 patches (3 x board revision detection +
2 x GPIO bank clocks) boot tested on Beagle rev C:
-- cut --
U-Boot 2009.06-rc2-01028-gef3c752-dirty (May 31 2009 - 18:13:48)
OMAP3530-GP ES3.0, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
DRAM: 256 MB
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Board revision C
Die ID #783000030000000004013f7806019018
OMAP3 beagleboard.org #
-- cut --
Looks fine. So all 5 patches:
Acked-by: Dirk Behme <dirk.behme@googlemail.com>
Thanks
Dirk
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2
@ 2009-06-03 1:53 Tom Rix
2009-06-03 1:53 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Tom Rix
0 siblings, 1 reply; 9+ messages in thread
From: Tom Rix @ 2009-06-03 1:53 UTC (permalink / raw)
To: u-boot
Jean-Christophe,
Based on your review I have made the changes you asked for.
Tom
> @@ -60,6 +61,46 @@ static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {
> 0x1D0904C4, 0
> };
>
> +/* Used to track the revision of the board */
> +int zoom2_revision = ZOOM2_REVISION_UNKNOWN;
add static and as the beagle provide a function to get the current version
> +
Tom : Ok added
See
+/* Used to track the revision of the board */
+static ZOOM2_REVISION zoom2_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 zoom2_revision;
+}
-------------------------------------------------------------------
> + printf("Board revision ");
> + if (ZOOM2_REVISION_PRODUCTION == zoom2_revision)
> + printf("Production\n");
> + else if (ZOOM2_REVISION_BETA == zoom2_revision)
> + printf("Beta\n");
> + else
> + printf("Unknown\n");
please use switch
> +}
Tom : Ok done.
See
+ switch (zoom2_revision) {
+ case (ZOOM2_REVISION_PRODUCTION):
+ printf("Production\n");
+ break;
+ case (ZOOM2_REVISION_BETA):
+ printf("Beta\n");
+ break;
+ default:
+ printf("Unknown\n");
+ break;
+ }
+}
-------------------------------------------------------
> +#define ZOOM2_REVISION_UNKNOWN 0
> +#define ZOOM2_REVISION_ALPHA 1
> +#define ZOOM2_REVISION_BETA 2
> +#define ZOOM2_REVISION_PRODUCTION 3
please use an emum
Tom : Ok
See
+typedef enum {
+ ZOOM2_REVISION_UNKNOWN = 0,
+ ZOOM2_REVISION_ALPHA,
+ ZOOM2_REVISION_BETA,
+ ZOOM2_REVISION_PRODUCTION
+} ZOOM2_REVISION;
----------------------------------------------------------
Also changed this comment in beagle.c
/*
* 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.
^ permalink raw reply [flat|nested] 9+ messages in thread* [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface.
2009-06-03 1:53 [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 Tom Rix
@ 2009-06-03 1:53 ` Tom Rix
2009-06-03 1:53 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Tom Rix
0 siblings, 1 reply; 9+ messages in thread
From: Tom Rix @ 2009-06-03 1:53 UTC (permalink / raw)
To: u-boot
Using the example for reading a gpio, shows the problem.
NULL should be the gpio number.
Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
---
doc/README.omap3 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/doc/README.omap3 b/doc/README.omap3
index e05e816..66e781d 100644
--- a/doc/README.omap3
+++ b/doc/README.omap3
@@ -106,7 +106,7 @@ To clear a bit :
To read a bit :
if (!omap_request_gpio(N)) {
- omap_set_gpio_direction(NULL, 1);
+ omap_set_gpio_direction(N, 1);
val = omap_get_gpio_datain(N);
omap_free_gpio(N);
}
--
1.6.0.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime.
2009-06-03 1:53 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Tom Rix
@ 2009-06-03 1:53 ` Tom Rix
0 siblings, 0 replies; 9+ messages in thread
From: Tom Rix @ 2009-06-03 1:53 UTC (permalink / raw)
To: u-boot
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>
---
board/omap3/zoom2/zoom2.c | 62 ++++++++++++++++++++++++++++++++++++++++++--
board/omap3/zoom2/zoom2.h | 9 ++++++
2 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/board/omap3/zoom2/zoom2.c b/board/omap3/zoom2/zoom2.c
index e5c248d..94231da 100644
--- a/board/omap3/zoom2/zoom2.c
+++ b/board/omap3/zoom2/zoom2.c
@@ -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 zoom2_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 zoom2_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)
+ zoom2_revision = ZOOM2_REVISION_BETA;
+ else
+ zoom2_revision = ZOOM2_REVISION_PRODUCTION;
+ }
+
+ printf("Board revision ");
+ switch (zoom2_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;
}
diff --git a/board/omap3/zoom2/zoom2.h b/board/omap3/zoom2/zoom2.h
index cae8a7a..b12b0fa 100644
--- a/board/omap3/zoom2/zoom2.h
+++ b/board/omap3/zoom2/zoom2.h
@@ -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;
+
+extern ZOOM2_REVISION zoom2_get_revision(void);
+
/*
* IEN - Input Enable
* IDIS - Input Disable
--
1.6.0.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-06-03 18:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-29 14:58 [U-Boot] Zoom2, Beagle board revision detection Tom Rix
2009-05-29 14:58 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Tom Rix
2009-05-29 14:58 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Tom Rix
2009-05-29 14:58 ` [U-Boot] [PATCH 3/3] Beagle Convert the board version detection to use the OMAP3 GPIO interface Tom Rix
2009-06-01 16:22 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Jean-Christophe PLAGNIOL-VILLARD
2009-06-03 2:07 ` Tom
2009-06-03 18:29 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Jean-Christophe PLAGNIOL-VILLARD
2009-05-31 16:23 ` [U-Boot] Zoom2, Beagle board revision detection Dirk Behme
-- strict thread matches above, loose matches on Subject: below --
2009-06-03 1:53 [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 Tom Rix
2009-06-03 1:53 ` [U-Boot] [PATCH 1/3] Fix a typo in the instructions on using omap3's gpio interface Tom Rix
2009-06-03 1:53 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime Tom Rix
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox