diff mbox series

bus: mhi: pci_generic: Implement PCI shutdown callback

Message ID 1616169037-7969-1-git-send-email-loic.poulain@linaro.org
State Accepted
Commit 757072abe1c0b67cb226936c709291889658a222
Headers show
Series bus: mhi: pci_generic: Implement PCI shutdown callback | expand

Commit Message

Loic Poulain March 19, 2021, 3:50 p.m. UTC
Deinit the device on shutdown to halt MHI/PCI operation on device
side. This change fixes floating device state with some hosts that
do not fully shutdown PCIe device when rebooting.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

---
 drivers/bus/mhi/pci_generic.c | 7 +++++++
 1 file changed, 7 insertions(+)

-- 
2.7.4

Comments

Loic Poulain April 7, 2021, 7:23 a.m. UTC | #1
Hi Mani, Hemant

On Fri, 19 Mar 2021 at 16:42, Loic Poulain <loic.poulain@linaro.org> wrote:
>

> Deinit the device on shutdown to halt MHI/PCI operation on device

> side. This change fixes floating device state with some hosts that

> do not fully shutdown PCIe device when rebooting.


Any comments on this change?

>

> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

> ---

>  drivers/bus/mhi/pci_generic.c | 7 +++++++

>  1 file changed, 7 insertions(+)

>

> diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c

> index cbd2224..b104ab8 100644

> --- a/drivers/bus/mhi/pci_generic.c

> +++ b/drivers/bus/mhi/pci_generic.c

> @@ -532,6 +532,12 @@ static void mhi_pci_remove(struct pci_dev *pdev)

>         mhi_unregister_controller(mhi_cntrl);

>  }

>

> +static void mhi_pci_shutdown(struct pci_dev *pdev)

> +{

> +       mhi_pci_remove(pdev);

> +       pci_set_power_state(pdev, PCI_D3hot);

> +}

> +

>  static void mhi_pci_reset_prepare(struct pci_dev *pdev)

>  {

>         struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev);

> @@ -704,6 +710,7 @@ static struct pci_driver mhi_pci_driver = {

>         .id_table       = mhi_pci_id_table,

>         .probe          = mhi_pci_probe,

>         .remove         = mhi_pci_remove,

> +       .shutdown       = mhi_pci_shutdown,

>         .err_handler    = &mhi_pci_err_handler,

>         .driver.pm      = &mhi_pci_pm_ops

>  };

> --

> 2.7.4

>
Manivannan Sadhasivam April 7, 2021, 8:14 a.m. UTC | #2
On Fri, Mar 19, 2021 at 04:50:37PM +0100, Loic Poulain wrote:
> Deinit the device on shutdown to halt MHI/PCI operation on device

> side. This change fixes floating device state with some hosts that

> do not fully shutdown PCIe device when rebooting.

> 

> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>


Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>


Thanks,
Mani

> ---

>  drivers/bus/mhi/pci_generic.c | 7 +++++++

>  1 file changed, 7 insertions(+)

> 

> diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c

> index cbd2224..b104ab8 100644

> --- a/drivers/bus/mhi/pci_generic.c

> +++ b/drivers/bus/mhi/pci_generic.c

> @@ -532,6 +532,12 @@ static void mhi_pci_remove(struct pci_dev *pdev)

>  	mhi_unregister_controller(mhi_cntrl);

>  }

>  

> +static void mhi_pci_shutdown(struct pci_dev *pdev)

> +{

> +	mhi_pci_remove(pdev);

> +	pci_set_power_state(pdev, PCI_D3hot);

> +}

> +

>  static void mhi_pci_reset_prepare(struct pci_dev *pdev)

>  {

>  	struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev);

> @@ -704,6 +710,7 @@ static struct pci_driver mhi_pci_driver = {

>  	.id_table	= mhi_pci_id_table,

>  	.probe		= mhi_pci_probe,

>  	.remove		= mhi_pci_remove,

> +	.shutdown	= mhi_pci_shutdown,

>  	.err_handler	= &mhi_pci_err_handler,

>  	.driver.pm	= &mhi_pci_pm_ops

>  };

> -- 

> 2.7.4

>
Manivannan Sadhasivam April 7, 2021, 8:16 a.m. UTC | #3
On Fri, Mar 19, 2021 at 04:50:37PM +0100, Loic Poulain wrote:
> Deinit the device on shutdown to halt MHI/PCI operation on device

> side. This change fixes floating device state with some hosts that

> do not fully shutdown PCIe device when rebooting.

> 

> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>


Applied to mhi-next!

Thanks,
Mani

> ---

>  drivers/bus/mhi/pci_generic.c | 7 +++++++

>  1 file changed, 7 insertions(+)

> 

> diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c

> index cbd2224..b104ab8 100644

> --- a/drivers/bus/mhi/pci_generic.c

> +++ b/drivers/bus/mhi/pci_generic.c

> @@ -532,6 +532,12 @@ static void mhi_pci_remove(struct pci_dev *pdev)

>  	mhi_unregister_controller(mhi_cntrl);

>  }

>  

> +static void mhi_pci_shutdown(struct pci_dev *pdev)

> +{

> +	mhi_pci_remove(pdev);

> +	pci_set_power_state(pdev, PCI_D3hot);

> +}

> +

>  static void mhi_pci_reset_prepare(struct pci_dev *pdev)

>  {

>  	struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev);

> @@ -704,6 +710,7 @@ static struct pci_driver mhi_pci_driver = {

>  	.id_table	= mhi_pci_id_table,

>  	.probe		= mhi_pci_probe,

>  	.remove		= mhi_pci_remove,

> +	.shutdown	= mhi_pci_shutdown,

>  	.err_handler	= &mhi_pci_err_handler,

>  	.driver.pm	= &mhi_pci_pm_ops

>  };

> -- 

> 2.7.4

>
patchwork-bot+linux-arm-msm@kernel.org May 26, 2021, 7:03 p.m. UTC | #4
Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Fri, 19 Mar 2021 16:50:37 +0100 you wrote:
> Deinit the device on shutdown to halt MHI/PCI operation on device

> side. This change fixes floating device state with some hosts that

> do not fully shutdown PCIe device when rebooting.

> 

> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

> ---

>  drivers/bus/mhi/pci_generic.c | 7 +++++++

>  1 file changed, 7 insertions(+)


Here is the summary with links:
  - bus: mhi: pci_generic: Implement PCI shutdown callback
    https://git.kernel.org/qcom/c/757072abe1c0

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c
index cbd2224..b104ab8 100644
--- a/drivers/bus/mhi/pci_generic.c
+++ b/drivers/bus/mhi/pci_generic.c
@@ -532,6 +532,12 @@  static void mhi_pci_remove(struct pci_dev *pdev)
 	mhi_unregister_controller(mhi_cntrl);
 }
 
+static void mhi_pci_shutdown(struct pci_dev *pdev)
+{
+	mhi_pci_remove(pdev);
+	pci_set_power_state(pdev, PCI_D3hot);
+}
+
 static void mhi_pci_reset_prepare(struct pci_dev *pdev)
 {
 	struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev);
@@ -704,6 +710,7 @@  static struct pci_driver mhi_pci_driver = {
 	.id_table	= mhi_pci_id_table,
 	.probe		= mhi_pci_probe,
 	.remove		= mhi_pci_remove,
+	.shutdown	= mhi_pci_shutdown,
 	.err_handler	= &mhi_pci_err_handler,
 	.driver.pm	= &mhi_pci_pm_ops
 };