linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume
@ 2017-03-25 23:04 Sinan Kaya
  2017-03-25 23:04 ` [PATCH 2/2] dmaengine: qcom_hidma: pause the channel on shutdown Sinan Kaya
  2017-03-27  5:14 ` [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Sinan Kaya @ 2017-03-25 23:04 UTC (permalink / raw)
  To: dmaengine, timur
  Cc: Vinod Koul, linux-arm-msm, linux-kernel, Sinan Kaya, David Brown,
	Andy Gross, Dan Williams, linux-soc, linux-arm-kernel

Once the channels are stopped, disable interrupts to make sure no new
HW interaction can happen.

Similarly, re-enable the interrupts only if we know that channel is
operational again.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/dma/qcom/hidma_ll.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c
index 6645bdf..1530a66 100644
--- a/drivers/dma/qcom/hidma_ll.c
+++ b/drivers/dma/qcom/hidma_ll.c
@@ -499,6 +499,9 @@ int hidma_ll_enable(struct hidma_lldev *lldev)
 	lldev->trch_state = HIDMA_CH_ENABLED;
 	lldev->evch_state = HIDMA_CH_ENABLED;
 
+	/* enable irqs */
+	writel(ENABLE_IRQS, lldev->evca + HIDMA_EVCA_IRQ_EN_REG);
+
 	return 0;
 }
 
@@ -596,6 +599,9 @@ int hidma_ll_disable(struct hidma_lldev *lldev)
 
 	lldev->trch_state = HIDMA_CH_SUSPENDED;
 	lldev->evch_state = HIDMA_CH_SUSPENDED;
+
+	/* disable interrupts */
+	writel(0, lldev->evca + HIDMA_EVCA_IRQ_EN_REG);
 	return 0;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] dmaengine: qcom_hidma: pause the channel on shutdown
  2017-03-25 23:04 [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume Sinan Kaya
@ 2017-03-25 23:04 ` Sinan Kaya
  2017-03-27  5:14 ` [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Sinan Kaya @ 2017-03-25 23:04 UTC (permalink / raw)
  To: dmaengine, timur
  Cc: linux-arm-msm, linux-arm-kernel, Sinan Kaya, Andy Gross,
	David Brown, Dan Williams, Vinod Koul, linux-soc, linux-kernel

We need to ensure that all DMAs and interrupts are cleared during
shutdown operation in order for kexec to start the next kernel clearly.

Otherwise, HW could be performing a DMA into random addresses in the
middle of second kernel start.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/dma/qcom/hidma.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c
index 3c982c9..5072a7d 100644
--- a/drivers/dma/qcom/hidma.c
+++ b/drivers/dma/qcom/hidma.c
@@ -865,6 +865,20 @@ static int hidma_probe(struct platform_device *pdev)
 	return rc;
 }
 
+static void hidma_shutdown(struct platform_device *pdev)
+{
+	struct hidma_dev *dmadev = platform_get_drvdata(pdev);
+
+	dev_info(dmadev->ddev.dev, "HI-DMA engine shutdown\n");
+
+	pm_runtime_get_sync(dmadev->ddev.dev);
+	if (hidma_ll_disable(dmadev->lldev))
+		dev_warn(dmadev->ddev.dev, "channel did not stop\n");
+	pm_runtime_mark_last_busy(dmadev->ddev.dev);
+	pm_runtime_put_autosuspend(dmadev->ddev.dev);
+
+}
+
 static int hidma_remove(struct platform_device *pdev)
 {
 	struct hidma_dev *dmadev = platform_get_drvdata(pdev);
@@ -908,6 +922,7 @@ static int hidma_remove(struct platform_device *pdev)
 static struct platform_driver hidma_driver = {
 	.probe = hidma_probe,
 	.remove = hidma_remove,
+	.shutdown = hidma_shutdown,
 	.driver = {
 		   .name = "hidma",
 		   .of_match_table = hidma_match,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume
  2017-03-25 23:04 [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume Sinan Kaya
  2017-03-25 23:04 ` [PATCH 2/2] dmaengine: qcom_hidma: pause the channel on shutdown Sinan Kaya
@ 2017-03-27  5:14 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2017-03-27  5:14 UTC (permalink / raw)
  To: Sinan Kaya
  Cc: David Brown, linux-arm-msm, timur, linux-kernel, Andy Gross,
	dmaengine, Dan Williams, linux-soc, linux-arm-kernel

On Sat, Mar 25, 2017 at 07:04:02PM -0400, Sinan Kaya wrote:
> Once the channels are stopped, disable interrupts to make sure no new
> HW interaction can happen.
> 
> Similarly, re-enable the interrupts only if we know that channel is
> operational again.

Applied both, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-27  5:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-25 23:04 [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume Sinan Kaya
2017-03-25 23:04 ` [PATCH 2/2] dmaengine: qcom_hidma: pause the channel on shutdown Sinan Kaya
2017-03-27  5:14 ` [PATCH 1/2] dmaengine: qcom_hidma: disable/enable IRQs on pause/resume Vinod Koul

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).