soc: qcom: mem-buf: Configure the mem-buf device's DMA mask

The mem-buf device can handle memory from anywhere in the
system. This includes memory with a physical address above
32 bits, so configure the DMA mask for the mem-buf device
based on the system configuration.

Change-Id: If91bb6d8044e8e6f47994acd7e50633b46596808
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
Isaac J. Manjarres 2020-05-20 17:19:09 -07:00
commit ca3e7ebe4f

View file

@ -1560,6 +1560,8 @@ static int mem_buf_probe(struct platform_device *pdev)
int ret;
struct device *dev = &pdev->dev;
struct device *class_dev;
u64 dma_mask = IS_ENABLED(CONFIG_ARM64) ? DMA_BIT_MASK(64) :
DMA_BIT_MASK(32);
if (of_property_match_string(dev->of_node, "qcom,mem-buf-capabilities",
"supplier") >= 0) {
@ -1577,6 +1579,12 @@ static int mem_buf_probe(struct platform_device *pdev)
return -EINVAL;
}
ret = dma_set_mask_and_coherent(dev, dma_mask);
if (ret) {
dev_err(dev, "Unable to set dma mask: %d\n", ret);
return ret;
}
mem_buf_msgq_recv_thr = kthread_create(mem_buf_msgq_recv_fn, NULL,
"mem_buf_rcvr");
if (IS_ERR(mem_buf_msgq_recv_thr)) {