driver: net: fsl-mc: flib changes for MC 10.3.0
Existing MC driver framework is based on MC-9.x.x flib. This patch
migrates MC obj (DPBP, DPNI, DPRC, DPMAC etc) to use latest MC flib
which is MC-10.3.0.
Changes introduced due to migration:
1. To get OBJ token, pair of create and open API replaces create APIs
2. Pair of close and destroy APIs replaces destroy APIs
3. For version read, get_version APIs replaces get_attributes APIs
4. dpni_get/reset_statistics APIs replaces dpni_get/set_counter APIs
5. Simplifies struct dpni_cfg and removes dpni_extended_cfg struct
6. Single API dpni_get_buffer_layout/set_buffer_layout replaces
dpni_get_rx/set_rx, tx related, tx_conf_buffer_layout related APIs.
New API takes a queue type as an argument.
7. Similarly dpni_get_queue/set_queue replaces
dpni_get_rx_flow/set_rx_flow , tx_flow related, tx_conf related
APIs
Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
diff --git a/include/fsl-mc/fsl_dpio.h b/include/fsl-mc/fsl_dpio.h
index d8c458f..86251e2 100644
--- a/include/fsl-mc/fsl_dpio.h
+++ b/include/fsl-mc/fsl_dpio.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2013-2015 Freescale Semiconductor
+ * Copyright (C) 2013-2016 Freescale Semiconductor
+ * Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -8,19 +9,20 @@
#define _FSL_DPIO_H
/* DPIO Version */
-#define DPIO_VER_MAJOR 3
+#define DPIO_VER_MAJOR 4
#define DPIO_VER_MINOR 2
/* Command IDs */
-#define DPIO_CMDID_CLOSE 0x800
-#define DPIO_CMDID_OPEN 0x803
-#define DPIO_CMDID_CREATE 0x903
-#define DPIO_CMDID_DESTROY 0x900
+#define DPIO_CMDID_CLOSE 0x8001
+#define DPIO_CMDID_OPEN 0x8031
+#define DPIO_CMDID_CREATE 0x9031
+#define DPIO_CMDID_DESTROY 0x9831
+#define DPIO_CMDID_GET_API_VERSION 0xa031
-#define DPIO_CMDID_ENABLE 0x002
-#define DPIO_CMDID_DISABLE 0x003
-#define DPIO_CMDID_GET_ATTR 0x004
-#define DPIO_CMDID_RESET 0x005
+#define DPIO_CMDID_ENABLE 0x0021
+#define DPIO_CMDID_DISABLE 0x0031
+#define DPIO_CMDID_GET_ATTR 0x0041
+#define DPIO_CMDID_RESET 0x0051
/* cmd, param, offset, width, type, arg_name */
#define DPIO_CMD_OPEN(cmd, dpio_id) \
@@ -43,8 +45,6 @@
MC_RSP_OP(cmd, 0, 56, 4, enum dpio_channel_mode, attr->channel_mode);\
MC_RSP_OP(cmd, 1, 0, 64, uint64_t, attr->qbman_portal_ce_offset);\
MC_RSP_OP(cmd, 2, 0, 64, uint64_t, attr->qbman_portal_ci_offset);\
- MC_RSP_OP(cmd, 3, 0, 16, uint16_t, attr->version.major);\
- MC_RSP_OP(cmd, 3, 16, 16, uint16_t, attr->version.minor);\
MC_RSP_OP(cmd, 3, 32, 32, uint32_t, attr->qbman_version);\
} while (0)
@@ -73,7 +73,7 @@
*/
int dpio_open(struct fsl_mc_io *mc_io,
uint32_t cmd_flags,
- int dpio_id,
+ uint32_t dpio_id,
uint16_t *token);
/**
@@ -114,9 +114,10 @@
/**
* dpio_create() - Create the DPIO object.
* @mc_io: Pointer to MC portal's I/O object
+ * @token: Authentication token.
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
* @cfg: Configuration structure
- * @token: Returned token; use in subsequent API calls
+ * @obj_id: Returned obj_id; use in subsequent API calls
*
* Create the DPIO object, allocate required resources and
* perform required initialization.
@@ -134,21 +135,24 @@
* Return: '0' on Success; Error code otherwise.
*/
int dpio_create(struct fsl_mc_io *mc_io,
+ uint16_t token,
uint32_t cmd_flags,
const struct dpio_cfg *cfg,
- uint16_t *token);
+ uint32_t *obj_id);
/**
* dpio_destroy() - Destroy the DPIO object and release all its resources.
* @mc_io: Pointer to MC portal's I/O object
+ * @token: Authentication token.
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPIO object
+ * @obj_id: Object ID of DPIO
*
* Return: '0' on Success; Error code otherwise
*/
int dpio_destroy(struct fsl_mc_io *mc_io,
+ uint16_t token,
uint32_t cmd_flags,
- uint16_t token);
+ uint32_t obj_id);
/**
* dpio_enable() - Enable the DPIO, allow I/O portal operations.
@@ -199,16 +203,7 @@
* @qbman_version: QBMAN version
*/
struct dpio_attr {
- int id;
- /**
- * struct version - DPIO version
- * @major: DPIO major version
- * @minor: DPIO minor version
- */
- struct {
- uint16_t major;
- uint16_t minor;
- } version;
+ uint32_t id;
uint64_t qbman_portal_ce_offset;
uint64_t qbman_portal_ci_offset;
uint16_t qbman_portal_id;
@@ -231,4 +226,19 @@
uint16_t token,
struct dpio_attr *attr);
+/**
+ * dpio_get_api_version - Retrieve DPIO Major and Minor version info.
+ *
+ * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @major_ver: DPIO major version
+ * @minor_ver: DPIO minor version
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dpio_get_api_version(struct fsl_mc_io *mc_io,
+ u32 cmd_flags,
+ u16 *major_ver,
+ u16 *minor_ver);
+
#endif /* _FSL_DPIO_H */