From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29923EB64D9 for ; Sat, 17 Jun 2023 14:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236180AbjFQOsZ (ORCPT ); Sat, 17 Jun 2023 10:48:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233932AbjFQOsY (ORCPT ); Sat, 17 Jun 2023 10:48:24 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 514651FE2 for ; Sat, 17 Jun 2023 07:48:22 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-9829a5ae978so277704866b.2 for ; Sat, 17 Jun 2023 07:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687013301; x=1689605301; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=j1U4ZmZXx/vAL10/mCf095vEMlIWmF3nehD7kLntIR4=; b=ChcxjDgwes6HY4rsFeEdVgdSJcYWw9lrNgoXNUBd42MlO3z+2Tad30VAh2jRuHwnfs +Oxv3XcgbIgjyZJhM8C4EvvB+UuqGNmEybmYZjuyrN3lDBEfB8nV5jIX2sjr0diWfC9G 6jA9xAeyP7ZOhsX1DO7yQgHrYFG4ex+AyLDNc6e0hZPf/rgIqgWIa9Dfq6WXHNPb7BX5 BiQWPD4JQ3IjSjujjBfBkHDBP9KE8gOI8H4DupELlJeTCtsBCvZT25bgz/NMGz3tRNIz trpAh1SZMQ338DW2dhssFVlFheSDJzg7ibKAQ+Kv/JYfaIgjmqB7DbrV35vYAyqPbQTx EXiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687013301; x=1689605301; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j1U4ZmZXx/vAL10/mCf095vEMlIWmF3nehD7kLntIR4=; b=KrdXwROUgFvannVNG1Xai7m9ertkYVmKXUnyWYgRN83LTwnX2I6MsaVlGAvXG+uB2D Ggdo83z5PKRoWZxrZrYoRaRekrvmgRGWFf7yvmjEiLTp6mUB1CvS4oVzqa3TfjwWDIEU DJ7HRJ8BcgdNkCTB9HlbnCSN4RBmIUuUCXR6sDMOg0P6YJOnfdhT8F9jvIrXoQKIxrn9 t4jcK0QdeOqG/bTZidMBD+E5TsoqT1zNL/lzb0q0bjIrU3B3oyPu+ryGPzuqmjeb1Sk0 6s0/BP3GkNmMLLghmGBIh9HyI+/Lt7pCGaEbnfuMj34Q3vA9/oXtZyxMLdXDwv5syJg+ jtbA== X-Gm-Message-State: AC+VfDwcqnA9mCTdkFznA0o/9O4RKwcnYWkBtibpuawNqxnBWf/8Iiau hkse/AgBqLmLNt2UsUSJQ5FAKQ== X-Google-Smtp-Source: ACHHUZ5Kn/BVDeBc4E+2dSIzgz0zNItmrTa6yJTUuBJ7aeykoelm6bQrtRhisnWHDutx2AdTCHryAQ== X-Received: by 2002:a17:907:6d81:b0:974:e767:e1db with SMTP id sb1-20020a1709076d8100b00974e767e1dbmr5635437ejc.46.1687013300606; Sat, 17 Jun 2023 07:48:20 -0700 (PDT) Received: from [192.168.1.20] ([178.197.219.26]) by smtp.gmail.com with ESMTPSA id m25-20020a170906235900b00982aec29db1sm3313076eja.126.2023.06.17.07.48.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Jun 2023 07:48:20 -0700 (PDT) Message-ID: Date: Sat, 17 Jun 2023 16:48:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v4 8/9] mips: ralink: get cpu rate from new driver code Content-Language: en-US To: Sergio Paracuellos , linux-clk@vger.kernel.org Cc: linux-mips@vger.kernel.org, tsbogend@alpha.franken.de, john@phrozen.org, linux-kernel@vger.kernel.org, p.zabel@pengutronix.de, mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, devicetree@vger.kernel.org, arinc.unal@arinc9.com References: <20230617052435.359177-1-sergio.paracuellos@gmail.com> <20230617052435.359177-9-sergio.paracuellos@gmail.com> From: Krzysztof Kozlowski In-Reply-To: <20230617052435.359177-9-sergio.paracuellos@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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? Anyway, NAK for of_find_node_by_name(), because you now create ABI for node name. It's broken approach. Best regards, Krzysztof