Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp353914rdb; Sun, 14 Jan 2024 21:58:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEk0p1tdMldhgDsDS+Pa4OmVHXMv4Yl+ygUSz1kPjmqSyGvU3gNdGqDG8COxoRw4UTxwGQb X-Received: by 2002:aa7:cfc1:0:b0:557:a9a3:69fe with SMTP id r1-20020aa7cfc1000000b00557a9a369femr2307530edy.70.1705298297002; Sun, 14 Jan 2024 21:58:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705298296; cv=pass; d=google.com; s=arc-20160816; b=s3jTrbVujQuoWHTkkSgTNjH2rXl00ZWUtmt3uIjeoVFPWkYYOb+mVfwVwSDBEkF5r1 mNz6D4hL2KxhXVNI1bcwfQLple1/95r+9P+Ex2WWmjM9USm7Vgg1gMJRoEwnG4YoOYaa lxF/XEd4LPfhbxmFQNEVG4oRbL3wKbxOZRJCS/KmnTpMi4tI2nMVF3hjplYHpuWb5Rii l06wyhNt0GunB+0CIAMeUwF534nImaeDZInFmsVuiKvlbDHEIe4ISj75NkAErQoFxFlj lSpzxt6qNp5/5lvEdAdVZmCsJd+k1Vj4h5DdapYZOM9JNa1vFSIb7b3FQvGOGJFIOx1g 5aqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=7prCgq7aW3drmzWtI44fBPWT40AfPUsY7EKGytfDK8s=; fh=aahmfxKanh1aWHAGll/KQksIjvRn11ksSXpyhRadaQM=; b=Kb7SZoSjt1Xf2/E19M0RB2Hu2cmW2frz7+POg5CIZDUMuVwPW++k10cweM3YUDB8ZK wWZM9oK3ovTUTS7oDgVOFZ5niHCOPHdoPrnWftBKl6fRiw8GVCQ6jbup8mJHxTidkWmM EU/H9GeE5Y/wnPCd8AQwy1mLG4RK6PnsBKOMItaqS57BP48xTm2XidNLD+S4rGMVX7PR va/PTihOzfmTaxCGLO670kJXgxn480W5f4fAeHgP32RCrBOu5OqhYAlFeWDo+kBu5pvk JpnVUqbWnJtTreJxVGhNnGH4rbKQKcDLuUGq4+KcgUU6vNyldFGn4SmNjvvka7zDXgvZ QHOQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=Arp2SdIW; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel+bounces-25646-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25646-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r6-20020a508d86000000b00557a6ed424fsi3576038edh.528.2024.01.14.21.58.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 21:58:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25646-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=Arp2SdIW; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel+bounces-25646-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25646-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 908721F21652 for ; Mon, 15 Jan 2024 05:58:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66A65440D; Mon, 15 Jan 2024 05:57:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="Arp2SdIW" Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2041.outbound.protection.outlook.com [40.107.241.41]) (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 54E4D23CC; Mon, 15 Jan 2024 05:57:56 +0000 (UTC) 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l9cIO9ygUmHKDUbZCypR+Y5ZZJ1mDdzjIY3VzORmW4Nu4AVJNHA8+zFJvJtU+V5osbXn6GTkd6daKVMnZZuC9Fh5gLtD97YsoQ4ws7b5m9wcFuKWlrUfK6i+jRX006Aqy0OUYiyrIbh4s/h6C1AXPw3vCnKRHts84J8VT+k5APCCgnWT/Y7el2jzPs4MkcLlO67fpeEIzzLhlS6XgCZRYpR2PsVKXbLRtKxmhDa4e5DlBRHfw4mNgo94J/Jik7C+mwbSsUK/XrgGIkho0zyMAZaVBdkeUqxzeT+igvBSpAWbDR47OnXNE5boYsrLrcKPwZqFrQhm0+0s0koGhUvAFw== 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=7prCgq7aW3drmzWtI44fBPWT40AfPUsY7EKGytfDK8s=; b=fuhq64Hwj5HwRtSDFPPgAxEiKZh9nHsrXJMIO+tfbQoW+8eqfR9F+Wlk0B8sTUtbsHlhHBk38xe4NWGo2cFXdTKIgTrQeAMdu4vBLCD/TCDT4KwZII+ar3OMcsF1It8l6vUmENT4QTKbjJvqCcqKweH9OCAaMtm2xQqOL3G1hQZNRUIA7X5nKrNd98rC+tbS+0MbxLjg45nfg2YksEmaMmQ6lpmy2wSwkGE7kYU5QP+85tSbetzc/aTRBpRyB2VyLxuPxxSE2bwy1PFilZnQwGI/Zh8ISTRDmyCJTUWOjxIREPBN62jXKIOwGCxg8vDXaER85L8y685Ck97XhsAsXQ== 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=7prCgq7aW3drmzWtI44fBPWT40AfPUsY7EKGytfDK8s=; b=Arp2SdIWJeZOmFyvJ05PhO7zMhoiYat5nOekeUs2TK5TBfwP5PrQgRQgL33FFxoJBeno63eg+mXLiFrD+VzMMiqJO/4w+awfRp8u2+ZyK2WKcqkIbs5r/LbM0MRACdYce/syCKFtqZcWnv2cOWpdl7Fy+DYYkG5jJUwXFWtcgJA= 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 PA4PR04MB9269.eurprd04.prod.outlook.com (2603:10a6:102:2a4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.23; Mon, 15 Jan 2024 05:57:53 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::c499:8cef:9bb1:ced6]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::c499:8cef:9bb1:ced6%3]) with mapi id 15.20.7181.022; Mon, 15 Jan 2024 05:57:53 +0000 From: "Peng Fan (OSS)" To: sudeep.holla@arm.com, cristian.marussi@arm.com, mturquette@baylibre.com, sboyd@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH V3 2/2] clk: scmi: support state_ctrl_forbidden Date: Mon, 15 Jan 2024 14:02:03 +0800 Message-Id: <20240115060203.813168-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20240115060203.813168-1-peng.fan@oss.nxp.com> References: <20240115060203.813168-1-peng.fan@oss.nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI1PR02CA0035.apcprd02.prod.outlook.com (2603:1096:4:1f6::8) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|PA4PR04MB9269:EE_ X-MS-Office365-Filtering-Correlation-Id: 077c68ee-c01a-494f-f7ec-08dc158ee9d6 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: Sm6+pqItSI1ACOVeMRqrH8TzUxlhTAWNsuaQ7meBI9NEv6VQMkwE4678kxWDHPN5yVfJxZizUD2De5HL4/SnNH7km3+mW5qGHhSeWnbOFGX6bumBn+MS/uFsnC/8/N/awTDSLHpULDe+nVs534eRkqWUUeCUMKJb8FhzA9W+sLf1ONkjXPy7fbVzVQAmW2FylNDDubT/NDiBe5dtW0Px45y7qfnyaRGjGyhgf9ekTevguUp4nocAa95EO06F4yi/IRxvT3YeujZKM6re3Aa8YKy5u+Xtv3le/gvUUiAGUNHfwKB0KMGnGNxIzsp7hFZ8Tg43CVR30i7ufHFFpQWoTgzrw3/uT0lLGUxJB0BfKPIX30z2OwpxGJZoFO+ui2CdcURigI4Em9cfAwcbLck1oepBMldGattQ6DphvHulYlU0oTdu2ulzqECIZaBL6WHMPxzHtEbhgJ9s//M2lp25ZRhLDMtvb3K+yesTCa43QZ2zsoblzHGOuBf2kWcdPWFBvfAWyorQHcE04JBkavKQunHOI2MBi/qh/4gY9JOmvbphQ6PvZ+y/7bw0P73MCZ29DUWhrvwc3kMjEO/n5LhKs4VG1VNlfOYWL9sM1egYDsLY1fBo9YTF5GUDwfiNhbK0Ovi86wvn8JtsW4MeJPon1g== 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)(376002)(396003)(346002)(136003)(39860400002)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(38350700005)(2616005)(1076003)(26005)(86362001)(83380400001)(38100700002)(52116002)(6512007)(6666004)(66946007)(66556008)(66476007)(316002)(5660300002)(8676002)(4326008)(8936002)(2906002)(6506007)(6486002)(41300700001)(478600001)(21443003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Ant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YlcJ7KhTFoayWjye1bvpvctvKJvNYq9nI?= =?us-ascii?Q?TtobPoIKaq2+qG8xNJ9xUq/UyDo+lexFGLGoh/GJ+o6YEaGMm8J96A0AGXM7?= =?us-ascii?Q?Unr5/6B5iwtM1UQ4rxAO/aALB8oY2tw+IEYksQI4Ozxfo8MRxWRLe063WhIb?= =?us-ascii?Q?I8j2G/htJ7baIHOEf1NIbhGrhZmi/1GmFIO+KzEykBn1L2Z6e9AoGi/L8UI7?= =?us-ascii?Q?SWa0m4Om0YxOMID75B299i+2MxL/jElrp4TDOPTQ7r4lV1fEqhFBQh64OQ1I?= =?us-ascii?Q?e2x+ADPR3AO7gdLXGzStwehtq2TGoqxfBWcVQzteRZzgtOr4IgH+s3GQGxXf?= =?us-ascii?Q?enq7uC7UzkHhZ8HWyQloGsxRfGtZwut0p/4VXQunWSjLYLnGhHClZZf09sPJ?= =?us-ascii?Q?T/8SEA6iJyiqizCXrC3hb1gteL98fHUli0E/NRpCxGEXidAd/CSgG0deXcyS?= =?us-ascii?Q?dSDANDYUtyXxSy+WwZV9EGOa8vw3NmzaQ8psZ/jSwuwald3koszyf0aWnZlw?= =?us-ascii?Q?VjP7Bcy2S7p8Uxx2niirXOZhUssh01EepR1I5iilpsZKJPcN2SYZaab1d5zX?= =?us-ascii?Q?MbPG1KpirKlj4U4IXmFRNEztcqJBSnkv+FbcdtXkXYTJ9bbsqWfoELdzNKbK?= =?us-ascii?Q?fUV49YRyzz79jJm9+Q3qdN+foJghfa5J3jiX0hPaLubgDAaulDRkdzB5Xkn0?= =?us-ascii?Q?NkHKrO3TUfBC3ebX2+lndEkuOg36uw8iRglUEaLC?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 077c68ee-c01a-494f-f7ec-08dc158ee9d6 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 05:57:53.4526 (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: 8Ug0yr1CM5EWMxHzNvyNu1qaqHWC6fygN6ndDBzbSbUdp5utR3Nom8/fOIeQoJ9HaSPqq/WmQAMKe2iOO11VTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9269 From: Peng Fan Some clocks may exported to linux, while those clocks are not allowed to configure by Linux. For example: SYS_CLK1----- \ --MUX--->MMC1_CLK / SYS_CLK2----- MMC1 needs set parent, so SYS_CLK1 and SYS_CLK2 are exported to Linux, then the clk propagation will touch SYS_CLK1 or SYS_CLK2. So we need bypass the failure for SYS_CLK1 or SYS_CLK2 when enable the clock of MMC1. Signed-off-by: Peng Fan --- V3: Add check in atomic enable V2: New. Take Cristian's suggestion drivers/clk/clk-scmi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index 8cbe24789c24..5327e0547741 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c @@ -119,8 +119,13 @@ static int scmi_clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *r static int scmi_clk_enable(struct clk_hw *hw) { struct scmi_clk *clk = to_scmi_clk(hw); + int ret; + + ret = scmi_proto_clk_ops->enable(clk->ph, clk->id, NOT_ATOMIC); + if (ret == -EACCES && clk->info->state_ctrl_forbidden) + return 0; - return scmi_proto_clk_ops->enable(clk->ph, clk->id, NOT_ATOMIC); + return ret; } static void scmi_clk_disable(struct clk_hw *hw) @@ -133,8 +138,13 @@ static void scmi_clk_disable(struct clk_hw *hw) static int scmi_clk_atomic_enable(struct clk_hw *hw) { struct scmi_clk *clk = to_scmi_clk(hw); + int ret; + + ret = scmi_proto_clk_ops->enable(clk->ph, clk->id, ATOMIC); + if (ret == -EACCES && clk->info->state_ctrl_forbidden) + return 0; - return scmi_proto_clk_ops->enable(clk->ph, clk->id, ATOMIC); + return ret; } static void scmi_clk_atomic_disable(struct clk_hw *hw) -- 2.37.1