Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssvb/ba01a221603d9719e2f5 to your computer and use it in GitHub Desktop.
Save ssvb/ba01a221603d9719e2f5 to your computer and use it in GitHub Desktop.
Patch for U-Boot to allow access to RTC clock from non-secure mode on Allwinner A31s to fix /dev/rtc in Linux
diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index f01846e..cd06c72 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -106,6 +106,10 @@ void s_init(void)
* access gets messed up (seems cache related) */
setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800);
#endif
+#if defined CONFIG_MACH_SUN6I
+ /* Allow access to RTC clock from non-secure mode */
+ writel(2, SUNXI_TZPC_BASE + 0x8);
+#endif
#if defined CONFIG_MACH_SUN6I || \
defined CONFIG_MACH_SUN7I || \
defined CONFIG_MACH_SUN8I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment