Skip to content

Commit

Permalink
ARM: highbank: adapt to use ARM PSCI calls
Browse files Browse the repository at this point in the history
This adapts highbank to use psci for smp_ops and the cpu_suspend function
for suspend/resume.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
  • Loading branch information
Rob Herring committed Oct 1, 2013
1 parent 97fc4de commit dd68eb0
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 144 deletions.
1 change: 1 addition & 0 deletions arch/arm/mach-highbank/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ config ARCH_HIGHBANK
select ARM_ERRATA_775420
select ARM_ERRATA_798181
select ARM_GIC
select ARM_PSCI
select ARM_TIMER_SP804
select CACHE_L2X0
select CLKDEV_LOOKUP
Expand Down
2 changes: 0 additions & 2 deletions arch/arm/mach-highbank/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ obj-y := highbank.o system.o smc.o
plus_sec := $(call as-instr,.arch_extension sec,+sec)
AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec)

obj-$(CONFIG_SMP) += platsmp.o
obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
obj-$(CONFIG_PM_SLEEP) += pm.o
4 changes: 0 additions & 4 deletions arch/arm/mach-highbank/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <linux/reboot.h>

extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
extern void highbank_restart(enum reboot_mode, const char *);
extern void __iomem *scu_base_addr;

Expand All @@ -14,8 +13,5 @@ static inline void highbank_pm_init(void) {}
#endif

extern void highbank_smc1(int fn, int arg);
extern void highbank_cpu_die(unsigned int cpu);

extern struct smp_operations highbank_smp_ops;

#endif
16 changes: 1 addition & 15 deletions arch/arm/mach-highbank/highbank.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
#include <linux/clk-provider.h>
#include <linux/platform_device.h>

#include <asm/cacheflush.h>
#include <asm/cputype.h>
#include <asm/smp_plat.h>
#include <asm/psci.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
Expand All @@ -50,17 +48,6 @@ static void __init highbank_scu_map_io(void)
scu_base_addr = ioremap(base, SZ_4K);
}

#define HB_JUMP_TABLE_PHYS(cpu) (0x40 + (0x10 * (cpu)))
#define HB_JUMP_TABLE_VIRT(cpu) phys_to_virt(HB_JUMP_TABLE_PHYS(cpu))

void highbank_set_cpu_jump(int cpu, void *jump_addr)
{
cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0);
writel(virt_to_phys(jump_addr), HB_JUMP_TABLE_VIRT(cpu));
__cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16);
outer_clean_range(HB_JUMP_TABLE_PHYS(cpu),
HB_JUMP_TABLE_PHYS(cpu) + 15);
}

static void highbank_l2x0_disable(void)
{
Expand Down Expand Up @@ -182,7 +169,6 @@ DT_MACHINE_START(HIGHBANK, "Highbank")
#if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
.dma_zone_size = (4ULL * SZ_1G),
#endif
.smp = smp_ops(highbank_smp_ops),
.init_irq = highbank_init_irq,
.init_time = highbank_timer_init,
.init_machine = highbank_init,
Expand Down
37 changes: 0 additions & 37 deletions arch/arm/mach-highbank/hotplug.c

This file was deleted.

68 changes: 0 additions & 68 deletions arch/arm/mach-highbank/platsmp.c

This file was deleted.

27 changes: 9 additions & 18 deletions arch/arm/mach-highbank/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,31 @@

#include <linux/cpu_pm.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/suspend.h>

#include <asm/cacheflush.h>
#include <asm/proc-fns.h>
#include <asm/suspend.h>

#include "core.h"
#include "sysregs.h"
#include <asm/psci.h>

static int highbank_suspend_finish(unsigned long val)
{
outer_flush_all();
outer_disable();

highbank_set_pwr_suspend();

cpu_do_idle();
const struct psci_power_state ps = {
.type = PSCI_POWER_STATE_TYPE_POWER_DOWN,
.affinity_level = 1,
};

highbank_clear_pwr_request();
return 0;
return psci_ops.cpu_suspend(ps, __pa(cpu_resume));
}

static int highbank_pm_enter(suspend_state_t state)
{
cpu_pm_enter();
cpu_cluster_pm_enter();

highbank_set_cpu_jump(0, cpu_resume);
cpu_suspend(0, highbank_suspend_finish);

cpu_cluster_pm_exit();
cpu_pm_exit();

highbank_smc1(0x102, 0x1);
if (scu_base_addr)
scu_enable(scu_base_addr);
return 0;
}

Expand All @@ -63,5 +51,8 @@ static const struct platform_suspend_ops highbank_pm_ops = {

void __init highbank_pm_init(void)
{
if (!psci_ops.cpu_suspend)
return;

suspend_set_ops(&highbank_pm_ops);
}

0 comments on commit dd68eb0

Please sign in to comment.