Lines Matching +full:ufs +full:- +full:wrapper

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
7 #include <ufs/ufshcd.h>
11 return !hba->shutting_down; in ufshcd_is_user_access_allowed()
19 return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; in ufshcd_keep_autobkops_enabled_except_suspend()
24 if (hba->dev_info.wb_buffer_type == WB_BUF_MODE_LU_DEDICATED) in ufshcd_wb_get_query_index()
25 return hba->dev_info.wb_dedicated_lu; in ufshcd_wb_get_query_index()
32 !(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL); in ufshcd_is_wb_buf_flush_allowed()
97 /* Wrapper functions for safely calling variant operations */
100 if (hba->vops) in ufshcd_get_var_name()
101 return hba->vops->name; in ufshcd_get_var_name()
107 if (hba->vops && hba->vops->exit) in ufshcd_vops_exit()
108 return hba->vops->exit(hba); in ufshcd_vops_exit()
113 if (hba->vops && hba->vops->get_ufs_hci_version) in ufshcd_vops_get_ufs_hci_version()
114 return hba->vops->get_ufs_hci_version(hba); in ufshcd_vops_get_ufs_hci_version()
122 if (hba->vops && hba->vops->clk_scale_notify) in ufshcd_vops_clk_scale_notify()
123 return hba->vops->clk_scale_notify(hba, up, status); in ufshcd_vops_clk_scale_notify()
131 if (hba->vops && hba->vops->event_notify) in ufshcd_vops_event_notify()
132 hba->vops->event_notify(hba, evt, data); in ufshcd_vops_event_notify()
138 if (hba->vops && hba->vops->setup_clocks) in ufshcd_vops_setup_clocks()
139 return hba->vops->setup_clocks(hba, on, status); in ufshcd_vops_setup_clocks()
146 if (hba->vops && hba->vops->hce_enable_notify) in ufshcd_vops_hce_enable_notify()
147 return hba->vops->hce_enable_notify(hba, status); in ufshcd_vops_hce_enable_notify()
154 if (hba->vops && hba->vops->link_startup_notify) in ufshcd_vops_link_startup_notify()
155 return hba->vops->link_startup_notify(hba, status); in ufshcd_vops_link_startup_notify()
165 if (hba->vops && hba->vops->pwr_change_notify) in ufshcd_vops_pwr_change_notify()
166 return hba->vops->pwr_change_notify(hba, status, in ufshcd_vops_pwr_change_notify()
169 return -ENOTSUPP; in ufshcd_vops_pwr_change_notify()
175 if (hba->vops && hba->vops->setup_task_mgmt) in ufshcd_vops_setup_task_mgmt()
176 return hba->vops->setup_task_mgmt(hba, tag, tm_function); in ufshcd_vops_setup_task_mgmt()
183 if (hba->vops && hba->vops->hibern8_notify) in ufshcd_vops_hibern8_notify()
184 return hba->vops->hibern8_notify(hba, cmd, status); in ufshcd_vops_hibern8_notify()
189 if (hba->vops && hba->vops->apply_dev_quirks) in ufshcd_vops_apply_dev_quirks()
190 return hba->vops->apply_dev_quirks(hba); in ufshcd_vops_apply_dev_quirks()
196 if (hba->vops && hba->vops->fixup_dev_quirks) in ufshcd_vops_fixup_dev_quirks()
197 hba->vops->fixup_dev_quirks(hba); in ufshcd_vops_fixup_dev_quirks()
203 if (hba->vops && hba->vops->suspend) in ufshcd_vops_suspend()
204 return hba->vops->suspend(hba, op, status); in ufshcd_vops_suspend()
211 if (hba->vops && hba->vops->resume) in ufshcd_vops_resume()
212 return hba->vops->resume(hba, op); in ufshcd_vops_resume()
219 if (hba->vops && hba->vops->dbg_register_dump) in ufshcd_vops_dbg_register_dump()
220 hba->vops->dbg_register_dump(hba); in ufshcd_vops_dbg_register_dump()
225 if (hba->vops && hba->vops->device_reset) in ufshcd_vops_device_reset()
226 return hba->vops->device_reset(hba); in ufshcd_vops_device_reset()
228 return -EOPNOTSUPP; in ufshcd_vops_device_reset()
235 if (hba->vops && hba->vops->config_scaling_param) in ufshcd_vops_config_scaling_param()
236 hba->vops->config_scaling_param(hba, p, data); in ufshcd_vops_config_scaling_param()
241 if (hba->vops && hba->vops->reinit_notify) in ufshcd_vops_reinit_notify()
242 hba->vops->reinit_notify(hba); in ufshcd_vops_reinit_notify()
247 if (hba->vops && hba->vops->mcq_config_resource) in ufshcd_vops_mcq_config_resource()
248 return hba->vops->mcq_config_resource(hba); in ufshcd_vops_mcq_config_resource()
250 return -EOPNOTSUPP; in ufshcd_vops_mcq_config_resource()
255 if (hba->vops && hba->vops->op_runtime_config) in ufshcd_mcq_vops_op_runtime_config()
256 return hba->vops->op_runtime_config(hba); in ufshcd_mcq_vops_op_runtime_config()
258 return -EOPNOTSUPP; in ufshcd_mcq_vops_op_runtime_config()
264 if (hba->vops && hba->vops->get_outstanding_cqs) in ufshcd_vops_get_outstanding_cqs()
265 return hba->vops->get_outstanding_cqs(hba, ocqs); in ufshcd_vops_get_outstanding_cqs()
267 return -EOPNOTSUPP; in ufshcd_vops_get_outstanding_cqs()
272 if (hba->vops && hba->vops->config_esi) in ufshcd_mcq_vops_config_esi()
273 return hba->vops->config_esi(hba); in ufshcd_mcq_vops_config_esi()
275 return -EOPNOTSUPP; in ufshcd_mcq_vops_config_esi()
281 * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN
303 return ufshcd_update_ee_control(hba, &hba->ee_drv_mask, in ufshcd_update_ee_drv_mask()
304 &hba->ee_usr_mask, set, clr); in ufshcd_update_ee_drv_mask()
310 return ufshcd_update_ee_control(hba, &hba->ee_usr_mask, in ufshcd_update_ee_usr_mask()
311 &hba->ee_drv_mask, set, clr); in ufshcd_update_ee_usr_mask()
316 return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev); in ufshcd_rpm_get_sync()
321 return pm_runtime_get_if_active(&hba->ufs_device_wlun->sdev_gendev); in ufshcd_rpm_get_if_active()
326 return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev); in ufshcd_rpm_put_sync()
331 pm_runtime_get_noresume(&hba->ufs_device_wlun->sdev_gendev); in ufshcd_rpm_get_noresume()
336 return pm_runtime_resume(&hba->ufs_device_wlun->sdev_gendev); in ufshcd_rpm_resume()
341 return pm_runtime_put(&hba->ufs_device_wlun->sdev_gendev); in ufshcd_rpm_put()
345 * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor
352 if (!dev_info || !dev_info->max_lu_supported) { in ufs_is_valid_unit_desc_lun()
353 pr_err("Max General LU supported by UFS isn't initialized\n"); in ufs_is_valid_unit_desc_lun()
356 return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported); in ufs_is_valid_unit_desc_lun()
360 __must_hold(&q->sq_lock) in ufshcd_inc_sq_tail()
364 q->sq_tail_slot++; in ufshcd_inc_sq_tail()
365 if (q->sq_tail_slot == q->max_entries) in ufshcd_inc_sq_tail()
366 q->sq_tail_slot = 0; in ufshcd_inc_sq_tail()
367 val = q->sq_tail_slot * sizeof(struct utp_transfer_req_desc); in ufshcd_inc_sq_tail()
368 writel(val, q->mcq_sq_tail); in ufshcd_inc_sq_tail()
373 u32 val = readl(q->mcq_cq_tail); in ufshcd_mcq_update_cq_tail_slot()
375 q->cq_tail_slot = val / sizeof(struct cq_entry); in ufshcd_mcq_update_cq_tail_slot()
380 return q->cq_head_slot == q->cq_tail_slot; in ufshcd_mcq_is_cq_empty()
385 q->cq_head_slot++; in ufshcd_mcq_inc_cq_head_slot()
386 if (q->cq_head_slot == q->max_entries) in ufshcd_mcq_inc_cq_head_slot()
387 q->cq_head_slot = 0; in ufshcd_mcq_inc_cq_head_slot()
392 writel(q->cq_head_slot * sizeof(struct cq_entry), q->mcq_cq_head); in ufshcd_mcq_update_cq_head()
397 struct cq_entry *cqe = q->cqe_base_addr; in ufshcd_mcq_cur_cqe()
399 return cqe + q->cq_head_slot; in ufshcd_mcq_cur_cqe()
404 u32 val = readl(q->mcq_sq_head); in ufshcd_mcq_get_sq_head_slot()