Patchwork [U-Boot,3/4,v2] smdk5250: enable support for tmu throttling

login
register
mail settings
Submitter Akshay Saraswat
Date May 13, 2013, 5:19 a.m.
Message ID <1368422356-9227-4-git-send-email-akshay.s@samsung.com>
Download mbox | patch
Permalink /patch/243268/
State New
Delegated to: Minkyu Kang
Headers show

Comments

Akshay Saraswat - May 13, 2013, 5:19 a.m.
Adding tmu throttling support to smdk5250.

Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
Changes since v1:
	- Added "Acked-by: Simon Glass".

 board/samsung/smdk5250/smdk5250.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Patch

diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
index 8b09e1d..301dcf8 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -38,6 +38,8 @@ 
 #include <power/pmic.h>
 #include <power/max77686_pmic.h>
 #include <tmu.h>
+#include <asm/arch/cpufreq.h>
+#include <asm/arch/clk.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -58,6 +60,15 @@  static void boot_temp_check(void)
 		break;
 	case TMU_STATUS_WARNING:
 		puts("EXYNOS_TMU: WARNING! Temperature very high\n");
+#ifdef CONFIG_EXYNOS_CPUFREQ
+		exynos_set_frequency(CPU_FREQ_L400);
+#endif
+		break;
+	case TMU_STATUS_NORMAL:
+#ifdef CONFIG_EXYNOS_CPUFREQ
+		if (get_pll_clk(APLL) != 1700000000)
+			exynos_set_frequency(CPU_FREQ_L1700);
+#endif
 		break;
 	/*
 	 * TMU_STATUS_INIT means something is wrong with temperature sensing
@@ -110,6 +121,13 @@  int board_init(void)
 	boot_temp_check();
 #endif
 
+#if defined CONFIG_EXYNOS_CPUFREQ
+	if (exynos_cpufreq_init()) {
+		debug("%s: Failed to init CPU frequency scaling\n", __func__);
+		return -1;
+	}
+#endif
+
 #ifdef CONFIG_EXYNOS_SPI
 	spi_init();
 #endif
@@ -119,6 +137,7 @@  int board_init(void)
 #ifdef CONFIG_SOUND_MAX98095
 	board_enable_audio_codec();
 #endif
+
 	return 0;
 }