From: Philipp Zabel <p.zabel@pengutronix.de>
To: Changhuang Liang <changhuang.liang@starfivetech.com>,
Brian Masney <bmasney@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Emil Renner Berthing <kernel@esmil.dk>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org,
Hal Feng <hal.feng@starfivetech.com>
Subject: Re: [PATCH v2 5/6] reset: starfive: jh71x0: Support discontiguous reset IDs
Date: Wed, 18 Nov 2026 11:39:56 +0100 [thread overview]
Message-ID: <0ee6bfcc5bb62fcb0c9128168e9367254393eca3.camel@pengutronix.de> (raw)
In-Reply-To: <20261118100523.11395-6-changhuang.liang@starfivetech.com>
On Mi, 2026-11-18 at 02:05 -0800, Changhuang Liang wrote:
> The reset IDs exposed to consumers of the StarFive JHB100 reset
> controllers do not map one-to-one to the hardware reset bits.
>
> Add struct jh71x0_reset_info, which describes the number of resets, the
> assert/status register offsets and, for such controllers, a table of
> hardware reset lines indexed by reset ID. Add
> reset_starfive_jh71x0_register_with_info() to register a controller
> described this way.
>
> If a map is provided, install a custom fwnode_xlate callback that
> translates the reset ID of the reset specifier to the hardware reset
> line. The translation is thus done once when a reset control is
> requested, and the reset operations are left untouched since they only
> ever see hardware reset lines.
>
> Existing users of reset_starfive_jh71x0_register() are unaffected.
>
> Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
> ---
> .../reset/starfive/reset-starfive-jh71x0.c | 60 +++++++++++++++++++
> .../reset/starfive/reset-starfive-jh71x0.h | 24 ++++++++
> 2 files changed, 84 insertions(+)
>
> diff --git a/drivers/reset/starfive/reset-starfive-jh71x0.c b/drivers/reset/starfive/reset-starfive-jh71x0.c
> index d410a5a0ded4..5c64d47fb530 100644
> --- a/drivers/reset/starfive/reset-starfive-jh71x0.c
> +++ b/drivers/reset/starfive/reset-starfive-jh71x0.c
[...]
> @@ -132,3 +152,43 @@ int reset_starfive_jh71x0_register(struct device *dev, struct device_node *of_no
> return devm_reset_controller_register(dev, &data->rcdev);
> }
> EXPORT_SYMBOL_GPL(reset_starfive_jh71x0_register);
> +
> +int reset_starfive_jh71x0_register_with_info(struct device *dev, struct device_node *of_node,
> + void __iomem *assert, void __iomem *status,
> + const u32 *asserted,
> + const struct jh71x0_reset_info *info,
> + struct module *owner)
> +{
> + struct jh71x0_reset *data;
> + int ret;
> +
> + data = devm_kzalloc_obj(dev, *data);
> + if (!data)
> + return -ENOMEM;
> +
> + data->rcdev.ops = &jh71x0_reset_ops;
> + data->rcdev.owner = owner;
> + data->rcdev.nr_resets = info->nr_resets;
> + data->rcdev.dev = dev;
> + data->rcdev.of_node = of_node;
> +
> + if (info->map) {
> + data->map = info->map;
> + data->rcdev.fwnode_xlate = jh71x0_reset_fwnode_xlate;
> + data->rcdev.fwnode_reset_n_cells = 1;
> + }
> +
> + spin_lock_init(&data->lock);
> + data->assert = assert;
> + data->status = status;
> + data->asserted = asserted;
> +
> + ret = devm_reset_controller_register(dev, &data->rcdev);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "Failed to register reset controller\n");
> +
> + dev_info(dev, "Registered %u resets\n", data->rcdev.nr_resets);
Does this really need to be this verbose? Otherwise,
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
regards
Philipp
next prev parent reply other threads:[~2026-11-18 10:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 10:05 [PATCH v2 0/6] Add System-0 CRG for JHB100 SoC Changhuang Liang
2026-11-18 10:05 ` [PATCH v2 1/6] clk: starfive: jh7110-sys: Fix memory leak in reset controller register Changhuang Liang
2026-11-18 10:05 ` [PATCH v2 2/6] clk: starfive: jh71x0: Move reset controller registration to jh71x0 common code Changhuang Liang
2026-11-18 10:05 ` [PATCH v2 3/6] clk: starfive: jh71x0: Add generic CRG probe helper Changhuang Liang
2026-11-18 10:05 ` [PATCH v2 4/6] clk: starfive: Add JHB100 System-0 clock generator driver Changhuang Liang
2026-11-18 10:05 ` [PATCH v2 5/6] reset: starfive: jh71x0: Support discontiguous reset IDs Changhuang Liang
2026-11-18 10:39 ` Philipp Zabel [this message]
2026-11-18 10:05 ` [PATCH v2 6/6] reset: starfive: Add StarFive JHB100 System-0 reset driver Changhuang Liang
2026-11-18 10:39 ` Philipp Zabel
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=0ee6bfcc5bb62fcb0c9128168e9367254393eca3.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=bmasney@redhat.com \
--cc=changhuang.liang@starfivetech.com \
--cc=conor+dt@kernel.org \
--cc=hal.feng@starfivetech.com \
--cc=jbrunet+clk@baylibre.com \
--cc=kernel@esmil.dk \
--cc=krzk+dt@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=robh@kernel.org \
--cc=sboyd@kernel.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
all inboxes | Powered by JetHome®