| @@ -8520,6 +8520,41 @@ out: · 8519 unmodified lines |
| 8520 | return ret; | 8520 | return ret; |
| 8521 | } | 8521 | } |
| 8522 | | 8522 | |
| | 8523 | static void ufshcd_set_timestamp_attr(struct ufs_hba *hba) |
| | 8524 | { |
| | 8525 | int err; |
| | 8526 | struct ufs_query_req *request = NULL; |
| | 8527 | struct ufs_query_res *response = NULL; |
| | 8528 | struct ufs_dev_info *dev_info = &hba->dev_info; |
| | 8529 | struct utp_upiu_query_v4_0 *upiu_data; |
| | 8530 | |
| | 8531 | if (dev_info->wspecversion < 0x400) |
| | 8532 | return; |
| | 8533 | |
| | 8534 | ufshcd_hold(hba); |
| | 8535 | |
| | 8536 | mutex_lock(&hba->dev_cmd.lock); |
| | 8537 | |
| | 8538 | ufshcd_init_query(hba, &request, &response, |
| | 8539 | UPIU_QUERY_OPCODE_WRITE_ATTR, |
| | 8540 | QUERY_ATTR_IDN_TIMESTAMP, 0, 0); |
| | 8541 | |
| | 8542 | request->query_func = UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST; |
| | 8543 | |
| | 8544 | upiu_data = (struct utp_upiu_query_v4_0 *)&request->upiu_req; |
| | 8545 | |
| | 8546 | put_unaligned_be64(ktime_get_real_ns(), &upiu_data->osf3); |
| | 8547 | |
| | 8548 | err = ufshcd_exec_dev_cmd(hba, DEV_CMD_TYPE_QUERY, QUERY_REQ_TIMEOUT); |
| | 8549 | |
| | 8550 | if (err) |
| | 8551 | dev_err(hba->dev, "%s: failed to set timestamp %d\n", |
| | 8552 | __func__, err); |
| | 8553 | |
| | 8554 | mutex_unlock(&hba->dev_cmd.lock); |
| | 8555 | ufshcd_release(hba); |
| | 8556 | } |
| | 8557 | |
| 8523 | /** | 8558 | /** |
| 8524 | * ufshcd_add_lus - probe and add UFS logical units | 8559 | * ufshcd_add_lus - probe and add UFS logical units |
| 8525 | * @hba: per-adapter instance | 8560 | * @hba: per-adapter instance |
| @@ -8708,6 +8743,8 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params) · 182 unmodified lines |
| 8708 | ufshcd_set_ufs_dev_active(hba); | 8743 | ufshcd_set_ufs_dev_active(hba); |
| 8709 | ufshcd_force_reset_auto_bkops(hba); | 8744 | ufshcd_force_reset_auto_bkops(hba); |
| 8710 | | 8745 | |
| | 8746 | ufshcd_set_timestamp_attr(hba); |
| | 8747 | |
| 8711 | /* Gear up to HS gear if supported */ | 8748 | /* Gear up to HS gear if supported */ |
| 8712 | if (hba->max_pwr_info.is_valid) { | 8749 | if (hba->max_pwr_info.is_valid) { |
| 8713 | /* | 8750 | /* |
| @@ -9741,6 +9778,7 @@ static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) · 1027 unmodified lines |
| 9741 | ret = ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE); | 9778 | ret = ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE); |
| 9742 | if (ret) | 9779 | if (ret) |
| 9743 | goto set_old_link_state; | 9780 | goto set_old_link_state; |
| | 9781 | ufshcd_set_timestamp_attr(hba); |
| 9744 | } | 9782 | } |
| 9745 | | 9783 | |
| 9746 | if (ufshcd_keep_autobkops_enabled_except_suspend(hba)) | 9784 | if (ufshcd_keep_autobkops_enabled_except_suspend(hba)) |