Patchwork [U-Boot,5/8,v2] EXYNOS5: TMU: Add TMU status polling

login
register
mail settings
Submitter Hatim RV
Date Nov. 7, 2012, 1:08 p.m.
Message ID <1352293728-9958-6-git-send-email-hatim.rv@samsung.com>
Download mbox | patch
Permalink /patch/197667/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Hatim RV - Nov. 7, 2012, 1:08 p.m.
From: Akshay Saraswat <akshay.s@samsung.com>

This adds call to tmu_init() and TMU status polling in board_poll_devices()
funtion to monitor temperature change of the SOC.

Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
Changes since v1:
	- Removed debug print under TMU_STATUS_NORMAL case
	- Added Acked-by: Simon Glass

 board/samsung/smdk5250/smdk5250.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

Patch

diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
index ac7346d..db2457b 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -32,15 +32,51 @@ 
 #include <asm/arch/pinmux.h>
 #include <asm/arch/sromc.h>
 #include <pmic.h>
+#include <tmu.h>
+#include <asm/arch/exynos-tmu.h>
+#include <asm/arch/power.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * Polling various devices on board for details and status monitoring purposes
+ */
+void board_poll_devices(void)
+{
+#if defined CONFIG_EXYNOS_TMU
+	int temp;
+
+	switch (tmu_monitor(&temp)) {
+	case TMU_STATUS_TRIPPED:
+		puts("EXYNOS_TMU: TRIPPING! Device power going down ...\n");
+		power_shutdown();
+		break;
+	case TMU_STATUS_WARNING:
+		puts("EXYNOS_TMU: WARNING! Temperature very high\n");
+		break;
+	case TMU_STATUS_INIT:
+	case TMU_STATUS_NORMAL:
+		break;
+	default:
+		debug("Unknown TMU state\n");
+	}
+#endif
+}
+
 int board_init(void)
 {
 	gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
 #if defined(CONFIG_PMIC)
 	pmic_init();
 #endif
+
+#if defined CONFIG_EXYNOS_TMU
+	if (tmu_init(gd->fdt_blob)) {
+		debug("%s: Failed to init TMU\n", __func__);
+		return -1;
+	}
+#endif
+
 #ifdef CONFIG_EXYNOS_SPI
 	spi_init();
 #endif