diff options
author | Tom Rini <trini@konsulko.com> | 2023-06-15 11:02:22 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-06-15 11:02:22 -0400 |
commit | 5ac10c00ed727842c00d8659611151334f84c0ea (patch) | |
tree | bd6c31a0a00be76a17a120f7a2ec72bec76daa00 /include/fsl-mc/fsl_mc_cmd.h | |
parent | cb4fe56eca1109780e97c68329e6b71ef33bf0e6 (diff) | |
parent | b824212dc29b5b0354e84c7dadec21d75bacb349 (diff) |
Merge tag 'fsl-qoriq-2023-6-15' of https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq into next
DM_MDIO/CMD for ls1046afrwy
sync APIs for fsl-mc
ldpaa_eth update
lx2160ardb recv support.
net: dsa fix of fallback lookup
Diffstat (limited to 'include/fsl-mc/fsl_mc_cmd.h')
-rw-r--r-- | include/fsl-mc/fsl_mc_cmd.h | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/include/fsl-mc/fsl_mc_cmd.h b/include/fsl-mc/fsl_mc_cmd.h index 591cda9685..c239595ed5 100644 --- a/include/fsl-mc/fsl_mc_cmd.h +++ b/include/fsl-mc/fsl_mc_cmd.h @@ -19,6 +19,15 @@ static inline uint64_t mc_dec(uint64_t val, int lsoffset, int width) return (uint64_t)((val >> lsoffset) & MAKE_UMASK64(width)); } +struct mc_cmd_header { + u8 src_id; + u8 flags_hw; + u8 status; + u8 flags_sw; + __le16 token; + __le16 cmd_id; +}; + struct mc_command { uint64_t header; uint64_t params[MC_CMD_NUM_OF_PARAMS]; @@ -74,29 +83,6 @@ enum mc_cmd_status { ((enum mc_cmd_status)mc_dec((_hdr), \ MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S)) -#define MC_CMD_HDR_READ_TOKEN(_hdr) \ - ((uint16_t)mc_dec((_hdr), MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S)) - -#define MC_PREP_OP(_ext, _param, _offset, _width, _type, _arg) \ - ((_ext)[_param] |= cpu_to_le64(mc_enc((_offset), (_width), _arg))) - -#define MC_EXT_OP(_ext, _param, _offset, _width, _type, _arg) \ - (_arg = (_type)mc_dec(cpu_to_le64(_ext[_param]), (_offset), (_width))) - -#define MC_CMD_OP(_cmd, _param, _offset, _width, _type, _arg) \ - ((_cmd).params[_param] |= mc_enc((_offset), (_width), _arg)) - -#define MC_RSP_OP(_cmd, _param, _offset, _width, _type, _arg) \ - (_arg = (_type)mc_dec(_cmd.params[_param], (_offset), (_width))) - -/* cmd, param, offset, width, type, arg_name */ -#define MC_CMD_READ_OBJ_ID(cmd, obj_id) \ - MC_RSP_OP(cmd, 0, 0, 32, uint32_t, obj_id) - -/* cmd, param, offset, width, type, arg_name */ -#define CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id) \ - MC_CMD_OP(cmd, 0, 0, 32, uint32_t, object_id) - static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id, uint32_t cmd_flags, uint16_t token) @@ -179,4 +165,19 @@ static inline void mc_cmd_read_api_version(struct mc_command *cmd, *minor_ver = le16_to_cpu(rsp_params->minor_ver); } +static inline uint16_t mc_cmd_hdr_read_token(struct mc_command *cmd) +{ + struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header; + u16 token = le16_to_cpu(hdr->token); + + return token; +} + +static inline uint32_t mc_cmd_read_object_id(struct mc_command *cmd) +{ + struct mc_rsp_create *rsp_params; + + rsp_params = (struct mc_rsp_create *)cmd->params; + return le32_to_cpu(rsp_params->object_id); +} #endif /* __FSL_MC_CMD_H */ |