From: Jeffrey Hugo <jhugo@codeaurora.org>
To: Loic Poulain <loic.poulain@linaro.org>,
manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org
Cc: linux-arm-msm@vger.kernel.org, bbhatt@codeaurora.org
Subject: Re: [PATCH v3 3/9] mhi: pci-generic: Perform hard reset on remove
Date: Fri, 27 Nov 2020 10:40:41 -0700 [thread overview]
Message-ID: <afab13b8-e3aa-ac3e-fcd9-f7ee4b697499@codeaurora.org> (raw)
In-Reply-To: <39fae2b9-cdde-1864-8ff3-55e3c07f4264@codeaurora.org>
On 11/27/2020 10:34 AM, Jeffrey Hugo wrote:
> On 11/26/2020 8:29 AM, Loic Poulain wrote:
>> Ensure that the device is hard-reset on remove to restore its initial
>> state and avoid further issues on subsequent probe.
>>
>> This has been tested with Telit FN980m module.
>>
>> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
>> ---
>> drivers/bus/mhi/pci_generic.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/bus/mhi/pci_generic.c
>> b/drivers/bus/mhi/pci_generic.c
>> index d3896ef..4363676 100644
>> --- a/drivers/bus/mhi/pci_generic.c
>> +++ b/drivers/bus/mhi/pci_generic.c
>> @@ -15,6 +15,8 @@
>> #define MHI_PCI_DEFAULT_BAR_NUM 0
>> +#define DEV_RESET_REG (0xB0)
>> +
>> /**
>> * struct mhi_pci_dev_info - MHI PCI device specific information
>> * @config: MHI controller configuration
>> @@ -166,6 +168,11 @@ static void mhi_pci_status_cb(struct
>> mhi_controller *mhi_cntrl,
>> /* Nothing to do for now */
>> }
>> +static inline void mhi_pci_reset(struct mhi_controller *mhi_cntrl)
>> +{
>> + writel(1, mhi_cntrl->regs + DEV_RESET_REG);
>> +}
>> +
>> static int mhi_pci_claim(struct mhi_controller *mhi_cntrl,
>> unsigned int bar_num, u64 dma_mask)
>> {
>> @@ -329,6 +336,10 @@ static void mhi_pci_remove(struct pci_dev *pdev)
>> mhi_power_down(mhi_cntrl, true);
>> mhi_unprepare_after_power_down(mhi_cntrl);
>> mhi_unregister_controller(mhi_cntrl);
>> +
>> + /* MHI-layer reset could not be enough, always hard-reset the
>> device */
>> + mhi_pci_reset(mhi_cntrl);
>> +
>> mhi_free_controller(mhi_cntrl);
>> }
>>
>
> Did you miss my eariler comment asking to make this functionality common?
Sorry, I missed your reply to my reply.
>
> Also, I caution you to think carefully about this. Its possible doing
> this type of reset can take down the PCI link, and the host would need
> to have PCI hotplug to recover. If not, the device will become
> inaccessable until the host reboots.
>
--
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2020-11-27 17:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 15:28 [PATCH v3 0/9] mhi: pci_generic: Misc improvements Loic Poulain
2020-11-26 15:28 ` [PATCH v3 1/9] mhi: Add mhi_controller_initialize helper Loic Poulain
2020-11-28 5:42 ` Manivannan Sadhasivam
2020-12-02 1:41 ` Bhaumik Bhatt
2020-11-26 15:29 ` [PATCH v3 2/9] mhi: pci-generic: Increase number of hardware events Loic Poulain
2020-11-28 5:44 ` Manivannan Sadhasivam
2020-11-26 15:29 ` [PATCH v3 3/9] mhi: pci-generic: Perform hard reset on remove Loic Poulain
2020-11-27 17:34 ` Jeffrey Hugo
2020-11-27 17:40 ` Jeffrey Hugo [this message]
2020-11-26 15:29 ` [PATCH v3 4/9] mhi: pci_generic: Enable burst mode for hardware channels Loic Poulain
2020-11-28 5:45 ` Manivannan Sadhasivam
2020-11-26 15:29 ` [PATCH v3 5/9] mhi: pci_generic: Add support for reset Loic Poulain
2020-11-28 5:49 ` Manivannan Sadhasivam
2020-11-30 9:08 ` Loic Poulain
2020-12-02 1:24 ` Bhaumik Bhatt
2020-12-07 14:05 ` Loic Poulain
2020-11-26 15:29 ` [PATCH v3 6/9] mhi: pci_generic: Add suspend/resume/recovery procedure Loic Poulain
2020-11-26 15:29 ` [PATCH v3 7/9] mhi: pci_generic: Add PCI error handlers Loic Poulain
2020-11-26 15:29 ` [PATCH v3 8/9] mhi: pci_generic: Add health-check Loic Poulain
2020-11-28 5:59 ` Manivannan Sadhasivam
2020-12-01 0:59 ` Hemant Kumar
2020-12-01 1:02 ` Hemant Kumar
2020-11-26 15:29 ` [PATCH v3 9/9] mhi: pci_generic: Increase controller timeout value Loic Poulain
2020-11-28 5:51 ` Manivannan Sadhasivam
2020-11-28 6:00 ` [PATCH v3 0/9] mhi: pci_generic: Misc improvements Manivannan Sadhasivam
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=afab13b8-e3aa-ac3e-fcd9-f7ee4b697499@codeaurora.org \
--to=jhugo@codeaurora.org \
--cc=bbhatt@codeaurora.org \
--cc=hemantk@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=manivannan.sadhasivam@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).