Lines Matching full:cpu
48 static struct reset_control *meson_smp_get_core_reset(int cpu) in meson_smp_get_core_reset() argument
50 struct device_node *np = of_get_cpu_node(cpu, 0); in meson_smp_get_core_reset()
55 static void meson_smp_set_cpu_ctrl(int cpu, bool on_off) in meson_smp_set_cpu_ctrl() argument
60 val |= BIT(cpu); in meson_smp_set_cpu_ctrl()
62 val &= ~BIT(cpu); in meson_smp_set_cpu_ctrl()
124 static void meson_smp_begin_secondary_boot(unsigned int cpu) in meson_smp_begin_secondary_boot() argument
127 * Set the entry point before powering on the CPU through the SCU. This in meson_smp_begin_secondary_boot()
128 * is needed if the CPU is in "warm" state (= after rebooting the in meson_smp_begin_secondary_boot()
129 * system without power-cycling, or when taking the CPU offline and in meson_smp_begin_secondary_boot()
133 sram_base + MESON_SMP_SRAM_CPU_CTRL_ADDR_REG(cpu)); in meson_smp_begin_secondary_boot()
136 * SCU Power on CPU (needs to be done before starting the CPU, in meson_smp_begin_secondary_boot()
137 * otherwise the secondary CPU will not start). in meson_smp_begin_secondary_boot()
139 scu_cpu_power_enable(scu_base, cpu); in meson_smp_begin_secondary_boot()
142 static int meson_smp_finalize_secondary_boot(unsigned int cpu) in meson_smp_finalize_secondary_boot() argument
147 while (readl(sram_base + MESON_SMP_SRAM_CPU_CTRL_ADDR_REG(cpu))) { in meson_smp_finalize_secondary_boot()
149 pr_err("Timeout while waiting for CPU%d status\n", in meson_smp_finalize_secondary_boot()
150 cpu); in meson_smp_finalize_secondary_boot()
156 sram_base + MESON_SMP_SRAM_CPU_CTRL_ADDR_REG(cpu)); in meson_smp_finalize_secondary_boot()
158 meson_smp_set_cpu_ctrl(cpu, true); in meson_smp_finalize_secondary_boot()
163 static int meson8_smp_boot_secondary(unsigned int cpu, in meson8_smp_boot_secondary() argument
169 rstc = meson_smp_get_core_reset(cpu); in meson8_smp_boot_secondary()
171 pr_err("Couldn't get the reset controller for CPU%d\n", cpu); in meson8_smp_boot_secondary()
175 meson_smp_begin_secondary_boot(cpu); in meson8_smp_boot_secondary()
180 pr_err("Failed to assert CPU%d reset\n", cpu); in meson8_smp_boot_secondary()
184 /* CPU power ON */ in meson8_smp_boot_secondary()
186 MESON_CPU_PWR_A9_CNTL1_M(cpu), 0); in meson8_smp_boot_secondary()
188 pr_err("Couldn't wake up CPU%d\n", cpu); in meson8_smp_boot_secondary()
195 ret = regmap_update_bits(pmu, MESON_CPU_AO_RTI_PWR_A9_CNTL0, BIT(cpu), in meson8_smp_boot_secondary()
198 pr_err("Error when disabling isolation of CPU%d\n", cpu); in meson8_smp_boot_secondary()
205 pr_err("Failed to de-assert CPU%d reset\n", cpu); in meson8_smp_boot_secondary()
209 ret = meson_smp_finalize_secondary_boot(cpu); in meson8_smp_boot_secondary()
219 static int meson8b_smp_boot_secondary(unsigned int cpu, in meson8b_smp_boot_secondary() argument
226 rstc = meson_smp_get_core_reset(cpu); in meson8b_smp_boot_secondary()
228 pr_err("Couldn't get the reset controller for CPU%d\n", cpu); in meson8b_smp_boot_secondary()
232 meson_smp_begin_secondary_boot(cpu); in meson8b_smp_boot_secondary()
234 /* CPU power UP */ in meson8b_smp_boot_secondary()
236 MESON_CPU_PWR_A9_CNTL0_M(cpu), 0); in meson8b_smp_boot_secondary()
238 pr_err("Couldn't power up CPU%d\n", cpu); in meson8b_smp_boot_secondary()
247 pr_err("Failed to assert CPU%d reset\n", cpu); in meson8b_smp_boot_secondary()
253 MESON_CPU_PWR_A9_MEM_PD0_M(cpu), 0); in meson8b_smp_boot_secondary()
255 pr_err("Couldn't power up the memory for CPU%d\n", cpu); in meson8b_smp_boot_secondary()
259 /* Wake up CPU */ in meson8b_smp_boot_secondary()
261 MESON_CPU_PWR_A9_CNTL1_M(cpu), 0); in meson8b_smp_boot_secondary()
263 pr_err("Couldn't wake up CPU%d\n", cpu); in meson8b_smp_boot_secondary()
270 val & MESON_CPU_PWR_A9_CNTL1_ST(cpu), in meson8b_smp_boot_secondary()
273 pr_err("Timeout while polling PMU for CPU%d status\n", cpu); in meson8b_smp_boot_secondary()
278 ret = regmap_update_bits(pmu, MESON_CPU_AO_RTI_PWR_A9_CNTL0, BIT(cpu), in meson8b_smp_boot_secondary()
281 pr_err("Error when disabling isolation of CPU%d\n", cpu); in meson8b_smp_boot_secondary()
288 pr_err("Failed to de-assert CPU%d reset\n", cpu); in meson8b_smp_boot_secondary()
292 ret = meson_smp_finalize_secondary_boot(cpu); in meson8b_smp_boot_secondary()
303 static void meson8_smp_cpu_die(unsigned int cpu) in meson8_smp_cpu_die() argument
305 meson_smp_set_cpu_ctrl(cpu, false); in meson8_smp_cpu_die()
318 static int meson8_smp_cpu_kill(unsigned int cpu) in meson8_smp_cpu_kill() argument
325 power_mode = scu_get_cpu_power_mode(scu_base, cpu); in meson8_smp_cpu_kill()
334 pr_err("Error while waiting for SCU power-off on CPU%d\n", in meson8_smp_cpu_kill()
335 cpu); in meson8_smp_cpu_kill()
342 ret = regmap_update_bits(pmu, MESON_CPU_AO_RTI_PWR_A9_CNTL0, BIT(cpu), in meson8_smp_cpu_kill()
345 pr_err("Error when enabling isolation for CPU%d\n", cpu); in meson8_smp_cpu_kill()
351 /* CPU power OFF */ in meson8_smp_cpu_kill()
353 MESON_CPU_PWR_A9_CNTL1_M(cpu), 0x3); in meson8_smp_cpu_kill()
355 pr_err("Couldn't change sleep status of CPU%d\n", cpu); in meson8_smp_cpu_kill()
362 static int meson8b_smp_cpu_kill(unsigned int cpu) in meson8b_smp_cpu_kill() argument
367 power_mode = scu_get_cpu_power_mode(scu_base, cpu); in meson8b_smp_cpu_kill()
376 pr_err("Error while waiting for SCU power-off on CPU%d\n", in meson8b_smp_cpu_kill()
377 cpu); in meson8b_smp_cpu_kill()
383 /* CPU power DOWN */ in meson8b_smp_cpu_kill()
385 MESON_CPU_PWR_A9_CNTL0_M(cpu), 0x3); in meson8b_smp_cpu_kill()
387 pr_err("Couldn't power down CPU%d\n", cpu); in meson8b_smp_cpu_kill()
392 ret = regmap_update_bits(pmu, MESON_CPU_AO_RTI_PWR_A9_CNTL0, BIT(cpu), in meson8b_smp_cpu_kill()
395 pr_err("Error when enabling isolation for CPU%d\n", cpu); in meson8b_smp_cpu_kill()
403 MESON_CPU_PWR_A9_CNTL1_M(cpu), 0x3); in meson8b_smp_cpu_kill()
405 pr_err("Couldn't change sleep status of CPU%d\n", cpu); in meson8b_smp_cpu_kill()
411 MESON_CPU_PWR_A9_MEM_PD0_M(cpu), 0xf); in meson8b_smp_cpu_kill()
413 pr_err("Couldn't power down the memory of CPU%d\n", cpu); in meson8b_smp_cpu_kill()