Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yu-Chun Lin [林祐君]" <eleanor.lin@realtek.com>
To: "Philipp Zabel" <p.zabel@pengutronix.de>,
	"mturquette@baylibre.com" <mturquette@baylibre.com>,
	"sboyd@kernel.org" <sboyd@kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"Edgar Lee [李承諭]" <cylee12@realtek.com>,
	"afaerber@suse.com" <afaerber@suse.com>,
	"Jyan Chou [周芷安]" <jyanchou@realtek.com>,
	"bmasney@redhat.com" <bmasney@redhat.com>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-realtek-soc@lists.infradead.org"
	<linux-realtek-soc@lists.infradead.org>,
	"James Tai [戴志峰]" <james.tai@realtek.com>,
	"CY_Huang[黃鉦晏]" <cy.huang@realtek.com>,
	"Stanley Chang[昌育德]" <stanley_chang@realtek.com>
Subject: RE: [PATCH v9 02/12] reset: Add Realtek basic reset support
Date: Thu, 25 Jun 2026 10:02:59 +0000	[thread overview]
Message-ID: <e447f0d347b343129064317fcf220ee7@realtek.com> (raw)
In-Reply-To: <eb03894ae2765a426457238157e474087ea0aaa6.camel@pengutronix.de>

Hi Philipp,

> On Mi, 2026-06-24 at 19:29 +0800, Yu-Chun Lin wrote:
> > Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
> > ---
> > +static int rtk_reset_deassert(struct reset_controller_dev *rcdev,
> > +                           unsigned long idx) {
> > +     struct rtk_reset_data *data = to_rtk_reset_controller(rcdev);
> > +     const struct rtk_reset_desc *desc;
> > +     u32 mask, val;
> > +
> > +     desc = rtk_reset_get_desc(data, idx);
> > +     mask = desc->write_en ? (0x3U << desc->bit) : BIT(desc->bit);
> > +     val = mask;
> > +
> > +     return regmap_update_bits(data->regmap, desc->ofs, mask, val);
> 
> You can use regmap_set_bits() here.
> 

Ack.

> > +}
> > +
> > +static int rtk_reset_status(struct reset_controller_dev *rcdev,
> > +                         unsigned long idx) {
> > +     struct rtk_reset_data *data = to_rtk_reset_controller(rcdev);
> > +     const struct rtk_reset_desc *desc;
> > +     u32 val;
> 
>         unsigned int val;
> 

Ack.

> > +     int ret;
> > +
> > +     desc = rtk_reset_get_desc(data, idx);
> > +     ret = regmap_read(data->regmap, desc->ofs, &val);
> > +     if (ret)
> > +             return ret;
> > +
> > +     return !((val >> desc->bit) & 1); }
> > +
> > +static const struct reset_control_ops rtk_reset_ops = {
> > +     .assert   = rtk_reset_assert,
> > +     .deassert = rtk_reset_deassert,
> > +     .status   = rtk_reset_status,
> > +};
> > +
> > +/* The caller must initialize data->descs, data->rcdev.nr_resets and
> > + * data->rcdev.owner before calling rtk_reset_controller_add().
> > + */
> > +int rtk_reset_controller_add(struct device *dev,
> > +                          struct rtk_reset_data *data) {
> > +     data->regmap          = dev_get_platdata(dev);
> > +     data->rcdev.ops       = &rtk_reset_ops;
> > +     data->rcdev.dev       = dev;
> > +     data->rcdev.of_node   = dev->parent->of_node;
> 
> This split rcdev initialization is more hassle than it is worth.
> Please just export rtk_reset_ops and duplicate the regmap/ops/dev/of_node
> assignment in the probe functions.
> 
> Alternatively, consolidate the probe function and export it from here.
> 

Thanks for your suggestion. I will go with your first approach in v10.

Best Regards,
Yu-Chun

> regards
> Philipp

  reply	other threads:[~2026-06-25 10:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 11:29 [PATCH v9 00/12] clk / reset: realtek: Add RTD1625 clock and reset support Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 01/12] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 02/12] reset: Add Realtek basic reset support Yu-Chun Lin
2026-06-24 13:02   ` Philipp Zabel
2026-06-25 10:02     ` Yu-Chun Lin [林祐君] [this message]
2026-06-24 11:29 ` [PATCH v9 03/12] reset: realtek: Add RTD1625-CRT reset driver Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 04/12] reset: realtek: Add RTD1625-ISO reset controller driver Yu-Chun Lin
2026-06-24 13:03   ` Philipp Zabel
2026-06-25 10:05     ` Yu-Chun Lin [林祐君]
2026-06-25 10:22       ` Philipp Zabel
2026-06-24 11:29 ` [PATCH v9 05/12] clk: realtek: Introduce a common probe() Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 06/12] clk: realtek: Add support for phase locked loops (PLLs) Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 07/12] clk: realtek: Add support for gate clock Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 08/12] clk: realtek: Add support for mux clock Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 09/12] clk: realtek: Add support for MMC-tuned PLL clocks Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 10/12] clk: realtek: Add RTD1625-CRT clock controller driver Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 11/12] clk: realtek: Add RTD1625-ISO " Yu-Chun Lin
2026-06-24 11:29 ` [PATCH v9 12/12] arm64: dts: realtek: Add clock support for RTD1625 Yu-Chun Lin

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=e447f0d347b343129064317fcf220ee7@realtek.com \
    --to=eleanor.lin@realtek.com \
    --cc=afaerber@suse.com \
    --cc=bmasney@redhat.com \
    --cc=conor+dt@kernel.org \
    --cc=cy.huang@realtek.com \
    --cc=cylee12@realtek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=james.tai@realtek.com \
    --cc=jyanchou@realtek.com \
    --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-realtek-soc@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=stanley_chang@realtek.com \
    /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