Thread (27 messages) 27 messages, 3 authors, 2025-12-18

Re: [PATCH 07/10] can: grcan: set DMA mask for GRCAN and GRCANFD to 32-bit

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2025-11-21 12:47:02
Also in: linux-can, lkml

On 18.11.2025 10:21:12, Arun Muthusamy wrote:
quoted hunk ↗ jump to hunk
From: Daniel Hellstrom <redacted>

Sets the DMA mask for GRCAN and GRCANFD devices to 32-bit.
Setting the DMA mask and coherent DMA mask to 32-bit ensures proper
memory addressing during DMA operations

Signed-off-by: Arun Muthusamy <redacted>
Signed-off-by: Daniel Hellstrom <redacted>
---
 drivers/net/can/grcan.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
index e367581faa57..51a10fae2faf 100644
--- a/drivers/net/can/grcan.c
+++ b/drivers/net/can/grcan.c
@@ -1074,6 +1074,12 @@ static int grcan_allocate_dma_buffers(struct net_device *dev,

 	/* Extra GRCAN_BUFFER_ALIGNMENT to allow for alignment */
 	dma->base_size = lsize + ssize + GRCAN_BUFFER_ALIGNMENT;
+
+	/* On 64-bit systems.. GRCAN and GRCANFD can only address 32-bit */
+	if (dma_set_mask_and_coherent(priv->ofdev_dev, DMA_BIT_MASK(32))) {
+		netdev_warn(dev, "No suitable DMA available\n");
+		return -ENOMEM;
Please move this to probe(), return the error code, and use
dev_err_probe() for the error message.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help