xref: /rk3399_rockchip-uboot/drivers/net/fsl-mc/dpmng.c (revision e22b1a54942d9003b10564325a34e3cf767556ce)
1a2a55e51SPrabhakar 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 
mc_get_version(struct fsl_mc_io * mc_io,uint32_t cmd_flags,struct mc_version * mc_ver_info)10*87457d11SPrabhakar Kushwaha int mc_get_version(struct fsl_mc_io *mc_io,
11*87457d11SPrabhakar Kushwaha 		   uint32_t cmd_flags,
12*87457d11SPrabhakar Kushwaha 		   struct mc_version *mc_ver_info)
137b3bd9a7SJ. German Rivera {
147b3bd9a7SJ. German Rivera 	struct mc_command cmd = { 0 };
157b3bd9a7SJ. German Rivera 	int err;
167b3bd9a7SJ. German Rivera 
177b3bd9a7SJ. German Rivera 	/* prepare command */
187b3bd9a7SJ. German Rivera 	cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
19*87457d11SPrabhakar Kushwaha 					  cmd_flags,
20*87457d11SPrabhakar Kushwaha 					  0);
217b3bd9a7SJ. German Rivera 
227b3bd9a7SJ. German Rivera 	/* send command to mc*/
237b3bd9a7SJ. German Rivera 	err = mc_send_command(mc_io, &cmd);
247b3bd9a7SJ. German Rivera 	if (err)
257b3bd9a7SJ. German Rivera 		return err;
267b3bd9a7SJ. German Rivera 
277b3bd9a7SJ. German Rivera 	/* retrieve response parameters */
287b3bd9a7SJ. German Rivera 	DPMNG_RSP_GET_VERSION(cmd, mc_ver_info);
297b3bd9a7SJ. German Rivera 
307b3bd9a7SJ. German Rivera 	return 0;
317b3bd9a7SJ. German Rivera }
32