summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-06-07 22:43:16 +0100
committerGerrit Rockbox <gerrit@rockbox.org>2016-06-08 21:53:36 +0200
commit9a6700d52e8dfb2e93623e7143204ae34f798bbf (patch)
tree60f1d88841b1ac5107a3d0bec37c7de8fcb51541
parente195126ce82987f1547ff975130edc96f455b999 (diff)
downloadrockbox-9a6700d52e8dfb2e93623e7143204ae34f798bbf.tar.gz
rockbox-9a6700d52e8dfb2e93623e7143204ae34f798bbf.zip
imx233: fix power off code
There are two very suspicious things in the power off code: - it does not properly unlock the power register, so it should fail (!) - it does not disable sw/hw watchdog so if register fails, the device will most probably crash horribly because of the watchdog I don't even understand how it worked before. Change-Id: I9f3f94bd012e52c3b50cd5b658d68b5eb907f79b
-rw-r--r--firmware/target/arm/imx233/power-imx233.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/firmware/target/arm/imx233/power-imx233.c b/firmware/target/arm/imx233/power-imx233.c
index 600f65eea6..e2b6a622a0 100644
--- a/firmware/target/arm/imx233/power-imx233.c
+++ b/firmware/target/arm/imx233/power-imx233.c
@@ -28,6 +28,7 @@
28#include "power-imx233.h" 28#include "power-imx233.h"
29#include "pinctrl-imx233.h" 29#include "pinctrl-imx233.h"
30#include "fmradio_i2c.h" 30#include "fmradio_i2c.h"
31#include "rtc-imx233.h"
31 32
32#include "regs/power.h" 33#include "regs/power.h"
33 34
@@ -232,6 +233,11 @@ void power_off(void)
232{ 233{
233 /* wait a bit, useful for the user to stop touching anything */ 234 /* wait a bit, useful for the user to stop touching anything */
234 sleep(HZ / 2); 235 sleep(HZ / 2);
236 /* disable watchdog just in case since we will disable interrupts */
237 imx233_rtc_enable_watchdog(false);
238 /* disable interrupts, it's probably better to avoid any action so close
239 * to shutdown */
240 disable_interrupt(IRQ_FIQ_STATUS);
235#ifdef SANSA_FUZEPLUS 241#ifdef SANSA_FUZEPLUS
236 /* This pin seems to be important to shutdown the hardware properly */ 242 /* This pin seems to be important to shutdown the hardware properly */
237 imx233_pinctrl_acquire(0, 9, "power off"); 243 imx233_pinctrl_acquire(0, 9, "power off");
@@ -240,7 +246,7 @@ void power_off(void)
240 imx233_pinctrl_set_gpio(0, 9, true); 246 imx233_pinctrl_set_gpio(0, 9, true);
241#endif 247#endif
242 /* power down */ 248 /* power down */
243 HW_POWER_RESET = BM_OR(POWER_RESET, UNLOCK, PWD); // FIXME bug 249 HW_POWER_RESET = BF_OR(POWER_RESET, UNLOCK_V(KEY), PWD(1));
244 while(1); 250 while(1);
245} 251}
246 252