From: Philipp Zabel <p.zabel@pengutronix.de>
To: Sergio Paracuellos <sergio.paracuellos@gmail.com>,
linux-clk@vger.kernel.org
Cc: john@phrozen.org, linux-staging@lists.linux.dev,
gregkh@linuxfoundation.org, neil@brown.name,
linux-kernel@vger.kernel.org, sboyd@kernel.org
Subject: Re: [PATCH v6 3/4] clk: ralink: make system controller node a reset provider
Date: Mon, 10 Jan 2022 10:13:21 +0100 [thread overview]
Message-ID: <5368e89c391e1329ed2be6496655f1bb50acfd19.camel@pengutronix.de> (raw)
In-Reply-To: <20220110083910.1351020-4-sergio.paracuellos@gmail.com>
Hi Sergio,
On Mon, 2022-01-10 at 09:39 +0100, Sergio Paracuellos wrote:
> +static int mt7621_assert_device(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + struct mt7621_rst *data = to_mt7621_rst(rcdev);
> + struct regmap *sysc = data->sysc;
> +
> + if (id == MT7621_RST_SYS)
> + return -EINVAL;
Better implement the .of_xlate callback and check there instead.
That way it would fail on reset_control_get() rather than handing out a
valid reset controller that just doesn't work.
> +
> + return regmap_update_bits(sysc, SYSC_REG_RESET_CTRL, BIT(id), BIT(id));
> +}
> +
> +static int mt7621_deassert_device(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + struct mt7621_rst *data = to_mt7621_rst(rcdev);
> + struct regmap *sysc = data->sysc;
> +
> + if (id == MT7621_RST_SYS)
> + return -EINVAL;
Same as above.
> + return regmap_update_bits(sysc, SYSC_REG_RESET_CTRL, BIT(id), 0);
> +}
> +
> +static int mt7621_reset_device(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + int ret;
> +
> + ret = mt7621_assert_device(rcdev, id);
> + if (ret < 0)
> + return ret;
> +
> + return mt7621_deassert_device(rcdev, id);
> +}
Is this known to work for all possible users, without delay between
assert and deassert?
Are there any users of the reset_control_reset() API at all? This API
was added for self-clearing reset bits, so if there are no users that
need to pretend this is a reset pulse at the hardware level (there may
be), I'd prefer if this was just left out.
Apart from this, this looks good to me.
regards
Philipp
next prev parent reply other threads:[~2022-01-10 9:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 8:39 [PATCH v6 0/4] clk: ralink: make system controller " Sergio Paracuellos
2022-01-10 8:39 ` [PATCH v6 1/4] dt-bindings: reset: add dt binding header for Mediatek MT7621 resets Sergio Paracuellos
2022-01-10 8:39 ` [PATCH v6 2/4] dt-bindings: clock: mediatek,mt7621-sysc: add '#reset-cells' property Sergio Paracuellos
2022-01-10 8:39 ` [PATCH v6 3/4] clk: ralink: make system controller node a reset provider Sergio Paracuellos
2022-01-10 9:13 ` Philipp Zabel [this message]
2022-01-10 9:39 ` Sergio Paracuellos
2022-01-10 10:23 ` Philipp Zabel
2022-01-10 10:59 ` Sergio Paracuellos
2022-01-10 8:39 ` [PATCH v6 4/4] staging: mt7621-dts: align resets with binding documentation Sergio Paracuellos
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=5368e89c391e1329ed2be6496655f1bb50acfd19.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=john@phrozen.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=neil@brown.name \
--cc=sboyd@kernel.org \
--cc=sergio.paracuellos@gmail.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
all inboxes | Powered by JetHome®