2 * arch/arm/mach-tegra/power-macros.S
4 * Assembly macros useful for power state save / restore routines
6 * Copyright (c) 2010, NVIDIA Corporation.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 /* returns the ID of the current processor */
25 mrc p15, 0, \rd, c0, c0, 5
30 .macro mov32, reg, val
31 movw \reg, #:lower16:\val
32 movt \reg, #:upper16:\val
35 /* waits until the microsecond counter (base) ticks, for exact timing loops */
36 .macro wait_for_us, rd, base, tmp
38 1001: ldr \tmp, [\base]
44 /* waits until the microsecond counter (base) is >= rn */
45 .macro wait_until, rn, base, tmp
46 1002: ldr \tmp, [\base]
48 ands \tmp, \tmp, #0x80000000
53 /* Enable Coresight access on cpu */
54 .macro enable_coresite, tmp
55 mov32 \tmp, 0xC5ACCE55
56 mcr p14, 0, \tmp, c7, c12, 6