summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv7/keystone/clock.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-08-29 13:47:42 -0400
committerTom Rini <trini@ti.com>2014-08-29 13:47:42 -0400
commit6defdc0b5552ab1af4a66a8abac8196cbb6b9e15 (patch)
treea9c7640fc7e771696ac134018e9aebc5b7f6c3e4 /arch/arm/cpu/armv7/keystone/clock.c
parent8f005b3918cc16bb3e8f6d7228c27d207f4c606f (diff)
parentb640b460f54caf74ce21e8797a29379a5267eb4f (diff)
downloadu-boot-imx-6defdc0b5552ab1af4a66a8abac8196cbb6b9e15.zip
u-boot-imx-6defdc0b5552ab1af4a66a8abac8196cbb6b9e15.tar.gz
u-boot-imx-6defdc0b5552ab1af4a66a8abac8196cbb6b9e15.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-ti
Diffstat (limited to 'arch/arm/cpu/armv7/keystone/clock.c')
-rw-r--r--arch/arm/cpu/armv7/keystone/clock.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/keystone/clock.c b/arch/arm/cpu/armv7/keystone/clock.c
index 03c1d9f..30d76a6 100644
--- a/arch/arm/cpu/armv7/keystone/clock.c
+++ b/arch/arm/cpu/armv7/keystone/clock.c
@@ -11,6 +11,8 @@
#include <asm/arch/clock.h>
#include <asm/arch/clock_defs.h>
+#define MAX_SPEEDS 13
+
static void wait_for_completion(const struct pll_init_data *data)
{
int i;
@@ -218,3 +220,44 @@ void init_plls(int num_pll, struct pll_init_data *config)
for (i = 0; i < num_pll; i++)
init_pll(&config[i]);
}
+
+static int get_max_speed(u32 val, int *speeds)
+{
+ int j;
+
+ if (!val)
+ return speeds[0];
+
+ for (j = 1; j < MAX_SPEEDS; j++) {
+ if (val == 1)
+ return speeds[j];
+ val >>= 1;
+ }
+
+ return SPD800;
+}
+
+#ifdef CONFIG_SOC_K2HK
+static u32 read_efuse_bootrom(void)
+{
+ return (cpu_revision() > 1) ? __raw_readl(KS2_EFUSE_BOOTROM) :
+ __raw_readl(KS2_REV1_DEVSPEED);
+}
+#else
+static inline u32 read_efuse_bootrom(void)
+{
+ return __raw_readl(KS2_EFUSE_BOOTROM);
+}
+#endif
+
+inline int get_max_dev_speed(void)
+{
+ return get_max_speed(read_efuse_bootrom() & 0xffff, dev_speeds);
+}
+
+#ifndef CONFIG_SOC_K2E
+inline int get_max_arm_speed(void)
+{
+ return get_max_speed((read_efuse_bootrom() >> 16) & 0xffff, arm_speeds);
+}
+#endif