Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2786651ybc; Wed, 13 Nov 2019 22:05:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzMt8y+bwfEtwQjBFEbgmytXQt0a3t2YaCgF2gLQZjbPpSh6GvMGHCu/ma6p5drtDq4HEOZ X-Received: by 2002:a17:906:d293:: with SMTP id ay19mr6658103ejb.146.1573711528696; Wed, 13 Nov 2019 22:05:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573711528; cv=none; d=google.com; s=arc-20160816; b=Xv4fq6/W4UA/bv0p6T7Cs1ubWZKQjdvXvBLGnnIGcvWKIBKlhtsZ92OFDrpsnT1+0h LF5DCbwBNb6LEtDkgCdEfXTt2e5PEwHgOYpMHKyupZQi6fpxbM7XF22dnnFq+chZHjxx vDc8QAtgVlSrUQq+qAWWpLXFBurkPje2spvDPRucPwFniEM79VHf7cyPIq5vThvRaP9j 894A6ZVlcF6jBDOOwn2ZXazvAPoHv1Yad4koxBVQcQqAcsTm/fMZWY3iPOFPJqK2imTF NmzWZapCCuEX1jHOI1RfT8MUvnXF89Yrq64yBAjdbplM4rvjHMpeX26kykibb1PjJfNo 46nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:cc:to:subject :dkim-signature:dkim-filter; bh=844ttLUpNaaPNiYTmal0WcOkLi3t0g8bvltfaZY1WMc=; b=mkoIQwtP+LVBVv2XeT9p+k0jBEw3CW9jjSw9/TdEhhKUlAV6prcEqUwUHGHdpWW6kw jmyW2VswN1m+U1PshewZXTKJTDaAd5h0FSZ909SNgzf6Mpw3DEpjAtkz4mgYqQjJoE7I PzksKMcgJFWRwesVi3Zwe5EgtxIfSHhHGScHdm3XyRW8a0dTH43svrmyA0W9gbWVLC8u 78xSw3X1mFJhdxSlPfa22S0KtuNmBKTiXWIWpWfcndir4xqLP6jmFhm4VR6G2kSFK2Fy jBQZZeecf/a+nmALkHZFSHWNG3AVY/gDFrqolbWZ571ALQFKLP6awJ3bkxaPSGA3aZjP uObw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VBYQcNJQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13si3216934eda.288.2019.11.13.22.05.04; Wed, 13 Nov 2019 22:05:28 -0800 (PST) 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=@samsung.com header.s=mail20170921 header.b=VBYQcNJQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726409AbfKNGCB (ORCPT + 99 others); Thu, 14 Nov 2019 01:02:01 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:20751 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbfKNGCA (ORCPT ); Thu, 14 Nov 2019 01:02:00 -0500 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20191114060157epoutp049f4d065c2c85c620dba803755a621b94~W8hr0AmxM0900109001epoutp04o for ; Thu, 14 Nov 2019 06:01:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20191114060157epoutp049f4d065c2c85c620dba803755a621b94~W8hr0AmxM0900109001epoutp04o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1573711317; bh=844ttLUpNaaPNiYTmal0WcOkLi3t0g8bvltfaZY1WMc=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=VBYQcNJQ1iVNHjtoMtIsf0jCA1BJO3EQRz+CWpVBs2r1VuP4QKMXy3zDqeXRSq1zg PNDynsc3i7IWj8txMXkZA8sPR3XcQbHHSUu+hEXXKIAHsetN796T5eIK2eFKsZCnqP 8r6IBl/eNGiQvLYwCWkc3odzhhZPbqpgvMlTLqJM= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20191114060156epcas1p16c31d92b8a67fe418f70844229933091~W8hrbCU_n2708227082epcas1p1W; Thu, 14 Nov 2019 06:01:56 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.40.152]) by epsnrtp4.localdomain (Postfix) with ESMTP id 47D9q658vBzMqYkn; Thu, 14 Nov 2019 06:01:54 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 52.86.04068.2DDECCD5; Thu, 14 Nov 2019 15:01:54 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20191114060153epcas1p439994a9d2b13c795d4c91d3e86d24c24~W8honRn_j2958129581epcas1p4g; Thu, 14 Nov 2019 06:01:53 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20191114060153epsmtrp269df35d7f834333cbe5b05004f6757af~W8homjPdy0512805128epsmtrp2b; Thu, 14 Nov 2019 06:01:53 +0000 (GMT) X-AuditID: b6c32a39-f5fff70000000fe4-1e-5dccedd259b1 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id BC.74.24756.1DDECCD5; Thu, 14 Nov 2019 15:01:53 +0900 (KST) Received: from [10.113.221.102] (unknown [10.113.221.102]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20191114060153epsmtip1cb6f59fbc93e5ea722e2eda400d1f728~W8hoWvjWh2319423194epsmtip1T; Thu, 14 Nov 2019 06:01:53 +0000 (GMT) Subject: Re: [PATCH] devfreq: exynos-bus: workaround dev_pm_opp_set_rate() errors on Exynos5422/5800 SoCs To: Kamil Konieczny , Marek Szyprowski , k.konieczny@partner.samsung.com Cc: Bartlomiej Zolnierkiewicz , MyungJoo Ham , Kyungmin Park , Kukjin Kim , Krzysztof Kozlowski , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Chanwoo Choi Organization: Samsung Electronics Message-ID: <9e0a4aa6-46a6-3ca6-42db-11ed55b468dd@samsung.com> Date: Thu, 14 Nov 2019 15:07:38 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Ta0gUURTmzuzOjtXWbc06bVHbRJDSqpNtjZE96LWUlFBED8QGHVZzH8PO allU2lvLXhrpZiSUWkKpq5mJtmVSLFZGllgRGUpZlpHa0167O0b++84533fP+c69lyY19ZSW TrI6BLuVNzPUMEX17eAw/aMP92LDM9+EcBV5ZUru6I0/iCvszVNyxzq6Sa65uVzF3d/zXsW5 OlqVXEttAcX1ZTciLq/5BsFdbnyh4p5nXKQWjjC6SjMpY+WF3cZbPXWE8WhVKTL2uSbFKDcm z0sU+ATBrhOs8baEJKspilm5Jm5xnGF2OKtnI7k5jM7KW4QoZkl0jH5Zktk7HqNL5c0p3lQM L0lM2Px5dluKQ9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uHmXuYuQAsoUlDh8uhqh5yyjx p+84E0iNsEC2xLfTy8BqRARqJTq+SIPUMAvcZZJY9+0DE0TDGyaJv28PgA1lE9CS2P/iBpjN L6AocfXHY0YQm1fATuLnlNlgQ1kEVCUebvoOViMqECHxfPsNqBpBiZMzn7CA2JwC9hI/d/1m B7GZBdQl/sy7xAxhi0vcejKfCcKWl2jeOpt5AqPwLCTts5C0zELSMgtJywJGllWMkqkFxbnp ucWGBYZ5qeV6xYm5xaV56XrJ+bmbGMHRp6W5g/HykvhDjAIcjEo8vAdEz8QKsSaWFVfmHmKU 4GBWEuHVyAMK8aYkVlalFuXHF5XmpBYfYpTmYFES532adyxSSCA9sSQ1OzW1ILUIJsvEwSnV wMhgu4O/dV5UyOZU268PF0xrWySRWP527z03Z+sTN07MvTIvPSMs9+2i66EnBFfLPzQ9MV0j 0TlpT61JX1+v0YwZa9nu+Fg/7BK4v8JNpeD6T6OM1kMFJqceMm/h2ZWflXp6q0Kp0OeUzh3n PYMu2zzqWdD/d1v4ysK7M//ce9pxwCzrzgQTx51KLMUZiYZazEXFiQA966KAugIAAA== X-CMS-MailID: 20191114060153epcas1p439994a9d2b13c795d4c91d3e86d24c24 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20191008134950eucas1p15cfef5800efc10d5b18ec5eb37dde60b References: <20191008134923.30123-1-k.konieczny@partner.samsung.com> <4f14d3af-e455-d05b-fc03-cba58e001f41@samsung.com> <0ce56e65-d989-18f8-af84-2fbd74ba20aa@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kamil, On 11/14/19 12:12 AM, Kamil Konieczny wrote: > Hi Chanwoo, > > On 14.10.2019 08:46, Chanwoo Choi wrote: >> Hi Marek, >> >> On 19. 10. 11. 오후 8:33, Marek Szyprowski wrote: >>> Hi Chanwoo, >>> >>> On 10.10.2019 04:50, Chanwoo Choi wrote: >>>> On 2019년 10월 08일 22:49, k.konieczny@partner.samsung.com wrote: >>>>> Commit 4294a779bd8d ("PM / devfreq: exynos-bus: Convert to use >>>>> dev_pm_opp_set_rate()") introduced errors: >>>>> exynos-bus: new bus device registered: soc:bus_wcore ( 84000 KHz ~ 400000 KHz) >>>>> exynos-bus: new bus device registered: soc:bus_noc ( 67000 KHz ~ 100000 KHz) >>>>> exynos-bus: new bus device registered: soc:bus_fsys_apb (100000 KHz ~ 200000 KHz) >>>>> ... >>>>> exynos-bus soc:bus_wcore: dev_pm_opp_set_rate: failed to find current OPP for freq 532000000 (-34) >>>>> exynos-bus soc:bus_noc: dev_pm_opp_set_rate: failed to find current OPP for freq 111000000 (-34) >>>>> exynos-bus soc:bus_fsys_apb: dev_pm_opp_set_rate: failed to find current OPP for freq 222000000 (-34) >>>>> >>>>> They are caused by incorrect PLL assigned to clock source, which results >>>>> in clock rate outside of OPP range. Add workaround for this in >>>>> exynos_bus_parse_of() by adjusting clock rate to those present in OPP. >>>> If the clock caused this issue, you can set the initial clock on DeviceTree >>>> with assigned-clock-* properties. Because the probe time of clock driver >>>> is early than the any device drivers. >>>> >>>> It is not proper to fix the clock issue on other device driver. >>>> I think you can fix it by using the supported clock properties. >>> >>> This issue is about something completely different. The OPPs defined in >>> DT cannot be applied, because it is not possible to derive the needed >>> clock rate from the bootloader-configured clock topology (mainly due to >>> lack of common divisor values for some of the parent clocks). Some time >>> ago Lukasz tried initially to redefine this clock topology using >>> assigned-clock-rates/parents properties (see >>> https://protect2.fireeye.com/url?k=4b80c0304459bc8e.4b814b7f-f87f1e1aee1a85c0&u=https://lkml.org/lkml/2019/7/15/276), but it has limitations and some >>> such changes has to be done in bootloader. Until this is resolved, >>> devfreq simply cannot set some of the defined OPPs. >> >> As you mentioned, the wrong setting in bootloader cause the this issue. >> So, this patch change the rate on exynos-bus.c in order to fix >> the issue with workaround style. >> >> But, also, it can be fixed by initializing the clock rate on DT >> although it is not fundamental solution as you mentioned. >> >> If above two method are workaround way, I think that set the clock >> rate in DT is proper. The role of 'assigned-clock-*' properties >> is for this case in order to set the initial frequency on probe time. > > I can add 'assigned-clock-*' to DT, but the issue is caused in opp points, > so the warning from exynos-bus will still be there. > > Before this fix, devfreq will issue warning and then change clock to max > frequency within opp range. This fix mask warning, and as Marek and > Lukasz Luba wrotes, the proper fix will be to make changes in u-boot > (and connect proper PLLs to IPs). PLL could be changed by clock device driver in the linux kernel. If you don't add the supported frequency into PLL frequency table of clock device driver, will fail to change the wanted frequency on the linux kernel. It means that it is not fixed by only touching the bootloader. As you commented, the wrong opp points which are specified on dt cause this issue. Usually, have to initialize the clock rate on dt by using 'assigned-clocks-*' property and then use the clock with the preferable clock rate. I think that we have to fix the fundamental problem. Without bootloader problem, you can fix it by initializing the clock on dt with 'assigned-clocks-*' property. As I knew that it is correct way and I always tried to do this method for resolving the similar clock issue. Lastly, I think that my opinion is more simple and correct. It could give the more correct information to linux kernel user which refer to the device tree file. 1. Your suggestion a. Add opp-table with unsupported frequency on dt b. Try to change the clock rate on exynos-bus.c by using unsupported frequency from opp-table c. If failed, retry to change the clock rate on exynos-bus.c 2. My opinion a. Initialize the PLL or any clock by using assigned-clock-* property on dt and add opp-table with supported frequency on dt b. Try to change the clock rate on exynos-bus.c by using supported frequency from opp-table > > Second solution would be to write down new OPP points with currently used > frequencies, and with max one for 532 MHz. > >> I think that the previous patch[1] of Kamil Konieczny is missing >> the patches which initialize the clock rate on DT file. >> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4294a779bd8dff6c65e7e85ffe7a1ea236e92a68 >> >>> >>> This issue was there from the beginning, recent Kamil's patch only >>> revealed it. In fact it was even worse - devfreq and common clock >>> framework silently set lower clock than the given OPP defined. >>> >>>>> Fixes: 4294a779bd8d ("PM / devfreq: exynos-bus: Convert to use dev_pm_opp_set_rate()") >>>>> Reported-by: Krzysztof Kozlowski >>>>> Signed-off-by: Kamil Konieczny >>>>> --- >>>>> drivers/devfreq/exynos-bus.c | 14 +++++++++++--- >>>>> 1 file changed, 11 insertions(+), 3 deletions(-) >>>>> >>>>> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c >>>>> index c832673273a2..37bd34d5625b 100644 >>>>> --- a/drivers/devfreq/exynos-bus.c >>>>> +++ b/drivers/devfreq/exynos-bus.c >>>>> @@ -243,7 +243,7 @@ static int exynos_bus_parse_of(struct device_node *np, >>>>> { >>>>> struct device *dev = bus->dev; >>>>> struct dev_pm_opp *opp; >>>>> - unsigned long rate; >>>>> + unsigned long rate, opp_rate; >>>>> int ret; >>>>> >>>>> /* Get the clock to provide each bus with source clock */ >>>>> @@ -267,13 +267,21 @@ static int exynos_bus_parse_of(struct device_node *np, >>>>> } >>>>> >>>>> rate = clk_get_rate(bus->clk); >>>>> - >>>>> - opp = devfreq_recommended_opp(dev, &rate, 0); >>>>> + opp_rate = rate; >>>>> + opp = devfreq_recommended_opp(dev, &opp_rate, 0); >>>>> if (IS_ERR(opp)) { >>>>> dev_err(dev, "failed to find dev_pm_opp\n"); >>>>> ret = PTR_ERR(opp); >>>>> goto err_opp; >>>>> } >>>>> + /* >>>>> + * FIXME: U-boot leaves clock source at incorrect PLL, this results >>>>> + * in clock rate outside defined OPP rate. Work around this bug by >>>>> + * setting clock rate to recommended one. >>>>> + */ >>>>> + if (rate > opp_rate) >>>>> + clk_set_rate(bus->clk, opp_rate); >>>>> + >>>>> bus->curr_freq = dev_pm_opp_get_freq(opp); >>>>> dev_pm_opp_put(opp); >>>>> >>>>> >>>> >>> Best regards >>> >> >> > -- Best Regards, Chanwoo Choi Samsung Electronics