From patchwork Fri Mar 31 06:38:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13195273 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90D4EC77B60 for ; Fri, 31 Mar 2023 06:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229909AbjCaGe5 (ORCPT ); Fri, 31 Mar 2023 02:34:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbjCaGez (ORCPT ); Fri, 31 Mar 2023 02:34:55 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2058.outbound.protection.outlook.com [40.107.8.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85333191E2; Thu, 30 Mar 2023 23:34:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QHpoK7oxxdXXtFtjO+yp+qLOJEugTnZG/EemMROlStLjoPRrp6hB1A2LoSUstQ2eSaip+g+KIFopNajPS5GdP9CbeuTvNWYoFRgkplPbc8Pl35/7048Kw9Ue9HdLunpVCTYYvuICsZysbw7XfOvqNrDkOPFA1gQeWhKi6FTzYVInYhaQQXm6xYFOQmhVcMOVLAwGEHbatjsw0WqJUuymdX8AoKEOG6c7xPjSLl8vB1Lupsm0ZaWYOORNN+Ao/0PN7SBRbjUQlbrroeGoUW6Of1E8iYYbV+K3pc+Mimu9Ey8eI8hzAcu8iPtfulsPQbGfFH5Gn9PrIDnPk2+fkOFygA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/+kk5vVtHszPsy7VkfxiCED1bhqOtpUvT/dSaLfIVvI=; b=FAECDbrsqDw+vJcqn2NLra19ys2LTV9G/6Fzp+ejZV8rhdEn8LAWfE0EcFq0cWr93dTpgHVOUDga26Sy/3DdFCO3NHVqvJqwGseysim6qoa8Uarmert1G8a7Bg+AU30V4tWfxCOcsrOKb3324rjpzj8E/tAIC1rDF6CTqxWzxZYFoXeKb+hXXLjOpr9BwqPa5F7fYYVT+tkrzFNDk+8DaqRkp9vs6YCO5yTMFulyFfkyAnYtlxtxCyosFXYAqFVninso+N7ZBaltajvRcuDLEtyW2uG8YAAK7TAimA8XrxXJPrQYeXdJ5mXWOKMf5CJCKrQPS/0aUZbedh1PHIETeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/+kk5vVtHszPsy7VkfxiCED1bhqOtpUvT/dSaLfIVvI=; b=RFAk6etxMdW7QrUXEA0paQrwDapWKzr7m4Uz4gbpfLpQ1jc5OO+RpCi6k2Q5yMZi8E3FcPI4R9pZsf4nNa+ABBujpyBh05BNZUBv8XLV66BSaKa3dcUnrtq+zwYAGi92lKWFD7cAj3d6QN81ABpyM2CvsBeMSeQ46NQbXC1bVaY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by PR3PR04MB7356.eurprd04.prod.outlook.com (2603:10a6:102:8d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.21; Fri, 31 Mar 2023 06:33:51 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::778e:19d0:cba0:5cc0]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::778e:19d0:cba0:5cc0%4]) with mapi id 15.20.6222.028; Fri, 31 Mar 2023 06:33:51 +0000 From: "Peng Fan (OSS)" To: abelvesa@kernel.org, abel.vesa@linaro.org, mturquette@baylibre.com, sboyd@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com Cc: linux-imx@nxp.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jacky Bai , Ye Li , Peng Fan Subject: [PATCH 5/5] clk: imx: imx8ulp: update clk flag for system critical clock Date: Fri, 31 Mar 2023 14:38:14 +0800 Message-Id: <20230331063814.2462059-6-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230331063814.2462059-1-peng.fan@oss.nxp.com> References: <20230331063814.2462059-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2P153CA0030.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::17) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|PR3PR04MB7356:EE_ X-MS-Office365-Filtering-Correlation-Id: d0607f0a-0e05-4b8f-e432-08db31b1e40e X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qhEo31x2WaZktsy/3iOsQ3gF5BIXO/KkwG17Ad6lhpmK7Qbu8nNHAQeyXYQUZpMX0Df331+pO8j7QdT1lfoW3/Yb6WUes3YIjBpdtSNeRf6EOet+vMVTivzc/wFQ8VBOBwlNShsB38hmZebdfA7xcvFroSy/hV4OQ4NziswA45K7/i/whZygus4sYAeKhMiRP7hHIcVIjxbTSumUlVEXD/Kw8q+5tHiy7FHK+Dmr9PknzFv9qX0W1k7z89I5An9hUwp0pPThNbmFnZrghbvv7tpk0fqGx94M6Fnqu91xBiaiQtmFPs9opgIiJgyshHnqmpCjnw4aSRHVrYFX+0ibIjiOJUEY3FJZtvbo8IsIWDnYBSdHKBBpskfAXXV/UhLenOiuYSWADmAz9hx7j0ky01wqjGBnvgrQNq6przwT4q1mvmxxKx8/bzEsq2HnsEHA9AN0DzyC/BU2IcvaiAR41AnRZwE8fO1Do9rTl0RY1drPu0x8tnvh9QgDzWrojY1gR7a7oxu6WYwfd0KYniFxprASuU+p2gFLexqSgMaFSDBRYq6vFtEuW4J1F0dcsL5PMZGuzaaRUz1+T5LMhYTS91vt8XdjM+CEX0G5TrBxrQ78pp5qPKrNPA0JPGtZXFnMTs45pCrKSVE6FWbbPIZvnQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(346002)(39860400002)(396003)(366004)(451199021)(38100700002)(5660300002)(8936002)(7416002)(66946007)(41300700001)(38350700002)(4326008)(8676002)(66476007)(66556008)(6486002)(83380400001)(2616005)(54906003)(6512007)(26005)(1076003)(186003)(6666004)(86362001)(6506007)(2906002)(52116002)(15650500001)(478600001)(316002)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eE4HPr24Pba9F9mPqQxIZD0L0rctOQ0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uNxNaSGG7n2XP5KtZAUBA10LWtN3Js6j06tiNhpVCHl0EANCU5A63paWgQFm8NuLl2JpbwBthbEv20QCm7Ee7Q7BMjtRlaWmGTKYOxQ8M7di78mEfBZdajkQPMUrnxhIw0L8Ln3Ju3pBSM77OnSk8Ilg//Vo+xqKeh0FE9aA0uxyE1LCIj9C2K1638uiE3KSM+jCxuj05RUVr5hXFhU4To9a3qodNNstLRujwLaxmKNFE64IaauW5HWU2aaIuo9anIEC9rozYnOe/rzNmm7yHwGlHPfDpTQLaGHKVAVV4Xr5NxgyIzD8Jey7RKowV/mtIZlEDPTQ/CJ5zqDeJLEtW/LYkMEmQWSjLdvNRxi2ABRYmuM6ubLcW+Hvz+barA8G/utjDwVcbhQ7h8ebma2zScqzQcFDHGHzYV/1/jbBK9WGNFVJCPJ6efbNKVCVyuzdIkrTKwcluWy509FNv2vH43uMW8WfjAySlMXEthNc6fLwqlBnZs X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0607f0a-0e05-4b8f-e432-08db31b1e40e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2023 06:33:51.0744 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QMZxVO24i50YZ4LvYFIFK9XYLm8lXi2fleU8m/4OMSNh+KpJlZFfUoQVTSatBFzTjXBR5013GCnkW1YZthtkVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7356 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org From: Jacky Bai In order to support bus fabric clock frequency changed on the fly, need to update some bus clocks'flags to make sure these clocks'frequency and parent can be changed on the fly. For these clocks, HW can make sure no glitch will be introduced when changing on the fly. In order to support DDR DFS, the HW register bit for DDR_SEL and DDR_DIV clock will be modified by TF-A. So need to update these two clock's flag to make sure that the linux kernel side can correct these clocks' SW state to reflect the actual HW state. Reviewed-by: Ye Li Signed-off-by: Jacky Bai Signed-off-by: Peng Fan Reviewed-by: Abel Vesa --- drivers/clk/imx/clk-imx8ulp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clk/imx/clk-imx8ulp.c b/drivers/clk/imx/clk-imx8ulp.c index 6a8a9e50d826..e308c88cb801 100644 --- a/drivers/clk/imx/clk-imx8ulp.c +++ b/drivers/clk/imx/clk-imx8ulp.c @@ -198,10 +198,10 @@ static int imx8ulp_clk_cgc1_init(struct platform_device *pdev) clks[IMX8ULP_CLK_NIC_SEL] = imx_clk_hw_mux2("nic_sel", base + 0x34, 28, 2, nic_sels, ARRAY_SIZE(nic_sels)); clks[IMX8ULP_CLK_NIC_AD_DIVPLAT] = imx_clk_hw_divider_flags("nic_ad_divplat", "nic_sel", base + 0x34, 21, 6, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); - clks[IMX8ULP_CLK_NIC_PER_DIVPLAT] = imx_clk_hw_divider_flags("nic_per_divplat", "nic_ad_divplat", base + 0x34, 14, 6, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); - clks[IMX8ULP_CLK_XBAR_AD_DIVPLAT] = imx_clk_hw_divider_flags("xbar_ad_divplat", "nic_ad_divplat", base + 0x38, 14, 6, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); - clks[IMX8ULP_CLK_XBAR_DIVBUS] = imx_clk_hw_divider_flags("xbar_divbus", "xbar_ad_divplat", base + 0x38, 7, 6, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); - clks[IMX8ULP_CLK_XBAR_AD_SLOW] = imx_clk_hw_divider_flags("xbar_ad_slow", "xbar_divbus", base + 0x38, 0, 6, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); + clks[IMX8ULP_CLK_NIC_PER_DIVPLAT] = imx_clk_hw_divider_flags("nic_per_divplat", "nic_ad_divplat", base + 0x34, 14, 6, CLK_SET_RATE_PARENT); + clks[IMX8ULP_CLK_XBAR_AD_DIVPLAT] = imx_clk_hw_divider_flags("xbar_ad_divplat", "nic_ad_divplat", base + 0x38, 14, 6, CLK_SET_RATE_PARENT); + clks[IMX8ULP_CLK_XBAR_DIVBUS] = imx_clk_hw_divider_flags("xbar_divbus", "xbar_ad_divplat", base + 0x38, 7, 6, CLK_SET_RATE_PARENT); + clks[IMX8ULP_CLK_XBAR_AD_SLOW] = imx_clk_hw_divider_flags("xbar_ad_slow", "xbar_divbus", base + 0x38, 0, 6, CLK_SET_RATE_PARENT); clks[IMX8ULP_CLK_SOSC_DIV1_GATE] = imx_clk_hw_gate_dis("sosc_div1_gate", "sosc", base + 0x108, 7); clks[IMX8ULP_CLK_SOSC_DIV2_GATE] = imx_clk_hw_gate_dis("sosc_div2_gate", "sosc", base + 0x108, 15); @@ -255,9 +255,9 @@ static int imx8ulp_clk_cgc2_init(struct platform_device *pdev) clks[IMX8ULP_CLK_HIFI_DIVCORE] = imx_clk_hw_divider("hifi_core_div", "hifi_sel", base + 0x14, 21, 6); clks[IMX8ULP_CLK_HIFI_DIVPLAT] = imx_clk_hw_divider("hifi_plat_div", "hifi_core_div", base + 0x14, 14, 6); - clks[IMX8ULP_CLK_DDR_SEL] = imx_clk_hw_mux_flags("ddr_sel", base + 0x40, 28, 3, ddr_sels, ARRAY_SIZE(ddr_sels), CLK_SET_PARENT_GATE); - clks[IMX8ULP_CLK_DDR_DIV] = imx_clk_hw_divider_flags("ddr_div", "ddr_sel", base + 0x40, 21, 6, CLK_IS_CRITICAL); - clks[IMX8ULP_CLK_LPAV_AXI_SEL] = imx_clk_hw_mux("lpav_sel", base + 0x3c, 28, 2, lpav_sels, ARRAY_SIZE(lpav_sels)); + clks[IMX8ULP_CLK_DDR_SEL] = imx_clk_hw_mux_flags("ddr_sel", base + 0x40, 28, 3, ddr_sels, ARRAY_SIZE(ddr_sels), CLK_GET_RATE_NOCACHE); + clks[IMX8ULP_CLK_DDR_DIV] = imx_clk_hw_divider_flags("ddr_div", "ddr_sel", base + 0x40, 21, 6, CLK_IS_CRITICAL | CLK_GET_RATE_NOCACHE); + clks[IMX8ULP_CLK_LPAV_AXI_SEL] = imx_clk_hw_mux2("lpav_sel", base + 0x3c, 28, 2, lpav_sels, ARRAY_SIZE(lpav_sels)); clks[IMX8ULP_CLK_LPAV_AXI_DIV] = imx_clk_hw_divider_flags("lpav_axi_div", "lpav_sel", base + 0x3c, 21, 6, CLK_IS_CRITICAL); clks[IMX8ULP_CLK_LPAV_AHB_DIV] = imx_clk_hw_divider_flags("lpav_ahb_div", "lpav_axi_div", base + 0x3c, 14, 6, CLK_IS_CRITICAL); clks[IMX8ULP_CLK_LPAV_BUS_DIV] = imx_clk_hw_divider_flags("lpav_bus_div", "lpav_axi_div", base + 0x3c, 7, 6, CLK_IS_CRITICAL);