/*1* Copyright (C) 2002 ARM Ltd.2* All Rights Reserved3*4* This program is free software; you can redistribute it and/or modify5* it under the terms of the GNU General Public License version 2 as6* published by the Free Software Foundation.7*/8#include <linux/kernel.h>9#include <linux/errno.h>10#include <linux/smp.h>1112#include <asm/cacheflush.h>1314extern volatile int pen_release;1516static inline void cpu_enter_lowpower(void)17{18/* Just flush the cache. Changing the coherency is not yet19* available on msm. */20flush_cache_all();21}2223static inline void cpu_leave_lowpower(void)24{25}2627static inline void platform_do_lowpower(unsigned int cpu)28{29/* Just enter wfi for now. TODO: Properly shut off the cpu. */30for (;;) {31/*32* here's the WFI33*/34asm("wfi"35:36:37: "memory", "cc");3839if (pen_release == cpu) {40/*41* OK, proper wakeup, we're done42*/43break;44}4546/*47* getting here, means that we have come out of WFI without48* having been woken up - this shouldn't happen49*50* The trouble is, letting people know about this is not really51* possible, since we are currently running incoherently, and52* therefore cannot safely call printk() or anything else53*/54pr_debug("CPU%u: spurious wakeup call\n", cpu);55}56}5758int platform_cpu_kill(unsigned int cpu)59{60return 1;61}6263/*64* platform-specific code to shutdown a CPU65*66* Called with IRQs disabled67*/68void platform_cpu_die(unsigned int cpu)69{70/*71* we're ready for shutdown now, so do it72*/73cpu_enter_lowpower();74platform_do_lowpower(cpu);7576/*77* bring this CPU back into the world of cache78* coherency, and then restore interrupts79*/80cpu_leave_lowpower();81}8283int platform_cpu_disable(unsigned int cpu)84{85/*86* we don't allow CPU 0 to be shutdown (it is still too special87* e.g. clock tick interrupts)88*/89return cpu == 0 ? -EPERM : 0;90}919293