Patchwork [U-Boot,3/8] EXYNOS5: Power down API for Thermal Management Unit

login
register
mail settings
Submitter Hatim RV
Date Dec. 11, 2012, 10:54 a.m.
Message ID <1355223289-15685-4-git-send-email-hatim.rv@samsung.com>
Download mbox | patch
Permalink /patch/205165/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Hatim RV - Dec. 11, 2012, 10:54 a.m.
From: Akshay Saraswat <akshay.s@samsung.com>

Adding API in power for system shutdown when tripping value is reached
in Exynos Thermal Management Unit.

Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Wolfgang Denk - Dec. 11, 2012, 12:43 p.m.
Dear Hatim Ali,

In message <1355223289-15685-4-git-send-email-hatim.rv@samsung.com> you wrote:
> From: Akshay Saraswat <akshay.s@samsung.com>
> 
> Adding API in power for system shutdown when tripping value is reached
> in Exynos Thermal Management Unit.
> 
> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
> Acked-by: Simon Glass <sjg@chromium.org>

If we add something like this, it should be general enough to be used
by other systems as well, i. e. please chose a generic API like plain
poweroff() or similar.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Chapter 1 -- The story so  far:
In the beginning the Universe was created. This has  made  a  lot  of
people very angry and been widely regarded as a bad move.
Simon Glass - Dec. 12, 2012, 2 p.m.
Hi Hatim,

On Tue, Dec 11, 2012 at 4:43 AM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Hatim Ali,
>
> In message <1355223289-15685-4-git-send-email-hatim.rv@samsung.com> you wrote:
>> From: Akshay Saraswat <akshay.s@samsung.com>
>>
>> Adding API in power for system shutdown when tripping value is reached
>> in Exynos Thermal Management Unit.
>>
>> Signed-off-by: Akshay Saraswat <akshay.s@samsung.com>
>> Acked-by: Simon Glass <sjg@chromium.org>
>
> If we add something like this, it should be general enough to be used
> by other systems as well, i. e. please chose a generic API like plain
> poweroff() or similar.

Maybe rename the function and move to a new include/power.h header,
with the implementation staying where it is?

Regards,
Simon

>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
> Chapter 1 -- The story so  far:
> In the beginning the Universe was created. This has  made  a  lot  of
> people very angry and been widely regarded as a bad move.
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Wolfgang Denk - Dec. 12, 2012, 8:27 p.m.
Dear Simon Glass,

In message <CAPnjgZ0Biqyy-k0RBrLomKqFK6pC1rJvGTMBLuvp3wr9USsUOw@mail.gmail.com> you wrote:
> 
> > If we add something like this, it should be general enough to be used
> > by other systems as well, i. e. please chose a generic API like plain
> > poweroff() or similar.
> 
> Maybe rename the function and move to a new include/power.h header,
> with the implementation staying where it is?

Assuming there is no common code to be expected, yes.

Best regards,

Wolfgang Denk

Patch

diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
index d4bce6d..725c2d3 100644
--- a/arch/arm/cpu/armv7/exynos/power.c
+++ b/arch/arm/cpu/armv7/exynos/power.c
@@ -95,3 +95,18 @@  void set_dp_phy_ctrl(unsigned int enable)
 	if (cpu_is_exynos5())
 		exynos5_dp_phy_control(enable);
 }
+
+/*
+ * This function never returns.
+ * When called this function makes system hang and PAD driving value high
+ * which in turn makes system power down in case of cold reboot.
+ */
+void power_shutdown(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+
+	clrbits_le32(&power->ps_hold_control, POWER_PS_HOLD_CONTROL_DATA_HIGH);
+
+	hang();
+}
diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
index d2fdb59..f069a0b 100644
--- a/arch/arm/include/asm/arch-exynos/power.h
+++ b/arch/arm/include/asm/arch-exynos/power.h
@@ -863,5 +863,13 @@  void set_usbhost_phy_ctrl(unsigned int enable);
 void set_dp_phy_ctrl(unsigned int enable);
 
 #define EXYNOS_DP_PHY_ENABLE		(1 << 0)
+#define POWER_PS_HOLD_CONTROL_DATA_HIGH         (1 << 8)
+
+/*
+ * This function never returns.
+ * When called this function makes system hang and PAD driving value high
+ * which in turn makes system power down in case of cold reboot.
+ */
+void power_shutdown(void) __attribute__ ((noreturn));
 
 #endif