Make ufshcd_send_uic_cmd() public for that.
Unified · Split
| @@ -84,6 +84,7 @@ static int ufs_bsg_request(struct bsg_job *job) · 83 unmodified lines | ||
| 84 | 84 | struct ufs_hba *hba = shost_priv(dev_to_shost(job->dev->parent)); |
| 85 | 85 | unsigned int req_len = job->request_len; |
| 86 | 86 | unsigned int reply_len = job->reply_len; |
| 87 | + struct uic_command uc = {}; | |
| 87 | 88 | int msgcode; |
| 88 | 89 | uint8_t *desc_buff = NULL; |
| 89 | 90 | int desc_len = 0; |
| @@ -116,6 +117,16 @@ static int ufs_bsg_request(struct bsg_job *job) · 26 unmodified lines | ||
| 116 | 117 | dev_err(hba->dev, |
| 117 | 118 | "exe raw upiu: error code %d\n", ret); |
| 118 | 119 | |
| 120 | + break; | |
| 121 | + case UPIU_TRANSACTION_UIC_CMD: | |
| 122 | + memcpy(&uc, &bsg_request->upiu_req.uc, UIC_CMD_SIZE); | |
| 123 | + ret = ufshcd_send_uic_cmd(hba, &uc); | |
| 124 | + if (ret) | |
| 125 | + dev_dbg(hba->dev, | |
| 126 | + "send uic cmd: error code %d\n", ret); | |
| 127 | + | |
| 128 | + memcpy(&bsg_reply->upiu_rsp.uc, &uc, UIC_CMD_SIZE); | |
| 129 | + | |
| 119 | 130 | break; |
| 120 | 131 | default: |
| 121 | 132 | ret = -ENOTSUPP; |
| @@ -2059,8 +2059,7 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, · 2058 unmodified lines | ||
| 2059 | 2059 | * |
| 2060 | 2060 | * Returns 0 only if success. |
| 2061 | 2061 | */ |
| 2062 | −static int | |
| 2063 | −ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) | |
| 2062 | +int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) | |
| 2064 | 2063 | { |
| 2065 | 2064 | int ret; |
| 2066 | 2065 | unsigned long flags; |
| @@ -895,6 +895,8 @@ int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id, · 894 unmodified lines | ||
| 895 | 895 | |
| 896 | 896 | u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba); |
| 897 | 897 | |
| 898 | +int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd); | |
| 899 | + | |
| 898 | 900 | int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, |
| 899 | 901 | struct utp_upiu_req *req_upiu, |
| 900 | 902 | struct utp_upiu_req *rsp_upiu, |
| @@ -13,6 +13,9 @@ · 12 unmodified lines | ||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | #define UFS_CDB_SIZE 16 |
| 16 | +#define UPIU_TRANSACTION_UIC_CMD 0x1F | |
| 17 | +/* uic commands are 4DW long, per UFSHCI V2.1 paragraph 5.6.1 */ | |
| 18 | +#define UIC_CMD_SIZE (sizeof(u32) * 4) | |
| 16 | 19 | |
| 17 | 20 | /** |
| 18 | 21 | * struct utp_upiu_header - UPIU header structure |