[PATCH] [3.3] ARM: tegra: emc: max rate based on emc table

Olof Johansson olof at lixom.net
Tue Oct 18 14:14:54 EDT 2011


Update max rate for emc clock based on configured EMC timings,
but by default leave it at the same rate that firmware configured.

Also update the shared clocks accordingly.

This patch was based on work by Danny Huang <dahuang at nvidia.com>.

Signed-off-by: Olof Johansson <olof at lixom.net>
---
 arch/arm/mach-tegra/tegra2_emc.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c
index 0f7ae6e..bed7e74 100644
--- a/arch/arm/mach-tegra/tegra2_emc.c
+++ b/arch/arm/mach-tegra/tegra2_emc.c
@@ -23,6 +23,7 @@
 
 #include <mach/iomap.h>
 
+#include "clock.h"
 #include "tegra2_emc.h"
 
 #ifdef CONFIG_TEGRA_EMC_SCALING_ENABLE
@@ -173,6 +174,24 @@ int tegra_emc_set_rate(unsigned long rate)
 
 void tegra_init_emc(const struct tegra_emc_table *table, int table_size)
 {
+	struct clk *c = clk_get_sys("emc", NULL);
+	struct clk *user;
+	unsigned long max = 0;
+	int i;
+
+	/* Since default max_rate on emc clock is the same as firmware set
+	 * it to before booting, raise it up here based on known timings.
+	 */
+
+	for (i = 0; i < table_size; i++)
+		if (table[i].rate > max)
+			max = table[i].rate;
+
 	tegra_emc_table = table;
 	tegra_emc_table_size = table_size;
+
+	c->max_rate = max * 2 * 1000;
+
+	list_for_each_entry(user, &c->shared_bus_list, u.shared_bus_user.node)
+		user->max_rate = c->max_rate;
 }
-- 
1.7.4.1




More information about the linux-arm-kernel mailing list