From patchwork Fri Oct 22 09:28:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "roy-cw.yeh" X-Patchwork-Id: 12577463 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9753FC433F5 for ; Fri, 22 Oct 2021 09:34:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67A8A610CB for ; Fri, 22 Oct 2021 09:34:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 67A8A610CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PKxJ8nIAfx9YOrS9Bs0ECuYi8J7nrW8sZ+jVkmyVa18=; b=qfzDmUV0uq+VvH v4Qd6oKA4hXK8WefFjO57dgl/mSKIblOypUrN2U1NXqJw8ebfdeQYzKMAlqu5ex6+V07QA6Fzcum1 GGdsYttamPakT1NcIS/f660h3aaOgnj2wrObAXsyx9dPUsjlHv5lRd1Izq/6xhAYY6MDLOw/r8/aw UHb/tAOGX660mR3AG6GL+d67+CC6NuqGRQUtBjmiSCbyI/8hjkJG+yG1r+RgUinvqS0TwlXjaue+t EK1iHqwT2LMmKnhc9Y0DIIXq5v8EyzJFwHl40jaKd55sAoE/yzSdDt7qu0fScVLkrE/tLUXppvAnM PpR4RRjG0jy3t1B55BCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdqvF-00ANYu-G0; Fri, 22 Oct 2021 09:33:09 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdqvC-00ANXk-Dv; Fri, 22 Oct 2021 09:33:07 +0000 X-UUID: c4c8201410a340cf948a648f94ea5b3e-20211022 X-UUID: c4c8201410a340cf948a648f94ea5b3e-20211022 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 727749675; Fri, 22 Oct 2021 02:33:03 -0700 Received: from mtkmbs10n1.mediatek.inc (172.21.101.34) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 22 Oct 2021 02:28:30 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Fri, 22 Oct 2021 17:28:28 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 22 Oct 2021 17:28:28 +0800 From: roy-cw.yeh To: Rob Herring , Matthias Brugger , AngeloGioacchino Del Regno , Chun-Kuang Hu CC: Mauro Carvalho Chehab , Fabien Parent , "Roy-CW . Yeh" , "jason-jh . lin" , daoyuan huang , Ping-Hsun Wu , Moudy Ho , "river . cheng" , Enric Balletbo i Serra , Yongqiang Niu , , , , , Subject: [PATCH v2 3/4] media: platform: mtk-mdp3: Set dma_set_mask_and_coherent Date: Fri, 22 Oct 2021 17:28:26 +0800 Message-ID: <20211022092827.24631-4-roy-cw.yeh@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20211022092827.24631-1-roy-cw.yeh@mediatek.com> References: <20211022092827.24631-1-roy-cw.yeh@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211022_023306_485093_489B1CDB X-CRM114-Status: GOOD ( 11.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Roy-CW.Yeh" Use the dma_set_mask_and_coherent helper to set mdp DMA bit mask to support 34bits iova space(16GB) that the mt8195 iommu HW supports. The whole iova range separates to 0~4G/4G~8G/8G~12G/12G~16G. Regarding which iova range mdp actually locates, it depends on the dma-ranges property of mdp dtsi node. Signed-off-by: Roy-CW.Yeh Acked-by: AngeloGioacchino Del Regno --- drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c b/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c index 12b029d145d6..51f7ef2b31ce 100644 --- a/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c +++ b/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c @@ -1141,6 +1141,9 @@ static int mdp_probe(struct platform_device *pdev) mdp->pdev = pdev; mdp->mdp_data = of_device_get_match_data(&pdev->dev); + if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL)) + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34)); + ret = of_property_read_u32(dev->of_node, "mediatek,mdp3-id", &id); if (ret) { dev_err(dev, "Failed to get mdp-id\n");