Lines Matching +full:controller +full:- +full:specific
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>
43 /* uic specific errors */
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
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
305 * @setup_clocks: called before touching any of the controller registers
307 * variant specific Uni-Pro initialization.
309 * to allow variant specific Uni-Pro initialization.
320 * @apply_dev_quirks: called to apply device specific quirks
321 * @fixup_dev_quirks: called to modify device specific quirks
322 * @suspend: called during host controller PM callback
323 * @resume: called during host controller PM callback
324 * @dbg_register_dump: used to dump controller debug information
328 * @fill_crypto_prdt: initialize crypto-related fields in the PRDT
332 * the controller. Should be implemented for UFSHCI 4.0 or later
336 * @config_esi: called to config Event Specific Interrupt
399 * struct ufs_clk_gating - UFS clock gating related info
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
519 * @UFSHCD_STATE_OPERATIONAL: The host controller is operational and can process
522 * SCSI commands may be submitted to the controller.
547 * If UFS host controller is having issue in processing LCC (Line
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
572 * is enabled, standard UFS host driver will call the vendor specific
583 * This quirk needs to be enabled if host controller doesn't allow
589 * This quirks needs to be enabled if host controller cannot be
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.
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
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
672 * host controller initialization fails if that bit is set.
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
687 * Controller Capabilities register although it supports the legacy
707 * This capability allows host controller driver to use the UFS HCI's
714 * This capability allows the device auto-bkops to be always enabled
723 * This capability allows host controller driver to automatically
730 * This capability allows the host controller driver to turn-on
737 * This capability allows the host controller driver to use the
743 * This capability allows the controller regulators to be put into
750 * This capability allows the host controller driver to use DeepSleep,
751 * if it is supported by the UFS device. The host controller driver must
752 * support device hardware reset via the hba->device_reset() callback,
758 * This capability allows the host controller driver to use temperature
797 * struct ufshcd_mcq_opr_info_t - Operation and Runtime registers
818 * struct ufs_hba - per adapter private structure
835 * @ahit: value of Auto-Hibernate Idle Timer register.
840 * @capabilities: UFS Controller Capabilities
842 * @nutrs: Transfer Request Queue depth supported by controller
843 * @nortt - Max outstanding RTTs supported by controller
844 * @nutmrs: Task Management Queue depth supported by controller
846 * @ufs_version: UFS Version to which controller complies
847 * @vops: pointer to variant specific operations
848 * @vps: pointer to variant specific parameters
849 * @priv: pointer to variant specific private data
851 * @irq: Irq number of the controller
852 * @is_irq_enabled: whether or not the UFS controller interrupt is enabled.
890 * @clk_list_head: UFS host controller clocks list node head
894 * controller and the UFS device.
898 * @caps: bitmask with information about UFS controller capabilities
911 * @bsg_queue: BSG queue associated with the UFS controller
920 * @debugfs_root: UFS controller debugfs root directory
944 * @dev_lvl_exception_id: vendor specific information about the
976 /* Auto-Hibernate Idle Timer register value */
1123 * struct ufs_hw_queue - per hardware queue structure
1167 return hba->mcq_opr[opr].offset + hba->mcq_opr[opr].stride * idx;
1178 return hba->sg_entry_size;
1184 hba->sg_entry_size = sg_entry_size;
1212 return hba->caps & UFSHCD_CAP_CLK_GATING;
1216 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING;
1220 return hba->caps & UFSHCD_CAP_CLK_SCALING;
1224 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND;
1228 return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND;
1233 return (hba->caps & UFSHCD_CAP_INTR_AGGR) &&
1234 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR);
1240 (hba->caps & UFSHCD_CAP_AGGR_POWER_COLLAPSE));
1245 return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) &&
1246 !(hba->quirks & UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8);
1251 return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit);
1256 return hba->caps & UFSHCD_CAP_WB_EN;
1261 return hba->caps & UFSHCD_CAP_WB_WITH_CLK_SCALING;
1265 writel((val), (hba)->mcq_base + (reg))
1267 readl((hba)->mcq_base + (reg))
1270 writel_relaxed((val), (hba)->mcq_base + (reg))
1272 readl_relaxed((hba)->mcq_base + (reg))
1275 writel((val), (hba)->mmio_base + (reg))
1277 readl((hba)->mmio_base + (reg))
1280 * ufshcd_rmwl - perform read/modify/write for a controller register
1327 * ufshcd_set_variant - set variant specific data to the hba
1329 * @variant: pointer to variant specific data
1334 hba->priv = variant;
1338 * ufshcd_get_variant - get variant specific data from the hba
1344 return hba->priv;
1420 return (pwr_info->pwr_rx == FAST_MODE ||
1421 pwr_info->pwr_rx == FASTAUTO_MODE) &&
1422 (pwr_info->pwr_tx == FAST_MODE ||
1423 pwr_info->pwr_tx == FASTAUTO_MODE);
1466 if (hba->vops && hba->vops->init)
1467 return hba->vops->init(hba);
1474 if (hba->vops && hba->vops->phy_initialization)
1475 return hba->vops->phy_initialization(hba);