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] [day] [month] [year] [list]
Message-ID: <CAOwMV_z9QzAOO09ZUVyn61Fv4+pRUNA0H22tnP-PrXUOLRjXeg@mail.gmail.com>
Date:   Mon, 26 Oct 2020 19:08:20 +0100
From:   Fabien Parent <fparent@...libre.com>
To:     Rob Herring <robh@...nel.org>
Cc:     "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        DTML <devicetree@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Matthias Brugger <matthias.bgg@...il.com>, tglx@...utronix.de,
        Daniel Lezcano <daniel.lezcano@...aro.org>
Subject: Re: [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support

Hi Rob,

On Mon, Oct 26, 2020 at 2:30 PM Rob Herring <robh@...nel.org> wrote:
>
> On Sat, Oct 17, 2020 at 05:38:57PM +0200, Fabien Parent wrote:
> > Some MediaTek SoC like MT8516 need to enable additional clocks
> > for the GPT timer. Enable them if present.
> >
> > Signed-off-by: Fabien Parent <fparent@...libre.com>
> > ---
> >  drivers/clocksource/timer-mediatek.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
> > index 9318edcd8963..42e2d2090484 100644
> > --- a/drivers/clocksource/timer-mediatek.c
> > +++ b/drivers/clocksource/timer-mediatek.c
> > @@ -9,6 +9,7 @@
> >
> >  #define pr_fmt(fmt)  KBUILD_MODNAME ": " fmt
> >
> > +#include <linux/clk.h>
> >  #include <linux/clockchips.h>
> >  #include <linux/clocksource.h>
> >  #include <linux/interrupt.h>
> > @@ -278,8 +279,19 @@ static int __init mtk_syst_init(struct device_node *node)
> >
> >  static int __init mtk_gpt_init(struct device_node *node)
> >  {
> > +     struct clk *clk_13m, *clk_bus;
> >       int ret;
> >
> > +     /* Optional clock*/
>
> Then use the optional api variant.

I looked for optional API variant but could only find these:
* struct clk *devm_clk_get_optional(struct device *dev, const char *id);
* struct clk *devm_clk_get_optional(struct device *dev, const char *id);

These two require a "struct device" parameter but in the function
mtk_gpt_init, we only have a "struct device_node" I didn't see any way
to get a "struct device" from a "struct device_node".

>
> > +     clk_13m = of_clk_get_by_name(node, "clk13m");
> > +     if (!IS_ERR(clk_13m))
>
> And then you can drop this check (or handle it for any error other than
> clock is not present).
>
> > +             clk_prepare_enable(clk_13m);
> > +
> > +     /* Optional clock*/
> > +     clk_bus = of_clk_get_by_name(node, "bus");
> > +     if (!IS_ERR(clk_bus))
> > +             clk_prepare_enable(clk_bus);
> > +
> >       to.clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
> >       to.clkevt.set_state_shutdown = mtk_gpt_clkevt_shutdown;
> >       to.clkevt.set_state_periodic = mtk_gpt_clkevt_set_periodic;
> > --
> > 2.28.0
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ