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

Commit bd5a875d authored by Magnus Damm's avatar Magnus Damm Committed by Rafael J. Wysocki
Browse files

mach-shmobile: Emma Mobile EV2 SMP support V3



This is V3 of Emma Mobile EV2 SMP support.

At this point only the most basic form of SMP operation
is supported. TWD and CPU Hotplug support is excluded.

Tied to both the Emma Mobile EV2 and the KZM9D board
due to the need to switch on board in platsmp.c and
the newly introduced need for static mappings.

The static mappings are needed to allow hardware
acces early during boot when SMP is initialized.
This early requirement forces us to also map in
the SMU registers.

Signed-off-by: default avatarMagnus Damm <damm@opensource.se>
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent c050fb10
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ smp-y := platsmp.o headsmp.o
smp-$(CONFIG_HOTPLUG_CPU)	+= hotplug.o
smp-$(CONFIG_ARCH_SH73A0)	+= smp-sh73a0.o
smp-$(CONFIG_ARCH_R8A7779)	+= smp-r8a7779.o
smp-$(CONFIG_ARCH_EMEV2)	+= smp-emev2.o

# Pinmux setup
pfc-y				:=
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <asm/hardware/gic.h>

MACHINE_START(KZM9D, "kzm9d")
	.map_io		= emev2_map_io,
	.init_early	= emev2_add_early_devices,
	.nr_irqs	= NR_IRQS_LEGACY,
	.init_irq	= emev2_init_irq,
+18 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#define USIB2SCLKDIV 0x65c
#define USIB3SCLKDIV 0x660
#define STI_CLKSEL 0x688
#define SMU_GENERAL_REG0 0x7c0

/* not pretty, but hey */
static void __iomem *smu_base;
@@ -50,6 +51,11 @@ static void emev2_smu_write(unsigned long value, int offs)
	iowrite32(value, smu_base + offs);
}

void emev2_set_boot_vector(unsigned long value)
{
	emev2_smu_write(value, SMU_GENERAL_REG0);
}

static struct clk_mapping smu_mapping = {
	.phys	= EMEV2_SMU_BASE,
	.len	= PAGE_SIZE,
@@ -194,6 +200,18 @@ static struct clk_lookup lookups[] = {
void __init emev2_clock_init(void)
{
	int k, ret = 0;
	static int is_setup;

	/* yuck, this is ugly as hell, but the non-smp case of clocks
	 * code is now designed to rely on ioremap() instead of static
	 * entity maps. in the case of smp we need access to the SMU
	 * register earlier than ioremap() is actually working without
	 * any static maps. to enable SMP in ugly but with dynamic
	 * mappings we have to call emev2_clock_init() from different
	 * places depending on UP and SMP...
	 */
	if (is_setup++)
		return;

	smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
	BUG_ON(!smu_base);
+7 −0
Original line number Diff line number Diff line
#ifndef __ASM_EMEV2_H__
#define __ASM_EMEV2_H__

extern void emev2_map_io(void);
extern void emev2_init_irq(void);
extern void emev2_add_early_devices(void);
extern void emev2_add_standard_devices(void);
extern void emev2_clock_init(void);
extern void emev2_set_boot_vector(unsigned long value);
extern unsigned int emev2_get_core_count(void);
extern int emev2_platform_cpu_kill(unsigned int cpu);
extern void emev2_secondary_init(unsigned int cpu);
extern int emev2_boot_secondary(unsigned int cpu);
extern void emev2_smp_prepare_cpus(void);

#endif /* __ASM_EMEV2_H__ */
+17 −0
Original line number Diff line number Diff line
@@ -19,9 +19,11 @@
#include <asm/hardware/gic.h>
#include <asm/mach-types.h>
#include <mach/common.h>
#include <mach/emev2.h>

#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2())
#define is_r8a7779() machine_is_marzen()
#define is_emev2() machine_is_kzm9d()

static unsigned int __init shmobile_smp_get_core_count(void)
{
@@ -31,6 +33,9 @@ static unsigned int __init shmobile_smp_get_core_count(void)
	if (is_r8a7779())
		return r8a7779_get_core_count();

	if (is_emev2())
		return emev2_get_core_count();

	return 1;
}

@@ -41,6 +46,9 @@ static void __init shmobile_smp_prepare_cpus(void)

	if (is_r8a7779())
		r8a7779_smp_prepare_cpus();

	if (is_emev2())
		emev2_smp_prepare_cpus();
}

int shmobile_platform_cpu_kill(unsigned int cpu)
@@ -48,6 +56,9 @@ int shmobile_platform_cpu_kill(unsigned int cpu)
	if (is_r8a7779())
		return r8a7779_platform_cpu_kill(cpu);

	if (is_emev2())
		return emev2_platform_cpu_kill(cpu);

	return 1;
}

@@ -60,6 +71,9 @@ void __cpuinit platform_secondary_init(unsigned int cpu)

	if (is_r8a7779())
		r8a7779_secondary_init(cpu);

	if (is_emev2())
		emev2_secondary_init(cpu);
}

int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
@@ -70,6 +84,9 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
	if (is_r8a7779())
		return r8a7779_boot_secondary(cpu);

	if (is_emev2())
		return emev2_boot_secondary(cpu);

	return -ENOSYS;
}

Loading