forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/bus/fsl-mc/fsl-mc-private.h
....@@ -79,9 +79,13 @@
7979
8080 /* DPRC command versioning */
8181 #define DPRC_CMD_BASE_VERSION 1
82
+#define DPRC_CMD_2ND_VERSION 2
83
+#define DPRC_CMD_3RD_VERSION 3
8284 #define DPRC_CMD_ID_OFFSET 4
8385
8486 #define DPRC_CMD(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
87
+#define DPRC_CMD_V2(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_2ND_VERSION)
88
+#define DPRC_CMD_V3(id) (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_3RD_VERSION)
8589
8690 /* DPRC command IDs */
8791 #define DPRC_CMDID_CLOSE DPRC_CMD(0x800)
....@@ -89,6 +93,8 @@
8993 #define DPRC_CMDID_GET_API_VERSION DPRC_CMD(0xa05)
9094
9195 #define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
96
+#define DPRC_CMDID_RESET_CONT DPRC_CMD(0x005)
97
+#define DPRC_CMDID_RESET_CONT_V2 DPRC_CMD_V2(0x005)
9298
9399 #define DPRC_CMDID_SET_IRQ DPRC_CMD(0x010)
94100 #define DPRC_CMDID_SET_IRQ_ENABLE DPRC_CMD(0x012)
....@@ -100,10 +106,19 @@
100106 #define DPRC_CMDID_GET_OBJ_COUNT DPRC_CMD(0x159)
101107 #define DPRC_CMDID_GET_OBJ DPRC_CMD(0x15A)
102108 #define DPRC_CMDID_GET_OBJ_REG DPRC_CMD(0x15E)
109
+#define DPRC_CMDID_GET_OBJ_REG_V2 DPRC_CMD_V2(0x15E)
110
+#define DPRC_CMDID_GET_OBJ_REG_V3 DPRC_CMD_V3(0x15E)
103111 #define DPRC_CMDID_SET_OBJ_IRQ DPRC_CMD(0x15F)
112
+
113
+#define DPRC_CMDID_GET_CONNECTION DPRC_CMD(0x16C)
104114
105115 struct dprc_cmd_open {
106116 __le32 container_id;
117
+};
118
+
119
+struct dprc_cmd_reset_container {
120
+ __le32 child_container_id;
121
+ __le32 options;
107122 };
108123
109124 struct dprc_cmd_set_irq {
....@@ -147,8 +162,7 @@
147162 struct dprc_rsp_get_attributes {
148163 /* response word 0 */
149164 __le32 container_id;
150
- __le16 icid;
151
- __le16 pad;
165
+ __le32 icid;
152166 /* response word 1 */
153167 __le32 options;
154168 __le32 portal_id;
....@@ -199,9 +213,16 @@
199213 /* response word 0 */
200214 __le64 pad;
201215 /* response word 1 */
202
- __le64 base_addr;
216
+ __le64 base_offset;
203217 /* response word 2 */
204218 __le32 size;
219
+ __le32 pad2;
220
+ /* response word 3 */
221
+ __le32 flags;
222
+ __le32 pad3;
223
+ /* response word 4 */
224
+ /* base_addr may be zero if older MC firmware is used */
225
+ __le64 base_addr;
205226 };
206227
207228 struct dprc_cmd_set_obj_irq {
....@@ -216,6 +237,22 @@
216237 __le32 obj_id;
217238 /* cmd word 3-4 */
218239 u8 obj_type[16];
240
+};
241
+
242
+struct dprc_cmd_get_connection {
243
+ __le32 ep1_id;
244
+ __le16 ep1_interface_id;
245
+ u8 pad[2];
246
+ u8 ep1_type[16];
247
+};
248
+
249
+struct dprc_rsp_get_connection {
250
+ __le64 pad[3];
251
+ __le32 ep2_id;
252
+ __le16 ep2_interface_id;
253
+ __le16 pad1;
254
+ u8 ep2_type[16];
255
+ __le32 state;
219256 };
220257
221258 /*
....@@ -302,7 +339,7 @@
302339 */
303340 struct dprc_attributes {
304341 int container_id;
305
- u16 icid;
342
+ u32 icid;
306343 int portal_id;
307344 u64 options;
308345 };
....@@ -330,11 +367,6 @@
330367 int obj_id,
331368 u8 irq_index,
332369 struct dprc_irq_cfg *irq_cfg);
333
-
334
-/* Region flags */
335
-/* Cacheable - Indicates that region should be mapped as cacheable */
336
-#define DPRC_REGION_CACHEABLE 0x00000001
337
-
338370 /**
339371 * enum dprc_region_type - Region type
340372 * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region
....@@ -342,7 +374,8 @@
342374 */
343375 enum dprc_region_type {
344376 DPRC_REGION_TYPE_MC_PORTAL,
345
- DPRC_REGION_TYPE_QBMAN_PORTAL
377
+ DPRC_REGION_TYPE_QBMAN_PORTAL,
378
+ DPRC_REGION_TYPE_QBMAN_MEM_BACKED_PORTAL
346379 };
347380
348381 /**
....@@ -360,6 +393,7 @@
360393 u32 size;
361394 u32 flags;
362395 enum dprc_region_type type;
396
+ u64 base_address;
363397 };
364398
365399 int dprc_get_obj_region(struct fsl_mc_io *mc_io,
....@@ -378,6 +412,27 @@
378412 int dprc_get_container_id(struct fsl_mc_io *mc_io,
379413 u32 cmd_flags,
380414 int *container_id);
415
+
416
+/**
417
+ * struct dprc_endpoint - Endpoint description for link connect/disconnect
418
+ * operations
419
+ * @type: Endpoint object type: NULL terminated string
420
+ * @id: Endpoint object ID
421
+ * @if_id: Interface ID; should be set for endpoints with multiple
422
+ * interfaces ("dpsw", "dpdmux"); for others, always set to 0
423
+ */
424
+struct dprc_endpoint {
425
+ char type[16];
426
+ int id;
427
+ u16 if_id;
428
+};
429
+
430
+int dprc_get_connection(struct fsl_mc_io *mc_io,
431
+ u32 cmd_flags,
432
+ u16 token,
433
+ const struct dprc_endpoint *endpoint1,
434
+ struct dprc_endpoint *endpoint2,
435
+ int *state);
381436
382437 /*
383438 * Data Path Buffer Pool (DPBP) API
....@@ -466,11 +521,6 @@
466521 __le64 user_ctx;
467522 };
468523
469
-/**
470
- * Maximum number of total IRQs that can be pre-allocated for an MC bus'
471
- * IRQ pool
472
- */
473
-#define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS 256
474524
475525 /**
476526 * struct fsl_mc_resource_pool - Pool of MC resources of a given
....@@ -543,13 +593,7 @@
543593
544594 void fsl_mc_msi_domain_free_irqs(struct device *dev);
545595
546
-int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
547
- struct irq_domain **mc_msi_domain);
548
-
549
-int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,
550
- unsigned int irq_count);
551
-
552
-void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus);
596
+struct irq_domain *fsl_mc_find_msi_domain(struct device *dev);
553597
554598 int __must_check fsl_create_mc_io(struct device *dev,
555599 phys_addr_t mc_portal_phys_addr,
....@@ -561,4 +605,10 @@
561605
562606 bool fsl_mc_is_root_dprc(struct device *dev);
563607
608
+void fsl_mc_get_root_dprc(struct device *dev,
609
+ struct device **root_dprc_dev);
610
+
611
+struct fsl_mc_device *fsl_mc_device_lookup(struct fsl_mc_obj_desc *obj_desc,
612
+ struct fsl_mc_device *mc_bus_dev);
613
+
564614 #endif /* _FSL_MC_PRIVATE_H_ */