Message ID | 20230117061453.3723649-15-o.rempel@pengutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1588731wrn; Mon, 16 Jan 2023 22:17:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXu15Zl6owKOXtrV2/8/SqIQpucw5YXjcypjsssp6LYfTX4CnHyaXlSDm7W6pnB9b1eSzpVU X-Received: by 2002:a17:906:f74a:b0:86b:5507:8aef with SMTP id jp10-20020a170906f74a00b0086b55078aefmr1710592ejb.65.1673936251472; Mon, 16 Jan 2023 22:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673936251; cv=none; d=google.com; s=arc-20160816; b=KRgHa/TxyaBAw+/8Ru0W3+cm3Vsxh5RYAxl9HaxkKRsrsGj+O59/NP29p7b1mz6Ae3 ZckMksul2igdy5KRUYj8zVTMs36saW7AkpHVWAIkDYxNf0z0rTPYVFwiImchcWaOeict oodVuDSNhRQMzwsttXGJ4OiMyt1bb6K8u0ZxeZhJNp5m8ablMdYh8dLqfeY3HX6kXy7h QOfH2CQlJhWE5QD+E9WPtXnH0N37fvuIY1F4xCCtnF4qyu8I1YuxacNrhM66C9/2fpSt Y83C2/NAtVnFsUevJduASQjyFRClV6BHbKvkXaSaGsWaQyfjXxFvzITjsbfXCi7O5Io7 mOUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=erOK/BwhhaUIzYpLu53F8V+4VxqvNsqOd1HQ8PpKcys=; b=bhC4pB8HH7GDSReK/pVhofkipFm3pahHIrqwIJ4ehRqlgkjR35Fl0LYa3zq0wGx6Zj Nv04ldnl9O1AIeRoqH+B3OUVZWSdQYrJEKtowl/8i3wd7bia9/WySB4A1fJLXiBHXEHO X4V7LPWAur647lnrfRwr2ikRoo7kC0bOfuXrlsuydnZsZq6CMCo68hMg6hVQd0UTyAbh 2lUt9SeZ9vxj/vcXVuz8ZPNkJkek4oN5m+5O3i7PE+Zp3bgZiXaLeggewDDOXJaeAla3 aRq+t614MoQyv7r3Bg4qob7ACfuCVnxNcujCVKzW/83qRE3vUw7J3GRnF4h+nXuMRWTF 6f1g== ARC-Authentication-Results: i=1; mx.google.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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wy7-20020a170906fe0700b007c0eb33879asi31708942ejb.667.2023.01.16.22.17.08; Mon, 16 Jan 2023 22:17:31 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235836AbjAQGQ0 (ORCPT <rfc822;pfffrao@gmail.com> + 99 others); Tue, 17 Jan 2023 01:16:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235695AbjAQGPs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Jan 2023 01:15:48 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD0923C58 for <linux-kernel@vger.kernel.org>; Mon, 16 Jan 2023 22:15:42 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <ore@pengutronix.de>) id 1pHfFf-0002TY-Hr; Tue, 17 Jan 2023 07:15:19 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from <ore@pengutronix.de>) id 1pHfFZ-006c0Q-SL; Tue, 17 Jan 2023 07:15:13 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from <ore@pengutronix.de>) id 1pHfFX-00Fck9-2p; Tue, 17 Jan 2023 07:15:11 +0100 From: Oleksij Rempel <o.rempel@pengutronix.de> To: Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Abel Vesa <abelvesa@kernel.org>, Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org>, Richard Cochran <richardcochran@gmail.com> Cc: Oleksij Rempel <o.rempel@pengutronix.de>, kernel@pengutronix.de, Fabio Estevam <festevam@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Russell King <linux@armlinux.org.uk>, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 14/19] clk: imx: add imx_obtain_fixed_of_clock() Date: Tue, 17 Jan 2023 07:14:48 +0100 Message-Id: <20230117061453.3723649-15-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230117061453.3723649-1-o.rempel@pengutronix.de> References: <20230117061453.3723649-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755249379073583977?= X-GMAIL-MSGID: =?utf-8?q?1755249379073583977?= |
Series |
ARM: imx: make Ethernet refclock configurable
|
|
Commit Message
Oleksij Rempel
Jan. 17, 2023, 6:14 a.m. UTC
Add imx_obtain_fixed_of_clock() to optionally add clock not configured in
the devicetree.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/clk/imx/clk.c | 14 ++++++++++++++
drivers/clk/imx/clk.h | 3 +++
2 files changed, 17 insertions(+)
Comments
On 23-01-17 07:14:48, Oleksij Rempel wrote: > Add imx_obtain_fixed_of_clock() to optionally add clock not configured in > the devicetree. > > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Abel Vesa <abel.vesa@linaro.org> > --- > drivers/clk/imx/clk.c | 14 ++++++++++++++ > drivers/clk/imx/clk.h | 3 +++ > 2 files changed, 17 insertions(+) > > diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c > index b636cc099d96..5f1f729008ee 100644 > --- a/drivers/clk/imx/clk.c > +++ b/drivers/clk/imx/clk.c > @@ -110,6 +110,20 @@ struct clk_hw *imx_obtain_fixed_clock_hw( > return __clk_get_hw(clk); > } > > +struct clk_hw *imx_obtain_fixed_of_clock(struct device_node *np, > + const char *name, unsigned long rate) > +{ > + struct clk *clk = of_clk_get_by_name(np, name); > + struct clk_hw *hw; > + > + if (IS_ERR(clk)) > + hw = imx_obtain_fixed_clock_hw(name, rate); > + else > + hw = __clk_get_hw(clk); > + > + return hw; > +} > + > struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name) > { > struct clk *clk; > diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h > index 801213109697..f0a24cd54d1c 100644 > --- a/drivers/clk/imx/clk.h > +++ b/drivers/clk/imx/clk.h > @@ -288,6 +288,9 @@ struct clk * imx_obtain_fixed_clock( > struct clk_hw *imx_obtain_fixed_clock_hw( > const char *name, unsigned long rate); > > +struct clk_hw *imx_obtain_fixed_of_clock(struct device_node *np, > + const char *name, unsigned long rate); > + > struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name); > > struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent, > -- > 2.30.2 >
diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c index b636cc099d96..5f1f729008ee 100644 --- a/drivers/clk/imx/clk.c +++ b/drivers/clk/imx/clk.c @@ -110,6 +110,20 @@ struct clk_hw *imx_obtain_fixed_clock_hw( return __clk_get_hw(clk); } +struct clk_hw *imx_obtain_fixed_of_clock(struct device_node *np, + const char *name, unsigned long rate) +{ + struct clk *clk = of_clk_get_by_name(np, name); + struct clk_hw *hw; + + if (IS_ERR(clk)) + hw = imx_obtain_fixed_clock_hw(name, rate); + else + hw = __clk_get_hw(clk); + + return hw; +} + struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name) { struct clk *clk; diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index 801213109697..f0a24cd54d1c 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -288,6 +288,9 @@ struct clk * imx_obtain_fixed_clock( struct clk_hw *imx_obtain_fixed_clock_hw( const char *name, unsigned long rate); +struct clk_hw *imx_obtain_fixed_of_clock(struct device_node *np, + const char *name, unsigned long rate); + struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name); struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent,