summaryrefslogtreecommitdiff
path: root/include/fsl-mc/fsl_dpmac.h
diff options
context:
space:
mode:
authorYogesh Gaur <yogeshnarayan.gaur@nxp.com>2017-11-15 11:59:31 +0530
committerYork Sun <york.sun@nxp.com>2017-12-06 14:55:17 -0800
commit2557c5a942213acc2a0e3353a9c00140ea11b5d4 (patch)
tree19eab2844a182b9bddcdb761460c8d624a7e7ba8 /include/fsl-mc/fsl_dpmac.h
parentba348904207a2e9061a2405ebd84268f63a1809f (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_dpmac.h')
-rw-r--r--include/fsl-mc/fsl_dpmac.h69
1 files changed, 39 insertions, 30 deletions
diff --git a/include/fsl-mc/fsl_dpmac.h b/include/fsl-mc/fsl_dpmac.h
index 296f3aed24..36a5cca69c 100644
--- a/include/fsl-mc/fsl_dpmac.h
+++ b/include/fsl-mc/fsl_dpmac.h
@@ -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 */