diff mbox

[4/9] ARM: mvebu: prepare mvebu_pm_store_bootinfo() to support multiple SoCs

Message ID 1434456785-23696-5-git-send-email-thomas.petazzoni@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Petazzoni June 16, 2015, 12:13 p.m. UTC
As we are going to introduce support for Armada 38x in pm.c, split out
the Armada XP part of mvebu_pm_store_bootinfo() into
mvebu_pm_store_armadaxp_bootinfo(), and make the former retunr an
error when an unsupported SoC is used.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/pm.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

Comments

Gregory CLEMENT June 17, 2015, 4:12 p.m. UTC | #1
Hi Thomas,

On 16/06/2015 14:13, Thomas Petazzoni wrote:
> As we are going to introduce support for Armada 38x in pm.c, split out
> the Armada XP part of mvebu_pm_store_bootinfo() into
> mvebu_pm_store_armadaxp_bootinfo(), and make the former retunr an
> error when an unsupported SoC is used.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


Thanks,

Gregory

> ---
>  arch/arm/mach-mvebu/pm.c | 25 +++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/pm.c b/arch/arm/mach-mvebu/pm.c
> index eca650b..02fdf67 100644
> --- a/arch/arm/mach-mvebu/pm.c
> +++ b/arch/arm/mach-mvebu/pm.c
> @@ -105,12 +105,10 @@ static phys_addr_t mvebu_internal_reg_base(void)
>  	return of_translate_address(np, in_addr);
>  }
>  
> -static void mvebu_pm_store_bootinfo(void)
> +static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr)
>  {
> -	u32 *store_addr;
>  	phys_addr_t resume_pc;
>  
> -	store_addr = phys_to_virt(BOOT_INFO_ADDR);
>  	resume_pc = virt_to_phys(armada_370_xp_cpu_resume);
>  
>  	/*
> @@ -151,14 +149,33 @@ static void mvebu_pm_store_bootinfo(void)
>  	writel(BOOT_MAGIC_LIST_END, store_addr);
>  }
>  
> +static int mvebu_pm_store_bootinfo(void)
> +{
> +	u32 *store_addr;
> +
> +	store_addr = phys_to_virt(BOOT_INFO_ADDR);
> +
> +	if (of_machine_is_compatible("marvell,armadaxp"))
> +		mvebu_pm_store_armadaxp_bootinfo(store_addr);
> +	else
> +		return -ENODEV;
> +
> +	return 0;
> +}
> +
>  static int mvebu_pm_enter(suspend_state_t state)
>  {
> +	int ret;
> +
>  	if (state != PM_SUSPEND_MEM)
>  		return -EINVAL;
>  
> +	ret = mvebu_pm_store_bootinfo();
> +	if (ret)
> +		return ret;
> +
>  	cpu_pm_enter();
>  
> -	mvebu_pm_store_bootinfo();
>  	cpu_suspend(0, mvebu_pm_powerdown);
>  
>  	outer_resume();
>
diff mbox

Patch

diff --git a/arch/arm/mach-mvebu/pm.c b/arch/arm/mach-mvebu/pm.c
index eca650b..02fdf67 100644
--- a/arch/arm/mach-mvebu/pm.c
+++ b/arch/arm/mach-mvebu/pm.c
@@ -105,12 +105,10 @@  static phys_addr_t mvebu_internal_reg_base(void)
 	return of_translate_address(np, in_addr);
 }
 
-static void mvebu_pm_store_bootinfo(void)
+static void mvebu_pm_store_armadaxp_bootinfo(u32 *store_addr)
 {
-	u32 *store_addr;
 	phys_addr_t resume_pc;
 
-	store_addr = phys_to_virt(BOOT_INFO_ADDR);
 	resume_pc = virt_to_phys(armada_370_xp_cpu_resume);
 
 	/*
@@ -151,14 +149,33 @@  static void mvebu_pm_store_bootinfo(void)
 	writel(BOOT_MAGIC_LIST_END, store_addr);
 }
 
+static int mvebu_pm_store_bootinfo(void)
+{
+	u32 *store_addr;
+
+	store_addr = phys_to_virt(BOOT_INFO_ADDR);
+
+	if (of_machine_is_compatible("marvell,armadaxp"))
+		mvebu_pm_store_armadaxp_bootinfo(store_addr);
+	else
+		return -ENODEV;
+
+	return 0;
+}
+
 static int mvebu_pm_enter(suspend_state_t state)
 {
+	int ret;
+
 	if (state != PM_SUSPEND_MEM)
 		return -EINVAL;
 
+	ret = mvebu_pm_store_bootinfo();
+	if (ret)
+		return ret;
+
 	cpu_pm_enter();
 
-	mvebu_pm_store_bootinfo();
 	cpu_suspend(0, mvebu_pm_powerdown);
 
 	outer_resume();