GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / fsl-mc / bus / dpio / dpio-cmd.h
1 /*
2  * Copyright 2013-2016 Freescale Semiconductor Inc.
3  * Copyright 2016 NXP
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the above-listed copyright holders nor the
13  * names of any contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * ALTERNATIVELY, this software may be distributed under the terms of the
17  * GNU General Public License ("GPL") as published by the Free Software
18  * Foundation, either version 2 of that License or (at your option) any
19  * later version.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 #ifndef _FSL_DPIO_CMD_H
34 #define _FSL_DPIO_CMD_H
35
36 /* DPIO Version */
37 #define DPIO_VER_MAJOR                  4
38 #define DPIO_VER_MINOR                  2
39
40 /* Command Versioning */
41
42 #define DPIO_CMD_ID_OFFSET              4
43 #define DPIO_CMD_BASE_VERSION           1
44
45 #define DPIO_CMD(id)    (((id) << DPIO_CMD_ID_OFFSET) | DPIO_CMD_BASE_VERSION)
46
47 /* Command IDs */
48 #define DPIO_CMDID_CLOSE                                DPIO_CMD(0x800)
49 #define DPIO_CMDID_OPEN                                 DPIO_CMD(0x803)
50 #define DPIO_CMDID_GET_API_VERSION                      DPIO_CMD(0xa03)
51 #define DPIO_CMDID_ENABLE                               DPIO_CMD(0x002)
52 #define DPIO_CMDID_DISABLE                              DPIO_CMD(0x003)
53 #define DPIO_CMDID_GET_ATTR                             DPIO_CMD(0x004)
54
55 struct dpio_cmd_open {
56         __le32 dpio_id;
57 };
58
59 #define DPIO_CHANNEL_MODE_MASK          0x3
60
61 struct dpio_rsp_get_attr {
62         /* cmd word 0 */
63         __le32 id;
64         __le16 qbman_portal_id;
65         u8 num_priorities;
66         u8 channel_mode;
67         /* cmd word 1 */
68         __le64 qbman_portal_ce_addr;
69         /* cmd word 2 */
70         __le64 qbman_portal_ci_addr;
71         /* cmd word 3 */
72         __le32 qbman_version;
73 };
74
75 #endif /* _FSL_DPIO_CMD_H */