From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8311FC433F5 for ; Mon, 21 Mar 2022 01:30:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 01E3983AF7; Mon, 21 Mar 2022 02:30:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=oss.nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="Pj8BZ+vE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 60D7A83AF7; Mon, 21 Mar 2022 02:30:44 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20625.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::625]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6526983AF7 for ; Mon, 21 Mar 2022 02:30:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=oss.nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=peng.fan@oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OJAaIzs+7g3VUSlK8O0X05YAEk7jqjgwFczee4SJGvu3s0Bc9JmsvB/K8taGcV4jjvVrMgahTzFr3Ybv1+HnnI1mPL//wMEEqbD1B+jYLTvlja76BvFlwEM1WfNT49RFF6D9dwk126YmnWsGDSB6psxU0aRBk8ie6nOurb609CLNuqkKDMU3gC1LbQ04vQozXeQo3NUTw1e5P1HoGM/jxcFqWzax5sNnl5zh46kw6Q//3q80zZNY/sVeLURxiQFQgYAFW327GpWPw120IrNeb53DCpr3oTkr4/ZBxaH9gk07Qph7MDOwiZx6U87vH5h5ATFSugYTRLBZl8pfD1i9IQ== 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=lQA1ws6EDtiQ6f4IzlM7sQbuhhTYITjgbSOm2DAvXIo=; b=Km7s9QxrF3SmGQyQSVsi3eilLR/I8h+Phh1JbbEGClPqZSKvByaCDX7uptZCUp64Zd/BcyeoU2NmBu3P+D1l596nOqujo2Iz1WwoG6za5KjEAdWa+ai4bwieqhjJvXcjHQLkhRkBTvZhzUXFKSimGXLOqV3lf+Lvec4g7eYlNTLXvKcmLA/1Kb9Y2Wlvb94pjB2GiDMPCeMUFAL3wnRn31ByqxQOX/B/GTaywDqkdJhTXmRhasEqAj+a4lxX3Y9nEukP5Ao09ZXiuv7yNlamkrd4S+u/l1EW679uTCrhOcbaev3xPTeyG5bI0O/TiCgYVT7KADpebckqwKH/02eECA== 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=lQA1ws6EDtiQ6f4IzlM7sQbuhhTYITjgbSOm2DAvXIo=; b=Pj8BZ+vECuTDr4IZLO7VPoRbfq+7aVKVcIQO6elKIbizIqx/TzlX/+LfwyRepDPNVBEuOfWxTUpVkCMyqEFYYFMRdC/b5rc07VME14NxA+f1vrXfjcIsE/s7qhJG9vHuQNddLUsPLDs+MdhmgAu2Se+64dwMZbdNcM2UVVQpepo= 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 AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.22; Mon, 21 Mar 2022 01:30:34 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::cd28:b224:dbce:5f5e]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::cd28:b224:dbce:5f5e%7]) with mapi id 15.20.5081.022; Mon, 21 Mar 2022 01:30:34 +0000 Subject: Re: [PATCH 2/2] clk: Use generic CCF ops where possible To: Sean Anderson , "u-boot@lists.denx.de" Cc: Peng Fan , Eugen Hristev , Claudiu Beznea , Cyril Jean , Lukasz Majewski , Giulio Benetti References: <20220320203446.740178-1-seanga2@gmail.com> <20220320203446.740178-2-seanga2@gmail.com> From: "Peng Fan (OSS)" Message-ID: <1e00aafa-2eee-14e7-9abe-57bfb11505b8@oss.nxp.com> Date: Mon, 21 Mar 2022 09:30:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <20220320203446.740178-2-seanga2@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SG2PR01CA0116.apcprd01.prod.exchangelabs.com (2603:1096:4:40::20) 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: 3b19211f-3435-42e4-1986-08da0ada6520 X-MS-TrafficTypeDiagnostic: AM7PR04MB7142:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kp0E0KecgIBpqtDRCNgKQvaVPw7GGwKTL1CVCbbYM523jt7ysdrlgr8x57PYSnUVuU5vJnVGKO4+TzOURv70L4GucGvdqhhtKKL+RqZ1EbwlSQyBMmaJi/5fRKnufItKM81YCu18NmhjlScwwmBZAJGpTS+Bf8HZKfbna5cp7VXmdOrGizlg9Gxbk2ABtbZjCwd+Wm+dB1c4Y5Jb9Fxz+Fp4DC6djnanwnMjAMyidTfRxzb1bA1whIylzj+LeCj4ETP40aPKpDbglWUdZ+MCYta4PUk4yJYGchaBhvDoPPpxJQRnhspFO4dm8kpG8Lyo2rGpqUU/doY3kVfpROh6ELzjalq+34yevC/rT/EK2ZfT85k89yGy8B2NSH/FbBr7MdbL5feCWI3yyznrxIYytJH+uZAHU85HslQS18rEsWgjecELAfgk4pKDauqsYlM7KVgixin4wZ4G4AWM60IOLyQniUEc7fhivZEvitshuXNyUt68RkJ5TPXPAosU43jFXkB2pMQjegrA6DxvRk/fEPqlKOEqMvh4kDGHkb/3/CiW5tRouOKVTxi9DMPrWVwykaQTc/5TI16JgYuzvbJefnAhKXV6qt8yoosXBkelRqS7FbUw09XJt/CsftB8+CribkfMPWn1WOkhFzxitawKJZVQBCE2WQIoJpD97TeG4mOzx4rYTWL71SI1pvzKmE92gjQnaa+8k1vGmWA0fJsVo2wuhfOMEn+sNvflZJMxOwy9IDtYHF2ji2Ei1c47VXguSjiBtiUwnAKDHvuKQk+XTH7VhYXHHXr5K2HtEV/dRhE= 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:(13230001)(4636009)(366004)(508600001)(8936002)(31686004)(54906003)(110136005)(316002)(5660300002)(38100700002)(38350700002)(52116002)(31696002)(6666004)(30864003)(86362001)(6506007)(53546011)(4326008)(6486002)(66476007)(66556008)(8676002)(66946007)(2906002)(2616005)(186003)(26005)(6512007)(83380400001)(41533002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TDVyQS9HSVdaWGZSZ0ErVmx0SEw2OGVtc2Z6OFpJN3o0bUQrSi9VdVhESVhm?= =?utf-8?B?NmdvbXlLUk9odGNYaU55bFhLRmswd0EvbGZuWHhQL0x0NTNndHpRUXNSS0hF?= =?utf-8?B?TTNBemU1UW16UkhXNTlHSEVuNDVoQkErSllwUFFoOW1MWFpvWDVhVEw3bDBT?= =?utf-8?B?Tk5XVHlUMkIrdUx4cVNabmFBSkxXb2hPL1JaWmRiWlNtMzNSVGtuWEtOcUty?= =?utf-8?B?QUtIY285ajkwYzNLQ3ZyemdkV1VmZ3dIQkRBSnFjZU9aTVMxMUV4eDF6TFZU?= =?utf-8?B?ZmZiQjdLOXdGclB5UTJnbkYwS3NqVWNCZzdWeUU1ZUd3UDMrUlR2UzdpeEx5?= =?utf-8?B?eGZlekYrUUJmUjN5NVh1SU9BL2pYamZJN2dLZ0FqSXB0N3F0RnlGOTZPS0Fz?= =?utf-8?B?UWN0cThXMFpFb3Y2ZVlkS2EyWlJmOC9TTkM4VW9LblhjY3JxZjI1TVhkaW1H?= =?utf-8?B?bG9TcDhIT1YyU0tUYkxqbE5DUUkwdXZlVnk3eUFOaEtDeTFLUU5pUGdJV2NT?= =?utf-8?B?ZUVNdVFWa20vUTJRUlFxZjByc1NZc2V6RVErc1dMZThTSmR6N3BHeXZRK2Zr?= =?utf-8?B?U20reDZRWGFtbjYxVjZicjVnMm5pV0ptNjVUeGcxUlJPaTM3UkNWbWF4TU8r?= =?utf-8?B?WjVTeW5LYTY1U3U4YXF1ZGxxaWtHQjJVUzBrWVFaNXh1Nm1reHc3alUrZGN6?= =?utf-8?B?UmFpUWpwSS9Xc1U2NHJ5Q09BS1BKV1lIVHY3Y0JhVms4R2hTaWNzYU44ckgr?= =?utf-8?B?ekpNTmozWjc4N1hSdGhhWVcxVlliWHhIMTA5RzBiSFNMcndsclZRdHFQQ3Av?= =?utf-8?B?QVlaL3NZU01hNHhMNXBFN3k0WWw3cC9nRmJFMk5ILzZUWDk0aW1zOXBzRTl4?= =?utf-8?B?WlJNbmJQZ1JOdGN2NkMwakRNZUoyVVkzc05kOHRTd1pKY01GNlhvOWQrNUxn?= =?utf-8?B?QkRtbzlLeDBBK3Q5bUF2eTBLTnRTeGpNYjZhSDZsTFZTYlQ1NkluazZhS0NE?= =?utf-8?B?N1pYNkNKNWRnOTBwdGRwdXdZTlVrYmtyUkRWUGFMNDU2dWxDZ2VFU1hPQklE?= =?utf-8?B?N05Qb3QrelIrKzQyWC9ObUlMRXFPOTM4Njc2T1lSSDhPQUdtRTBYZzBKLzNW?= =?utf-8?B?VmhkYlhiWE1oZzNvd2JZOXhoWkM5a2FvS0VqcTBxbll4dnZXNGZTaG8zZ3BV?= =?utf-8?B?SFRGdzlxYis3Z21XRkZ1VUQwT1hQWGJuOEY2QUZ5YWxwcHorZDFTQzluTVpN?= =?utf-8?B?Zm5PNnBnOGE5R1Yxa091YWxCL2ZsbWd5czZNVk1WZ1M0Y080RHVDbnV0emxI?= =?utf-8?B?cFJDYTNkaE5zM2l0ZjZXd3VZanF4aGtBMnl5dEU0Rm5IS2pCdTBuTjB5bmU4?= =?utf-8?B?OFF4U1RGVmgvd1RFeHFUSUViaDBrekRXbDFsVjdwVGdLYkVYMzVpWXptdVQ1?= =?utf-8?B?MmtSZVJTMlRRaFFUYk53U3M5azNLNndUSGQ4K2xFaFRJMVgzRG15R3RTclIw?= =?utf-8?B?cDFhdjNPUjUwRy9PSXVMdzBXcFE2NGNraHhjUmtQcVBGaW9ZVFpmYlFHNVFV?= =?utf-8?B?L09XTThCRXJFemhWS1NXNU82YzAzeDMvYnh3clhzMHJXdnd3K0FvRlhIdzJw?= =?utf-8?B?b0FwL0dWRkpOZDd6ODExVmowK2JRN1NPY2ZxRWdWRjhOak8zeUpRcDRLQXBW?= =?utf-8?B?SmI0K0RaVHUrbVZDbTBTR28zOGFmcDg0Y0NPY2dwanFqUlI4VDhnR1g1dVYy?= =?utf-8?B?cFJ1eWZpbzRuTG94MVl2S0x3bE1Vb1B3dzdkWXhjRDhZVldQeHp0MUkzb3RV?= =?utf-8?B?Y1Q4WWFQT0tFRUlmNE5Gb3preUU3d2ZERENXNU5XRmZZNVNNa1o5WWVXT2sx?= =?utf-8?B?SXdxVEZNY3lqcXMzUGYybGYvQ3RORTI3UG5OTWJLMWF4ZGNqSzRQUVhpZm4y?= =?utf-8?Q?Dylcki1OFgf12AFnoc/bLJhiMUiV/3uU?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b19211f-3435-42e4-1986-08da0ada6520 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2022 01:30:34.5077 (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: Ii0yeSe8RCvXun6GQlzk8FHtwA7ZzdG2T4HzUqe0X1EMwl1Mw+fgXdVHgXKhwv47QXGutX/Ft71WqQneJmpNXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On 2022/3/21 4:34, Sean Anderson wrote: > This converts most CCF drivers to use generic ops. imx6q is the only > outlier, where we retain the existing functionality by moving the check to > request(). > > Signed-off-by: Sean Anderson For i.MX8M* Reviewed-by: Peng Fan > --- > > drivers/clk/at91/pmc.c | 56 ++------------------ > drivers/clk/imx/clk-imx6q.c | 73 +++----------------------- > drivers/clk/imx/clk-imx8mm.c | 88 +------------------------------ > drivers/clk/imx/clk-imx8mn.c | 88 +------------------------------ > drivers/clk/imx/clk-imx8mp.c | 90 +------------------------------- > drivers/clk/imx/clk-imxrt1020.c | 65 ++--------------------- > drivers/clk/imx/clk-imxrt1050.c | 85 +----------------------------- > drivers/clk/microchip/mpfs_clk.c | 67 +----------------------- > 8 files changed, 21 insertions(+), 591 deletions(-) > > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c > index 1fa42d728b..58bf1047b5 100644 > --- a/drivers/clk/at91/pmc.c > +++ b/drivers/clk/at91/pmc.c > @@ -21,60 +21,12 @@ static int at91_clk_of_xlate(struct clk *clk, struct ofnode_phandle_args *args) > return 0; > } > > -static ulong at91_clk_get_rate(struct clk *clk) > -{ > - struct clk *c; > - int ret; > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_get_rate(c); > -} > - > -static ulong at91_clk_set_rate(struct clk *clk, ulong rate) > -{ > - struct clk *c; > - int ret; > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_set_rate(c, rate); > -} > - > -static int at91_clk_enable(struct clk *clk) > -{ > - struct clk *c; > - int ret; > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_enable(c); > -} > - > -static int at91_clk_disable(struct clk *clk) > -{ > - struct clk *c; > - int ret; > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_disable(c); > -} > - > const struct clk_ops at91_clk_ops = { > .of_xlate = at91_clk_of_xlate, > - .set_rate = at91_clk_set_rate, > - .get_rate = at91_clk_get_rate, > - .enable = at91_clk_enable, > - .disable = at91_clk_disable, > + .set_rate = ccf_clk_set_rate, > + .get_rate = ccf_clk_get_rate, > + .enable = ccf_clk_enable, > + .disable = ccf_clk_disable, > }; > > /** > diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c > index 5343036bab..67825af89b 100644 > --- a/drivers/clk/imx/clk-imx6q.c > +++ b/drivers/clk/imx/clk-imx6q.c > @@ -14,79 +14,22 @@ > > #include "clk.h" > > -static int imx6q_check_id(ulong id) > +static int imx6q_clk_request(struct clk *clk) > { > - if (id < IMX6QDL_CLK_DUMMY || id >= IMX6QDL_CLK_END) { > - printf("%s: Invalid clk ID #%lu\n", __func__, id); > + if (clk->id < IMX6QDL_CLK_DUMMY || clk->id >= IMX6QDL_CLK_END) { > + printf("%s: Invalid clk ID #%lu\n", __func__, clk->id); > return -EINVAL; > } > > return 0; > } > > -static ulong imx6q_clk_get_rate(struct clk *clk) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu)\n", __func__, clk->id); > - > - ret = imx6q_check_id(clk->id); > - if (ret) > - return ret; > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_get_rate(c); > -} > - > -static ulong imx6q_clk_set_rate(struct clk *clk, unsigned long rate) > -{ > - debug("%s(#%lu), rate: %lu\n", __func__, clk->id, rate); > - > - return rate; > -} > - > -static int __imx6q_clk_enable(struct clk *clk, bool enable) > -{ > - struct clk *c; > - int ret = 0; > - > - debug("%s(#%lu) en: %d\n", __func__, clk->id, enable); > - > - ret = imx6q_check_id(clk->id); > - if (ret) > - return ret; > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - if (enable) > - ret = clk_enable(c); > - else > - ret = clk_disable(c); > - > - return ret; > -} > - > -static int imx6q_clk_disable(struct clk *clk) > -{ > - return __imx6q_clk_enable(clk, 0); > -} > - > -static int imx6q_clk_enable(struct clk *clk) > -{ > - return __imx6q_clk_enable(clk, 1); > -} > - > static struct clk_ops imx6q_clk_ops = { > - .set_rate = imx6q_clk_set_rate, > - .get_rate = imx6q_clk_get_rate, > - .enable = imx6q_clk_enable, > - .disable = imx6q_clk_disable, > + .request = imx6q_clk_request, > + .set_rate = ccf_clk_set_rate, > + .get_rate = ccf_clk_get_rate, > + .enable = ccf_clk_enable, > + .disable = ccf_clk_disable, > }; > > static const char *const usdhc_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", }; > diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c > index 3aa8c641f9..443bbdae33 100644 > --- a/drivers/clk/imx/clk-imx8mm.c > +++ b/drivers/clk/imx/clk-imx8mm.c > @@ -140,92 +140,6 @@ static const char *imx8mm_ecspi2_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sy > static const char *imx8mm_ecspi3_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m", "sys_pll1_160m", > "sys_pll1_800m", "sys_pll3_out", "sys_pll2_250m", "audio_pll2_out", }; > > -static ulong imx8mm_clk_get_rate(struct clk *clk) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu)\n", __func__, clk->id); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_get_rate(c); > -} > - > -static ulong imx8mm_clk_set_rate(struct clk *clk, unsigned long rate) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu), rate: %lu\n", __func__, clk->id, rate); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_set_rate(c, rate); > -} > - > -static int __imx8mm_clk_enable(struct clk *clk, bool enable) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu) en: %d\n", __func__, clk->id, enable); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - if (enable) > - ret = clk_enable(c); > - else > - ret = clk_disable(c); > - > - return ret; > -} > - > -static int imx8mm_clk_disable(struct clk *clk) > -{ > - return __imx8mm_clk_enable(clk, 0); > -} > - > -static int imx8mm_clk_enable(struct clk *clk) > -{ > - return __imx8mm_clk_enable(clk, 1); > -} > - > -static int imx8mm_clk_set_parent(struct clk *clk, struct clk *parent) > -{ > - struct clk *c, *cp; > - int ret; > - > - debug("%s(#%lu), parent: %lu\n", __func__, clk->id, parent->id); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - ret = clk_get_by_id(parent->id, &cp); > - if (ret) > - return ret; > - > - ret = clk_set_parent(c, cp); > - c->dev->parent = cp->dev; > - > - return ret; > -} > - > -static struct clk_ops imx8mm_clk_ops = { > - .set_rate = imx8mm_clk_set_rate, > - .get_rate = imx8mm_clk_get_rate, > - .enable = imx8mm_clk_enable, > - .disable = imx8mm_clk_disable, > - .set_parent = imx8mm_clk_set_parent, > -}; > - > static int imx8mm_clk_probe(struct udevice *dev) > { > void __iomem *base; > @@ -470,7 +384,7 @@ U_BOOT_DRIVER(imx8mm_clk) = { > .name = "clk_imx8mm", > .id = UCLASS_CLK, > .of_match = imx8mm_clk_ids, > - .ops = &imx8mm_clk_ops, > + .ops = &ccf_clk_ops, > .probe = imx8mm_clk_probe, > .flags = DM_FLAG_PRE_RELOC, > }; > diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c > index e398d7de02..bb62138f8c 100644 > --- a/drivers/clk/imx/clk-imx8mn.c > +++ b/drivers/clk/imx/clk-imx8mn.c > @@ -148,92 +148,6 @@ static const char * const imx8mn_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_10 > "sys_pll2_100m", "sys_pll2_200m", "clk_ext2", > "clk_ext3", "audio_pll2_out", }; > > -static ulong imx8mn_clk_get_rate(struct clk *clk) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu)\n", __func__, clk->id); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_get_rate(c); > -} > - > -static ulong imx8mn_clk_set_rate(struct clk *clk, unsigned long rate) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu), rate: %lu\n", __func__, clk->id, rate); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_set_rate(c, rate); > -} > - > -static int __imx8mn_clk_enable(struct clk *clk, bool enable) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu) en: %d\n", __func__, clk->id, enable); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - if (enable) > - ret = clk_enable(c); > - else > - ret = clk_disable(c); > - > - return ret; > -} > - > -static int imx8mn_clk_disable(struct clk *clk) > -{ > - return __imx8mn_clk_enable(clk, 0); > -} > - > -static int imx8mn_clk_enable(struct clk *clk) > -{ > - return __imx8mn_clk_enable(clk, 1); > -} > - > -static int imx8mn_clk_set_parent(struct clk *clk, struct clk *parent) > -{ > - struct clk *c, *cp; > - int ret; > - > - debug("%s(#%lu), parent: %lu\n", __func__, clk->id, parent->id); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - ret = clk_get_by_id(parent->id, &cp); > - if (ret) > - return ret; > - > - ret = clk_set_parent(c, cp); > - c->dev->parent = cp->dev; > - > - return ret; > -} > - > -static struct clk_ops imx8mn_clk_ops = { > - .set_rate = imx8mn_clk_set_rate, > - .get_rate = imx8mn_clk_get_rate, > - .enable = imx8mn_clk_enable, > - .disable = imx8mn_clk_disable, > - .set_parent = imx8mn_clk_set_parent, > -}; > - > static int imx8mn_clk_probe(struct udevice *dev) > { > void __iomem *base; > @@ -481,7 +395,7 @@ U_BOOT_DRIVER(imx8mn_clk) = { > .name = "clk_imx8mn", > .id = UCLASS_CLK, > .of_match = imx8mn_clk_ids, > - .ops = &imx8mn_clk_ops, > + .ops = &ccf_clk_ops, > .probe = imx8mn_clk_probe, > .flags = DM_FLAG_PRE_RELOC, > }; > diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c > index c77500bcce..ad84ce38ed 100644 > --- a/drivers/clk/imx/clk-imx8mp.c > +++ b/drivers/clk/imx/clk-imx8mp.c > @@ -186,94 +186,6 @@ static const char *imx8mp_enet_phy_ref_sels[] = {"clock-osc-24m", "sys_pll2_50m" > > static const char *imx8mp_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", }; > > - > -static ulong imx8mp_clk_get_rate(struct clk *clk) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu)\n", __func__, clk->id); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_get_rate(c); > -} > - > -static ulong imx8mp_clk_set_rate(struct clk *clk, unsigned long rate) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu), rate: %lu\n", __func__, clk->id, rate); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_set_rate(c, rate); > -} > - > -static int __imx8mp_clk_enable(struct clk *clk, bool enable) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu) en: %d\n", __func__, clk->id, enable); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - if (enable) > - ret = clk_enable(c); > - else > - ret = clk_disable(c); > - > - return ret; > -} > - > -static int imx8mp_clk_disable(struct clk *clk) > -{ > - return __imx8mp_clk_enable(clk, 0); > -} > - > -static int imx8mp_clk_enable(struct clk *clk) > -{ > - return __imx8mp_clk_enable(clk, 1); > -} > - > -static int imx8mp_clk_set_parent(struct clk *clk, struct clk *parent) > -{ > - struct clk *c, *cp; > - int ret; > - > - debug("%s(#%lu), parent: %lu\n", __func__, clk->id, parent->id); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - ret = clk_get_by_id(parent->id, &cp); > - if (ret) > - return ret; > - > - ret = clk_set_parent(c, cp); > - > - c->dev->parent = cp->dev; > - > - return ret; > -} > - > -static struct clk_ops imx8mp_clk_ops = { > - .set_rate = imx8mp_clk_set_rate, > - .get_rate = imx8mp_clk_get_rate, > - .enable = imx8mp_clk_enable, > - .disable = imx8mp_clk_disable, > - .set_parent = imx8mp_clk_set_parent, > -}; > - > static int imx8mp_clk_probe(struct udevice *dev) > { > void __iomem *base; > @@ -409,7 +321,7 @@ U_BOOT_DRIVER(imx8mp_clk) = { > .name = "clk_imx8mp", > .id = UCLASS_CLK, > .of_match = imx8mp_clk_ids, > - .ops = &imx8mp_clk_ops, > + .ops = &ccf_clk_ops, > .probe = imx8mp_clk_probe, > .flags = DM_FLAG_PRE_RELOC, > }; > diff --git a/drivers/clk/imx/clk-imxrt1020.c b/drivers/clk/imx/clk-imxrt1020.c > index 840f783940..3f8b4df3c5 100644 > --- a/drivers/clk/imx/clk-imxrt1020.c > +++ b/drivers/clk/imx/clk-imxrt1020.c > @@ -14,68 +14,11 @@ > > #include "clk.h" > > -static ulong imxrt1020_clk_get_rate(struct clk *clk) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu)\n", __func__, clk->id); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_get_rate(c); > -} > - > -static ulong imxrt1020_clk_set_rate(struct clk *clk, unsigned long rate) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu), rate: %lu\n", __func__, clk->id, rate); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_set_rate(c, rate); > -} > - > -static int __imxrt1020_clk_enable(struct clk *clk, bool enable) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu) en: %d\n", __func__, clk->id, enable); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - if (enable) > - ret = clk_enable(c); > - else > - ret = clk_disable(c); > - > - return ret; > -} > - > -static int imxrt1020_clk_disable(struct clk *clk) > -{ > - return __imxrt1020_clk_enable(clk, 0); > -} > - > -static int imxrt1020_clk_enable(struct clk *clk) > -{ > - return __imxrt1020_clk_enable(clk, 1); > -} > - > static struct clk_ops imxrt1020_clk_ops = { > - .set_rate = imxrt1020_clk_set_rate, > - .get_rate = imxrt1020_clk_get_rate, > - .enable = imxrt1020_clk_enable, > - .disable = imxrt1020_clk_disable, > + .set_rate = ccf_clk_set_rate, > + .get_rate = ccf_clk_get_rate, > + .enable = ccf_clk_enable, > + .disable = ccf_clk_disable, > }; > > static const char * const pll2_bypass_sels[] = {"pll2_sys", "osc", }; > diff --git a/drivers/clk/imx/clk-imxrt1050.c b/drivers/clk/imx/clk-imxrt1050.c > index 3e17161002..5cb5e3bc15 100644 > --- a/drivers/clk/imx/clk-imxrt1050.c > +++ b/drivers/clk/imx/clk-imxrt1050.c > @@ -15,89 +15,6 @@ > > #include "clk.h" > > -static ulong imxrt1050_clk_get_rate(struct clk *clk) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu)\n", __func__, clk->id); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_get_rate(c); > -} > - > -static ulong imxrt1050_clk_set_rate(struct clk *clk, ulong rate) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu), rate: %lu\n", __func__, clk->id, rate); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - return clk_set_rate(c, rate); > -} > - > -static int __imxrt1050_clk_enable(struct clk *clk, bool enable) > -{ > - struct clk *c; > - int ret; > - > - debug("%s(#%lu) en: %d\n", __func__, clk->id, enable); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - if (enable) > - ret = clk_enable(c); > - else > - ret = clk_disable(c); > - > - return ret; > -} > - > -static int imxrt1050_clk_disable(struct clk *clk) > -{ > - return __imxrt1050_clk_enable(clk, 0); > -} > - > -static int imxrt1050_clk_enable(struct clk *clk) > -{ > - return __imxrt1050_clk_enable(clk, 1); > -} > - > -static int imxrt1050_clk_set_parent(struct clk *clk, struct clk *parent) > -{ > - struct clk *c, *cp; > - int ret; > - > - debug("%s(#%lu), parent: %lu\n", __func__, clk->id, parent->id); > - > - ret = clk_get_by_id(clk->id, &c); > - if (ret) > - return ret; > - > - ret = clk_get_by_id(parent->id, &cp); > - if (ret) > - return ret; > - > - return clk_set_parent(c, cp); > -} > - > -static struct clk_ops imxrt1050_clk_ops = { > - .set_rate = imxrt1050_clk_set_rate, > - .get_rate = imxrt1050_clk_get_rate, > - .enable = imxrt1050_clk_enable, > - .disable = imxrt1050_clk_disable, > - .set_parent = imxrt1050_clk_set_parent, > -}; > - > static const char * const pll_ref_sels[] = {"osc", "dummy", }; > static const char * const pll1_bypass_sels[] = {"pll1_arm", "pll1_arm_ref_sel", }; > static const char * const pll2_bypass_sels[] = {"pll2_sys", "pll2_sys_ref_sel", }; > @@ -317,7 +234,7 @@ U_BOOT_DRIVER(imxrt1050_clk) = { > .name = "clk_imxrt1050", > .id = UCLASS_CLK, > .of_match = imxrt1050_clk_ids, > - .ops = &imxrt1050_clk_ops, > + .ops = &ccf_clk_ops, > .probe = imxrt1050_clk_probe, > .flags = DM_FLAG_PRE_RELOC, > }; > diff --git a/drivers/clk/microchip/mpfs_clk.c b/drivers/clk/microchip/mpfs_clk.c > index 05d7647206..67828c9bf4 100644 > --- a/drivers/clk/microchip/mpfs_clk.c > +++ b/drivers/clk/microchip/mpfs_clk.c > @@ -15,63 +15,6 @@ > > #include "mpfs_clk.h" > > -/* All methods are delegated to CCF clocks */ > - > -static ulong mpfs_clk_get_rate(struct clk *clk) > -{ > - struct clk *c; > - int err = clk_get_by_id(clk->id, &c); > - > - if (err) > - return err; > - return clk_get_rate(c); > -} > - > -static ulong mpfs_clk_set_rate(struct clk *clk, unsigned long rate) > -{ > - struct clk *c; > - int err = clk_get_by_id(clk->id, &c); > - > - if (err) > - return err; > - return clk_set_rate(c, rate); > -} > - > -static int mpfs_clk_set_parent(struct clk *clk, struct clk *parent) > -{ > - struct clk *c, *p; > - int err = clk_get_by_id(clk->id, &c); > - > - if (err) > - return err; > - > - err = clk_get_by_id(parent->id, &p); > - if (err) > - return err; > - > - return clk_set_parent(c, p); > -} > - > -static int mpfs_clk_endisable(struct clk *clk, bool enable) > -{ > - struct clk *c; > - int err = clk_get_by_id(clk->id, &c); > - > - if (err) > - return err; > - return enable ? clk_enable(c) : clk_disable(c); > -} > - > -static int mpfs_clk_enable(struct clk *clk) > -{ > - return mpfs_clk_endisable(clk, true); > -} > - > -static int mpfs_clk_disable(struct clk *clk) > -{ > - return mpfs_clk_endisable(clk, false); > -} > - > static int mpfs_clk_probe(struct udevice *dev) > { > int ret; > @@ -100,14 +43,6 @@ static int mpfs_clk_probe(struct udevice *dev) > return ret; > } > > -static const struct clk_ops mpfs_clk_ops = { > - .set_rate = mpfs_clk_set_rate, > - .get_rate = mpfs_clk_get_rate, > - .set_parent = mpfs_clk_set_parent, > - .enable = mpfs_clk_enable, > - .disable = mpfs_clk_disable, > -}; > - > static const struct udevice_id mpfs_of_match[] = { > { .compatible = "microchip,mpfs-clkcfg" }, > { } > @@ -117,7 +52,7 @@ U_BOOT_DRIVER(mpfs_clk) = { > .name = "mpfs_clk", > .id = UCLASS_CLK, > .of_match = mpfs_of_match, > - .ops = &mpfs_clk_ops, > + .ops = &ccf_clk_ops, > .probe = mpfs_clk_probe, > .priv_auto = sizeof(struct clk), > .flags = DM_FLAG_PRE_RELOC, >