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>
This commit is contained in:
Yogesh Gaur
2017-11-15 11:59:31 +05:30
committed by York Sun
parent ba34890420
commit 2557c5a942
16 changed files with 1081 additions and 1323 deletions

View File

@@ -1,8 +1,8 @@
/*
* Freescale Layerscape MC I/O wrapper
*
* Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
* Author: German Rivera <German.Rivera@freescale.com>
* Copyright (C) 2013-2016 Freescale Semiconductor, Inc.
* Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -14,19 +14,21 @@
#define __FSL_DPBP_H
/* DPBP Version */
#define DPBP_VER_MAJOR 2
#define DPBP_VER_MINOR 2
#define DPBP_VER_MAJOR 3
#define DPBP_VER_MINOR 3
/* Command IDs */
#define DPBP_CMDID_CLOSE 0x800
#define DPBP_CMDID_OPEN 0x804
#define DPBP_CMDID_CREATE 0x904
#define DPBP_CMDID_DESTROY 0x900
#define DPBP_CMDID_CLOSE 0x8001
#define DPBP_CMDID_OPEN 0x8041
#define DPBP_CMDID_CREATE 0x9041
#define DPBP_CMDID_DESTROY 0x9841
#define DPBP_CMDID_GET_API_VERSION 0xa041
#define DPBP_CMDID_ENABLE 0x002
#define DPBP_CMDID_DISABLE 0x003
#define DPBP_CMDID_GET_ATTR 0x004
#define DPBP_CMDID_RESET 0x005
#define DPBP_CMDID_ENABLE 0x0021
#define DPBP_CMDID_DISABLE 0x0031
#define DPBP_CMDID_GET_ATTR 0x0041
#define DPBP_CMDID_RESET 0x0051
#define DPBP_CMDID_IS_ENABLED 0x0061
/* cmd, param, offset, width, type, arg_name */
#define DPBP_CMD_OPEN(cmd, dpbp_id) \
@@ -37,8 +39,6 @@
do { \
MC_RSP_OP(cmd, 0, 16, 16, uint16_t, attr->bpid); \
MC_RSP_OP(cmd, 0, 32, 32, int, attr->id);\
MC_RSP_OP(cmd, 1, 0, 16, uint16_t, attr->version.major);\
MC_RSP_OP(cmd, 1, 16, 16, uint16_t, attr->version.minor);\
} while (0)
/* Data Path Buffer Pool API
@@ -114,9 +114,10 @@ struct dpbp_cfg {
* Return: '0' on Success; Error code otherwise.
*/
int dpbp_create(struct fsl_mc_io *mc_io,
uint16_t dprc_token,
uint32_t cmd_flags,
const struct dpbp_cfg *cfg,
uint16_t *token);
uint32_t *obj_id);
/**
* dpbp_destroy() - Destroy the DPBP object and release all its resources.
@@ -127,8 +128,9 @@ int dpbp_create(struct fsl_mc_io *mc_io,
* Return: '0' on Success; error code otherwise.
*/
int dpbp_destroy(struct fsl_mc_io *mc_io,
uint16_t dprc_token,
uint32_t cmd_flags,
uint16_t token);
uint32_t obj_id);
/**
* dpbp_enable() - Enable the DPBP.
@@ -189,16 +191,7 @@ int dpbp_reset(struct fsl_mc_io *mc_io,
* acquire/release operations on buffers
*/
struct dpbp_attr {
int id;
/**
* struct version - Structure representing DPBP version
* @major: DPBP major version
* @minor: DPBP minor version
*/
struct {
uint16_t major;
uint16_t minor;
} version;
uint32_t id;
uint16_t bpid;
};
@@ -217,6 +210,21 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
uint16_t token,
struct dpbp_attr *attr);
/**
* dpbp_get_api_version - Retrieve DPBP 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: DPBP major version
* @minor_ver: DPBP minor version
*
* Return: '0' on Success; Error code otherwise.
*/
int dpbp_get_api_version(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 *major_ver,
u16 *minor_ver);
/** @} */
#endif /* __FSL_DPBP_H */

View File

@@ -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 @@ do { \
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 @@ struct fsl_mc_io;
*/
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 @@ struct dpio_cfg {
/**
* 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 @@ struct dpio_cfg {
* 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 @@ int dpio_reset(struct fsl_mc_io *mc_io,
* @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 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
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 */

View File

@@ -1,7 +1,8 @@
/*
* Freescale Layerscape MC I/O wrapper
*
* Copyright (C) 2015 Freescale Semiconductor, Inc.
* Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
* Copyright 2017 NXP
* Author: Prabhakar Kushwaha <prabhakar@freescale.com>
*
* SPDX-License-Identifier: GPL-2.0+
@@ -11,27 +12,28 @@
#define __FSL_DPMAC_H
/* DPMAC Version */
#define DPMAC_VER_MAJOR 3
#define DPMAC_VER_MAJOR 4
#define DPMAC_VER_MINOR 2
/* Command IDs */
#define DPMAC_CMDID_CLOSE 0x800
#define DPMAC_CMDID_OPEN 0x80c
#define DPMAC_CMDID_CREATE 0x90c
#define DPMAC_CMDID_DESTROY 0x900
#define DPMAC_CMDID_CLOSE 0x8001
#define DPMAC_CMDID_OPEN 0x80c1
#define DPMAC_CMDID_CREATE 0x90c1
#define DPMAC_CMDID_DESTROY 0x98c1
#define DPMAC_CMDID_GET_API_VERSION 0xa0c1
#define DPMAC_CMDID_GET_ATTR 0x004
#define DPMAC_CMDID_RESET 0x005
#define DPMAC_CMDID_GET_ATTR 0x0041
#define DPMAC_CMDID_RESET 0x0051
#define DPMAC_CMDID_MDIO_READ 0x0c0
#define DPMAC_CMDID_MDIO_WRITE 0x0c1
#define DPMAC_CMDID_GET_LINK_CFG 0x0c2
#define DPMAC_CMDID_SET_LINK_STATE 0x0c3
#define DPMAC_CMDID_GET_COUNTER 0x0c4
#define DPMAC_CMDID_MDIO_READ 0x0c01
#define DPMAC_CMDID_MDIO_WRITE 0x0c11
#define DPMAC_CMDID_GET_LINK_CFG 0x0c21
#define DPMAC_CMDID_SET_LINK_STATE 0x0c31
#define DPMAC_CMDID_GET_COUNTER 0x0c41
/* cmd, param, offset, width, type, arg_name */
#define DPMAC_CMD_CREATE(cmd, cfg) \
MC_CMD_OP(cmd, 0, 0, 32, int, cfg->mac_id)
MC_CMD_OP(cmd, 0, 0, 16, uint16_t, cfg->mac_id)
/* cmd, param, offset, width, type, arg_name */
#define DPMAC_CMD_OPEN(cmd, dpmac_id) \
@@ -42,8 +44,6 @@
do { \
MC_RSP_OP(cmd, 0, 0, 32, int, attr->phy_id);\
MC_RSP_OP(cmd, 0, 32, 32, int, attr->id);\
MC_RSP_OP(cmd, 1, 0, 16, uint16_t, attr->version.major);\
MC_RSP_OP(cmd, 1, 16, 16, uint16_t, attr->version.minor);\
MC_RSP_OP(cmd, 1, 32, 8, enum dpmac_link_type, attr->link_type);\
MC_RSP_OP(cmd, 1, 40, 8, enum dpmac_eth_if, attr->eth_if);\
MC_RSP_OP(cmd, 2, 0, 32, uint32_t, attr->max_rate);\
@@ -85,7 +85,7 @@ do { \
/* cmd, param, offset, width, type, arg_name */
#define DPMAC_CMD_GET_COUNTER(cmd, type) \
MC_CMD_OP(cmd, 0, 0, 8, enum dpmac_counter, type)
MC_CMD_OP(cmd, 1, 0, 64, enum dpmac_counter, type)
/* cmd, param, offset, width, type, arg_name */
#define DPMAC_RSP_GET_COUNTER(cmd, counter) \
@@ -187,9 +187,10 @@ struct dpmac_cfg {
/**
* dpmac_create() - Create the DPMAC 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 DPMAC object, allocate required resources and
* perform required initialization.
@@ -206,21 +207,24 @@ struct dpmac_cfg {
* Return: '0' on Success; Error code otherwise.
*/
int dpmac_create(struct fsl_mc_io *mc_io,
uint16_t token,
uint32_t cmd_flags,
const struct dpmac_cfg *cfg,
uint16_t *token);
uint32_t *obj_id);
/**
* dpmac_destroy() - Destroy the DPMAC 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 DPMAC object
* @obj_id: DPMAC object id
*
* Return: '0' on Success; error code otherwise.
*/
int dpmac_destroy(struct fsl_mc_io *mc_io,
uint16_t token,
uint32_t cmd_flags,
uint16_t token);
uint32_t obj_id);
/* DPMAC IRQ Index and Events */
@@ -246,15 +250,6 @@ struct dpmac_attr {
enum dpmac_link_type link_type;
enum dpmac_eth_if eth_if;
uint32_t max_rate;
/**
* struct version - Structure representing DPMAC version
* @major: DPMAC major version
* @minor: DPMAC minor version
*/
struct {
uint16_t major;
uint16_t minor;
} version;
};
/**
@@ -464,5 +459,19 @@ int dpmac_get_counter(struct fsl_mc_io *mc_io,
uint16_t token,
enum dpmac_counter type,
uint64_t *counter);
/**
* dpmac_get_api_version - Retrieve DPMAC 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: DPMAC major version
* @minor_ver: DPMAC minor version
*
* Return: '0' on Success; Error code otherwise.
*/
int dpmac_get_api_version(struct fsl_mc_io *mc_io,
uint32_t cmd_flags,
uint16_t *major_ver,
uint16_t *minor_ver);
#endif /* __FSL_DPMAC_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/*
* Freescale Layerscape MC I/O wrapper
*
* Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
* Author: German Rivera <German.Rivera@freescale.com>
* Copyright (C) 2013-2016 Freescale Semiconductor, Inc.
* Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -10,29 +10,30 @@
#define _FSL_DPRC_H
/* DPRC Version */
#define DPRC_VER_MAJOR 5
#define DPRC_VER_MAJOR 6
#define DPRC_VER_MINOR 1
/* Command IDs */
#define DPRC_CMDID_CLOSE 0x800
#define DPRC_CMDID_OPEN 0x805
#define DPRC_CMDID_CREATE 0x905
#define DPRC_CMDID_CLOSE 0x8001
#define DPRC_CMDID_OPEN 0x8051
#define DPRC_CMDID_CREATE 0x9051
#define DPRC_CMDID_GET_ATTR 0x004
#define DPRC_CMDID_RESET_CONT 0x005
#define DPRC_CMDID_GET_ATTR 0x0041
#define DPRC_CMDID_RESET_CONT 0x0051
#define DPRC_CMDID_GET_API_VERSION 0xa051
#define DPRC_CMDID_CREATE_CONT 0x151
#define DPRC_CMDID_DESTROY_CONT 0x152
#define DPRC_CMDID_GET_CONT_ID 0x830
#define DPRC_CMDID_GET_OBJ_COUNT 0x159
#define DPRC_CMDID_GET_OBJ 0x15A
#define DPRC_CMDID_GET_RES_COUNT 0x15B
#define DPRC_CMDID_GET_RES_IDS 0x15C
#define DPRC_CMDID_GET_OBJ_REG 0x15E
#define DPRC_CMDID_CREATE_CONT 0x1511
#define DPRC_CMDID_DESTROY_CONT 0x1521
#define DPRC_CMDID_GET_CONT_ID 0x8301
#define DPRC_CMDID_GET_OBJ_COUNT 0x1591
#define DPRC_CMDID_GET_OBJ 0x15A1
#define DPRC_CMDID_GET_RES_COUNT 0x15B1
#define DPRC_CMDID_GET_RES_IDS 0x15C1
#define DPRC_CMDID_GET_OBJ_REG 0x15E1
#define DPRC_CMDID_CONNECT 0x167
#define DPRC_CMDID_DISCONNECT 0x168
#define DPRC_CMDID_GET_CONNECTION 0x16C
#define DPRC_CMDID_CONNECT 0x1671
#define DPRC_CMDID_DISCONNECT 0x1681
#define DPRC_CMDID_GET_CONNECTION 0x16C1
/* cmd, param, offset, width, type, arg_name */
#define DPRC_RSP_GET_CONTAINER_ID(cmd, container_id) \
@@ -88,8 +89,6 @@ do { \
MC_RSP_OP(cmd, 0, 32, 16, uint16_t, attr->icid); \
MC_RSP_OP(cmd, 1, 0, 32, uint32_t, attr->options);\
MC_RSP_OP(cmd, 1, 32, 32, int, attr->portal_id); \
MC_RSP_OP(cmd, 2, 0, 16, uint16_t, attr->version.major);\
MC_RSP_OP(cmd, 2, 16, 16, uint16_t, attr->version.minor);\
} while (0)
/* cmd, param, offset, width, type, arg_name */
@@ -345,9 +344,9 @@ do { \
#define DPRC_CMD_CONNECT(cmd, endpoint1, endpoint2, cfg) \
do { \
MC_CMD_OP(cmd, 0, 0, 32, int, endpoint1->id); \
MC_CMD_OP(cmd, 0, 32, 16, uint16_t, endpoint1->if_id); \
MC_CMD_OP(cmd, 0, 32, 32, int, endpoint1->if_id); \
MC_CMD_OP(cmd, 1, 0, 32, int, endpoint2->id); \
MC_CMD_OP(cmd, 1, 32, 16, uint16_t, endpoint2->if_id); \
MC_CMD_OP(cmd, 1, 32, 32, int, endpoint2->if_id); \
MC_CMD_OP(cmd, 2, 0, 8, char, endpoint1->type[0]); \
MC_CMD_OP(cmd, 2, 8, 8, char, endpoint1->type[1]); \
MC_CMD_OP(cmd, 2, 16, 8, char, endpoint1->type[2]); \
@@ -410,8 +409,8 @@ do { \
/* cmd, param, offset, width, type, arg_name */
#define DPRC_CMD_GET_CONNECTION(cmd, endpoint1) \
do { \
MC_CMD_OP(cmd, 0, 0, 32, int, endpoint1->id); \
MC_CMD_OP(cmd, 0, 32, 16, uint16_t, endpoint1->if_id); \
MC_CMD_OP(cmd, 0, 0, 32, int, endpoint1->id); \
MC_CMD_OP(cmd, 0, 32, 32, int, endpoint1->if_id); \
MC_CMD_OP(cmd, 1, 0, 8, char, endpoint1->type[0]); \
MC_CMD_OP(cmd, 1, 8, 8, char, endpoint1->type[1]); \
MC_CMD_OP(cmd, 1, 16, 8, char, endpoint1->type[2]); \
@@ -657,15 +656,6 @@ struct dprc_attributes {
uint16_t icid;
int portal_id;
uint64_t options;
/**
* struct version - DPRC version
* @major: DPRC major version
* @minor: DPRC minor version
*/
struct {
uint16_t major;
uint16_t minor;
} version;
};
/**
@@ -950,4 +940,19 @@ int dprc_get_connection(struct fsl_mc_io *mc_io,
struct dprc_endpoint *endpoint2,
int *state);
/**
* dprc_get_api_version - Retrieve DPRC 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: DPRC major version
* @minor_ver: DPRC minor version
*
* Return: '0' on Success; Error code otherwise.
*/
int dprc_get_api_version(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 *major_ver,
u16 *minor_ver);
#endif /* _FSL_DPRC_H */

View File

@@ -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 */

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Freescale Semiconductor
* Copyright (C) 2014-2016 Freescale Semiconductor
* Copyright 2017 NXP
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -29,6 +30,7 @@ extern struct fsl_mc_io *dflt_mc_io;
* @struct dpbp_attr: DPBP attribute
*/
struct fsl_dpbp_obj {
uint32_t dpbp_id;
uint16_t dpbp_handle;
struct dpbp_attr dpbp_attr;
};
@@ -41,7 +43,7 @@ extern struct fsl_dpbp_obj *dflt_dpbp;
* @struct qbman_swp *sw_portal: SW portal object
*/
struct fsl_dpio_obj {
int dpio_id;
uint32_t dpio_id;
uint16_t dpio_handle;
struct qbman_swp *sw_portal; /** SW portal object */
};
@@ -56,7 +58,7 @@ extern struct fsl_dpio_obj *dflt_dpio;
* @struct dpni_buffer_layout: DPNI buffer layout
*/
struct fsl_dpni_obj {
int dpni_id;
uint32_t dpni_id;
uint16_t dpni_handle;
struct dpni_attr dpni_attrs;
struct dpni_buffer_layout buf_layout;