From patchwork Sun Jul 14 10:53:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 3264 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id BB41340F59 for ; Sun, 14 Jul 2024 12:53:43 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-58c38bcd765sf2832006a12.1 for ; Sun, 14 Jul 2024 03:53:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720954423; cv=pass; d=google.com; s=arc-20160816; b=bd8hYoz3vG9DUwhMxfbwJmUXQR5uVQ1UmybFjoPkofY5wn4ywy9LIcpPHlku5ozjhW eTNaNjjO0svQv0kDnfVOk+DHYaeVa3HDa0MRe7FS3fLYw/AxMtn7LGtBEh0QnqzLivGi H/CAPjLTmFmlP8cKVkkFES5HCxNBcizBKDrXBxh8ZM+7Z5dKaty+qe70V9ouNHLbBaty h0fQKsQgfnblxUv5hXbCQUl8kJs24Y9JaruLTAKatnG+XTF3l45JsgGW7w3/dk/+9uOA VGPqE9ALwwpiZBa+NIZzcGsvvG377uEPHnOhdya08MaFXShq83mxSOmmDnOnT2I3WCLZ SHkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=chNxDfO3ru0vE/ex6/6kVvGPM0MfBdG7mbFIksUbpjk=; fh=dHo47AeF3meSDKfkHACm7nbfzy45T66qX8/EdV3PJik=; b=UQLW1xRc8v3R9RVkRoWDl/9IsG3HWSLEptm4+It/jfaXbmu4XQxJgqNbvdcNtv6zBW qJ7zt+DNibTzP4DRf8fZ7Ek0eSBLciquBOqdzr8fAU0Bf1iZwuu3Z4xt7Rv3+X4+Krgw vZPPDXHRVpn1ir+wWac97zZALkCgUMofmEOHzP57cGMJpJtpRNQaFXbVHe5ZIUuuGboJ 1xbxrqU+IFEjliEoYe+dIe5uhJDqIhHmIW/EBaXy/dZMghyLsvZrOszdzs75uMUVkUCp RPhAmDw8z4MOnxUGah7FQ0dH6xUkV9EL7zsN+QME2vyb/UdWCCLZVNTrrBAhwiWYGgxG MMaw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="kAve/lJV"; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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=1720954423; x=1721559223; 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=chNxDfO3ru0vE/ex6/6kVvGPM0MfBdG7mbFIksUbpjk=; b=W7E1P3Gv15B6v1SmAH1H10L3AVHr9YDfyn4SJLfhoMC2ntYJWSgTqDd/vXd4ScWaam a52LyUPebtkjJlxvHrOuRuYPZFaHH61+tMd8m1oIx6qG5q1oIc5sKTAGa51m11X6E4VY nEUD6e0dVVMzDAWiCt5br0k0FIStVh7H/Tx/k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720954423; x=1721559223; 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=chNxDfO3ru0vE/ex6/6kVvGPM0MfBdG7mbFIksUbpjk=; b=TmwI5bD8VXE7+YX+c4ACUykNDH+kYno/ndY61R1CMI4/pOVEjNqHpuKWlYhWJ1wuGy QHpofYAEo/m6eDa7UCCLNHmAFEDm6GcW8Aq0D2g53QaMK/rvWrBwIzJw+6VqFDsb2G8O CY7syJwDFhoqS2yPJTYjz0S/vrE9UF1BdB4nU9FkKHVByKSGACtzDFlXFJEedyfjcLbq mPCD6oIdGQUlgqvDOm2d1TU27o8XpFKT2t4b4fG3hPZluKCh8TUF9fFIWweQRhpZbCAG JjgGirjdoLZxCYVXqj0Udp98GdllTLL9hgY0bATad0NZw05EHRo51GS18ATUPHq+CXFu 07pQ== X-Forwarded-Encrypted: i=2; AJvYcCV2gfxjoxmSZZP74ZNPsMBYAv9GUAAmtuPv5ATpAzHHKBGf8OYQhUoqDeTbDvEAi+1XQbsHPS4YOFXY0ehCKzAhDmdhbMJoqcj5y/1j9WvBvb+U17nXpRiLskXm1g== X-Gm-Message-State: AOJu0Ywdk1JOOYKwyEFEbPTo/10ZNbGgys/I0Ghb0o/sMQwx8uoKBgUk 4K96KTigOmix8I5svBszxVEA7RR+uMTi7Hg/cILp/knmAXK2hhhnNMOmRmmOq3AUXg== X-Google-Smtp-Source: AGHT+IEpAzrGv5xY8ZRbwubRpkNio+VW8h05URwOrmk9tNu6TNFfbhdGwSLCUb8549jUKuBJT6Long== X-Received: by 2002:a05:6402:4301:b0:57a:4c22:bd with SMTP id 4fb4d7f45d1cf-594baa8bb40mr12335299a12.7.1720954423480; Sun, 14 Jul 2024 03:53:43 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:c84e:0:b0:595:7fb0:945a with SMTP id 4fb4d7f45d1cf-5982622a74els1526538a12.1.-pod-prod-02-eu; Sun, 14 Jul 2024 03:53:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXCM7tPKKFHjoTGjJKeXdWNKL2Vxnu0dnnRIzj7rl/MlpdZdRwglzCP/yNBhD/ShzfzNpuaWPZTA5eOS/1n5tt4CQvzqExqwP71j1gdwCRUTphy X-Received: by 2002:a17:907:2da1:b0:a71:ddb8:9394 with SMTP id a640c23a62f3a-a780b6fe3e7mr1399333166b.40.1720954421189; Sun, 14 Jul 2024 03:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720954421; cv=none; d=google.com; s=arc-20160816; b=o8bhGzmjCP/UGld/hJm/B6VgSCQh2XysgmTXqwQdfzGTf2DMUR9MmDXxYJ2cu25Lz2 XUpEEQRHdveWvAmO75zXfk5Xqk9tj076JFXJ6RS9Y7xoqh73GUkqcPQEsSOi7om8/fIf RIa6G8Uv5LALFdbXgc+Kxqhx2DeBJvXKl7mNnZmpz8vzjqtftxiU0NFehzCf+psmWzeA MAq4/j/PdEpzBcsnC+dnK0V0mgxOcr1p+T6I/s8pFJtNk3FJQkZ4U/+eV0ZFQ6g/pY2d 1AtSbGtfu0eCzb2sByme6jsMvNMzi6xBrmMf8k3j6BWU1s1lgWoV/DxOxqE6a6QjZLaa w0Sw== 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=LC/8L7NUGYg45ARL2mO02nABwby5f4t+d+oF9CPd4v8=; fh=+E/k6BqAI3bi53drxZlz+1CGNC/LpusN6iNCB77LX1k=; b=LcCv1l0ooj1TRWaS2S2jOvwDy+LFXtkGkY7Jsq0JPrZavsp6JvPfFzI6WjywZ/CqjS 0G1L6mtaM54MXX3UWHzC6J+rM1aXc9mQfeq9GKybkltVpqZN6m1C4R7FBrpEwuNiif7+ hA0fxE7pI/sDtXuvUQfzZPGxukIv+C7DwEgDnCMGyxeGVNQqPQGW/+XKNUXJrdwQ4tne pN/kWTWLuoSdxo+ZRW5AjDs5AwmQNSIbTb9gXzMoZXSyQ0Ye9g5cnU2za7iN6kTyjw/O olGoRnJrYrofDw+9b24HqBq+sRW5s2brvXDX8Zi1zCYnom2KURSGoQaEEsbpNTXMTkOv 9IZg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="kAve/lJV"; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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 a640c23a62f3a-a79bc8861ebsor32774866b.9.2024.07.14.03.53.41 for (Google Transport Security); Sun, 14 Jul 2024 03:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCV0cl+86z4p2XNV5rtSzOD9ytUtNcRtK0c6fsqNPeYdiy/pDYXe+uZWYBT2w9iETVIGtcJazTaUGkhFnm6CTpelpE9vpsGtU1z3rr2a0A/D1HTe X-Received: by 2002:a17:906:48c:b0:a6f:ab9c:7780 with SMTP id a640c23a62f3a-a780b6b1af5mr976028066b.31.1720954420771; Sun, 14 Jul 2024 03:53:40 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc5a36c7sm119966166b.7.2024.07.14.03.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 03:53:40 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 07/25] clk: imx8mm: Prevent clock critical path from disabling during reparent and set_rate Date: Sun, 14 Jul 2024 12:53:10 +0200 Message-ID: <20240714105328.35825-7-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714105328.35825-1-michael@amarulasolutions.com> References: <20240714105328.35825-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="kAve/lJV"; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@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: , 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 e538f047b3..685e7df0e5 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));