[U-Boot] [PATCH 2/7] OMAP3: Beagle: Add board revision detection

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Wed Feb 11 23:17:35 CET 2009


On 20:12 Thu 05 Feb     , Dirk Behme wrote:
> 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? ;)
global var NACK specialy when other code is not supposed to change it's value

you have other clean way to do it as static var with a function to return it

please change to this

Best Regards,
J.


More information about the U-Boot mailing list