From patchwork Sun Jul 14 11:32:44 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: 3289 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3059C412C7 for ; Sun, 14 Jul 2024 13:33:14 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-57851ae6090sf3299111a12.3 for ; Sun, 14 Jul 2024 04:33:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720956794; cv=pass; d=google.com; s=arc-20160816; b=Aa+hFvIQjyLkrxmsBBcJePqmimBrS+UkgLghiWJMr75putv6qZE4UY7PzVtXchYSnY w1a/DeqCUq3+Z0017yrf6XCY/XxN/Yc6RwtV6IJiaHkvhgQ2aidG6H/hYJVkaYrgK3Fj jnRlVyu3JDvx1dvInknicKI0M/KLBLZsJ6eN9Hr5jkq3J3lwaxmR/b5KClrbRoUYf9gu va6ciIN70U4438TUqJsbFvZ9q0p6YbwwXLJBySKP5hoyGz7JABvCzpIdJTId/E5lIQPi Zz1D406a2S8yuWUde7h31ujAA2oJ/notJ7mYRYvmHGT+8YWFWWxjF1yqG/A3P40bP0yQ AYSg== 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=oBZqcteNav7lt2Spv38m1OfhG6XFnJEFtkmUkUfAlKI=; b=uO+oCcRI+YEdqcvYGoUbFjV4zxZIfK70k3H2zD3HXrZSJ/tLfjznJfFyLxIX8Y53hY CnTChwpXRqcLHKOpa+oETtjnd0b8sbng9wdtHI3FdIb/qzYm3vRIdZRxJA1xBKwQTLid eB1QDCKg214nK8CWklg7bU8ST8xv9ZSHQpjnT0256tDACWyuHl8Z95BDoP2qOemtpwiw My5YpxTsgOw+v+eR3HJTsaLy5koW7wXEwli2PGmIejzCqmZaMspsYZg8MECwsScpLch/ UMlUrMjewMBgEh96XCteJhvk8JNY4HcoJLPSwKDwnlzsQKcOutHluG0SCnNThoqvZPRx WVNQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XycU4TLy; 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=1720956794; x=1721561594; 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=l7gYSD03QxDrKDTFbavK1snqVkvZxzn+Pw9SjRybYK8H6qVFwbE+NjqgWoFX7gHqTU cF7bhY15wCCrwBED6m/gmEGn7HsgOV15dTKYhF+bMaxN7+rATsIJ3WM2C7/WACt/Zdle jwTR4D1EATFfl+RukHJjCg6g53Mxz+IAEptCg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720956794; x=1721561594; 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=T8Ab55WlhCVKYbvR/UHAEXTULgDlAXD6akUn0b7w2PzBweA+8grPlr95fi1u+UrSBz 6JHykyo6B4TCslMNrRRTu8s4LjaXSJqw9gzeJAz389FcDmBJPisZISNObNwR8evPFdcQ FXTBSL53E+5Ke5IIWZ3lc2+ZdQrQSjiI+bLxKjUkjU9QsQ55lM7cRX519ezUXiCId5Nl 9L7WXV6UNLa+WNFursDjF3cKZ4BusstYFQCGflOcDbQhE/xpMEF1PFikXZCbV7not8c6 UgD88t68+FTUxgzJ29te54ipmUaP/NM26p5dJ7BMLS3hXjZ+z450Vrgp8H3rQlyeaYKO Jm8A== X-Forwarded-Encrypted: i=2; AJvYcCXXYVvpnGQHUaEWzAveUy78bYsPGq6R9YitMr0sUnn9z4k74EayTrceJbCPwDRz8hYBY5KWSPKyOfJoN94NvP89U7RWdudk81AJLxW0d8yun0eB+1T99WOBwSKEAQ== X-Gm-Message-State: AOJu0YxP8hw0VkPByok0A816nbz6Y3EV+ABEb6YWgbGQcXgmwwQvy9Vs 3BcKneDuvg0oHTUBL2SBvD+xHNdFfCucyOYgT4qXK04/p+CNBJp0dg/ShL6QHDrcJ0PyC0CSYw= = X-Google-Smtp-Source: AGHT+IEIIfJvIj+aH5nbQx3wBLAxpa2qC7N4RsyxOF2NU7wHbilcCW2cSxwDMvJJpfVLihO5H0xZ9g== X-Received: by 2002:a50:9f8b:0:b0:599:4c76:69f6 with SMTP id 4fb4d7f45d1cf-5994c766dfamr5129192a12.1.1720956793887; Sun, 14 Jul 2024 04:33:13 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:308a:b0:58f:749f:1c6c with SMTP id 4fb4d7f45d1cf-5982622cf27ls1718684a12.1.-pod-prod-01-eu; Sun, 14 Jul 2024 04:33:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVsVwsK18ijOZwUTRGJ4wFxXkgDEXQXK2bdVvLvSc/1+XYqxyC9an3+hD2oLkTQMRIVwqYTcjqrIbVdFxFi3eyxSedwwJ7ZOw9tCpJamJw4iffv X-Received: by 2002:a17:907:6d26:b0:a72:8d40:52b8 with SMTP id a640c23a62f3a-a780b68a34cmr1360605066b.3.1720956792273; Sun, 14 Jul 2024 04:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720956792; cv=none; d=google.com; s=arc-20160816; b=lkLT7WAvzEKzw13wfvOFElzm9IsD/LQa53JyA+A5Ng37BcsOixXvag18UAuLED5Kbu mY4SBQZHgIyg57p6H2XJ2Ow/2tvajIDZu0GWcD/nIA9NN3kjVyLL1Kd/gZ6PMASumLnO kIFT/YCa+bNGtZEA9ZXKF6aTzM6noUe36zIlPLUqwWpCVAC96zwWyyZTv2cVGDiyyig4 fQdgQbRyB78vNCt3b7tevPZAQKnO6E2Vuqj+XmPARHJtZ6N7v4vs58U6R3JxBebxpNTz bbawI22dfiDZE5zKNBYHTGKpYDO0aL9btb6mO552p4qmstbKtNOSopgfxmmAiIUvfFtF /LvQ== 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=A54fgNm4iaPnM41okreuoyvzrdtRA3bvjlLp8NlEZRU=; b=m3GtT0UE+1p+AHE51hkeUpec57+XvZVDQRiD2RN9w43DwJb/Df2fjrr0EJGHMJEdYH AV3SCg+AijjdcwhT7rF7EK9umvAOLfMdZBlSgFkGVOS+uq6x2hYQFCS73vjFbpYsFHuZ A8PGJcZ5efJWvjLBSBXeEaCmHL9nIoe6wYr/KEdWPmZS9jao7W+l4scLE8whgXdsObRs kdx8iHinWrqzG/fh4na5K7RRC3ZuTH08ANPqTvbpUYqCURGPKcEGyfWs8CeBRQFzq8T3 W963bIL8IU15O+1OjVSk1dVFaYSxrV9i7qnKvOB86uBgfYoKFkVMBWDiZaSrEDrDQ57b cqdA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XycU4TLy; 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-a79bc9596dfsor41592366b.13.2024.07.14.04.33.12 for (Google Transport Security); Sun, 14 Jul 2024 04:33:12 -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; AJvYcCWz6IUDy6lLhoVMzaKD/qYxFJhSKoIh2xC2cFxTzNewb03Voizl65TWYmPqOw9bN/FZj8shVuJlwMh408viLj+AS9L9thAbVuF7TemHACu5x2d7 X-Received: by 2002:a50:ee06:0:b0:58c:7c2f:5c0b with SMTP id 4fb4d7f45d1cf-594ba78a00amr9505939a12.25.1720956791864; Sun, 14 Jul 2024 04:33:11 -0700 (PDT) Received: from panicking.. (mob-5-91-58-211.net.vodafone.it. [5.91.58.211]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-59b25528dc1sm1929469a12.52.2024.07.14.04.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 04:33:11 -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 13:32:44 +0200 Message-ID: <20240714113302.133399-7-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714113302.133399-1-michael@amarulasolutions.com> References: <20240714113302.133399-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=XycU4TLy; 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));