Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5684570ybp; Tue, 8 Oct 2019 06:53:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwihY1fFWWibPExGcgt63lawzjHyjrP1IhCNEaxiyo59oA4z0cybuWIASHTNDmQWLK6THg0 X-Received: by 2002:a50:baa5:: with SMTP id x34mr35053447ede.148.1570542788637; Tue, 08 Oct 2019 06:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570542788; cv=none; d=google.com; s=arc-20160816; b=daICPoMVBK6AePzRXyhNlhJdIATQJlb5lAwIhsYEZgFT8t9w5yGbkoUxjjrF/4Kbl8 SIHFried/4i8zJqqTPTx5xK+czNF3dF/M6nubs94Fw/U+jM3s2qLrrxEQTw80e+0oEIG +iNUw7d2nOYIC+Tn1yLoL79LTMZ1fFl9BotPoXpLR4QFxa18zrImEMeuSbJJQ9uhTqTU ArphalOYhBzhNs0AL3s/0IoFotq/ZZm3xQpaHAK+4KL/2JrUBiqRWMfg19I9TwAzThqo OYzaOejkH4Ddqqj29L/GaQcWfOScnYPFwCT5BUlDWc+a1QHW/h165HrYZDzn+dDuTLcu KKdA== 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-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:dkim-filter; bh=L6jrGOKBnyfCH0sLXoEEAMCWGWvKLLesnLO7aFiGlP0=; b=XUVh3emrc870xNEjFIe/G45lLnalR3sF1H8rWwZh4hFvbyZgMyBhsglxl+uyKTqMT/ gmcBpohklSziSb4D4oFXzjrOv7BfNt8RbYPa49vtOaTL2P3JXp83eBjXkee+AAZ1XvtE wkHC4wn+DZqxe7bdp/Z8kWLD2kNH2ugk9Icvi46tq9ue02YmDA5hUJ26P1HZjNHp0Z/9 DZw7EkTj72sx93UoRj+UfgVARBIY91vDys11G5nj7YrGjxuWzRqAO1QdCcV6V9uwCzqF nvOgxoQkFIeyoahsiM5Tequ+KtNL66xnml3M3h01pe+6c5xUCHUXM2b/mAwnDMzcBTVs 5euQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=PTBVEb+x; 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 t37si11827961edd.25.2019.10.08.06.52.44; Tue, 08 Oct 2019 06:53:08 -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=PTBVEb+x; 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 S1726109AbfJHNtx (ORCPT + 99 others); Tue, 8 Oct 2019 09:49:53 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:52187 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbfJHNtx (ORCPT ); Tue, 8 Oct 2019 09:49:53 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20191008134951euoutp017d722acd61ceeaf865774692b2c2caed~LsCp-21m81308513085euoutp01U for ; Tue, 8 Oct 2019 13:49:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20191008134951euoutp017d722acd61ceeaf865774692b2c2caed~LsCp-21m81308513085euoutp01U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1570542591; bh=L6jrGOKBnyfCH0sLXoEEAMCWGWvKLLesnLO7aFiGlP0=; h=From:To:Cc:Subject:Date:References:From; b=PTBVEb+xkHqR5ME9pH119lRq/Ei202LrebfL8/M76gAWQ/IYq4Y+MNI8ym9LszFwq aHDloHS9AVRT8A9MXNesyCC/nw7CnDRXhH3Ya7mqA+k28xeUz48TKgbaLfOpXmHqtp Mzn5cz7qgN1W65EBkZf/n003Wy4k137YW42YBJ6U= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20191008134951eucas1p2e647b9672cc01a735fe27b502c9d3f03~LsCpqTaP71989419894eucas1p2o; Tue, 8 Oct 2019 13:49:51 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id B1.86.04374.FF39C9D5; Tue, 8 Oct 2019 14:49:51 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191008134950eucas1p15cfef5800efc10d5b18ec5eb37dde60b~LsCpSvYXp2879228792eucas1p1W; Tue, 8 Oct 2019 13:49:50 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191008134950eusmtrp1f4a5410a8e962016417ab111bb505d5c~LsCpSBZgO0486604866eusmtrp1B; Tue, 8 Oct 2019 13:49:50 +0000 (GMT) X-AuditID: cbfec7f5-4ddff70000001116-84-5d9c93ff4962 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 91.7C.04166.EF39C9D5; Tue, 8 Oct 2019 14:49:50 +0100 (BST) Received: from AMDC3218.digital.local (unknown [106.120.51.18]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191008134950eusmtip296671187e8381e8e1458f31035479996~LsCov6rwO0868008680eusmtip2B; Tue, 8 Oct 2019 13:49:50 +0000 (GMT) From: k.konieczny@partner.samsung.com To: k.konieczny@partner.samsung.com Cc: Bartlomiej Zolnierkiewicz , Marek Szyprowski , Chanwoo Choi , 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 Subject: [PATCH] devfreq: exynos-bus: workaround dev_pm_opp_set_rate() errors on Exynos5422/5800 SoCs Date: Tue, 8 Oct 2019 15:49:23 +0200 Message-Id: <20191008134923.30123-1-k.konieczny@partner.samsung.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGKsWRmVeSWpSXmKPExsWy7djP87r/J8+JNdj/m99i44z1rBbXvzxn tejb95/Rov/xa2aL8+c3sFucbXrDbrHp8TVWi8u75rBZfO49wmgx4/w+Jou1R+6yW9xuXMHm wOOxaVUnm8fmJfUeB9/tYfLo27KK0ePzJrkA1igum5TUnMyy1CJ9uwSujFcHPjIXbBeqmDX1 IlMD40L+LkZODgkBE4kTK9YydzFycQgJrGCUmD77HBuE84VRYsbv/awQzmdGiedL77PAtDSt 3w6VWM4o8WXCa1a4lnv7JrKBVLEJqEpsmfGSHcQWEVCWmHxvOtgSZoENzBLdiw8zgiSEBdIl 3rzsYgKxWYAaVrxZwwxi8wq4SNxevg6omQNonbzE4UNZEGFBiZMzn4BdwQwUbt46G2ymhMB0 dokfpx6yQtS7SExvN4a4VFji1fEt7BC2jMTpyT1QH5RLPF3Yxw7R28Io8aD9I1TCWuLw8Ytg c5gFNCXW79KHCDtKvL1/mRFiPJ/EjbeCECfwSUzaBvIWSJhXoqNNCKJaVeL5qR4mCFtaouv/ OlYI20NiTe8qsGuEBGIl1j3qZJ/AqDALyW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s9M55aabaDsmNrGWebgu3Mm j7yOya3761/elZc39/2qFZc5yYeL5b748sfyF6cc9FKw3f3sCfNefrn6kt+pitFW+1ueVebn nP7rz6Fm4707sMrp0kKWwPMntE6tT1P9cK1GLUPnj8SVbiWW4oxEQy3mouJEAGOxeLKgAgAA X-CMS-MailID: 20191008134950eucas1p15cfef5800efc10d5b18ec5eb37dde60b 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: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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); -- 2.23.0