Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Freescale Management Complex (MC) bus private declarations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2016 Freescale Semiconductor, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #ifndef _FSL_MC_PRIVATE_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #define _FSL_MC_PRIVATE_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/fsl/mc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * Data Path Management Complex (DPMNG) General API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) /* DPMNG command versioning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define DPMNG_CMD_BASE_VERSION		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define DPMNG_CMD_ID_OFFSET		4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define DPMNG_CMD(id)	(((id) << DPMNG_CMD_ID_OFFSET) | DPMNG_CMD_BASE_VERSION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) /* DPMNG command IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define DPMNG_CMDID_GET_VERSION		DPMNG_CMD(0x831)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) struct dpmng_rsp_get_version {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	__le32 revision;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	__le32 version_major;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	__le32 version_minor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * Data Path Management Command Portal (DPMCP) API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) /* Minimal supported DPMCP Version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define DPMCP_MIN_VER_MAJOR		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #define DPMCP_MIN_VER_MINOR		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) /* DPMCP command versioning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define DPMCP_CMD_BASE_VERSION		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define DPMCP_CMD_ID_OFFSET		4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define DPMCP_CMD(id)	(((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /* DPMCP command IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define DPMCP_CMDID_CLOSE		DPMCP_CMD(0x800)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define DPMCP_CMDID_OPEN		DPMCP_CMD(0x80b)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define DPMCP_CMDID_RESET		DPMCP_CMD(0x005)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) struct dpmcp_cmd_open {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	__le32 dpmcp_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * Initialization and runtime control APIs for DPMCP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) int dpmcp_open(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	       u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	       int dpmcp_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	       u16 *token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) int dpmcp_close(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		u16 token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) int dpmcp_reset(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		u16 token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * Data Path Resource Container (DPRC) API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) /* Minimal supported DPRC Version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #define DPRC_MIN_VER_MAJOR			6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #define DPRC_MIN_VER_MINOR			0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) /* DPRC command versioning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) #define DPRC_CMD_BASE_VERSION			1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #define DPRC_CMD_2ND_VERSION			2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #define DPRC_CMD_3RD_VERSION			3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #define DPRC_CMD_ID_OFFSET			4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #define DPRC_CMD(id)	(((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #define DPRC_CMD_V2(id)	(((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_2ND_VERSION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) #define DPRC_CMD_V3(id)	(((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_3RD_VERSION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) /* DPRC command IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #define DPRC_CMDID_CLOSE                        DPRC_CMD(0x800)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) #define DPRC_CMDID_OPEN                         DPRC_CMD(0x805)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #define DPRC_CMDID_GET_API_VERSION              DPRC_CMD(0xa05)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #define DPRC_CMDID_GET_ATTR                     DPRC_CMD(0x004)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #define DPRC_CMDID_RESET_CONT                   DPRC_CMD(0x005)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define DPRC_CMDID_RESET_CONT_V2                DPRC_CMD_V2(0x005)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #define DPRC_CMDID_SET_IRQ                      DPRC_CMD(0x010)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define DPRC_CMDID_SET_IRQ_ENABLE               DPRC_CMD(0x012)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define DPRC_CMDID_SET_IRQ_MASK                 DPRC_CMD(0x014)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define DPRC_CMDID_GET_IRQ_STATUS               DPRC_CMD(0x016)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define DPRC_CMDID_CLEAR_IRQ_STATUS             DPRC_CMD(0x017)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #define DPRC_CMDID_GET_CONT_ID                  DPRC_CMD(0x830)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #define DPRC_CMDID_GET_OBJ_COUNT                DPRC_CMD(0x159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define DPRC_CMDID_GET_OBJ                      DPRC_CMD(0x15A)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #define DPRC_CMDID_GET_OBJ_REG                  DPRC_CMD(0x15E)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #define DPRC_CMDID_GET_OBJ_REG_V2               DPRC_CMD_V2(0x15E)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #define DPRC_CMDID_GET_OBJ_REG_V3               DPRC_CMD_V3(0x15E)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define DPRC_CMDID_SET_OBJ_IRQ                  DPRC_CMD(0x15F)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define DPRC_CMDID_GET_CONNECTION               DPRC_CMD(0x16C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct dprc_cmd_open {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	__le32 container_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct dprc_cmd_reset_container {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	__le32 child_container_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	__le32 options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) struct dprc_cmd_set_irq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	/* cmd word 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	__le32 irq_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	u8 irq_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	u8 pad[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	/* cmd word 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	__le64 irq_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	/* cmd word 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	__le32 irq_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define DPRC_ENABLE		0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct dprc_cmd_set_irq_enable {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	u8 enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	u8 pad[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	u8 irq_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct dprc_cmd_set_irq_mask {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	__le32 mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	u8 irq_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct dprc_cmd_get_irq_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	__le32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	u8 irq_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct dprc_rsp_get_irq_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	__le32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct dprc_cmd_clear_irq_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	__le32 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	u8 irq_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct dprc_rsp_get_attributes {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	/* response word 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	__le32 container_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	__le32 icid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	/* response word 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	__le32 options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	__le32 portal_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) struct dprc_rsp_get_obj_count {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	__le32 pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	__le32 obj_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) struct dprc_cmd_get_obj {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	__le32 obj_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) struct dprc_rsp_get_obj {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	/* response word 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	__le32 pad0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	__le32 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	/* response word 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	__le16 vendor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	u8 irq_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	u8 region_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	__le32 state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	/* response word 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	__le16 version_major;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	__le16 version_minor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	__le16 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	__le16 pad1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	/* response word 3-4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	u8 type[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	/* response word 5-6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	u8 label[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) struct dprc_cmd_get_obj_region {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	/* cmd word 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	__le32 obj_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	__le16 pad0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	u8 region_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	u8 pad1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	/* cmd word 1-2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	__le64 pad2[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	/* cmd word 3-4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	u8 obj_type[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) struct dprc_rsp_get_obj_region {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	/* response word 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	__le64 pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	/* response word 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	__le64 base_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	/* response word 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	__le32 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	__le32 pad2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	/* response word 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	__le32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	__le32 pad3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	/* response word 4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	/* base_addr may be zero if older MC firmware is used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	__le64 base_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) struct dprc_cmd_set_obj_irq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	/* cmd word 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	__le32 irq_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	u8 irq_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	u8 pad[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	/* cmd word 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	__le64 irq_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	/* cmd word 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	__le32 irq_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	__le32 obj_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	/* cmd word 3-4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	u8 obj_type[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) struct dprc_cmd_get_connection {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	__le32 ep1_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	__le16 ep1_interface_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	u8 pad[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	u8 ep1_type[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) struct dprc_rsp_get_connection {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	__le64 pad[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	__le32 ep2_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	__le16 ep2_interface_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	__le16 pad1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	u8 ep2_type[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	__le32 state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)  * DPRC API for managing and querying DPAA resources
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) int dprc_open(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	      u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	      int container_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	      u16 *token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) int dprc_close(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	       u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	       u16 token);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) /* DPRC IRQ events */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) /* IRQ event - Indicates that a new object added to the container */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #define DPRC_IRQ_EVENT_OBJ_ADDED		0x00000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) /* IRQ event - Indicates that an object was removed from the container */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) #define DPRC_IRQ_EVENT_OBJ_REMOVED		0x00000002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)  * IRQ event - Indicates that one of the descendant containers that opened by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)  * this container is destroyed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) #define DPRC_IRQ_EVENT_CONTAINER_DESTROYED	0x00000010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)  * IRQ event - Indicates that on one of the container's opened object is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  * destroyed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) #define DPRC_IRQ_EVENT_OBJ_DESTROYED		0x00000020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) /* Irq event - Indicates that object is created at the container */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) #define DPRC_IRQ_EVENT_OBJ_CREATED		0x00000040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)  * struct dprc_irq_cfg - IRQ configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)  * @paddr:	Address that must be written to signal a message-based interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  * @val:	Value to write into irq_addr address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  * @irq_num:	A user defined number associated with this IRQ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) struct dprc_irq_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	     phys_addr_t paddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	     u32 val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	     int irq_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) int dprc_set_irq(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 		 u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 		 u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 		 u8 irq_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 		 struct dprc_irq_cfg *irq_cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 			u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 			u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 			u8 irq_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 			u8 en);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 		      u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 		      u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		      u8 irq_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 		      u32 mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) int dprc_get_irq_status(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 			u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 			u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 			u8 irq_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 			u32 *status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 			  u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 			  u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 			  u8 irq_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 			  u32 status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)  * struct dprc_attributes - Container attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)  * @container_id: Container's ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)  * @icid: Container's ICID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)  * @portal_id: Container's portal ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  * @options: Container's options as set at container's creation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) struct dprc_attributes {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	int container_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	u32 icid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	int portal_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	u64 options;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) int dprc_get_attributes(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 			u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 			u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 			struct dprc_attributes *attributes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) int dprc_get_obj_count(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 		       u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 		       u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 		       int *obj_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) int dprc_get_obj(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 		 u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 		 u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		 int obj_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 		 struct fsl_mc_obj_desc *obj_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 		     u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		     u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		     char *obj_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 		     int obj_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 		     u8 irq_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 		     struct dprc_irq_cfg *irq_cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)  * enum dprc_region_type - Region type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)  * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)  * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) enum dprc_region_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	DPRC_REGION_TYPE_MC_PORTAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	DPRC_REGION_TYPE_QBMAN_PORTAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	DPRC_REGION_TYPE_QBMAN_MEM_BACKED_PORTAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)  * struct dprc_region_desc - Mappable region descriptor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)  * @base_offset: Region offset from region's base address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)  *	For DPMCP and DPRC objects, region base is offset from SoC MC portals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)  *	base address; For DPIO, region base is offset from SoC QMan portals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)  *	base address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)  * @size: Region size (in bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)  * @flags: Region attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)  * @type: Portal region type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) struct dprc_region_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	u32 base_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	u32 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	enum dprc_region_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	u64 base_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) int dprc_get_obj_region(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 			u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 			u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 			char *obj_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 			int obj_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 			u8 region_index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 			struct dprc_region_desc *region_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) int dprc_get_api_version(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 			 u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 			 u16 *major_ver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 			 u16 *minor_ver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) int dprc_get_container_id(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 			  u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 			  int *container_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)  * struct dprc_endpoint - Endpoint description for link connect/disconnect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)  *			operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)  * @type:	Endpoint object type: NULL terminated string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)  * @id:		Endpoint object ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)  * @if_id:	Interface ID; should be set for endpoints with multiple
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)  *		interfaces ("dpsw", "dpdmux"); for others, always set to 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) struct dprc_endpoint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	char type[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	int id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 	u16 if_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) int dprc_get_connection(struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 			u32 cmd_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 			u16 token,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 			const struct dprc_endpoint *endpoint1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 			struct dprc_endpoint *endpoint2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 			int *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)  * Data Path Buffer Pool (DPBP) API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) /* DPBP Version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) #define DPBP_VER_MAJOR				3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) #define DPBP_VER_MINOR				2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) /* Command versioning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) #define DPBP_CMD_BASE_VERSION			1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) #define DPBP_CMD_ID_OFFSET			4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) #define DPBP_CMD(id)	(((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) /* Command IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) #define DPBP_CMDID_CLOSE		DPBP_CMD(0x800)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) #define DPBP_CMDID_OPEN			DPBP_CMD(0x804)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) #define DPBP_CMDID_ENABLE		DPBP_CMD(0x002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) #define DPBP_CMDID_DISABLE		DPBP_CMD(0x003)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) #define DPBP_CMDID_GET_ATTR		DPBP_CMD(0x004)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) #define DPBP_CMDID_RESET		DPBP_CMD(0x005)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) struct dpbp_cmd_open {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 	__le32 dpbp_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) #define DPBP_ENABLE			0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) struct dpbp_rsp_get_attributes {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 	/* response word 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 	__le16 pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	__le16 bpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 	__le32 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 	/* response word 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 	__le16 version_major;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 	__le16 version_minor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)  * Data Path Concentrator (DPCON) API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) /* DPCON Version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) #define DPCON_VER_MAJOR				3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) #define DPCON_VER_MINOR				2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) /* Command versioning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) #define DPCON_CMD_BASE_VERSION			1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) #define DPCON_CMD_ID_OFFSET			4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) #define DPCON_CMD(id)	(((id) << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) /* Command IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) #define DPCON_CMDID_CLOSE			DPCON_CMD(0x800)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) #define DPCON_CMDID_OPEN			DPCON_CMD(0x808)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) #define DPCON_CMDID_ENABLE			DPCON_CMD(0x002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) #define DPCON_CMDID_DISABLE			DPCON_CMD(0x003)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) #define DPCON_CMDID_GET_ATTR			DPCON_CMD(0x004)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) #define DPCON_CMDID_RESET			DPCON_CMD(0x005)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) #define DPCON_CMDID_SET_NOTIFICATION		DPCON_CMD(0x100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) struct dpcon_cmd_open {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 	__le32 dpcon_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) #define DPCON_ENABLE			1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) struct dpcon_rsp_get_attr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 	/* response word 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 	__le32 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 	__le16 qbman_ch_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 	u8 num_priorities;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 	u8 pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) struct dpcon_cmd_set_notification {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 	/* cmd word 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 	__le32 dpio_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 	u8 priority;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 	u8 pad[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	/* cmd word 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	__le64 user_ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)  * struct fsl_mc_resource_pool - Pool of MC resources of a given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)  * type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)  * @type: type of resources in the pool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)  * @max_count: maximum number of resources in the pool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530)  * @free_count: number of free resources in the pool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)  * @mutex: mutex to serialize access to the pool's free list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)  * @free_list: anchor node of list of free resources in the pool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)  * @mc_bus: pointer to the MC bus that owns this resource pool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) struct fsl_mc_resource_pool {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 	enum fsl_mc_pool_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 	int max_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	int free_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 	struct mutex mutex;	/* serializes access to free_list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	struct list_head free_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 	struct fsl_mc_bus *mc_bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)  * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)  * @mc_dev: fsl-mc device for the bus device itself.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)  * @resource_pools: array of resource pools (one pool per resource type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548)  * for this MC bus. These resources represent allocatable entities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)  * from the physical DPRC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)  * @irq_resources: Pointer to array of IRQ objects for the IRQ pool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)  * @scan_mutex: Serializes bus scanning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552)  * @dprc_attr: DPRC attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) struct fsl_mc_bus {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 	struct fsl_mc_device mc_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 	struct fsl_mc_resource_pool resource_pools[FSL_MC_NUM_POOL_TYPES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	struct fsl_mc_device_irq *irq_resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 	struct mutex scan_mutex;    /* serializes bus scanning */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 	struct dprc_attributes dprc_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) #define to_fsl_mc_bus(_mc_dev) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	container_of(_mc_dev, struct fsl_mc_bus, mc_dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 				   struct fsl_mc_io *mc_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 				   struct device *parent_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 				   struct fsl_mc_device **new_mc_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) void fsl_mc_device_remove(struct fsl_mc_device *mc_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) int __init dprc_driver_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) void dprc_driver_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) int __init fsl_mc_allocator_driver_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) void fsl_mc_allocator_driver_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 					  enum fsl_mc_pool_type pool_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 					  struct fsl_mc_resource
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 							  **new_resource);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) void fsl_mc_resource_free(struct fsl_mc_resource *resource);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 				 unsigned int irq_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) void fsl_mc_msi_domain_free_irqs(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) struct irq_domain *fsl_mc_find_msi_domain(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) int __must_check fsl_create_mc_io(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 				  phys_addr_t mc_portal_phys_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 				  u32 mc_portal_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 				  struct fsl_mc_device *dpmcp_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 				  u32 flags, struct fsl_mc_io **new_mc_io);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) void fsl_destroy_mc_io(struct fsl_mc_io *mc_io);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) bool fsl_mc_is_root_dprc(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) void fsl_mc_get_root_dprc(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 			 struct device **root_dprc_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc *obj_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 					   struct fsl_mc_device *mc_bus_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) #endif /* _FSL_MC_PRIVATE_H_ */