From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk Behme Date: Thu, 05 Feb 2009 20:12:48 +0100 Subject: [U-Boot] [PATCH 2/7] OMAP3: Beagle: Add board revision detection In-Reply-To: <20090204232213.GJ31498@game.jcrosoft.org> References: <1233554011-30084-1-git-send-email-dirk.behme@googlemail.com> <1233554011-30084-2-git-send-email-dirk.behme@googlemail.com> <1233554011-30084-3-git-send-email-dirk.behme@googlemail.com> <20090204232213.GJ31498@game.jcrosoft.org> Message-ID: <498B3A30.2030900@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Jean-Christophe, Jean-Christophe PLAGNIOL-VILLARD wrote: > >> /****************************************************************************** >> + * Routine: board_identify >> + * Description: Detect if we are running on a Beagle revision Ax/Bx or >> + * Cx. This can be done by GPIO_171. If this is low, we are >> + * running on a revision C board. >> + *****************************************************************************/ >> +void board_identify(void) >> +{ >> + gpio_t *gpio6_base = (gpio_t *)OMAP34XX_GPIO6_BASE; >> + >> + /* Configure GPIO 171 as input */ > we may need to start to think about merge to the gpiolib to simplify it >> + writel(readl(&gpio6_base->oe) | GPIO11, &gpio6_base->oe); >> + >> + /* Get value of GPIO 171 */ >> + beagle_revision_c = readl(&gpio6_base->datain) & BOARD_REVISION_MASK; >> + >> + printf("Board revision "); >> + if (beagle_revision_c) { > ??? > I'm not a fan of glabal var And I'm not a fan of bad weather. But I'm not sure if it really matters here what we are fans of? ;) > please create a function that will return if it's > a rev c or not And where should this function you propose get the info from which board revision it is? Note that we follow here (and in the serial number patch) the concept of "touch hardware only once, remember the value and then deal with the remembered value. Don't touch hardware again if done already". I.e. it's the concept behind this to not have a function to read HW (and do masking etc) again and again if revision value is needed. Dirk