Messages in this thread | | | From | Sergio Paracuellos <> | Date | Mon, 10 Jan 2022 10:39:30 +0100 | Subject | Re: [PATCH v6 3/4] clk: ralink: make system controller node a reset provider |
| |
Hi Philipp,
Thanks for the review.
On Mon, Jan 10, 2022 at 10:13 AM Philipp Zabel <p.zabel@pengutronix.de> wrote: > > 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.
Pretty clear, thanks. Will change this check into '.of_xlate' callback and remove it from here.
> > > + > > + 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.
Ditto.
> > > + 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?
It seems it is. This is based on the original reset implementation for ralink. See:
https://elixir.bootlin.com/linux/v5.16/source/arch/mips/ralink/reset.c#L55
> > 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.
I am not following you here. What do you mean?
> > Apart from this, this looks good to me.
Thanks, I will include of_xlate callback changes and send v7.
> > regards > Philipp
Best regards, Sergio Paracuellos
| |