From patchwork Wed Sep 11 15:10:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3433 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D981F42E8A for ; Wed, 11 Sep 2024 17:10:45 +0200 (CEST) Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-374b69e65e8sf910114f8f.0 for ; Wed, 11 Sep 2024 08:10:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067445; cv=pass; d=google.com; s=arc-20240605; b=RAMaOInzqauD3qT5L2DBHF211FUUVgrdGKu+fryG63DoJ4Y+bfmEzKWnIqRttZPxYX DzVmD2fO2/LKAlvQ/pmatWUo7L7Ll0Im0o5XLNKQBD6nki+IXp6ggGbVXRd83tIzYE3b yNz9R4uCItftViaGWfyBLNnSgkpolXV8Y8XzPiVHXtK42pru76whpu07uwpmCKWKUcxD 8nFx9EQgj+5iAEDfZ8Ppcm3Sfge7XoT2KGXIgw96ou8cz9j3HWC/KUra1x1EWQYIs19U JYxkFxEp/n2vhRepVC92EZ5m7Qw0bDsUM834qDbpEhqDM/fXwjCaSPh1H28xIU1upmrs S4Pg== 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=FrXBIv97q4vE3yaXHAQ60FgMBVSGB9SS/gXweDthaSQ=; fh=JGngl2qfq7eir61fTQb0iGI8lmlWX7+yCG0HwMWsnXA=; b=Cn9/WObTjh/NM2phVjy61pI2i8u20MMxcGveACL5LPhBEGbi7Fv3+dA5aLwIXAVvAU SJXyznSuiPB5dGhuKwvymLiXcy1yjgMkN0HybzQMbg5lh3GP6bB0xurjdIc1xOJ+DITT 4i+7n9IJ1Y/szd+QX6Jw3fLAV7e8BAvSWopDqPJ0A5v0GNoCcp9PRVUqlpcVCWRQgcDW 93TEqwds8l0U8/uyLpLjUGjgLYpIhq3SY58xFj86K9Z+PtG8FvWVK70crHf6unfAl8Ti hj/g3ZkSTOnwKodziMF00ghpo/zf23+3PxkP7nS0Y6LNLZDCU8lgNzr3SEcy+ZN4qFBu HcLg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YWULq8T8; 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=1726067445; x=1726672245; 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=FrXBIv97q4vE3yaXHAQ60FgMBVSGB9SS/gXweDthaSQ=; b=bJgoY1Ezgj08f2cguLlRNsCq1lZMhJoMF1jEHsUUW610HbIrt659LX3J49RmV6t5HG P/GwfgTUASBziqyBhyIul1tpYr3OJCggjm/pWU62zbHwoBp9cSm3TXE2GURTcCEZ31a/ lZFy2ufJErxrwweMeIVtkmYFK60S4RAmK+jBg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067445; x=1726672245; 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=FrXBIv97q4vE3yaXHAQ60FgMBVSGB9SS/gXweDthaSQ=; b=sePEcxSpRyjcxdmUawyRdl8eDfvGVsty0JNPo/kRPAAyiIkomSmA8VzBPdr57bmouW +6QnDRAXk5c96DDOOhhQf/BL32G8a758ItXWbZ7tciblPVM3Ks5HFuD2EdI56slALOOe NNHMsvtU8fFe4owvGhfn01U/SpIz3z9pQIcKO7oNZW5/47+gQBPX8bOL2sKdCRsu555G eogFfahbL6IQ7jhKJicUDQCRntDG38vRjVRiLvtnqebwggy4DHZDa48O5rd+gIXKlOMw D6LvOkM3oXmfFM+5v6BHXURkk1sHAzZJU8nnjwtx2mwNU0OAB2Ji29WwekGVQPBJOCO4 Oo3Q== X-Forwarded-Encrypted: i=2; AJvYcCW50HO8K2Kerpd1OlGAZzfORb92qrzYZeeASbcilW278Qo7V+A9LL8MC5btgTq1xmBEMChFUsqtlPRbQ4tX@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yy7ZuN3ObAsfVW5qiyo+Gb4IQfsDxxGi49DhySQe/ZOWTgI7r8I VlS5ZKppny/r/6MTZ5xrt2EFA37WeR+O8uFJ9PRy/aTd6BQFZuD4+xAnPHUy1UgFlw== X-Google-Smtp-Source: AGHT+IH2GR8HzPdkGwyELM3mBQxpIvkIdV5vHR/bX2x55C4s2MMJO9SsTviAA1Em+ffScl+Yg8NGlg== X-Received: by 2002:adf:eb8b:0:b0:371:88b9:256d with SMTP id ffacd0b85a97d-378b07966f2mr2202759f8f.6.1726067445413; Wed, 11 Sep 2024 08:10:45 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:564b:0:b0:374:d287:ec15 with SMTP id ffacd0b85a97d-378a8b7ac34ls617885f8f.1.-pod-prod-03-eu; Wed, 11 Sep 2024 08:10:44 -0700 (PDT) X-Received: by 2002:adf:dd84:0:b0:375:56ed:a3a0 with SMTP id ffacd0b85a97d-378b07feb88mr2213312f8f.43.1726067443813; Wed, 11 Sep 2024 08:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067443; cv=none; d=google.com; s=arc-20160816; b=L23F6Eh6MwtGpYmIZen2irPJLs6FyzOq8vH+RYTWichuD9s+YzGpWXi0yV/yxpJuWW 1YYFA7G2Ehlhht7hi019Fo/p0asR4bePoXachmBeNbSNrfWdDWPQJrvfA99D4q0HHWnR C6G8ujpQY+ZL6ock2Yd1Fa0HXXS2yf+AVNNUI0Y4wX3nErDhVmaAE/N5HQ5cxgo/t2uf 23O01tpxyP4Dz9HTDzAYFN45V+HdDCYPEnQKAU4OJiRUy3ptphkeRBsCIvrHpvh24pj3 QbdeZil6cJb9gaMweAKnqXGwqJSWVUgMzPpqfK8A2B+8mkOkogTrxkXX/cHOczHB0ZZj ftQg== 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=jDWptbH9w/9zBY+KHy9Xv9lgS/KNlcO7NFqasYaIoQ0=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=C7DzvnynspQyGqx62mjMN9Y7mq4ndkoe9SdWZ92bOY6W4aavCOvC4ITD+J1jgmwwi1 LJXFQTvfUpcaOP0iiyrC6YJ6Tuw/h5phKLxwnPFp1DegFzNk+Wq7YtScIqKp+Ymlq9M2 sgnGXIqiEfrxVLOt0bArjEtdGe4fe8HfE2Fmmr5O+DYU4+1dERZYUVuvzQMKGnnpaaeH MyXppGVrkHXoNZnOD2mBpD1HPCb7yNbQldKZIzM77V4LEQbhf1OxRAkwAsPUvnlH6WRW 7IiXrnqCgwtQCJFjKe/c88Uuhzqi7y+3UwKYAtzCq8tyq6RbLfuWZ+5JzJ+2ke/50kOr dwHQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YWULq8T8; 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-42caf2b1b33sor36563855e9.5.2024.09.11.08.10.43 for (Google Transport Security); Wed, 11 Sep 2024 08:10:43 -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:4510:b0:42c:b309:8d18 with SMTP id 5b1f17b1804b1-42ccd32e264mr22843365e9.19.1726067442967; Wed, 11 Sep 2024 08:10:42 -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.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:10:42 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 03/27] clk: imx8mm: Prevent clock critical path from disabling during reparent and set_rate Date: Wed, 11 Sep 2024 17:10:15 +0200 Message-ID: <20240911151039.2914886-3-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=YWULq8T8; 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 This commit ensures that critical clock paths are not disabled during reparent and set_rate operations within the clock framework, paving the way for the inclusion of new features. Signed-off-by: Michael Trimarchi --- drivers/clk/imx/clk-imx8mm.c | 58 ++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c index e538f047b310..685e7df0e568 100644 --- a/drivers/clk/imx/clk-imx8mm.c +++ b/drivers/clk/imx/clk-imx8mm.c @@ -25,11 +25,23 @@ static const char * const imx8mm_a53_sels[] = {"clock-osc-24m", "arm_pll_out", " "sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m", "audio_pll1_out", "sys_pll3_out", }; +#ifndef CONFIG_SPL_BUILD +static const char * const imx8mm_noc_sels[] = {"clock-osc-24m", "sys_pll1_800m", "sys_pll3_out", + "sys_pll2_1000m", "sys_pll2_500m", "audio_pll1_out", + "video_pll1_out", "audio_pll2_out", }; + +static const char * const imx8mm_noc_apb_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll3_out", + "sys_pll2_333m", "sys_pll2_200m", "sys_pll1_800m", + "audio_pll1_out", "video_pll1_out", }; + static const char * const imx8mm_ahb_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_800m", "sys_pll1_400m", "sys_pll2_125m", "sys_pll3_out", "audio_pll1_out", "video_pll1_out", }; -#ifndef CONFIG_SPL_BUILD +static const char * const imx8mm_main_axi_sels[] = {"clock-osc-24m", "sys_pll2_333m", "sys_pll1_800m", + "sys_pll2_250m", "sys_pll2_1000m", "audio_pll1_out", + "video_pll1_out", "sys_pll1_100m",}; + static const char * const imx8mm_enet_axi_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_250m", "sys_pll2_200m", "audio_pll1_out", "video_pll1_out", "sys_pll3_out", }; @@ -45,6 +57,10 @@ static const char * const imx8mm_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2 static const char * const imx8mm_enet_phy_sels[] = {"clock-osc-24m", "sys_pll2_50m", "sys_pll2_125m", "sys_pll2_200m", "sys_pll2_500m", "video_pll1_out", "audio_pll2_out", }; + +static const char * const imx8mm_dram_apb_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", + "sys_pll1_160m", "sys_pll1_800m", "sys_pll3_out", + "sys_pll2_250m", "audio_pll2_out", }; #endif static const char * const imx8mm_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", @@ -133,6 +149,10 @@ static const char * const imx8mm_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_10 "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", "clk_ext3", "audio_pll2_out", }; +static const char * const imx8mm_gic_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", + "sys_pll2_100m", "sys_pll1_800m", "clk_ext2", + "clk_ext4", "audio_pll2_out" }; + #if CONFIG_IS_ENABLED(DM_SPI) static const char * const imx8mm_ecspi1_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", "sys_pll1_160m", "sys_pll1_800m", "sys_pll3_out", @@ -281,18 +301,30 @@ static int imx8mm_clk_probe(struct udevice *dev) imx_clk_divider2("arm_a53_div", "arm_a53_cg", base + 0x8000, 0, 3)); - clk_dm(IMX8MM_CLK_AHB, - imx8m_clk_composite_critical("ahb", imx8mm_ahb_sels, - base + 0x9000)); clk_dm(IMX8MM_CLK_IPG_ROOT, imx_clk_divider2("ipg_root", "ahb", base + 0x9080, 0, 1)); - clk_dm(IMX8MM_CLK_NAND_USDHC_BUS, - imx8m_clk_composite_critical("nand_usdhc_bus", - imx8mm_nand_usdhc_sels, - base + 0x8900)); - clk_dm(IMX8MM_CLK_USB_BUS, - imx8m_clk_composite("usb_bus", imx8mm_usb_bus_sels, base + 0x8b80)); +#ifndef CONFIG_SPL_BUILD + /* BUS */ + clk_dm(IMX8MM_CLK_MAIN_AXI, imx8m_clk_composite_critical("main_axi", + imx8mm_main_axi_sels, base + 0x8800)); + clk_dm(IMX8MM_CLK_ENET_AXI, imx8m_clk_composite("enet_axi", + imx8mm_enet_axi_sels, base + 0x8880)); + clk_dm(IMX8MM_CLK_NOC, imx8m_clk_composite_critical("noc", + imx8mm_noc_sels, base + 0x8d00)); + clk_dm(IMX8MM_CLK_NOC_APB, imx8m_clk_composite_critical("noc_apb", + imx8mm_noc_apb_sels, base + 0x8d80)); + clk_dm(IMX8MM_CLK_AHB, imx8m_clk_composite_critical("ahb", + imx8mm_ahb_sels, base + 0x9000)); + clk_dm(IMX8MM_CLK_DRAM_APB, imx8m_clk_composite_critical("dram_apb", + imx8mm_dram_apb_sels, base + 0xa080)); +#endif + + clk_dm(IMX8MM_CLK_NAND_USDHC_BUS, imx8m_clk_composite_critical("nand_usdhc_bus", + imx8mm_nand_usdhc_sels, base + 0x8900)); + + clk_dm(IMX8MM_CLK_USB_BUS, imx8m_clk_composite("usb_bus", + imx8mm_usb_bus_sels, base + 0x8b80)); /* IP */ #if CONFIG_IS_ENABLED(PCIE_DW_IMX) @@ -356,9 +388,6 @@ static int imx8mm_clk_probe(struct udevice *dev) /* clks not needed in SPL stage */ #ifndef CONFIG_SPL_BUILD - clk_dm(IMX8MM_CLK_ENET_AXI, - imx8m_clk_composite("enet_axi", imx8mm_enet_axi_sels, - base + 0x8880)); clk_dm(IMX8MM_CLK_ENET_REF, imx8m_clk_composite("enet_ref", imx8mm_enet_ref_sels, base + 0xa980)); @@ -394,6 +423,9 @@ static int imx8mm_clk_probe(struct udevice *dev) imx_clk_gate4("pcie1_root_clk", "pcie1_ctrl", base + 0x4250, 0)); #endif + clk_dm(IMX8MM_CLK_GIC, imx8m_clk_composite_critical("gic", + imx8mm_gic_sels, base + 0xb200)); + #if CONFIG_IS_ENABLED(DM_SPI) clk_dm(IMX8MM_CLK_ECSPI1, imx8m_clk_composite("ecspi1", imx8mm_ecspi1_sels, base + 0xb280));