-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable SMP support on hi3xxx platform Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org> Tested-by: Zhang Mingjun <zhang.mingjun@linaro.org> Tested-by: Li Xin <li.xin@linaro.org> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> [khilman: fix checkpatch errors] Signed-off-by: Kevin Hilman <khilman@linaro.org>
- Loading branch information
Kevin Hilman
committed
Dec 18, 2013
1 parent
524b7df
commit a9434e9
Showing
7 changed files
with
204 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
# | ||
|
||
obj-y += hi3xxx.o | ||
obj-$(CONFIG_SMP) += platsmp.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef __HISILICON_CORE_H | ||
#define __HISILICON_CORE_H | ||
|
||
#include <linux/reboot.h> | ||
|
||
extern void hi3xxx_set_cpu_jump(int cpu, void *jump_addr); | ||
extern int hi3xxx_get_cpu_jump(int cpu); | ||
extern void secondary_startup(void); | ||
extern struct smp_operations hi3xxx_smp_ops; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (c) 2013 Linaro Ltd. | ||
* Copyright (c) 2013 Hisilicon Limited. | ||
* Based on arch/arm/mach-vexpress/platsmp.c, Copyright (C) 2002 ARM Ltd. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
*/ | ||
#include <linux/smp.h> | ||
#include <linux/io.h> | ||
#include <linux/of_address.h> | ||
|
||
#include <asm/cacheflush.h> | ||
#include <asm/smp_plat.h> | ||
#include <asm/smp_scu.h> | ||
|
||
#include "core.h" | ||
|
||
static void __iomem *ctrl_base; | ||
|
||
void hi3xxx_set_cpu_jump(int cpu, void *jump_addr) | ||
{ | ||
cpu = cpu_logical_map(cpu); | ||
if (!cpu || !ctrl_base) | ||
return; | ||
writel_relaxed(virt_to_phys(jump_addr), ctrl_base + ((cpu - 1) << 2)); | ||
} | ||
|
||
int hi3xxx_get_cpu_jump(int cpu) | ||
{ | ||
cpu = cpu_logical_map(cpu); | ||
if (!cpu || !ctrl_base) | ||
return 0; | ||
return readl_relaxed(ctrl_base + ((cpu - 1) << 2)); | ||
} | ||
|
||
static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus) | ||
{ | ||
struct device_node *np = NULL; | ||
unsigned long base = 0; | ||
u32 offset = 0; | ||
void __iomem *scu_base = NULL; | ||
|
||
if (scu_a9_has_base()) { | ||
base = scu_a9_get_base(); | ||
scu_base = ioremap(base, SZ_4K); | ||
if (!scu_base) { | ||
pr_err("ioremap(scu_base) failed\n"); | ||
return; | ||
} | ||
scu_enable(scu_base); | ||
iounmap(scu_base); | ||
} | ||
if (!ctrl_base) { | ||
np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl"); | ||
if (!np) { | ||
pr_err("failed to find hisilicon,sysctrl node\n"); | ||
return; | ||
} | ||
ctrl_base = of_iomap(np, 0); | ||
if (!ctrl_base) { | ||
pr_err("failed to map address\n"); | ||
return; | ||
} | ||
if (of_property_read_u32(np, "smp-offset", &offset) < 0) { | ||
pr_err("failed to find smp-offset property\n"); | ||
return; | ||
} | ||
ctrl_base += offset; | ||
} | ||
} | ||
|
||
static int hi3xxx_boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
{ | ||
hi3xxx_set_cpu_jump(cpu, secondary_startup); | ||
arch_send_wakeup_ipi_mask(cpumask_of(cpu)); | ||
return 0; | ||
} | ||
|
||
struct smp_operations hi3xxx_smp_ops __initdata = { | ||
.smp_prepare_cpus = hi3xxx_smp_prepare_cpus, | ||
.smp_boot_secondary = hi3xxx_boot_secondary, | ||
}; |