From patchwork Sat Jul 13 08:45:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 3213 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C913540F45 for ; Sat, 13 Jul 2024 10:45:45 +0200 (CEST) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-58b92b79a46sf4774610a12.0 for ; Sat, 13 Jul 2024 01:45:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720860345; cv=pass; d=google.com; s=arc-20160816; b=lF7+dc8pRiC3Zz1PkHPIOr/g9+lbvwgsvP9srUxEdiP9kwHNKXPnixtI0MnxGB3oB8 huqfUivfncX42cZj4SxnNDhJwbKj0vHIlRa22da7wureA1aJHMCBPHkpkFrfJ2wsynkc 2+LW5RBZ6QikNh9pvGQi+5FQ1bfQ3ywto/Z+xYbS7nJAN6pFV1/XUWJspfpBdC9LHcYf 5sm2NwgHqmt0hylGGPlumrdwZBoLyKIvosQGya/ftuho2XT4dvuBxSiigV7cLzMYJ3rA NPyr5CYTY0xe/i8X/q9hCodhJ9ug83fHWpued/A2252Ec27yzZbbpaJUxcZQNTAvK0pS FQSQ== 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=5TuJ+EX9pHQA0NMoNA9POzhWHKBFOndcMV3wyubjoV8=; b=NetpAcrskZL3enSEhy2BUE7uwG2r5yRyro8fJpEJaOFtNLJK8nxqbf/Yj9INesqTum ZYGfOTuhy5FraqEH86V7h6mE/p0oT+cky7f3Z6e7p4OKxpKcGXV76d3Ymr67MCBV7WJl J8Mq8RF5Gc9ZDYX2tK4O2hSwS3JKByttGoWKMeS3ZCK3aq20BCfUJDETpWA2htXzJcPp IMZwLItTUVHE9po+uHOiy46Ev1h2D85PJCpqiL7gJ/2ldBTZG/xpJ4HTZPqgmbsdgamI /aLGan/MJM+V25wYSkpdwaCZu0lcmCFiTQ2z8PUuQ+EoVNJZuHWE+EUvMbDFmHC8BzpC 3Djg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jkx1E+XW; 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=1720860345; x=1721465145; 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=JHGodQFO1Zl/EpYM76ZFY3Mg+WSSogW0OPCxkZa6vgZUFfcl3t0a20E8clzoAhpmCT uc+tZEQ2OORAH3w+l3JvoOfdB0HTKp/SQgxSL2AO0n5fDIHk939ufbteWQ6SGmhBTLp5 JDBdRmy+1L1vmgSzGukvxqfUOCUSSN2IBZGDk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720860345; x=1721465145; 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=uxJs+6o/efFFgn7GQGgsnDGq5WTW/rT/oCgeIbYUKO2fdXayuyI1NQQM7m/t9xlsIg uxFiAaXVWKOfBEv2L2QFC2DnWNKIg6zElUq5CQekee9fWBq50ZTbUTjhYQHAIS2twIlR qsG2Rzy4NxqeCAAzG6Unh8b+6X98zGt7LiPdT3lMnSc3DZV4T0EPNJVQNSPlH4iHve7d x1YFq4nuX+U+mD31ll3AVLohN30XhmQkNaxevQlSbghkuY9XlP9a/Y5x0kkaUCT6iiOC Rqxm98wkJXDRe6VEnt++qxBX330LF4nZKCZhXbhhO/RAUn8Yvep7OlJSOC0C7KeuWt1J OvUQ== X-Forwarded-Encrypted: i=2; AJvYcCX9dbr91fWX7iOZuVvzcxS1MMN5DpHFa8EEy7RLkXrTGGAVqnbYZJ5fCmHEx36c+RrowctZEQUFCyk3soBTmLPoLexC5jvRLx2op0XsQt/DI1L8XwvNp8gBljIMBA== X-Gm-Message-State: AOJu0YxGZLymaNxpQK8NbvD8CMbbUxCgCh9QuIqS2oBRDoMbnpM/+5TZ inR+xer6gWQBjIDLCV9NRZ5pc7SL+q6iNJySynbVm4wUw+NoMzV3Lff0L0y1rKhhdQ== X-Google-Smtp-Source: AGHT+IF236umqZ2b5nLGOyszX++9QtNaL3O3Hn77QsECErWbbBjNIX74Fan1d6tNC9qGTEtjiJucuQ== X-Received: by 2002:a50:d4d6:0:b0:595:7779:1f7 with SMTP id 4fb4d7f45d1cf-59960008613mr3333049a12.16.1720860345482; Sat, 13 Jul 2024 01:45:45 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:48f:b0:57d:1766:62e9 with SMTP id 4fb4d7f45d1cf-5982661bbbdls309758a12.2.-pod-prod-00-eu; Sat, 13 Jul 2024 01:45:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWu9aZHIh3ntXtj317o4D30CaHCNcOGrhD73XSllgetuod/9PrHlVJx5KYxr0s6LXLyrPlVxxuqcepjLIJKXuyFiQVpbKKLi8HY6mBDDfp6g/r1 X-Received: by 2002:a17:907:846:b0:a77:f5fc:cb61 with SMTP id a640c23a62f3a-a799cd67784mr472184466b.0.1720860343749; Sat, 13 Jul 2024 01:45:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720860343; cv=none; d=google.com; s=arc-20160816; b=PWNKSMdhvqVNn7vu5RUVfdiQBQnSU+C0bPOJQ1f8S+QJ+3s9DM1a+TrDE6l3nQi8oy bqr+RNxquzn/q64YpafDFNcoePeVpfHBTc0Xg+iSV+wyVw0A+NbRn1NAdCSv4Ekvc+wM /bZrbsmXhv5xVAIwpYVv00w3F1vNmelv4/r98DgDZeJvZKjXrPiKnY8VEzhCEVr436V3 onhswwe6ElHN34+kIE7Qu17VDf37hYsACNAhJu+FRrMbrxcEbM8x46eJ6/Qkbn2vcwaD sm9DUQ1f4qIReFLr4BAdJkjl93PF08ZDrqVrvElQOr8rUut7XGm8dYLd9VvRRlAWugNO d/Zg== 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=B/pluHHsDZ9uJPUtsY1TlBCJu4umNQ0UwwjNPLntG24=; b=OsSQ5uUA1oqjJ/vvpmgwWqr2GsNFYEDxpC6943ZXk1bPlGhunSDy8tW1HpYju5QPSo VYFgi4i8sm/lJi2BZ8ALxANTNiorrt2GILdIzrYW2y+oWErtzchsRaWfJzaJvsNuAMzV Cxdt3Sho1u5t/M9Hn2c/RjVlfpZ70aJSvqZS3gD4t9gO4nelr6BRKsJoQgQ1fqCWSrKO sRB0d8lSuhYDMQkQEImm5sH3/8OC7o2grTylVXyJ9eflEbDm9YJ48huxpoQDogWdMlva ljHuMtZVd36ay1mUziiqUVI2D/oo5s3+iBJOC4Db2eFwFg+qf5rRl6LXxYnMARlLKe6H 4RpA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jkx1E+XW; 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-a79bb77f073sor19125566b.8.2024.07.13.01.45.43 for (Google Transport Security); Sat, 13 Jul 2024 01:45:43 -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; AJvYcCW4n9z3UxBMF8dfkH6MyW+6JE+e6UcOX//IcwZU3GM4qCSubyKZhoYHrgQuh+5QZSnUGIV2M2IOaiD1M4XEHkccAx8a0FuugRqRRYKXgNgjca9F X-Received: by 2002:a17:906:c083:b0:a77:a1f1:cfa0 with SMTP id a640c23a62f3a-a799d3a5aaamr341425966b.36.1720860342371; Sat, 13 Jul 2024 01:45:42 -0700 (PDT) Received: from panicking.amarulasolutions.com (93-35-128-17.ip55.fastwebnet.it. [93.35.128.17]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc7f1e20sm31483966b.116.2024.07.13.01.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jul 2024 01:45:41 -0700 (PDT) From: Michael Trimarchi To: Michael Trimarchi Cc: Dario Binacchi , Patrick Barsanti , linux-amarula@amarulasolutions.com Subject: [PATCH 07/21] clk: imx8mm: Prevent clock critical path from disabling during reparent and set_rate Date: Sat, 13 Jul 2024 10:45:12 +0200 Message-ID: <20240713084526.922537-7-michael@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240713084526.922537-1-michael@amarulasolutions.com> References: <20240713084526.922537-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=jkx1E+XW; 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));