blob: 5052c70326e49ef5790e65d519c620e615d442ce [file] [log] [blame]
Michal Simekc7c28b02013-03-20 13:56:15 +01001/*
2 * Copyright (C) 2012-2013 Xilinx
3 *
4 * based on linux/arch/arm/mach-realview/hotplug.c
5 *
6 * Copyright (C) 2002 ARM Ltd.
7 * All Rights Reserved
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/smp.h>
16
17#include <asm/cacheflush.h>
18#include <asm/cp15.h>
19#include "common.h"
20
21static inline void zynq_cpu_enter_lowpower(void)
22{
23 unsigned int v;
24
25 flush_cache_all();
26 asm volatile(
27 " mcr p15, 0, %1, c7, c5, 0\n"
28 " dsb\n"
29 /*
30 * Turn off coherency
31 */
32 " mrc p15, 0, %0, c1, c0, 1\n"
33 " bic %0, %0, #0x40\n"
34 " mcr p15, 0, %0, c1, c0, 1\n"
35 " mrc p15, 0, %0, c1, c0, 0\n"
36 " bic %0, %0, %2\n"
37 " mcr p15, 0, %0, c1, c0, 0\n"
38 : "=&r" (v)
39 : "r" (0), "Ir" (CR_C)
40 : "cc");
41}
42
Michal Simekc7c28b02013-03-20 13:56:15 +010043/*
44 * platform-specific code to shutdown a CPU
45 *
46 * Called with IRQs disabled
47 */
48void zynq_platform_cpu_die(unsigned int cpu)
49{
Michal Simekc7c28b02013-03-20 13:56:15 +010050 zynq_cpu_enter_lowpower();
Michal Simekc7c28b02013-03-20 13:56:15 +010051
52 /*
Soren Brinkmannb5228772013-08-01 09:36:53 -070053 * there is no power-control hardware on this platform, so all
54 * we can do is put the core into WFI; this is safe as the calling
55 * code will have already disabled interrupts
Michal Simekc7c28b02013-03-20 13:56:15 +010056 */
Soren Brinkmannb5228772013-08-01 09:36:53 -070057 for (;;)
58 cpu_do_idle();
Michal Simekc7c28b02013-03-20 13:56:15 +010059}