From patchwork Wed Oct 19 17:20:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2449 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C20293FA58 for ; Wed, 19 Oct 2022 19:20:27 +0200 (CEST) Received: by mail-ed1-f70.google.com with SMTP id h13-20020a056402280d00b0045cb282161csf14549875ede.8 for ; Wed, 19 Oct 2022 10:20:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666200027; cv=pass; d=google.com; s=arc-20160816; b=pX0GQlvC5wGXOjQEPQAReFK/wMMcNyiIxpW2jtIMi0dsYDJ3oWXqLnJ+3wse/03ymS 4pvRWoAieZH+jC18FNHTMxyBGITpDnQe1LA45yZconYwVlnPJMCCfUH4CxSsDlBuTx6I AO4desivVIBhoJEi/bpVJgau32WKFN9gGHu3laLciDIraE5tfO9NF+kfL7VISeeZD+yV 3Zp+Zx8578viGAeaUDUW3BoYp9B3CJ2DWlUMdoG1iqM3kxjT9/ktf+4MoUT8RRCa2yMY fC3OA8TkVM6HRXlbXNCQ0Ucp4KEkb+evcHyImmCnYrRfhd2GCYByq4b0Gf2ytfVPqRRw O3fA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=66EGVKRAzQDa7nS31+ZrWpPE+rH/zNhqh0AQqrKbL1A=; b=Gg3TOfB0erqpYkzA1ArSn4WTYNml6klTBPh7ltfMCgLuYhOqBzTn+Jpmx0DH8l61lV 5+cMaSezcRzyUgfIo7E5+75dZjtobd9r2e1ArZ07mNFZWW/dS6P9n3H0hcJ6rtDVKpKX 6rAs8LBWFJ6C/EYVJN71e5/a04H8+bT57lOJy51/sYvxXaEKJCeScgBVUJPwouV/2/4U TtLfxVMtnfNh1NBZMKChspsUEy10aViZRQs2+MC7hLwwDKrHdJ2V/ZzU30rUT9h5QZD5 Jj4U/dMW8XE4cGNnDgC6WcOl4kZ4T9pjhRGWJHLBoisd75ZJN5Jlft7fM82VdekKpHzg r/sQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Wj7lt+pp; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=66EGVKRAzQDa7nS31+ZrWpPE+rH/zNhqh0AQqrKbL1A=; b=i9K6n2eGTL3dcqbW4r7y/QfobkLjqDUoMliQG7BdglXTn2hf/QRbmW/WekLUT06Uku mJK/YZE90NaMmpG6TNekh7T9q5TT4nG9cH/Xqkn5TOXeFE8XY6IVLfxtvILyzBnEhzyf A6gHMmQWCw87Y2vO56THOr03aveoLpoXJ/0hk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=66EGVKRAzQDa7nS31+ZrWpPE+rH/zNhqh0AQqrKbL1A=; b=Qlf7d6eSAq8rSl9fme1zJsRBQ/Xyl6QvBeJQbcG6Jw7gE6F8Wlk4+VUTqMULCVgeEk HIFEkQnAlJb8k1W5ked8h1IFAFV4wrO2JTRUC7QLSWV9BEnR5FD+iVAQwGj/Gu1C6oSG XN2OD3IGuRHjURUEv7rdizj/Zdp/BpEq34VoLja8F8Zd/QpisEqNlWcUMnUaNSb6VP6z L7mwF5HM2XZ0yucsNv4PvZQCLJVGTbwyMSESL/1Bv7UBJ1F23QrwKOAJS6hLmZH/JL2K vdZAzKY1gtrf9tZAGtg5miWvU2hUXRTxfggX1WSW18//OaRiM7In/Mw2WZFiSrSLuan5 aQ1w== X-Gm-Message-State: ACrzQf2y4v620e5oUZnNPd+pKSAw/24/cpi9RuIokkoI/XthHRpG+Xwm ADxykwZx7bwCxd7GUzdArwzV09PQ X-Google-Smtp-Source: AMsMyM5JXcRwu+l5zbRvVL9iXs5rlXjM9PfpSIQVj0OaQ/NeDP/IdUgLWqQrEG61/JC7J/RT6HvyOA== X-Received: by 2002:a17:907:6d18:b0:78e:259d:c391 with SMTP id sa24-20020a1709076d1800b0078e259dc391mr7722012ejc.615.1666200027380; Wed, 19 Oct 2022 10:20:27 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:35c1:b0:45d:64be:d1a with SMTP id z1-20020a05640235c100b0045d64be0d1als1125764edc.1.-pod-prod-gmail; Wed, 19 Oct 2022 10:20:26 -0700 (PDT) X-Received: by 2002:aa7:dc10:0:b0:440:b446:c0cc with SMTP id b16-20020aa7dc10000000b00440b446c0ccmr8455656edu.34.1666200026169; Wed, 19 Oct 2022 10:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666200026; cv=none; d=google.com; s=arc-20160816; b=KRdtkQaDhDqZqxgIEN7pd4FyA0e4ceLYFl/+5qMWrgUTkiKZdCjbpUWccT6nbqSNr9 ks411NsSw/ipVkILXShUXcX2HC66s0Q4i0pgHZ0k5Nu6Y+KTlWaA30mzRxGsZvtgT4lW 1cTAVC/om/OwBJxb6+kIxZ1N2CrPWf1kXCktrEzKz0dkwVx4euy5Ng9dKsjrOrg6ggcs Oz4I3/FNEuU+4hHNvWiLZXIVcwulrs/+HHtwHe2w9wsUCeUXSII5qCeN8FOzMob6tMgs Fsr/wAStAsFv708VIvKtq96ovPbVbdSvmBSLX/ZvP+5NP2LxgKGHwLDDlIyquRe8Ttdo 0kCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=jopgl/wXXW3z+1SrGUkChdxa7ziSKQbSgAnfRrtZVCo=; b=QQ5l5Uq1ZLgqisQ4E3++N5NmXbqb0RbIL7OS0HDMi54uZyl7lXGfuP7xmHv4XJ+N5U nv31V/uH0D3mpwr0dnfucBVhGasUQZby/Avo0lwv63cnLwpFxsyndJUkL3l5koGPUPMI ABg0wQEPXGeOTkg2CzxC2qA11ELvBCw1yovcQGS6J1K7LAQVtS/6anRerOvTpwfkdPy8 3HhPawuXszIWqY18N7dpoBU2GOnqoWbyDz2TFmpF1+7uWHfhRFzFdmAsBNRBo7Ssw4rC Py6I1Uj84TNTyyCB5ygcxXYicxhUssS8w+GwCYPl6gSavo85Q2a6WmIkrn1U7OBji3k3 TJuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Wj7lt+pp; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id h26-20020a1709066d9a00b0078183bda914sor7391047ejt.37.2022.10.19.10.20.26 for (Google Transport Security); Wed, 19 Oct 2022 10:20:26 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:906:d54d:b0:78e:2fbf:ca2a with SMTP id cr13-20020a170906d54d00b0078e2fbfca2amr7851889ejc.488.1666200025784; Wed, 19 Oct 2022 10:20:25 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-95-233-42-253.retail.telecomitalia.it. [95.233.42.253]) by smtp.gmail.com with ESMTPSA id b27-20020a17090630db00b0073dbaeb50f6sm9237983ejb.169.2022.10.19.10.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 10:20:25 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Cc: anthony@amarulasolutions.com, jagan@amarulasolutions.com, dario.binacchi@amarulasolutions.com, michael@amarulasolutions.com, tommaso.merciai@amarulasolutions.com Subject: [RFC PATCH 3/8] clk: imx: add imx_get_clk_hw_from_dt() helper Date: Wed, 19 Oct 2022 19:20:14 +0200 Message-Id: <20221019172019.2303223-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20221019172019.2303223-1-dario.binacchi@amarulasolutions.com> References: <20221019172019.2303223-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Wj7lt+pp; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Dario Binacchi --- drivers/clk/imx/clk.c | 21 +++++++++++++++++++++ drivers/clk/imx/clk.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c index 96db803647f4..39034a7b73cd 100644 --- a/drivers/clk/imx/clk.c +++ b/drivers/clk/imx/clk.c @@ -76,6 +76,27 @@ void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count) } EXPORT_SYMBOL_GPL(imx_check_clk_hws); +struct clk_hw *imx_get_clk_hw_from_dt(struct device_node *np, + const char *name) +{ + struct of_phandle_args clkspec; + struct clk *clk; + + clkspec.np = of_find_node_by_name(np, name); + if (clkspec.np) { + clk = of_clk_get_from_provider(&clkspec); + if (!IS_ERR(clk)) { + pr_debug("%s: got %s clock\n", __func__, name); + of_node_put(clkspec.np); + return __clk_get_hw(clk); + } + } + + pr_err("%s: failed to %s clock\n", __func__, name); + return ERR_PTR(-ENODEV); +} +EXPORT_SYMBOL_GPL(imx_get_clk_hw_from_dt); + static struct clk *imx_obtain_fixed_clock_from_dt(const char *name) { struct of_phandle_args phandle; diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index e3262ce035f7..1daeaf1e4729 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -294,6 +294,9 @@ struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name, u8 clk_gate_flags, spinlock_t *lock, unsigned int *share_count); +struct clk_hw *imx_get_clk_hw_from_dt(struct device_node *np, + const char *name); + struct clk * imx_obtain_fixed_clock( const char *name, unsigned long rate);