Linux Audio

Check our new training course

Loading...
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * OMAP4 SMP cpu-hotplug support
 4 *
 5 * Copyright (C) 2010 Texas Instruments, Inc.
 6 * Author:
 7 *      Santosh Shilimkar <santosh.shilimkar@ti.com>
 8 *
 9 * Platform file needed for the OMAP4 SMP. This file is based on arm
10 * realview smp platform.
11 * Copyright (c) 2002 ARM Limited.
 
 
 
 
12 */
13
14#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/smp.h>
17#include <linux/io.h>
18
19#include "omap-wakeupgen.h"
20#include "common.h"
21#include "powerdomain.h"
 
 
 
 
22
23/*
24 * platform-specific code to shutdown a CPU
25 * Called with IRQs disabled
26 */
27void omap4_cpu_die(unsigned int cpu)
28{
29	unsigned int boot_cpu = 0;
30	void __iomem *base = omap_get_wakeupgen_base();
31
32	/*
33	 * we're ready for shutdown now, so do it
34	 */
35	if (omap_secure_apis_support()) {
36		if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
37			pr_err("Secure clear status failed\n");
38	} else {
39		writel_relaxed(0, base + OMAP_AUX_CORE_BOOT_0);
40	}
41
42
43	for (;;) {
44		/*
45		 * Enter into low power state
46		 */
47		omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF);
48
49		if (omap_secure_apis_support())
50			boot_cpu = omap_read_auxcoreboot0() >> 9;
51		else
52			boot_cpu =
53				readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5;
54
55		if (boot_cpu == smp_processor_id()) {
56			/*
57			 * OK, proper wakeup, we're done
58			 */
59			break;
60		}
61		pr_debug("CPU%u: spurious wakeup call\n", cpu);
62	}
63}
64
65/* Needed by kexec and platform_can_cpu_hotplug() */
66int omap4_cpu_kill(unsigned int cpu)
67{
68	return 1;
 
 
 
 
69}
v3.1
 
 1/*
 2 * OMAP4 SMP cpu-hotplug support
 3 *
 4 * Copyright (C) 2010 Texas Instruments, Inc.
 5 * Author:
 6 *      Santosh Shilimkar <santosh.shilimkar@ti.com>
 7 *
 8 * Platform file needed for the OMAP4 SMP. This file is based on arm
 9 * realview smp platform.
10 * Copyright (c) 2002 ARM Limited.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/kernel.h>
18#include <linux/errno.h>
19#include <linux/smp.h>
 
20
21#include <asm/cacheflush.h>
22#include <mach/omap4-common.h>
23
24int platform_cpu_kill(unsigned int cpu)
25{
26	return 1;
27}
28
29/*
30 * platform-specific code to shutdown a CPU
31 * Called with IRQs disabled
32 */
33void platform_cpu_die(unsigned int cpu)
34{
35	flush_cache_all();
36	dsb();
37
38	/*
39	 * we're ready for shutdown now, so do it
40	 */
41	if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
42		printk(KERN_CRIT "Secure clear status failed\n");
 
 
 
 
 
43
44	for (;;) {
45		/*
46		 * Execute WFI
47		 */
48		do_wfi();
 
 
 
 
 
 
49
50		if (omap_read_auxcoreboot0() == cpu) {
51			/*
52			 * OK, proper wakeup, we're done
53			 */
54			break;
55		}
56		pr_debug("CPU%u: spurious wakeup call\n", cpu);
57	}
58}
59
60int platform_cpu_disable(unsigned int cpu)
 
61{
62	/*
63	 * we don't allow CPU 0 to be shutdown (it is still too special
64	 * e.g. clock tick interrupts)
65	 */
66	return cpu == 0 ? -EPERM : 0;
67}