diff options
Diffstat (limited to 'drivers/scsi/ufs/ufshcd.h')
| -rw-r--r-- | drivers/scsi/ufs/ufshcd.h | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index e3931d0c94eb..4bb65669f052 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | #include <linux/clk.h> | 54 | #include <linux/clk.h> |
| 55 | #include <linux/completion.h> | 55 | #include <linux/completion.h> |
| 56 | #include <linux/regulator/consumer.h> | 56 | #include <linux/regulator/consumer.h> |
| 57 | #include "unipro.h" | ||
| 57 | 58 | ||
| 58 | #include <asm/irq.h> | 59 | #include <asm/irq.h> |
| 59 | #include <asm/byteorder.h> | 60 | #include <asm/byteorder.h> |
| @@ -383,6 +384,9 @@ struct ufs_init_prefetch { | |||
| 383 | * @clk_list_head: UFS host controller clocks list node head | 384 | * @clk_list_head: UFS host controller clocks list node head |
| 384 | * @pwr_info: holds current power mode | 385 | * @pwr_info: holds current power mode |
| 385 | * @max_pwr_info: keeps the device max valid pwm | 386 | * @max_pwr_info: keeps the device max valid pwm |
| 387 | * @urgent_bkops_lvl: keeps track of urgent bkops level for device | ||
| 388 | * @is_urgent_bkops_lvl_checked: keeps track if the urgent bkops level for | ||
| 389 | * device is known or not. | ||
| 386 | */ | 390 | */ |
| 387 | struct ufs_hba { | 391 | struct ufs_hba { |
| 388 | void __iomem *mmio_base; | 392 | void __iomem *mmio_base; |
| @@ -470,6 +474,9 @@ struct ufs_hba { | |||
| 470 | 474 | ||
| 471 | unsigned int quirks; /* Deviations from standard UFSHCI spec. */ | 475 | unsigned int quirks; /* Deviations from standard UFSHCI spec. */ |
| 472 | 476 | ||
| 477 | /* Device deviations from standard UFS device spec. */ | ||
| 478 | unsigned int dev_quirks; | ||
| 479 | |||
| 473 | wait_queue_head_t tm_wq; | 480 | wait_queue_head_t tm_wq; |
| 474 | wait_queue_head_t tm_tag_wq; | 481 | wait_queue_head_t tm_tag_wq; |
| 475 | unsigned long tm_condition; | 482 | unsigned long tm_condition; |
| @@ -509,6 +516,8 @@ struct ufs_hba { | |||
| 509 | 516 | ||
| 510 | bool wlun_dev_clr_ua; | 517 | bool wlun_dev_clr_ua; |
| 511 | 518 | ||
| 519 | /* Number of lanes available (1 or 2) for Rx/Tx */ | ||
| 520 | u32 lanes_per_direction; | ||
| 512 | struct ufs_pa_layer_attr pwr_info; | 521 | struct ufs_pa_layer_attr pwr_info; |
| 513 | struct ufs_pwr_mode_info max_pwr_info; | 522 | struct ufs_pwr_mode_info max_pwr_info; |
| 514 | 523 | ||
| @@ -533,6 +542,9 @@ struct ufs_hba { | |||
| 533 | struct devfreq *devfreq; | 542 | struct devfreq *devfreq; |
| 534 | struct ufs_clk_scaling clk_scaling; | 543 | struct ufs_clk_scaling clk_scaling; |
| 535 | bool is_sys_suspended; | 544 | bool is_sys_suspended; |
| 545 | |||
| 546 | enum bkops_status urgent_bkops_lvl; | ||
| 547 | bool is_urgent_bkops_lvl_checked; | ||
| 536 | }; | 548 | }; |
| 537 | 549 | ||
| 538 | /* Returns true if clocks can be gated. Otherwise false */ | 550 | /* Returns true if clocks can be gated. Otherwise false */ |
| @@ -588,15 +600,9 @@ int ufshcd_alloc_host(struct device *, struct ufs_hba **); | |||
| 588 | void ufshcd_dealloc_host(struct ufs_hba *); | 600 | void ufshcd_dealloc_host(struct ufs_hba *); |
| 589 | int ufshcd_init(struct ufs_hba * , void __iomem * , unsigned int); | 601 | int ufshcd_init(struct ufs_hba * , void __iomem * , unsigned int); |
| 590 | void ufshcd_remove(struct ufs_hba *); | 602 | void ufshcd_remove(struct ufs_hba *); |
| 591 | 603 | int ufshcd_wait_for_register(struct ufs_hba *hba, u32 reg, u32 mask, | |
| 592 | /** | 604 | u32 val, unsigned long interval_us, |
| 593 | * ufshcd_hba_stop - Send controller to reset state | 605 | unsigned long timeout_ms, bool can_sleep); |
| 594 | * @hba: per adapter instance | ||
| 595 | */ | ||
| 596 | static inline void ufshcd_hba_stop(struct ufs_hba *hba) | ||
| 597 | { | ||
| 598 | ufshcd_writel(hba, CONTROLLER_DISABLE, REG_CONTROLLER_ENABLE); | ||
| 599 | } | ||
| 600 | 606 | ||
| 601 | static inline void check_upiu_size(void) | 607 | static inline void check_upiu_size(void) |
| 602 | { | 608 | { |
| @@ -682,11 +688,27 @@ static inline int ufshcd_dme_peer_get(struct ufs_hba *hba, | |||
| 682 | return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_PEER); | 688 | return ufshcd_dme_get_attr(hba, attr_sel, mib_val, DME_PEER); |
| 683 | } | 689 | } |
| 684 | 690 | ||
| 691 | int ufshcd_read_device_desc(struct ufs_hba *hba, u8 *buf, u32 size); | ||
| 692 | |||
| 693 | static inline bool ufshcd_is_hs_mode(struct ufs_pa_layer_attr *pwr_info) | ||
| 694 | { | ||
| 695 | return (pwr_info->pwr_rx == FAST_MODE || | ||
| 696 | pwr_info->pwr_rx == FASTAUTO_MODE) && | ||
| 697 | (pwr_info->pwr_tx == FAST_MODE || | ||
| 698 | pwr_info->pwr_tx == FASTAUTO_MODE); | ||
| 699 | } | ||
| 700 | |||
| 701 | #define ASCII_STD true | ||
| 702 | |||
| 703 | int ufshcd_read_string_desc(struct ufs_hba *hba, int desc_index, u8 *buf, | ||
| 704 | u32 size, bool ascii); | ||
| 705 | |||
| 685 | /* Expose Query-Request API */ | 706 | /* Expose Query-Request API */ |
| 686 | int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, | 707 | int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, |
| 687 | enum flag_idn idn, bool *flag_res); | 708 | enum flag_idn idn, bool *flag_res); |
| 688 | int ufshcd_hold(struct ufs_hba *hba, bool async); | 709 | int ufshcd_hold(struct ufs_hba *hba, bool async); |
| 689 | void ufshcd_release(struct ufs_hba *hba); | 710 | void ufshcd_release(struct ufs_hba *hba); |
| 711 | u32 ufshcd_get_local_unipro_ver(struct ufs_hba *hba); | ||
| 690 | 712 | ||
| 691 | /* Wrapper functions for safely calling variant operations */ | 713 | /* Wrapper functions for safely calling variant operations */ |
| 692 | static inline const char *ufshcd_get_var_name(struct ufs_hba *hba) | 714 | static inline const char *ufshcd_get_var_name(struct ufs_hba *hba) |
