| /* |
| * Copyright (c) 2020, Mediatek Inc. All rights reserved. |
| * |
| * SPDX-License-Identifier: BSD-3-Clause |
| */ |
| |
| #ifndef UNIPRO_H_ |
| #define UNIPRO_H_ |
| |
| #define UIC_ARG_MIB_SEL(attr, sel) ((((attr) & 0xFFFF) << 16) |\ |
| ((sel) & 0xFFFF)) |
| #define UIC_ARG_MIB(attr) UIC_ARG_MIB_SEL(attr, 0) |
| #define UIC_ARG_ATTR_TYPE(t) (((t) & 0xFF) << 16) |
| #define UIC_GET_ATTR_ID(v) (((v) >> 16) & 0xFFFF) |
| |
| /* UIC command interfaces for DME primitives */ |
| #define DME_LOCAL 0 |
| #define DME_PEER 1 |
| #define ATTR_SET_NOR 0 /* NORMAL */ |
| #define ATTR_SET_ST 1 /* STATIC */ |
| #define MASK_UIC_COMMAND_RESULT 0xFF |
| |
| #define UPIU_TRANSACTION_UIC_CMD 0x1F |
| /* uic commands are 4DW long, per UFSHCI V2.1 paragraph 5.6.1 */ |
| #define UIC_CMD_SIZE (sizeof(__u32) * 4) |
| |
| /** |
| * struct uic_command - UIC command structure |
| * @command: UIC command |
| * @argument1: UIC command argument 1 |
| * @argument2: UIC command argument 2 |
| * @argument3: UIC command argument 3 |
| */ |
| struct uic_command { |
| __u32 command; |
| __u32 argument1; |
| __u32 argument2; |
| __u32 argument3; |
| }; |
| |
| enum unipro_acc_mode { |
| GETTABLE = (1 << 0), |
| SETTABLE = (1 << 1), |
| STATIC = (1 << 2), |
| DYNAMIC = (1 << 3) |
| }; |
| |
| struct ufs_uic_attr_fields { |
| const char *name; |
| __u32 id; |
| enum unipro_acc_mode acc_mode; |
| }; |
| |
| struct ufs_unipro_attrs_info { |
| const char *name; |
| struct ufs_uic_attr_fields *attrs; |
| __u32 items; |
| }; |
| |
| struct uic_cmd_result_code { |
| __u8 value; |
| const char *def; |
| }; |
| |
| /* Unipro attribute idn */ |
| enum unipro_attr_idn { |
| MPHY = 0x00, |
| PHY_ADAPTER = 0x01, |
| DME_QOS = 0X02, |
| MAX_UNIPRO_IDN, |
| }; |
| |
| /* UIC Commands */ |
| enum uic_cmd_dme { |
| UIC_CMD_DME_GET = 0x01, |
| UIC_CMD_DME_SET = 0x02, |
| UIC_CMD_DME_PEER_GET = 0x03, |
| UIC_CMD_DME_PEER_SET = 0x04, |
| UIC_CMD_DME_POWERON = 0x10, |
| UIC_CMD_DME_POWEROFF = 0x11, |
| UIC_CMD_DME_ENABLE = 0x12, |
| UIC_CMD_DME_RESET = 0x14, |
| UIC_CMD_DME_END_PT_RST = 0x15, |
| UIC_CMD_DME_LINK_STARTUP = 0x16, |
| UIC_CMD_DME_HIBER_ENTER = 0x17, |
| UIC_CMD_DME_HIBER_EXIT = 0x18, |
| UIC_CMD_DME_TEST_MODE = 0x1A, |
| }; |
| |
| int do_uic(struct tool_options *opt); |
| void unipro_help(char *tool_name); |
| |
| #endif /* END UNIPRO_H_ */ |