From patchwork Sat May 4 00:48:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13653704 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2085.outbound.protection.outlook.com [40.107.105.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21039BA4D for ; Sat, 4 May 2024 00:41:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714783278; cv=fail; b=sKiADnaNrulbv3cFU2qPpnaKEUDyLqaKjXhk55mTbl1UEAfIxHFWFeAbqDt6jBTvBTbv8zvDKqIUQ+xJOdvVPNV9U3IhLycmB7SH2u6oWLWKhRE4696v8c11S/rug0y/8NHWd7YyzhDU4WzLC84hyQ121PM4qhrJZYWmk8KuJNo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714783278; c=relaxed/simple; bh=6bfV1dS4W03vysGWKUi5DvTJJb/JmkVcqlEWc5z/JWg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=MUJAB5ph6BTbF8ZYWFdwI6/QfW5rcQbLfokn/MyAgk0jOgkLY+SeIMCPQZbaOoYYnQj8tdMmkyeJ2iC857iGF4QnTFWg0xF4bVi9gma1uW6sVErKGiS0mVwPmWqN4FMnzlA4zRzWmLSd7Nj2PSv06aQ9uSXtQnJmV5YynRL0Q/E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=beP4RVJX; arc=fail smtp.client-ip=40.107.105.85 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="beP4RVJX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m5qCufNfSAiYu0lHWeji7Zkyc1bhWYsxOUQ5pPMGHQwnFJdaunKLhhBYiVrUXUw3yxqfsUQiS68LXGXQ9qnSphdfXpsj+8h+w/8IooqNL2lqYMJBvbvihTaVM+51NJ/4li3iFNNM67mZswQSH5Las9fNw19u1musmWHM2xUFXz9eaepxcnrzYD2aIdXmSHVDgP3YwIA7hCFHWhOd0dvjmi1YKLnmRkn2t/2eCLIwB97k3cVwfe9MyS1VtVC6g147ylOehZO0iWlAcXuQXPxwtNbmNyB4kAdg16MQ+3O9zMjXcUQoe/ET1v8kizWVe9gtzhJqJaovxxqmrERT0GQhDA== 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=VGMI2AiGxzw3PtYdGfhqBPcJZuR1jYmB5HiZD5n8n9U=; b=E2ZfAVfjtrTq57DbWsgcsxAeDV6xx6RDmu3Od2CPEItisyuxlaJtWrr0MIgB8xWDPtB1rNx7vx7l2vznD7/ZFAr4/eaLMVnRcvhlQEXwct63UdiJeSHxWXCwCtOpLytxkpdaNxRorIuDQkNPbXN1+GLwBX8+Dk7j649fybdnLQQ7kqEsw6LxPkucyRX6QFgOqK+TPIDzs0mxpRSke3Nu56CaEWJm0HeK7JiRZVetIFKjHzw6h4ByxE2rxiPZDn2kvd3S5TVZcuZinIsYzv1CWnoPUumy0XAWCLWQpCJ5e3RU7xCBEqoW+LBVQjonuW1K2MSg0PspprXIAl+gS9CFag== 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=VGMI2AiGxzw3PtYdGfhqBPcJZuR1jYmB5HiZD5n8n9U=; b=beP4RVJXKfA0VyKIo9b5Fxhx+pYU039zLwUQQtw3nDTRCqJsx+VSMbFNNPLhRGUL+6wO2h4cT46jqpsc4bP8xTEpEVoqWPxX/hHkAtQz1RhR3WY2nz5xCu7TGUPEXMjMbYy++aAbAnHAhJuj9a47skkF9watz3UtOWe7GMNzruQ= 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 PA4PR04MB7726.eurprd04.prod.outlook.com (2603:10a6:102:ea::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.29; Sat, 4 May 2024 00:41:13 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.029; Sat, 4 May 2024 00:41:13 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 08:48:55 +0800 Subject: [PATCH 02/18] clk: imx: composite-93: keep root clock on when mcore enabled Message-Id: <20240504-imx-clk-v1-2-f7915489d58d@nxp.com> References: <20240504-imx-clk-v1-0-f7915489d58d@nxp.com> In-Reply-To: <20240504-imx-clk-v1-0-f7915489d58d@nxp.com> To: Abel Vesa , Michael Turquette , Stephen Boyd , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Jacky Bai , Ye Li , Dong Aisheng Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Abel Vesa , Peng Fan , Chancel Liu X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714783747; l=2275; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=nzd37ej6sCrJO2CX0AUOVMMELufbZrxk0WgiSw0tXHw=; b=ZpZQ4CTt9Q0v3CidAfPTOx0iAPeCEzp5sE1+Hz3Vbmoc4EdTbB04/h89bvHDFglwc2HIEwfYY cQiiBpsCKYKBEuMj2WkFEaqyBvuyFqV9EGT8SVQBO6XbVChNLFKuv7A X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0055.apcprd02.prod.outlook.com (2603:1096:4:1f5::16) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|PA4PR04MB7726:EE_ X-MS-Office365-Filtering-Correlation-Id: f7580939-a12b-43fc-4ad0-08dc6bd2e663 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|52116005|366007|1800799015|376005|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?zLnxJ2dz2+K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mV+6MbrV876r7ZoPdH?= =?utf-8?q?Y4HzQ91D80H0KEN8W5MVEhBdkstDgJO8R93AZgG5+BKsTJnkeAnJPmPyDT3UFARuA?= =?utf-8?q?+PpafiDpK61KOm2e7QcI6ERcsPZFa3xwYxM7y+ffJWLYsBMNQnuSd6CwAI/Ub62xq?= =?utf-8?q?AgvbduA69U3cfCkoOMzfqoi1YLCLEibCeDaSswT4p07bqjPnwPXWxuZvzD0bbJcCu?= =?utf-8?q?HlJ6TqcBPySPSa73O9XKutXzj3fuO+oUrxSsYCpy3zoKrnoRoJQ5i6iEFHHO7Pdc9?= =?utf-8?q?pX5aXpFNDAl8R0fpr9iZMZ5g4VJDK51TGJrYIbNck2x77m2Exwon9coo5OVDLNLbZ?= =?utf-8?q?km4qRx+zGuaGut6+fm4DH3PLTrK7BAYo6G76cFGUtDODcu48GH9yGEgj5ROZ/zMZH?= =?utf-8?q?LOW9U1rnBHugG4C89MW0SxE8gZTaLMYrZxy3DZg/3ayoCcbOFeBpubz4=3D?= 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:(13230031)(7416005)(52116005)(366007)(1800799015)(376005)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?OlWopRwU52UOLMlW0R8L7toravGu?= =?utf-8?q?NjXsJDZN5h3zS3hgQB7KHhMo4NJTt5AGCEdfdLB65A0JlUvndUpw0oxpu/6C8mKKu?= =?utf-8?q?+pxnaOPv5FerfCqp4gz87/ejfVs8CrKSz+JHfQqr3cnZFgSL6seRuVyaVRnKKG4Yr?= =?utf-8?q?6WNcdz46OnYNTLBbGr+Aum7rRQy3O4ximvM80xfNQ48V5n19FWu3wC9GKAj2QXz8h?= =?utf-8?q?oBT9OqznRzge2i8S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uBSr4KvUhQ2hQTMabQDr5AZnVVNPKXcHMdttBX9ESfCyOZFMx5?= =?utf-8?q?APv8WNCV/bepiijbs+o+e/gLnWoZLBZ0qICr4kHkLpKEAeVBuLbwiMp5GKerOU8WE?= =?utf-8?q?vrH1Y10f0lyI+2Kj0+4a/yaqgOw5VIwKLofKvscFRd6Bp7edPEWbJlj4/awpDEgP9?= =?utf-8?q?o9WwiM2vZHBiiFRWd5os46fXCvn6Myjz1tgLAxWNtZcpt2i6Sv5OhKKJqKd3vI5Lv?= =?utf-8?q?YYlrw+/yKV/rhmO+XUc5BTlY1d57LcUDT9KZ3mIYFKZN+95vz7+79ylCrVkvVfeC3?= =?utf-8?q?8N+Kb5QRplsIcX0INJ8gNhg/Fu0CBYP03CPGfyvmduQOMP5103kKdRfnMxbppB5mt?= =?utf-8?q?tCLmQ4bYQkmkWvjp/EaBekNp2wNktV1j6cZ0gvl2U4MSeqte4CoSrBJcFBjf7fsYO?= =?utf-8?q?lE2IfO+z6AUx?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7580939-a12b-43fc-4ad0-08dc6bd2e663 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 00:41:13.3222 (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: K97XeFzAbgl18NZ6cn6eE1ibx4dlaLn3rfIKMM9//ajxpzvjYsyFoNXdhLvlkfdExgO1kXZAllDVAWuNd4M9WA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7726 From: Jacky Bai Previously we assumed that the root clock slice is enabled by default when kernel boot up. But the bootloader may disable the clocks before jump into kernel. The gate ops should be registered rather than NULL to make sure the disabled clock can be enabled when kernel boot up. Refine the code to skip disable the clock if mcore booted. Fixes: a740d7350ff7 ("clk: imx: imx93: add mcore_booted module paratemter") Signed-off-by: Jacky Bai Reviewed-by: Peng Fan Tested-by: Chancel Liu Signed-off-by: Peng Fan --- drivers/clk/imx/clk-composite-93.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/clk/imx/clk-composite-93.c b/drivers/clk/imx/clk-composite-93.c index 81164bdcd6cc..6c6c5a30f328 100644 --- a/drivers/clk/imx/clk-composite-93.c +++ b/drivers/clk/imx/clk-composite-93.c @@ -76,6 +76,13 @@ static int imx93_clk_composite_gate_enable(struct clk_hw *hw) static void imx93_clk_composite_gate_disable(struct clk_hw *hw) { + /* + * Skip disable the root clock gate if mcore enabled. + * The root clock may be used by the mcore. + */ + if (mcore_booted) + return; + imx93_clk_composite_gate_endisable(hw, 0); } @@ -222,7 +229,7 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *p hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, mux_hw, &clk_mux_ro_ops, div_hw, &clk_divider_ro_ops, NULL, NULL, flags); - } else if (!mcore_booted) { + } else { gate = kzalloc(sizeof(*gate), GFP_KERNEL); if (!gate) goto fail; @@ -238,12 +245,6 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *p &imx93_clk_composite_divider_ops, gate_hw, &imx93_clk_composite_gate_ops, flags | CLK_SET_RATE_NO_REPARENT); - } else { - hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, - mux_hw, &imx93_clk_composite_mux_ops, div_hw, - &imx93_clk_composite_divider_ops, NULL, - &imx93_clk_composite_gate_ops, - flags | CLK_SET_RATE_NO_REPARENT); } if (IS_ERR(hw))