[U-Boot] [PATCH v2 02/22] omap4: add OMAP4430 revision check

Aneesh V
2011-05-16T12:14:09Z

Hi Wolfgang,

On Monday 16 May 2011 12:39 AM, Wolfgang Denk wrote:
> Dear Aneesh V,
>
> In message<1305472900-4004-3-git-send-email-aneesh@ti.com> you wrote:
>> Signed-off-by: Aneesh V<aneesh@ti.com>
>> ---
>> V2:
>> * Added a revision string in addition to the revision number
>> Helps in printing out the OMAP revision at bootup
> ...
>> +const char *omap4_rev_string(void)
>> +{
>> + const char *omap4_rev = NULL;
>> + switch (omap4_revision()) {
>> + case OMAP4430_ES1_0:
>> + omap4_rev = "OMAP4430 ES1.0";
>> + break;
>> + case OMAP4430_ES2_0:
>> + omap4_rev = "OMAP4430 ES2.0";
>> + break;
>> + case OMAP4430_ES2_1:
>> + omap4_rev = "OMAP4430 ES2.1";
>> + break;
>> + case OMAP4430_ES2_2:
>> + omap4_rev = "OMAP4430 ES2.2";
>> + break;
>
> Such code does not really scale well. Can this not be improved? I
> think we just had similar discussions for i.MX5x - please check what
> the result of these was.

Are you referring to this one?
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/98522

If so, it may not work for us:

1. Please note that the above function is just for getting the string
not for the revision itself. To get the revision we have
omap4_revision().

2. In our case we do not have a 1:1 mapping between the
revisions(monotonically increasing numbers) we need in the U-Boot and
the value obtained from the ID_CODE register. So, a translation is
inevitable.

3. We need increasing numbers for subsequent revisions so that we can
have something like:

if (omap4_revision() >= OMAP4430_ES2_0)
do_something();
>
>> + default:
>> + omap4_rev = "OMAP4 - Unknown Rev";
>> + break;
>
> Please also output what the unknown revision was - this saves at least
> one debug round if you ever run into this case.

This function should be in sync with omap4_revision() function(unless
there is a bug). So, the rev will be OMAP4430_SILICON_ID_INVALID in
that case.

I shall print out the ARM revision and OMAP revision registers when I
get into OMAP4430_SILICON_ID_INVALID situation in omap4_revision()

>
>> +}
>> diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h
>> index a30bb33..1f88732 100644
>> --- a/arch/arm/include/asm/arch-omap4/omap4.h
>> +++ b/arch/arm/include/asm/arch-omap4/omap4.h
>> @@ -51,6 +51,11 @@
>> #define CONTROL_PADCONF_CORE (OMAP44XX_L4_CORE_BASE + 0x100000)
>> #define CONTROL_PADCONF_WKUP (OMAP44XX_L4_CORE_BASE + 0x31E000)
>>
>> +/* CONTROL_ID_CODE */
>> +#define CONTROL_ID_CODE (CTRL_BASE + 0x204)
>
> C struct?

Ok. I shall convert defines to C structs globally for register
addressing.

>
>
> Best regards,
>
> Wolfgang Denk
>