Commit d8d9f793 authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Martin K. Petersen

scsi: ufs: Introduce vops for resetting device

Some UFS memory devices needs their reset line toggled in order to get them
into a good state for initialization. Provide a new vops to allow the
platform driver to implement this operation.

Link: https://lore.kernel.org/r/20190828191756.24312-2-bjorn.andersson@linaro.orgSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: default avatarAlim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: default avatarBean Huo <beanhuo@micron.com>
Reviewed-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Acked-by: default avatarAvri Altman <Avri.Altman@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4fb86a6b
...@@ -6234,6 +6234,9 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba) ...@@ -6234,6 +6234,9 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba)
int retries = MAX_HOST_RESET_RETRIES; int retries = MAX_HOST_RESET_RETRIES;
do { do {
/* Reset the attached device */
ufshcd_vops_device_reset(hba);
err = ufshcd_host_reset_and_restore(hba); err = ufshcd_host_reset_and_restore(hba);
} while (err && --retries); } while (err && --retries);
...@@ -8367,6 +8370,9 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) ...@@ -8367,6 +8370,9 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
goto exit_gating; goto exit_gating;
} }
/* Reset the attached device */
ufshcd_vops_device_reset(hba);
/* Host controller enable */ /* Host controller enable */
err = ufshcd_hba_enable(hba); err = ufshcd_hba_enable(hba);
if (err) { if (err) {
......
...@@ -298,6 +298,7 @@ struct ufs_pwr_mode_info { ...@@ -298,6 +298,7 @@ struct ufs_pwr_mode_info {
* @resume: called during host controller PM callback * @resume: called during host controller PM callback
* @dbg_register_dump: used to dump controller debug information * @dbg_register_dump: used to dump controller debug information
* @phy_initialization: used to initialize phys * @phy_initialization: used to initialize phys
* @device_reset: called to issue a reset pulse on the UFS device
*/ */
struct ufs_hba_variant_ops { struct ufs_hba_variant_ops {
const char *name; const char *name;
...@@ -326,6 +327,7 @@ struct ufs_hba_variant_ops { ...@@ -326,6 +327,7 @@ struct ufs_hba_variant_ops {
int (*resume)(struct ufs_hba *, enum ufs_pm_op); int (*resume)(struct ufs_hba *, enum ufs_pm_op);
void (*dbg_register_dump)(struct ufs_hba *hba); void (*dbg_register_dump)(struct ufs_hba *hba);
int (*phy_initialization)(struct ufs_hba *); int (*phy_initialization)(struct ufs_hba *);
void (*device_reset)(struct ufs_hba *hba);
}; };
/* clock gating state */ /* clock gating state */
...@@ -1070,6 +1072,12 @@ static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) ...@@ -1070,6 +1072,12 @@ static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
hba->vops->dbg_register_dump(hba); hba->vops->dbg_register_dump(hba);
} }
static inline void ufshcd_vops_device_reset(struct ufs_hba *hba)
{
if (hba->vops && hba->vops->device_reset)
hba->vops->device_reset(hba);
}
extern struct ufs_pm_lvl_states ufs_pm_lvl_states[]; extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment