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_HjsT2om2CZpMmVDYao=M5FoZwyy0Te1QB9MLj6mAxnw@mail.gmail.com>
Date:   Sat, 17 Jun 2023 17:35:28 +0200
From:   Sergio Paracuellos <sergio.paracuellos@...il.com>
To:     Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc:     linux-clk@...r.kernel.org, linux-mips@...r.kernel.org,
        tsbogend@...ha.franken.de, john@...ozen.org,
        linux-kernel@...r.kernel.org, p.zabel@...gutronix.de,
        mturquette@...libre.com, sboyd@...nel.org, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, matthias.bgg@...il.com,
        devicetree@...r.kernel.org, arinc.unal@...nc9.com
Subject: Re: [PATCH v4 8/9] mips: ralink: get cpu rate from new driver code

On Sat, Jun 17, 2023 at 4:48 PM Krzysztof Kozlowski
<krzysztof.kozlowski@...aro.org> wrote:
>
> On 17/06/2023 07:24, Sergio Paracuellos wrote:
> > At very early stage on boot, there is a need to set 'mips_hpt_frequency'.
> > This timer frequency is a half of the CPU frequency. To get clocks properly
> > set we need to call to 'of_clk_init()' and properly get cpu clock frequency
> > afterwards. Depending on the SoC, CPU clock index in the clock provider is
> > different being two for MT7620 SoC and one for the rest. Hence, adapt code
> > to be aligned with new clock driver.
>
>
> >  void __init plat_time_init(void)
> >  {
> > +     struct of_phandle_args clkspec;
> >       struct clk *clk;
> > +     int cpu_clk_idx;
> >
> >       ralink_of_remap();
> >
> > -     ralink_clk_init();
> > -     clk = clk_get_sys("cpu", NULL);
> > +     cpu_clk_idx = clk_cpu_index();
> > +     if (cpu_clk_idx == -1)
> > +             panic("unable to get CPU clock index");
> > +
> > +     of_clk_init(NULL);
> > +     clkspec.np = of_find_node_by_name(NULL, "sysc");
> > +     clkspec.args_count = 1;
> > +     clkspec.args[0] = cpu_clk_idx;
> > +     clk = of_clk_get_from_provider(&clkspec);
>
> This is very obfuscated way of getting clock. Why can't you get it from
> "clocks" property of "cpu", like every other recent platform?

I did not find any other approach that works for me. So I ended up in this one.
Can you point me out in a sample of code doing the same so I can check
if it works for me then?

>
> Anyway, NAK for of_find_node_by_name(), because you now create ABI for
> node name. It's broken approach.

I will change whatever is needed to provide a valid approach. Please,
point me out in the right direction.

>
> Best regards,
> Krzysztof
>

Thanks in advance for your time.

Best regards,
    Sergio Paracuellos

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ