xref: /rk3399_rockchip-uboot/drivers/net/fsl-mc/dpmng.c (revision a2a55e518f81900ab1538656e5df8d2759ccb1fb)
1*a2a55e51SPrabhakar Kushwaha /* Copyright 2013-2015 Freescale Semiconductor Inc.
27b3bd9a7SJ. German Rivera  *
37b3bd9a7SJ. German Rivera  * SPDX-License-Identifier:	GPL-2.0+
47b3bd9a7SJ. German Rivera  */
57b3bd9a7SJ. German Rivera #include <fsl-mc/fsl_mc_sys.h>
67b3bd9a7SJ. German Rivera #include <fsl-mc/fsl_mc_cmd.h>
77b3bd9a7SJ. German Rivera #include <fsl-mc/fsl_dpmng.h>
87b3bd9a7SJ. German Rivera #include "fsl_dpmng_cmd.h"
97b3bd9a7SJ. German Rivera 
107b3bd9a7SJ. German Rivera int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info)
117b3bd9a7SJ. German Rivera {
127b3bd9a7SJ. German Rivera 	struct mc_command cmd = { 0 };
137b3bd9a7SJ. German Rivera 	int err;
147b3bd9a7SJ. German Rivera 
157b3bd9a7SJ. German Rivera 	/* prepare command */
167b3bd9a7SJ. German Rivera 	cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
177b3bd9a7SJ. German Rivera 					  MC_CMD_PRI_LOW, 0);
187b3bd9a7SJ. German Rivera 
197b3bd9a7SJ. German Rivera 	/* send command to mc*/
207b3bd9a7SJ. German Rivera 	err = mc_send_command(mc_io, &cmd);
217b3bd9a7SJ. German Rivera 	if (err)
227b3bd9a7SJ. German Rivera 		return err;
237b3bd9a7SJ. German Rivera 
247b3bd9a7SJ. German Rivera 	/* retrieve response parameters */
257b3bd9a7SJ. German Rivera 	DPMNG_RSP_GET_VERSION(cmd, mc_ver_info);
267b3bd9a7SJ. German Rivera 
277b3bd9a7SJ. German Rivera 	return 0;
287b3bd9a7SJ. German Rivera }
29