diff mbox

EXYNOS: Add API for power reset and shutdown

Message ID 1365059165-23764-1-git-send-email-rajeshwari.s@samsung.com
State New
Headers show

Commit Message

Rajeshwari Shinde April 4, 2013, 7:06 a.m. UTC
This patch adds API's to reset and shutdown the power of
EXYNOS boards
power_shutdown: powers off the board by deasserting PS_HOLD pin.
power_reset: this function software resets the Exynos board when called.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
 arch/arm/cpu/armv7/exynos/power.c        |   31 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/power.h |   10 +++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)

Comments

Minkyu Kang June 24, 2013, 5:42 a.m. UTC | #1
Dear Rajeshwari Shinde,

On 04/04/13 16:06, Rajeshwari Shinde wrote:
> This patch adds API's to reset and shutdown the power of
> EXYNOS boards
> power_shutdown: powers off the board by deasserting PS_HOLD pin.
> power_reset: this function software resets the Exynos board when called.
> 
> Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> ---
>  arch/arm/cpu/armv7/exynos/power.c        |   31 ++++++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-exynos/power.h |   10 +++++++++
>  2 files changed, 41 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
> index 6375a81..2b65bbe 100644
> --- a/arch/arm/cpu/armv7/exynos/power.c
> +++ b/arch/arm/cpu/armv7/exynos/power.c
> @@ -113,6 +113,25 @@ void set_ps_hold_ctrl(void)
>  }
>  

I know that is not related your patch.
But, please remove blank line.

>  
> +void exynos5_power_shutdown(void)
> +{
> +	struct exynos5_power *power =
> +		(struct exynos5_power *)samsung_get_base_power();
> +
> +	clrbits_le32(&power->ps_hold_control, EXYNOS_PS_HOLD_CONTROL_DATA_HIGH);
> +}

This function is same purpose with set_ps_hold_ctrl.
So please, add it to set_ps_hold_ctrl.

> +
> +void exynos5_power_reset(void)
> +{
> +	struct exynos5_power *power =
> +		(struct exynos5_power *)samsung_get_base_power();
> +
> +	/* Clear inform1 so there's no change we think we've got a wake reset */
> +	power->inform1 = 0;
> +
> +	setbits_le32(&power->swreset, 1);
> +}
> +
>  static void exynos5_set_xclkout(void)
>  {
>  	struct exynos5_power *power =
> @@ -140,3 +159,15 @@ void set_hw_thermal_trip(void)
>  		setbits_le32(&power->ps_hold_control, POWER_ENABLE_HW_TRIP);
>  	}
>  }
> +
> +void power_shutdown(void)
> +{
> +	if (cpu_is_exynos5())
> +		exynos5_power_shutdown();
> +}
> +
> +void power_reset(void)

swreset?

> +{
> +	if (cpu_is_exynos5())
> +		exynos5_power_reset();
> +}

please move this function under the exynos5_power_reset.
or move exynos5_power_reset to here.

> diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
> index 3549667..6844e0f 100644
> --- a/arch/arm/include/asm/arch-exynos/power.h
> +++ b/arch/arm/include/asm/arch-exynos/power.h
> @@ -888,4 +888,14 @@ void set_ps_hold_ctrl(void);
>   * source as XXTI
>   */
>  void set_xclkout(void);
> +
> +/*
> + * Power off the system; it should never return.
> + */
> +void power_shutdown(void);
> +
> +/*
> + * Perform a software reset.
> + */

please check comment rule.
One line comment should be.. /* .... */

> +void power_reset(void);
>  #endif
> 

Thanks,
Minkyu Kang.
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
index 6375a81..2b65bbe 100644
--- a/arch/arm/cpu/armv7/exynos/power.c
+++ b/arch/arm/cpu/armv7/exynos/power.c
@@ -113,6 +113,25 @@  void set_ps_hold_ctrl(void)
 }
 
 
+void exynos5_power_shutdown(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+
+	clrbits_le32(&power->ps_hold_control, EXYNOS_PS_HOLD_CONTROL_DATA_HIGH);
+}
+
+void exynos5_power_reset(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+
+	/* Clear inform1 so there's no change we think we've got a wake reset */
+	power->inform1 = 0;
+
+	setbits_le32(&power->swreset, 1);
+}
+
 static void exynos5_set_xclkout(void)
 {
 	struct exynos5_power *power =
@@ -140,3 +159,15 @@  void set_hw_thermal_trip(void)
 		setbits_le32(&power->ps_hold_control, POWER_ENABLE_HW_TRIP);
 	}
 }
+
+void power_shutdown(void)
+{
+	if (cpu_is_exynos5())
+		exynos5_power_shutdown();
+}
+
+void power_reset(void)
+{
+	if (cpu_is_exynos5())
+		exynos5_power_reset();
+}
diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
index 3549667..6844e0f 100644
--- a/arch/arm/include/asm/arch-exynos/power.h
+++ b/arch/arm/include/asm/arch-exynos/power.h
@@ -888,4 +888,14 @@  void set_ps_hold_ctrl(void);
  * source as XXTI
  */
 void set_xclkout(void);
+
+/*
+ * Power off the system; it should never return.
+ */
+void power_shutdown(void);
+
+/*
+ * Perform a software reset.
+ */
+void power_reset(void);
 #endif