From: Minkyu Kang <mk7.kang@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 8/9 v9] EXYNOS5: TMU: Add hardware tripping
Date: Wed, 20 Feb 2013 17:46:19 +0900 [thread overview]
Message-ID: <51248D5B.2060306@samsung.com> (raw)
In-Reply-To: <1360156726-13315-9-git-send-email-akshay.s@samsung.com>
Dear Akshay,
On 06/02/13 22:18, Akshay Saraswat wrote:
> This adds hardware tripping at 110 degrees celsius which must enable
> forced system shutdown in case TMU fails to power off.
>
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
> Acked-by: Simon Glass <sjg@chromium.org>
> ---
> Changes since v8:
> - None.
>
> arch/arm/cpu/armv7/exynos/power.c | 10 ++++++++++
> arch/arm/include/asm/arch-exynos/power.h | 5 +++++
> drivers/power/exynos-tmu.c | 25 ++++++++++++++++++++-----
> 3 files changed, 35 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
> index 73f764e..234c9f4 100644
> --- a/arch/arm/cpu/armv7/exynos/power.c
> +++ b/arch/arm/cpu/armv7/exynos/power.c
> @@ -96,6 +96,16 @@ void set_dp_phy_ctrl(unsigned int enable)
> exynos5_dp_phy_control(enable);
> }
>
> +/* Enables hardware tripping to power off the system when TMU fails */
> +void power_enable_hw_thermal_trip(void)
please change function name to set_hw_thermal_trip.
and this function should consider exynos4 also.
please refer other functions.
> +{
> + struct exynos5_power *power =
> + (struct exynos5_power *)samsung_get_base_power();
> +
> + /* PS_HOLD_CONTROL register ENABLE_HW_TRIP bit*/
> + setbits_le32(&power->ps_hold_control, POWER_ENABLE_HW_TRIP);
> +}
> +
> /*
> * This function never returns.
> * When called this function makes system hang and PAD driving value high
> diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
> index 7463036..034774f 100644
> --- a/arch/arm/include/asm/arch-exynos/power.h
> +++ b/arch/arm/include/asm/arch-exynos/power.h
> @@ -857,6 +857,9 @@ void set_mipi_phy_ctrl(unsigned int dev_index, unsigned int enable);
>
> void set_usbhost_phy_ctrl(unsigned int enable);
>
> +/* Enables hardware tripping to power off the system when TMU fails */
> +void power_enable_hw_thermal_trip(void);
> +
> #define POWER_USB_HOST_PHY_CTRL_EN (1 << 0)
> #define POWER_USB_HOST_PHY_CTRL_DISABLE (0 << 0)
>
> @@ -864,5 +867,7 @@ void set_dp_phy_ctrl(unsigned int enable);
>
> #define EXYNOS_DP_PHY_ENABLE (1 << 0)
> #define POWER_PS_HOLD_CONTROL_DATA_HIGH (1 << 8)
> +#define POWER_ENABLE_HW_TRIP (1UL << 31)
> +
please remove extra space.
>
> #endif
> diff --git a/drivers/power/exynos-tmu.c b/drivers/power/exynos-tmu.c
> index b010883..5885ce7 100644
> --- a/drivers/power/exynos-tmu.c
> +++ b/drivers/power/exynos-tmu.c
> @@ -22,9 +22,11 @@
> #include <fdtdec.h>
> #include <tmu.h>
> #include <asm/arch/exynos-tmu.h>
> +#include <asm/arch/power.h>
>
> #define TRIMINFO_RELOAD 1
> #define CORE_EN 1
> +#define THERM_TRIP_EN (1 << 12)
>
> #define INTEN_RISE0 1
> #define INTEN_RISE1 (1 << 4)
> @@ -55,6 +57,8 @@ struct temperature_params {
> unsigned int start_warning;
> /* temperature threshold CPU tripping */
> unsigned int start_tripping;
> + /* temperature threshold for HW tripping */
> + unsigned int hardware_tripping;
> };
>
> /* Pre-defined values and thresholds for calibration of current temperature */
> @@ -195,6 +199,9 @@ int get_tmu_fdt_values(struct tmu_info *info, const void *blob)
> info->data.ts.start_tripping = fdtdec_get_int(blob,
> node, "samsung,start-tripping", -1);
> error |= info->data.ts.start_tripping;
> + info->data.ts.hardware_tripping = fdtdec_get_int(blob,
> + node, "samsung,hw-tripping", -1);
> + error |= info->data.ts.hardware_tripping;
> info->data.efuse_min_value = fdtdec_get_int(blob,
> node, "samsung,efuse-min-value", -1);
> error |= info->data.efuse_min_value;
> @@ -228,7 +235,7 @@ int get_tmu_fdt_values(struct tmu_info *info, const void *blob)
> void tmu_setup_parameters(struct tmu_info *info)
> {
> unsigned int te_code, con;
> - unsigned int warning_code, trip_code;
> + unsigned int warning_code, trip_code, hwtrip_code;
> unsigned int cooling_temp;
> unsigned int rising_value;
> struct tmu_data *data = &info->data;
> @@ -252,9 +259,14 @@ void tmu_setup_parameters(struct tmu_info *info)
> + info->te1 - info->dc_value;
> trip_code = data->ts.start_tripping
> + info->te1 - info->dc_value;
> + hwtrip_code = data->ts.hardware_tripping
> + + info->te1 - info->dc_value;
> +
> cooling_temp = 0;
>
> - rising_value = ((warning_code << 8) | (trip_code << 16));
> + rising_value = ((warning_code << 8) |
> + (trip_code << 16) |
> + (hwtrip_code << 24));
>
> /* Set interrupt level */
> writel(rising_value, ®->threshold_temp_rise);
> @@ -274,12 +286,15 @@ void tmu_setup_parameters(struct tmu_info *info)
>
> /* TMU core enable */
> con = readl(®->tmu_control);
> - con |= CORE_EN;
> + con |= THERM_TRIP_EN | CORE_EN;
>
> writel(con, ®->tmu_control);
>
> - /* LEV0 LEV1 LEV2 interrupt enable */
> - writel(INTEN_RISE0 | INTEN_RISE1 | INTEN_RISE2, ®->inten);
> + /* Enable HW thermal trip */
> + power_enable_hw_thermal_trip();
> +
> + /* LEV1 LEV2 interrupt enable */
> + writel(INTEN_RISE1 | INTEN_RISE2, ®->inten);
> }
>
> /*
>
Thanks,
Minkyu Kang.
next prev parent reply other threads:[~2013-02-20 8:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-06 13:18 [U-Boot] [PATCH 0/9 v9] Add TMU support for Exynos5250 based SMDK5250 Akshay Saraswat
2013-02-06 13:18 ` [U-Boot] [PATCH 1/9 v9] EXYNOS5: TMU: Add driver for Thermal Management Unit Akshay Saraswat
2013-02-20 8:36 ` Minkyu Kang
2013-02-06 13:18 ` [U-Boot] [PATCH 2/9 v9] EXYNOS5: Implement board_poweroff " Akshay Saraswat
2013-02-20 8:38 ` Minkyu Kang
2013-02-06 13:18 ` [U-Boot] [PATCH 3/9 v9] EXYNOS5: FDT: Add TMU device node values Akshay Saraswat
2013-02-06 13:18 ` [U-Boot] [PATCH 4/9 v9] EXYNOS5: TMU: Add TMU init and status check Akshay Saraswat
2013-02-20 8:41 ` Minkyu Kang
2013-02-06 13:18 ` [U-Boot] [PATCH 5/9 v9] EXYNOS5: Config: Enable support for Exynos TMU driver Akshay Saraswat
2013-02-06 13:18 ` [U-Boot] [PATCH 6/9 v9] TMU: Add TMU support in dtt command Akshay Saraswat
2013-02-06 16:36 ` Simon Glass
2013-02-06 13:18 ` [U-Boot] [PATCH 7/9 v9] EXYNOS5: Config: Enable dtt command for TMU Akshay Saraswat
2013-02-06 13:18 ` [U-Boot] [PATCH 8/9 v9] EXYNOS5: TMU: Add hardware tripping Akshay Saraswat
2013-02-20 8:46 ` Minkyu Kang [this message]
2013-02-06 13:18 ` [U-Boot] [PATCH 9/9 v9] EXYNOS5: FDT: Add a H/W-trip member to TMU node Akshay Saraswat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51248D5B.2060306@samsung.com \
--to=mk7.kang@samsung.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox