Merge branch 'next'
[oweals/u-boot.git] / include / fsl-mc / fsl_dpio.h
index d8c458fb4fc270d6ed83afa442df0454eb536d64..7788e1962e6448fb77f17005791712cb6a4dcb70 100644 (file)
@@ -1,26 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright (C) 2013-2015 Freescale Semiconductor
- *
- * SPDX-License-Identifier:    GPL-2.0+
+ * Copyright 2013-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  */
 
 #ifndef _FSL_DPIO_H
 #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 +44,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 +72,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 +113,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 +134,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 +202,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 +225,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 */