Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1896939rdb; Tue, 3 Oct 2023 04:44:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJqguZTkWkIGXK6Kn6RKYcn5h2DvRC0lx3AOdwUaNW6rFnCfozdUrADm/4J15pu1yBqsYj X-Received: by 2002:a05:6870:7026:b0:1bb:509a:824f with SMTP id u38-20020a056870702600b001bb509a824fmr17559057oae.55.1696333480944; Tue, 03 Oct 2023 04:44:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696333480; cv=pass; d=google.com; s=arc-20160816; b=o1uz8uvmg6knQNvtS8v37eaL+/9LueXsBkkiVBGD2CcV/2PU6iURpnD9U61ID9wO/E 5f9zveD6o149/JKEmKTO4pMMQjBlfEVbsVN1+dRAEXaVc3CoiCRpkXXowiN8+5KjZROM FyyzCuZPaObTxdbaVTVzQVHwu6xczdDx3s8Sukr6DSDEYq/ovfXjQ2uap2+mHE1SJBan Kbr5Cxit92/T2WJIKVDD/txYKAtFmyyD8/ul08MdqWrmrpxXKapqXcywBS1/MHKyqJYr Wo2Y0ClJnf3xjXMpbZ+CBqpKvwDVScb7zUKclyfrF36XVDlz0MEwBz8us4Y7NtEEzzap E63A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:cc:to:in-reply-to:references :message-id:content-transfer-encoding:subject:date:from :dkim-signature; bh=rhjNGsp4xwdX0P6o9i0kzlk25NllGv3UowCaiQQeSaI=; fh=7d4W98/DO6zHn4gJg02zz+CsoFOyvFgc78S2RHb70N8=; b=yDit8+o3PoXFWRHKqwaRuUGeo+Ddz+3MOIJ43lLShuvKD/vus4Pwc7kxf5/Y8ZjRYB HuzSlTD+m5hE4zkP3bN9eM6mYl7LwGxZb2qxotmdGyJYkgwXm/W/Rpb7EeB9DWXIKZfE vnoeRJIVXpwslleOvSOqo3XiEUs7N6d7Xh0kij3JB+3uX9+2ISXqXNAWWGufOChwlFJk QPCD+mx2rRk/JdLBse6XHosjeV7/6JI07baPDu2mW794mqnVB/ocL/zfs3jlL6/R/Wi7 QZ1b/+lilo8MyZsaggyFGbk+IlQZs4KIqo7NoRI2ygzKPMqN1frRj2njg4ba/o0I8LbB MTsg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=b5xKnoyR; 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::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q16-20020a63cc50000000b005659b757791si1270090pgi.384.2023.10.03.04.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 04:44:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=b5xKnoyR; 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::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0D0C2818ABE0; Tue, 3 Oct 2023 04:44:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240621AbjJCLob (ORCPT + 99 others); Tue, 3 Oct 2023 07:44:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240604AbjJCLo3 (ORCPT ); Tue, 3 Oct 2023 07:44:29 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2042.outbound.protection.outlook.com [40.107.20.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64BD9B4; Tue, 3 Oct 2023 04:44:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gd+gFAc1x+t0cVf5sVH/cvnbBOr5eQJDDGflzKP69ff9B4WhktTDG1GOBq5HeDX5dLdaRuqQ7DOe3JDsDG9fyl009V1XzftedHikUA1iyuI0JIozLGERLIA3xJB44T5NcilfOxC+rftxpS4Hf/o4HsDbdQh4swhIjituL4oPdZqCcwl8lGwZ8qTL9Opsj/sr9ehNvLBl/aa5jgaLSjB4wL+9b1Oncl6M6093qSa8P23Pqwxe9AJKplR7IborASddUjKB9c5f/J0bNOQ655UhKccBT2WdzHE4DWPzjlYNjmhvfMbo0Tw863C2cABVA/BRuBYfb9U9HpOPcOkyUJEHvg== 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=rhjNGsp4xwdX0P6o9i0kzlk25NllGv3UowCaiQQeSaI=; b=HRpEhwdJmyKijOPR9U215f9p3NTku3A2CocGdrTSxGXuABcoWpYl4SzPDlptjjAUdqOM7hNn+AIwOtA7BTSUCJv+USu/uRwOPEodEOudRraP8g9LMDbh7/ijErhwZvQPj1z+a64taxT+cSVpahXckdHfexiTdX0PdCfSUIvs86BVeX4Mw3yt8jjyBMU3mWsUm9ZySxKk9ertD09bw/BdQmX/zviuK0QiY8GZLy2ZE19ojFUX6Ja2TheaIIBNr7MSCMBnxUoEgj5uSwSul7xI6WRwjXnb61yANFXzoM/b1NQRNBD7Mw653ebUcsnC9H0XoOmdCRlmS84GR0i2kGnf3Q== 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=rhjNGsp4xwdX0P6o9i0kzlk25NllGv3UowCaiQQeSaI=; b=b5xKnoyRq1Ff4KFSPYVEoe06W5qj6Cn4Y+/ww1+sKgiI8MTTLeJ0k1FQsff38bzq3zGAumW+w3lYuTbMNVkQH/wMDGDxx5ChnuyQFjAkXfkeWv2mcxtxqyyqcFkmeDTApOGhkCbZfPc0ngqVJ+tnI66Y/HK/DwAHB4avg8zwYRk= 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 DB9PR04MB10067.eurprd04.prod.outlook.com (2603:10a6:10:4c8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.26; Tue, 3 Oct 2023 11:44:22 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::2b3:d8de:95c8:b28b]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::2b3:d8de:95c8:b28b%3]) with mapi id 15.20.6838.024; Tue, 3 Oct 2023 11:44:22 +0000 From: "Peng Fan (OSS)" Date: Tue, 03 Oct 2023 19:48:49 +0800 Subject: [PATCH v4 2/2] clk: scmi: add set/get_parent support Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231003-scmi-clock-v3-v4-2-358d7f916a05@nxp.com> References: <20231003-scmi-clock-v3-v4-0-358d7f916a05@nxp.com> In-Reply-To: <20231003-scmi-clock-v3-v4-0-358d7f916a05@nxp.com> To: Sudeep Holla , Cristian Marussi , Michael Turquette , Stephen Boyd Cc: Peng Fan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1696333746; l=3574; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=MEH6g0VX59/MRx44I4/IiR8vh5iZLuYSBdn2AKvC5sQ=; b=8p/C+mQjxnZ2Gh8BEQilCyIs73x2bWLnu6kce7+FocjU7sIvGvkGhDerfcKjqhZ+GHRVm1MJu q8PQMkulFtDDYPhQn+sNYWwEwm9O9rx87gxTfVSFIWSgQhShmbSEgvR X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2P153CA0002.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::16) 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_|DB9PR04MB10067:EE_ X-MS-Office365-Filtering-Correlation-Id: 61c1e95c-b098-42eb-85fd-08dbc406165c 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: GfH1wF/EtXw+2KMQaKQs+eh+WwH64L85vd7Yui1HRNj55yMVkg593Coa5XDI2ku2VVBBdNR2RuFwrhJFfqFx/mXW025v24uiWKZa0SA5TEkuXo8MpoGceE5OQ0/UvCaRaHWxzXGQmqha6hy0OoQhvVE8P2iKNEFqMnPpFLfOhH9ojXY1jfKYGJQWjAeCdqph1Iz4LNcYzZmLzdTBZS/Jy3MoOom0ZSE2SaQ+kNJWZ3ClT4CglB+TCRDFWicqkIelgaiQzfQqliDSb7hIQ9kMB9T+8oa374lImXReGG2NzjUVHaZDmBMkUotJF5NRv7gl1y6WvWpSojntS8i/PX7Ff3jcVVqAL+ovtx610N7gDlsOfGvIbv0/w1IalQjIs7ligtl7qOC2sblmwMQT5/6I7Fls0Sr7wwBIIoThxWkbO4KFXGtxQQI+pHfqoB0G+PCl9poPyv9ahAAxVDLSFa2FXsHEP2GvqtuMkFzkEnZAGNfri5mZwSG5Y2nFs6C+5va+a1MWZB/8WlGwULwgtiAz0Basq55oNahdaykEgFdVKshqvFx133zaEHbWwI9TZ7fEDxj5+56fCcHa2cCndqGtvpQ3IyD8dhLijkNlBBxpWKK+27WHOuAoI5MbjIlfimls 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)(136003)(346002)(366004)(396003)(376002)(39860400002)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(8936002)(316002)(66556008)(478600001)(66476007)(83380400001)(9686003)(66946007)(4326008)(26005)(36756003)(41300700001)(8676002)(6486002)(6506007)(6666004)(86362001)(52116002)(38100700002)(6512007)(38350700002)(110136005)(2906002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K3BZSW00b3l5b2ZEakthb0NhZkFUR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B?dkQ5NU5BYWd0SEpLRkh4U21LY0s4TVhUREwwWWd0MlpHcWx0TUJhdC9ydDBx?= =?utf-8?B?OG8wNTV0eHBkMXR4eStkTC9Nbm1uY2VKNjFkQU5WaFVKbmxXNS9PSVh0ckdt?= =?utf-8?B?ZEFoVllMSEFsTEJJSzlRK1R2SEVTQkVFcnhKY3B0SFAya3FDL1c3VE9KeUI1?= =?utf-8?B?ZnhBNHZEWFdDdTRFZ2d1enQvNkNWS2JJZVpDOGkwcEhNV2lpVDlrcmpqUDM3?= =?utf-8?B?alVVejgwaWQvN0FwOXgzWFplTEs5WkxMclFqT01LeHYybTFRNHpDQ04wMFIz?= =?utf-8?Q?8y8t55G53K3FRNXf3F6lWLCO6?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61c1e95c-b098-42eb-85fd-08dbc406165c X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 11:44:22.8143 (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: t11JKuufYl0WYaDbxdnC3sh1wVn21etbsHfhBiagVGfv6npbpqTfRNeDtTpbjTAi3eLlXgnp5WXTozciZEPIAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB10067 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 03 Oct 2023 04:44:39 -0700 (PDT) From: Peng Fan SCMI v3.2 adds set/get parent clock commands, so update the clk driver to support them. Signed-off-by: Peng Fan --- drivers/clk/clk-scmi.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index 2e1337b511eb..e7a27fda561b 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c @@ -24,6 +24,7 @@ struct scmi_clk { struct clk_hw hw; const struct scmi_clock_info *info; const struct scmi_protocol_handle *ph; + struct clk_parent_data *parent_data; }; #define to_scmi_clk(clk) container_of(clk, struct scmi_clk, hw) @@ -78,6 +79,43 @@ static int scmi_clk_set_rate(struct clk_hw *hw, unsigned long rate, return scmi_proto_clk_ops->rate_set(clk->ph, clk->id, rate); } +static int scmi_clk_set_parent(struct clk_hw *hw, u8 parent_index) +{ + struct scmi_clk *clk = to_scmi_clk(hw); + + return scmi_proto_clk_ops->parent_set(clk->ph, clk->id, parent_index); +} + +static u8 scmi_clk_get_parent(struct clk_hw *hw) +{ + struct scmi_clk *clk = to_scmi_clk(hw); + u32 parent_id, p_idx; + int ret; + + ret = scmi_proto_clk_ops->parent_get(clk->ph, clk->id, &parent_id); + if (ret) + return 0; + + for (p_idx = 0; p_idx < clk->info->num_parents; p_idx++) { + if (clk->parent_data[p_idx].index == parent_id) + break; + } + + if (p_idx == clk->info->num_parents) + return 0; + + return p_idx; +} + +static int scmi_clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) +{ + /* + * Suppose all the requested rates are supported, and let firmware + * to handle the left work. + */ + return 0; +} + static int scmi_clk_enable(struct clk_hw *hw) { struct scmi_clk *clk = to_scmi_clk(hw); @@ -139,6 +177,9 @@ static const struct clk_ops scmi_clk_ops = { .set_rate = scmi_clk_set_rate, .prepare = scmi_clk_enable, .unprepare = scmi_clk_disable, + .set_parent = scmi_clk_set_parent, + .get_parent = scmi_clk_get_parent, + .determine_rate = scmi_clk_determine_rate, }; static const struct clk_ops scmi_atomic_clk_ops = { @@ -148,6 +189,9 @@ static const struct clk_ops scmi_atomic_clk_ops = { .enable = scmi_clk_atomic_enable, .disable = scmi_clk_atomic_disable, .is_enabled = scmi_clk_atomic_is_enabled, + .set_parent = scmi_clk_set_parent, + .get_parent = scmi_clk_get_parent, + .determine_rate = scmi_clk_determine_rate, }; static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk, @@ -158,9 +202,10 @@ static int scmi_clk_ops_init(struct device *dev, struct scmi_clk *sclk, struct clk_init_data init = { .flags = CLK_GET_RATE_NOCACHE, - .num_parents = 0, + .num_parents = sclk->info->num_parents, .ops = scmi_ops, .name = sclk->info->name, + .parent_data = sclk->parent_data, }; sclk->hw.init = &init; @@ -250,6 +295,17 @@ static int scmi_clocks_probe(struct scmi_device *sdev) else scmi_ops = &scmi_clk_ops; + /* Initialize clock parent data. */ + if (sclk->info->num_parents > 0) { + sclk->parent_data = devm_kcalloc(dev, sclk->info->num_parents, + sizeof(*sclk->parent_data), GFP_KERNEL); + + for (int i = 0; i < sclk->info->num_parents; i++) { + sclk->parent_data[i].index = sclk->info->parents[i]; + sclk->parent_data[i].hw = hws[sclk->info->parents[i]]; + } + } + err = scmi_clk_ops_init(dev, sclk, scmi_ops); if (err) { dev_err(dev, "failed to register clock %d\n", idx); -- 2.37.1