From patchwork Fri Sep 13 09:55:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3475 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C5F53411AB for ; Fri, 13 Sep 2024 11:57:11 +0200 (CEST) Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-536589936d3sf1685262e87.0 for ; Fri, 13 Sep 2024 02:57:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221431; cv=pass; d=google.com; s=arc-20240605; b=j7mWDzY1urWowwnx2P3Wf1pGPMYtXYudV1svbOHXtxJ9WUHTcNHr2v0AcneCDe3zRd ce2//MN+cd3IAdP7IHnPjPMQQWkBOmzrZMd5JYEZI72HcD3HqT85c4RxFOOcoIYaIQQk mvdIind5ntLsDEj5wj+Z9ptVbxeFeyW7dZCp375DhIhoorOCWvtzjRPU3IhoIkmzW/+2 gRZ1NsH+asXDuXGmOpfCVVeMmTiBKFYrxpk2txQJREDxjPFtu/11ORHKMfR6nWAxZ7BZ vDAfNbe8O26JMTdyZjXNgc26hmQU31e2484ncESbqTT1DFuBSKSIF3adGyL783bN7F/Y vGXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=vfNvEepGLyY7HQt6oAySjIBwdiRXE9Tu/8D4qfyVq98=; fh=1iD/KuvhfUC38qn2fOJYCQs+DMD1Yklhen3OminBYAM=; b=O3DcwLyPxz5oUKCSRb/ltu4W+t23sCIukLPEQkIzcybtMnA3NiQ4o/OEPmREFkQRVt nmii3AG+e8lOBHdtWwRipyVCV6KTa1pLzB4Dj19BldX6oMpiZ5FJEa10A48tIPpK6jsK GRF4UjcrZ9Pku/rOrnM+0jxCLsoa+h2YN9k5vEhcUW3j7o9F9Xzgpo1IdeS+vcvByycj jh1NbShlZQA1/YWmvGAOVGulL3zuME9J25rQt3Fj+YLcuWpyfMgJNjw6Ux3KI8NKcbR4 CVU4Ft/acbHh8ms524NdWPaqsIp2Wvg4Ipe36GXMZitmUBTuL+lFXlX6jzInF8mlXHru EpCw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AiLYp8ha; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1726221431; x=1726826231; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=vfNvEepGLyY7HQt6oAySjIBwdiRXE9Tu/8D4qfyVq98=; b=V5wrhB6/H70g+TvyGrT5dGncqUetAEhghRRlPKvEbQ75CerDdeh/J02u4zx0pjqFko PMaWlhJzuNUKxbDHwEaxADd4ly7zPeOefmU6AlEmWDGyLzmawK62ASKy6jWnVJ6KL0h2 wFTOjxfUT+TVkyCWIH5maoPnlZbBKO1nycbZI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221431; x=1726826231; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vfNvEepGLyY7HQt6oAySjIBwdiRXE9Tu/8D4qfyVq98=; b=b4apgVvOT1M86b5OMiOSK3QdizQPTW6BEaXUdLV8+RxDj261sfhTpO6mLBwhqng2jn 1XjFA243cYdvsFUYRhFvRbf1CD46ojex/9zReLRohhOF7Xv0LeyV6KlvJvq1bmDr+n97 8REzUNktjlqaH5cFSSKQPBFEtweqRFEPPQCjSBFhNSK4gv8cYSGCEOFAEv/D5rQJFSE7 qVHY5KMSGVuHOUel2VQJ3Y230hfumvet4gfRst5qDzE97bAS2E52t3WbSm90AzNjO+hv XNZ6PQpV3/fCJXtjU8mu/SQSbp5H6fumBWFkVCf1jhITceB8PFKdbmlEJ5tke9USleW8 KWlw== X-Forwarded-Encrypted: i=2; AJvYcCVH/31TQ6l0JJB7fr2A4zr5mfJBuvJX/3i8xDWyS0BVtAPHqTiRJ5cyIHwdAJWZyxOcP3Cijh83zXtnJMTa@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx8E+rmOqxyJEomTpB6bC7F8VpTnmRmWEKQrQdl82sYpCCIB9yY uVFfOPlxoYgk5wienMVHMjaGNbYflXEQxkCPx0BvUXoBZizPyn38zPXx+zuqHN33jQ== X-Google-Smtp-Source: AGHT+IG/a9ACGKVpgDvC3UCcGv9O4p+/edg/iP/+I5cURRAhupkTHveFfl63Z7VDdEYi1uB+CoawSw== X-Received: by 2002:a05:6512:3f0d:b0:52b:bf8e:ffea with SMTP id 2adb3069b0e04-53678feb0f9mr3926673e87.40.1726221431055; Fri, 13 Sep 2024 02:57:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:ea5:b0:52f:c300:1e1f with SMTP id 2adb3069b0e04-53678f630c4ls934710e87.1.-pod-prod-02-eu; Fri, 13 Sep 2024 02:57:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVLjX/pVeTqPL7v0VBJBKRdxo5dAcxvmSf0dBYqMe/KcSFXrin+grmuTV0iHVAQ1zP9yrwImGxXYRY9jQe3@amarulasolutions.com X-Received: by 2002:a05:6512:3b0e:b0:536:55ae:7444 with SMTP id 2adb3069b0e04-53678fba506mr3862974e87.22.1726221429240; Fri, 13 Sep 2024 02:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221429; cv=none; d=google.com; s=arc-20160816; b=SLJYGRd452QdExhAfrveXUGXuf/ZQYO/kWs+ARPAgU8PPN4+ayrOnYSFjSJKwGxzrt IjvN84TRkKgCbNUI7lySuafMo0uepNWdQ8DQG9/Ouv2Lct7/h9plUfKAytuFnhjSdzhu DtmjqTPorwOWtRohrEYX5ODVztRIfU+J0yCOtWQWEp3USRAhdqX5Wx7wd9HdYI9/ESZm 4z9uVbHVVRIf1mqRHbks+W4zON8FnwxJttO8kVfz+tzLyAyn/aVRGYtcvuyneQq+oLj3 H+jqrUo0JN8vxf1tZHH6dNvcpxr6LccgEBJ4agaREcrwjUc6umK7U1LA3tNGAARWJcfy 58GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=tkMh91Hn86vFyByeQQFNsm5+zhBASEKSgno6mbETJI4=; fh=A9i34bCcdP2YZTwOHnjDd49K8lUgC+Zb0XjBvKK2Hd0=; b=HkIR3tT5kuOOOCvSgeO2SRVo92vNSgPnK+jhkrLQvT8n62xrrpk8W2qWF4sKHUeW64 VtUqxEXWpwTGAnbFIx048jF/fLxWCknoJdWlYFrJktH6h3cbXpyc6KAGTzzHKqKRI63S yeu2kQL3ZfhVFsPr7EcFUB9nxb5sRIYbKll06m5+Ao4+Swf7bEN1qEBA3o0KNT5ZhHFa AsXuPnWXrvONw3Fnv2wieP/I7F7C6AerALD6Mb723q+6SbP3NPLVCWhybkfrLdhMyl59 Eh6wnyAx4QM2WISJLbIc0VC+J8mX6k9NGSvPTrr/dx3ClEKXXk/fCwfMsD63EVYqN3Bs bYMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AiLYp8ha; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 2adb3069b0e04-5365f86feccsor4461353e87.10.2024.09.13.02.57.09 for (Google Transport Security); Fri, 13 Sep 2024 02:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCVyAoJCBwykkszZnAQPaGfYepehUStzDljOTTZ3efhTogoukozHn4j6/Wp2nq/sG9Kmxbt4CSQnEOTQUYTa@amarulasolutions.com X-Received: by 2002:a05:6512:3d23:b0:52c:99c9:bef6 with SMTP id 2adb3069b0e04-53678fb1929mr3438130e87.7.1726221427752; Fri, 13 Sep 2024 02:57:07 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:07 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Fabio Estevam , Hou Zhiqiang , Lukasz Majewski , Nicolas Heemeryck , Sean Anderson , Tom Rini Subject: [PATCH 07/26] clk: imx8mn: add video clocks support Date: Fri, 13 Sep 2024 11:55:49 +0200 Message-ID: <20240913095622.72377-8-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=AiLYp8ha; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi Add clocks support for the video subsystem. Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/clk/imx/clk-imx8mn.c | 97 +++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 7 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 449ebf2d0733..7ea4c90fa137 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -17,6 +17,7 @@ static u32 share_count_nand; static const char * const pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", }; +static const char * const video_pll_bypass_sels[] = {"video_pll", "video_pll_ref_sel", }; static const char * const dram_pll_bypass_sels[] = {"dram_pll", "dram_pll_ref_sel", }; static const char * const arm_pll_bypass_sels[] = {"arm_pll", "arm_pll_ref_sel", }; static const char * const sys_pll1_bypass_sels[] = {"sys_pll1", "sys_pll1_ref_sel", }; @@ -47,17 +48,52 @@ static const char * const imx8mn_enet_axi_sels[] = {"clock-osc-24m", "sys_pll1_2 "video_pll_out", "sys_pll3_out", }; #ifndef CONFIG_SPL_BUILD -static const char * const imx8mn_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", - "sys_pll2_100m", "sys_pll1_160m", "audio_pll1_out", +static const char * const imx8mn_disp_axi_sels[] = {"clock-osc-24m", "sys_pll2_1000m", + "sys_pll1_800m", "sys_pll3_out", "sys_pll1_40m", + "audio_pll2_out", "clk_ext1", "clk_ext4", }; + +static const char * const imx8mn_disp_apb_sels[] = {"clock-osc-24m", "sys_pll2_125m", + "sys_pll1_800m", "sys_pll3_out", "sys_pll1_40m", + "audio_pll2_out", "clk_ext1", "clk_ext3", }; + +static const char * const imx8mn_disp_pixel_sels[] = {"clock-osc-24m", "video_pll_out", + "audio_pll2_out", "audio_pll1_out", + "sys_pll1_800m", "sys_pll2_1000m", + "sys_pll3_out", "clk_ext4", }; + +static const char * const imx8mn_dsi_core_sels[] = {"clock-osc-24m", "sys_pll1_266m", + "sys_pll2_250m", "sys_pll1_800m", + "sys_pll2_1000m", "sys_pll3_out", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_dsi_phy_sels[] = {"clock-osc-24m", "sys_pll2_125m", + "sys_pll2_100m", "sys_pll1_800m", + "sys_pll2_1000m", "clk_ext2", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_dsi_dbi_sels[] = {"clock-osc-24m", "sys_pll1_266m", + "sys_pll2_100m", "sys_pll1_800m", + "sys_pll2_1000m", "sys_pll3_out", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_camera_pixel_sels[] = {"clock-osc-24m", "sys_pll1_266m", + "sys_pll2_250m", "sys_pll1_800m", + "sys_pll2_1000m", "sys_pll3_out", + "audio_pll2_out", "video_pll_out", }; + +static const char * const imx8mn_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", + "sys_pll2_50m", "sys_pll2_100m", + "sys_pll1_160m", "audio_pll1_out", "video_pll_out", "clk_ext4", }; -static const char * const imx8mn_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out", - "clk_ext1", "clk_ext2", "clk_ext3", - "clk_ext4", "video_pll_out", }; +static const char * const imx8mn_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", + "audio_pll1_out", "clk_ext1", "clk_ext2", + "clk_ext3", "clk_ext4", "video_pll_out", }; static const char * const imx8mn_enet_phy_sels[] = {"clock-osc-24m", "sys_pll2_50m", "sys_pll2_125m", - "sys_pll2_200m", "sys_pll2_500m", "audio_pll1_out", - "video_pll_out", "audio_pll2_out", }; + "sys_pll2_200m", "sys_pll2_500m", + "audio_pll1_out", "video_pll_out", + "audio_pll2_out", }; #endif static const char * const imx8mn_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", @@ -151,6 +187,10 @@ static const char * const imx8mn_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_10 "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", "clk_ext3", "audio_pll2_out", }; +#ifndef CONFIG_SPL_BUILD +static unsigned int share_count_disp; +#endif + static int imx8mn_clk_probe(struct udevice *dev) { struct clk osc_24m_clk; @@ -191,8 +231,19 @@ static int imx8mn_clk_probe(struct udevice *dev) clk_dm(IMX8MN_SYS_PLL3, imx_clk_pll14xx("sys_pll3", "sys_pll3_ref_sel", base + 0x114, &imx_1416x_pll)); + clk_dm(IMX8MN_VIDEO_PLL_REF_SEL, + imx_clk_mux("video_pll_ref_sel", base + 0x28, 0, 2, + pll_ref_sels, ARRAY_SIZE(pll_ref_sels))); + clk_dm(IMX8MN_VIDEO_PLL1, + imx_clk_pll14xx("video_pll", "video_pll_ref_sel", + base + 0x28, &imx_1443x_pll)); /* PLL bypass out */ + clk_dm(IMX8MN_VIDEO_PLL_BYPASS, + imx_clk_mux_flags("video_pll_bypass", base + 0x28, 16, 1, + video_pll_bypass_sels, + ARRAY_SIZE(video_pll_bypass_sels), + CLK_SET_RATE_PARENT)); clk_dm(IMX8MN_DRAM_PLL_BYPASS, imx_clk_mux_flags("dram_pll_bypass", base + 0x50, 4, 1, dram_pll_bypass_sels, @@ -220,6 +271,9 @@ static int imx8mn_clk_probe(struct udevice *dev) CLK_SET_RATE_PARENT)); /* PLL out gate */ + clk_dm(IMX8MN_VIDEO_PLL_OUT, + imx_clk_gate("video_pll_out", "video_pll_bypass", + base + 0x28, 13)); clk_dm(IMX8MN_DRAM_PLL_OUT, imx_clk_gate("dram_pll_out", "dram_pll_bypass", base + 0x50, 13)); @@ -376,6 +430,35 @@ static int imx8mn_clk_probe(struct udevice *dev) /* clks not needed in SPL stage */ #ifndef CONFIG_SPL_BUILD + clk_dm(IMX8MN_CLK_DISP_AXI, + imx8m_clk_composite("disp_axi", imx8mn_disp_axi_sels, base + 0x8a00)); + clk_dm(IMX8MN_CLK_DISP_APB, + imx8m_clk_composite("disp_apb", imx8mn_disp_apb_sels, base + 0x8a80)); + clk_dm(IMX8MN_CLK_DISP_PIXEL, + __imx8m_clk_composite("disp_pixel", imx8mn_disp_pixel_sels, base + 0xa500, + CLK_SET_RATE_PARENT)); + clk_dm(IMX8MN_CLK_DSI_CORE, + imx8m_clk_composite("dsi_core", imx8mn_dsi_core_sels, base + 0xbb00)); + clk_dm(IMX8MN_CLK_DSI_PHY_REF, + imx8m_clk_composite("dsi_phy_ref", imx8mn_dsi_phy_sels, base + 0xbb80)); + clk_dm(IMX8MN_CLK_DSI_DBI, + imx8m_clk_composite("dsi_dbi", imx8mn_dsi_dbi_sels, base + 0xbc00)); + clk_dm(IMX8MN_CLK_CAMERA_PIXEL, + imx8m_clk_composite("camera_pixel", imx8mn_camera_pixel_sels, base + 0xbd00)); + + clk_dm(IMX8MN_CLK_DISP_AXI_ROOT, + imx_clk_gate2_shared2("disp_axi_root_clk", "disp_axi", base + 0x45d0, 0, + &share_count_disp)); + clk_dm(IMX8MN_CLK_DISP_APB_ROOT, + imx_clk_gate2_shared2("disp_apb_root_clk", "disp_apb", base + 0x45d0, 0, + &share_count_disp)); + clk_dm(IMX8MN_CLK_CAMERA_PIXEL_ROOT, + imx_clk_gate2_shared2("camera_pixel_clk", "camera_pixel", base + 0x45d0, 0, + &share_count_disp)); + clk_dm(IMX8MN_CLK_DISP_PIXEL_ROOT, + imx_clk_gate2_shared2("disp_pixel_clk", "disp_pixel", base + 0x45d0, 0, + &share_count_disp)); + clk_dm(IMX8MN_CLK_ENET_REF, imx8m_clk_composite("enet_ref", imx8mn_enet_ref_sels, base + 0xa980));