From patchwork Wed Sep 11 15:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3438 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2ACC842E8A for ; Wed, 11 Sep 2024 17:10:51 +0200 (CEST) Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-3787ea79dcesf3411088f8f.2 for ; Wed, 11 Sep 2024 08:10:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067451; cv=pass; d=google.com; s=arc-20240605; b=UbTUWjzTAefIOjOo0OWcwDtmEhRUVxUgJuuQpX3quBViV7zF2gfOA8ykvPpCHsiZzf 8tJDpkvl26yEAap0eJHv1xIoWkxVakfLnmS3BdCQkylTYiU6P6r/7Qn9DgCEhNBV1YTW 33ZVfF1G7nF6VUbt/ccklNMNEaRCcW2XMVfjuA6P4xInbeaaN/Tm8de/amnaiapOM77T tQNqDZBtiWFEibHUWiHTBwSyozkQTspvArmPv0WXdlnhC39xBu0uT1GDYYeJ2dXlZw5A yWYlW0vRqLNiswhKsfQUGa/Msny3DvsmT3N17dGgwkGdVR/gpwLNrUGp4jsSzFNh6tpl mBVg== 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:to:from:dkim-signature; bh=mWDufPksGEYToewnG+IsiEC6GijPyIJfwVUHg9uQVd4=; fh=ixXYVobIRgYIaj4Cl4sN/sYoP3f7MsMBXsiME40Lewo=; b=NfnHXCRopvoriGSeVf08WVcqD7Gn5/pqX68Ow6H9+8hgcCZ7OadY0+DplPzo0eWl5v Gp4xsefKG5MwtMpL9oCAuvDFsVPOXLn4jLR5DeOXmGaO9pAcL4Gy0+/3u4Ew8S5tpklu W4iYMpUjZWBttTvzjxMbYCZLyWxQ81DGi9UVGuq0DT0/sW1V3kCZs3QoAvPbFhdXRszA 0rdsAmjE6ieZFRwQp4RsDica4X6UV+dBhOQ71Xfua/nOk6HEoo31YWDMXIEjSjkoDiQN YXC8Ve8Rk0HO/nTsYO94YBSqG0H1AEnHC/qWxzef4AmS+YyaHUH0RI4OhICoHljroRDK 4+JA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gOlhhVIs; 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=1726067451; x=1726672251; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=mWDufPksGEYToewnG+IsiEC6GijPyIJfwVUHg9uQVd4=; b=NdTY01BvC6Eb4/qp67smd8KdqZfCRNh6Nlpw+urGs7/BdrFAyer6cahlbv8TQY/XMj p6+r/ioEaUR0duOZWm37cTpYYMHxAykaGuDRidjz1cLSpnkHxg4JiHYqM5d1FCgu14mJ DsJIWCFkH/eFM6jgP4sd7L8lrFVddMxKukfqs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067451; x=1726672251; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mWDufPksGEYToewnG+IsiEC6GijPyIJfwVUHg9uQVd4=; b=AeXGFsxQz0ebZ4jOAaotGa9Qu5If+t6BMMXvIUYTtwWHC5oqYQ5H82bQFJ6+FJFRHR vBroBX+hBx2JucRboD+rrIb1YkmmxZ3jKX9vGvn3IF55rKCBOl9flyM8nJf673EqA8fL p1by5Gp1wVCcmZnM8XwkmVaLptCJrcsVHXL0uQkRIK47+EMS2wY6ZPLihp4q/0Ar6LjB K7wYGlYXwJt05s68jtp1gLAfF/LPWtWvrEtlU4XMcCm4QOeZ0pytnHDXCy4VjlrmXfXk by6pCc9CiOgrMNYMSKFOROuawmC2btLFIaqwwEgL439GPgpuL7EDpDh/n3aQyonKA5hr hamg== X-Forwarded-Encrypted: i=2; AJvYcCVrs26t6LRUnO4YrHx3mtavimdKY5A/Y6JBks1PBx98C1fDdE+YfKbz78hYPez6fqDKlt/y4ifvpYiFbJ2x@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YzW404o0/ikyG09jba7zMFocaMQLi/tCQex2XNL87METrJvB0yc 1UP8UbNYdYm4nCvgpK2czI4MFXt0yARJpihSmumApU2EL/dKHR1E28CMI2LJ0lX5IA== X-Google-Smtp-Source: AGHT+IGHnmxrKCxYlKUa67yhzU43wXN8nXND6CHe+24v6X8FTt1Xn4hnfeORQwiLWI/oNYTQx35PrA== X-Received: by 2002:a05:6000:188d:b0:378:7f65:e13a with SMTP id ffacd0b85a97d-378949ef5ffmr10536132f8f.2.1726067450663; Wed, 11 Sep 2024 08:10:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:1913:b0:42c:af5b:fabd with SMTP id 5b1f17b1804b1-42cdb168be7ls65065e9.1.-pod-prod-06-eu; Wed, 11 Sep 2024 08:10:49 -0700 (PDT) X-Received: by 2002:a05:600c:1e10:b0:426:6e95:78d6 with SMTP id 5b1f17b1804b1-42cae709278mr105892505e9.4.1726067448654; Wed, 11 Sep 2024 08:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067448; cv=none; d=google.com; s=arc-20160816; b=M/eKbzqYKqM2yYqawstczH7GvpE07i3ahVV57Z/0AxkBTqLpk0bjxBYevdIKulmTpc 1Y9Vpy+3mxi4PPvfxi7lQdAvPgVEmL1ZA0G9JAZ8aN+10zwcycQv2O22bEIXiIzaRVvN 0bZpiEfzxaV4wOsckBs8kLQleN17cmxV5tsSHtUjAOEbtE1sb7auB7QgW0f9q78ffI0Y uaTRmb8ZMOVMGPu1YzWZDazhyQSf3Dk/5GXYa7fgpmfJD9wbPcT1FTI1e/kl4sG4fCb4 Os6qVgCM35GWDiiCcob6IvWiJFBHezm0EqFz+yndNI9o5+WrNx0pBhw968BmjUI5Kv10 Au4Q== 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:to:from:dkim-signature; bh=oaGGzg1ZcW8MunpfHTSkfDsZrsx9ImjK3JuQuUVolOE=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=eG9LvzV6bdoXz8SJNtYQuxxfocQ28+CpAM8c+MyiftAzlYmcnc1B+aAd0gWbK2t4g6 f9KYovm0JM0AlUZVwpdCI3iyHfsy0qPMFDPnVOXryyXB3p8u38YKqD8MW4GzxIsKYcdb FdESG/1/UIDd+mBGGAjcogFf6a8RdXrg1gvmC74PIElHAv96JFylV8HXjaLYitIdvRU4 gvivd/A6ix86rsMGWIgh+NdkTf1LCJgKH6KtdGCo6tMB9h7Nrl9QT46zfF9zCYG1RKcz ATLZVPJ7j0Q1dCAUkCjmCiEE6BtVlN4AIdaOQqnW3Llhe0oSV8R9r2C6l5m5aFzPRxbD uiKg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gOlhhVIs; 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 5b1f17b1804b1-42caf2b1c4dsor23626015e9.6.2024.09.11.08.10.48 for (Google Transport Security); Wed, 11 Sep 2024 08:10:48 -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-Received: by 2002:a05:600c:5107:b0:426:5ef5:bcb1 with SMTP id 5b1f17b1804b1-42cae709f0cmr93661215e9.6.1726067447964; Wed, 11 Sep 2024 08:10:47 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42cb116f44esm137688375e9.45.2024.09.11.08.10.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:47 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 08/27] clk: imx8mn: add video clocks support Date: Wed, 11 Sep 2024 17:10:20 +0200 Message-ID: <20240911151039.2914886-8-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151039.2914886-1-dario.binacchi@amarulasolutions.com> References: <20240911151039.2914886-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=gOlhhVIs; 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 --- drivers/clk/imx/clk-imx8mn.c | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 31d2faa97a3e..089f5169da1a 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", }; @@ -44,6 +45,34 @@ 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_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", }; @@ -148,6 +177,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; @@ -188,8 +221,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, @@ -217,6 +261,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)); @@ -373,6 +420,31 @@ 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));