hotplug.c revision b0db321ba14daca748d5c8ca89298fdb637f9ba8
14898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song/* 24898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song * CPU hotplug support for CSR Marco dual-core SMP SoCs 34898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song * 44898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song * Copyright (c) 2012 Cambridge Silicon Radio Limited, a CSR plc group company. 54898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song * 64898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song * Licensed under GPLv2 or later. 74898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song */ 84898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song 94898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song#include <linux/kernel.h> 104898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song#include <linux/errno.h> 114898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song#include <linux/smp.h> 124898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song 134898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song#include <asm/cacheflush.h> 144898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song#include <asm/smp_plat.h> 154898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song 164898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Songstatic inline void platform_do_lowpower(unsigned int cpu) 174898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song{ 184898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song flush_cache_all(); 194898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song 204898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song /* we put the platform to just WFI */ 214898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song for (;;) { 224898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song __asm__ __volatile__("dsb\n\t" "wfi\n\t" 234898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song : : : "memory"); 244898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song if (pen_release == cpu_logical_map(cpu)) { 254898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song /* 264898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song * OK, proper wakeup, we're done 274898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song */ 284898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song break; 294898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song } 304898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song } 314898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song} 324898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song 334898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song/* 344898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song * platform-specific code to shutdown a CPU 354898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song * 364898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song * Called with IRQs disabled 374898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song */ 38b0db321ba14daca748d5c8ca89298fdb637f9ba8Arnd Bergmannvoid __ref sirfsoc_cpu_die(unsigned int cpu) 394898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song{ 404898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song platform_do_lowpower(cpu); 414898de3d15d8ba34aa7a1b0f753a476d52ebdf92Barry Song} 42