From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Date: Tue, 02 Jun 2009 21:07:56 -0500 Subject: [U-Boot] [PATCH 2/3] ZOOM2 detect the version of the zoom2 board at runtime. In-Reply-To: <20090601162235.GC6399@game.jcrosoft.org> References: <1243609112-11777-1-git-send-email-Tom.Rix@windriver.com> <1243609112-11777-2-git-send-email-Tom.Rix@windriver.com> <1243609112-11777-3-git-send-email-Tom.Rix@windriver.com> <20090601162235.GC6399@game.jcrosoft.org> Message-ID: <4A25DAFC.103@windriver.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. */