From 154145ee4ecd7778590d6a0fc76f6c6144d48d88 Mon Sep 17 00:00:00 2001
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
Date: Thu, 6 Jun 2024 16:38:02 +0100
Subject: [PATCH] staging: vc04_services: vc-sm-cma: Explicitly set DMA mask

The platform model originally handled the DMA mask. Now that
we are on the vchiq_bus we need to explicitly set this.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 drivers/staging/vc04_services/vc-sm-cma/vc_sm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
+++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
@@ -1477,8 +1477,17 @@ err_remove_debugfs:
 /* Driver loading. */
 static int bcm2835_vc_sm_cma_probe(struct vchiq_device *device)
 {
+	int err;
+
 	pr_info("%s: Videocore shared memory driver\n", __func__);
 
+	err = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32));
+	if (err) {
+		dev_err(&device->dev, "dma_set_mask_and_coherent failed: %d\n",
+			err);
+		return err;
+	}
+
 	sm_state = devm_kzalloc(&device->dev, sizeof(*sm_state), GFP_KERNEL);
 	if (!sm_state)
 		return -ENOMEM;
