Patchwork [U-Boot,4/7,v5] EXYNOS5: TMU: Add TMU init and status check

login
register
mail settings
Submitter Akshay Saraswat
Date Jan. 21, 2013, 11:11 a.m.
Message ID <1358766705-2118-5-git-send-email-akshay.s@samsung.com>
Download mbox | patch
Permalink /patch/214118/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Akshay Saraswat - Jan. 21, 2013, 11:11 a.m.
This adds call to tmu_init() and TMU boot time analysis
for the SoC temperature threshold breach.

Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
---
Changes since v4:
	- Replaced board polling with initial SoC temperature analysis for any possible threshold breach. 

 board/samsung/smdk5250/smdk5250.c |   35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
Simon Glass - Jan. 22, 2013, 8:45 p.m.
On Mon, Jan 21, 2013 at 3:11 AM, Akshay Saraswat <akshay.s@samsung.com> wrote:
> This adds call to tmu_init() and TMU boot time analysis
> for the SoC temperature threshold breach.
>
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>

Acked-by: Simon Glass <sjg@chromium.org>

> ---
> Changes since v4:
>         - Replaced board polling with initial SoC temperature analysis for any possible threshold breach.
>
>  board/samsung/smdk5250/smdk5250.c |   35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
> index 7a5f132..7b9a8c5 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -35,9 +35,35 @@
>  #include <asm/arch/sromc.h>
>  #include <asm/arch/dp_info.h>
>  #include <power/pmic.h>
> +#include <tmu.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> +#if defined CONFIG_EXYNOS_TMU
> +/*
> + * Boot Time Thermal Analysis for SoC temperature threshold breach
> + */
> +void boot_temp_check(void)
> +{
> +       int temp;
> +
> +       switch (tmu_monitor(&temp)) {
> +       case TMU_STATUS_TRIPPED:
> +               puts("EXYNOS_TMU: TRIPPING! Device power going down ...\n");
> +               board_poweroff();
> +               break;
> +       case TMU_STATUS_WARNING:
> +               puts("EXYNOS_TMU: WARNING! Temperature very high\n");
> +               break;
> +       case TMU_STATUS_NORMAL:
> +               break;
> +       case TMU_STATUS_INIT:
> +       default:
> +               debug("Unknown TMU state\n");
> +       }
> +}
> +#endif
> +
>  #ifdef CONFIG_USB_EHCI_EXYNOS
>  int board_usb_vbus_init(void)
>  {
> @@ -57,6 +83,15 @@ int board_usb_vbus_init(void)
>  int board_init(void)
>  {
>         gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
> +
> +#if defined CONFIG_EXYNOS_TMU
> +       if (tmu_init(gd->fdt_blob)) {
> +               debug("%s: Failed to init TMU\n", __func__);
> +               return -1;
> +       }
> +       boot_temp_check();
> +#endif
> +
>  #ifdef CONFIG_EXYNOS_SPI
>         spi_init();
>  #endif
> --
> 1.7.9.5
>

Patch

diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
index 7a5f132..7b9a8c5 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -35,9 +35,35 @@ 
 #include <asm/arch/sromc.h>
 #include <asm/arch/dp_info.h>
 #include <power/pmic.h>
+#include <tmu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if defined CONFIG_EXYNOS_TMU
+/*
+ * Boot Time Thermal Analysis for SoC temperature threshold breach
+ */
+void boot_temp_check(void)
+{
+	int temp;
+
+	switch (tmu_monitor(&temp)) {
+	case TMU_STATUS_TRIPPED:
+		puts("EXYNOS_TMU: TRIPPING! Device power going down ...\n");
+		board_poweroff();
+		break;
+	case TMU_STATUS_WARNING:
+		puts("EXYNOS_TMU: WARNING! Temperature very high\n");
+		break;
+	case TMU_STATUS_NORMAL:
+		break;
+	case TMU_STATUS_INIT:
+	default:
+		debug("Unknown TMU state\n");
+	}
+}
+#endif
+
 #ifdef CONFIG_USB_EHCI_EXYNOS
 int board_usb_vbus_init(void)
 {
@@ -57,6 +83,15 @@  int board_usb_vbus_init(void)
 int board_init(void)
 {
 	gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
+
+#if defined CONFIG_EXYNOS_TMU
+	if (tmu_init(gd->fdt_blob)) {
+		debug("%s: Failed to init TMU\n", __func__);
+		return -1;
+	}
+	boot_temp_check();
+#endif
+
 #ifdef CONFIG_EXYNOS_SPI
 	spi_init();
 #endif