driver: net: fsl-mc: flib changes for MC 10.3.0
[oweals/u-boot.git] / include / fsl-mc / fsl_dpmac.h
index 24f0b483aa542642c2b113b337c4be2ca097322c..36a5cca69cec2900ee033eec4ed9f70c1668c8f3 100644 (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+
 #define __FSL_DPMAC_H
 
 /* DPMAC Version */
-#define DPMAC_VER_MAJOR                                3
-#define DPMAC_VER_MINOR                                1
+#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 */