lkml.org 
[lkml]   [2020]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.6 189/254] scsi: ufs: fix Auto-Hibern8 error detection
    Date
    From: Stanley Chu <stanley.chu@mediatek.com>

    commit 5a244e0ea67b293abb1d26c825db2ddde5f2862f upstream.

    Auto-Hibern8 may be disabled by some vendors or sysfs in runtime even if
    Auto-Hibern8 capability is supported by host. If Auto-Hibern8 capability is
    supported by host but not actually enabled, Auto-Hibern8 error shall not
    happen.

    To fix this, provide a way to detect if Auto-Hibern8 is actually enabled
    first, and bypass Auto-Hibern8 disabling case in
    ufshcd_is_auto_hibern8_error().

    Fixes: 821744403913 ("scsi: ufs: Add error-handling of Auto-Hibernate")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20200129105251.12466-4-stanley.chu@mediatek.com
    Reviewed-by: Bean Huo <beanhuo@micron.com>
    Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
    Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
    Reviewed-by: Can Guo <cang@codeaurora.org>
    Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/scsi/ufs/ufshcd.c | 3 ++-
    drivers/scsi/ufs/ufshcd.h | 6 ++++++
    2 files changed, 8 insertions(+), 1 deletion(-)

    --- a/drivers/scsi/ufs/ufshcd.c
    +++ b/drivers/scsi/ufs/ufshcd.c
    @@ -5486,7 +5486,8 @@ static irqreturn_t ufshcd_update_uic_err
    static bool ufshcd_is_auto_hibern8_error(struct ufs_hba *hba,
    u32 intr_mask)
    {
    - if (!ufshcd_is_auto_hibern8_supported(hba))
    + if (!ufshcd_is_auto_hibern8_supported(hba) ||
    + !ufshcd_is_auto_hibern8_enabled(hba))
    return false;

    if (!(intr_mask & UFSHCD_UIC_HIBERN8_MASK))
    --- a/drivers/scsi/ufs/ufshcd.h
    +++ b/drivers/scsi/ufs/ufshcd.h
    @@ -55,6 +55,7 @@
    #include <linux/clk.h>
    #include <linux/completion.h>
    #include <linux/regulator/consumer.h>
    +#include <linux/bitfield.h>
    #include "unipro.h"

    #include <asm/irq.h>
    @@ -773,6 +774,11 @@ static inline bool ufshcd_is_auto_hibern
    return (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT);
    }

    +static inline bool ufshcd_is_auto_hibern8_enabled(struct ufs_hba *hba)
    +{
    + return FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, hba->ahit) ? true : false;
    +}
    +
    #define ufshcd_writel(hba, val, reg) \
    writel((val), (hba)->mmio_base + (reg))
    #define ufshcd_readl(hba, reg) \

    \
     
     \ /
      Last update: 2020-04-16 16:43    [W:4.262 / U:0.132 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site