summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/system-imx233.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx233/system-imx233.c')
-rw-r--r--firmware/target/arm/imx233/system-imx233.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/firmware/target/arm/imx233/system-imx233.c b/firmware/target/arm/imx233/system-imx233.c
index 2264f7cacd..5fd162a1ca 100644
--- a/firmware/target/arm/imx233/system-imx233.c
+++ b/firmware/target/arm/imx233/system-imx233.c
@@ -97,6 +97,24 @@ static void watchdog_init(void)
97 good_dog(); 97 good_dog();
98} 98}
99 99
100void imx233_system_prepare_shutdown(void)
101{
102 /* wait a bit, useful for the user to stop touching anything */
103 sleep(HZ / 2);
104 /* disable watchdog just in case since we will disable interrupts */
105 imx233_rtc_enable_watchdog(false);
106 /* disable interrupts, it's probably better to avoid any action so close
107 * to shutdown */
108 disable_interrupt(IRQ_FIQ_STATUS);
109#ifdef SANSA_FUZEPLUS
110 /* This pin seems to be important to shutdown the hardware properly */
111 imx233_pinctrl_acquire(0, 9, "power off");
112 imx233_pinctrl_set_function(0, 9, PINCTRL_FUNCTION_GPIO);
113 imx233_pinctrl_enable_gpio(0, 9, true);
114 imx233_pinctrl_set_gpio(0, 9, true);
115#endif
116}
117
100void imx233_chip_reset(void) 118void imx233_chip_reset(void)
101{ 119{
102#if IMX233_SUBTARGET >= 3700 120#if IMX233_SUBTARGET >= 3700
@@ -108,10 +126,8 @@ void imx233_chip_reset(void)
108 126
109void system_reboot(void) 127void system_reboot(void)
110{ 128{
111 backlight_hw_off(); 129 imx233_system_prepare_shutdown();
112 130 /* reset */
113 disable_irq();
114
115 imx233_chip_reset(); 131 imx233_chip_reset();
116 while(1); 132 while(1);
117} 133}