From patchwork Thu Dec 5 11:17:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3703 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 759BF3FA09 for ; Thu, 5 Dec 2024 12:20:04 +0100 (CET) Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2ffc7fe1b6dsf5281281fa.0 for ; Thu, 05 Dec 2024 03:20:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1733397604; cv=pass; d=google.com; s=arc-20240605; b=O+fPNBoX7HD5R+48hEKUt2NPNbWhJ8BzZSfTVOuG8YV9XeJBYl33YHaZHsekkb5gFG QUvDkXbFaiLu2kc5gmJTO3DTklNb/Q90+wP0TEgEfwfFzYTe5QWIQ/G+/J2MK1r36w+y H0Q8mItJYCt25WJNLFLFWqokeIgQInqv7Mgsp3ciM0PA7iMGWdEXyukdEUte9sqPlrio taVxPFTv8vYITYt/f/RcRT+m/t4cWa2nrOWKoGoJbAr1hbZHdxYcT5IistnExgZJeNzK TOPgDvTZ6Ith5InxtQm3o3f2oRY3eMPEn/maX0N1JBefDcXfxGZl0X/2+U2HLpsCwlf/ 85iw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=uFmKfG7tuVF7sGXeVBT6Z2CTnd9z18zFOSHvGvUiFYA=; fh=BSvTkN0fe+cj/U5e8AZ1Waxa8CgTpNxkpS0J9SRR1Do=; b=POAeKvIrzgQwwaxRPzjSKf7bOp4ZI+ZCbtEH84L4FqWdihmkjZLNkKbcuxPJWPsybf C2xGcnHEQzK1SXp5voAPPkxxw2HfiUQ2HlvF2rOoIcDtyDnh9ngcmgI0iOcJsrdzflas AN+GyhiSXowQKWwvvOVErGujr4KIFVKjorfChwxKd1qrgw0JnYXlTbk8PBpM4fUpYJbO f6tMw/D1jQkU8Xzg3IK9smHP4P5u7rlyENUJAXShTMGRvBse2hUKnHD5mqbbMgxi+Jkz F3ZjIIvfrqNc5Xz/lmgKjPKMaViYUO+Yk1htDPS2ga1wFE+goi/HMwX1BisVMVYEKnQX usSQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RJKTujcJ; 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; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1733397604; x=1734002404; darn=patchwork.amarulasolutions.com; 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=uFmKfG7tuVF7sGXeVBT6Z2CTnd9z18zFOSHvGvUiFYA=; b=Ey1SusqalGARmLow/SvfXAQpc3wG7A3HIatXWVBPmIK9wop6Sf3H18E0Kvj3ODIxur O9uSPO3OSYKJYlGVBdinn+aXKQL0F5sY19SeHGQ6a5xrEXOgr1ba9Ilk3Jr/F5N+ImYB rnDFUJ9C1D+Mb/zmuL3IUlOoobcw2hoD9SSj0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733397604; x=1734002404; 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-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uFmKfG7tuVF7sGXeVBT6Z2CTnd9z18zFOSHvGvUiFYA=; b=kvAJMg3/vW21Bf85j0bodbDOEAMKniuiJmBrbizWU0AcSRgTjCZ1sU5LJJw5co2A40 DlpS9End3YBPgoY/t3LH9n9YzEEKXEeGZn77j5G7rZi5SO5icdTR7XOdWpX6hxo4BTSX PFBtOczqqQaVBkQSj9vRkVR31sD8NvZSerDwTjgRn38LL4CjkgcXFMNCyIBJpxsWnyrA zzfmtaRIj6uaPyAXarZpvTh99MDmB3npWUiMefu2/192kID65fCNl/qloFx3jeQ3yW7g Jcb6KkUPzcxSwnraDrr6+ReBz1Qd7MZuKbMQInsHmbBb6PQU5C9GGRd+Q821RsR4i+6/ 5h0A== X-Forwarded-Encrypted: i=2; AJvYcCXZ4VKiGb7+9AEhRSNSrU9mI10TLpc/a93jLrNPoFl6KnC12MHh4/i+sGDZS6iB9q48nIgPQE5R2GHq8Hv8@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YwBCDHlwMbK1Jpzu4jjq4FkQS62Tl2KX9KbdXznC3FkMgvI8rZA kbU+CJkXNnIdQsbKwCTuNWb0toT45Dt/v9TGWzAnUAMtI6IIUih0UCHTKcHiUr6msw== X-Google-Smtp-Source: AGHT+IFZ7rC6lUNRWFoz6ER9ykTbQaFcQbUrLpSGM7yHTQtwTNGujKXTLg8wzGGIRpyvApnnImbzCg== X-Received: by 2002:a2e:b8d2:0:b0:2fb:5014:c963 with SMTP id 38308e7fff4ca-30009c11b7cmr64715601fa.20.1733397603786; Thu, 05 Dec 2024 03:20:03 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a2e:97c6:0:b0:300:ba7:463d with SMTP id 38308e7fff4ca-3001ed8f840ls2065561fa.2.-pod-prod-08-eu; Thu, 05 Dec 2024 03:20:02 -0800 (PST) X-Received: by 2002:a05:6512:3f2a:b0:53d:a58c:c5a4 with SMTP id 2adb3069b0e04-53e12a22f0bmr5518870e87.40.1733397601719; Thu, 05 Dec 2024 03:20:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733397601; cv=none; d=google.com; s=arc-20240605; b=DCcSsrrZ7MdGoTUlI33e4w/MXhdYmxrBIeX2mnAj253zF69ieX9IYiOp64v7cbz/NA G2M/5V8Wz0LskLhGlP1YgXmRzHG9d7cCf9WbdyqqluOO2nfye+h7tutJtoRVWyeN2eI9 59k9jXygJdl85CYzZet9lF3ySBH9B7BiIDUZ2dNl3fusNGQJwfCsqTI12GB1h3J7hK3U 6oiCJdTWIqxRjUOZJ7FMoJIzjr3tOINcfsLMlasJLGMQAWJg6PUMWLfhxlz3wwdVwhcv IOY1r3AyOby0dSpFQsi60mKe3yiN35oxe9DXKmqpaZAc03vK1GA296ntm2VnR+ZQI2Za HF5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=5sIT0jqKNMZhKzMLzfgvLUDfd+FJ1ix9dxzYWA8kfsM=; fh=u/u80m6tBSaxW7VWG5AQatIbYzkIAnRGhZp/RTASK5o=; b=fmXoBB4JMUhsZ1GW6VmEbCPH1WOR6MxZUh6FazdIM5a+BIcMZkp4xTtkwg2YyX0iDo 6gcXsSc7Vu8e7Ho5MlLxPmAS6vt8+u0+BECyrIjmSNBHAxbjfaSYutZBoAmkvCsmnmLd st08LotDmPcLK9R2emBDahcnEbmAXDx072g1qf0R/9lUffQ8IGZLKn9Lhy14lRAGq0yc UHMQcYK36hkb6NU86uVNveFaEbdQjdEnH3W9qCo31KbzRSIElXXe3vZ99UKcLSk6Bs5Z W9UrOFylGudcl/ibPMrULZO+qSyGc1NtxUYJLMlgxpN+wnoDBVstiecQrZ3UGvus2kSe oj4g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RJKTujcJ; 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; dara=pass header.i=@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 a640c23a62f3a-aa6260b9b5esor44020066b.17.2024.12.05.03.20.01 for (Google Transport Security); Thu, 05 Dec 2024 03:20:01 -0800 (PST) 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-Gm-Gg: ASbGncvAYrB0sDvy8c52s4eP9D+CKxNT6jrIYObhclgRrd4n773WKiyRl7/IjBNDOmY Ngy5vv1651pA8qX4pCb7LsR70nANJkEgmvuyBL2ztYITr5rZPECFZ1MVKae+r4yf7bPq9RpnEND /nkCohrVpZWYFi8v3OWqMEgKYtSOHbH+qr4TPTlbGinnEyjRerXMqxK2HTtdsFdCKOs8ZJZdL8z NY37XWQV+Dwu00ZKgFyEC167ad49CngkdtFsDR8lBK0rVIeWvQr7Hds2ZUNEpWbz/c62nqIlqEV bYBfi5MvvkT97nTcKF4W0dajPtS6o8SkRREcouOJ3NDHjg== X-Received: by 2002:a17:907:7847:b0:aa6:2a5c:fee2 with SMTP id a640c23a62f3a-aa62a5d4b52mr116294366b.31.1733397601340; Thu, 05 Dec 2024 03:20:01 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2001:b07:6474:ebbf:61a1:9bc8:52c6:3c2d]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa625eedcd0sm77505266b.87.2024.12.05.03.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2024 03:20:00 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Abel Vesa , Fabio Estevam , Michael Turquette , Peng Fan , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Stephen Boyd , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org Subject: [PATCH v5 13/20] clk: imx: add hw API imx8m_anatop_get_clk_hw Date: Thu, 5 Dec 2024 12:17:48 +0100 Message-ID: <20241205111939.1796244-14-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241205111939.1796244-1-dario.binacchi@amarulasolutions.com> References: <20241205111939.1796244-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=RJKTujcJ; 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; dara=pass header.i=@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: , Get the hw of a clock registered by the anatop module. This function is preparatory for future developments. Signed-off-by: Dario Binacchi --- Changes in v5: - Consider CONFIG_CLK_IMX8M{M,N,P,Q}_MODULE to fix compilation errors Changes in v4: - New drivers/clk/imx/clk.c | 28 ++++++++++++++++++++++++++++ drivers/clk/imx/clk.h | 7 +++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c index df83bd939492..9a21f233e105 100644 --- a/drivers/clk/imx/clk.c +++ b/drivers/clk/imx/clk.c @@ -128,6 +128,34 @@ struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name) } EXPORT_SYMBOL_GPL(imx_get_clk_hw_by_name); +#if defined(CONFIG_CLK_IMX8MM) || defined(CONFIG_CLK_IMX8MM_MODULE) || \ + defined(CONFIG_CLK_IMX8MN) || defined(CONFIG_CLK_IMX8MN_MODULE) || \ + defined(CONFIG_CLK_IMX8MP) || defined(CONFIG_CLK_IMX8MP_MODULE) || \ + defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) +struct clk_hw *imx8m_anatop_get_clk_hw(int id) +{ +#if defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) + const char *compatible = "fsl,imx8mq-anatop"; +#else + const char *compatible = "fsl,imx8mm-anatop"; +#endif + struct device_node *np; + struct of_phandle_args args; + struct clk_hw *hw; + + np = of_find_compatible_node(NULL, NULL, compatible); + args.np = np; + args.args_count = 1; + args.args[0] = id; + of_node_put(np); + + hw = __clk_get_hw(of_clk_get_from_provider(&args)); + pr_debug("%s: got clk: %s\n", __func__, clk_hw_get_name(hw)); + return hw; +} +EXPORT_SYMBOL_GPL(imx8m_anatop_get_clk_hw); +#endif + /* * This fixups the register CCM_CSCMR1 write value. * The write/read/divider values of the aclk_podf field diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index aa5202f284f3..52055fda3058 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -487,4 +487,11 @@ struct clk_hw *imx_clk_gpr_mux(const char *name, const char *compatible, u32 reg, const char **parent_names, u8 num_parents, const u32 *mux_table, u32 mask); +#if defined(CONFIG_CLK_IMX8MM) || defined(CONFIG_CLK_IMX8MM_MODULE) || \ + defined(CONFIG_CLK_IMX8MN) || defined(CONFIG_CLK_IMX8MN_MODULE) || \ + defined(CONFIG_CLK_IMX8MP) || defined(CONFIG_CLK_IMX8MP_MODULE) || \ + defined(CONFIG_CLK_IMX8MQ) || defined(CONFIG_CLK_IMX8MQ_MODULE) +struct clk_hw *imx8m_anatop_get_clk_hw(int id); +#endif + #endif