Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7215696ybi; Wed, 5 Jun 2019 13:18:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCpp5tX+/dqyPIcoOKXPU7qYlZiqg5SNiF5S29H4C8RTqub1uwYnu4pX94yFm7kIVJ53R7 X-Received: by 2002:a65:654f:: with SMTP id a15mr706306pgw.73.1559765910859; Wed, 05 Jun 2019 13:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559765910; cv=none; d=google.com; s=arc-20160816; b=m2b+2wmsYvdVe7HqnazpE2E0CAHWTK3NKy+C6t2oJQv01PJFLAZ8jOJNceP4TAK6Ue ckakuJdUwNVM1XehhsOoPaCGHtte5kNMVW57atCExtvNYmNYoxdVdW4IbljurJSt1jA8 MP6pJI428P5XH+OUZhVlbIsEms2x3SfGS7BbsqdwvX4/5SHxRtJCzNAstbUOzLBFRPTE nLyXNEfSKRwqvDrTI94jto+VrJGRAD/YxE3Gdtw8CTWf1WK3fWG8yPZC+QNriRDohvsR vyuebm8Sl0kbrEhO7eIslP6626sg8Zoq3Qkq1iaoAZGS76GXmYfK+DojTRVLgmSsga+f t0bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=H+QeczUW4S9HwAYJ3a9V3kbYCRvgpl+BNWPWA4eP0T8=; b=mB8NSeUnmjBY5OoN8nd+TACqK7AamYCTKhbrqtil7fpblWl5DchDCtmyV91lH/cbHj 44XjkdZaAoVjAEDFz6VOwTcR10WlHOnzR2EG4/QdU7IWJLX5bgeUuD/Q1eK2geVhbU8J V6aey08ZuYTWVg/FgaWKndL+vh7xMQ8EDmbhjI1ED/05hUou4dvqTqk0aK02K4+2RpNf q/qqXerX+x1wWIfRfm3qO8Ztr+iqjVsdd49GM4LHXKNdjrsWQwlkX4h7dzk9vmao7lUP i56eOuw/AT96q80k2Q45WFq11/tJGDEAOWDaktanQKprDpgpDtqGluznb2XV47J56Vfa mNSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=VJXJDhnD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si27740255pgl.282.2019.06.05.13.18.14; Wed, 05 Jun 2019 13:18:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=VJXJDhnD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726561AbfFEUQ2 (ORCPT + 99 others); Wed, 5 Jun 2019 16:16:28 -0400 Received: from mout.gmx.net ([212.227.15.15]:39527 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbfFEUQ2 (ORCPT ); Wed, 5 Jun 2019 16:16:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1559765745; bh=rijiQSXdFy2isPAAqnaADCu9R9ZY3RJXS+RUCx+UfTs=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=VJXJDhnDH3ex3dDL7itq0g4lKdjZcUZbtrGmw9d61c5zy5a8seGbh2HVSwNLRVvn5 koMKEj/v+1NXTABfa/sgn9ERg9rSf7dONwUE4mEkp31xzodKqguf7iGnsjyDfGOD4s NXaaHUuBhOCCfD+ibFQy8puryJ8ldsnADt+ABVTA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.1.162] ([37.4.249.160]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MBVwM-1hRR2s3Qv8-00AVYp; Wed, 05 Jun 2019 22:15:45 +0200 Subject: Re: [PATCH 0/4] cpufreq support for the Raspberry Pi To: Nicolas Saenz Julienne , Stefan Wahren , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Cc: f.fainelli@gmail.com, ptesarik@suse.com, sboyd@kernel.org, viresh.kumar@linaro.org, mturquette@baylibre.com, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, eric@anholt.net, bcm-kernel-feedback-list@broadcom.com, linux-clk@vger.kernel.org, mbrugger@suse.de, ssuloev@orpaltech.com References: <20190604173223.4229-1-nsaenzjulienne@suse.de> <2ece3f20-ef8c-c39e-941c-76635ddbe185@gmx.net> <1a86637dad1d2f33450950143a82016beb91bdb6.camel@suse.de> <1c9708c9-a3c9-8a8f-4693-8f29d3e60634@gmx.net> <6f40f43ed32c5c519761879245423f7c371e4ae6.camel@suse.de> From: Stefan Wahren Openpgp: preference=signencrypt Autocrypt: addr=stefan.wahren@i2se.com; keydata= xsFNBFt6gBMBEACub/pBevHxbvJefyZG32JINmn2bsEPX25V6fejmyYwmCGKjFtL/DoUMEVH DxCJ47BMXo344fHV1C3AnudgN1BehLoBtLHxmneCzgH3KcPtWW7ptj4GtJv9CQDZy27SKoEP xyaI8CF0ygRxJc72M9I9wmsPZ5bUHsLuYWMqQ7JcRmPs6D8gBkk+8/yngEyNExwxJpR1ylj5 bjxWDHyYQvuJ5LzZKuO9LB3lXVsc4bqXEjc6VFuZFCCk/syio/Yhse8N+Qsx7MQagz4wKUkQ QbfXg1VqkTnAivXs42VnIkmu5gzIw/0tRJv50FRhHhxpyKAI8B8nhN8Qvx7MVkPc5vDfd3uG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6atWvYl0fy/CqajT Ksx7+p9xziu8ZfVX+iKBCc+He+EDEdGIDhvNZ/IQHfOB2PUXWGS+s9FNTxr/A6nLGXnA9Y6w 93iPdYIwxS7KXLoKJee10DjlzsYsRflFOW0ZOiSihICXiQV1uqM6tzFG9gtRcius5UAthWaO 1OwUSCQmfCOm4fvMIJIA9rxtoS6OqRQciF3crmo0rJCtN2awZfgi8XEif7d6hjv0EKM9XZoi AZYZD+/iLm5TaKWN6oGIti0VjJv8ZZOZOfCb6vqFIkJW+aOu4orTLFMz28aoU3QyWpNC8FFm dYsVua8s6gN1NIa6y3qa/ZB8bA/iky59AEz4iDIRrgUzMEg8Ak7Tfm1KiYeiTtBDCo25BvXj bqsyxkQD1nkRm6FAVzEuOPIe8JuqW2xD9ixGYvjU5hkRgJp3gP5b+cnG3LPqquQ2E6goKUML AQ== Message-ID: <008bf9da-b2eb-8858-a58b-4252b7920856@gmx.net> Date: Wed, 5 Jun 2019 22:15:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <6f40f43ed32c5c519761879245423f7c371e4ae6.camel@suse.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Provags-ID: V03:K1:TijECVh98arPrcmwN3J8EqR3bttBi4JP2mkLKSUCsKLttPAEda6 vgUKwT6larHeCrNof/v6AeWluYqdpyICbs1C6QLuSTvT6m6GHgZzHa4efCHhGr+9alKGNgJ kspPB4/jMmsDDi94JiTvMhYqDguCkXj6gxGRHLJcy289xmKFRHqdU4t06wRU9aiAlpkLjYl BeU3PI5fh+IsAUe8cZb2Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:wjRpJFh5V5Q=:sXUFJUqTYNiSwsF5XvN/yW w+4gVP272Vh513kJHKFVldzPTVSDiUmTsQRLNaq29uvqusIl8hnEHaimvN7A0Ljfjkpc9+zke aQIPueHWT2506vFI/YBANiZ3RoqyAX3n1wZChg7zfTHmgAq+8bV4cTxgvFCu44prF9/nI/Q3o +Bonq/81uuNf/jPyqIv1+zfUXopiuiLPEqaFstodjh2gfWHf6qgd8lVSZtT8auEJf2x0VTcVQ +iFffj5JbT+/XKMPXYLMJG6sCFs3US+po7KfJN2lxsRn3+r19K+F+XP2/8J06XlC+N/fc58X/ 4JtGgAR9Mp8G5FAC65XMTufHkdCBi7c+sdC3FR1e5I4PlN6Cl0Ya8Av2LKapzZ2b8eQRl4APo 7gZsr2iTBVJaCQLhSPPaYbtrVwUm5AlBiAEv9wFOQ8zfbDTHB4ROFp+i1B7cG8MtdM8rFyAf3 hbGwv2gWDTxriHf4FpY1yWyDr6j9D7k4PvtQa9yior25PCNrULM0ySc8QC3WDZDowHkmeiRm4 z1v6bIalnMiHPdKB0EI+Py4lRynA+GZUnwZdLEPBTi86rnl7ulqmVskitd0HNxS2FPGrUChmx OKE8epnMuizky9pEvj1s0N6bKPQy0497avYNBjaoUhbe7YCfVc2J12KNtdCnUDO5PxP4Bnorj LeXmGuvkyzN3IMz+OPGd3Hm5fUJMCiKvRvIjJZqfAPYqVGaDMh734zPi6a2/2WV++JkcnwByP qrEGHjy+V9CAgRaM0C1y844Sx4eDFvqNVExmvwEPXPH5zc/pOsWAJcZBnFfdTRzNwBvFvJ3jx gRrAZvgjdGEj9/9weEKw67e55BuzZ3QCzkExCxZH/HwJObXxos9uVWk6DmxDEQzC6JjOFG/h5 8vu7jyQII98OflI+C6k1GacIPu9rSFAlYyMv67Y1O8WxaM7P5KSSOew78X8VA6EbJeZeZCl+8 KB2n8TZcdCOE3hKQmtAP/97XpogPc9ikz7vkEYlhKYPCvyK1S8/hQ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nicolas, >> Am 05.06.19 um 13:00 schrieb Nicolas Saenz Julienne: >>> Hi Stefan, >>> thanks for the review, I took note of your code comments. >>> >>> On Wed, 2019-06-05 at 11:46 +0200, Stefan Wahren wrote: >>>> Hi Nicolas, >>>> >>>> Am 04.06.19 um 19:32 schrieb Nicolas Saenz Julienne: >>>>> Hi all, >>>>> this series aims at adding cpufreq support to the Raspberry Pi fami= ly of >>>>> boards. >>>>> >>>>> The previous revision can be found at:=20 >>>>> https://lkml.org/lkml/2019/5/20/431 >>>>> >>>>> The series first factors out 'pllb' from clk-bcm2385 and creates a = new >>>>> clk driver that operates it over RPi's firmware interface[1]. We ar= e >>>>> forced to do so as the firmware 'owns' the pll and we're not allowe= d to >>>>> change through the register interface directly as we might race wit= h the >>>>> over-temperature and under-voltage protections provided by the firm= ware. >>>> it would be nice to preserve such design decision in the driver as a= >>>> comment, because the cover letter usually get lost. >>>>> Next it creates a minimal cpufreq driver that populates the CPU's o= pp >>>>> table, and registers cpufreq-dt. Which is needed as the firmware >>>>> controls the max and min frequencies available. >>>> I tested your series on top of Linux 5.2-rc1 with multi_v7_defconfig= and >>>> manually enable this drivers. During boot with Raspbian rootfs i'm >>>> getting the following: >>>> >>>> [ 1.177009] cpu cpu0: failed to get clock: -2 >>>> [ 1.183643] cpufreq-dt: probe of cpufreq-dt failed with error -2 >>> This is surprising, who could be creating a platform_device for cpufr= eq-dt >>> apart from raspberrypi-cpufreq? Just to make things clear, you're usi= ng the >>> device tree from v5.2-rc1 (as opposed to the Raspbian one)? >> sorry my fault, i thought it already has been replaced. The behavior i= n >> this unexpected case is fine, since it doesn't crash. >> >> I replaced the the DTB with the mainline one, but now i'm getting this= : >> >> [ 4.566068] cpufreq: cpufreq_online: CPU0: Running at unlisted freq= : >> 600000 KHz >> [ 4.580690] cpu cpu0: dev_pm_opp_set_rate: Invalid target frequency= 0 >> [ 4.594391] cpufreq: __target_index: Failed to change cpu frequency= : -22 > For the record this fixes it: > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c > index aa51756fd4d6..edb71eefe9cf 100644 > --- a/drivers/clk/clk.c > +++ b/drivers/clk/clk.c > @@ -1293,7 +1293,7 @@ static int clk_core_determine_round_nolock(struct= clk_core > *core, > } else if (core->ops->round_rate) { > rate =3D core->ops->round_rate(core->hw, req->rate, > &req->best_parent_rate); > - if (rate < 0) > + if (IS_ERR_VALUE(rate)) > return rate; > > req->rate =3D rate; > > round_rate() returns a 'long' value, yet 'pllb' in rpi3b+ goes as high = as > 2.8GHz, which only fits in an 'unsigned long'. This explains why I didn= 't see > this issue with RPI2b. Okay, i understand the problem. But the patch doesn't look like the proper fix to me. Maybe the better way is to implement determine_rate instead of round_rate in the clock driver. AFAICS this provides the necessary unsigned long. > > I'll add the patch to the series. > > Regards, > Nicolas