diff mbox

[1/4,V2] EXYNOS: Add functions for power initialisation

Message ID 1357564126-13275-2-git-send-email-rajeshwari.s@samsung.com
State New
Headers show

Commit Message

Rajeshwari Shinde Jan. 7, 2013, 1:08 p.m. UTC
This patch adds functions to intialsise power registers during
spl boot.

Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
Changes in V2:
	- Moved from second patch to first patch
	- Renamed ps_hold_setup to power_ps_hold_setup
	- Added explanation before each power function definition
 arch/arm/cpu/armv7/exynos/power.c        |   27 +++++++++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/power.h |   10 ++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)

Comments

Simon Glass Jan. 10, 2013, 5:26 p.m. UTC | #1
Hi Rajeshwari,

On Mon, Jan 7, 2013 at 5:08 AM, Rajeshwari Shinde
<rajeshwari.s@samsung.com> wrote:
> This patch adds functions to intialsise power registers during
> spl boot.
>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> ---
> Changes in V2:
>         - Moved from second patch to first patch
>         - Renamed ps_hold_setup to power_ps_hold_setup
>         - Added explanation before each power function definition
>  arch/arm/cpu/armv7/exynos/power.c        |   27 +++++++++++++++++++++++++++
>  arch/arm/include/asm/arch-exynos/power.h |   10 ++++++++++
>  2 files changed, 37 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
> index d4bce6d..f0c107c 100644
> --- a/arch/arm/cpu/armv7/exynos/power.c
> +++ b/arch/arm/cpu/armv7/exynos/power.c
> @@ -95,3 +95,30 @@ void set_dp_phy_ctrl(unsigned int enable)
>         if (cpu_is_exynos5())
>                 exynos5_dp_phy_control(enable);
>  }
> +
> +uint32_t power_read_reset_status(void)
> +{
> +       struct exynos5_power *power =
> +               (struct exynos5_power *)samsung_get_base_power();
> +
> +       return power->inform1;
> +}
> +
> +void power_ps_hold_setup(void)
> +{
> +       struct exynos5_power *power =
> +               (struct exynos5_power *)samsung_get_base_power();
> +
> +       /* Set PS-Hold high */
> +       setbits_le32(&power->ps_hold_control,
> +                       EXYNOS_PS_HOLD_CONTROL_DATA_HIGH);
> +}
> +
> +void power_exit_wakeup(void)
> +{
> +       struct exynos5_power *power =
> +               (struct exynos5_power *)samsung_get_base_power();
> +       typedef void (*resume_func)(void);
> +
> +       ((resume_func)power->inform0)();
> +}
> diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
> index d2fdb59..f6d0278 100644
> --- a/arch/arm/include/asm/arch-exynos/power.h
> +++ b/arch/arm/include/asm/arch-exynos/power.h
> @@ -864,4 +864,14 @@ void set_dp_phy_ctrl(unsigned int enable);
>
>  #define EXYNOS_DP_PHY_ENABLE           (1 << 0)
>
> +#define EXYNOS_PS_HOLD_CONTROL_DATA_HIGH       (1 << 8)
> +
> +/* Read inform1 to get the reset status */
> +uint32_t power_read_reset_status(void);
> +
> +/*Set ps_hold data drving value high */

driving

While you are there I suggest you add that this enables the machine to
stay powered on after the initial power-on condition goes away (e.g.
power button).

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

Regards,
Simon
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/exynos/power.c b/arch/arm/cpu/armv7/exynos/power.c
index d4bce6d..f0c107c 100644
--- a/arch/arm/cpu/armv7/exynos/power.c
+++ b/arch/arm/cpu/armv7/exynos/power.c
@@ -95,3 +95,30 @@  void set_dp_phy_ctrl(unsigned int enable)
 	if (cpu_is_exynos5())
 		exynos5_dp_phy_control(enable);
 }
+
+uint32_t power_read_reset_status(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+
+	return power->inform1;
+}
+
+void power_ps_hold_setup(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+
+	/* Set PS-Hold high */
+	setbits_le32(&power->ps_hold_control,
+			EXYNOS_PS_HOLD_CONTROL_DATA_HIGH);
+}
+
+void power_exit_wakeup(void)
+{
+	struct exynos5_power *power =
+		(struct exynos5_power *)samsung_get_base_power();
+	typedef void (*resume_func)(void);
+
+	((resume_func)power->inform0)();
+}
diff --git a/arch/arm/include/asm/arch-exynos/power.h b/arch/arm/include/asm/arch-exynos/power.h
index d2fdb59..f6d0278 100644
--- a/arch/arm/include/asm/arch-exynos/power.h
+++ b/arch/arm/include/asm/arch-exynos/power.h
@@ -864,4 +864,14 @@  void set_dp_phy_ctrl(unsigned int enable);
 
 #define EXYNOS_DP_PHY_ENABLE		(1 << 0)
 
+#define EXYNOS_PS_HOLD_CONTROL_DATA_HIGH	(1 << 8)
+
+/* Read inform1 to get the reset status */
+uint32_t power_read_reset_status(void);
+
+/*Set ps_hold data drving value high */
+void power_ps_hold_setup(void);
+
+/* Read the resume function and call it */
+void power_exit_wakeup(void);
 #endif