bus/dpaa: update platform SoC value register routines
[dpdk.git] / drivers / net / dpaa / dpaa_ethdev.c
index cf5a2ec..24943ef 100644 (file)
@@ -1,34 +1,8 @@
-/*-
- *   BSD LICENSE
+/* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2017 NXP.
+ *   Copyright 2017 NXP
  *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of  Freescale Semiconductor, Inc nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 /* System headers */
 #include <stdio.h>
@@ -212,19 +186,17 @@ dpaa_fw_version_get(struct rte_eth_dev *dev __rte_unused,
                DPAA_PMD_ERR("Unable to open SoC device");
                return -ENOTSUP; /* Not supported on this infra */
        }
-
-       ret = fscanf(svr_file, "svr:%x", &svr_ver);
-       if (ret <= 0) {
+       if (fscanf(svr_file, "svr:%x", &svr_ver) > 0)
+               dpaa_svr_family = svr_ver & SVR_MASK;
+       else
                DPAA_PMD_ERR("Unable to read SoC device");
-               return -ENOTSUP; /* Not supported on this infra */
-       }
 
-       ret = snprintf(fw_version, fw_size,
-                      "svr:%x-fman-v%x",
-                      svr_ver,
-                      fman_ip_rev);
+       fclose(svr_file);
 
+       ret = snprintf(fw_version, fw_size, "SVR:%x-fman-v%x",
+                      svr_ver, fman_ip_rev);
        ret += 1; /* add the size of '\0' */
+
        if (fw_size < (uint32_t)ret)
                return ret;
        else
@@ -723,7 +695,7 @@ static int dpaa_fc_set_default(struct dpaa_if *dpaa_intf)
 static int dpaa_rx_queue_init(struct qman_fq *fq,
                              uint32_t fqid)
 {
-       struct qm_mcc_initfq opts;
+       struct qm_mcc_initfq opts = {0};
        int ret;
 
        PMD_INIT_FUNC_TRACE();
@@ -769,7 +741,7 @@ static int dpaa_rx_queue_init(struct qman_fq *fq,
 static int dpaa_tx_queue_init(struct qman_fq *fq,
                              struct fman_if *fman_intf)
 {
-       struct qm_mcc_initfq opts;
+       struct qm_mcc_initfq opts = {0};
        int ret;
 
        PMD_INIT_FUNC_TRACE();
@@ -800,7 +772,7 @@ static int dpaa_tx_queue_init(struct qman_fq *fq,
 /* Initialise a DEBUG FQ ([rt]x_error, rx_default). */
 static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid)
 {
-       struct qm_mcc_initfq opts;
+       struct qm_mcc_initfq opts = {0};
        int ret;
 
        PMD_INIT_FUNC_TRACE();