2 * Copyright (C) 2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
5 * Based on code by Carl van Schaik <carl@ok-labs.com>.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _GENERICTIMER_H_
21 #define _GENERICTIMER_H_
26 * This macro provide a physical timer that can be used for delay in the code.
27 * The macro is moved from sunxi/psci_sun7i.S
29 * reg: is used in this macro.
30 * ticks: The freq is based on generic timer.
32 .macro timer_wait reg, ticks
33 movw \reg, #(\ticks & 0xffff)
34 movt \reg, #(\ticks >> 16)
35 mcr p15, 0, \reg, c14, c2, 0
38 mcr p15, 0, \reg, c14, c2, 1
40 mrc p15, 0, \reg, c14, c2, 1
44 mcr p15, 0, \reg, c14, c2, 1
48 #endif /* __ASSEMBLY__ */
50 #endif /* _GENERICTIMER_H_ */