Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp794745ybp; Fri, 11 Oct 2019 04:36:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFOHiZPt9gJlofVYVjyuMFKLTReQEKVkTOp5MhJOh1VrAGE1whUpp/2VBKmtkjRuowhoPi X-Received: by 2002:a50:f395:: with SMTP id g21mr12689700edm.223.1570793767225; Fri, 11 Oct 2019 04:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570793767; cv=none; d=google.com; s=arc-20160816; b=GnsApg5lVpD+rA1+j3n4DmQ9JiU5Kp+qamLvzICSRjxKFGCcGipkg10QWubdZLL9Er 07weGafEQv9qRz5AkJUGVb+W+pjNfMefRRwV6HmzXePF2eGJAhqIDema4UaYrfzDZQ0M y/SCXwY2UAahDZdf57FsW1CiFnMKG2nXzQXCjp51f50fSP9Geh6N0rtP4K0buBuN39tf oSmkVfObeCiGA9bahG3KxyIwr71wq8JcC5jFs8t/VUKNV2abUwBUKA2dtzKRXPQjIt4x T7LPzcf+RLG/zye245q8SGJEHwl4B6vqDXh68pFqMhA8wgEinW9HtAOiMzCgmVAvs3IH hQMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=4ZYRzf6XeFviC24JG3kc+6eo4xAoGOrUhYOqB4a0MZc=; b=L0HF5uOAMzlcnwUKxmBqYMm5aa/HPv9CZhZL0gSvCJKI2dn8NI5xFELHS2tR29YXFW 7aph7qVBak7axNFUzQ0uVLQgpVq0Z9OHbpIGLcDEypRGsrCCqeZmjDJr51GCA8xen+p5 eBTLOULHsd+iPOJm/Wh456g/cOQzwQUyKMDNBUtqrCtmaOZ9awqmUwUczu6nwgbPaZZn tpGNg780AfboZipchX3wCNIIDni+NYXmxlDyCerxocSU4sGMLVT665hhQYgM1CMsAg3h W2WouC+In0lDY4EWwPqJkKVw7KFAw4RWi7rlpDIvJPlOxqHH/vt5SigbcGKsbNipHF/o W9hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=AXVdnsFS; 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 g18si5262872edq.209.2019.10.11.04.35.43; Fri, 11 Oct 2019 04:36:06 -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=@samsung.com header.s=mail20170921 header.b=AXVdnsFS; 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 S1727891AbfJKLd5 (ORCPT + 99 others); Fri, 11 Oct 2019 07:33:57 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:49125 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727198AbfJKLd5 (ORCPT ); Fri, 11 Oct 2019 07:33:57 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20191011113355euoutp01eef7edc2737ae290c01fa5a19a84e7bc~MlH0YCinx0779907799euoutp01M for ; Fri, 11 Oct 2019 11:33:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20191011113355euoutp01eef7edc2737ae290c01fa5a19a84e7bc~MlH0YCinx0779907799euoutp01M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1570793635; bh=4ZYRzf6XeFviC24JG3kc+6eo4xAoGOrUhYOqB4a0MZc=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=AXVdnsFS+UnP18yoy2NrwZ4s+czvJHklYPMz9cA3QL1qSh3DFSTF0py5ncO4lIroR ePxxM5LCUVBNmx84kXEgV+30KVU54eWpJp8vQS4KiWhknyvDN7mPuGCJ0SoP1K/BuC ejyGLdWpZogtAEgIebD29Q4xZCjNQ8aY14ggSaL4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20191011113354eucas1p14d4a819a030bba87cbecc0a6f4bb24f2~MlH0BB75m1526815268eucas1p16; Fri, 11 Oct 2019 11:33:54 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 7A.62.04374.2A860AD5; Fri, 11 Oct 2019 12:33:54 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20191011113354eucas1p219e79f62d780540027a1350ea3a016ea~MlHzrtVVx0387903879eucas1p2G; Fri, 11 Oct 2019 11:33:54 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20191011113354eusmtrp2deb37900f27cecd2eded4d8c644dd6ba~MlHzrEwdA0746607466eusmtrp2g; Fri, 11 Oct 2019 11:33:54 +0000 (GMT) X-AuditID: cbfec7f5-4ddff70000001116-93-5da068a2d7ba Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 64.A3.04117.2A860AD5; Fri, 11 Oct 2019 12:33:54 +0100 (BST) Received: from [106.120.51.15] (unknown [106.120.51.15]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20191011113353eusmtip1e76cf8e6c1eea71f16851db13000461b~MlHzEpiRd3093230932eusmtip15; Fri, 11 Oct 2019 11:33:53 +0000 (GMT) Subject: Re: [PATCH] devfreq: exynos-bus: workaround dev_pm_opp_set_rate() errors on Exynos5422/5800 SoCs To: Chanwoo Choi , 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: Marek Szyprowski Message-ID: <0ce56e65-d989-18f8-af84-2fbd74ba20aa@samsung.com> Date: Fri, 11 Oct 2019 13:33:53 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <4f14d3af-e455-d05b-fc03-cba58e001f41@samsung.com> Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPKsWRmVeSWpSXmKPExsWy7djP87qLMhbEGrycrWKxccZ6VovrX56z WvTt+89o0f/4NbPF+fMb2C3ONr1ht9j0+BqrxeVdc9gsPvceYbSYcX4fk8XtxhVsDtwem1Z1 snlsXlLvcfDdHiaPvi2rGD0+b5ILYI3isklJzcksSy3St0vgyjg8dSNjwSq5it73P5gbGM9L dDFyckgImEjcuPGSrYuRi0NIYAWjxIFd/cwQzhdGibXt5xkhnM+MEg93nWOEaWlb+YcJIrEc qOrWWmaQhJDAW0aJZf8sQWxhgWyJb6eXgcVFBDwl/n6YwwLSwCxwm0mi99MvFpAEm4ChRNfb LjYQm1fATmLp7k9MIDaLgKpE65Hf7CC2qECsxL0fx5khagQlTs58AtbLKWAv8aPpEFg9s4C8 RPPW2cwQtrjErSfzwa6TELjELnH+wmaos10kWk/1M0HYwhKvjm9hh7BlJP7vhGlo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c8sOxq53wYcY BTgYlXh4Z8jPjxViTSwrrsw9xCjBwawkwrto1pxYId6UxMqq1KL8+KLSnNTiQ4ymQL9NZJYS Tc4HJo68knhDU0NzC0tDc2NzYzMLJXHeDoGDMUIC6YklqdmpqQWpRTB9TBycUg2Mh082Vy59 HWMUWpPRlPXXqMqwNW6vVfM8h0OTGLkj7KMiN//wl6uKvr9q6YdFWT3zTYvY5KSC7yzJNvEM OVP36vnju0qmh9ZZNW2ZbqnlNpfz+0G+26w+/TKR7VWMXr5PSo88MfZTlxHZXDNn1rlDoSn/ zZxP6Mr8YDL5aX7YNf2q8lW2a8+VWIozEg21mIuKEwF9HHsT5AIAAA== X-CMS-MailID: 20191011113354eucas1p219e79f62d780540027a1350ea3a016ea X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20191008134950eucas1p15cfef5800efc10d5b18ec5eb37dde60b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191008134950eucas1p15cfef5800efc10d5b18ec5eb37dde60b References: <20191008134923.30123-1-k.konieczny@partner.samsung.com> <4f14d3af-e455-d05b-fc03-cba58e001f41@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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://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. 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 -- Marek Szyprowski, PhD Samsung R&D Institute Poland