Lines Matching +full:broken +full:- +full:turn +full:- +full:around

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Copyright (C) 2011-2013 Samsung India Software Operations
5 * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
35 #include <linux/keyslot-manager.h>
62 * struct uic_command - UIC command structure
90 /* Host <-> Device UniPro Link state */
95 UIC_LINK_BROKEN_STATE = 3, /* Link is in broken state */
98 #define ufshcd_is_link_off(hba) ((hba)->uic_link_state == UIC_LINK_OFF_STATE)
99 #define ufshcd_is_link_active(hba) ((hba)->uic_link_state == \
101 #define ufshcd_is_link_hibern8(hba) ((hba)->uic_link_state == \
103 #define ufshcd_is_link_broken(hba) ((hba)->uic_link_state == \
105 #define ufshcd_set_link_off(hba) ((hba)->uic_link_state = UIC_LINK_OFF_STATE)
106 #define ufshcd_set_link_active(hba) ((hba)->uic_link_state = \
108 #define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \
110 #define ufshcd_set_link_broken(hba) ((hba)->uic_link_state = \
114 ((h)->curr_dev_pwr_mode = UFS_ACTIVE_PWR_MODE)
116 ((h)->curr_dev_pwr_mode = UFS_SLEEP_PWR_MODE)
118 ((h)->curr_dev_pwr_mode = UFS_POWERDOWN_PWR_MODE)
120 ((h)->curr_dev_pwr_mode == UFS_ACTIVE_PWR_MODE)
122 ((h)->curr_dev_pwr_mode == UFS_SLEEP_PWR_MODE)
124 ((h)->curr_dev_pwr_mode == UFS_POWERDOWN_PWR_MODE)
146 * struct ufshcd_lrb - local reference block
165 * @crypto_key_slot: the key slot to use for inline crypto (-1 if none)
187 u8 lun; /* UPIU LUN id field is only 8-bit wide */
200 * struct ufs_query - holds relevant data structures for query request
212 * struct ufs_dev_cmd - all assosiated fields with device management commands
213 * @type: device management command type - Query, NOP OUT
225 * struct ufs_clk_info - UFS clock related info
226 * @list: list headed by hba->clk_list_head
265 * struct ufs_hba_variant_ops - variant specific callbacks
274 * variant specific Uni-Pro initialization.
276 * to allow variant specific Uni-Pro initialization.
284 * @hibern8_notify: called around hibern8 enter/exit
338 * struct ufs_clk_gating - UFS clock gating related info
339 * @gate_work: worker to turn off clocks after some delay as specified in
341 * @ungate_work: worker to turn on clocks that will be used in case of
372 * struct ufs_clk_scaling - UFS clock scaling related data
374 * devfreq ->target() function is called then schedule "suspend_work" to
406 * struct ufs_err_reg_hist - keeps history of errors
418 * struct ufs_stats - keeps usage/err statistics
422 * reset this after link-startup.
425 * @pa_err: tracks pa-uic errors
426 * @dl_err: tracks dl-uic errors
427 * @nl_err: tracks nl-uic errors
428 * @tl_err: tracks tl-uic errors
430 * @auto_hibern8_err: tracks auto-hibernate errors
432 * @linkup_err: tracks link-startup errors
467 /* Interrupt aggregation support is broken */
538 * auto-hibernate capability but it doesn't work.
570 * This capability allows the device auto-bkops to be always enabled
586 * This capability allows the host controller driver to turn-on
607 * struct ufs_hba - per adapter private structure
618 * @cmd_queue: Used to allocate command tags from hba->host->tag_set.
683 * "UFS device" W-LU.
697 /* Auto-Hibernate Idle Timer register value */
801 return hba->caps & UFSHCD_CAP_CLK_GATING; in ufshcd_is_clkgating_allowed()
805 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; in ufshcd_can_hibern8_during_gating()
809 return hba->caps & UFSHCD_CAP_CLK_SCALING; in ufshcd_is_clkscaling_supported()
813 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND; in ufshcd_can_autobkops_during_suspend()
817 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND; in ufshcd_is_rpm_autosuspend_allowed()
824 if ((hba->caps & UFSHCD_CAP_INTR_AGGR) && in ufshcd_is_intr_aggr_allowed()
825 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR)) in ufshcd_is_intr_aggr_allowed()
836 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) && in ufshcd_is_auto_hibern8_supported()
837 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8); in ufshcd_is_auto_hibern8_supported()
842 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false; in ufshcd_is_auto_hibern8_enabled()
847 return hba->caps & UFSHCD_CAP_WB_EN; in ufshcd_is_wb_allowed()
851 writel((val), (hba)->mmio_base + (reg))
853 readl((hba)->mmio_base + (reg))
856 * ufshcd_rmwl - read modify write into a register
857 * @hba - per adapter instance
858 * @mask - mask to apply on read value
859 * @val - actual value to write
860 * @reg - register address
895 * ufshcd_set_variant - set variant specific data to the hba
896 * @hba - per adapter instance
897 * @variant - pointer to variant specific data
902 hba->priv = variant; in ufshcd_set_variant()
906 * ufshcd_get_variant - get variant specific data from the hba
907 * @hba - per adapter instance
912 return hba->priv; in ufshcd_get_variant()
917 return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; in ufshcd_keep_autobkops_enabled_except_suspend()
922 if (hba->dev_info.b_wb_buffer_type == WB_BUF_MODE_LU_DEDICATED) in ufshcd_wb_get_query_index()
923 return hba->dev_info.wb_dedicated_lu; in ufshcd_wb_get_query_index()
988 return (pwr_info->pwr_rx == FAST_MODE || in ufshcd_is_hs_mode()
989 pwr_info->pwr_rx == FASTAUTO_MODE) && in ufshcd_is_hs_mode()
990 (pwr_info->pwr_tx == FAST_MODE || in ufshcd_is_hs_mode()
991 pwr_info->pwr_tx == FASTAUTO_MODE); in ufshcd_is_hs_mode()
999 /* Expose Query-Request API */
1044 if (hba->vops) in ufshcd_get_var_name()
1045 return hba->vops->name; in ufshcd_get_var_name()
1051 if (hba->vops && hba->vops->init) in ufshcd_vops_init()
1052 return hba->vops->init(hba); in ufshcd_vops_init()
1059 if (hba->vops && hba->vops->exit) in ufshcd_vops_exit()
1060 return hba->vops->exit(hba); in ufshcd_vops_exit()
1065 if (hba->vops && hba->vops->get_ufs_hci_version) in ufshcd_vops_get_ufs_hci_version()
1066 return hba->vops->get_ufs_hci_version(hba); in ufshcd_vops_get_ufs_hci_version()
1074 if (hba->vops && hba->vops->clk_scale_notify) in ufshcd_vops_clk_scale_notify()
1075 return hba->vops->clk_scale_notify(hba, up, status); in ufshcd_vops_clk_scale_notify()
1082 if (hba->vops && hba->vops->setup_clocks) in ufshcd_vops_setup_clocks()
1083 return hba->vops->setup_clocks(hba, on, status); in ufshcd_vops_setup_clocks()
1089 if (hba->vops && hba->vops->setup_regulators) in ufshcd_vops_setup_regulators()
1090 return hba->vops->setup_regulators(hba, status); in ufshcd_vops_setup_regulators()
1098 if (hba->vops && hba->vops->hce_enable_notify) in ufshcd_vops_hce_enable_notify()
1099 return hba->vops->hce_enable_notify(hba, status); in ufshcd_vops_hce_enable_notify()
1106 if (hba->vops && hba->vops->link_startup_notify) in ufshcd_vops_link_startup_notify()
1107 return hba->vops->link_startup_notify(hba, status); in ufshcd_vops_link_startup_notify()
1117 if (hba->vops && hba->vops->pwr_change_notify) in ufshcd_vops_pwr_change_notify()
1118 return hba->vops->pwr_change_notify(hba, status, in ufshcd_vops_pwr_change_notify()
1121 return -ENOTSUPP; in ufshcd_vops_pwr_change_notify()
1127 if (hba->vops && hba->vops->setup_xfer_req) in ufshcd_vops_setup_xfer_req()
1128 return hba->vops->setup_xfer_req(hba, tag, is_scsi_cmd); in ufshcd_vops_setup_xfer_req()
1134 if (hba->vops && hba->vops->setup_task_mgmt) in ufshcd_vops_setup_task_mgmt()
1135 return hba->vops->setup_task_mgmt(hba, tag, tm_function); in ufshcd_vops_setup_task_mgmt()
1142 if (hba->vops && hba->vops->hibern8_notify) in ufshcd_vops_hibern8_notify()
1143 return hba->vops->hibern8_notify(hba, cmd, status); in ufshcd_vops_hibern8_notify()
1148 if (hba->vops && hba->vops->apply_dev_quirks) in ufshcd_vops_apply_dev_quirks()
1149 return hba->vops->apply_dev_quirks(hba); in ufshcd_vops_apply_dev_quirks()
1155 if (hba->vops && hba->vops->fixup_dev_quirks) in ufshcd_vops_fixup_dev_quirks()
1156 hba->vops->fixup_dev_quirks(hba); in ufshcd_vops_fixup_dev_quirks()
1161 if (hba->vops && hba->vops->suspend) in ufshcd_vops_suspend()
1162 return hba->vops->suspend(hba, op); in ufshcd_vops_suspend()
1169 if (hba->vops && hba->vops->resume) in ufshcd_vops_resume()
1170 return hba->vops->resume(hba, op); in ufshcd_vops_resume()
1177 if (hba->vops && hba->vops->dbg_register_dump) in ufshcd_vops_dbg_register_dump()
1178 hba->vops->dbg_register_dump(hba); in ufshcd_vops_dbg_register_dump()
1183 if (hba->vops && hba->vops->device_reset) { in ufshcd_vops_device_reset()
1184 hba->vops->device_reset(hba); in ufshcd_vops_device_reset()
1186 ufshcd_update_reg_hist(&hba->ufs_stats.dev_reset, 0); in ufshcd_vops_device_reset()
1194 if (hba->vops && hba->vops->config_scaling_param) in ufshcd_vops_config_scaling_param()
1195 hba->vops->config_scaling_param(hba, profile, data); in ufshcd_vops_config_scaling_param()
1201 * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN