aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2018-07-26 18:42:46 +0100
committerBen Hutchings <ben.hutchings@codethink.co.uk>2018-08-24 19:18:22 +0100
commit9b1ae093d8734b07a0a0ab878df12b2761426ec8 (patch)
tree5eb664aab38103fb1b93775cb0960547a482af7e
parentd0352169e719047551ab402efec3a230605f9a55 (diff)
downloadlinux-cip-9b1ae093d8734b07a0a0ab878df12b2761426ec8.tar.gz
ARM: shmobile: rcar-gen2: Obtain jump stub region from DT
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> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> (cherry picked from commit 816756962b15f469d467b09beeb702af015c55cc) Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com> Reviewed-by: Biju Das <biju.das@bp.renesas.com> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
-rw-r--r--arch/arm/mach-shmobile/pm-rcar-gen2.c33
1 files 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 6556134ca638f8..7a34ec9b3490b5 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 <asm/io.h>
#include "common.h"
@@ -73,8 +75,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;
@@ -99,14 +102,38 @@ void __init rcar_gen2_pm_init(void)
else if (of_machine_is_compatible("renesas,r8a7745"))
syscier = 0x00300060;
+ 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);