xref: /openbmc/u-boot/drivers/net/fsl-mc/dpmng.c (revision b9553986)
1 // SPDX-License-Identifier: GPL-2.0+
2 /* Copyright 2013-2015 Freescale Semiconductor Inc.
3  */
4 #include <fsl-mc/fsl_mc_sys.h>
5 #include <fsl-mc/fsl_mc_cmd.h>
6 #include <fsl-mc/fsl_dpmng.h>
7 #include "fsl_dpmng_cmd.h"
8 
9 int mc_get_version(struct fsl_mc_io *mc_io,
10 		   uint32_t cmd_flags,
11 		   struct mc_version *mc_ver_info)
12 {
13 	struct mc_command cmd = { 0 };
14 	int err;
15 
16 	/* prepare command */
17 	cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
18 					  cmd_flags,
19 					  0);
20 
21 	/* send command to mc*/
22 	err = mc_send_command(mc_io, &cmd);
23 	if (err)
24 		return err;
25 
26 	/* retrieve response parameters */
27 	DPMNG_RSP_GET_VERSION(cmd, mc_ver_info);
28 
29 	return 0;
30 }
31