2 * Freescale Layerscape MC I/O wrapper
4 * Copyright (C) 2013-2015 Freescale Semiconductor, Inc.
5 * Author: German Rivera <German.Rivera@freescale.com>
7 * SPDX-License-Identifier: GPL-2.0+
9 #include <fsl-mc/fsl_mc_sys.h>
10 #include <fsl-mc/fsl_mc_cmd.h>
11 #include <fsl-mc/fsl_dpbp.h>
13 int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token)
15 struct mc_command cmd = { 0 };
19 cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN,
21 DPBP_CMD_OPEN(cmd, dpbp_id);
23 /* send command to mc*/
24 err = mc_send_command(mc_io, &cmd);
28 /* retrieve response parameters */
29 *token = MC_CMD_HDR_READ_TOKEN(cmd.header);
34 int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token)
36 struct mc_command cmd = { 0 };
39 cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, MC_CMD_PRI_HIGH,
42 /* send command to mc*/
43 return mc_send_command(mc_io, &cmd);
46 int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token)
48 struct mc_command cmd = { 0 };
51 cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, MC_CMD_PRI_LOW,
54 /* send command to mc*/
55 return mc_send_command(mc_io, &cmd);
58 int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token)
60 struct mc_command cmd = { 0 };
63 cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE,
64 MC_CMD_PRI_LOW, token);
66 /* send command to mc*/
67 return mc_send_command(mc_io, &cmd);
70 int dpbp_reset(struct fsl_mc_io *mc_io, uint16_t token)
72 struct mc_command cmd = { 0 };
75 cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET,
76 MC_CMD_PRI_LOW, token);
78 /* send command to mc*/
79 return mc_send_command(mc_io, &cmd);
82 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
84 struct dpbp_attr *attr)
86 struct mc_command cmd = { 0 };
90 cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR,
91 MC_CMD_PRI_LOW, token);
93 /* send command to mc*/
94 err = mc_send_command(mc_io, &cmd);
98 /* retrieve response parameters */
99 DPBP_RSP_GET_ATTRIBUTES(cmd, attr);