xref: /netbsd-src/sys/arch/arm/samsung/smc.h (revision b9a01336efcd496de743f43f6f1c70895cd66e38)
1 /*	$NetBSD: smc.h,v 1.2 2014/09/05 08:01:05 skrll Exp $	*/
2 
3 /*-
4  * Copyright (c) 2014 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Reinoud Zandijk.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 
33 #ifndef _ARM_SAMSUNG_SMC_H_
34 #define _ARM_SAMSUNG_SMC_H_
35 
36 /* provided by Samsung for the Exynos SMC calls */
37 
38 #define SMC_CMD_INIT		(-1)
39 #define SMC_CMD_INFO		(-2)
40 /* For Power Management */
41 #define SMC_CMD_SLEEP		(-3)
42 #define SMC_CMD_CPU1BOOT	(-4)
43 #define SMC_CMD_CPU0AFTR	(-5)
44 /* For CP15 Access */
45 #define SMC_CMD_C15RESUME	(-11)
46 /* For L2 Cache Access */
47 #define SMC_CMD_L2X0CTRL	(-21)
48 #define SMC_CMD_L2X0SETUP1	(-22)
49 #define SMC_CMD_L2X0SETUP2	(-23)
50 #define SMC_CMD_L2X0INVALL	(-24)
51 #define SMC_CMD_L2X0DEBUG	(-25)
52 
53 
54 /* XXX status of the following SMC is not known */
55 /* For Accessing CP15/SFR (General) */
56 #define SMC_CMD_REG             (-101)
57 
58 /* MACRO for SMC_CMD_REG */
59 #define SMC_REG_CLASS_CP15      (0x0 << 30)
60 #define SMC_REG_CLASS_SFR_W     (0x1 << 30)
61 #define SMC_REG_CLASS_SFR_R     (0x3 << 30)
62 #define SMC_REG_CLASS_MASK      (0x3 << 30)
63 #define SMC_REG_ID_CP15(CRn, Op1, CRm, Op2) \
64            (SMC_REG_CLASS_CP15 | \
65             ((CRn) << 10) | ((Op1) << 7) | ((CRm) << 3) | (Op2))
66 #define SMC_REG_ID_SFR_W(ADDR)  (SMC_REG_CLASS_SFR_W | ((ADDR) >> 2))
67 #define SMC_REG_ID_SFR_R(ADDR)  (SMC_REG_CLASS_SFR_R | ((ADDR) >> 2))
68 
69 
70 extern void exynos_smc(uint32_t cmd, uint32_t arg1, uint32_t arg2, uint32_t arg3);
71 
72 #endif	/* _ARM_SAMSUNG_SMC_H_ */
73 
74