Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp226837imm; Thu, 30 Aug 2018 21:51:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaFwzakmwr8xztPjAw6HPFYxMCzAIUQz2EIA87Xpdu7Tt8isnbzz5GRNlLAbTLQxwNCjHtz X-Received: by 2002:a17:902:7d83:: with SMTP id a3-v6mr13531279plm.0.1535691068491; Thu, 30 Aug 2018 21:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535691068; cv=none; d=google.com; s=arc-20160816; b=QV7kItps2KEB+pFmCc67NducKICQvcusxjbQic0Ajjce7lsd3IOJuD+gq4mwPGuwgD 9YYoH5PDEDZluvUu58qGGGpl/AiqAb5T5zM59OEMU/IfPBSqTkcsmbfqg2/MQjZCZDzw cGpVvoj9/3U9BtwA0ly7BOTCme61hznKmhxYLHn73Ybd0xBcXBOtnAbbI2gmkcT9XuFg AHyC2ZmuGzu1zosmgL+B1KHSwWOrs064h1HXlL0l4dOVjC6a9/5XiK5SkcXTrPKyHUea QQZQfq41Ah/lEPZlvWggJ3Qo7RXnY2wP9gM5U02RxCorAt2Il7tU1bvGfQSrDzrj+kCC oinA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Rw9+YfSA6MDu1qVOhtAIGv4iDtfo3XsUT5Y+EGVeicw=; b=go7C8WeSRHvd4Aw8i6QarfXSlFExmxKCsxhyiZsFL6FZsZFzlEXye5Zg1LQAnjhYMk cYLngI1UknFXg8T1ZDfnt2mr04KtJlY0VvEpkisURw7RExKknN1M1K0CkxXxM1q0z5oD k7tGqbs44oIxORPeKUyukcLokneeO+mnrk8s5+58V/JiHVspWXCpvADrbk5ABfNJcQLS 5VcROL3r/kFqd4YZ1BpSe7FQKoXVh8VPweSeeVLzasqWUHOWJUEiSh5x7xHmoAa/20s8 E24kMO9LVBgrXk4SpPzXHBlLqVNIGnCTkoLhdOXD07XNloqjftiTJm/1DTBaU38bRLzi 6ebg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=aGiyY93U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y13-v6si8130632pgp.560.2018.08.30.21.50.53; Thu, 30 Aug 2018 21:51:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=aGiyY93U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727482AbeHaIzR (ORCPT + 99 others); Fri, 31 Aug 2018 04:55:17 -0400 Received: from mail-eopbgr20080.outbound.protection.outlook.com ([40.107.2.80]:11232 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727211AbeHaIzR (ORCPT ); Fri, 31 Aug 2018 04:55:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rw9+YfSA6MDu1qVOhtAIGv4iDtfo3XsUT5Y+EGVeicw=; b=aGiyY93UrBqIa/C5s/6WSsvNbUkBAz9BNS8BsEMCTO/PlbQjk/YPccxHC83mtyrUVjPKyo4OqyvvS6H9ifHS4BcYaQCLw+rolguKTJIO/twAL2vVfp/76+DrETy74Cr+kFmAVpUzGbQ/SNgxy5qkcJiaSBcjg4xL8VbaqhAeLwo= Received: from b29396-OptiPlex-7040.ap.freescale.net (119.31.174.66) by AM0PR04MB4212.eurprd04.prod.outlook.com (2603:10a6:208:66::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.18; Fri, 31 Aug 2018 04:49:33 +0000 From: Dong Aisheng To: linux-clk@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, sboyd@kernel.org, mturquette@baylibre.com, shawnguo@kernel.org, thor.thayer@linux.intel.com, linux-imx@nxp.com, hdegoede@redhat.com, Dong Aisheng , Stephen Boyd , Masahiro Yamada Subject: [PATCH V6 2/4] clk: add new APIs to operate on all available clocks Date: Fri, 31 Aug 2018 12:45:54 +0800 Message-Id: <1535690756-22234-3-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535690756-22234-1-git-send-email-aisheng.dong@nxp.com> References: <1535690756-22234-1-git-send-email-aisheng.dong@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK0PR03CA0061.apcprd03.prod.outlook.com (2603:1096:203:52::25) To AM0PR04MB4212.eurprd04.prod.outlook.com (2603:10a6:208:66::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e4dc8375-e66b-4290-96a8-08d60efd27a5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB4212; X-Microsoft-Exchange-Diagnostics: 1;AM0PR04MB4212;3:vsR42QjYCeb2B5EWlpSueHHlHUzejhfHc+gEl9g1B3AcgaRiXl6rXOauPq/vUEmT5cXJVzURC3Clr4SFxyuKCmWw8qRQ/ROxz1r3Wy9DzP8joeHxuGHsqKfk3FmRB0bl2oL0owNouwyYAVH7jlxD6abKkrdBqlyq7b+hzcZsnv1oZbfuOBBh7o93ZrlG3DRkggK/rBnu4BDmall4R8IhL1MOkaA8Q3FtFEGu0jSNx9oqmlo38wQeR0nsfWSeABKn;25:Fd/N7LLxgIghDcqfvCxkq/Qb5DUeSzcYRdESkkkwyqs1MnIrjo13+0sQ7G93yj7kNfE84TZ6BSB58sDyuFXFw/21hZrAf987szCtHm9ndjXXOgncYpKhCtZru7V7MnJqNAw3+Vd9dp9ElHyAkMOT3lmIkoKoHmMLQBCYKY57/orShyInehF1jhbQueM6y6EZXfonYwfGWhhN2lYXwgA1SzzfO4zGgBEx7C9E3SV9D67/xZKC1H445imy2t3MMgFluYsJrd/heg1bAWkG+aSLf4piudrDz9olvX0BDN2mK/isLd7drq9/GmndBZtfM8VTYEWsPP6pjpmkvMLXCHGFhg==;31:LBQrH+WBcq4fvQOyh3PoQrv3ui/+EGyZbBpw//OxV9FREsmHu3PeCtGnItuQip1CKNtGmeRQcLoJSl2UkxqZsRA1UfudCXeG8wBKNb198RFuYI9niU1y9dXXwz6AZE3LEmkA/a/C3vSrOjOt7JPOPM9gt1aBNW+7I44Yyct6UPLwRwm9O64+pdFTyutFQPwVOXxNZZ5vfiqd2O4AuT3nMRizfhG8FDt6QXmDIAtf26k= X-MS-TrafficTypeDiagnostic: AM0PR04MB4212: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; X-Microsoft-Exchange-Diagnostics: 1;AM0PR04MB4212;20:6tG7GyRcFxlT/Kuk9fiIKxJ4u8DLgzzJrtL/zKlA2VvRgmpXXKmBFL3/y/nFMx5buMJFNw07MjxFwBolSxW/mdgedvTgeH0k7bXWuy7/l2ZBesuBOFLIXxGjd2QlreWkPLH15rdQX2ckkk4UKMyCjOZHQPEsXC6AvDlzxOCug4Y8xaOx3T2VrKTPQbwSIr6mKatko/jMeoo/YwIslsLm+G+8669OrVOxw0YD8rODYREkayvDw3OvhoMw869yT1Gjnn5sH0AFJdYvLrJzDpM6aoGm+yk+koEYTfhfSgeYYl/QUxSD6+bpPdQFrSnGPIE3QvDqzRAe7irLOwxoZX2vsvl6cE5KcJVZ2Iyp593JqP4KG4uyx0V2rOPRAa0fWfFdSeEAIMIE38YCmTuYd1JRCPG6mM4wG0EEjy297gEo7OKqki4LvFxUt+g0eeC8qDid2rtL+QKCcp8EQFwoniGqZ9MKITgVxfhsws6H+ag3qIyr6fr/ltgNwsktguCheIu1;4:Z5OtRLMcmw8mTsvUIbxQTt/KxlXR+r4W9UO28YQ672Ro/LBY4PlJqsPE2z7uYbliEbD/YYb+B8FoyHzvbAUHs6vIywOfbF0H66PNiYFdI8DStEGROGM61fEQXdu7vxiRS27j0LbpF4JOj6i6t+WIEE2OYDl/k09L+OCSvFOrs26pGlpB2o6wvOjtplp5WIBo2Xx/OLlveA9iROGWRgVu+ntMUOb0kI0NKPkPWG8C6oo9xdq66aq16g5JepExwxHqGgdKf1Z8MXXEwqc/Bry6JGUwstJxSZpNkG2qJu4xVud9sGDYyYKbWejD2XjhdxLv/p3gB+oldTHCcJk2+efbAHUtB8/LMjbPmlegb9C2oIU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016);SRVR:AM0PR04MB4212;BCL:0;PCL:0;RULEID:;SRVR:AM0PR04MB4212; X-Forefront-PRVS: 07817FCC2D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(346002)(396003)(366004)(39860400002)(136003)(376002)(199004)(189003)(5660300001)(26005)(52116002)(186003)(47776003)(16526019)(2351001)(2906002)(6666003)(386003)(6506007)(51416003)(76176011)(446003)(11346002)(53936002)(2616005)(105586002)(14444005)(486006)(25786009)(4326008)(6512007)(476003)(956004)(36756003)(66066001)(478600001)(86362001)(6486002)(106356001)(316002)(16586007)(6116002)(3846002)(50466002)(54906003)(2361001)(81156014)(48376002)(7736002)(97736004)(305945005)(50226002)(7416002)(81166006)(6916009)(8936002)(68736007)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB4212;H:b29396-OptiPlex-7040.ap.freescale.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM0PR04MB4212;23:/6vqMsdSMNQ3CAwXz9y37ccyHRPDoh5rR6qJCVZIG?= =?us-ascii?Q?n/vaOERzfT3bEFrUkamOvhEswu2s0dXcZde95mnVBa+dRjuExh/EwPiagsiu?= =?us-ascii?Q?LHx4UdAK8a/fEzQT9Q8Ito2AsQbgTQVDkpj1nUsZgr7KAB+eTYhcMHRQOZK1?= =?us-ascii?Q?qFXgCxXApklsjCiJXqWfGmXH2OyJPlmaMdFAuaoUieBlZK7tw9wAdC3b+dq4?= =?us-ascii?Q?bDVCBwjRNFWpqAtPYvJrFXZUnKYJ9Ryr1mlOHMI5nB55MuLY1PkLJOfdWKn2?= =?us-ascii?Q?MHkVwFJhuCnb2cmzym2rCG+OgE6hHIoRCmub4dGTmM4dMziXGs8tWR4ISosm?= =?us-ascii?Q?0gutUaPKkcwu0k7MGcGcDE6xtaxwasdRFe/xjisxQ6YO5906QEeXyTg1zho9?= =?us-ascii?Q?H41fIl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4IA07Yb0xD4HntVqm7oiXBE94m+CaqmX3KttUYX+F9kTL2rSulkWTSFEf4bUdA8qDhMXuSClR+PSRmiBMzkk4vs2XZKvKTw2zkVJQ84lKay1Lmxxvmc72cIaKZ2VilG2xtM5Va4093PXBq1UEsz6pIpGE59XO2EjCLLrrsD/wfvGcTJKapj79nd3QAPGivmsgWEwcyLaGvWyFh3YQsPP+mdWrCOdgqBAeVCxrSVE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2018 04:49:33.8088 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e4dc8375-e66b-4290-96a8-08d60efd27a5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4212 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces of_clk_bulk_get_all and clk_bulk_x_all APIs to users who just want to handle all available clocks from device tree without need to know the detailed clock information likes clock numbers and names. This is useful in writing some generic drivers to handle clock part. Cc: Stephen Boyd Cc: Masahiro Yamada Tested-by: Thor Thayer Signed-off-by: Dong Aisheng --- v3->v4: * no changes v2->v3: * remove #if define condition * use kmalloc_array v1->v2: * make of_clk_bulk_get_all private * add clk_bulk_get/put_all --- drivers/clk/clk-bulk.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/clk.h | 42 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 92 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index 4460ac5..6a7118d 100644 --- a/drivers/clk/clk-bulk.c +++ b/drivers/clk/clk-bulk.c @@ -17,9 +17,11 @@ */ #include +#include #include #include #include +#include static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, struct clk_bulk_data *clks) @@ -49,6 +51,32 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, return ret; } +static int __must_check of_clk_bulk_get_all(struct device_node *np, + struct clk_bulk_data **clks) +{ + struct clk_bulk_data *clk_bulk; + int num_clks; + int ret; + + num_clks = of_clk_get_parent_count(np); + if (!num_clks) + return 0; + + clk_bulk = kmalloc_array(num_clks, sizeof(*clk_bulk), GFP_KERNEL); + if (!clk_bulk) + return -ENOMEM; + + ret = of_clk_bulk_get(np, num_clks, clk_bulk); + if (ret) { + kfree(clk_bulk); + return ret; + } + + *clks = clk_bulk; + + return num_clks; +} + void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) { while (--num_clks >= 0) { @@ -88,6 +116,29 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, } EXPORT_SYMBOL(clk_bulk_get); +void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks) +{ + if (IS_ERR_OR_NULL(clks)) + return; + + clk_bulk_put(num_clks, clks); + + kfree(clks); +} +EXPORT_SYMBOL(clk_bulk_put_all); + +int __must_check clk_bulk_get_all(struct device *dev, + struct clk_bulk_data **clks) +{ + struct device_node *np = dev_of_node(dev); + + if (!np) + return 0; + + return of_clk_bulk_get_all(np, clks); +} +EXPORT_SYMBOL(clk_bulk_get_all); + #ifdef CONFIG_HAVE_CLK_PREPARE /** diff --git a/include/linux/clk.h b/include/linux/clk.h index 4f750c4..e9433c7 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -312,7 +312,26 @@ struct clk *clk_get(struct device *dev, const char *id); */ int __must_check clk_bulk_get(struct device *dev, int num_clks, struct clk_bulk_data *clks); - +/** + * clk_bulk_get_all - lookup and obtain all available references to clock + * producer. + * @dev: device for clock "consumer" + * @clks: pointer to the clk_bulk_data table of consumer + * + * This helper function allows drivers to get all clk consumers in one + * operation. If any of the clk cannot be acquired then any clks + * that were obtained will be freed before returning to the caller. + * + * Returns a positive value for the number of clocks obtained while the + * clock references are stored in the clk_bulk_data table in @clks field. + * Returns 0 if there're none and a negative value if something failed. + * + * Drivers must assume that the clock source is not enabled. + * + * clk_bulk_get should not be called from within interrupt context. + */ +int __must_check clk_bulk_get_all(struct device *dev, + struct clk_bulk_data **clks); /** * devm_clk_bulk_get - managed get multiple clk consumers * @dev: device for clock "consumer" @@ -488,6 +507,19 @@ void clk_put(struct clk *clk); void clk_bulk_put(int num_clks, struct clk_bulk_data *clks); /** + * clk_bulk_put_all - "free" all the clock source + * @num_clks: the number of clk_bulk_data + * @clks: the clk_bulk_data table of consumer + * + * Note: drivers must ensure that all clk_bulk_enable calls made on this + * clock source are balanced by clk_bulk_disable calls prior to calling + * this function. + * + * clk_bulk_put_all should not be called from within interrupt context. + */ +void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks); + +/** * devm_clk_put - "free" a managed clock source * @dev: device used to acquire the clock * @clk: clock source acquired with devm_clk_get() @@ -642,6 +674,12 @@ static inline int __must_check clk_bulk_get(struct device *dev, int num_clks, return 0; } +static inline int __must_check clk_bulk_get_all(struct device *dev, + struct clk_bulk_data **clks) +{ + return 0; +} + static inline struct clk *devm_clk_get(struct device *dev, const char *id) { return NULL; @@ -663,6 +701,8 @@ static inline void clk_put(struct clk *clk) {} static inline void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) {} +static inline void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks) {} + static inline void devm_clk_put(struct device *dev, struct clk *clk) {} -- 2.7.4