From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime.
Date: Mon, 1 Jun 2009 18:22:35 +0200 [thread overview]
Message-ID: <20090601162235.GC6399@game.jcrosoft.org> (raw)
In-Reply-To: <1243609112-11777-3-git-send-email-Tom.Rix@windriver.com>
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.
next prev parent reply other threads:[~2009-06-01 16:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2009-06-03 2:07 ` [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090601162235.GC6399@game.jcrosoft.org \
--to=plagnioj@jcrosoft.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox