lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMhs-H_gjW_6p6yBWf+k2PBym4N+k+rBEXR9S8c13NU-UWD4VQ@mail.gmail.com>
Date:   Mon, 10 Jan 2022 10:39:30 +0100
From:   Sergio Paracuellos <sergio.paracuellos@...il.com>
To:     Philipp Zabel <p.zabel@...gutronix.de>
Cc:     "open list:COMMON CLK FRAMEWORK" <linux-clk@...r.kernel.org>,
        John Crispin <john@...ozen.org>, linux-staging@...ts.linux.dev,
        Greg KH <gregkh@...uxfoundation.org>,
        NeilBrown <neil@...wn.name>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Stephen Boyd <sboyd@...nel.org>
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@...gutronix.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ