2 * Universal Flash Storage Host controller driver
4 * This code is based on drivers/scsi/ufs/ufshcd.h
5 * Copyright (C) 2011-2013 Samsung India Software Operations
6 * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
9 * Santosh Yaraganavi <santosh.sy@samsung.com>
10 * Vinayak Holikatti <h.vinayak@samsung.com>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 * See the COPYING file in the top-level directory or visit
17 * <http://www.gnu.org/licenses/gpl-2.0.html>
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * This program is provided "AS IS" and "WITH ALL FAULTS" and
25 * without warranty of any kind. You are solely responsible for
26 * determining the appropriateness of using and distributing
27 * the program and assume all risks associated with your exercise
28 * of rights with respect to the program, including but not limited
29 * to infringement of third party rights, the risks and costs of
30 * program errors, damage to or loss of data, programs or equipment,
31 * and unavailability or interruption of operations. Under no
32 * circumstances will the contributor of this Program be liable for
33 * any damages of any kind arising from your use or distribution of
40 #include <linux/module.h>
41 #include <linux/kernel.h>
42 #include <linux/init.h>
43 #include <linux/interrupt.h>
45 #include <linux/delay.h>
46 #include <linux/slab.h>
47 #include <linux/spinlock.h>
48 #include <linux/workqueue.h>
49 #include <linux/errno.h>
50 #include <linux/types.h>
51 #include <linux/wait.h>
52 #include <linux/bitops.h>
53 #include <linux/pm_runtime.h>
54 #include <linux/clk.h>
55 #include <linux/completion.h>
56 #include <linux/regulator/consumer.h>
59 #include <asm/byteorder.h>
60 #include <scsi/scsi.h>
61 #include <scsi/scsi_cmnd.h>
62 #include <scsi/scsi_host.h>
63 #include <scsi/scsi_tcq.h>
64 #include <scsi/scsi_dbg.h>
65 #include <scsi/scsi_eh.h>
70 #define UFSHCD "ufshcd"
71 #define UFSHCD_DRIVER_VERSION "0.2"
76 DEV_CMD_TYPE_NOP = 0x0,
77 DEV_CMD_TYPE_QUERY = 0x1,
81 * struct uic_command - UIC command structure
82 * @command: UIC command
83 * @argument1: UIC command argument 1
84 * @argument2: UIC command argument 2
85 * @argument3: UIC command argument 3
86 * @cmd_active: Indicate if UIC command is outstanding
87 * @result: UIC command result
88 * @done: UIC command completion
97 struct completion done;
100 /* Used to differentiate the power management options */
107 #define ufshcd_is_runtime_pm(op) ((op) == UFS_RUNTIME_PM)
108 #define ufshcd_is_system_pm(op) ((op) == UFS_SYSTEM_PM)
109 #define ufshcd_is_shutdown_pm(op) ((op) == UFS_SHUTDOWN_PM)
111 /* Host <-> Device UniPro Link state */
112 enum uic_link_state {
113 UIC_LINK_OFF_STATE = 0, /* Link powered down or disabled */
114 UIC_LINK_ACTIVE_STATE = 1, /* Link is in Fast/Slow/Sleep state */
115 UIC_LINK_HIBERN8_STATE = 2, /* Link is in Hibernate state */
118 #define ufshcd_is_link_off(hba) ((hba)->uic_link_state == UIC_LINK_OFF_STATE)
119 #define ufshcd_is_link_active(hba) ((hba)->uic_link_state == \
120 UIC_LINK_ACTIVE_STATE)
121 #define ufshcd_is_link_hibern8(hba) ((hba)->uic_link_state == \
122 UIC_LINK_HIBERN8_STATE)
123 #define ufshcd_set_link_off(hba) ((hba)->uic_link_state = UIC_LINK_OFF_STATE)
124 #define ufshcd_set_link_active(hba) ((hba)->uic_link_state = \
125 UIC_LINK_ACTIVE_STATE)
126 #define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \
127 UIC_LINK_HIBERN8_STATE)
130 * UFS Power management levels.
131 * Each level is in increasing order of power savings.
134 UFS_PM_LVL_0, /* UFS_ACTIVE_PWR_MODE, UIC_LINK_ACTIVE_STATE */
135 UFS_PM_LVL_1, /* UFS_ACTIVE_PWR_MODE, UIC_LINK_HIBERN8_STATE */
136 UFS_PM_LVL_2, /* UFS_SLEEP_PWR_MODE, UIC_LINK_ACTIVE_STATE */
137 UFS_PM_LVL_3, /* UFS_SLEEP_PWR_MODE, UIC_LINK_HIBERN8_STATE */
138 UFS_PM_LVL_4, /* UFS_POWERDOWN_PWR_MODE, UIC_LINK_HIBERN8_STATE */
139 UFS_PM_LVL_5, /* UFS_POWERDOWN_PWR_MODE, UIC_LINK_OFF_STATE */
143 struct ufs_pm_lvl_states {
144 enum ufs_dev_pwr_mode dev_state;
145 enum uic_link_state link_state;
149 * struct ufshcd_lrb - local reference block
150 * @utr_descriptor_ptr: UTRD address of the command
151 * @ucd_req_ptr: UCD address of the command
152 * @ucd_rsp_ptr: Response UPIU address for this command
153 * @ucd_prdt_ptr: PRDT address of the command
154 * @cmd: pointer to SCSI command
155 * @sense_buffer: pointer to sense buffer address of the SCSI command
156 * @sense_bufflen: Length of the sense buffer
157 * @scsi_status: SCSI status of the command
158 * @command_type: SCSI, UFS, Query.
159 * @task_tag: Task tag of the command
160 * @lun: LUN of the command
161 * @intr_cmd: Interrupt command (doesn't participate in interrupt aggregation)
164 struct utp_transfer_req_desc *utr_descriptor_ptr;
165 struct utp_upiu_req *ucd_req_ptr;
166 struct utp_upiu_rsp *ucd_rsp_ptr;
167 struct ufshcd_sg_entry *ucd_prdt_ptr;
169 struct scsi_cmnd *cmd;
171 unsigned int sense_bufflen;
176 u8 lun; /* UPIU LUN id field is only 8-bit wide */
181 * struct ufs_query - holds relevant data structures for query request
182 * @request: request upiu and function
183 * @descriptor: buffer for sending/receiving descriptor
184 * @response: response upiu and response
187 struct ufs_query_req request;
189 struct ufs_query_res response;
193 * struct ufs_dev_cmd - all assosiated fields with device management commands
194 * @type: device management command type - Query, NOP OUT
195 * @lock: lock to allow one command at a time
196 * @complete: internal commands completion
197 * @tag_wq: wait queue until free command slot is available
200 enum dev_cmd_type type;
202 struct completion *complete;
203 wait_queue_head_t tag_wq;
204 struct ufs_query query;
208 * struct ufs_clk_info - UFS clock related info
209 * @list: list headed by hba->clk_list_head
212 * @max_freq: maximum frequency supported by the clock
213 * @min_freq: min frequency that can be used for clock scaling
214 * @curr_freq: indicates the current frequency that it is set to
215 * @enabled: variable to check against multiple enable/disable
217 struct ufs_clk_info {
218 struct list_head list;
227 enum ufs_notify_change_status {
232 struct ufs_pa_layer_attr {
242 struct ufs_pwr_mode_info {
244 struct ufs_pa_layer_attr info;
248 * struct ufs_hba_variant_ops - variant specific callbacks
249 * @name: variant name
250 * @init: called when the driver is initialized
251 * @exit: called to cleanup everything done in init
252 * @get_ufs_hci_version: called to get UFS HCI version
253 * @clk_scale_notify: notifies that clks are scaled up/down
254 * @setup_clocks: called before touching any of the controller registers
255 * @setup_regulators: called before accessing the host controller
256 * @hce_enable_notify: called before and after HCE enable bit is set to allow
257 * variant specific Uni-Pro initialization.
258 * @link_startup_notify: called before and after Link startup is carried out
259 * to allow variant specific Uni-Pro initialization.
260 * @pwr_change_notify: called before and after a power mode change
261 * is carried out to allow vendor spesific capabilities
263 * @suspend: called during host controller PM callback
264 * @resume: called during host controller PM callback
265 * @dbg_register_dump: used to dump controller debug information
267 struct ufs_hba_variant_ops {
269 int (*init)(struct ufs_hba *);
270 void (*exit)(struct ufs_hba *);
271 u32 (*get_ufs_hci_version)(struct ufs_hba *);
272 int (*clk_scale_notify)(struct ufs_hba *, bool,
273 enum ufs_notify_change_status);
274 int (*setup_clocks)(struct ufs_hba *, bool);
275 int (*setup_regulators)(struct ufs_hba *, bool);
276 int (*hce_enable_notify)(struct ufs_hba *,
277 enum ufs_notify_change_status);
278 int (*link_startup_notify)(struct ufs_hba *,
279 enum ufs_notify_change_status);
280 int (*pwr_change_notify)(struct ufs_hba *,
281 enum ufs_notify_change_status status,
282 struct ufs_pa_layer_attr *,
283 struct ufs_pa_layer_attr *);
284 int (*suspend)(struct ufs_hba *, enum ufs_pm_op);
285 int (*resume)(struct ufs_hba *, enum ufs_pm_op);
286 void (*dbg_register_dump)(struct ufs_hba *hba);
289 /* clock gating state */
290 enum clk_gating_state {
298 * struct ufs_clk_gating - UFS clock gating related info
299 * @gate_work: worker to turn off clocks after some delay as specified in
301 * @ungate_work: worker to turn on clocks that will be used in case of
303 * @state: the current clocks state
304 * @delay_ms: gating delay in ms
305 * @is_suspended: clk gating is suspended when set to 1 which can be used
306 * during suspend/resume
307 * @delay_attr: sysfs attribute to control delay_attr
308 * @active_reqs: number of requests that are pending and should be waited for
309 * completion before gating clocks.
311 struct ufs_clk_gating {
312 struct delayed_work gate_work;
313 struct work_struct ungate_work;
314 enum clk_gating_state state;
315 unsigned long delay_ms;
317 struct device_attribute delay_attr;
321 struct ufs_clk_scaling {
322 ktime_t busy_start_t;
323 bool is_busy_started;
324 unsigned long tot_busy_t;
325 unsigned long window_start_t;
329 * struct ufs_init_prefetch - contains data that is pre-fetched once during
331 * @icc_level: icc level which was read during initialization
333 struct ufs_init_prefetch {
338 * struct ufs_hba - per adapter private structure
339 * @mmio_base: UFSHCI base register address
340 * @ucdl_base_addr: UFS Command Descriptor base address
341 * @utrdl_base_addr: UTP Transfer Request Descriptor base address
342 * @utmrdl_base_addr: UTP Task Management Descriptor base address
343 * @ucdl_dma_addr: UFS Command Descriptor DMA address
344 * @utrdl_dma_addr: UTRDL DMA address
345 * @utmrdl_dma_addr: UTMRDL DMA address
346 * @host: Scsi_Host instance of the driver
347 * @dev: device handle
348 * @lrb: local reference block
349 * @lrb_in_use: lrb in use
350 * @outstanding_tasks: Bits representing outstanding task requests
351 * @outstanding_reqs: Bits representing outstanding transfer requests
352 * @capabilities: UFS Controller Capabilities
353 * @nutrs: Transfer Request Queue depth supported by controller
354 * @nutmrs: Task Management Queue depth supported by controller
355 * @ufs_version: UFS Version to which controller complies
356 * @vops: pointer to variant specific operations
357 * @priv: pointer to variant specific private data
358 * @irq: Irq number of the controller
359 * @active_uic_cmd: handle of active UIC command
360 * @uic_cmd_mutex: mutex for uic command
361 * @tm_wq: wait queue for task management
362 * @tm_tag_wq: wait queue for free task management slots
363 * @tm_slots_in_use: bit map of task management request slots in use
364 * @pwr_done: completion for power mode change
365 * @tm_condition: condition variable for task management
366 * @ufshcd_state: UFSHCD states
367 * @eh_flags: Error handling flags
368 * @intr_mask: Interrupt Mask Bits
369 * @ee_ctrl_mask: Exception event control mask
370 * @is_powered: flag to check if HBA is powered
371 * @is_init_prefetch: flag to check if data was pre-fetched in initialization
372 * @init_prefetch_data: data pre-fetched during initialization
373 * @eh_work: Worker to handle UFS errors that require s/w attention
374 * @eeh_work: Worker to handle exception events
375 * @errors: HBA errors
376 * @uic_error: UFS interconnect layer error status
377 * @saved_err: sticky error mask
378 * @saved_uic_err: sticky UIC error mask
379 * @dev_cmd: ufs device management command information
380 * @last_dme_cmd_tstamp: time stamp of the last completed DME command
381 * @auto_bkops_enabled: to track whether bkops is enabled in device
382 * @vreg_info: UFS device voltage regulator information
383 * @clk_list_head: UFS host controller clocks list node head
384 * @pwr_info: holds current power mode
385 * @max_pwr_info: keeps the device max valid pwm
388 void __iomem *mmio_base;
390 /* Virtual memory reference */
391 struct utp_transfer_cmd_desc *ucdl_base_addr;
392 struct utp_transfer_req_desc *utrdl_base_addr;
393 struct utp_task_req_desc *utmrdl_base_addr;
395 /* DMA memory reference */
396 dma_addr_t ucdl_dma_addr;
397 dma_addr_t utrdl_dma_addr;
398 dma_addr_t utmrdl_dma_addr;
400 struct Scsi_Host *host;
403 * This field is to keep a reference to "scsi_device" corresponding to
406 struct scsi_device *sdev_ufs_device;
408 enum ufs_dev_pwr_mode curr_dev_pwr_mode;
409 enum uic_link_state uic_link_state;
410 /* Desired UFS power management level during runtime PM */
411 enum ufs_pm_level rpm_lvl;
412 /* Desired UFS power management level during system PM */
413 enum ufs_pm_level spm_lvl;
414 int pm_op_in_progress;
416 struct ufshcd_lrb *lrb;
417 unsigned long lrb_in_use;
419 unsigned long outstanding_tasks;
420 unsigned long outstanding_reqs;
426 struct ufs_hba_variant_ops *vops;
431 /* Interrupt aggregation support is broken */
432 #define UFSHCD_QUIRK_BROKEN_INTR_AGGR UFS_BIT(0)
435 * delay before each dme command is required as the unipro
436 * layer has shown instabilities
438 #define UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS UFS_BIT(1)
441 * If UFS host controller is having issue in processing LCC (Line
442 * Control Command) coming from device then enable this quirk.
443 * When this quirk is enabled, host controller driver should disable
444 * the LCC transmission on UFS device (by clearing TX_LCC_ENABLE
445 * attribute of device to 0).
447 #define UFSHCD_QUIRK_BROKEN_LCC UFS_BIT(2)
450 * The attribute PA_RXHSUNTERMCAP specifies whether or not the
451 * inbound Link supports unterminated line in HS mode. Setting this
452 * attribute to 1 fixes moving to HS gear.
454 #define UFSHCD_QUIRK_BROKEN_PA_RXHSUNTERMCAP UFS_BIT(3)
457 * This quirk needs to be enabled if the host contoller only allows
458 * accessing the peer dme attributes in AUTO mode (FAST AUTO or
461 #define UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE UFS_BIT(4)
464 * This quirk needs to be enabled if the host contoller doesn't
465 * advertise the correct version in UFS_VER register. If this quirk
466 * is enabled, standard UFS host driver will call the vendor specific
467 * ops (get_ufs_hci_version) to get the correct version.
469 #define UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION UFS_BIT(5)
471 unsigned int quirks; /* Deviations from standard UFSHCI spec. */
473 wait_queue_head_t tm_wq;
474 wait_queue_head_t tm_tag_wq;
475 unsigned long tm_condition;
476 unsigned long tm_slots_in_use;
478 struct uic_command *active_uic_cmd;
479 struct mutex uic_cmd_mutex;
480 struct completion *uic_async_done;
487 bool is_init_prefetch;
488 struct ufs_init_prefetch init_prefetch_data;
491 struct work_struct eh_work;
492 struct work_struct eeh_work;
500 /* Device management request data */
501 struct ufs_dev_cmd dev_cmd;
502 ktime_t last_dme_cmd_tstamp;
504 /* Keeps information of the UFS device connected to this host */
505 struct ufs_dev_info dev_info;
506 bool auto_bkops_enabled;
507 struct ufs_vreg_info vreg_info;
508 struct list_head clk_list_head;
510 bool wlun_dev_clr_ua;
512 struct ufs_pa_layer_attr pwr_info;
513 struct ufs_pwr_mode_info max_pwr_info;
515 struct ufs_clk_gating clk_gating;
516 /* Control to enable/disable host capabilities */
518 /* Allow dynamic clk gating */
519 #define UFSHCD_CAP_CLK_GATING (1 << 0)
520 /* Allow hiberb8 with clk gating */
521 #define UFSHCD_CAP_HIBERN8_WITH_CLK_GATING (1 << 1)
522 /* Allow dynamic clk scaling */
523 #define UFSHCD_CAP_CLK_SCALING (1 << 2)
524 /* Allow auto bkops to enabled during runtime suspend */
525 #define UFSHCD_CAP_AUTO_BKOPS_SUSPEND (1 << 3)
527 * This capability allows host controller driver to use the UFS HCI's
528 * interrupt aggregation capability.
529 * CAUTION: Enabling this might reduce overall UFS throughput.
531 #define UFSHCD_CAP_INTR_AGGR (1 << 4)
533 struct devfreq *devfreq;
534 struct ufs_clk_scaling clk_scaling;
535 bool is_sys_suspended;
538 /* Returns true if clocks can be gated. Otherwise false */
539 static inline bool ufshcd_is_clkgating_allowed(struct ufs_hba *hba)
541 return hba->caps & UFSHCD_CAP_CLK_GATING;
543 static inline bool ufshcd_can_hibern8_during_gating(struct ufs_hba *hba)
545 return hba->caps & UFSHCD_CAP_HIBERN8_WITH_CLK_GATING;
547 static inline int ufshcd_is_clkscaling_enabled(struct ufs_hba *hba)
549 return hba->caps & UFSHCD_CAP_CLK_SCALING;
551 static inline bool ufshcd_can_autobkops_during_suspend(struct ufs_hba *hba)
553 return hba->caps & UFSHCD_CAP_AUTO_BKOPS_SUSPEND;
556 static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba)
558 if ((hba->caps & UFSHCD_CAP_INTR_AGGR) &&
559 !(hba->quirks & UFSHCD_QUIRK_BROKEN_INTR_AGGR))
565 #define ufshcd_writel(hba, val, reg) \
566 writel((val), (hba)->mmio_base + (reg))
567 #define ufshcd_readl(hba, reg) \
568 readl((hba)->mmio_base + (reg))
571 * ufshcd_rmwl - read modify write into a register
572 * @hba - per adapter instance
573 * @mask - mask to apply on read value
574 * @val - actual value to write
575 * @reg - register address
577 static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg)
581 tmp = ufshcd_readl(hba, reg);
584 ufshcd_writel(hba, tmp, reg);
587 int ufshcd_alloc_host(struct device *, struct ufs_hba **);
588 void ufshcd_dealloc_host(struct ufs_hba *);
589 int ufshcd_init(struct ufs_hba * , void __iomem * , unsigned int);
590 void ufshcd_remove(struct ufs_hba *);
593 * ufshcd_hba_stop - Send controller to reset state
594 * @hba: per adapter instance
596 static inline void ufshcd_hba_stop(struct ufs_hba *hba)
598 ufshcd_writel(hba, CONTROLLER_DISABLE, REG_CONTROLLER_ENABLE);
601 static inline void check_upiu_size(void)
603 BUILD_BUG_ON(ALIGNED_UPIU_SIZE <
604 GENERAL_UPIU_REQUEST_SIZE + QUERY_DESC_MAX_SIZE);
608 * ufshcd_set_variant - set variant specific data to the hba
609 * @hba - per adapter instance
610 * @variant - pointer to variant specific data
612 static inline void ufshcd_set_variant(struct ufs_hba *hba, void *variant)
619 * ufshcd_get_variant - get variant specific data from the hba
620 * @hba - per adapter instance
622 static inline void *ufshcd_get_variant(struct ufs_hba *hba)
628 extern int ufshcd_runtime_suspend(struct ufs_hba *hba);
629 extern int ufshcd_runtime_resume(struct ufs_hba *hba);
630 extern int ufshcd_runtime_idle(struct ufs_hba *hba);
631 extern int ufshcd_system_suspend(struct ufs_hba *hba);
632 extern int ufshcd_system_resume(struct ufs_hba *hba);
633 extern int ufshcd_shutdown(struct ufs_hba *hba);
634 extern int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel,
635 u8 attr_set, u32 mib_val, u8 peer);
636 extern int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
637 u32 *mib_val, u8 peer);
639 /* UIC command interfaces for DME primitives */
642 #define ATTR_SET_NOR 0 /* NORMAL */
643 #define ATTR_SET_ST 1 /* STATIC */
645 static inline int ufshcd_dme_set(struct ufs_hba *hba, u32 attr_sel,
648 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR,
652 static inline int ufshcd_dme_st_set(struct ufs_hba *hba, u32 attr_sel,
655 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST,
659 static inline int ufshcd_dme_peer_set(struct ufs_hba *hba, u32 attr_sel,
662 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_NOR,
666 static inline int ufshcd_dme_peer_st_set(struct ufs_hba *hba, u32 attr_sel,
669 return ufshcd_dme_set_attr(hba, attr_sel, ATTR_SET_ST,
673 static inline int ufshcd_dme_get(struct ufs_hba *hba,
674 u32 attr_sel, u32 *mib_val)
676 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_LOCAL);
679 static inline int ufshcd_dme_peer_get(struct ufs_hba *hba,
680 u32 attr_sel, u32 *mib_val)
682 return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_PEER);
685 /* Expose Query-Request API */
686 int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
687 enum flag_idn idn, bool *flag_res);
688 int ufshcd_hold(struct ufs_hba *hba, bool async);
689 void ufshcd_release(struct ufs_hba *hba);
691 /* Wrapper functions for safely calling variant operations */
692 static inline const char *ufshcd_get_var_name(struct ufs_hba *hba)
695 return hba->vops->name;
699 static inline int ufshcd_vops_init(struct ufs_hba *hba)
701 if (hba->vops && hba->vops->init)
702 return hba->vops->init(hba);
707 static inline void ufshcd_vops_exit(struct ufs_hba *hba)
709 if (hba->vops && hba->vops->exit)
710 return hba->vops->exit(hba);
713 static inline u32 ufshcd_vops_get_ufs_hci_version(struct ufs_hba *hba)
715 if (hba->vops && hba->vops->get_ufs_hci_version)
716 return hba->vops->get_ufs_hci_version(hba);
718 return ufshcd_readl(hba, REG_UFS_VERSION);
721 static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba,
722 bool up, enum ufs_notify_change_status status)
724 if (hba->vops && hba->vops->clk_scale_notify)
725 return hba->vops->clk_scale_notify(hba, up, status);
729 static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on)
731 if (hba->vops && hba->vops->setup_clocks)
732 return hba->vops->setup_clocks(hba, on);
736 static inline int ufshcd_vops_setup_regulators(struct ufs_hba *hba, bool status)
738 if (hba->vops && hba->vops->setup_regulators)
739 return hba->vops->setup_regulators(hba, status);
744 static inline int ufshcd_vops_hce_enable_notify(struct ufs_hba *hba,
747 if (hba->vops && hba->vops->hce_enable_notify)
748 return hba->vops->hce_enable_notify(hba, status);
752 static inline int ufshcd_vops_link_startup_notify(struct ufs_hba *hba,
755 if (hba->vops && hba->vops->link_startup_notify)
756 return hba->vops->link_startup_notify(hba, status);
761 static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
763 struct ufs_pa_layer_attr *dev_max_params,
764 struct ufs_pa_layer_attr *dev_req_params)
766 if (hba->vops && hba->vops->pwr_change_notify)
767 return hba->vops->pwr_change_notify(hba, status,
768 dev_max_params, dev_req_params);
773 static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op)
775 if (hba->vops && hba->vops->suspend)
776 return hba->vops->suspend(hba, op);
781 static inline int ufshcd_vops_resume(struct ufs_hba *hba, enum ufs_pm_op op)
783 if (hba->vops && hba->vops->resume)
784 return hba->vops->resume(hba, op);
789 static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
791 if (hba->vops && hba->vops->dbg_register_dump)
792 hba->vops->dbg_register_dump(hba);
795 #endif /* End of Header */