Lines Matching +full:host +full:- +full:command

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Universal Flash Storage Host controller driver
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
69 * @command: UIC command
70 * @argument1: UIC command argument 1
71 * @argument2: UIC command argument 2
72 * @argument3: UIC command argument 3
73 * @cmd_active: Indicate if UIC command is outstanding
74 * @done: UIC command completion
77 const u32 command;
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
156 * @utr_descriptor_ptr: UTRD address of the command
157 * @ucd_req_ptr: UCD address of the command
158 * @ucd_rsp_ptr: Response UPIU address for this command
159 * @ucd_prdt_ptr: PRDT address of the command
164 * @cmd: pointer to SCSI command
165 * @scsi_status: SCSI status of the command
167 * @task_tag: Task tag of the command
168 * @lun: LUN of the command
169 * @intr_cmd: Interrupt command (doesn't participate in interrupt aggregation)
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.
323 * @suspend: called during host controller PM callback
324 * @resume: called during host controller PM callback
329 * @fill_crypto_prdt: initialize crypto-related fields in the PRDT
400 * struct ufs_clk_gating - UFS clock gating related info
407 * relative to the host lock
437 * struct ufs_clk_scaling - UFS clock scaling related data
443 * devfreq ->target() function is called then schedule "suspend_work" to
489 * struct ufs_event_hist - keeps history of errors
503 * struct ufs_stats - keeps usage/err statistics
505 * reset this after link-startup.
507 * Clear after the first successful command completion.
517 * enum ufshcd_state - UFS host controller state
518 * @UFSHCD_STATE_RESET: Link is not operational. Postpone SCSI command
520 * @UFSHCD_STATE_OPERATIONAL: The host controller is operational and can process
542 * delay before each dme command is required as the unipro
548 * If UFS host controller is having issue in processing LCC (Line
549 * Control Command) coming from device then enable this quirk.
550 * When this quirk is enabled, host controller driver should disable
564 * This quirk needs to be enabled if the host controller only allows
571 * This quirk needs to be enabled if the host controller doesn't
573 * is enabled, standard UFS host driver will call the vendor specific
584 * This quirk needs to be enabled if host controller doesn't allow
590 * This quirks needs to be enabled if host controller cannot be
596 * This quirk needs to be enabled if the host controller regards
602 * This quirk needs to be enabled if the host controller reports
608 * This quirk needs to be enabled if the host controller has
609 * auto-hibernate capability but it doesn't work.
625 * This quirk needs to be enabled if the host controller does not
626 * support UIC command
631 * This quirk needs to be enabled if the host controller cannot
632 * support physical host configuration.
637 * This quirk needs to be enabled if the host controller has
638 * auto-hibernate capability but it's FASTAUTO only.
643 * This quirk needs to be enabled if the host controller needs
649 * Some host raises interrupt (per queue) in addition to
656 * Some host does not implement SQ Run Time Command (SQRTC) register
662 * This quirk needs to be enabled if the host controller supports inline
671 * This quirk needs to be enabled if the host controller supports inline
673 * host controller initialization fails if that bit is set.
678 * This quirk needs to be enabled if the host controller driver copies
708 * This capability allows host controller driver to use the UFS HCI's
715 * This capability allows the device auto-bkops to be always enabled
724 * This capability allows host controller driver to automatically
731 * This capability allows the host controller driver to turn-on
738 * This capability allows the host controller driver to use the
751 * This capability allows the host controller driver to use DeepSleep,
752 * if it is supported by the UFS device. The host controller driver must
753 * support device hardware reset via the hba->device_reset() callback,
759 * This capability allows the host controller driver to use temperature
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
845 * @ucdl_base_addr: UFS Command Descriptor base address
848 * @ucdl_dma_addr: UFS Command Descriptor DMA address
851 * @host: Scsi_Host instance of the driver
860 * @ahit: value of Auto-Hibernate Idle Timer register.
868 * @nortt - Max outstanding RTTs supported by controller
884 * @active_uic_cmd: pointer to active UIC command.
885 * @uic_cmd_mutex: mutex used for serializing UIC command processing.
909 * @dev_cmd: ufs device management command information
910 * @last_dme_cmd_tstamp: time stamp of the last completed DME command
915 * @clk_list_head: UFS host controller clocks list node head
984 struct Scsi_Host *host;
1000 /* Auto-Hibernate Idle Timer register value */
1070 /* Keeps information of the UFS device connected to this host */
1086 /* Control to enable/disable host capabilities */
1146 * struct ufs_hw_queue - per hardware queue structure
1190 return hba->mcq_opr[opr].offset + hba->mcq_opr[opr].stride * 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;
1288 writel((val), (hba)->mcq_base + (reg))
1290 readl((hba)->mcq_base + (reg))
1293 writel_relaxed((val), (hba)->mcq_base + (reg))
1295 readl_relaxed((hba)->mcq_base + (reg))
1298 writel((val), (hba)->mmio_base + (reg))
1300 readl((hba)->mmio_base + (reg))
1303 * ufshcd_rmwl - perform read/modify/write for a controller register
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;
1394 /* UIC command interfaces for DME primitives */
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);