From: cang@codeaurora.org
To: "Bean Huo (beanhuo)" <beanhuo@micron.com>
Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org,
rnayak@codeaurora.org, linux-scsi@vger.kernel.org,
kernel-team@android.com, saravanak@google.com,
salyzyn@google.com, Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
Pedro Sousa <pedrom.sousa@synopsys.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Stanley Chu <stanley.chu@mediatek.com>,
Tomas Winkler <tomas.winkler@intel.com>,
Subhash Jadavani <subhashj@codeaurora.org>,
Arnd Bergmann <arnd@arndb.de>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [EXT] [PATCH v1 1/2] scsi: ufs: Introduce a vops for resetting host controller
Date: Tue, 29 Oct 2019 10:11:05 +0800 [thread overview]
Message-ID: <ebd83f54b99a544a15fca681196bb8f3@codeaurora.org> (raw)
In-Reply-To: <BN7PR08MB568444BD52F49775D7EEB363DB6B0@BN7PR08MB5684.namprd08.prod.outlook.com>
On 2019-10-23 18:39, Bean Huo (beanhuo) wrote:
> Hi, Can Guo
> Actually, we already have DME_RESET, this is not enough for Qualcomm
> host?
> Thanks,
>
> //Bean
>
Hi Bean,
Yes, for Qualcomm hosts, we need this to fully reset the whole UFS
controller block
Can Guo
>>
>> Some UFS host controllers need their specific implementations of
>> resetting to
>> get them into a good state. Provide a new vops to allow the platform
>> driver to
>> implement this own reset operation.
>>
>> Signed-off-by: Can Guo <cang@codeaurora.org>
>> ---
>> drivers/scsi/ufs/ufshcd.c | 16 ++++++++++++++++
>> drivers/scsi/ufs/ufshcd.h | 10
>> ++++++++++
>> 2 files changed, 26 insertions(+)
>>
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> index
>> c28c144..161e3c4 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -3859,6 +3859,14 @@ static int ufshcd_link_recovery(struct ufs_hba
>> *hba)
>> ufshcd_set_eh_in_progress(hba);
>> spin_unlock_irqrestore(hba->host->host_lock, flags);
>>
>> + ret = ufshcd_vops_full_reset(hba);
>> + if (ret)
>> + dev_warn(hba->dev, "%s: full reset returned %d\n",
>> + __func__, ret);
>> +
>> + /* Reset the attached device */
>> + ufshcd_vops_device_reset(hba);
>> +
>> ret = ufshcd_host_reset_and_restore(hba);
>>
>> spin_lock_irqsave(hba->host->host_lock, flags); @@ -6241,6 +6249,11
>> @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba)
>> int retries = MAX_HOST_RESET_RETRIES;
>>
>> do {
>> + err = ufshcd_vops_full_reset(hba);
>> + if (err)
>> + dev_warn(hba->dev, "%s: full reset returned %d\n",
>> + __func__, err);
>> +
>> /* Reset the attached device */
>> ufshcd_vops_device_reset(hba);
>>
>> @@ -8384,6 +8397,9 @@ int ufshcd_init(struct ufs_hba *hba, void
>> __iomem
>> *mmio_base, unsigned int irq)
>> goto exit_gating;
>> }
>>
>> + /* Reset controller to power on reset (POR) state */
>> + ufshcd_vops_full_reset(hba);
>> +
>> /* Reset the attached device */
>> ufshcd_vops_device_reset(hba);
>>
>> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
>> index
>> e0fe247..253b9ea 100644
>> --- a/drivers/scsi/ufs/ufshcd.h
>> +++ b/drivers/scsi/ufs/ufshcd.h
>> @@ -296,6 +296,8 @@ struct ufs_pwr_mode_info {
>> * @apply_dev_quirks: called to apply device specific quirks
>> * @suspend: called during host controller PM callback
>> * @resume: called during host controller PM callback
>> + * @full_reset: called for handling variant specific implementations
>> of
>> + * resetting the hci
>> * @dbg_register_dump: used to dump controller debug information
>> * @phy_initialization: used to initialize phys
>> * @device_reset: called to issue a reset pulse on the UFS device @@
>> -325,6
>> +327,7 @@ struct ufs_hba_variant_ops {
>> int (*apply_dev_quirks)(struct ufs_hba *);
>> int (*suspend)(struct ufs_hba *, enum ufs_pm_op);
>> int (*resume)(struct ufs_hba *, enum ufs_pm_op);
>> + int (*full_reset)(struct ufs_hba *hba);
>> void (*dbg_register_dump)(struct ufs_hba *hba);
>> int (*phy_initialization)(struct ufs_hba *);
>> void (*device_reset)(struct ufs_hba *hba);
>> @@ -1076,6 +1079,13 @@ static inline int ufshcd_vops_resume(struct
>> ufs_hba
>> *hba, enum ufs_pm_op op)
>> return 0;
>> }
>>
>> +static inline int ufshcd_vops_full_reset(struct ufs_hba *hba) {
>> + if (hba->vops && hba->vops->full_reset)
>> + return hba->vops->full_reset(hba);
>> + return 0;
>> +}
>> +
>> static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba)
>> {
>> if (hba->vops && hba->vops->dbg_register_dump)
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
>> Forum,
>> a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2019-10-29 2:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1571804009-29787-1-git-send-email-cang@codeaurora.org>
2019-10-23 4:13 ` [PATCH v1 1/2] scsi: ufs: Introduce a vops for resetting host controller Can Guo
2019-10-23 10:39 ` [EXT] " Bean Huo (beanhuo)
2019-10-29 2:11 ` cang [this message]
2019-10-31 14:44 ` Mark Salyzyn
2019-11-01 1:18 ` cang
2019-11-04 14:28 ` Avri Altman
2019-11-04 14:34 ` [EXT] " Bean Huo (beanhuo)
2019-11-04 23:46 ` cang
2019-11-04 23:44 ` cang
2019-10-23 4:13 ` [PATCH v1 2/2] scsi: ufs-qcom: Add reset control support for " Can Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ebd83f54b99a544a15fca681196bb8f3@codeaurora.org \
--to=cang@codeaurora.org \
--cc=alim.akhtar@samsung.com \
--cc=arnd@arndb.de \
--cc=asutoshd@codeaurora.org \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bjorn.andersson@linaro.org \
--cc=jejb@linux.ibm.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nguyenb@codeaurora.org \
--cc=pedrom.sousa@synopsys.com \
--cc=rnayak@codeaurora.org \
--cc=salyzyn@google.com \
--cc=saravanak@google.com \
--cc=stanley.chu@mediatek.com \
--cc=subhashj@codeaurora.org \
--cc=tomas.winkler@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox