[PATCH v4 09/15] can: grcan: set DMA mask for GRCAN and GRCANFD to 32-bit

Arun Muthusamy
2026-01-28T14:49:33Z

From: Daniel Hellstrom <daniel@gaisler.com>

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: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: Arun Muthusamy <arun.muthusamy@gaisler.com>
---
drivers/net/can/grcan.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
index 29247e9860c9..13dc4989f067 100644
--- a/drivers/net/can/grcan.c
+++ b/drivers/net/can/grcan.c
@@ -1741,6 +1741,13 @@ static int grcan_probe(struct platform_device *ofdev)
goto exit_error;
}

+ /* On 64-bit systems.. GRCAN and GRCANFD can only address 32-bit */
+ err = dma_set_mask_and_coherent(&ofdev->dev, DMA_BIT_MASK(32));
+ if (err) {
+ dev_err_probe(&ofdev->dev, err, "No usable DMA configuration.\n");
+ goto exit_error;
+ }
+
irq = irq_of_parse_and_map(np, GRCAN_IRQIX_IRQ);
if (!irq) {
dev_err(&ofdev->dev, "no irq found\n");
--
2.51.0