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>
87 * struct uic_command - UIC command structure
111 /* Host <-> Device UniPro Link state */
116 UIC_LINK_BROKEN_STATE = 3, /* Link is in broken state */
119 #define ufshcd_is_link_off(hba) ((hba)->uic_link_state == UIC_LINK_OFF_STATE)
120 #define ufshcd_is_link_active(hba) ((hba)->uic_link_state == \
122 #define ufshcd_is_link_hibern8(hba) ((hba)->uic_link_state == \
124 #define ufshcd_is_link_broken(hba) ((hba)->uic_link_state == \
126 #define ufshcd_set_link_off(hba) ((hba)->uic_link_state = UIC_LINK_OFF_STATE)
127 #define ufshcd_set_link_active(hba) ((hba)->uic_link_state = \
129 #define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \
131 #define ufshcd_set_link_broken(hba) ((hba)->uic_link_state = \
135 ((h)->curr_dev_pwr_mode = UFS_ACTIVE_PWR_MODE)
137 ((h)->curr_dev_pwr_mode = UFS_SLEEP_PWR_MODE)
139 ((h)->curr_dev_pwr_mode = UFS_POWERDOWN_PWR_MODE)
141 ((h)->curr_dev_pwr_mode = UFS_DEEPSLEEP_PWR_MODE)
143 ((h)->curr_dev_pwr_mode == UFS_ACTIVE_PWR_MODE)
145 ((h)->curr_dev_pwr_mode == UFS_SLEEP_PWR_MODE)
147 ((h)->curr_dev_pwr_mode == UFS_POWERDOWN_PWR_MODE)
149 ((h)->curr_dev_pwr_mode == UFS_DEEPSLEEP_PWR_MODE)
174 * struct ufshcd_lrb - local reference block
193 * @crypto_key_slot: the key slot to use for inline crypto (-1 if none)
215 u8 lun; /* UPIU LUN id field is only 8-bit wide */
228 * struct ufs_query - holds relevant data structures for query request
240 * struct ufs_dev_cmd - all assosiated fields with device management commands
241 * @type: device management command type - Query, NOP OUT
253 * struct ufs_clk_info - UFS clock related info
254 * @list: list headed by hba->clk_list_head
296 * struct ufs_hba_variant_ops - variant specific callbacks
304 * variant specific Uni-Pro initialization.
306 * to allow variant specific Uni-Pro initialization.
314 * @hibern8_notify: called around hibern8 enter/exit
370 * struct ufs_clk_gating - UFS clock gating related info
371 * @gate_work: worker to turn off clocks after some delay as specified in
373 * @ungate_work: worker to turn on clocks that will be used in case of
406 * struct ufs_clk_scaling - UFS clock scaling related data
408 * devfreq ->target() function is called then schedule "suspend_work" to
448 * struct ufs_event_hist - keeps history of errors
462 * struct ufs_stats - keeps usage/err statistics
466 * reset this after link-startup.
480 * enum ufshcd_state - UFS host controller state
501 /* Interrupt aggregation support is broken */
572 * auto-hibernate capability but it doesn't work.
614 * This capability allows the device auto-bkops to be always enabled
630 * This capability allows the host controller driver to turn-on
652 * support device hardware reset via the hba->device_reset() callback,
667 * struct ufshpb_dev_info - UFSHPB device related info
671 * @srgn_size: device reported HPB sub-region size
710 * struct ufs_hba - per adapter private structure
721 * @cmd_queue: Used to allocate command tags from hba->host->tag_set.
789 * "UFS device" W-LU.
804 /* Auto-Hibernate Idle Timer register value */
929 return hba->caps & UFSHCD_CAP_CLK_GATING; in ufshcd_is_clkgating_allowed()
933 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; in ufshcd_can_hibern8_during_gating()
937 return hba->caps & UFSHCD_CAP_CLK_SCALING; in ufshcd_is_clkscaling_supported()
941 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND; in ufshcd_can_autobkops_during_suspend()
945 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND; in ufshcd_is_rpm_autosuspend_allowed()
950 return (hba->caps & UFSHCD_CAP_INTR_AGGR) && in ufshcd_is_intr_aggr_allowed()
951 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR); in ufshcd_is_intr_aggr_allowed()
957 (hba->caps & UFSHCD_CAP_AGGR_POWER_COLLAPSE)); in ufshcd_can_aggressive_pc()
962 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) && in ufshcd_is_auto_hibern8_supported()
963 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8); in ufshcd_is_auto_hibern8_supported()
968 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false; in ufshcd_is_auto_hibern8_enabled()
973 return hba->caps & UFSHCD_CAP_WB_EN; in ufshcd_is_wb_allowed()
978 return !hba->shutting_down; in ufshcd_is_user_access_allowed()
982 writel((val), (hba)->mmio_base + (reg))
984 readl((hba)->mmio_base + (reg))
987 * ufshcd_rmwl - read modify write into a register
988 * @hba - per adapter instance
989 * @mask - mask to apply on read value
990 * @val - actual value to write
991 * @reg - register address
1026 * ufshcd_set_variant - set variant specific data to the hba
1027 * @hba - per adapter instance
1028 * @variant - pointer to variant specific data
1033 hba->priv = variant; in ufshcd_set_variant()
1037 * ufshcd_get_variant - get variant specific data from the hba
1038 * @hba - per adapter instance
1043 return hba->priv; in ufshcd_get_variant()
1048 return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; in ufshcd_keep_autobkops_enabled_except_suspend()
1053 if (hba->dev_info.wb_buffer_type == WB_BUF_MODE_LU_DEDICATED) in ufshcd_wb_get_query_index()
1054 return hba->dev_info.wb_dedicated_lu; in ufshcd_wb_get_query_index()
1125 return (pwr_info->pwr_rx == FAST_MODE || in ufshcd_is_hs_mode()
1126 pwr_info->pwr_rx == FASTAUTO_MODE) && in ufshcd_is_hs_mode()
1127 (pwr_info->pwr_tx == FAST_MODE || in ufshcd_is_hs_mode()
1128 pwr_info->pwr_tx == FASTAUTO_MODE); in ufshcd_is_hs_mode()
1136 /* Expose Query-Request API */
1188 if (hba->vops) in ufshcd_get_var_name()
1189 return hba->vops->name; in ufshcd_get_var_name()
1195 if (hba->vops && hba->vops->init) in ufshcd_vops_init()
1196 return hba->vops->init(hba); in ufshcd_vops_init()
1203 if (hba->vops && hba->vops->exit) in ufshcd_vops_exit()
1204 return hba->vops->exit(hba); in ufshcd_vops_exit()
1209 if (hba->vops && hba->vops->get_ufs_hci_version) in ufshcd_vops_get_ufs_hci_version()
1210 return hba->vops->get_ufs_hci_version(hba); in ufshcd_vops_get_ufs_hci_version()
1218 if (hba->vops && hba->vops->clk_scale_notify) in ufshcd_vops_clk_scale_notify()
1219 return hba->vops->clk_scale_notify(hba, up, status); in ufshcd_vops_clk_scale_notify()
1227 if (hba->vops && hba->vops->event_notify) in ufshcd_vops_event_notify()
1228 hba->vops->event_notify(hba, evt, data); in ufshcd_vops_event_notify()
1234 if (hba->vops && hba->vops->setup_clocks) in ufshcd_vops_setup_clocks()
1235 return hba->vops->setup_clocks(hba, on, status); in ufshcd_vops_setup_clocks()
1242 if (hba->vops && hba->vops->hce_enable_notify) in ufshcd_vops_hce_enable_notify()
1243 return hba->vops->hce_enable_notify(hba, status); in ufshcd_vops_hce_enable_notify()
1250 if (hba->vops && hba->vops->link_startup_notify) in ufshcd_vops_link_startup_notify()
1251 return hba->vops->link_startup_notify(hba, status); in ufshcd_vops_link_startup_notify()
1258 if (hba->vops && hba->vops->phy_initialization) in ufshcd_vops_phy_initialization()
1259 return hba->vops->phy_initialization(hba); in ufshcd_vops_phy_initialization()
1269 if (hba->vops && hba->vops->pwr_change_notify) in ufshcd_vops_pwr_change_notify()
1270 return hba->vops->pwr_change_notify(hba, status, in ufshcd_vops_pwr_change_notify()
1273 return -ENOTSUPP; in ufshcd_vops_pwr_change_notify()
1279 if (hba->vops && hba->vops->setup_task_mgmt) in ufshcd_vops_setup_task_mgmt()
1280 return hba->vops->setup_task_mgmt(hba, tag, tm_function); in ufshcd_vops_setup_task_mgmt()
1287 if (hba->vops && hba->vops->hibern8_notify) in ufshcd_vops_hibern8_notify()
1288 return hba->vops->hibern8_notify(hba, cmd, status); in ufshcd_vops_hibern8_notify()
1293 if (hba->vops && hba->vops->apply_dev_quirks) in ufshcd_vops_apply_dev_quirks()
1294 return hba->vops->apply_dev_quirks(hba); in ufshcd_vops_apply_dev_quirks()
1300 if (hba->vops && hba->vops->fixup_dev_quirks) in ufshcd_vops_fixup_dev_quirks()
1301 hba->vops->fixup_dev_quirks(hba); in ufshcd_vops_fixup_dev_quirks()
1306 if (hba->vops && hba->vops->suspend) in ufshcd_vops_suspend()
1307 return hba->vops->suspend(hba, op); in ufshcd_vops_suspend()
1314 if (hba->vops && hba->vops->resume) in ufshcd_vops_resume()
1315 return hba->vops->resume(hba, op); in ufshcd_vops_resume()
1322 if (hba->vops && hba->vops->dbg_register_dump) in ufshcd_vops_dbg_register_dump()
1323 hba->vops->dbg_register_dump(hba); in ufshcd_vops_dbg_register_dump()
1328 if (hba->vops && hba->vops->device_reset) in ufshcd_vops_device_reset()
1329 return hba->vops->device_reset(hba); in ufshcd_vops_device_reset()
1331 return -EOPNOTSUPP; in ufshcd_vops_device_reset()
1338 if (hba->vops && hba->vops->config_scaling_param) in ufshcd_vops_config_scaling_param()
1339 hba->vops->config_scaling_param(hba, profile, data); in ufshcd_vops_config_scaling_param()
1345 * ufshcd_scsi_to_upiu_lun - maps scsi LUN to UPIU LUN
1370 return ufshcd_update_ee_control(hba, &hba->ee_drv_mask, in ufshcd_update_ee_drv_mask()
1371 &hba->ee_usr_mask, set, clr); in ufshcd_update_ee_drv_mask()
1377 return ufshcd_update_ee_control(hba, &hba->ee_usr_mask, in ufshcd_update_ee_usr_mask()
1378 &hba->ee_drv_mask, set, clr); in ufshcd_update_ee_usr_mask()
1383 return pm_runtime_get_sync(&hba->sdev_ufs_device->sdev_gendev); in ufshcd_rpm_get_sync()
1388 return pm_runtime_put_sync(&hba->sdev_ufs_device->sdev_gendev); in ufshcd_rpm_put_sync()
1393 return pm_runtime_put(&hba->sdev_ufs_device->sdev_gendev); in ufshcd_rpm_put()
1398 return pm_runtime_get_sync(&hba->sdev_rpmb->sdev_gendev); in ufshcd_rpmb_rpm_get_sync()
1403 return pm_runtime_put(&hba->sdev_rpmb->sdev_gendev); in ufshcd_rpmb_rpm_put()