Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3798878rwe; Mon, 29 Aug 2022 21:18:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR4mFpjot5GIrt8YC+1H+5OfEC/NV7dg08iS6uytmF+cIiTxb9O+yr3uTfd8EpYzQAO7YsCP X-Received: by 2002:a17:902:bb94:b0:172:8fd9:7438 with SMTP id m20-20020a170902bb9400b001728fd97438mr18765214pls.174.1661833117638; Mon, 29 Aug 2022 21:18:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661833117; cv=pass; d=google.com; s=arc-20160816; b=pxBhr9US9kstnPPf3lNP4T2tDO7w9wbqwh/NqwIveqJ7Q81lv/xw3xEyf+ZuFCInZa guL9n3c1TxDdpt7g32XgxfIUHoBoCzxQ8Sv4Sobbpwb+27MCGXCVgCY3zbNMXhymeMYV qZ6qG6998+GW6nh8+KDN5wcDA1NaGyeotf1X7U5jPjCc00oivGJ2kWigV18/9fAcf9tZ YCsC/3brnK4q25giBmuM+Oly+zIWndD1ztWgScZZg4CdhyYW4YshuVDQJU+Bfi+kN5/a NeTSyKWx3KzzNWMdjWTrx0MZ0HyuPTNqahqxhmbHVbRcGm3jPo4GYAnsb9uckFPzKzaN uaKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=32kGsytcm/KC6GjyETlExBYBe79w549bCZaIkKOiPE8=; b=QzYzsfSeJJqWjidWOa1QBowfQPRgxu5GjXZOiMeSnJCSWf0Qy6MtYUwlMd5J9atswF dk1EImR6eUZLGqOz1e9dJPmqKCsOYJGfWmcR9S8g1HV+jmr1Zvjb1pmkc8wGDVTkgIFW m0MVnhkExQGf4xxYdqltB5hXMfYWIKyNFzeF0ldvdc0uHPNQI5pmlv95Hhcohpj0bIZy rm3zmtAeb7M1hMH0/ieFe02WQO1O2K0MTSqjzTIqY8LchA+jw2VAqL3a8EpdVQ/W3ftK H0aXnOnl6Fb4UWKVDDJyX0sX7xXo0S6os6mnMxemuAHmnADHLHlFnLREfhtuYMtU0hf2 gLTw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=A9F6Nd+0; 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-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw17-20020a17090b4d1100b001f5902550c5si13233450pjb.155.2022.08.29.21.18.23; Mon, 29 Aug 2022 21:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=A9F6Nd+0; 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-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229653AbiH3Daq (ORCPT + 99 others); Mon, 29 Aug 2022 23:30:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbiH3Da3 (ORCPT ); Mon, 29 Aug 2022 23:30:29 -0400 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10082.outbound.protection.outlook.com [40.107.1.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08DF06B162; Mon, 29 Aug 2022 20:30:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LNzA9HmRY4YvFBCulrXaPMTP/X5lKCp+QRCoq7KFvm7UKVoxXYAFrZVwU2Hc22F6IUZ6ysy0cnzK32lEEZ+itiISVw0Gp3MI6bJmNLR0xmgBBg52p1LrUjLuOSQVvaKulzXzo9rW9XnNKv+6FrM/4sz5q6PfXIsBrfsItWKEP54/qy1nQ+Q8yztbvhkbaset8PenrPbBx0l4ZgZzDmlgrD0UVAkUz1VwNN3gK1Y3JGrjgT1UoeB7OUvl9TPgtWeDxL2+/a8J4eWCnhgWxxvdr848Z/ddtErcQOV2NsahamZXeri/It86Ttr/VGJVGuv0wCq6C3+/oo1XpqBWo6oN6Q== 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=32kGsytcm/KC6GjyETlExBYBe79w549bCZaIkKOiPE8=; b=KlNHFud7nUNYFjtoDTIlhM1IKvBaZdJckr020qnt5CweCLChT87KVtcyzwNBIffziV8zk+8VYIUvPbNfhyQ4u8DOmRcubP/zGN15L0clQc7HhIR2/0HDVe6G6eZ0onL5UF/rbVC7zdmjjW/rESFZOj/JSfxljNzPNYyG8S9U7b9IHYjiS25V8cif7GIzHnosvglFvPBLlMQZ0IMGo94qbTiP+HASohaCdf4i6DoGTgpHX/Fws0CmOmtXx/FTzeilDnGN699PxnlcDCBYigqTH7kFzNMC0mDBYWxS8Wc68iqnf/Tn/Ooo6PcntjCutbM5nKfv8W4rvmLlpL67iZTt7g== 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=32kGsytcm/KC6GjyETlExBYBe79w549bCZaIkKOiPE8=; b=A9F6Nd+0IbjUBUma8p5CYjagbxdT9z4vz7xCAp3YQampLnnV849jZMSNqKKI3ZQjlAN5zCAefO5QuTdyrgN8PeAO0O5nMbZngvbtdZOfasLfZranEjlULs3kllS2JWv/lscWoOp5YaTH/HQFjEK2XbqZ6G86HHQ07L+A/rO76DY= 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 AS1PR04MB9359.eurprd04.prod.outlook.com (2603:10a6:20b:4db::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21; Tue, 30 Aug 2022 03:30:21 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::2d22:3315:6f9b:82c7]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::2d22:3315:6f9b:82c7%6]) with mapi id 15.20.5566.021; Tue, 30 Aug 2022 03:30:21 +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, Peng Fan , Ye Li , Jacky Bai Subject: [PATCH V3 4/8] clk: imx: clk-composite-93: check white_list Date: Tue, 30 Aug 2022 11:31:33 +0800 Message-Id: <20220830033137.4149542-5-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220830033137.4149542-1-peng.fan@oss.nxp.com> References: <20220830033137.4149542-1-peng.fan@oss.nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SGXP274CA0022.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::34) 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-Office365-Filtering-Correlation-Id: 258f988c-b62a-42d7-f1fd-08da8a37f7dd X-MS-TrafficTypeDiagnostic: AS1PR04MB9359:EE_ 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: NGpyyhEbvc2SfHnZ1oe5c0k9bdLz8Fao7WgjINzbp8I2znV/Jj9BBs/PiJFpZzdi0nsOv0aUPpmZ9L6RA/BNoSoeKt1kFYs2vJ+uF+6l9YbHGMLVbz1HrIV/p/eegBNiy6bKJ87eji0J+HMu0HzJVy+PGzk32lYzeZgrcRZLZsXPs1ETwkVzCjedI3cRUr3u3CpAXjGgLP32gDvEUiTb0vaZUah3bMsMQZW8Zgs7U+Tq1lyLiKoSBEsKzef/3t7DK3gv/y8d8BsZ8ZjKUlcL6WN5w5zZCpn8LfdoIJS8pGk39nx36ARPP+EIki7kBhsuQf9SwS1zd93IyPjDBm1fRkA+YXVww5nsDn4IO6wGoZWwS5EnjyjWK2wC/5Pt6qPNSasPeAOWng2XS9y64LQ0KZe2iGjD3DqWmzJBpbJke5519Ofs4wGG7Ts+sDLH1pYfX68ew8TnuxXxREzeukpX1aSljF6sCEbRN1vULu7ZNKTtkB49CUSeD0rNI072LHs2WRFSJ+Xa6Z+W4YirAQ7f4CJH0in5xwZK12n1zFvEHJ8pa5VbCH1qr4eN1yjJ0147ELAzMvfXEO6Asfr9LFYEazZTm1u9S8r0kdMJ6mAnIqxzRpeKKUfkuC99heczdeSLMbWtvtay81H8AgaTeKdlrhrzbojP/N/e3QuR/hkcBzsTWuG7Wn/Xkyi5NdNtjhwGH9tSb6XnZT5fefdXkXloPR2UTUrVMj+gSKUhPIDfUc6U4z35I6z8pLsVpSxKUyry83d4E6Ivk5SjgttePVsX9g== 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:(13230016)(4636009)(346002)(39860400002)(376002)(136003)(396003)(366004)(8676002)(4326008)(66946007)(66556008)(38350700002)(38100700002)(86362001)(83380400001)(186003)(41300700001)(1076003)(7416002)(478600001)(6506007)(26005)(6666004)(6512007)(66476007)(2616005)(2906002)(54906003)(316002)(52116002)(5660300002)(6486002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?TC1GiNjftjI9Oi8XlbEoLjQWCNGtU+9kH//Dn0hRsQ3aQA9WsseLccwhIKWM?= =?us-ascii?Q?af0F131tTaU6qDrsgQ7Kf+hz22gXl012o9yjtmoSGKzQpN27ByqS9r6Z/BRJ?= =?us-ascii?Q?tTsigkqNCRTJVKaiQkS2RqET9uRL9fk24NLZWflOMkHe3PkAAogncK6bg9T2?= =?us-ascii?Q?74nlamOG4I8FeeL0k01VxStBsvTbV8YF8tBWV9emyoqHqLkCyp3pjZo267xO?= =?us-ascii?Q?Vz5HjXrUgmZxXgNYVm0Ek55K82O5TLvZ5kfWspX/LbgZTfTBkUw+66wIQnWr?= =?us-ascii?Q?lnLYa89VDNBtIE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= =?us-ascii?Q?JfRBFIMWXzpGU9/r89uH3fW0t0BLEc3O0mSX+IRRJkvJ2cyNsp+CPoUwIKBX?= =?us-ascii?Q?RvOM5MXBrkIKWjoSA64hAy3Dm80J8b/Zam+3Ivq/0v1ZhEm17nEAtGy/QXpH?= =?us-ascii?Q?2FTTKcpKZTjlh5lNSAT4+95/NT/MKSh+MDVD3nboaUmx2ykNo02W6BTlYa6p?= =?us-ascii?Q?lAYK2vQ23Zhwlp2Ey0gQbtG3yDflL3rB5jOfiEw4G7fBkuze4VVgu6bTb8lA?= =?us-ascii?Q?vMEbOcl1icCmmDAMXhccKDk6JOHYZWtf5VBD0yqKFOuiGVkn5l0qTStmL7ry?= =?us-ascii?Q?VnqkZdpQ6kgPw0cESI0FIcveHjlYje3Enz9LjeJFFKDPXxVRORUmlKwK/pnP?= =?us-ascii?Q?XLXxraMQxhrg9y1LTqfo/8zMC7fU733wDOeM9P+h?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 258f988c-b62a-42d7-f1fd-08da8a37f7dd X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 03:30:21.5510 (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: /mcpkApQUKTov55Fe0MewFuDaxSHOTVy3EZz1U9lxqe+wpqCr53xsZuGy7SivEl0iBk26R8Jnj05lFbjZcYgEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9359 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Fan The CCM ROOT AUTHEN register WHITE_LIST indicate: Each bit in this field represent for one domain. Bit16~Bit31 represent for DOMAIN0~DOMAIN15 respectively. Only corresponding bit of the domains is set to 1 can change the registers of this Clock Root. i.MX93 DID is 3, so if BIT(3 + WHITE_LIST_SHIFT) is 0, the clk should be set to read only. To make the imx93_clk_composite_flags be reusable, add a new parameter named did(domain id); Signed-off-by: Peng Fan Reviewed-by: Ye Li Reviewed-by: Jacky Bai Reviewed-by: Abel Vesa --- drivers/clk/imx/clk-composite-93.c | 8 ++++++-- drivers/clk/imx/clk-imx93.c | 2 +- drivers/clk/imx/clk.h | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/clk/imx/clk-composite-93.c b/drivers/clk/imx/clk-composite-93.c index 19f4037e6cca..74a66b0203e4 100644 --- a/drivers/clk/imx/clk-composite-93.c +++ b/drivers/clk/imx/clk-composite-93.c @@ -28,6 +28,8 @@ #define TZ_NS_SHIFT 9 #define TZ_NS_MASK BIT(9) +#define WHITE_LIST_SHIFT 16 + static int imx93_clk_composite_wait_ready(struct clk_hw *hw, void __iomem *reg) { int ret; @@ -180,7 +182,7 @@ static const struct clk_ops imx93_clk_composite_mux_ops = { }; struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *parent_names, - int num_parents, void __iomem *reg, + int num_parents, void __iomem *reg, u32 domain_id, unsigned long flags) { struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw; @@ -189,6 +191,7 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *p struct clk_gate *gate = NULL; struct clk_mux *mux = NULL; bool clk_ro = false; + u32 authen; mux = kzalloc(sizeof(*mux), GFP_KERNEL); if (!mux) @@ -211,7 +214,8 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *p div->lock = &imx_ccm_lock; div->flags = CLK_DIVIDER_ROUND_CLOSEST; - if (!(readl(reg + AUTHEN_OFFSET) & TZ_NS_MASK)) + authen = readl(reg + AUTHEN_OFFSET); + if (!(authen & TZ_NS_MASK) || !(authen & BIT(WHITE_LIST_SHIFT + domain_id))) clk_ro = true; if (clk_ro) { diff --git a/drivers/clk/imx/clk-imx93.c b/drivers/clk/imx/clk-imx93.c index dcc41d178238..6d9cbe26b2fb 100644 --- a/drivers/clk/imx/clk-imx93.c +++ b/drivers/clk/imx/clk-imx93.c @@ -293,7 +293,7 @@ static int imx93_clocks_probe(struct platform_device *pdev) root = &root_array[i]; clks[root->clk] = imx93_clk_composite_flags(root->name, parent_names[root->sel], - 4, base + root->off, + 4, base + root->off, 3, root->flags); } diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 5061a06468df..396a5ea75083 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -445,9 +445,10 @@ struct clk_hw *imx93_clk_composite_flags(const char *name, const char * const *parent_names, int num_parents, void __iomem *reg, + u32 domain_id, unsigned long flags); -#define imx93_clk_composite(name, parent_names, num_parents, reg) \ - imx93_clk_composite_flags(name, parent_names, num_parents, reg, \ +#define imx93_clk_composite(name, parent_names, num_parents, reg, domain_id) \ + imx93_clk_composite_flags(name, parent_names, num_parents, reg, domain_id \ CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE) struct clk_hw *imx_clk_hw_divider_gate(const char *name, const char *parent_name, -- 2.37.1