mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
imx233: refactor power off and reboot
There is no reason to use different code paths Change-Id: I4894c7963c802b56b5d3576909e1008a7c401935
This commit is contained in:
parent
9aeb6f48b8
commit
1c97083ca7
3 changed files with 22 additions and 19 deletions
|
|
@ -231,20 +231,7 @@ void power_init(void)
|
||||||
|
|
||||||
void power_off(void)
|
void power_off(void)
|
||||||
{
|
{
|
||||||
/* wait a bit, useful for the user to stop touching anything */
|
imx233_system_prepare_shutdown();
|
||||||
sleep(HZ / 2);
|
|
||||||
/* disable watchdog just in case since we will disable interrupts */
|
|
||||||
imx233_rtc_enable_watchdog(false);
|
|
||||||
/* disable interrupts, it's probably better to avoid any action so close
|
|
||||||
* to shutdown */
|
|
||||||
disable_interrupt(IRQ_FIQ_STATUS);
|
|
||||||
#ifdef SANSA_FUZEPLUS
|
|
||||||
/* This pin seems to be important to shutdown the hardware properly */
|
|
||||||
imx233_pinctrl_acquire(0, 9, "power off");
|
|
||||||
imx233_pinctrl_set_function(0, 9, PINCTRL_FUNCTION_GPIO);
|
|
||||||
imx233_pinctrl_enable_gpio(0, 9, true);
|
|
||||||
imx233_pinctrl_set_gpio(0, 9, true);
|
|
||||||
#endif
|
|
||||||
/* power down */
|
/* power down */
|
||||||
HW_POWER_RESET = BF_OR(POWER_RESET, UNLOCK_V(KEY), PWD(1));
|
HW_POWER_RESET = BF_OR(POWER_RESET, UNLOCK_V(KEY), PWD(1));
|
||||||
while(1);
|
while(1);
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,24 @@ static void watchdog_init(void)
|
||||||
good_dog();
|
good_dog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void imx233_system_prepare_shutdown(void)
|
||||||
|
{
|
||||||
|
/* wait a bit, useful for the user to stop touching anything */
|
||||||
|
sleep(HZ / 2);
|
||||||
|
/* disable watchdog just in case since we will disable interrupts */
|
||||||
|
imx233_rtc_enable_watchdog(false);
|
||||||
|
/* disable interrupts, it's probably better to avoid any action so close
|
||||||
|
* to shutdown */
|
||||||
|
disable_interrupt(IRQ_FIQ_STATUS);
|
||||||
|
#ifdef SANSA_FUZEPLUS
|
||||||
|
/* This pin seems to be important to shutdown the hardware properly */
|
||||||
|
imx233_pinctrl_acquire(0, 9, "power off");
|
||||||
|
imx233_pinctrl_set_function(0, 9, PINCTRL_FUNCTION_GPIO);
|
||||||
|
imx233_pinctrl_enable_gpio(0, 9, true);
|
||||||
|
imx233_pinctrl_set_gpio(0, 9, true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void imx233_chip_reset(void)
|
void imx233_chip_reset(void)
|
||||||
{
|
{
|
||||||
#if IMX233_SUBTARGET >= 3700
|
#if IMX233_SUBTARGET >= 3700
|
||||||
|
|
@ -108,10 +126,8 @@ void imx233_chip_reset(void)
|
||||||
|
|
||||||
void system_reboot(void)
|
void system_reboot(void)
|
||||||
{
|
{
|
||||||
backlight_hw_off();
|
imx233_system_prepare_shutdown();
|
||||||
|
/* reset */
|
||||||
disable_irq();
|
|
||||||
|
|
||||||
imx233_chip_reset();
|
imx233_chip_reset();
|
||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,10 @@
|
||||||
#define CPUFREQ_SLEEP IMX233_CPUFREQ_64_MHz
|
#define CPUFREQ_SLEEP IMX233_CPUFREQ_64_MHz
|
||||||
|
|
||||||
void system_prepare_fw_start(void);
|
void system_prepare_fw_start(void);
|
||||||
|
void imx233_system_prepare_shutdown(void);
|
||||||
void udelay(unsigned us);
|
void udelay(unsigned us);
|
||||||
bool imx233_us_elapsed(uint32_t ref, unsigned us_delay);
|
bool imx233_us_elapsed(uint32_t ref, unsigned us_delay);
|
||||||
void imx233_reset_block(volatile uint32_t *block_reg);
|
void imx233_reset_block(volatile uint32_t *block_reg);
|
||||||
void power_off(void);
|
|
||||||
void imx233_enable_usb_controller(bool enable);
|
void imx233_enable_usb_controller(bool enable);
|
||||||
void imx233_enable_usb_phy(bool enable);
|
void imx233_enable_usb_phy(bool enable);
|
||||||
// NOTE: this is available even if HAVE_ADJUSTABLE_CPU_FREQ is undef
|
// NOTE: this is available even if HAVE_ADJUSTABLE_CPU_FREQ is undef
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue