2 * r8a7790 Power management support
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2011 Renesas Solutions Corp.
6 * Copyright (C) 2011 Magnus Damm
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
13 #include <linux/kernel.h>
15 #include <linux/smp.h>
23 #define RST 0xe6160000
24 #define CA15BAR 0x0020
26 #define CA15RESCNT 0x0040
27 #define CA7RESCNT 0x0044
30 #define MERAM 0xe8080000
36 #if defined(CONFIG_SMP)
38 static void __init r8a7790_sysc_init(void)
40 void __iomem *base = rcar_sysc_init(0xe6180000);
42 /* enable all interrupt sources, but do not use interrupt handler */
43 iowrite32(0x0131000e, base + SYSCIER);
44 iowrite32(0, base + SYSCIMR);
47 #else /* CONFIG_SMP */
49 static inline void r8a7790_sysc_init(void) {}
51 #endif /* CONFIG_SMP */
53 void __init r8a7790_pm_init(void)
62 /* MERAM for jump stub, because BAR requires 256KB aligned address */
63 p = ioremap_nocache(MERAM, shmobile_boot_size);
64 memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
67 /* setup reset vectors */
68 p = ioremap_nocache(RST, 0x63);
69 bar = (MERAM >> 8) & 0xfffffc00;
70 writel_relaxed(bar, p + CA15BAR);
71 writel_relaxed(bar, p + CA7BAR);
72 writel_relaxed(bar | 0x10, p + CA15BAR);
73 writel_relaxed(bar | 0x10, p + CA7BAR);
75 /* de-assert reset for all CPUs */
76 writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
78 writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
83 shmobile_smp_apmu_suspend_init();