Lines Matching +full:rtt +full:- +full:rtc +full:- +full:time +full:- +full:reg

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
170 * @issue_time_stamp: time stamp for debug purposes (CLOCK_MONOTONIC)
171 * @issue_time_stamp_local_clock: time stamp for debug purposes (local_clock)
172 * @compl_time_stamp: time stamp for statistics (CLOCK_MONOTONIC)
173 * @compl_time_stamp_local_clock: time stamp for debug purposes (local_clock)
174 * @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 */
209 * struct ufs_query_req - parameters for building a query request
219 * struct ufs_query_resp - UPIU QUERY
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
242 * @lock: lock to allow one command at a time
254 * struct ufs_clk_info - UFS clock related info
255 * @list: list headed by hba->clk_list_head
297 * struct ufs_hba_variant_ops - variant specific callbacks
299 * @max_num_rtt: maximum RTT supported by the host
308 * variant specific Uni-Pro initialization.
310 * to allow variant specific Uni-Pro initialization.
329 * @fill_crypto_prdt: initialize crypto-related fields in the PRDT
400 * struct ufs_clk_gating - UFS clock gating related info
437 * struct ufs_clk_scaling - UFS clock scaling related data
443 * devfreq ->target() function is called then schedule "suspend_work" to
445 * @tot_busy_t: Total busy time in current polling window
446 * @window_start_t: Start time (in jiffies) of the current polling window
447 * @busy_start_t: Start time of current busy period
489 * struct ufs_event_hist - keeps history of errors
492 * @tstamp: cyclic buffer for time stamp
503 * struct ufs_stats - keeps usage/err statistics
505 * reset this after link-startup.
506 * @last_hibern8_exit_tstamp: Set time after the hibern8 exit.
517 * enum ufshcd_state - UFS host controller state
609 * auto-hibernate capability but it doesn't work.
638 * auto-hibernate capability but it's FASTAUTO only.
656 * Some host does not implement SQ Run Time Command (SQRTC) register
715 * This capability allows the device auto-bkops to be always enabled
731 * This capability allows the host controller driver to turn-on
753 * support device hardware reset via the hba->device_reset() callback,
798 * struct ufshcd_res_info_t - MCQ related resource regions
822 * struct ufshcd_mcq_opr_info_t - Operation and Runtime registers
843 * struct ufs_hba - per adapter private structure
860 * @ahit: value of Auto-Hibernate Idle Timer register.
868 * @nortt - Max outstanding RTTs supported by controller
910 * @last_dme_cmd_tstamp: time stamp of the last completed DME command
963 * @ufs_rtc_update_work: A work for UFS RTC periodic update
1000 /* Auto-Hibernate Idle Timer register value */
1146 * struct ufs_hw_queue - per hardware queue structure
1190 return hba->mcq_opr[opr].offset + hba->mcq_opr[opr].stride * idx;
1193 static inline unsigned int ufshcd_mcq_cfg_offset(unsigned int reg, int idx)
1195 return reg + MCQ_QCFG_SIZE * idx;
1201 return hba->sg_entry_size;
1207 hba->sg_entry_size = sg_entry_size;
1235 return hba->caps & UFSHCD_CAP_CLK_GATING;
1239 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING;
1243 return hba->caps & UFSHCD_CAP_CLK_SCALING;
1247 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND;
1251 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND;
1256 return (hba->caps & UFSHCD_CAP_INTR_AGGR) &&
1257 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR);
1263 (hba->caps & UFSHCD_CAP_AGGR_POWER_COLLAPSE));
1268 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) &&
1269 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8);
1274 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit);
1279 return hba->caps & UFSHCD_CAP_WB_EN;
1284 return hba->caps & UFSHCD_CAP_WB_WITH_CLK_SCALING;
1287 #define ufsmcq_writel(hba, val, reg) \
1288 writel((val), (hba)->mcq_base + (reg))
1289 #define ufsmcq_readl(hba, reg) \
1290 readl((hba)->mcq_base + (reg))
1292 #define ufsmcq_writelx(hba, val, reg) \
1293 writel_relaxed((val), (hba)->mcq_base + (reg))
1294 #define ufsmcq_readlx(hba, reg) \
1295 readl_relaxed((hba)->mcq_base + (reg))
1297 #define ufshcd_writel(hba, val, reg) \
1298 writel((val), (hba)->mmio_base + (reg))
1299 #define ufshcd_readl(hba, reg) \
1300 readl((hba)->mmio_base + (reg))
1303 * ufshcd_rmwl - perform read/modify/write for a controller register
1307 * @reg: register address
1309 static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg)
1313 tmp = ufshcd_readl(hba, reg);
1316 ufshcd_writel(hba, tmp, reg);
1349 * ufshcd_set_variant - set variant specific data to the hba
1356 hba->priv = variant;
1360 * ufshcd_get_variant - get variant specific data from the hba
1366 return hba->priv;
1442 return (pwr_info->pwr_rx == FAST_MODE ||
1443 pwr_info->pwr_rx == FASTAUTO_MODE) &&
1444 (pwr_info->pwr_tx == FAST_MODE ||
1445 pwr_info->pwr_tx == FASTAUTO_MODE);
1488 if (hba->vops && hba->vops->init)
1489 return hba->vops->init(hba);
1496 if (hba->vops && hba->vops->phy_initialization)
1497 return hba->vops->phy_initialization(hba);