[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250307-impossible-fine-panther-38c66b@krzk-bin>
Date: Fri, 7 Mar 2025 09:26:46 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Haylen Chu <heylenay@....org>
Cc: Yixun Lan <dlan@...too.org>,
Michael Turquette <mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Haylen Chu <heylenay@...look.com>, linux-riscv@...ts.infradead.org, linux-clk@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, spacemit@...ts.linux.dev,
Inochi Amaoto <inochiama@...look.com>, Chen Wang <unicornxdotw@...mail.com>,
Jisheng Zhang <jszhang@...nel.org>, Meng Zhang <zhangmeng.kevin@...ux.spacemit.com>
Subject: Re: [PATCH v5 3/5] clk: spacemit: Add clock support for Spacemit K1
SoC
On Fri, Mar 07, 2025 at 06:42:02AM +0000, Haylen Chu wrote:
> > > +static int k1_ccu_probe(struct platform_device *pdev)
> > > +{
> > > + struct regmap *base_regmap, *lock_regmap = NULL;
> > > + struct device *dev = &pdev->dev;
> > > + int ret;
> > > +
> > > + base_regmap = device_node_to_regmap(dev->of_node);
> > > + if (IS_ERR(base_regmap))
> > > + return dev_err_probe(dev, PTR_ERR(base_regmap),
> > > + "failed to get regmap\n");
> > > +
> > > + if (of_device_is_compatible(dev->of_node, "spacemit,k1-pll")) {
> > ..
> > > + struct device_node *mpmu = of_parse_phandle(dev->of_node,
> > > + "spacemit,mpmu", 0);
> > > + if (!mpmu)
> > > + return dev_err_probe(dev, -ENODEV,
> > > + "Cannot parse MPMU region\n");
> > > +
> > > + lock_regmap = device_node_to_regmap(mpmu);
> > > + of_node_put(mpmu);
> > > +
> > you can simplify above with syscon_regmap_lookup_by_phandle(), which
> > would save a few lines
> >
> > or further, just call syscon_regmap_lookup_by_compatible()? then
> > won't be necessary to introduce the "spacemit,mpmu" property..
> >
>
> These syscon_* functions differ a little from device_node_to_regmap():
> they get and enable the first item in "clocks" property when
> instantiating a regmap, which isn't desired for a clock controller.
Yes. And mpmu is not a syscon, so it would be inaccurate or even wrong
API to use.
Best regards,
Krzysztof
Powered by blists - more mailing lists