From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Magnus Damm <magnus.damm@gmail.com>,
Mark Rutland <mark.rutland@arm.com>,
Rob Herring <robh+dt@kernel.org>,
Simon Horman <horms@verge.net.au>
Cc: linux-renesas-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 2/9] ARM: shmobile: rcar-gen2: Obtain jump stub region from DT
Date: Tue, 4 Jul 2017 17:41:36 +0200 [thread overview]
Message-ID: <1499182903-31339-3-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1499182903-31339-1-git-send-email-geert+renesas@glider.be>
Add support for obtaining from DT the SRAM region to store the jump stub
for CPU core bringup, according to the renesas,smp-sram DT bindings.
If no region is specified in DT, the code falls back to hardcoded ICRAM1
as before, to maintain backwards compatibility.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
arch/arm/mach-shmobile/pm-rcar-gen2.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-shmobile/pm-rcar-gen2.c b/arch/arm/mach-shmobile/pm-rcar-gen2.c
index 0178da7ace82dcbd..e5f215c8b218100a 100644
--- a/arch/arm/mach-shmobile/pm-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/pm-rcar-gen2.c
@@ -11,7 +11,9 @@
*/
#include <linux/kernel.h>
+#include <linux/ioport.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/smp.h>
#include <linux/soc/renesas/rcar-sysc.h>
#include <asm/io.h>
@@ -69,8 +71,9 @@ void __init rcar_gen2_pm_init(void)
struct device_node *np, *cpus;
bool has_a7 = false;
bool has_a15 = false;
- phys_addr_t boot_vector_addr = ICRAM1;
+ struct resource res;
u32 syscier = 0;
+ int error;
if (once++)
return;
@@ -91,14 +94,38 @@ void __init rcar_gen2_pm_init(void)
else if (of_machine_is_compatible("renesas,r8a7791"))
syscier = 0x00111003;
+ np = of_find_compatible_node(NULL, NULL, "renesas,smp-sram");
+ if (!np) {
+ /* No smp-sram in DT, fall back to hardcoded address */
+ res = (struct resource)DEFINE_RES_MEM(ICRAM1,
+ shmobile_boot_size);
+ goto map;
+ }
+
+ error = of_address_to_resource(np, 0, &res);
+ if (error) {
+ pr_err("Failed to get smp-sram address: %d\n", error);
+ return;
+ }
+
+map:
/* RAM for jump stub, because BAR requires 256KB aligned address */
- p = ioremap_nocache(boot_vector_addr, shmobile_boot_size);
+ if (res.start & (256 * 1024 - 1) ||
+ resource_size(&res) < shmobile_boot_size) {
+ pr_err("Invalid smp-sram region\n");
+ return;
+ }
+
+ p = ioremap(res.start, resource_size(&res));
+ if (!p)
+ return;
+
memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
iounmap(p);
/* setup reset vectors */
p = ioremap_nocache(RST, 0x63);
- bar = phys_to_sbar(boot_vector_addr);
+ bar = phys_to_sbar(res.start);
if (has_a15) {
writel_relaxed(bar, p + CA15BAR);
writel_relaxed(bar | SBAR_BAREN, p + CA15BAR);
--
2.7.4
next prev parent reply other threads:[~2017-07-04 15:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-04 15:41 [PATCH 0/9] ARM: renesas: Use SMP jump stub SRAM region from DT Geert Uytterhoeven
2017-07-04 15:41 ` [PATCH 1/9] dt-bindings: sram: Document renesas,smp-sram Geert Uytterhoeven
2017-07-10 1:08 ` Rob Herring
2017-07-04 15:41 ` Geert Uytterhoeven [this message]
2017-07-04 15:41 ` [PATCH 3/9] ARM: dts: r8a7743: Reserve SRAM for the SMP jump stub Geert Uytterhoeven
[not found] ` <1499182903-31339-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2017-07-04 15:41 ` [PATCH 4/9] ARM: dts: r8a7745: " Geert Uytterhoeven
2017-07-04 15:41 ` [PATCH 5/9] ARM: dts: r8a7790: " Geert Uytterhoeven
2017-07-04 15:41 ` [PATCH 7/9] ARM: dts: r8a7792: " Geert Uytterhoeven
2017-07-04 15:41 ` [PATCH 6/9] ARM: dts: r8a7791: " Geert Uytterhoeven
2017-07-04 15:41 ` [PATCH 8/9] ARM: dts: r8a7793: " Geert Uytterhoeven
2017-07-04 15:41 ` [PATCH 9/9] ARM: dts: r8a7794: " Geert Uytterhoeven
2017-07-04 16:44 ` [PATCH 0/9] ARM: renesas: Use SMP jump stub SRAM region from DT Geert Uytterhoeven
2017-07-10 8:39 ` Simon Horman
[not found] ` <20170710083926.GI13680-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2017-07-10 8:44 ` Geert Uytterhoeven
2017-07-10 9:31 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1499182903-31339-3-git-send-email-geert+renesas@glider.be \
--to=geert+renesas@glider.be \
--cc=devicetree@vger.kernel.org \
--cc=horms@verge.net.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).