From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932970AbbCRKaH (ORCPT ); Wed, 18 Mar 2015 06:30:07 -0400 Received: from down.free-electrons.com ([37.187.137.238]:49491 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932913AbbCRKaE (ORCPT ); Wed, 18 Mar 2015 06:30:04 -0400 Date: Wed, 18 Mar 2015 11:29:39 +0100 From: Maxime Ripard To: Chen-Yu Tsai Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Marc Zyngier Subject: Re: [PATCH 2/3] ARM: sun8i: Add SMP support for the Allwinner A23 Message-ID: <20150318102939.GP4638@lukather> References: <1426649042-30547-1-git-send-email-wens@csie.org> <1426649042-30547-3-git-send-email-wens@csie.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Kynn+LdAwU9N+JqL" Content-Disposition: inline In-Reply-To: <1426649042-30547-3-git-send-email-wens@csie.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Kynn+LdAwU9N+JqL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 18, 2015 at 11:24:01AM +0800, Chen-Yu Tsai wrote: > The A23 is a dual Cortex-A7. Add the logic to use the IPs used to > control the CPU configuration and the CPU power so that we can > bring up secondary CPUs at boot. >=20 > Signed-off-by: Chen-Yu Tsai > --- >=20 > We can't use of_io_request_and_map() here, as it will conflict > with PRCM, and leave us without a serial console. >=20 > I think a proper way to solve this would be a syscon device or > something like the mfd-simple device posted by Arnd. >=20 > --- > Documentation/devicetree/bindings/arm/cpus.txt | 1 + > arch/arm/mach-sunxi/platsmp.c | 69 ++++++++++++++++++++= ++++++ > 2 files changed, 70 insertions(+) >=20 > diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentati= on/devicetree/bindings/arm/cpus.txt > index 8b9e0a95de31..40202d85b132 100644 > --- a/Documentation/devicetree/bindings/arm/cpus.txt > +++ b/Documentation/devicetree/bindings/arm/cpus.txt > @@ -188,6 +188,7 @@ nodes to be present and contain the properties descri= bed 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" > diff --git a/arch/arm/mach-sunxi/platsmp.c b/arch/arm/mach-sunxi/platsmp.c > index 587b0468efcc..e8483ec79d67 100644 > --- a/arch/arm/mach-sunxi/platsmp.c > +++ b/arch/arm/mach-sunxi/platsmp.c > @@ -121,3 +121,72 @@ static struct smp_operations sun6i_smp_ops __initdat= a =3D { > .smp_boot_secondary =3D sun6i_smp_boot_secondary, > }; > CPU_METHOD_OF_DECLARE(sun6i_a31_smp, "allwinner,sun6i-a31", &sun6i_smp_o= ps); > + > +static void __init sun8i_smp_prepare_cpus(unsigned int max_cpus) > +{ > + struct device_node *node; > + > + node =3D 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 =3D of_iomap(node, 0); > + if (!prcm_membase) { > + pr_err("Couldn't map A23 PRCM registers\n"); > + return; > + } > + > + node =3D 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 =3D 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); One question I couldn't find any answer to is that does the SMP bit is set in secondary_startup? I couldn't find where it was set, but it still looks like the right thing to do, so I would expect the code to do that. Thanks! Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --Kynn+LdAwU9N+JqL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVCVOTAAoJEBx+YmzsjxAgEvUP/14nW9NVk+EjRz647w7pZJqj dx7PywB70tqeEdIHg6cMHBpbgZdTEftFOCUzQk4OWamit7c8uwy0myR/n0eJlM55 E2SOLsqbiIU7VdBIDNaNyLCwIIi1tinDfwlrUGmGDyvHgoEZd0QndF9IF8P5B/VH NTz9Knkglvp6yE+bLofD8b8/pJZIzbUGbn8WRYj//PIeZCb61/Gs/8IGHG4Fw1us LTpNt7j9Th0MCg85EUB261GRJe4LLy8SdRbTWhMCQ5ViRzuNzSPhXex9HJQr/8eQ Ob5xFO3c+ieWis2rNJltSh4qzcYzV1syazPX4YuAAUcqE7eqNIZoATwwsKBfuDd4 bSwoT0rZUfQGA+zbKBTSsg5KqG2IvmM48q2Bk+qJs67vMFg0Leq05phtViGzvWbQ i2EMc+hhDDLaCHnJIg1UxWZnwGkMqCY8UZUqY/47e0rJWNisCod4cZ309oundsbw fi3SYk3S2TTQBCLblP/tRn1wVdkEVtzw6l/z0+8ftwV52CPo0vyKXb8WafJCCdWu AykACFj1M0iRvONIy457WNTJ9jXD930klzka0Sz7fs3871L4jRj9FpmfocYt6X3v WNyfMTLgagP8LGb8FFRPhAUbEMBPdh+Mi/CsIRa7Mo5gnRtqAyP9c+aZeToW2S9Z 6fX69Q/R+ejpSxnWIIE7 =5Eoy -----END PGP SIGNATURE----- --Kynn+LdAwU9N+JqL--