From 0ac69de37277aec31d18a8c7b9d9a3a65b629526 Mon Sep 17 00:00:00 2001
From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Wed, 12 Oct 2016 16:30:57 +0800
Subject: [PATCH 144/226] dpaa: call arch_setup_dma_ops before using dma_ops

A previous patch caused dpaa call trace. This patch provides
a temporary workaround for this until this is fixed by upstream.

Fixes: 1dccb598df54 ("arm64: simplify dma_get_ops")
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 .../ethernet/freescale/sdk_dpaa/dpaa_eth_common.c  |   12 ++++++------
 drivers/staging/fsl_qbman/qman_high.c              |    1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c
@@ -754,6 +754,12 @@ dpa_bp_alloc(struct dpa_bp *dpa_bp)
 		goto pdev_register_failed;
 	}
 
+#ifdef CONFIG_FMAN_ARM
+	/* force coherency */
+	pdev->dev.archdata.dma_coherent = true;
+	arch_setup_dma_ops(&pdev->dev, 0, 0, NULL, true);
+#endif
+
 	err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(40));
 	if (err)
 		goto pdev_mask_failed;
@@ -765,12 +771,6 @@ dpa_bp_alloc(struct dpa_bp *dpa_bp)
 			goto pdev_mask_failed;
 	}
 
-#ifdef CONFIG_FMAN_ARM
-	/* force coherency */
-	pdev->dev.archdata.dma_coherent = true;
-	arch_setup_dma_ops(&pdev->dev, 0, 0, NULL, true);
-#endif
-
 	dpa_bp->dev = &pdev->dev;
 
 	if (dpa_bp->seed_cb) {
--- a/drivers/staging/fsl_qbman/qman_high.c
+++ b/drivers/staging/fsl_qbman/qman_high.c
@@ -662,6 +662,7 @@ struct qman_portal *qman_create_portal(
 	portal->pdev->dev.coherent_dma_mask = DMA_BIT_MASK(40);
 	portal->pdev->dev.dma_mask = &portal->pdev->dev.coherent_dma_mask;
 #else
+	arch_setup_dma_ops(&portal->pdev->dev, 0, 0, NULL, false);
 	if (dma_set_mask(&portal->pdev->dev, DMA_BIT_MASK(40))) {
 		pr_err("qman_portal - dma_set_mask() failed\n");
 		goto fail_devadd;
