From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Nelson Date: Thu, 05 Feb 2015 16:14:28 -0700 Subject: [U-Boot] [PATCH] imx: save reset cause in 'reset_cause' environment variable In-Reply-To: <54D3F790.6060605@boundarydevices.com> References: <54D3BB1E.1060409@denx.de> <1423177107-16012-1-git-send-email-eric.nelson@boundarydevices.com> <54D3F790.6060605@boundarydevices.com> Message-ID: <54D3F954.80701@boundarydevices.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Troy, On 02/05/2015 04:06 PM, Troy Kisky wrote: > On 2/5/2015 3:58 PM, Eric Nelson wrote: >> The cause of a reset is generally useful, and shouldn't be >> blindly cleared in the process of displaying it as a part >> of the boot announcement. >> >> Stash the string representation in the environment variable >> "reset_cause". >> >> Values include: >> "POR" - power on reset >> "CSU" - reset was the result of the csu_reset_b input >> "IPP-USER" - ipp_user_reset_b qualified reset >> "WDOG" - watchdog reset >> "JTAG-HIGH-Z" - HIGH-Z reset from JTAG >> "JTAG-SW" - software reset from JTAG >> "WARM-BOOT" - WARM boot was initiated by software >> >> >> >> switch (cause) { >> case 0x00001: >> case 0x00011: >> - return "POR"; >> + rval = "POR"; >> + break; >> >> >> >> - default: >> - return "unknown reset"; >> + rval = "WARM-BOOT"; > > Instead of removing default, can we have a hex value, something like > sprintf(buf, "unknown(0x%x)", cause); > Of course (if we go that route). I thought of this when typing up the list of values for the commit comment. The human readable form is harder to handle on the receiving side though, which is why I favor hex. Regards, Eric