Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98abaf13 authored by Olof Johansson's avatar Olof Johansson
Browse files

Merge tag 'renesas-soc-for-v3.17' of...

Merge tag 'renesas-soc-for-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/soc

Merge "Renesas ARM Based SoC Updates for v3.17" from Simon Horman:

- Use shmobile_init_late on r8a7791 and r8a7790 whien booting using DT-only
- Support Core-Standby for Suspend to RAM on r8a7791 and r8a7790 SoCs
- Shared CMA reservation for R-Car Gen2 SoCs
- Add r8a7791 SYSC power management support

* tag 'renesas-soc-for-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas

:
  ARM: shmobile: Remove ARCH_HAS_CPUFREQ config for shmobile
  ARM: shmobile: rcar-gen2: update call to dma_contiguous_reserve_area
  ARM: shmobile: rcar-gen2: correct return value of shmobile_smp_apmu_suspend_init
  ARM: shmobile: rcar-gen2: Remove useless copied section for LongTrail
  ARM: shmobile: rcar-gen2: Use "1ULL" instead of "(u64)1"
  ARM: shmobile: rcar-gen2: Update for of_get_flat_dt_prop() update
  ARM: shmobile: Add shared R-Car Gen2 CMA reservation code
  ARM: shmobile: Use shmobile_init_late() on r8a7791 DT-only
  ARM: shmobile: Use shmobile_init_late() on r8a7790 DT-only
  ARM: shmobile: Mark all SoCs in shmobile as CPUFreq, capable
  ARM: shmobile: r8a7791: Support Core-Standby for Suspend to RAM
  ARM: shmobile: r8a7790: Support Core-Standby for Suspend to RAM
  ARM: shmobile: APMU: Add Core-Standby-state for Suspend to RAM
  ARM: shmobile: r8a7791 SYSC setup code

Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 12af7011 3ed66ec5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ menuconfig ARCH_SHMOBILE_MULTI
	select NO_IOPORT_MAP
	select PINCTRL
	select ARCH_REQUIRE_GPIOLIB
	select ARCH_HAS_OPP

if ARCH_SHMOBILE_MULTI

+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o
obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o pm-rmobile.o
obj-$(CONFIG_ARCH_R8A7779)	+= pm-r8a7779.o pm-rcar.o
obj-$(CONFIG_ARCH_R8A7790)	+= pm-r8a7790.o pm-rcar.o
obj-$(CONFIG_ARCH_R8A7791)	+= pm-r8a7791.o pm-rcar.o

# Board objects
ifdef CONFIG_ARCH_SHMOBILE_MULTI
+2 −0
Original line number Diff line number Diff line
@@ -35,8 +35,10 @@ extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv);

#ifdef CONFIG_SUSPEND
int shmobile_suspend_init(void);
void shmobile_smp_apmu_suspend_init(void);
#else
static inline int shmobile_suspend_init(void) { return 0; }
static inline void shmobile_smp_apmu_suspend_init(void) { }
#endif

#ifdef CONFIG_CPU_IDLE
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ void r8a7791_add_standard_devices(void);
void r8a7791_add_dt_devices(void);
void r8a7791_clock_init(void);
void r8a7791_pinmux_init(void);
void r8a7791_pm_init(void);
extern struct smp_operations r8a7791_smp_ops;

#endif /* __ASM_R8A7791_H__ */
+56 −4
Original line number Diff line number Diff line
@@ -7,15 +7,19 @@
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#include <linux/cpu_pm.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/of_address.h>
#include <linux/smp.h>
#include <linux/suspend.h>
#include <asm/cacheflush.h>
#include <asm/cp15.h>
#include <asm/proc-fns.h>
#include <asm/smp_plat.h>
#include <asm/suspend.h>
#include "common.h"

static struct {
@@ -141,7 +145,7 @@ int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
	return apmu_wrap(cpu, apmu_power_on);
}

#ifdef CONFIG_HOTPLUG_CPU
#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND)
/* nicked from arch/arm/mach-exynos/hotplug.c */
static inline void cpu_enter_lowpower_a15(void)
{
@@ -172,16 +176,40 @@ static inline void cpu_enter_lowpower_a15(void)
	dsb();
}

void shmobile_smp_apmu_cpu_die(unsigned int cpu)
void shmobile_smp_apmu_cpu_shutdown(unsigned int cpu)
{
	/* For this particular CPU deregister boot vector */
	shmobile_smp_hook(cpu, 0, 0);

	/* Select next sleep mode using the APMU */
	apmu_wrap(cpu, apmu_power_off);

	/* Do ARM specific CPU shutdown */
	cpu_enter_lowpower_a15();
}

static inline void cpu_leave_lowpower(void)
{
	unsigned int v;

	asm volatile("mrc    p15, 0, %0, c1, c0, 0\n"
		     "       orr     %0, %0, %1\n"
		     "       mcr     p15, 0, %0, c1, c0, 0\n"
		     "       mrc     p15, 0, %0, c1, c0, 1\n"
		     "       orr     %0, %0, %2\n"
		     "       mcr     p15, 0, %0, c1, c0, 1\n"
		     : "=&r" (v)
		     : "Ir" (CR_C), "Ir" (0x40)
		     : "cc");
}
#endif

#if defined(CONFIG_HOTPLUG_CPU)
void shmobile_smp_apmu_cpu_die(unsigned int cpu)
{
	/* For this particular CPU deregister boot vector */
	shmobile_smp_hook(cpu, 0, 0);

	/* Shutdown CPU core */
	shmobile_smp_apmu_cpu_shutdown(cpu);

	/* jump to shared mach-shmobile sleep / reset code */
	shmobile_smp_sleep();
@@ -192,3 +220,27 @@ int shmobile_smp_apmu_cpu_kill(unsigned int cpu)
	return apmu_wrap(cpu, apmu_power_off_poll);
}
#endif

#if defined(CONFIG_SUSPEND)
static int shmobile_smp_apmu_do_suspend(unsigned long cpu)
{
	shmobile_smp_hook(cpu, virt_to_phys(cpu_resume), 0);
	shmobile_smp_apmu_cpu_shutdown(cpu);
	cpu_do_idle(); /* WFI selects Core Standby */
	return 1;
}

static int shmobile_smp_apmu_enter_suspend(suspend_state_t state)
{
	cpu_suspend(smp_processor_id(), shmobile_smp_apmu_do_suspend);
	cpu_leave_lowpower();
	return 0;
}

void shmobile_smp_apmu_suspend_init(void)
{
	shmobile_suspend_ops.enter = shmobile_smp_apmu_enter_suspend;
}
#else
void shmobile_smp_apmu_suspend_init(void) {}
#endif
Loading