mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 05:35:02 -05:00
Creative ZEN: fix RTC regression
Creative ZEN lost it's time when shutting down. The bug was introduced with commit7f282b9280(g#2601), followed bye3f6e9d9f6(g#2616). I guarded all persistent register writes with wait loops, as described in the datasheet. TODO: test SONY_NWZE360 and SONY_NWZE370 targets Change-Id: Ib38ab8691fd1c6e8d0771c1e2eca20dfeb6fc87f
This commit is contained in:
parent
69bc230e7d
commit
297af3a483
2 changed files with 13 additions and 2 deletions
|
|
@ -28,8 +28,8 @@
|
||||||
|
|
||||||
#define YEAR1980 315532800 /* 1980/1/1 00:00:00 in UTC */
|
#define YEAR1980 315532800 /* 1980/1/1 00:00:00 in UTC */
|
||||||
|
|
||||||
#if defined(SANSA_FUZEPLUS) || defined(CREATIVE_ZENXFI3) || defined(SONY_NWZE360) || \
|
#if defined(SANSA_FUZEPLUS) || defined(SONY_NWZE360) || defined(SONY_NWZE370) || \
|
||||||
defined(SONY_NWZE370)
|
defined(CREATIVE_ZENXFI2) || defined(CREATIVE_ZENXFI3)
|
||||||
#define USE_PERSISTENT
|
#define USE_PERSISTENT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,21 @@ static inline void imx233_rtc_init(void)
|
||||||
BF_CLR(RTC_CTRL, SFTRST);
|
BF_CLR(RTC_CTRL, SFTRST);
|
||||||
udelay(5); /* only need 3 GPMI clocks (1us) */
|
udelay(5); /* only need 3 GPMI clocks (1us) */
|
||||||
BF_CLR(RTC_CTRL, CLKGATE);
|
BF_CLR(RTC_CTRL, CLKGATE);
|
||||||
|
#if defined(SANSA_FUZEPLUS)
|
||||||
#ifdef BM_RTC_PERSISTENT0_DISABLE_XTALOK
|
#ifdef BM_RTC_PERSISTENT0_DISABLE_XTALOK
|
||||||
|
while (BF_RD(RTC_STAT, NEW_REGS)!=0) {};
|
||||||
BF_SET(RTC_PERSISTENT0, XTAL24MHZ_PWRUP, DISABLE_XTALOK);
|
BF_SET(RTC_PERSISTENT0, XTAL24MHZ_PWRUP, DISABLE_XTALOK);
|
||||||
#endif
|
#endif
|
||||||
|
while (BF_RD(RTC_STAT, NEW_REGS)!=0) {};
|
||||||
BF_CLR(RTC_PERSISTENT0, CLOCKSOURCE);
|
BF_CLR(RTC_PERSISTENT0, CLOCKSOURCE);
|
||||||
|
#else
|
||||||
|
/* confirmed for CREATIVE_ZEN and CREATIVE_ZENXFI2 */
|
||||||
|
/* FIXME: test SONY_NWZE360 and SONY_NWZE370 targets */
|
||||||
|
while (BF_RD(RTC_STAT, NEW_REGS)!=0) {};
|
||||||
|
BF_SET(RTC_PERSISTENT0, XTAL32KHZ_PWRUP, CLOCKSOURCE);
|
||||||
|
while (BF_RD(RTC_STAT, NEW_REGS)!=0) {};
|
||||||
|
BF_CLR(RTC_PERSISTENT0, XTAL24MHZ_PWRUP, DISABLE_XTALOK);
|
||||||
|
#endif
|
||||||
imx233_rtc_enable_watchdog(false);
|
imx233_rtc_enable_watchdog(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue