From patchwork Wed Mar 9 19:45:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 12775536 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 CB626C433FE for ; Wed, 9 Mar 2022 19:45:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238005AbiCITqb (ORCPT ); Wed, 9 Mar 2022 14:46:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231503AbiCITqa (ORCPT ); Wed, 9 Mar 2022 14:46:30 -0500 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AFD108E; Wed, 9 Mar 2022 11:45:30 -0800 (PST) X-IronPort-AV: E=Sophos;i="5.90,168,1643641200"; d="scan'208";a="113867408" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 10 Mar 2022 04:45:30 +0900 Received: from localhost.localdomain (unknown [10.226.92.47]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D68A440DDA93; Thu, 10 Mar 2022 04:45:27 +0900 (JST) From: Biju Das To: Mauro Carvalho Chehab , Rob Herring Cc: Biju Das , Laurent Pinchart , Kieran Bingham , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Geert Uytterhoeven , Chris Paterson , Biju Das , Prabhakar Mahadev Lad Subject: [PATCH 1/3] media: dt-bindings: media: renesas,vsp1: Document RZ/{G2L,V2L} VSPD bindings Date: Wed, 9 Mar 2022 19:45:19 +0000 Message-Id: <20220309194521.7028-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220309194521.7028-1-biju.das.jz@bp.renesas.com> References: <20220309194521.7028-1-biju.das.jz@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Document VSPD found in RZ/G2L and RZ/V2L family SoC's. VSPD block is similar to VSP2-D found on R-Car SoC's, but it does not have a version register and it has 3 clocks compared to 1 clock on vsp1 and vsp2. This patch introduces a new compatible 'renesas,vsp2-rzg2l' to handle these differences. Signed-off-by: Biju Das Reviewed-by: Lad Prabhakar --- RFC->v1: * Updated commit description * Changed compatible from vsp2-r9a07g044->vsp2-rzg2l * Defined the clocks * Clock max Items is based on SoC Compatible string RFC: * https://patchwork.kernel.org/project/linux-renesas-soc/patch/20220112174612.10773-20-biju.das.jz@bp.renesas.com/ --- .../bindings/media/renesas,vsp1.yaml | 52 ++++++++++++++----- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/Documentation/devicetree/bindings/media/renesas,vsp1.yaml b/Documentation/devicetree/bindings/media/renesas,vsp1.yaml index 990e9c1dbc43..52e26eea4f70 100644 --- a/Documentation/devicetree/bindings/media/renesas,vsp1.yaml +++ b/Documentation/devicetree/bindings/media/renesas,vsp1.yaml @@ -19,6 +19,7 @@ properties: enum: - renesas,vsp1 # R-Car Gen2 and RZ/G1 - renesas,vsp2 # R-Car Gen3 and RZ/G2 + - renesas,vsp2-rzg2l # RZ/G2L and RZ/V2L reg: maxItems: 1 @@ -26,8 +27,8 @@ properties: interrupts: maxItems: 1 - clocks: - maxItems: 1 + clocks: true + clock-names: true power-domains: maxItems: 1 @@ -50,17 +51,42 @@ required: additionalProperties: false -if: - properties: - compatible: - items: - - const: renesas,vsp1 -then: - properties: - renesas,fcp: false -else: - required: - - renesas,fcp +allOf: + - if: + properties: + compatible: + contains: + const: renesas,vsp1 + then: + properties: + renesas,fcp: false + else: + required: + - renesas,fcp + + - if: + properties: + compatible: + contains: + const: renesas,vsp2-rzg2l + then: + properties: + clocks: + items: + - description: LCDC Main clock + - description: LCDC Register Access Clock + - description: LCDC Video Clock + clock-names: + items: + - const: du.0 + - const: pclk + - const: vclk + required: + - clock-names + else: + properties: + clocks: + maxItems: 1 examples: # R8A7790 (R-Car H2) VSP1-S From patchwork Wed Mar 9 19:45:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 12775535 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 7B6C1C43217 for ; Wed, 9 Mar 2022 19:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238006AbiCITqd (ORCPT ); Wed, 9 Mar 2022 14:46:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238003AbiCITqc (ORCPT ); Wed, 9 Mar 2022 14:46:32 -0500 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 85578B74; Wed, 9 Mar 2022 11:45:33 -0800 (PST) X-IronPort-AV: E=Sophos;i="5.90,168,1643641200"; d="scan'208";a="113867413" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 10 Mar 2022 04:45:33 +0900 Received: from localhost.localdomain (unknown [10.226.92.47]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id E075E40DDA93; Thu, 10 Mar 2022 04:45:30 +0900 (JST) From: Biju Das To: Mauro Carvalho Chehab , Philipp Zabel Cc: Biju Das , Laurent Pinchart , Kieran Bingham , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , Chris Paterson , Biju Das , Prabhakar Mahadev Lad Subject: [PATCH 2/3] media: vsp1: Add support to deassert/assert reset line Date: Wed, 9 Mar 2022 19:45:20 +0000 Message-Id: <20220309194521.7028-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220309194521.7028-1-biju.das.jz@bp.renesas.com> References: <20220309194521.7028-1-biju.das.jz@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As the resets DT property is mandatory, and is present in all .dtsi in mainline, add support to perform deassert/assert when required. Signed-off-by: Biju Das Reviewed-by: Lad Prabhakar --- RFC->v1: * Added reset support as seperate patch * Moved rstc just after the bus_master field in struct vsp1_device * RFC: * https://patchwork.kernel.org/project/linux-renesas-soc/patch/20220112174612.10773-21-biju.das.jz@bp.renesas.com/ --- drivers/media/platform/vsp1/vsp1.h | 1 + drivers/media/platform/vsp1/vsp1_drv.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h index 37cf33c7e6ca..c5da829c79b5 100644 --- a/drivers/media/platform/vsp1/vsp1.h +++ b/drivers/media/platform/vsp1/vsp1.h @@ -79,6 +79,7 @@ struct vsp1_device { void __iomem *mmio; struct rcar_fcp_device *fcp; struct device *bus_master; + struct reset_control *rstc; struct vsp1_brx *brs; struct vsp1_brx *bru; diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index 502c7d9d6890..77da6a6732d8 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -569,7 +570,19 @@ static void vsp1_mask_all_interrupts(struct vsp1_device *vsp1) */ int vsp1_device_get(struct vsp1_device *vsp1) { - return pm_runtime_resume_and_get(vsp1->dev); + int ret = reset_control_deassert(vsp1->rstc); + + if (ret < 0) + goto err; + + ret = pm_runtime_resume_and_get(vsp1->dev); + if (ret < 0) + goto err; + + return 0; +err: + reset_control_assert(vsp1->rstc); + return ret; } /* @@ -581,6 +594,7 @@ int vsp1_device_get(struct vsp1_device *vsp1) void vsp1_device_put(struct vsp1_device *vsp1) { pm_runtime_put_sync(vsp1->dev); + reset_control_assert(vsp1->rstc); } /* ----------------------------------------------------------------------------- @@ -827,6 +841,11 @@ static int vsp1_probe(struct platform_device *pdev) if (irq < 0) return irq; + vsp1->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); + if (IS_ERR(vsp1->rstc)) + return dev_err_probe(&pdev->dev, PTR_ERR(vsp1->rstc), + "failed to get reset ctrl\n"); + /* FCP (optional). */ fcp_node = of_parse_phandle(pdev->dev.of_node, "renesas,fcp", 0); if (fcp_node) { From patchwork Wed Mar 9 19:45:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 12775537 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 891E3C433EF for ; Wed, 9 Mar 2022 19:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238010AbiCITqg (ORCPT ); Wed, 9 Mar 2022 14:46:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238003AbiCITqf (ORCPT ); Wed, 9 Mar 2022 14:46:35 -0500 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 55B878E; Wed, 9 Mar 2022 11:45:36 -0800 (PST) X-IronPort-AV: E=Sophos;i="5.90,168,1643641200"; d="scan'208";a="113002341" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 10 Mar 2022 04:45:36 +0900 Received: from localhost.localdomain (unknown [10.226.92.47]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id B99F740DD852; Thu, 10 Mar 2022 04:45:33 +0900 (JST) From: Biju Das To: Mauro Carvalho Chehab , Philipp Zabel Cc: Biju Das , Laurent Pinchart , Kieran Bingham , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , Chris Paterson , Biju Das , Prabhakar Mahadev Lad Subject: [PATCH 3/3] media: vsp1: Add support for RZ/G2L VSPD Date: Wed, 9 Mar 2022 19:45:21 +0000 Message-Id: <20220309194521.7028-4-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220309194521.7028-1-biju.das.jz@bp.renesas.com> References: <20220309194521.7028-1-biju.das.jz@bp.renesas.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The RZ/G2L VSPD provides a single VSPD instance. It has the following sub modules MAU, CTU, RPF, DPR, LUT, BRS, WPF and LIF. The VSPD block on RZ/G2L does not have a version register, so added a new compatible string "renesas,vsp2-rzg2l" with a data pointer containing the info structure. Also the reset line is shared with the DU module so devm_reset_control_get_shared() call is used in case of RZ/G2L. Signed-off-by: Biju Das Reviewed-by: Lad Prabhakar --- RFC->v1: * Used data pointer containing info structure to retrieve version information RFC: * https://patchwork.kernel.org/project/linux-renesas-soc/patch/20220112174612.10773-21-biju.das.jz@bp.renesas.com/ --- drivers/media/platform/vsp1/vsp1_drv.c | 32 +++++++++++++++++++------ drivers/media/platform/vsp1/vsp1_lif.c | 7 ++++-- drivers/media/platform/vsp1/vsp1_regs.h | 1 + 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index 77da6a6732d8..40c6d9290681 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -811,6 +811,14 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .uif_count = 2, .wpf_count = 1, .num_bru_inputs = 5, + }, { + .version = VI6_IP_VERSION_MODEL_VSPD_RZG2L, + .model = "VSP2-D", + .gen = 3, + .features = VSP1_HAS_BRS | VSP1_HAS_WPF_VFLIP | VSP1_HAS_EXT_DL, + .lif_count = 1, + .rpf_count = 2, + .wpf_count = 1, }, }; @@ -841,7 +849,14 @@ static int vsp1_probe(struct platform_device *pdev) if (irq < 0) return irq; - vsp1->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); + vsp1->info = of_device_get_match_data(&pdev->dev); + if (vsp1->info) { + vsp1->version = vsp1->info->version; + vsp1->rstc = devm_reset_control_get_shared(&pdev->dev, NULL); + } else { + vsp1->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); + } + if (IS_ERR(vsp1->rstc)) return dev_err_probe(&pdev->dev, PTR_ERR(vsp1->rstc), "failed to get reset ctrl\n"); @@ -874,13 +889,15 @@ static int vsp1_probe(struct platform_device *pdev) if (ret < 0) goto done; - vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION); + if (!vsp1->info) { + vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION); - for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) { - if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) == - vsp1_device_infos[i].version) { - vsp1->info = &vsp1_device_infos[i]; - break; + for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) { + if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) == + vsp1_device_infos[i].version) { + vsp1->info = &vsp1_device_infos[i]; + break; + } } } @@ -943,6 +960,7 @@ static int vsp1_remove(struct platform_device *pdev) static const struct of_device_id vsp1_of_match[] = { { .compatible = "renesas,vsp1" }, { .compatible = "renesas,vsp2" }, + { .compatible = "renesas,vsp2-rzg2l", .data = &vsp1_device_infos[14] }, { }, }; MODULE_DEVICE_TABLE(of, vsp1_of_match); diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c index 6a6857ac9327..6e997653cfac 100644 --- a/drivers/media/platform/vsp1/vsp1_lif.c +++ b/drivers/media/platform/vsp1/vsp1_lif.c @@ -107,6 +107,7 @@ static void lif_configure_stream(struct vsp1_entity *entity, case VI6_IP_VERSION_MODEL_VSPDL_GEN3: case VI6_IP_VERSION_MODEL_VSPD_V3: + case VI6_IP_VERSION_MODEL_VSPD_RZG2L: hbth = 0; obth = 1500; lbth = 0; @@ -135,8 +136,10 @@ static void lif_configure_stream(struct vsp1_entity *entity, * may appear on the output). The value required by the manual is not * explained but is likely a buffer size or threshold. */ - if ((entity->vsp1->version & VI6_IP_VERSION_MASK) == - (VI6_IP_VERSION_MODEL_VSPD_V3 | VI6_IP_VERSION_SOC_V3M)) + if (((entity->vsp1->version & VI6_IP_VERSION_MASK) == + (VI6_IP_VERSION_MODEL_VSPD_V3 | VI6_IP_VERSION_SOC_V3M)) || + ((entity->vsp1->version & VI6_IP_VERSION_MASK) == + VI6_IP_VERSION_MODEL_VSPD_RZG2L)) vsp1_lif_write(lif, dlb, VI6_LIF_LBA, VI6_LIF_LBA_LBA0 | (1536 << VI6_LIF_LBA_LBA1_SHIFT)); diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h index fae7286eb01e..12c5b09885dc 100644 --- a/drivers/media/platform/vsp1/vsp1_regs.h +++ b/drivers/media/platform/vsp1/vsp1_regs.h @@ -766,6 +766,7 @@ #define VI6_IP_VERSION_MODEL_VSPD_V3 (0x18 << 8) #define VI6_IP_VERSION_MODEL_VSPDL_GEN3 (0x19 << 8) #define VI6_IP_VERSION_MODEL_VSPBS_GEN3 (0x1a << 8) +#define VI6_IP_VERSION_MODEL_VSPD_RZG2L (0x1b << 8) #define VI6_IP_VERSION_MODEL_VSPD_V3U (0x1c << 8) #define VI6_IP_VERSION_SOC_MASK (0xff << 0)