diff options
| -rw-r--r-- | drivers/scsi/ufs/ufs-sysfs.c | 6 | ||||
| -rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 4 | ||||
| -rw-r--r-- | drivers/scsi/ufs/ufshcd.h | 5 |
3 files changed, 10 insertions, 5 deletions
diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index 8d9332bb7d0c..f478685122ff 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c | |||
| @@ -122,7 +122,7 @@ static void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit) | |||
| 122 | { | 122 | { |
| 123 | unsigned long flags; | 123 | unsigned long flags; |
| 124 | 124 | ||
| 125 | if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT)) | 125 | if (!ufshcd_is_auto_hibern8_supported(hba)) |
| 126 | return; | 126 | return; |
| 127 | 127 | ||
| 128 | spin_lock_irqsave(hba->host->host_lock, flags); | 128 | spin_lock_irqsave(hba->host->host_lock, flags); |
| @@ -164,7 +164,7 @@ static ssize_t auto_hibern8_show(struct device *dev, | |||
| 164 | { | 164 | { |
| 165 | struct ufs_hba *hba = dev_get_drvdata(dev); | 165 | struct ufs_hba *hba = dev_get_drvdata(dev); |
| 166 | 166 | ||
| 167 | if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT)) | 167 | if (!ufshcd_is_auto_hibern8_supported(hba)) |
| 168 | return -EOPNOTSUPP; | 168 | return -EOPNOTSUPP; |
| 169 | 169 | ||
| 170 | return snprintf(buf, PAGE_SIZE, "%d\n", ufshcd_ahit_to_us(hba->ahit)); | 170 | return snprintf(buf, PAGE_SIZE, "%d\n", ufshcd_ahit_to_us(hba->ahit)); |
| @@ -177,7 +177,7 @@ static ssize_t auto_hibern8_store(struct device *dev, | |||
| 177 | struct ufs_hba *hba = dev_get_drvdata(dev); | 177 | struct ufs_hba *hba = dev_get_drvdata(dev); |
| 178 | unsigned int timer; | 178 | unsigned int timer; |
| 179 | 179 | ||
| 180 | if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT)) | 180 | if (!ufshcd_is_auto_hibern8_supported(hba)) |
| 181 | return -EOPNOTSUPP; | 181 | return -EOPNOTSUPP; |
| 182 | 182 | ||
| 183 | if (kstrtouint(buf, 0, &timer)) | 183 | if (kstrtouint(buf, 0, &timer)) |
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 8c1c551f2b42..0cf698d05426 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
| @@ -3907,7 +3907,7 @@ static void ufshcd_auto_hibern8_enable(struct ufs_hba *hba) | |||
| 3907 | { | 3907 | { |
| 3908 | unsigned long flags; | 3908 | unsigned long flags; |
| 3909 | 3909 | ||
| 3910 | if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) || !hba->ahit) | 3910 | if (!ufshcd_is_auto_hibern8_supported(hba) || !hba->ahit) |
| 3911 | return; | 3911 | return; |
| 3912 | 3912 | ||
| 3913 | spin_lock_irqsave(hba->host->host_lock, flags); | 3913 | spin_lock_irqsave(hba->host->host_lock, flags); |
| @@ -8312,7 +8312,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) | |||
| 8312 | UIC_LINK_HIBERN8_STATE); | 8312 | UIC_LINK_HIBERN8_STATE); |
| 8313 | 8313 | ||
| 8314 | /* Set the default auto-hiberate idle timer value to 150 ms */ | 8314 | /* Set the default auto-hiberate idle timer value to 150 ms */ |
| 8315 | if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) { | 8315 | if (ufshcd_is_auto_hibern8_supported(hba)) { |
| 8316 | hba->ahit = FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK, 150) | | 8316 | hba->ahit = FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK, 150) | |
| 8317 | FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, 3); | 8317 | FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, 3); |
| 8318 | } | 8318 | } |
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index ecfa898b9ccc..994d73d03207 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h | |||
| @@ -740,6 +740,11 @@ return true; | |||
| 740 | #endif | 740 | #endif |
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | static inline bool ufshcd_is_auto_hibern8_supported(struct ufs_hba *hba) | ||
| 744 | { | ||
| 745 | return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT); | ||
| 746 | } | ||
| 747 | |||
| 743 | #define ufshcd_writel(hba, val, reg) \ | 748 | #define ufshcd_writel(hba, val, reg) \ |
| 744 | writel((val), (hba)->mmio_base + (reg)) | 749 | writel((val), (hba)->mmio_base + (reg)) |
| 745 | #define ufshcd_readl(hba, reg) \ | 750 | #define ufshcd_readl(hba, reg) \ |
