Merge branches 'acpi-ec' and 'acpi-button'
[cascardo/linux.git] / drivers / staging / fsl-mc / include / dpbp-cmd.h
1 /* Copyright 2013-2016 Freescale Semiconductor Inc.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5 * * Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * * Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
10 * * Neither the name of the above-listed copyright holders nor the
11 * names of any contributors may be used to endorse or promote products
12 * derived from this software without specific prior written permission.
13 *
14 *
15 * ALTERNATIVELY, this software may be distributed under the terms of the
16 * GNU General Public License ("GPL") as published by the Free Software
17 * Foundation, either version 2 of that License or (at your option) any
18 * later version.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32 #ifndef _FSL_DPBP_CMD_H
33 #define _FSL_DPBP_CMD_H
34
35 /* DPBP Version */
36 #define DPBP_VER_MAJOR                          2
37 #define DPBP_VER_MINOR                          2
38
39 /* Command IDs */
40 #define DPBP_CMDID_CLOSE                                0x800
41 #define DPBP_CMDID_OPEN                                 0x804
42 #define DPBP_CMDID_CREATE                               0x904
43 #define DPBP_CMDID_DESTROY                              0x900
44
45 #define DPBP_CMDID_ENABLE                               0x002
46 #define DPBP_CMDID_DISABLE                              0x003
47 #define DPBP_CMDID_GET_ATTR                             0x004
48 #define DPBP_CMDID_RESET                                0x005
49 #define DPBP_CMDID_IS_ENABLED                           0x006
50
51 #define DPBP_CMDID_SET_IRQ                              0x010
52 #define DPBP_CMDID_GET_IRQ                              0x011
53 #define DPBP_CMDID_SET_IRQ_ENABLE                       0x012
54 #define DPBP_CMDID_GET_IRQ_ENABLE                       0x013
55 #define DPBP_CMDID_SET_IRQ_MASK                         0x014
56 #define DPBP_CMDID_GET_IRQ_MASK                         0x015
57 #define DPBP_CMDID_GET_IRQ_STATUS                       0x016
58 #define DPBP_CMDID_CLEAR_IRQ_STATUS                     0x017
59
60 #define DPBP_CMDID_SET_NOTIFICATIONS            0x01b0
61 #define DPBP_CMDID_GET_NOTIFICATIONS            0x01b1
62
63 struct dpbp_cmd_open {
64         __le32 dpbp_id;
65 };
66
67 #define DPBP_ENABLE                     0x1
68
69 struct dpbp_rsp_is_enabled {
70         u8 enabled;
71 };
72
73 struct dpbp_cmd_set_irq {
74         /* cmd word 0 */
75         u8 irq_index;
76         u8 pad[3];
77         __le32 irq_val;
78         /* cmd word 1 */
79         __le64 irq_addr;
80         /* cmd word 2 */
81         __le32 irq_num;
82 };
83
84 struct dpbp_cmd_get_irq {
85         __le32 pad;
86         u8 irq_index;
87 };
88
89 struct dpbp_rsp_get_irq {
90         /* response word 0 */
91         __le32 irq_val;
92         __le32 pad;
93         /* response word 1 */
94         __le64 irq_addr;
95         /* response word 2 */
96         __le32 irq_num;
97         __le32 type;
98 };
99
100 struct dpbp_cmd_set_irq_enable {
101         u8 enable;
102         u8 pad[3];
103         u8 irq_index;
104 };
105
106 struct dpbp_cmd_get_irq_enable {
107         __le32 pad;
108         u8 irq_index;
109 };
110
111 struct dpbp_rsp_get_irq_enable {
112         u8 enabled;
113 };
114
115 struct dpbp_cmd_set_irq_mask {
116         __le32 mask;
117         u8 irq_index;
118 };
119
120 struct dpbp_cmd_get_irq_mask {
121         __le32 pad;
122         u8 irq_index;
123 };
124
125 struct dpbp_rsp_get_irq_mask {
126         __le32 mask;
127 };
128
129 struct dpbp_cmd_get_irq_status {
130         __le32 status;
131         u8 irq_index;
132 };
133
134 struct dpbp_rsp_get_irq_status {
135         __le32 status;
136 };
137
138 struct dpbp_cmd_clear_irq_status {
139         __le32 status;
140         u8 irq_index;
141 };
142
143 struct dpbp_rsp_get_attributes {
144         /* response word 0 */
145         __le16 pad;
146         __le16 bpid;
147         __le32 id;
148         /* response word 1 */
149         __le16 version_major;
150         __le16 version_minor;
151 };
152
153 struct dpbp_cmd_set_notifications {
154         /* cmd word 0 */
155         __le32 depletion_entry;
156         __le32 depletion_exit;
157         /* cmd word 1 */
158         __le32 surplus_entry;
159         __le32 surplus_exit;
160         /* cmd word 2 */
161         __le16 options;
162         __le16 pad[3];
163         /* cmd word 3 */
164         __le64 message_ctx;
165         /* cmd word 4 */
166         __le64 message_iova;
167 };
168
169 struct dpbp_rsp_get_notifications {
170         /* response word 0 */
171         __le32 depletion_entry;
172         __le32 depletion_exit;
173         /* response word 1 */
174         __le32 surplus_entry;
175         __le32 surplus_exit;
176         /* response word 2 */
177         __le16 options;
178         __le16 pad[3];
179         /* response word 3 */
180         __le64 message_ctx;
181         /* response word 4 */
182         __le64 message_iova;
183 };
184
185 #endif /* _FSL_DPBP_CMD_H */