From patchwork Mon Aug 7 05:20:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaiwei Liu X-Patchwork-Id: 13342997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B3DFEB64DD for ; Mon, 7 Aug 2023 05:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjHGFUm (ORCPT ); Mon, 7 Aug 2023 01:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbjHGFUm (ORCPT ); Mon, 7 Aug 2023 01:20:42 -0400 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F10A1703; Sun, 6 Aug 2023 22:20:40 -0700 (PDT) Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 3775KJin020082; Mon, 7 Aug 2023 13:20:19 +0800 (+08) (envelope-from Kaiwei.Liu@unisoc.com) Received: from SHDLP.spreadtrum.com (shmbx07.spreadtrum.com [10.0.1.12]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4RK4NM1pz8z2K1r9q; Mon, 7 Aug 2023 13:18:27 +0800 (CST) Received: from xm9614pcu.spreadtrum.com (10.13.2.29) by shmbx07.spreadtrum.com (10.0.1.12) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Mon, 7 Aug 2023 13:20:17 +0800 From: Kaiwei Liu To: Vinod Koul , Orson Zhai , Baolin Wang , Chunyan Zhang CC: , , kaiwei liu , Wenming Wu Subject: [PATCH 2/5] dma: add dma mask interface in probe Date: Mon, 7 Aug 2023 13:20:14 +0800 Message-ID: <20230807052014.2781-1-kaiwei.liu@unisoc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.13.2.29] X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To shmbx07.spreadtrum.com (10.0.1.12) X-MAIL: SHSQR01.spreadtrum.com 3775KJin020082 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org In the probe of DMA, the default addressing range is 32 bits, while the actual DMA hardware addressing range used is 36 bits. So add dma_set_mask_and_coherent function to match DMA addressing range. Signed-off-by: Kaiwei Liu --- drivers/dma/sprd-dma.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 20c3cb1ef2f5..0e146550dfbb 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -1115,6 +1115,15 @@ static int sprd_dma_probe(struct platform_device *pdev) u32 chn_count; int ret, i; + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36)); + if (ret) { + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "dma_set_mask_and_coherent failed\n"); + return ret; + } + } + /* Parse new and deprecated dma-channels properties */ ret = device_property_read_u32(&pdev->dev, "dma-channels", &chn_count); if (ret)