Patchwork [U-Boot,1/4] EXYNOS: Add API for power reset and exit wakeup

login
register
mail settings
Submitter Rajeshwari Birje
Date April 25, 2013, 5:57 a.m.
Message ID <1366869439-9695-2-git-send-email-rajeshwari.s@samsung.com>
Download mbox | patch
Permalink /patch/239398/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Rajeshwari Birje - April 25, 2013, 5:57 a.m.
This patch adds APIs to get power reset status and exit the wakeup condition for
both exynos5 and exynos4

Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
 arch/arm/cpu/armv7/exynos/power.c        |   50 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/power.h |   10 ++++++
 2 files changed, 60 insertions(+), 0 deletions(-)
Simon Glass - May 11, 2013, 6:22 p.m.
Hi Rajeshwari,

On Wed, Apr 24, 2013 at 11:57 PM, Rajeshwari Shinde
<rajeshwari.s@samsung.com> wrote:
> This patch adds APIs to get power reset status and exit the wakeup condition for
> both exynos5 and exynos4
>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> ---
>  arch/arm/cpu/armv7/exynos/power.c        |   50 ++++++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-exynos/power.h |   10 ++++++
>  2 files changed, 60 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
> index 6375a81..5d3bda2 100644
> --- a/arch/arm/cpu/armv7/exynos/power.c
> +++ b/arch/arm/cpu/armv7/exynos/power.c
> @@ -140,3 +140,53 @@ void set_hw_thermal_trip(void)
>                 setbits_le32(&power->ps_hold_control, POWER_ENABLE_HW_TRIP);
>         }
>  }
> +
> +static uint32_t exynos5_get_reset_status(void)
> +{
> +       struct exynos5_power *power =
> +               (struct exynos5_power *)samsung_get_base_power();
> +
> +       return power->inform1;
> +}
> +
> +static uint32_t exynos4_get_reset_status(void)
> +{
> +       struct exynos4_power *power =
> +               (struct exynos4_power *)samsung_get_base_power();
> +
> +       return power->inform1;
> +}
> +
> +uint32_t get_reset_status(void)
> +{
> +       if (cpu_is_exynos5())
> +               return exynos5_get_reset_status();
> +       else
> +               return  exynos4_get_reset_status();
> +}
> +
> +static void exynos5_power_exit_wakeup(void)
> +{
> +       struct exynos5_power *power =
> +               (struct exynos5_power *)samsung_get_base_power();
> +       typedef void (*resume_func)(void);
> +
> +       ((resume_func)power->inform0)();
> +}
> +
> +static void exynos4_power_exit_wakeup(void)
> +{
> +       struct exynos4_power *power =
> +               (struct exynos4_power *)samsung_get_base_power();
> +       typedef void (*resume_func)(void);
> +
> +       ((resume_func)power->inform0)();
> +}
> +
> +void power_exit_wakeup(void)
> +{
> +       if (cpu_is_exynos5())
> +               exynos5_power_exit_wakeup();
> +       else
> +               exynos4_power_exit_wakeup();
> +}
> diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
> index 3549667..98e1144 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);
> +
> +/*
> + *  Read inform1 to get the reset status

Please can you expand this comment? What values are returned? Do you
have an enum that can be used to decode the values?

> + */
> +uint32_t get_reset_status(void);
> +
> +/*
> + *  Read the resume function and call it
> + */
> +void power_exit_wakeup(void);
>  #endif
> --
> 1.7.4.4
>

Regards,
Simon

Patch

diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
index 6375a81..5d3bda2 100644
--- a/arch/arm/cpu/armv7/exynos/power.c
+++ b/arch/arm/cpu/armv7/exynos/power.c
@@ -140,3 +140,53 @@  void set_hw_thermal_trip(void)
 		setbits_le32(&power->ps_hold_control, POWER_ENABLE_HW_TRIP);
 	}
 }
+
+static uint32_t exynos5_get_reset_status(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+
+	return power->inform1;
+}
+
+static uint32_t exynos4_get_reset_status(void)
+{
+	struct exynos4_power *power =
+		(struct exynos4_power *)samsung_get_base_power();
+
+	return power->inform1;
+}
+
+uint32_t get_reset_status(void)
+{
+	if (cpu_is_exynos5())
+		return exynos5_get_reset_status();
+	else
+		return  exynos4_get_reset_status();
+}
+
+static void exynos5_power_exit_wakeup(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+	typedef void (*resume_func)(void);
+
+	((resume_func)power->inform0)();
+}
+
+static void exynos4_power_exit_wakeup(void)
+{
+	struct exynos4_power *power =
+		(struct exynos4_power *)samsung_get_base_power();
+	typedef void (*resume_func)(void);
+
+	((resume_func)power->inform0)();
+}
+
+void power_exit_wakeup(void)
+{
+	if (cpu_is_exynos5())
+		exynos5_power_exit_wakeup();
+	else
+		exynos4_power_exit_wakeup();
+}
diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
index 3549667..98e1144 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);
+
+/*
+ *  Read inform1 to get the reset status
+ */
+uint32_t get_reset_status(void);
+
+/*
+ *  Read the resume function and call it
+ */
+void power_exit_wakeup(void);
 #endif