1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
3 * Copyright 2013-2015 Freescale Semiconductor Inc.
7 #include <fsl_mc_sys.h>
8 #include <fsl_mc_cmd.h>
10 #include <fsl_dpmng_cmd.h>
13 * mc_get_version() - Retrieves the Management Complex firmware
15 * @mc_io: Pointer to opaque I/O object
16 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
17 * @mc_ver_info: Returned version information structure
19 * Return: '0' on Success; Error code otherwise.
21 int mc_get_version(struct fsl_mc_io *mc_io,
23 struct mc_version *mc_ver_info)
25 struct mc_command cmd = { 0 };
26 struct dpmng_rsp_get_version *rsp_params;
30 cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
34 /* send command to mc*/
35 err = mc_send_command(mc_io, &cmd);
39 /* retrieve response parameters */
40 rsp_params = (struct dpmng_rsp_get_version *)cmd.params;
41 mc_ver_info->revision = le32_to_cpu(rsp_params->revision);
42 mc_ver_info->major = le32_to_cpu(rsp_params->version_major);
43 mc_ver_info->minor = le32_to_cpu(rsp_params->version_minor);
49 * mc_get_soc_version() - Retrieves the Management Complex firmware
51 * @mc_io Pointer to opaque I/O object
52 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
53 * @mc_platform_info: Returned version information structure. The structure
54 * contains the values of SVR and PVR registers.
55 * Please consult platform specific reference manual
56 * for detailed information.
58 * Return: '0' on Success; Error code otherwise.
60 int mc_get_soc_version(struct fsl_mc_io *mc_io,
62 struct mc_soc_version *mc_platform_info)
64 struct dpmng_rsp_get_soc_version *rsp_params;
65 struct mc_command cmd = { 0 };
69 cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_SOC_VERSION,
73 /* send command to mc*/
74 err = mc_send_command(mc_io, &cmd);
78 /* retrieve response parameters */
79 rsp_params = (struct dpmng_rsp_get_soc_version *)cmd.params;
80 mc_platform_info->svr = le32_to_cpu(rsp_params->svr);
81 mc_platform_info->pvr = le32_to_cpu(rsp_params->pvr);