
On 03/12/2011 02:15 PM, Anatolij Gustschin wrote:
The reason for using wrsr register is that when reading this register, we can also recognize the software reset cause (SWFT, bit 0 is set). In our use case we have this requirement.
Ok, understood.
I do not think printing the reset cause should be implemented in print_cpuinfo(), because it manages a different issue (reset cause against CPU information). The print_cpuinfo() should have only CPU related values, as clock values, and so on, as it is implemented now for this and other processors. Better to add a different function for the reset cause.
Were should we call this different function? Should be put it into init_sequence[]?
Well, I have not thought as a general function to be inserted in the init_sequence, I do not know if other ARM processor can export this function. On other i.MX processors, the reset cause is printed inside the checkboard function, if CONFIG_DISPLAY_BOARDINFO is set, and not inside print_cpuinfo(). I understand that the cpuinfo reports only how to identify the CPU, and the reset cause should be handled separately.
IMHO should be enough to have a mxc_get_reset_cause() (or something like this) that the board maintainer can call if for some reason he must perform different actions according to the last reset cause. As name, I would prefer to identify not static functions starting with mxc_, as I am trying to uniform all i.MX exponing the same set of functions.
Best regards, Stefano