devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Yao Zi <ziyao@disroot.org>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	Celeste Liu <CoelacanthusHex@gmail.com>,
	Yao Zi <ziyao@disroot.org>
Subject: Re: [PATCH 6/8] clk: rockchip: Add clock controller driver for RK3528 SoC
Date: Wed, 02 Oct 2024 12:21:29 +0200	[thread overview]
Message-ID: <115216996.nniJfEyVGO@diego> (raw)
In-Reply-To: <20241001042401.31903-8-ziyao@disroot.org>

Am Dienstag, 1. Oktober 2024, 06:24:00 CEST schrieb Yao Zi:
> Add clock tree definition for RK3528. Similar to previous Rockchip
> SoCs, clock controller shares MMIO region with reset controller and
> they are probed together.
> 
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> ---

[...]

> +	GATE(ACLK_DDR_UPCTL, "aclk_ddr_upctl", "clk_ddrc_src", CLK_IS_CRITICAL,
> +	     RK3528_CLKGATE_CON(45), 11, GFLAGS),
> +	GATE(CLK_DDR_UPCTL, "clk_ddr_upctl", "clk_ddrc_src", CLK_IS_CRITICAL,
> +	     RK3528_CLKGATE_CON(45), 12, GFLAGS),
> +	GATE(CLK_DDRMON, "clk_ddrmon", "clk_ddrc_src", CLK_IS_CRITICAL,
> +	     RK3528_CLKGATE_CON(45), 13, GFLAGS),
> +	GATE(ACLK_DDR_SCRAMBLE, "aclk_ddr_scramble", "clk_ddrc_src",
> +	     CLK_IS_CRITICAL, RK3528_CLKGATE_CON(45), 14, GFLAGS),
> +	GATE(ACLK_SPLIT, "aclk_split", "clk_ddrc_src", CLK_IS_CRITICAL,
> +	     RK3528_CLKGATE_CON(45), 15, GFLAGS),
> +
> +	/* gpu */
> +	COMPOSITE_NODIV(ACLK_GPU_ROOT, "aclk_gpu_root",
> +			mux_500m_300m_100m_24m_p, CLK_IS_CRITICAL,
> +			RK3528_CLKSEL_CON(76), 0, 2, MFLAGS,
> +			RK3528_CLKGATE_CON(34), 0, GFLAGS),

Please keep the styling intact for all branch definitions.
(this one taken as an example, but applies to all)

I.e. if you look at the rk3588/rk3576/and everything else, you'll see
subsequent lines getting indented by 3 tabs all the time. For a large
set of definitions this makes it way easier to parse for the eye, than
having ever shifting offsets, when things get aligned to opening
parentheses.

Similarly, please also keep elements in their position, i.e. for the
aclk_gpu_root above, this would mean moving parents and CLK_IS_CRITICAL
up to the parent line.

(lines according to coding style are allowed up to 100 chars, and Rockchip
clock drivers sometimes exceed even that, because it makes handling the
clock drivers a lot easier)

> +};
> +
> +static int __init clk_rk3528_probe(struct platform_device *pdev)
> +{
> +	struct rockchip_clk_provider *ctx;
> +	struct device *dev = &pdev->dev;
> +	struct device_node *np = dev->of_node;
> +	unsigned long nr_branches = ARRAY_SIZE(rk3528_clk_branches);
> +	unsigned long nr_clks;
> +	void __iomem *reg_base;
> +
> +	nr_clks = rockchip_clk_find_max_clk_id(rk3528_clk_branches,
> +					       nr_branches) + 1;
> +
> +	pr_warn("%s: nr_clks = %lu\n", __func__, nr_clks);
> +
> +	reg_base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(reg_base))
> +		return dev_err_probe(dev, PTR_ERR(reg_base),
> +				     "could not map cru region");
> +
> +	ctx = rockchip_clk_init(np, reg_base, nr_clks);
> +	if (IS_ERR(ctx))
> +		return dev_err_probe(dev, PTR_ERR(ctx),
> +				     "rockchip clk init failed");
> +
> +	rockchip_clk_register_plls(ctx, rk3528_pll_clks,
> +				   ARRAY_SIZE(rk3528_pll_clks),
> +				   RK3528_GRF_SOC_STATUS0);
> +	rockchip_clk_register_armclk(ctx, ARMCLK, "armclk",
> +				     mux_armclk, ARRAY_SIZE(mux_armclk),
> +				     &rk3528_cpuclk_data, rk3528_cpuclk_rates,
> +				     ARRAY_SIZE(rk3528_cpuclk_rates));
> +	rockchip_clk_register_branches(ctx, rk3528_clk_branches, nr_branches);
> +
> +	rockchip_register_softrst(np, 47, reg_base + RK3528_SOFTRST_CON(0),
> +				  ROCKCHIP_SOFTRST_HIWORD_MASK);

here you'll like also want to check how rk3576 + rk3588 handle how the reset-ids
are not matched to the register offsets anymore.
(see rst-rk3588.c for example)


Thanks a lot
Heiko



  reply	other threads:[~2024-10-02 10:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01  4:23 [PATCH 0/8] Support clock and reset unit of Rockchip RK3528 Yao Zi
2024-10-01  4:23 ` [PATCH 1/8] dt-bindings: clock: Add clock ID definition for " Yao Zi
2024-10-02  6:32   ` Krzysztof Kozlowski
2024-10-02  9:24     ` Yao Zi
2024-10-01  4:23 ` [PATCH 2/8] dt-bindings: reset: Add reset " Yao Zi
2024-10-01 16:29   ` Conor Dooley
2024-10-02  6:31   ` Krzysztof Kozlowski
2024-10-02  9:54     ` Yao Zi
2024-10-02 10:07       ` Heiko Stübner
2024-10-02 10:19         ` Yao Zi
2024-10-01  4:23 ` [PATCH 3/8] dt-bindings: clock: Add rockchip,rk3528-cru Yao Zi
2024-10-01 16:29   ` Conor Dooley
2024-10-01 21:18     ` Yao Zi
2024-10-02  8:49       ` Conor Dooley
2024-10-02 10:02         ` Yao Zi
2024-10-01  4:23 ` [PATCH 4/8] clk: rockchip: Add PLL flag ROCKCHIP_PLL_FIXED_MODE Yao Zi
2024-10-02  8:16   ` Heiko Stübner
2024-10-02 10:08     ` Yao Zi
2024-10-02 10:12       ` Heiko Stübner
2024-10-02 10:22         ` Yao Zi
2024-10-01  4:23 ` [PATCH 5/8] clk: rockchip: Add clock type GATE_NO_SET_RATE Yao Zi
2024-10-02  8:08   ` Heiko Stübner
2024-10-02 10:30     ` Yao Zi
2024-10-01  4:24 ` [PATCH 6/8] clk: rockchip: Add clock controller driver for RK3528 SoC Yao Zi
2024-10-02 10:21   ` Heiko Stübner [this message]
2024-10-02 10:38     ` Yao Zi
2024-10-01  4:38 ` [PATCH 7/8] arm64: dts: rockchip: Add clock generators " Yao Zi
2024-10-01  4:38 ` [PATCH 8/8] arm64: dts: rockchip: Add UART clocks " Yao Zi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=115216996.nniJfEyVGO@diego \
    --to=heiko@sntech.de \
    --cc=CoelacanthusHex@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=ziyao@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).