diff options
author | Yogesh Gaur | 2017-11-15 11:59:31 +0530 |
---|---|---|
committer | York Sun | 2017-12-06 14:55:17 -0800 |
commit | 2557c5a942213acc2a0e3353a9c00140ea11b5d4 (patch) | |
tree | 19eab2844a182b9bddcdb761460c8d624a7e7ba8 /include/fsl-mc/fsl_mc_cmd.h | |
parent | ba348904207a2e9061a2405ebd84268f63a1809f (diff) |
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>
Diffstat (limited to 'include/fsl-mc/fsl_mc_cmd.h')
-rw-r--r-- | include/fsl-mc/fsl_mc_cmd.h | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/include/fsl-mc/fsl_mc_cmd.h b/include/fsl-mc/fsl_mc_cmd.h index f3d1498cc0f..1ec67b54916 100644 --- a/include/fsl-mc/fsl_mc_cmd.h +++ b/include/fsl-mc/fsl_mc_cmd.h @@ -1,4 +1,5 @@ -/* Copyright 2013-2015 Freescale Semiconductor Inc. +/* Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright 2017 NXP * * SPDX-License-Identifier: GPL-2.0+ */ @@ -24,6 +25,15 @@ struct mc_command { uint64_t params[MC_CMD_NUM_OF_PARAMS]; }; +struct mc_rsp_create { + __le32 object_id; +}; + +struct mc_rsp_api_ver { + __le16 major_ver; + __le16 minor_ver; +}; + enum mc_cmd_status { MC_CMD_STATUS_OK = 0x0, /*!< Completed successfully */ MC_CMD_STATUS_READY = 0x1, /*!< Ready to be processed */ @@ -51,15 +61,15 @@ enum mc_cmd_status { #define MC_CMD_FLAG_INTR_DIS 0x01000000 -#define MC_CMD_HDR_CMDID_O 52 /* Command ID field offset */ -#define MC_CMD_HDR_CMDID_S 12 /* Command ID field size */ +#define MC_CMD_HDR_CMDID_O 48 /* Command ID field offset */ +#define MC_CMD_HDR_CMDID_S 16 /* Command ID field size */ #define MC_CMD_HDR_STATUS_O 16 /* Status field offset */ -#define MC_CMD_HDR_TOKEN_O 38 /* Token field offset */ -#define MC_CMD_HDR_TOKEN_S 10 /* Token field size */ +#define MC_CMD_HDR_TOKEN_O 32 /* Token field offset */ +#define MC_CMD_HDR_TOKEN_S 16 /* Token field size */ #define MC_CMD_HDR_STATUS_S 8 /* Status field size*/ #define MC_CMD_HDR_FLAGS_O 0 /* Flags field offset */ #define MC_CMD_HDR_FLAGS_S 32 /* Flags field size*/ -#define MC_CMD_HDR_FLAGS_MASK 0xFF00FF00 /* Command flags mask */ +#define MC_CMD_HDR_FLAGS_MASK 0x0000FFFF /* Command flags mask */ #define MC_CMD_HDR_READ_STATUS(_hdr) \ ((enum mc_cmd_status)mc_dec((_hdr), \ @@ -80,11 +90,19 @@ enum mc_cmd_status { #define MC_RSP_OP(_cmd, _param, _offset, _width, _type, _arg) \ (_arg = (_type)mc_dec(_cmd.params[_param], (_offset), (_width))) +/* cmd, param, offset, width, type, arg_name */ +#define MC_CMD_READ_OBJ_ID(cmd, obj_id) \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, obj_id) + +/* cmd, param, offset, width, type, arg_name */ +#define CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id) \ + MC_CMD_OP(cmd, 0, 0, 32, uint32_t, object_id) + static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id, uint32_t cmd_flags, uint16_t token) { - uint64_t hdr; + uint64_t hdr = 0; hdr = mc_enc(MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S, cmd_id); hdr |= mc_enc(MC_CMD_HDR_FLAGS_O, MC_CMD_HDR_FLAGS_S, @@ -144,4 +162,22 @@ static inline enum mc_cmd_status mc_read_response( return status; } +/** + * mc_read_version - read version of the given cmd + * + * @cmd: pointer to a filled command + * @major_version: major version value for the given cmd + * @minor_version: minor version value for the given cmd + */ +static inline void mc_cmd_read_api_version(struct mc_command *cmd, + u16 *major_ver, + u16 *minor_ver) +{ + struct mc_rsp_api_ver *rsp_params; + + rsp_params = (struct mc_rsp_api_ver *)cmd->params; + *major_ver = le16_to_cpu(rsp_params->major_ver); + *minor_ver = le16_to_cpu(rsp_params->minor_ver); +} + #endif /* __FSL_MC_CMD_H */ |