Fix kernel driver not setting coherent DMA mask

When the kernel driver creates the Ethos-U device, it doesn't setup the
coherent DMA mask. This causes the kernel to generate a warning the
first time any of the coherent DMA functions are used and the kernel
will end up using a default DMA mask.

To ensure that the device uses the correct DMA mask and to no longer get
the warning, the kernel driver will now setup the DMA mask for the
device.

Change-Id: I92c67c85be1754970412da92161dbf1ec993bca3
diff --git a/kernel/ethosu_device.c b/kernel/ethosu_device.c
index 96bd8b4..48aa0a5 100644
--- a/kernel/ethosu_device.c
+++ b/kernel/ethosu_device.c
@@ -33,6 +33,7 @@
 #include "ethosu_network_info.h"
 #include "uapi/ethosu.h"
 
+#include <linux/dma-mapping.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/io.h>
@@ -48,6 +49,8 @@
 #define MINOR_BASE      0 /* Minor version starts at 0 */
 #define MINOR_COUNT    64 /* Allocate minor versions */
 
+#define DMA_ADDR_BITS  32 /* Number of address bits */
+
 /****************************************************************************
  * Variables
  ****************************************************************************/
@@ -380,6 +383,14 @@
 		return ret;
 	}
 
+	/* Set mask for coherent DMA addressing */
+	ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(DMA_ADDR_BITS));
+	if (ret) {
+		dev_err(parent, "Failed to set coherent DMA mask. ret=%d", ret);
+
+		return ret;
+	}
+
 	ret = device_register(dev);
 	if (ret) {
 		dev_err(parent, "Failed to register device. ret=%d", ret);