Allwinner core additions for 4.2
This pull request contains only the changes needed to support the SMP on the Allwinner A23. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVUQFvAAoJEBx+YmzsjxAgzZEQAIvJbHSZKtuI7gVgD+74oa7A yigsnhdoOTMtWlgWWZHuN56CjEZNSosZoa9NLJhEDBAPEbDr74SoegW7knW6/xkD B6s/TV4zGCciZ6AWa7zJEwwvibzdhw+9fGTIWZ4ZLr5fiaPPOE4jN3+O2Cu/oydC 7kD0buhh2QJpQp9ryy8L0S9pafAp8iBaux2zP1xZElG0s52xyNKtZlKD7B8SywFH UFhJmjhL0Fq7APi1SUtLbESyIZWmvgE7G8Oh9l/N7VXnkb6R4eiKb/Q3QO8FXpKh qO26A0k5cPtnAwMCYbXWimGh/X/2bY+eY8YPa/yUj19Pz770kT6loZRhvGEmkhDy aSbJFC49/sco9FIkgNMNNFyPi6rCsrmj4CGOI67cDqomARUCxiQmg3Lr71NS5rtN m6drF/6B9EzDochK9k/P/uAW0I/HJtR9Lbh/TZYLEb0SbL+j+s4s7iFhHhI3S0zh hB9mfWvbse+2vLyjyoyT58igZAf9gg/QJFnHWDFPAc3D15zxg9xQObGQ68d6CNDB 1OvjDUBCwQBOdRQgFW2YUl70lm7Sm/rDFvWR/cY6+9QSEBeDeEglP0ji+BdHynAl QPdUiiTs5tuz6WtLDX3mRYGfocUCRbPxPQ2BNZtn9gpAx4N9eCDQQuX3f937Ur9F zMhuV7zfQ3X87beuUMWx =RNcV -----END PGP SIGNATURE----- Merge tag 'sunxi-core-for-4.2' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into next/soc Merge "Allwinner core additions for 4.2" from Maxime Ripard: This pull request contains only the changes needed to support the SMP on the Allwinner A23. * tag 'sunxi-core-for-4.2' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux: ARM: sun8i: Add SMP support for the Allwinner A23
This commit is contained in:
commit
73e601ea57
|
@ -188,6 +188,7 @@ nodes to be present and contain the properties described below.
|
|||
# On ARM 32-bit systems this property is optional and
|
||||
can be one of:
|
||||
"allwinner,sun6i-a31"
|
||||
"allwinner,sun8i-a23"
|
||||
"arm,psci"
|
||||
"brcm,brahma-b15"
|
||||
"marvell,armada-375-smp"
|
||||
|
|
|
@ -121,3 +121,72 @@ static struct smp_operations sun6i_smp_ops __initdata = {
|
|||
.smp_boot_secondary = sun6i_smp_boot_secondary,
|
||||
};
|
||||
CPU_METHOD_OF_DECLARE(sun6i_a31_smp, "allwinner,sun6i-a31", &sun6i_smp_ops);
|
||||
|
||||
static void __init sun8i_smp_prepare_cpus(unsigned int max_cpus)
|
||||
{
|
||||
struct device_node *node;
|
||||
|
||||
node = of_find_compatible_node(NULL, NULL, "allwinner,sun8i-a23-prcm");
|
||||
if (!node) {
|
||||
pr_err("Missing A23 PRCM node in the device tree\n");
|
||||
return;
|
||||
}
|
||||
|
||||
prcm_membase = of_iomap(node, 0);
|
||||
if (!prcm_membase) {
|
||||
pr_err("Couldn't map A23 PRCM registers\n");
|
||||
return;
|
||||
}
|
||||
|
||||
node = of_find_compatible_node(NULL, NULL,
|
||||
"allwinner,sun8i-a23-cpuconfig");
|
||||
if (!node) {
|
||||
pr_err("Missing A23 CPU config node in the device tree\n");
|
||||
return;
|
||||
}
|
||||
|
||||
cpucfg_membase = of_iomap(node, 0);
|
||||
if (!cpucfg_membase)
|
||||
pr_err("Couldn't map A23 CPU config registers\n");
|
||||
|
||||
}
|
||||
|
||||
static int sun8i_smp_boot_secondary(unsigned int cpu,
|
||||
struct task_struct *idle)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
if (!(prcm_membase && cpucfg_membase))
|
||||
return -EFAULT;
|
||||
|
||||
spin_lock(&cpu_lock);
|
||||
|
||||
/* Set CPU boot address */
|
||||
writel(virt_to_phys(secondary_startup),
|
||||
cpucfg_membase + CPUCFG_PRIVATE0_REG);
|
||||
|
||||
/* Assert the CPU core in reset */
|
||||
writel(0, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
|
||||
|
||||
/* Assert the L1 cache in reset */
|
||||
reg = readl(cpucfg_membase + CPUCFG_GEN_CTRL_REG);
|
||||
writel(reg & ~BIT(cpu), cpucfg_membase + CPUCFG_GEN_CTRL_REG);
|
||||
|
||||
/* Clear CPU power-off gating */
|
||||
reg = readl(prcm_membase + PRCM_CPU_PWROFF_REG);
|
||||
writel(reg & ~BIT(cpu), prcm_membase + PRCM_CPU_PWROFF_REG);
|
||||
mdelay(1);
|
||||
|
||||
/* Deassert the CPU core reset */
|
||||
writel(3, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
|
||||
|
||||
spin_unlock(&cpu_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct smp_operations sun8i_smp_ops __initdata = {
|
||||
.smp_prepare_cpus = sun8i_smp_prepare_cpus,
|
||||
.smp_boot_secondary = sun8i_smp_boot_secondary,
|
||||
};
|
||||
CPU_METHOD_OF_DECLARE(sun8i_a23_smp, "allwinner,sun8i-a23", &sun8i_smp_ops);
|
||||
|
|
Loading…
Reference in New Issue