How do we set Revision and Serial from proc/cpuinfo

cancel
Showing results for 
Search instead for 
Did you mean: 

How do we set Revision and Serial from proc/cpuinfo

1,358 Views
Contributor IV

I'm trying to use devregs from the meta-freescale repo and one of the first things that tool does is read /proc/cpuinfo to parse out the "Revision :" field. The tool was coming back with a "Error reading CPU type" message due to the fact that Revision was returning all 0s.

It does seem odd that "Revision" and "Serial" from cpuinfo are returning all 0s for this i.MX6DL. What are correct values to be returned? How do these get set correctly?

# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 10 (v7l)
BogoMIPS        : 3.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x2
CPU part        : 0xc09
CPU revision    : 10

processor       : 1
model name      : ARMv7 Processor rev 10 (v7l)
BogoMIPS        : 3.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x2
CPU part        : 0xc09
CPU revision    : 10

Hardware        : Freescale i.MX6 Quad/DualLite (Device Tree)
Revision        : 0000
Serial          : 0000000000000000

Labels (3)
6 Replies

24 Views
NXP Employee
NXP Employee

Hi Michael,

Inside u-boot source code in arch/arm/cpu/armv7/mx6/soc.c you will find the call to cpurev = get_cpu_rev();

But this depends on CONFIG_REVISION_TAG which must be enabled in mx6_common.h.


Best regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

24 Views
Contributor IV

Carlos, thanks for the hints. I found where U-Boot is checking the board's revision and serial number, and I tossed in a little code to check the results in U-Boot:

    int        ret = 0;
    struct tag_serialnr serialnr;

    rev = get_board_rev();
    printf("\nboard revision: %lu\n", rev);
    get_board_serial(&serialnr);
    printf("\nboard serial: %lu %lu\n", serialnr.low, serialnr.high);

When I booted up I was able to see some values showing up:

    board revision: 397331

    board serial: 1324543428 3961

So it looks like that's working, but when I get to the kernel, /proc/cpuinfo reports all 0's for revision and serial. Does this information need to be passed from the bootloader to the kernel somehow?

This is a custom board, so perhaps we missed some changes in the bootloader/kernel required to pass information.

0 Kudos

24 Views
NXP Employee
NXP Employee

Hi Michael,

the code for getting this information should be in the kernel code inside <Kernel>/arch/arm/kernel/setup.c


Best regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

24 Views
Contributor IV

Carlos,

    I looked into setup.c and it seems that Revision and Serial are being set by system_rev and serial_high/serial_low respectively. After some further investigation, it appears that these are only being set via atags in atags_compat.c. So, I suppose the system rev and serial must be set by atags and there is currently no device tree support for this.

    I searched around in the bootloader for any place this was set, but as far as I can tell, it looks like this information is not being passed. I can't find any fsl/i.mx code which passes these variables via the atags.

Am I missing anything here? Is it correct that this information must currently be passed by atags but that is not happening?

-Mike

0 Kudos

24 Views
NXP Employee
NXP Employee

I just looked at the device tree, there is a serial-number property for root node,

linux/Documentation/devicetree/booting-without-of.txt - Elixir - Free Electrons 

And the code to parse it is,

linux/arch/arm/kernel/setup.c - Elixir - Free Electrons 

So, either uboot updates it or just have it in kernel while building device tree should work.

0 Kudos

24 Views
Contributor IV

Jay, you are correct for a 4.11 kernel. I'm based off a 4.1.15, so it looks like support was not added at that point in time. Also, it would appear even in the later kernels only serial-number has an entry. Since devregs still requires a Revision to be set, it would see that atags are required still. Does that seem correct?