2 * Copyright (C) 2013-2015 Freescale Semiconductor
4 * SPDX-License-Identifier: GPL-2.0+
7 #include <fsl-mc/fsl_mc_sys.h>
8 #include <fsl-mc/fsl_mc_cmd.h>
9 #include <fsl-mc/fsl_dpio.h>
11 int dpio_open(struct fsl_mc_io *mc_io,
16 struct mc_command cmd = { 0 };
20 cmd.header = mc_encode_cmd_header(DPIO_CMDID_OPEN,
23 DPIO_CMD_OPEN(cmd, dpio_id);
25 /* send command to mc*/
26 err = mc_send_command(mc_io, &cmd);
30 /* retrieve response parameters */
31 *token = MC_CMD_HDR_READ_TOKEN(cmd.header);
36 int dpio_close(struct fsl_mc_io *mc_io,
40 struct mc_command cmd = { 0 };
43 cmd.header = mc_encode_cmd_header(DPIO_CMDID_CLOSE,
47 /* send command to mc*/
48 return mc_send_command(mc_io, &cmd);
51 int dpio_enable(struct fsl_mc_io *mc_io,
55 struct mc_command cmd = { 0 };
58 cmd.header = mc_encode_cmd_header(DPIO_CMDID_ENABLE,
62 /* send command to mc*/
63 return mc_send_command(mc_io, &cmd);
66 int dpio_disable(struct fsl_mc_io *mc_io,
70 struct mc_command cmd = { 0 };
73 cmd.header = mc_encode_cmd_header(DPIO_CMDID_DISABLE,
77 /* send command to mc*/
78 return mc_send_command(mc_io, &cmd);
81 int dpio_reset(struct fsl_mc_io *mc_io,
85 struct mc_command cmd = { 0 };
88 cmd.header = mc_encode_cmd_header(DPIO_CMDID_RESET,
92 /* send command to mc*/
93 return mc_send_command(mc_io, &cmd);
96 int dpio_get_attributes(struct fsl_mc_io *mc_io,
99 struct dpio_attr *attr)
101 struct mc_command cmd = { 0 };
104 /* prepare command */
105 cmd.header = mc_encode_cmd_header(DPIO_CMDID_GET_ATTR,
109 /* send command to mc*/
110 err = mc_send_command(mc_io, &cmd);
114 /* retrieve response parameters */
115 DPIO_RSP_GET_ATTR(cmd, attr);