From patchwork Fri Sep 13 09:55:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3471 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5467A411AB for ; Fri, 13 Sep 2024 11:57:06 +0200 (CEST) Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2f760cbd9desf15614621fa.0 for ; Fri, 13 Sep 2024 02:57:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726221425; cv=pass; d=google.com; s=arc-20240605; b=dztNHERahy5ftLeQopVfy4Pb6dAumcBIYGHi4HhM0lveO4tGZM4ryYEVa1sxmtjX6+ m3c8A6m5DbIC6jJs59egxZGn1XJ2txb4nW4DiaFQQSabi8jq6VyGStF0XK9rWFReMmOB eg6ttGnt9+tzqYkBJE5kaYXALjINTY/apygvQK8PaVGH2OoRyK+hpw05kZjliEpEMwtL tLJt2/PxB4LYT8NKOuibO9hhLbln6Vt/VfNVm2EzZLSu88vr+eeTL/9+rDTSKjriP5Hr F6FsJNv0lBQvgeeCUAD4edRGeXY0k1ep2yuvBVfcij2vO6Eeh1MCq0lLzODfgp8Mf4Vc Y0Kw== 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:cc:to:from:dkim-signature; bh=ppvup/Czz8fQ0eR3vbloJI/90ot3sAybYlGgF0ba0oI=; fh=0YXpq982Jrmyc5+1MxcT7DFpAnGANunpSYgClPt9g5Q=; b=c8v/l1oSHSG4n+XdNQN34eu8QJCP9Q+GQGRy8opmRKvmIApPVuoqnooWohV3mnVVYK yA9/K7vOgyCW40V108aZkt6io3Ut/cUHcBmLqqvYGTMauAUSoPfxlO7w35cfbFqIWH66 3ibEKvaVdc57FEiwQ1mYyA03NsoabqhHBJTTPA01GTiPouvbE54X0YW5T1OfUgV65mvW +XAW4GCGggKVXzcVCGevJthm14DdtuRdqQNxwzBIwNj6kHalzAOBthISGMlNa6w8GaBd G47csOOYD7DCpWDDIHzslTUditC8FtXZ1SqXzIlmEY2FAYIz90iBjlmU0XD82iQ7ZHrl vjZg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="SY/Pw8TQ"; 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=1726221425; x=1726826225; 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=ppvup/Czz8fQ0eR3vbloJI/90ot3sAybYlGgF0ba0oI=; b=hySAJy1xonvVMSJ8qUrtrFHd3S4G5AFAZJYJV0vgyrLMwNxCqRpiMYQ9n2Ysw8SaCz kpKT0ivZ4u/gZcFG/6foIu1/2YMkPSQp5+Xn83ZBDdfcGFH5IYlPImxd5vSTXVvyYiYf Ce0VdnOkE/KvMFEVKJ52lHUzRm1eTNZbIBPF0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726221425; x=1726826225; 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=ppvup/Czz8fQ0eR3vbloJI/90ot3sAybYlGgF0ba0oI=; b=RhkVQsOCm5IscwCEPEucRNqEAk+l2K4wVw753gAHguQPXNxpI3geuPQjqG9Rrw45xN nYpD9FQQzLZ05m4sXIer+vZXgv1zuU5FZKYFC+x1uki4LM6XlFgbxb09g3IhLzeFmjFF Awld24d9zfRvY9cfXBY7fKf6UIZHkvqcRe9HVZkrepBvFWo/2lu9bE29+w2L2RDvrZOz iUTgwLy6tjv0C198cCrCw/JCuPRj4Aq5uBQtlm/sH7fPE+1PKx3I3uj974UYIWcumoWb GUaA4t3y1GgtN6snEmP8LS9Vfnq69C/hwGZreLystdo42pUMJbGkAgyI/z2mC3hClnZJ 7g7Q== X-Forwarded-Encrypted: i=2; AJvYcCUUAX5g/xXtVLeR5HK7R4XY0VjaTAldLFasZXLe4A3G+p0u3Nyak6fUwaki6LX/+u3szvC/ZlKq8ePq1mpc@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxHCX2rnxhdd/hRCeS3pSACfzaHzqbrbIeOcmaYXvVnPep/aq5/ fMjU29FwY2+HYap2bxzmAbJEblnb3aaKPqVeUMM52CAPcd9Yq2iG4UNHTexG/Di5FQ== X-Google-Smtp-Source: AGHT+IFKJIrp9wxQl+fvxUb94TjGhDOm2qlMe2MzjukKPJTVARY1M6mYZv/l5HFTcwYYw4i8eJIN1Q== X-Received: by 2002:a05:6512:3c9c:b0:530:daaa:271c with SMTP id 2adb3069b0e04-53678fba2damr3519157e87.16.1726221425435; Fri, 13 Sep 2024 02:57:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6512:3d93:b0:52c:e511:acdf with SMTP id 2adb3069b0e04-53678e09181ls915000e87.0.-pod-prod-08-eu; Fri, 13 Sep 2024 02:57:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWCuW5jakumPmHLDO3uDUL8EDVUnL4DL+0Gl5E+fjLXpIlD3hoSu5Qvtu4pKzt9veAqRapJYDH2xb3upaaD@amarulasolutions.com X-Received: by 2002:a05:6512:1106:b0:536:53dd:6584 with SMTP id 2adb3069b0e04-53678fc99aamr3501244e87.34.1726221423594; Fri, 13 Sep 2024 02:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726221423; cv=none; d=google.com; s=arc-20160816; b=kxHHXGudWQld9oconq+oF+tFATDAd0Vw3tHrZbAf8UgANLp+FxqH8h/1+4L3dExFkd pFy2suwJvguGa/mq7Fv5gYpHLjdNpuwvDjHqM0vT5IqStbHoEntUZf+sP0xODEyXI+vh FnJQlGjik0S1fmMnDF01EXi1nfB+qG4PeKDD/WwBvOoIN0PfaEtRy+re38vlXDeEEuJx mgiHpcZtvHzjRSMWXR279l3ioeSKOE2ypGfOQlg/Be3FU0EqxnBJ1eGYXq3Euuvdk/J0 FDjKLbw0JbJjMvhcYe9YZlq4twDnCXe0AhCyBAK9L5nnPtFQFOIY/ZADsSdKFus2/EVG Rd6g== 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=PyaFmNCSWcMYfKku/Mr27YgQakO6Oi+2kFb/osBneFg=; fh=VTNuctJIBBgGnWi05TMBjvOYXhgI7DJEqtz/RAL3S8E=; b=zXI6upSzxF9RXvGEziX6hAOWVCFafMnj+oqeKHYgQ5PdtBc9dBDbzsRQRgQdVxzSPY nhwDKORzg2hGMISDy1r6ajPws4GlvE3NvrmMVlhxrnlpj1k/bDo7b2L7B1Mgvut6pDy+ Msv8ATrEc+rKcPmfcG9FveC0O+O9kKpSLuIep3xs02ae69jcfSgfQcTjt3p0/OgeJZxT UbiMI7CnjyPLsvjYZQAUdvAuXOtS1B7Y6Ipde6LGwgljb1jRnW4Tp6c9ONt8/Ssrk2Np 3mW+z684E1N2tzF12qkcJUKdg7qFw6tQZQh/7i22FTLVpfe0xoYvFItm9Lhl6HgjIhmM JnXQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="SY/Pw8TQ"; 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 a640c23a62f3a-a8d25045a4fsor523123866b.0.2024.09.13.02.57.03 for (Google Transport Security); Fri, 13 Sep 2024 02:57:03 -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-Forwarded-Encrypted: i=1; AJvYcCVTzdNWnoCfjCi1rnrFVkBckjZKnybnV2lMfOnjpKJLW6aHNwOQ5RziUocGsOgve7DARogU7/NcpZyrx0Gv@amarulasolutions.com X-Received: by 2002:a17:907:c7c4:b0:a86:7021:1368 with SMTP id a640c23a62f3a-a9029434ca4mr601239966b.21.1726221423050; Fri, 13 Sep 2024 02:57:03 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-87-4-102-18.retail.telecomitalia.it. [87.4.102.18]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cee72bsm863224766b.173.2024.09.13.02.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 02:57:02 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Fabio Estevam , linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Miquel Raynal , Dario Binacchi , Hou Zhiqiang , Lukasz Majewski , Marek Vasut , Sean Anderson , Tim Harvey , Tom Rini Subject: [PATCH 03/26] clk: imx8mm: Prevent clock critical path from disabling during reparent and set_rate Date: Fri, 13 Sep 2024 11:55:45 +0200 Message-ID: <20240913095622.72377-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240913095622.72377-1-dario.binacchi@amarulasolutions.com> References: <20240913095622.72377-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="SY/Pw8TQ"; 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 Signed-off-by: Dario Binacchi --- drivers/clk/imx/clk-imx8mm.c | 64 +++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c index a91c6767fac5..432348a15cad 100644 --- a/drivers/clk/imx/clk-imx8mm.c +++ b/drivers/clk/imx/clk-imx8mm.c @@ -27,11 +27,25 @@ 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", }; @@ -47,6 +61,11 @@ 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", @@ -82,8 +101,9 @@ static const char * const imx8mm_i2c4_sels[] = {"clock-osc-24m", "sys_pll1_160m" "audio_pll2_out", "sys_pll1_133m", }; #if CONFIG_IS_ENABLED(PCIE_DW_IMX) -static const char * const imx8mm_pcie1_ctrl_sels[] = {"clock-osc-24m", "sys_pll2_250m", "sys_pll2_200m", - "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_500m", +static const char * const imx8mm_pcie1_ctrl_sels[] = {"clock-osc-24m", "sys_pll2_250m", + "sys_pll2_200m", "sys_pll1_266m", + "sys_pll1_800m", "sys_pll2_500m", "sys_pll2_333m", "sys_pll3_out", }; static const char * const imx8mm_pcie1_phy_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll2_500m", @@ -135,6 +155,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", @@ -283,18 +307,34 @@ 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)); +#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, + 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)); + imx8m_clk_composite("usb_bus", imx8mm_usb_bus_sels, base + 0x8b80)); /* IP */ #if CONFIG_IS_ENABLED(PCIE_DW_IMX) @@ -358,9 +398,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)); @@ -396,6 +433,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));