Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2720933pxb; Sun, 8 Nov 2020 10:53:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkNlAqwAWnGrucuNrA3PZ4vu6PreRuputVvgMSDOjJ+8TbghJPvrTWEFg4zBukJskKlo/i X-Received: by 2002:a17:906:b53:: with SMTP id v19mr11452662ejg.136.1604861599308; Sun, 08 Nov 2020 10:53:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604861599; cv=none; d=google.com; s=arc-20160816; b=rtNHIL53+RDpDNj0STbOPiX6Yv4ZzyWEeQ1l4bhxyb3mc0rJT4qwOJnDWEl7rLFX+I /qa1c5nEqgKrbCiMJaT4KoHsxyIRKzKiq1+kN3VpCxl6hn0RtbIDLVPmWZlUKcrjBIfL Lp+apho9i5lT2IRK3Ar8uQeXLtGJZ5/MiT8t1DiKE//pGyN9tBatr0obg+764kCSKAD0 ElBjmFHcMI3wJBNp/QEyf91jUcIswenAGJxBeRgXce/htHg5KSC74MBTlrObNVqJVtij OR1AeVuyRpoEx++M0tYTmCMXIamAsp/rmltVPCioqUpKabV0hsODhdsdFdDLDQv44LGG 3yPg== 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 :dkim-signature; bh=06+nbmiG4lnDyueLVMl1bo6/nZZ0MAeHgQZQwzo4IUU=; b=pXoHYbFyIV42DrKw4RF7X2Cf5ja058ymvxH/iBdzVIm+dzOS/PEizfh2rA5GLao3P9 CLHEhO/WqPhAhbCtQxOgbBn3iTOeBHEO37ALA2BqKzIT2nWjgMqYaKE8S50GRMlRCscr U2vqhESJurx4kRkJaDdTBZ8OzB0gqp/+CuzW+NiImmI0iBE8TtRJL0wb5lxXZgHcWW9D k/+hjTA7LRXwBJcn5djWDMovEEH8EmuNtQpQpu0aWVkRpPHIN3g6WeWry47l6+m3v0YA eEAD/egUstuUaLbbp/FDfAiKYeIHLtRw1FPmKcOa1cKBV93F6xHKtnwRJfIn2YuJEZ2H Ln/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b="kVo/WQVl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w22si5681449edl.537.2020.11.08.10.52.55; Sun, 08 Nov 2020 10:53:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b="kVo/WQVl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728926AbgKHSvc (ORCPT + 99 others); Sun, 8 Nov 2020 13:51:32 -0500 Received: from ssl.serverraum.org ([176.9.125.105]:55223 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727570AbgKHSv2 (ORCPT ); Sun, 8 Nov 2020 13:51:28 -0500 Received: from apollo.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id ACCF223E64; Sun, 8 Nov 2020 19:51:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1604861486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=06+nbmiG4lnDyueLVMl1bo6/nZZ0MAeHgQZQwzo4IUU=; b=kVo/WQVlxbm+ucAHJEoDEkNOWLbk1kl1aFBAsKSK2vQ1mW5+BbvKunFtu5Lru82o4/+UsC snR2Q8k/Zo7fEzKtdNXlo023WaHlHMuwFQvARqCqMTey9/1TTFAxtyMdVkbTHiQa/Q67mu x5vOD+W0dEZZKFBOjehwnJhmFc5To9Y= From: Michael Walle To: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Michael Turquette , Stephen Boyd , Rob Herring , Shawn Guo , Li Yang , "Y . b . Lu" , Xiaowei Bao , Ashish Kumar , Vladimir Oltean , Michael Walle Subject: [PATCH v3 3/9] clk: qoriq: provide constants for the type Date: Sun, 8 Nov 2020 19:51:07 +0100 Message-Id: <20201108185113.31377-4-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201108185113.31377-1-michael@walle.cc> References: <20201108185113.31377-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To avoid future mistakes in the device tree for the clockgen module, add constants for the clockgen subtype as well as a macro for the PLL divider. Signed-off-by: Michael Walle --- Changes since v2: - new patch drivers/clk/clk-qoriq.c | 13 +++++++------ include/dt-bindings/clock/fsl,qoriq-clockgen.h | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 include/dt-bindings/clock/fsl,qoriq-clockgen.h diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 46101c6a20f2..70aa521e7e7f 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -7,6 +7,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -1368,33 +1369,33 @@ static struct clk *clockgen_clk_get(struct of_phandle_args *clkspec, void *data) idx = clkspec->args[1]; switch (type) { - case 0: + case QORIQ_CLK_SYSCLK: if (idx != 0) goto bad_args; clk = cg->sysclk; break; - case 1: + case QORIQ_CLK_CMUX: if (idx >= ARRAY_SIZE(cg->cmux)) goto bad_args; clk = cg->cmux[idx]; break; - case 2: + case QORIQ_CLK_HWACCEL: if (idx >= ARRAY_SIZE(cg->hwaccel)) goto bad_args; clk = cg->hwaccel[idx]; break; - case 3: + case QORIQ_CLK_FMAN: if (idx >= ARRAY_SIZE(cg->fman)) goto bad_args; clk = cg->fman[idx]; break; - case 4: + case QORIQ_CLK_PLATFORM_PLL: pll = &cg->pll[PLATFORM_PLL]; if (idx >= ARRAY_SIZE(pll->div)) goto bad_args; clk = pll->div[idx].clk; break; - case 5: + case QORIQ_CLK_CORECLK: if (idx != 0) goto bad_args; clk = cg->coreclk; diff --git a/include/dt-bindings/clock/fsl,qoriq-clockgen.h b/include/dt-bindings/clock/fsl,qoriq-clockgen.h new file mode 100644 index 000000000000..ddec7d0bdc7f --- /dev/null +++ b/include/dt-bindings/clock/fsl,qoriq-clockgen.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef DT_CLOCK_FSL_QORIQ_CLOCKGEN_H +#define DT_CLOCK_FSL_QORIQ_CLOCKGEN_H + +#define QORIQ_CLK_SYSCLK 0 +#define QORIQ_CLK_CMUX 1 +#define QORIQ_CLK_HWACCEL 2 +#define QORIQ_CLK_FMAN 3 +#define QORIQ_CLK_PLATFORM_PLL 4 +#define QORIQ_CLK_CORECLK 5 + +#define QORIQ_CLK_PLL_DIV(x) ((x) - 1) + +#endif /* DT_CLOCK_FSL_QORIQ_CLOCKGEN_H */ -- 2.20.1