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>
86 * struct uic_command - UIC command structure
114 /* Host <-> Device UniPro Link state */
119 UIC_LINK_BROKEN_STATE = 3, /* Link is in broken state */
122 #define ufshcd_is_link_off(hba) ((hba)->uic_link_state == UIC_LINK_OFF_STATE)
123 #define ufshcd_is_link_active(hba) ((hba)->uic_link_state == \
125 #define ufshcd_is_link_hibern8(hba) ((hba)->uic_link_state == \
127 #define ufshcd_is_link_broken(hba) ((hba)->uic_link_state == \
129 #define ufshcd_set_link_off(hba) ((hba)->uic_link_state = UIC_LINK_OFF_STATE)
130 #define ufshcd_set_link_active(hba) ((hba)->uic_link_state = \
132 #define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \
134 #define ufshcd_set_link_broken(hba) ((hba)->uic_link_state = \
138 ((h)->curr_dev_pwr_mode = UFS_ACTIVE_PWR_MODE)
140 ((h)->curr_dev_pwr_mode = UFS_SLEEP_PWR_MODE)
142 ((h)->curr_dev_pwr_mode = UFS_POWERDOWN_PWR_MODE)
144 ((h)->curr_dev_pwr_mode == UFS_ACTIVE_PWR_MODE)
146 ((h)->curr_dev_pwr_mode == UFS_SLEEP_PWR_MODE)
148 ((h)->curr_dev_pwr_mode == UFS_POWERDOWN_PWR_MODE)
170 * struct ufshcd_lrb - local reference block
189 * @crypto_key_slot: the key slot to use for inline crypto (-1 if none)
211 u8 lun; /* UPIU LUN id field is only 8-bit wide */
226 * struct ufs_query - holds relevant data structures for query request
238 * struct ufs_dev_cmd - all assosiated fields with device management commands
239 * @type: device management command type - Query, NOP OUT
251 * struct ufs_clk_info - UFS clock related info
252 * @list: list headed by hba->clk_list_head
294 * struct ufs_hba_variant_ops - variant specific callbacks
303 * variant specific Uni-Pro initialization.
305 * to allow variant specific Uni-Pro initialization.
313 * @hibern8_notify: called around hibern8 enter/exit
375 * struct ufs_clk_gating - UFS clock gating related info
376 * @gate_work: worker to turn off clocks after some delay as specified in
378 * @ungate_work: worker to turn on clocks that will be used in case of
413 * struct ufs_clk_scaling - UFS clock scaling related data
415 * devfreq ->target() function is called then schedule "suspend_work" to
457 * struct ufs_event_hist - keeps history of errors
471 * struct ufs_stats - keeps usage/err statistics
475 * reset this after link-startup.
489 /* Interrupt aggregation support is broken */
560 * auto-hibernate capability but it doesn't work.
637 * This capability allows the device auto-bkops to be always enabled
653 * This capability allows the host controller driver to turn-on
682 * struct ufshpb_dev_info - UFSHPB device related info
686 * @srgn_size: device reported HPB sub-region size
725 * struct ufs_hba - per adapter private structure
736 * @cmd_queue: Used to allocate command tags from hba->host->tag_set.
805 * "UFS device" W-LU.
820 /* Auto-Hibernate Idle Timer register value */
954 return hba->caps & UFSHCD_CAP_CLK_GATING; in ufshcd_is_clkgating_allowed()
958 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; in ufshcd_can_hibern8_during_gating()
962 return hba->caps & UFSHCD_CAP_CLK_SCALING; in ufshcd_is_clkscaling_supported()
966 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND; in ufshcd_can_autobkops_during_suspend()
970 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND; in ufshcd_is_rpm_autosuspend_allowed()
977 if ((hba->caps & UFSHCD_CAP_INTR_AGGR) && in ufshcd_is_intr_aggr_allowed()
978 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR)) in ufshcd_is_intr_aggr_allowed()
990 (hba->caps & UFSHCD_CAP_AGGR_POWER_COLLAPSE)); in ufshcd_can_aggressive_pc()
995 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) && in ufshcd_is_auto_hibern8_supported()
996 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8); in ufshcd_is_auto_hibern8_supported()
1001 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false; in ufshcd_is_auto_hibern8_enabled()
1006 return hba->caps & UFSHCD_CAP_WB_EN; in ufshcd_is_wb_allowed()
1011 return !hba->shutting_down; in ufshcd_is_user_access_allowed()
1015 writel((val), (hba)->mmio_base + (reg))
1017 readl((hba)->mmio_base + (reg))
1020 * ufshcd_rmwl - read modify write into a register
1021 * @hba - per adapter instance
1022 * @mask - mask to apply on read value
1023 * @val - actual value to write
1024 * @reg - register address
1059 * ufshcd_set_variant - set variant specific data to the hba
1060 * @hba - per adapter instance
1061 * @variant - pointer to variant specific data
1066 hba->priv = variant; in ufshcd_set_variant()
1070 * ufshcd_get_variant - get variant specific data from the hba
1071 * @hba - per adapter instance
1076 return hba->priv; in ufshcd_get_variant()
1081 return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; in ufshcd_keep_autobkops_enabled_except_suspend()
1086 if (hba->dev_info.b_wb_buffer_type == WB_BUF_MODE_LU_DEDICATED) in ufshcd_wb_get_query_index()
1087 return hba->dev_info.wb_dedicated_lu; in ufshcd_wb_get_query_index()
1152 return (pwr_info->pwr_rx == FAST_MODE || in ufshcd_is_hs_mode()
1153 pwr_info->pwr_rx == FASTAUTO_MODE) && in ufshcd_is_hs_mode()
1154 (pwr_info->pwr_tx == FAST_MODE || in ufshcd_is_hs_mode()
1155 pwr_info->pwr_tx == FASTAUTO_MODE); in ufshcd_is_hs_mode()
1163 /* Expose Query-Request API */
1214 if (hba->vops) in ufshcd_get_var_name()
1215 return hba->vops->name; in ufshcd_get_var_name()
1221 if (hba->vops && hba->vops->init) in ufshcd_vops_init()
1222 return hba->vops->init(hba); in ufshcd_vops_init()
1229 if (hba->vops && hba->vops->exit) in ufshcd_vops_exit()
1230 return hba->vops->exit(hba); in ufshcd_vops_exit()
1235 if (hba->vops && hba->vops->get_ufs_hci_version) in ufshcd_vops_get_ufs_hci_version()
1236 return hba->vops->get_ufs_hci_version(hba); in ufshcd_vops_get_ufs_hci_version()
1243 return (hba->ufs_version >= ufshci_version(3, 0)); in ufshcd_has_utrlcnr()
1249 if (hba->vops && hba->vops->clk_scale_notify) in ufshcd_vops_clk_scale_notify()
1250 return hba->vops->clk_scale_notify(hba, up, status); in ufshcd_vops_clk_scale_notify()
1258 if (hba->vops && hba->vops->event_notify) in ufshcd_vops_event_notify()
1259 hba->vops->event_notify(hba, evt, data); in ufshcd_vops_event_notify()
1265 if (hba->vops && hba->vops->setup_clocks) in ufshcd_vops_setup_clocks()
1266 return hba->vops->setup_clocks(hba, on, status); in ufshcd_vops_setup_clocks()
1272 if (hba->vops && hba->vops->setup_regulators) in ufshcd_vops_setup_regulators()
1273 return hba->vops->setup_regulators(hba, status); in ufshcd_vops_setup_regulators()
1281 if (hba->vops && hba->vops->hce_enable_notify) in ufshcd_vops_hce_enable_notify()
1282 return hba->vops->hce_enable_notify(hba, status); in ufshcd_vops_hce_enable_notify()
1289 if (hba->vops && hba->vops->link_startup_notify) in ufshcd_vops_link_startup_notify()
1290 return hba->vops->link_startup_notify(hba, status); in ufshcd_vops_link_startup_notify()
1300 if (hba->vops && hba->vops->pwr_change_notify) in ufshcd_vops_pwr_change_notify()
1301 return hba->vops->pwr_change_notify(hba, status, in ufshcd_vops_pwr_change_notify()
1304 return -ENOTSUPP; in ufshcd_vops_pwr_change_notify()
1310 if (hba->vops && hba->vops->setup_task_mgmt) in ufshcd_vops_setup_task_mgmt()
1311 return hba->vops->setup_task_mgmt(hba, tag, tm_function); in ufshcd_vops_setup_task_mgmt()
1318 if (hba->vops && hba->vops->hibern8_notify) in ufshcd_vops_hibern8_notify()
1319 return hba->vops->hibern8_notify(hba, cmd, status); in ufshcd_vops_hibern8_notify()
1324 if (hba->vops && hba->vops->apply_dev_quirks) in ufshcd_vops_apply_dev_quirks()
1325 return hba->vops->apply_dev_quirks(hba); in ufshcd_vops_apply_dev_quirks()
1331 if (hba->vops && hba->vops->fixup_dev_quirks) in ufshcd_vops_fixup_dev_quirks()
1332 hba->vops->fixup_dev_quirks(hba); in ufshcd_vops_fixup_dev_quirks()
1337 if (hba->vops && hba->vops->suspend) in ufshcd_vops_suspend()
1338 return hba->vops->suspend(hba, op); in ufshcd_vops_suspend()
1345 if (hba->vops && hba->vops->resume) in ufshcd_vops_resume()
1346 return hba->vops->resume(hba, op); in ufshcd_vops_resume()
1353 if (hba->vops && hba->vops->dbg_register_dump) in ufshcd_vops_dbg_register_dump()
1354 hba->vops->dbg_register_dump(hba); in ufshcd_vops_dbg_register_dump()
1359 if (hba->vops && hba->vops->device_reset) { in ufshcd_vops_device_reset()
1360 int err = hba->vops->device_reset(hba); in ufshcd_vops_device_reset()
1365 hba->wb_enabled = false; in ufshcd_vops_device_reset()
1366 hba->wb_buf_flush_enabled = false; in ufshcd_vops_device_reset()
1369 if (err != -EOPNOTSUPP) in ufshcd_vops_device_reset()
1378 if (hba->vops && hba->vops->config_scaling_param) in ufshcd_vops_config_scaling_param()
1379 hba->vops->config_scaling_param(hba, profile, data); in ufshcd_vops_config_scaling_param()
1385 * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN