[U-Boot] [PATCH] mx6: Fix the reading of CPU revision

Eric Nelson
2013-03-27T15:30:31Z

Hi Dirk,

On 03/27/2013 08:06 AM, Dirk Behme wrote:
> Hi Eric,
>
> On 27.03.2013 15:00, Eric Nelson wrote:
>> Hi Fabio,
>>
>> On 03/27/2013 06:37 AM, Fabio Estevam wrote:
>>> On Wed, Mar 27, 2013 at 5:57 AM, Dirk Behme <dirk.behme@de.bosch.com>
>>> wrote:
>>>
>> <snip>
>>
>> The VPU library relies on the output of /proc/cpuinfo (specifically
>> the line beginning with "Revision".
>>
>> The snippet (from vpu_io.h) is:
>>
>> tmp = strstr(buf, "Revision");
>> if (tmp != NULL) {
>> rev = index(tmp, ':');
>>
>> <snip>
>>
>> This code should really be changed,
>
> Yes :)
>

And this whole thing is really off-topic on the U-Boot list
except as a weak requirement on U-Boot.

>> so we don't have to carry this
>> data all the way from boot loader to /proc/cpuinfo.
>
> As mentioned in my previous mail, I have some doubts that *all* kernels
> pick the version from the boot loader. It's my understanding that this
> strongly depends on the kernel? I.e. there are kernels which get the
> version from the boot loader, e.g. via ATAGs. But there are kernels
> which are independent from the boot loader and calculate it on their
> own? E.g.
>
> http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/mach-mx6/mm.c?h=imx_3.0.35_1.1.0&id=207f80453c77bc32e04b5fef863f6fe50a7fd1a8#n60
>

You're right of course. I believe only non-DT kernels are at issue here,
and it's just the ATAG callback get_board_rev() is at issue, not
get_cpu_rev().

Note that this is supposed to carry **board** revision, which lends
more weight to fixing it.

The kernel knows the proper CPU revision in all cases but publishes
the content of ATAG_REVISION in /proc/cpuinfo
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/kernel/setup.c?h=imx_3.0.35_1.1.0#n655
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/kernel/setup.c?h=imx_3.0.35_1.1.0#n1041

It seems straightforward to simply over-write 'system_rev' on those
kernels which need the hack.

Regards,

Eric