18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 2013-2016 Freescale Semiconductor Inc.
48c2ecf20Sopenharmony_ci * Copyright 2016 NXP
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef _FSL_DPIO_CMD_H
88c2ecf20Sopenharmony_ci#define _FSL_DPIO_CMD_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* DPIO Version */
118c2ecf20Sopenharmony_ci#define DPIO_VER_MAJOR			4
128c2ecf20Sopenharmony_ci#define DPIO_VER_MINOR			2
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* Command Versioning */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define DPIO_CMD_ID_OFFSET		4
178c2ecf20Sopenharmony_ci#define DPIO_CMD_BASE_VERSION		1
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define DPIO_CMD(id)	(((id) << DPIO_CMD_ID_OFFSET) | DPIO_CMD_BASE_VERSION)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Command IDs */
228c2ecf20Sopenharmony_ci#define DPIO_CMDID_CLOSE				DPIO_CMD(0x800)
238c2ecf20Sopenharmony_ci#define DPIO_CMDID_OPEN					DPIO_CMD(0x803)
248c2ecf20Sopenharmony_ci#define DPIO_CMDID_GET_API_VERSION			DPIO_CMD(0xa03)
258c2ecf20Sopenharmony_ci#define DPIO_CMDID_ENABLE				DPIO_CMD(0x002)
268c2ecf20Sopenharmony_ci#define DPIO_CMDID_DISABLE				DPIO_CMD(0x003)
278c2ecf20Sopenharmony_ci#define DPIO_CMDID_GET_ATTR				DPIO_CMD(0x004)
288c2ecf20Sopenharmony_ci#define DPIO_CMDID_RESET				DPIO_CMD(0x005)
298c2ecf20Sopenharmony_ci#define DPIO_CMDID_SET_STASHING_DEST			DPIO_CMD(0x120)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_cistruct dpio_cmd_open {
328c2ecf20Sopenharmony_ci	__le32 dpio_id;
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define DPIO_CHANNEL_MODE_MASK		0x3
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistruct dpio_rsp_get_attr {
388c2ecf20Sopenharmony_ci	/* cmd word 0 */
398c2ecf20Sopenharmony_ci	__le32 id;
408c2ecf20Sopenharmony_ci	__le16 qbman_portal_id;
418c2ecf20Sopenharmony_ci	u8 num_priorities;
428c2ecf20Sopenharmony_ci	u8 channel_mode;
438c2ecf20Sopenharmony_ci	/* cmd word 1 */
448c2ecf20Sopenharmony_ci	__le64 qbman_portal_ce_addr;
458c2ecf20Sopenharmony_ci	/* cmd word 2 */
468c2ecf20Sopenharmony_ci	__le64 qbman_portal_ci_addr;
478c2ecf20Sopenharmony_ci	/* cmd word 3 */
488c2ecf20Sopenharmony_ci	__le32 qbman_version;
498c2ecf20Sopenharmony_ci};
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cistruct dpio_stashing_dest {
528c2ecf20Sopenharmony_ci	u8 sdest;
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#endif /* _FSL_DPIO_CMD_H */
56