drivers/fsl-mc: flib changes for mc 8.0.0
[platform/kernel/u-boot.git] / drivers / net / fsl-mc / dpni.c
index 7bc2504..9111f35 100644 (file)
@@ -8,14 +8,18 @@
 #include <fsl-mc/fsl_mc_cmd.h>
 #include <fsl-mc/fsl_dpni.h>
 
-int dpni_open(struct fsl_mc_io *mc_io, int dpni_id, uint16_t *token)
+int dpni_open(struct fsl_mc_io *mc_io,
+             uint32_t cmd_flags,
+             int dpni_id,
+             uint16_t *token)
 {
        struct mc_command cmd = { 0 };
        int err;
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_OPEN,
-                                         MC_CMD_PRI_LOW, 0);
+                                         cmd_flags,
+                                         0);
        DPNI_CMD_OPEN(cmd, dpni_id);
 
        /* send command to mc*/
@@ -29,19 +33,23 @@ int dpni_open(struct fsl_mc_io *mc_io, int dpni_id, uint16_t *token)
        return 0;
 }
 
-int dpni_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_close(struct fsl_mc_io *mc_io,
+              uint32_t cmd_flags,
+              uint16_t token)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_CLOSE,
-                                         MC_CMD_PRI_HIGH, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
 int dpni_set_pools(struct fsl_mc_io *mc_io,
+                  uint32_t cmd_flags,
                   uint16_t token,
                   const struct dpni_pools_cfg *cfg)
 {
@@ -49,7 +57,7 @@ int dpni_set_pools(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_POOLS,
-                                         MC_CMD_PRI_LOW,
+                                         cmd_flags,
                                          token);
        DPNI_CMD_SET_POOLS(cmd, cfg);
 
@@ -57,44 +65,53 @@ int dpni_set_pools(struct fsl_mc_io *mc_io,
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_enable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_enable(struct fsl_mc_io *mc_io,
+               uint32_t cmd_flags,
+               uint16_t token)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_ENABLE,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_disable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_disable(struct fsl_mc_io *mc_io,
+                uint32_t cmd_flags,
+                uint16_t token)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_DISABLE,
-                                         MC_CMD_PRI_LOW,
+                                         cmd_flags,
                                          token);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_reset(struct fsl_mc_io *mc_io, uint16_t token)
+int dpni_reset(struct fsl_mc_io *mc_io,
+              uint32_t cmd_flags,
+              uint16_t token)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
 int dpni_get_attributes(struct fsl_mc_io *mc_io,
+                       uint32_t cmd_flags,
                        uint16_t token,
                        struct dpni_attr *attr)
 {
@@ -103,7 +120,7 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_ATTR,
-                                         MC_CMD_PRI_LOW,
+                                         cmd_flags,
                                          token);
 
        /* send command to mc*/
@@ -118,6 +135,7 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io,
+                             uint32_t cmd_flags,
                              uint16_t token,
                              struct dpni_buffer_layout *layout)
 {
@@ -126,7 +144,8 @@ int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_RX_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -140,6 +159,7 @@ int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io,
 }
 
 int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io,
+                             uint32_t cmd_flags,
                              uint16_t token,
                              const struct dpni_buffer_layout *layout)
 {
@@ -147,7 +167,8 @@ int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_RX_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_RX_BUFFER_LAYOUT(cmd, layout);
 
        /* send command to mc*/
@@ -155,6 +176,7 @@ int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io,
+                             uint32_t cmd_flags,
                              uint16_t token,
                              struct dpni_buffer_layout *layout)
 {
@@ -163,7 +185,8 @@ int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -177,6 +200,7 @@ int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io,
 }
 
 int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io,
+                             uint32_t cmd_flags,
                              uint16_t token,
                              const struct dpni_buffer_layout *layout)
 {
@@ -184,7 +208,8 @@ int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_TX_BUFFER_LAYOUT(cmd, layout);
 
        /* send command to mc*/
@@ -192,6 +217,7 @@ int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
+                                  uint32_t cmd_flags,
                                   uint16_t token,
                                   struct dpni_buffer_layout *layout)
 {
@@ -200,7 +226,8 @@ int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_CONF_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -214,6 +241,7 @@ int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
 }
 
 int dpni_set_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
+                                  uint32_t cmd_flags,
                                   uint16_t token,
                                   const struct dpni_buffer_layout *layout)
 {
@@ -221,21 +249,25 @@ int dpni_set_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_CONF_BUFFER_LAYOUT,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_TX_CONF_BUFFER_LAYOUT(cmd, layout);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
 }
 
-int dpni_get_qdid(struct fsl_mc_io *mc_io, uint16_t token, uint16_t *qdid)
+int dpni_get_qdid(struct fsl_mc_io *mc_io,
+                 uint32_t cmd_flags,
+                 uint16_t token,
+                 uint16_t *qdid)
 {
        struct mc_command cmd = { 0 };
        int err;
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_QDID,
-                                         MC_CMD_PRI_LOW,
+                                         cmd_flags,
                                          token);
 
        /* send command to mc*/
@@ -250,6 +282,7 @@ int dpni_get_qdid(struct fsl_mc_io *mc_io, uint16_t token, uint16_t *qdid)
 }
 
 int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
+                           uint32_t cmd_flags,
                            uint16_t token,
                            uint16_t *data_offset)
 {
@@ -258,7 +291,8 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_DATA_OFFSET,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -272,6 +306,7 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_counter(struct fsl_mc_io *mc_io,
+                    uint32_t cmd_flags,
                     uint16_t token,
                     enum dpni_counter counter,
                     uint64_t *value)
@@ -281,7 +316,8 @@ int dpni_get_counter(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_COUNTER,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_GET_COUNTER(cmd, counter);
 
        /* send command to mc*/
@@ -296,6 +332,7 @@ int dpni_get_counter(struct fsl_mc_io *mc_io,
 }
 
 int dpni_set_counter(struct fsl_mc_io *mc_io,
+                    uint32_t cmd_flags,
                     uint16_t token,
                     enum dpni_counter counter,
                     uint64_t value)
@@ -304,7 +341,8 @@ int dpni_set_counter(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_COUNTER,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_COUNTER(cmd, counter, value);
 
        /* send command to mc*/
@@ -312,14 +350,16 @@ int dpni_set_counter(struct fsl_mc_io *mc_io,
 }
 
 int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
+                     uint32_t cmd_flags,
                      uint16_t token,
-                    const struct dpni_link_cfg *cfg)
+                     const struct dpni_link_cfg *cfg)
 {
        struct mc_command cmd = { 0 };
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_LINK_CFG,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_LINK_CFG(cmd, cfg);
 
        /* send command to mc*/
@@ -327,6 +367,7 @@ int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_link_state(struct fsl_mc_io *mc_io,
+                       uint32_t cmd_flags,
                        uint16_t token,
                        struct dpni_link_state *state)
 {
@@ -335,7 +376,8 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_LINK_STATE,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -350,6 +392,7 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io,
 
 
 int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
+                             uint32_t cmd_flags,
                              uint16_t token,
                              const uint8_t mac_addr[6])
 {
@@ -357,7 +400,8 @@ int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_PRIM_MAC,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr);
 
        /* send command to mc*/
@@ -365,6 +409,7 @@ int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
+                             uint32_t cmd_flags,
                              uint16_t token,
                              uint8_t mac_addr[6])
 {
@@ -373,7 +418,8 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_PRIM_MAC,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);
@@ -387,6 +433,7 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
 }
 
 int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
+                     uint32_t cmd_flags,
                      uint16_t token,
                      const uint8_t mac_addr[6])
 {
@@ -394,7 +441,8 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_ADD_MAC_ADDR,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr);
 
        /* send command to mc*/
@@ -402,6 +450,7 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
 }
 
 int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
+                        uint32_t cmd_flags,
                         uint16_t token,
                         const uint8_t mac_addr[6])
 {
@@ -409,7 +458,8 @@ int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_REMOVE_MAC_ADDR,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr);
 
        /* send command to mc*/
@@ -417,6 +467,7 @@ int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
 }
 
 int dpni_set_tx_flow(struct fsl_mc_io *mc_io,
+                    uint32_t cmd_flags,
                     uint16_t token,
                     uint16_t *flow_id,
                     const struct dpni_tx_flow_cfg *cfg)
@@ -426,7 +477,8 @@ int dpni_set_tx_flow(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_FLOW,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_TX_FLOW(cmd, *flow_id, cfg);
 
        /* send command to mc*/
@@ -441,6 +493,7 @@ int dpni_set_tx_flow(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
+                    uint32_t cmd_flags,
                     uint16_t token,
                     uint16_t flow_id,
                     struct dpni_tx_flow_attr *attr)
@@ -450,7 +503,8 @@ int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_TX_FLOW,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_GET_TX_FLOW(cmd, flow_id);
 
        /* send command to mc*/
@@ -465,6 +519,7 @@ int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
 }
 
 int dpni_set_rx_flow(struct fsl_mc_io *mc_io,
+                    uint32_t cmd_flags,
                     uint16_t token,
                     uint8_t tc_id,
                     uint16_t flow_id,
@@ -474,7 +529,8 @@ int dpni_set_rx_flow(struct fsl_mc_io *mc_io,
 
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_RX_FLOW,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_SET_RX_FLOW(cmd, tc_id, flow_id, cfg);
 
        /* send command to mc*/
@@ -482,6 +538,7 @@ int dpni_set_rx_flow(struct fsl_mc_io *mc_io,
 }
 
 int dpni_get_rx_flow(struct fsl_mc_io *mc_io,
+                    uint32_t cmd_flags,
                     uint16_t token,
                     uint8_t tc_id,
                     uint16_t flow_id,
@@ -491,7 +548,8 @@ int dpni_get_rx_flow(struct fsl_mc_io *mc_io,
        int err;
        /* prepare command */
        cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_RX_FLOW,
-                                         MC_CMD_PRI_LOW, token);
+                                         cmd_flags,
+                                         token);
        DPNI_CMD_GET_RX_FLOW(cmd, tc_id, flow_id);
 
        /* send command to mc*/