[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5368e89c391e1329ed2be6496655f1bb50acfd19.camel@pengutronix.de>
Date: Mon, 10 Jan 2022 10:13:21 +0100
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Sergio Paracuellos <sergio.paracuellos@...il.com>,
linux-clk@...r.kernel.org
Cc: john@...ozen.org, linux-staging@...ts.linux.dev,
gregkh@...uxfoundation.org, neil@...wn.name,
linux-kernel@...r.kernel.org, sboyd@...nel.org
Subject: Re: [PATCH v6 3/4] clk: ralink: make system controller node a reset
provider
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
Powered by blists - more mailing lists