Re: [PATCH v6 3/4] clk: ralink: make system controller node a reset provider

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Philipp,

Thanks for the review.

On Mon, Jan 10, 2022 at 10:13 AM Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> 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




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux