From patchwork Sun Jul 14 07:10:05 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: 3239 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 200FD40F59 for ; Sun, 14 Jul 2024 09:10:38 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-58bd84067fdsf3260880a12.0 for ; Sun, 14 Jul 2024 00:10:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720941038; cv=pass; d=google.com; s=arc-20160816; b=JO4SG94PJu8brY5xVIF6mnIW2oBkB80uTonCEW/Rvyjo554Sc4MPiRwg/vE5C3fGih gf4vrZtyG1Go3UEh4mJQ7M95+7h1/1oQJAucGr660wn3PyYwS1TWxdsCbw0nDjWAT/Ml 9yQCqNZcTafe9Tj0ZNlGLolbksdmoRTg14xJ3snquHttx5b+H33u+bScgOi1mNybyAJX gWLldPlsx0AoZR9ueZO1mJL62aqyrbDiapIV/nGdxi1WqLp4l9Oc1pPiDnbV+KFFOA43 GJHWBSc8UObAsQBFww28vvkvCtStiUKcnqKapue/XPRCZ9PtbnGFkDHBZ4LKGLGwutmE 7z8g== 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=wYKq5mCgDAdDFqqPtCF6bLKRQWHuszbFY2M0QQobudA=; b=Eb/zUy3W+Pde1g+rA217Jtp/aeqXBD8L1Tj6kypM3upOeZZxIdLdOknDZmA0px4fRF NEC5iltWQPFqjxYpDCQ2JDRy6rfYetEYR7ky/YmWOOzAZtZjPrrFoCqZJPtXdGNeqOXD r0dfTcqdK5A3IZQVQFECTCNxM5ltncyWssISfCWTN3QihFbHbRtsihPBi2LklLrADNNR FMEmj7k3S6ISapQ7XuPm7uI4WjmUOTHP0hzraINEciaFVc1nnz28U+FRN8IoHzoikTMr SbVj31fF0dJmvEN67/8O8aDMzNo23plLIC5Y/66ud/o1Pk04c+sYy/ROTkQ0VMQQvqVr 097g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iFLkAk95; 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=1720941038; x=1721545838; 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=QheXYYitMRWjkgfgHjOBp+djFAAU6NhDMkp5suMMbU9q/XAHqa5vcnUw+nOefjzEsc oeprnGjE/xEq7i+9VuGkXrJRYUtbAzYHUPIQOGJokixcdEYA2ehFC5Cf+uenJ6+tCdE+ e4SGVMpYibbSCR0tgiY9ZzOevT01d+E7a8Hf0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720941038; x=1721545838; 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=dgYfseyxF9QX8XyFGLl4vCfZqtKB+5e9fJ4LKRgJ1mtfRvNxW3bgwoWIQQYNxUJ8Os jDTn1Lvql6ufCbPzlYCLvstPEFKgFvsT/9Czlh6RNc287cKfBaeCqvolVzdV0XVOOHp2 CmuiVWQ2Exgar2drf8s/qgB/abEhwhKidu0UVowncqcragE09YwIGaP+BuFYCJGQi8ij 4MOevaLI3RRD4c0zPAvj6HSSVhuKvFRTKcfLtI3XhpU8WXH2sX02UgNhjocbwgPJ100F unmCfrQyggyoQ2unqINcAUkEy6iCgiUZxleVVHgtLKRkesbGF5vzwwPlftMoUtm5VGNn BRpg== X-Forwarded-Encrypted: i=2; AJvYcCVuODn8C6HDgn28LVv/fexgVnyyIHozoUJeiXWZcTu8OLMUWse75fEAiiQq4WXhEpU7pRmGm0Td9cuZpZS+XkxhWA9kee9bprdZbf+w3QwMHjoCpzoX/gwnnNbc+Q== X-Gm-Message-State: AOJu0YyXDOm5ULrlmOdKVejhPFbdlROsA354cj+tXrll//FFQnWOluhp l281EeCxKXpn5MKVeWpbcYnCoB3fHNyF0fNHOWFASPxeFikUEtUzJnoc/mEyBgnRBUrT6iC+Hg= = X-Google-Smtp-Source: AGHT+IHtL54MxtWDdifnOAxA40MTE5GTPdV9wjsHq5AxIYk5o2lDJTaOBVVJEFaVQNom+tz5pltyqA== X-Received: by 2002:a50:9b42:0:b0:57d:2659:9141 with SMTP id 4fb4d7f45d1cf-594ba59f968mr8706122a12.24.1720941037824; Sun, 14 Jul 2024 00:10:37 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:2188:f507 with SMTP id 4fb4d7f45d1cf-598267117b9ls1771872a12.2.-pod-prod-07-eu; Sun, 14 Jul 2024 00:10:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXq5+7VrzLhpo73VSIIs5Wpqx3oyGkjFQKaxLMpAIaeX8htYhKciEuNJ6p8Dipg/fIpjMjAX2OWjRdn90fD4zIszs5O59K+oeNSkOMKoG8n+vl7 X-Received: by 2002:a17:906:4ed6:b0:a77:c199:9cfc with SMTP id a640c23a62f3a-a780b8856e6mr913024166b.57.1720941036039; Sun, 14 Jul 2024 00:10:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720941036; cv=none; d=google.com; s=arc-20160816; b=nvJGaIbXPxJ5i/JaFmFNyWxiiRp/85MWF/4Bq1VH4Jt9irkWFb0H3KvO90BUsLEewU bwUTeRT7rCFEMLPNerQ/Hlm8ZmeZdklnyPmF2sFaSQPsN/DetLR46OKK5X1tlAbfp7pM rWQ5ppwVuOrT9jeadMx8tu76hwrnPiddMU7DtzgAzCpFMdHS3L8eJpSQUG3EVrOpbVyv suj+kVS4kaf77IWcgPLY9AccBlThne7Aq4k7BVqQ/RZtSeqQoVVpN3E1rk3JkLa39smg Hzzg5y7YprZP4417ADr2VOl0T7sjYmd/F/CpWdJHE8sT0naBTpTWBpPRuDHCxSYQpwGf gYdw== 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=4zbbfpvTLnMKJhCHbxe/BD8U8LVHOQEah/IyG8LC0js=; b=CKQtnUb8C5oaJLtHKtqyRIEF10HH9JiTRvheykFi+sv4vTn2Lw0TaQloo970Rf9Kb9 aDYlJPTsIdTqUT2p4TRbWToIrVIQw4d6nZaYBiPk1Y6r2W6aU/917msLhfgDT9cpiCEE Bdv6dIWROak8OlJyOFN51ydSQnT3UTtWgD+DGh2AYUWqNFe54LKkEkuJruNlCUyJRyYF T/bcecROSLAHKxLjgG4LwOe+PrLWHA9ITKp02JDMhbgEJY1bKvM6JNTInx0IZBz942kH hQIMsayDMJ+3Jci4u5zDMnvPywXo1d7Ix2u7XKAgI/Ap/3CLE5TNVi9EoCWCdM8BUEw1 n/Sg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=iFLkAk95; 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-a79bc7b2cb4sor35190066b.13.2024.07.14.00.10.35 for (Google Transport Security); Sun, 14 Jul 2024 00:10:36 -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; AJvYcCW10Bji0Wa72ZV3RBZluY28DOfY023FZkxY+1pF6wRpkfAjXnDIUAjt3Zg4WHse1W9ZCVZZzHFTbV5/dlRKEUF0c48scuQzyDXOgVQ85UB1GEdt X-Received: by 2002:a17:907:7783:b0:a77:af6b:d1a8 with SMTP id a640c23a62f3a-a780b89f497mr915556766b.64.1720941034604; Sun, 14 Jul 2024 00:10:34 -0700 (PDT) Received: from panicking.. (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820d52sm104950266b.214.2024.07.14.00.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jul 2024 00:10:34 -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 09:10:05 +0200 Message-ID: <20240714071023.10417-7-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240714071023.10417-1-michael@amarulasolutions.com> References: <20240714071023.10417-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=iFLkAk95; 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));