Lines Matching +full:irq +full:- +full:status +full:- +full:read +full:- +full:quirk

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.
16 #include <linux/blk-crypto-profile.h>
17 #include <linux/blk-mq.h>
19 #include <linux/fault-inject.h>
23 #include <linux/dma-direction.h>
68 * struct uic_command - UIC command structure
92 /* Host <-> Device UniPro Link state */
100 #define ufshcd_is_link_off(hba) ((hba)->uic_link_state == UIC_LINK_OFF_STATE)
101 #define ufshcd_is_link_active(hba) ((hba)->uic_link_state == \
103 #define ufshcd_is_link_hibern8(hba) ((hba)->uic_link_state == \
105 #define ufshcd_is_link_broken(hba) ((hba)->uic_link_state == \
107 #define ufshcd_set_link_off(hba) ((hba)->uic_link_state = UIC_LINK_OFF_STATE)
108 #define ufshcd_set_link_active(hba) ((hba)->uic_link_state = \
110 #define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \
112 #define ufshcd_set_link_broken(hba) ((hba)->uic_link_state = \
116 ((h)->curr_dev_pwr_mode = UFS_ACTIVE_PWR_MODE)
118 ((h)->curr_dev_pwr_mode = UFS_SLEEP_PWR_MODE)
120 ((h)->curr_dev_pwr_mode = UFS_POWERDOWN_PWR_MODE)
122 ((h)->curr_dev_pwr_mode = UFS_DEEPSLEEP_PWR_MODE)
124 ((h)->curr_dev_pwr_mode == UFS_ACTIVE_PWR_MODE)
126 ((h)->curr_dev_pwr_mode == UFS_SLEEP_PWR_MODE)
128 ((h)->curr_dev_pwr_mode == UFS_POWERDOWN_PWR_MODE)
130 ((h)->curr_dev_pwr_mode == UFS_DEEPSLEEP_PWR_MODE)
155 * struct ufshcd_lrb - local reference block
165 * @scsi_status: SCSI status of the command
175 * @crypto_key_slot: the key slot to use for inline crypto (-1 if none)
194 u8 lun; /* UPIU LUN id field is only 8-bit wide */
208 * struct ufs_query_req - parameters for building a query request
218 * struct ufs_query_resp - UPIU QUERY
227 * struct ufs_query - holds relevant data structures for query request
239 * struct ufs_dev_cmd - all assosiated fields with device management commands
240 * @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
307 * variant specific Uni-Pro initialization.
309 * to allow variant specific Uni-Pro initialization.
328 * @fill_crypto_prdt: initialize crypto-related fields in the PRDT
356 enum ufs_notify_change_status status,
399 * struct ufs_clk_gating - UFS clock gating related info
413 * @is_enabled: Indicates the current status of clock gating
436 * struct ufs_clk_scaling - UFS clock scaling related data
442 * devfreq ->target() function is called then schedule "suspend_work" to
488 * struct ufs_event_hist - keeps history of errors
502 * struct ufs_stats - keeps usage/err statistics
504 * reset this after link-startup.
516 * enum ufshcd_state - UFS host controller state
548 * Control Command) coming from device then enable this quirk.
549 * When this quirk is enabled, host controller driver should disable
563 * This quirk needs to be enabled if the host controller only allows
570 * This quirk needs to be enabled if the host controller doesn't
571 * advertise the correct version in UFS_VER register. If this quirk
583 * This quirk needs to be enabled if host controller doesn't allow
595 * This quirk needs to be enabled if the host controller regards
601 * This quirk needs to be enabled if the host controller reports
607 * This quirk needs to be enabled if the host controller has
608 * auto-hibernate capability but it doesn't work.
613 * This quirk needs to disable manual flush for write booster
618 * This quirk needs to disable unipro timeout values
624 * This quirk needs to be enabled if the host controller does not
630 * This quirk needs to be enabled if the host controller cannot
636 * This quirk needs to be enabled if the host controller has
637 * auto-hibernate capability but it's FASTAUTO only.
642 * This quirk needs to be enabled if the host controller needs
650 * Enable this quirk will disable CQES and use per queue interrupt.
656 * thus need this quirk to skip related flow.
661 * This quirk needs to be enabled if the host controller supports inline
670 * This quirk needs to be enabled if the host controller supports inline
677 * This quirk needs to be enabled if the host controller driver copies
685 * This quirk indicates that the controller reports the value 1 (not
693 * This quirk indicates that DME_LINKSTARTUP should not be issued a 2nd
721 * This capability allows the device auto-bkops to be always enabled
725 * the performance of ongoing read/write operations.
737 * This capability allows the host controller driver to turn-on
759 * support device hardware reset via the hba->device_reset() callback,
804 * struct ufshcd_mcq_opr_info_t - Operation and Runtime registers
825 * struct ufs_hba - per adapter private structure
842 * @ahit: value of Auto-Hibernate Idle Timer register.
850 * @nortt - Max outstanding RTTs supported by controller
858 * @irq: Irq number of the controller
884 * @uic_error: UFS interconnect layer error status
948 * @pm_qos_mutex: synchronizes PM QoS request and status updates
983 /* Auto-Hibernate Idle Timer register value */
1005 unsigned int irq; member
1121 /* synchronizes PM QoS request and status updates */
1130 * struct ufs_hw_queue - per hardware queue structure
1174 return hba->mcq_opr[opr].offset + hba->mcq_opr[opr].stride * idx; in ufshcd_mcq_opr_offset()
1185 return hba->sg_entry_size; in ufshcd_sg_entry_size()
1191 hba->sg_entry_size = sg_entry_size; in ufshcd_set_sg_entry_size()
1219 return hba->caps & UFSHCD_CAP_CLK_GATING; in ufshcd_is_clkgating_allowed()
1223 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING; in ufshcd_can_hibern8_during_gating()
1227 return hba->caps & UFSHCD_CAP_CLK_SCALING; in ufshcd_is_clkscaling_supported()
1231 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND; in ufshcd_can_autobkops_during_suspend()
1235 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND; in ufshcd_is_rpm_autosuspend_allowed()
1240 return (hba->caps & UFSHCD_CAP_INTR_AGGR) && in ufshcd_is_intr_aggr_allowed()
1241 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR); in ufshcd_is_intr_aggr_allowed()
1247 (hba->caps & UFSHCD_CAP_AGGR_POWER_COLLAPSE)); in ufshcd_can_aggressive_pc()
1252 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) && in ufshcd_is_auto_hibern8_supported()
1253 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8); in ufshcd_is_auto_hibern8_supported()
1258 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit); in ufshcd_is_auto_hibern8_enabled()
1263 return hba->caps & UFSHCD_CAP_WB_EN; in ufshcd_is_wb_allowed()
1268 return hba->caps & UFSHCD_CAP_WB_WITH_CLK_SCALING; in ufshcd_enable_wb_if_scaling_up()
1272 writel((val), (hba)->mcq_base + (reg))
1274 readl((hba)->mcq_base + (reg))
1277 writel_relaxed((val), (hba)->mcq_base + (reg))
1279 readl_relaxed((hba)->mcq_base + (reg))
1282 writel((val), (hba)->mmio_base + (reg))
1284 readl((hba)->mmio_base + (reg))
1287 * ufshcd_rmwl - perform read/modify/write for a controller register
1289 * @mask: mask to apply on read value
1334 * ufshcd_set_variant - set variant specific data to the hba
1341 hba->priv = variant; in ufshcd_set_variant()
1345 * ufshcd_get_variant - get variant specific data from the hba
1351 return hba->priv; in ufshcd_get_variant()
1427 return (pwr_info->pwr_rx == FAST_MODE || in ufshcd_is_hs_mode()
1428 pwr_info->pwr_rx == FASTAUTO_MODE) && in ufshcd_is_hs_mode()
1429 (pwr_info->pwr_tx == FAST_MODE || in ufshcd_is_hs_mode()
1430 pwr_info->pwr_tx == FASTAUTO_MODE); in ufshcd_is_hs_mode()
1473 if (hba->vops && hba->vops->init) in ufshcd_vops_init()
1474 return hba->vops->init(hba); in ufshcd_vops_init()
1481 if (hba->vops && hba->vops->phy_initialization) in ufshcd_vops_phy_initialization()
1482 return hba->vops->phy_initialization(hba); in ufshcd_vops_phy_initialization()