Magnus Damm | ad09cb8 | 2013-08-29 08:22:07 +0900 | [diff] [blame] | 1 | /* |
| 2 | * SMP support for r8a7790 |
| 3 | * |
| 4 | * Copyright (C) 2012-2013 Renesas Solutions Corp. |
| 5 | * Copyright (C) 2012 Takashi Yoshii <takashi.yoshii.ze@renesas.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | */ |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/smp.h> |
| 19 | #include <linux/io.h> |
Geert Uytterhoeven | fccae89 | 2014-06-20 18:53:06 +0200 | [diff] [blame] | 20 | |
Magnus Damm | ad09cb8 | 2013-08-29 08:22:07 +0900 | [diff] [blame] | 21 | #include <asm/smp_plat.h> |
Geert Uytterhoeven | fccae89 | 2014-06-20 18:53:06 +0200 | [diff] [blame] | 22 | |
Magnus Damm | fd44aa5 | 2014-06-17 16:47:37 +0900 | [diff] [blame] | 23 | #include "common.h" |
Hisashi Nakamura | a8d2ff3 | 2014-10-24 17:33:08 +0900 | [diff] [blame] | 24 | #include "platsmp-apmu.h" |
Magnus Damm | 585c09d | 2014-06-17 16:47:53 +0900 | [diff] [blame] | 25 | #include "pm-rcar.h" |
Gaku Inami | a8caad6 | 2015-03-16 14:48:43 +0900 | [diff] [blame] | 26 | #include "rcar-gen2.h" |
Geert Uytterhoeven | fccae89 | 2014-06-20 18:53:06 +0200 | [diff] [blame] | 27 | #include "r8a7790.h" |
Magnus Damm | ad09cb8 | 2013-08-29 08:22:07 +0900 | [diff] [blame] | 28 | |
Geert Uytterhoeven | bd82aff | 2015-06-04 20:22:35 +0200 | [diff] [blame] | 29 | static const struct rcar_sysc_ch r8a7790_ca15_scu = { |
Keita Kobayashi | c2c97ec | 2014-01-15 21:26:13 +0900 | [diff] [blame] | 30 | .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */ |
| 31 | .isr_bit = 12, /* CA15-SCU */ |
| 32 | }; |
| 33 | |
Geert Uytterhoeven | bd82aff | 2015-06-04 20:22:35 +0200 | [diff] [blame] | 34 | static const struct rcar_sysc_ch r8a7790_ca7_scu = { |
Gaku Inami | 0445ded | 2014-01-15 21:26:04 +0900 | [diff] [blame] | 35 | .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ |
| 36 | .isr_bit = 21, /* CA7-SCU */ |
| 37 | }; |
| 38 | |
Hisashi Nakamura | a8d2ff3 | 2014-10-24 17:33:08 +0900 | [diff] [blame] | 39 | static struct rcar_apmu_config r8a7790_apmu_config[] = { |
| 40 | { |
Wolfram Sang | 1d66f72 | 2015-02-03 15:57:41 +0100 | [diff] [blame] | 41 | .iomem = DEFINE_RES_MEM(0xe6152000, 0x188), |
Hisashi Nakamura | a8d2ff3 | 2014-10-24 17:33:08 +0900 | [diff] [blame] | 42 | .cpus = { 0, 1, 2, 3 }, |
| 43 | }, |
| 44 | { |
Wolfram Sang | 1d66f72 | 2015-02-03 15:57:41 +0100 | [diff] [blame] | 45 | .iomem = DEFINE_RES_MEM(0xe6151000, 0x188), |
Hisashi Nakamura | a8d2ff3 | 2014-10-24 17:33:08 +0900 | [diff] [blame] | 46 | .cpus = { 0x100, 0x0101, 0x102, 0x103 }, |
| 47 | } |
| 48 | }; |
| 49 | |
Magnus Damm | ad09cb8 | 2013-08-29 08:22:07 +0900 | [diff] [blame] | 50 | static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus) |
| 51 | { |
Magnus Damm | ad09cb8 | 2013-08-29 08:22:07 +0900 | [diff] [blame] | 52 | /* let APMU code install data related to shmobile_boot_vector */ |
Hisashi Nakamura | a8d2ff3 | 2014-10-24 17:33:08 +0900 | [diff] [blame] | 53 | shmobile_smp_apmu_prepare_cpus(max_cpus, |
| 54 | r8a7790_apmu_config, |
| 55 | ARRAY_SIZE(r8a7790_apmu_config)); |
Magnus Damm | ad09cb8 | 2013-08-29 08:22:07 +0900 | [diff] [blame] | 56 | |
Gaku Inami | 0445ded | 2014-01-15 21:26:04 +0900 | [diff] [blame] | 57 | /* turn on power to SCU */ |
Gaku Inami | a8caad6 | 2015-03-16 14:48:43 +0900 | [diff] [blame] | 58 | rcar_gen2_pm_init(); |
Keita Kobayashi | c2c97ec | 2014-01-15 21:26:13 +0900 | [diff] [blame] | 59 | rcar_sysc_power_up(&r8a7790_ca15_scu); |
Gaku Inami | 0445ded | 2014-01-15 21:26:04 +0900 | [diff] [blame] | 60 | rcar_sysc_power_up(&r8a7790_ca7_scu); |
Magnus Damm | ad09cb8 | 2013-08-29 08:22:07 +0900 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | struct smp_operations r8a7790_smp_ops __initdata = { |
| 64 | .smp_prepare_cpus = r8a7790_smp_prepare_cpus, |
| 65 | .smp_boot_secondary = shmobile_smp_apmu_boot_secondary, |
| 66 | #ifdef CONFIG_HOTPLUG_CPU |
Stephen Boyd | 787047e | 2015-07-29 00:34:48 +0100 | [diff] [blame] | 67 | .cpu_can_disable = shmobile_smp_cpu_can_disable, |
Magnus Damm | ad09cb8 | 2013-08-29 08:22:07 +0900 | [diff] [blame] | 68 | .cpu_die = shmobile_smp_apmu_cpu_die, |
| 69 | .cpu_kill = shmobile_smp_apmu_cpu_kill, |
| 70 | #endif |
| 71 | }; |