diff mbox series

[v2,3/4] media: platform: mtk-mdp3: Set dma_set_mask_and_coherent

Message ID 20211022092827.24631-4-roy-cw.yeh@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add additional setting and performance tuning | expand

Commit Message

roy-cw.yeh Oct. 22, 2021, 9:28 a.m. UTC
From: "Roy-CW.Yeh" <roy-cw.yeh@mediatek.com>

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 <roy-cw.yeh@mediatek.com>
---
 drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

AngeloGioacchino Del Regno Oct. 22, 2021, 3:24 p.m. UTC | #1
Il 22/10/21 11:28, roy-cw.yeh ha scritto:
> From: "Roy-CW.Yeh" <roy-cw.yeh@mediatek.com>
> 
> 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 <roy-cw.yeh@mediatek.com>

Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> ---
>   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");
>
diff mbox series

Patch

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");