2 * Copyright (C) 2013-2015 Freescale Semiconductor
4 * SPDX-License-Identifier: GPL-2.0+
11 #define DPIO_VER_MAJOR 2
12 #define DPIO_VER_MINOR 1
15 #define DPIO_CMDID_CLOSE 0x800
16 #define DPIO_CMDID_OPEN 0x803
18 #define DPIO_CMDID_ENABLE 0x002
19 #define DPIO_CMDID_DISABLE 0x003
20 #define DPIO_CMDID_GET_ATTR 0x004
21 #define DPIO_CMDID_RESET 0x005
23 /* cmd, param, offset, width, type, arg_name */
24 #define DPIO_CMD_OPEN(cmd, dpio_id) \
25 MC_CMD_OP(cmd, 0, 0, 32, int, dpio_id)
27 /* cmd, param, offset, width, type, arg_name */
28 #define DPIO_RSP_GET_ATTR(cmd, attr) \
30 MC_RSP_OP(cmd, 0, 0, 32, int, attr->id);\
31 MC_RSP_OP(cmd, 0, 32, 16, uint16_t, attr->qbman_portal_id);\
32 MC_RSP_OP(cmd, 0, 48, 8, uint8_t, attr->num_priorities);\
33 MC_RSP_OP(cmd, 0, 56, 4, enum dpio_channel_mode, attr->channel_mode);\
34 MC_RSP_OP(cmd, 1, 0, 64, uint64_t, attr->qbman_portal_ce_paddr);\
35 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, attr->qbman_portal_ci_paddr);\
36 MC_RSP_OP(cmd, 3, 0, 16, uint16_t, attr->version.major);\
37 MC_RSP_OP(cmd, 3, 16, 16, uint16_t, attr->version.minor);\
40 /* Data Path I/O Portal API
41 * Contains initialization APIs and runtime control APIs for DPIO
46 * dpio_open() - Open a control session for the specified object
47 * @mc_io: Pointer to MC portal's I/O object
48 * @dpio_id: DPIO unique ID
49 * @token: Returned token; use in subsequent API calls
51 * This function can be used to open a control session for an
52 * already created object; an object may have been declared in
53 * the DPL or by calling the dpio_create() function.
54 * This function returns a unique authentication token,
55 * associated with the specific object ID and the specific MC
56 * portal; this token must be used in all subsequent commands for
57 * this specific object.
59 * Return: '0' on Success; Error code otherwise.
61 int dpio_open(struct fsl_mc_io *mc_io, int dpio_id, uint16_t *token);
64 * dpio_open() - Open a control session for the specified object
65 * @mc_io: Pointer to MC portal's I/O object
66 * @dpio_id: DPIO unique ID
67 * @token: Returned token; use in subsequent API calls
69 * This function can be used to open a control session for an
70 * already created object; an object may have been declared in
71 * the DPL or by calling the dpio_create() function.
72 * This function returns a unique authentication token,
73 * associated with the specific object ID and the specific MC
74 * portal; this token must be used in all subsequent commands for
75 * this specific object.
77 * Return: '0' on Success; Error code otherwise.
79 int dpio_close(struct fsl_mc_io *mc_io, uint16_t token);
82 * enum dpio_channel_mode - DPIO notification channel mode
83 * @DPIO_NO_CHANNEL: No support for notification channel
84 * @DPIO_LOCAL_CHANNEL: Notifications on data availability can be received by a
85 * dedicated channel in the DPIO; user should point the queue's
86 * destination in the relevant interface to this DPIO
88 enum dpio_channel_mode {
90 DPIO_LOCAL_CHANNEL = 1,
94 * dpio_enable() - Enable the DPIO, allow I/O portal operations.
95 * @mc_io: Pointer to MC portal's I/O object
96 * @token: Token of DPIO object
98 * Return: '0' on Success; Error code otherwise
100 int dpio_enable(struct fsl_mc_io *mc_io, uint16_t token);
103 * dpio_disable() - Disable the DPIO, stop any I/O portal operation.
104 * @mc_io: Pointer to MC portal's I/O object
105 * @token: Token of DPIO object
107 * Return: '0' on Success; Error code otherwise
109 int dpio_disable(struct fsl_mc_io *mc_io, uint16_t token);
112 * dpio_reset() - Reset the DPIO, returns the object to initial state.
113 * @mc_io: Pointer to MC portal's I/O object
114 * @token: Token of DPIO object
116 * Return: '0' on Success; Error code otherwise.
118 int dpio_reset(struct fsl_mc_io *mc_io, uint16_t token);
121 * struct dpio_attr - Structure representing DPIO attributes
122 * @id: DPIO object ID
123 * @version: DPIO version
124 * @qbman_portal_ce_paddr: Physical address of the software portal
126 * @qbman_portal_ci_paddr: Physical address of the software portal
127 * cache-inhibited area
128 * @qbman_portal_id: Software portal ID
129 * @channel_mode: Notification channel mode
130 * @num_priorities: Number of priorities for the notification channel (1-8);
131 * relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
136 * struct version - DPIO version
137 * @major: DPIO major version
138 * @minor: DPIO minor version
144 uint64_t qbman_portal_ce_paddr;
145 uint64_t qbman_portal_ci_paddr;
146 uint16_t qbman_portal_id;
147 enum dpio_channel_mode channel_mode;
148 uint8_t num_priorities;
152 * dpio_get_attributes() - Retrieve DPIO attributes
153 * @mc_io: Pointer to MC portal's I/O object
154 * @token: Token of DPIO object
155 * @attr: Returned object's attributes
157 * Return: '0' on Success; Error code otherwise
159 int dpio_get_attributes(struct fsl_mc_io *mc_io,
161 struct dpio_attr *attr);
163 #endif /* _FSL_DPIO_H */