From: Akshay Saraswat <aksha...@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 <aksha...@samsung.com>
Acked-by: Simon Glass <s...@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(-)

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
-- 
1.7.2.3

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to