xref: /linux/drivers/soc/fsl/dpio/dpio-cmd.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1c89105c9SRoy Pledge /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2c89105c9SRoy Pledge /*
3c89105c9SRoy Pledge  * Copyright 2013-2016 Freescale Semiconductor Inc.
4c89105c9SRoy Pledge  * Copyright 2016 NXP
5c89105c9SRoy Pledge  *
6c89105c9SRoy Pledge  */
7c89105c9SRoy Pledge #ifndef _FSL_DPIO_CMD_H
8c89105c9SRoy Pledge #define _FSL_DPIO_CMD_H
9c89105c9SRoy Pledge 
10c89105c9SRoy Pledge /* DPIO Version */
11c89105c9SRoy Pledge #define DPIO_VER_MAJOR			4
12c89105c9SRoy Pledge #define DPIO_VER_MINOR			2
13c89105c9SRoy Pledge 
14c89105c9SRoy Pledge /* Command Versioning */
15c89105c9SRoy Pledge 
16c89105c9SRoy Pledge #define DPIO_CMD_ID_OFFSET		4
17c89105c9SRoy Pledge #define DPIO_CMD_BASE_VERSION		1
18c89105c9SRoy Pledge 
19c89105c9SRoy Pledge #define DPIO_CMD(id)	(((id) << DPIO_CMD_ID_OFFSET) | DPIO_CMD_BASE_VERSION)
20c89105c9SRoy Pledge 
21c89105c9SRoy Pledge /* Command IDs */
22c89105c9SRoy Pledge #define DPIO_CMDID_CLOSE				DPIO_CMD(0x800)
23c89105c9SRoy Pledge #define DPIO_CMDID_OPEN					DPIO_CMD(0x803)
24c89105c9SRoy Pledge #define DPIO_CMDID_GET_API_VERSION			DPIO_CMD(0xa03)
25c89105c9SRoy Pledge #define DPIO_CMDID_ENABLE				DPIO_CMD(0x002)
26c89105c9SRoy Pledge #define DPIO_CMDID_DISABLE				DPIO_CMD(0x003)
27c89105c9SRoy Pledge #define DPIO_CMDID_GET_ATTR				DPIO_CMD(0x004)
2811c8bac9SRoy Pledge #define DPIO_CMDID_RESET				DPIO_CMD(0x005)
2951da14e9SIoana Ciornei #define DPIO_CMDID_SET_STASHING_DEST			DPIO_CMD(0x120)
30c89105c9SRoy Pledge 
31c89105c9SRoy Pledge struct dpio_cmd_open {
32c89105c9SRoy Pledge 	__le32 dpio_id;
33c89105c9SRoy Pledge };
34c89105c9SRoy Pledge 
35c89105c9SRoy Pledge #define DPIO_CHANNEL_MODE_MASK		0x3
36c89105c9SRoy Pledge 
37c89105c9SRoy Pledge struct dpio_rsp_get_attr {
38c89105c9SRoy Pledge 	/* cmd word 0 */
39c89105c9SRoy Pledge 	__le32 id;
40c89105c9SRoy Pledge 	__le16 qbman_portal_id;
41c89105c9SRoy Pledge 	u8 num_priorities;
42c89105c9SRoy Pledge 	u8 channel_mode;
43c89105c9SRoy Pledge 	/* cmd word 1 */
44c89105c9SRoy Pledge 	__le64 qbman_portal_ce_addr;
45c89105c9SRoy Pledge 	/* cmd word 2 */
46c89105c9SRoy Pledge 	__le64 qbman_portal_ci_addr;
47c89105c9SRoy Pledge 	/* cmd word 3 */
48c89105c9SRoy Pledge 	__le32 qbman_version;
49*2cf0b6feSIoana Ciornei 	__le32 pad1;
50*2cf0b6feSIoana Ciornei 	/* cmd word 4 */
51*2cf0b6feSIoana Ciornei 	__le32 clk;
52c89105c9SRoy Pledge };
53c89105c9SRoy Pledge 
5451da14e9SIoana Ciornei struct dpio_stashing_dest {
5551da14e9SIoana Ciornei 	u8 sdest;
5651da14e9SIoana Ciornei };
5751da14e9SIoana Ciornei 
58c89105c9SRoy Pledge #endif /* _FSL_DPIO_CMD_H */
59