summaryrefslogtreecommitdiff
path: root/arch/arm/mach-keystone/include/mach/hardware-k2g.h
diff options
context:
space:
mode:
authorLokesh Vutla <lokeshvutla@ti.com>2017-05-03 16:58:25 +0530
committerTom Rini <trini@konsulko.com>2017-05-08 12:34:29 -0400
commitc5f177debc8b430c0a0038a9d8f6309eb3bd6299 (patch)
tree9d81ff27bfb29af7caa78ffa3f293ed7b7463538 /arch/arm/mach-keystone/include/mach/hardware-k2g.h
parent52f030ff6977109d709f8cd297fc2d06d9cad6f4 (diff)
ARM: k2g: Add support for dynamic programming of PLL based on SYSCLK
K2G supports various sysclk frequencies which can be determined using sysboot pins. PLLs should be configured based on this sysclock frequency. Add PLL configurations for all supported sysclk frequencies. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'arch/arm/mach-keystone/include/mach/hardware-k2g.h')
-rw-r--r--arch/arm/mach-keystone/include/mach/hardware-k2g.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/mach-keystone/include/mach/hardware-k2g.h b/arch/arm/mach-keystone/include/mach/hardware-k2g.h
index 0f6bf61867..90ca1208d4 100644
--- a/arch/arm/mach-keystone/include/mach/hardware-k2g.h
+++ b/arch/arm/mach-keystone/include/mach/hardware-k2g.h
@@ -86,4 +86,25 @@
#define RSTMUX_OMODE8_INT 0x3
#define RSTMUX_OMODE8_INT_AND_DEV_RESET 0x4
+/* DEVSTAT register definition */
+#define KS2_DEVSTAT_REFCLK_SHIFT 7
+#define KS2_DEVSTAT_REFCLK_MASK (0x7 << 7)
+
+/* GPMC */
+#define KS2_GPMC_BASE 0x21818000
+
+/* SYSCLK indexes */
+#define SYSCLK_19MHz 0
+#define SYSCLK_24MHz 1
+#define SYSCLK_25MHz 2
+#define SYSCLK_26MHz 3
+#define MAX_SYSCLK 4
+
+#ifndef __ASSEMBLY__
+static inline u8 get_sysclk_index(void)
+{
+ u32 dev_stat = __raw_readl(KS2_DEVSTAT);
+ return (dev_stat & KS2_DEVSTAT_REFCLK_MASK) >> KS2_DEVSTAT_REFCLK_SHIFT;
+}
+#endif
#endif /* __ASM_ARCH_HARDWARE_K2G_H */