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_enable(struct fsl_mc_io *mc_io,
56 struct mc_command cmd = { 0 };
59 cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, cmd_flags,
62 /* send command to mc*/
63 return mc_send_command(mc_io, &cmd);
66 int dpbp_disable(struct fsl_mc_io *mc_io,
70 struct mc_command cmd = { 0 };
73 cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE,
77 /* send command to mc*/
78 return mc_send_command(mc_io, &cmd);
81 int dpbp_reset(struct fsl_mc_io *mc_io,
85 struct mc_command cmd = { 0 };
88 cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET,
92 /* send command to mc*/
93 return mc_send_command(mc_io, &cmd);
96 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
99 struct dpbp_attr *attr)
101 struct mc_command cmd = { 0 };
104 /* prepare command */
105 cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR,
109 /* send command to mc*/
110 err = mc_send_command(mc_io, &cmd);
114 /* retrieve response parameters */
115 DPBP_RSP_GET_ATTRIBUTES(cmd, attr);