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,
18 struct mc_command cmd = { 0 };
22 cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN,
25 DPBP_CMD_OPEN(cmd, dpbp_id);
27 /* send command to mc*/
28 err = mc_send_command(mc_io, &cmd);
32 /* retrieve response parameters */
33 *token = MC_CMD_HDR_READ_TOKEN(cmd.header);
38 int dpbp_close(struct fsl_mc_io *mc_io,
42 struct mc_command cmd = { 0 };
45 cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, cmd_flags,
48 /* send command to mc*/
49 return mc_send_command(mc_io, &cmd);
52 int dpbp_create(struct fsl_mc_io *mc_io,
54 const struct dpbp_cfg *cfg,
57 struct mc_command cmd = { 0 };
60 (void)(cfg); /* unused */
63 cmd.header = mc_encode_cmd_header(DPBP_CMDID_CREATE,
67 /* send command to mc*/
68 err = mc_send_command(mc_io, &cmd);
72 /* retrieve response parameters */
73 *token = MC_CMD_HDR_READ_TOKEN(cmd.header);
78 int dpbp_destroy(struct fsl_mc_io *mc_io,
82 struct mc_command cmd = { 0 };
85 cmd.header = mc_encode_cmd_header(DPBP_CMDID_DESTROY,
89 /* send command to mc*/
90 return mc_send_command(mc_io, &cmd);
93 int dpbp_enable(struct fsl_mc_io *mc_io,
97 struct mc_command cmd = { 0 };
100 cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, cmd_flags,
103 /* send command to mc*/
104 return mc_send_command(mc_io, &cmd);
107 int dpbp_disable(struct fsl_mc_io *mc_io,
111 struct mc_command cmd = { 0 };
113 /* prepare command */
114 cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE,
118 /* send command to mc*/
119 return mc_send_command(mc_io, &cmd);
122 int dpbp_reset(struct fsl_mc_io *mc_io,
126 struct mc_command cmd = { 0 };
128 /* prepare command */
129 cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET,
133 /* send command to mc*/
134 return mc_send_command(mc_io, &cmd);
137 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
140 struct dpbp_attr *attr)
142 struct mc_command cmd = { 0 };
145 /* prepare command */
146 cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR,
150 /* send command to mc*/
151 err = mc_send_command(mc_io, &cmd);
155 /* retrieve response parameters */
156 DPBP_RSP_GET_ATTRIBUTES(cmd, attr);